Bump vendored T3 Code to 42c9107983 (v0.1.12-nightly) and catch up
- vendor/t3code submodule pinned to 42c9107983; deps in package.json aligned with the upstream catalog, including upstream's effect@4.1.5 patch via patchedDependencies (patches/effect@4.1.5.patch) - nix flake.nix devShell provides bun locally (no guix home install) - scripts/link-vendor.ts now copies the vendored packages into node_modules/@t3tools and applies tscPatches for the spots where classic tsc can't infer what upstream's Effect language service can, so `bun run typecheck` runs clean under full strict mode - protocol drift fixes across model/ui/client: usage-limit copy, context window snapshot, checkpoint totals, turn diff summaries, alert observation, "once" schedules, composer trigger kinds, PR keying, thread menu state, secret request answers, terminal summaries, snapshot-required shell events, revert checkpoint lookup - new parity features over the typed RPC: fork a turn into a new thread, rewind a message with its attachments restored to the composer, guest share links and turn-into-project in the thread menu - tests updated and added (301 pass); typecheck, lint and build clean Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
1 parent
3a93c35c41
commit
b40f09e56f
38 files changed
+4786
-63
No files matched your search
@@ -180,6 +180,51 @@ describe("a finished turn", () => {
|
||||
// The date half is locale- and timezone-shaped; the model and duration are not.
|
||||
expect(app.frame()).toMatch(/gpt-5\.4 · 3m 12s · /);
|
||||
});
|
||||
|
||||
test("forking a turn dispatches thread.fork and opens the new thread", async () => {
|
||||
const app = await open({ session: fakeSession({ projection: withCompletedTurn(), results: { forkThread: "thread-fork-1" } }) });
|
||||
await app.press("]");
|
||||
await app.press("k", { ctrl: true });
|
||||
await app.type("fork from this turn");
|
||||
await app.press("return");
|
||||
await app.settle(50);
|
||||
expect(app.calls("forkThread").map((call) => call.args[0])).toEqual([{ sourceThreadId: v2ThreadId, runId: "run-1", title: "Thread fork" }]);
|
||||
});
|
||||
|
||||
test("rewinding a message with attachments puts the prompt and the attachments back", async () => {
|
||||
const attachment = { type: "image", id: "att-1", name: "shot.png", mimeType: "image/png", sizeBytes: 3 };
|
||||
const projection = structuredClone(withCompletedTurn()) as unknown as {
|
||||
messages: { attachments: unknown }[];
|
||||
turnItems: { type: string; attachments: unknown }[];
|
||||
visibleTurnItems: { item: { type?: string; attachments: unknown } }[];
|
||||
thread: Record<string, unknown>;
|
||||
checkpoints: Record<string, unknown>[];
|
||||
providerThreads: unknown[];
|
||||
};
|
||||
projection.messages[0]!.attachments = [attachment];
|
||||
projection.turnItems.find((item) => item.type === "user_message")!.attachments = [attachment];
|
||||
for (const visible of projection.visibleTurnItems) if (visible.item.type === "user_message") visible.item.attachments = [attachment];
|
||||
// A thread-start checkpoint and a provider thread make turn 0 rewindable.
|
||||
projection.thread.activeProviderThreadId = "pt-1";
|
||||
projection.providerThreads = [{ id: "pt-1", providerSessionId: "ps-1", providerInstanceId: "codex" }];
|
||||
projection.checkpoints.unshift({ id: "checkpoint-0", threadId: projection.thread.id, scopeId: "scope-1", runId: null, nodeId: null, parentCheckpointId: null, ordinalWithinScope: 0, appRunOrdinal: null, ref: "refs/t3/checkpoint-0", status: "ready", files: [], capturedAt: projection.checkpoints[0]!.capturedAt });
|
||||
const serverConfig = { providers: [{ instanceId: "codex", driver: "codex", enabled: true, auth: { status: "authenticated" }, models: [] }], settings: {}, environment: { capabilities: {} } };
|
||||
const app = await open({
|
||||
session: fakeSession({
|
||||
projection: projection as unknown as OrchestrationV2ThreadProjection,
|
||||
serverConfig,
|
||||
results: { attachmentImage: new Uint8Array([1, 2, 3]), uploadAttachment: { type: "image", id: "att-new", name: "shot.png", mimeType: "image/png", sizeBytes: 3 } },
|
||||
}),
|
||||
});
|
||||
await app.press("]");
|
||||
await app.press("R");
|
||||
await app.settle(30);
|
||||
await app.press("return");
|
||||
await app.settle(80);
|
||||
expect(app.calls("rewind")).toHaveLength(1);
|
||||
expect(app.calls("uploadAttachment").map((call) => call.args[0])).toEqual([{ type: "image", name: "shot.png", mimeType: "image/png", sizeBytes: 3 }]);
|
||||
expect(app.hints()).toBe("Restored 1 attachment");
|
||||
});
|
||||
});
|
||||
|
||||
describe("live status", () => {
|
||||
|
||||
@@ -247,7 +247,7 @@ describe("acting on a file", () => {
|
||||
await prefix(app, "k");
|
||||
await app.press("i");
|
||||
await app.press("return");
|
||||
expect(app.calls("sendMessage")[0]?.args[1]).toBe("[src](src) [debug.log](debug.log)");
|
||||
expect(app.calls("sendMessage")[0]?.args[1]).toBe("[src](./src) [debug.log](debug.log)");
|
||||
});
|
||||
|
||||
test("y copies the path", async () => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { testRender } from "@opentui/react/test-utils";
|
||||
import { createMockKeys, type KeyInput } from "@opentui/core/testing";
|
||||
import type { OrchestrationV2ShellSnapshot, OrchestrationV2ThreadProjection, ThreadId } from "@t3tools/contracts";
|
||||
import { RunId, type OrchestrationV2ShellSnapshot, type OrchestrationV2ThreadProjection, type ThreadId } from "@t3tools/contracts";
|
||||
|
||||
import type { ConnectionStatus, T3Session } from "../../src/client/session.ts";
|
||||
import { DEFAULT_CONFIG, type T3tuiConfig } from "../../src/config.ts";
|
||||
@@ -52,7 +52,11 @@ export function fakeSession(
|
||||
) {
|
||||
const calls: Call[] = [];
|
||||
const threadListeners = new Set<(value: unknown) => void>();
|
||||
const snapshot = state.snapshot ?? v2ShellSnapshot;
|
||||
// The default thread has a finished run, as upstream's menu tests assume: "Mark unread"
|
||||
// only shows once the latest run completed.
|
||||
const snapshot =
|
||||
state.snapshot ??
|
||||
({ ...v2ShellSnapshot, threads: v2ShellSnapshot.threads.map((thread) => ({ ...thread, latestRunId: RunId.make("run-v2") })) } as OrchestrationV2ShellSnapshot);
|
||||
const projection = state.projection ?? v2Projection;
|
||||
const live = <T,>(value: T) => (listener: (value: T) => void) => {
|
||||
listener(value);
|
||||
|
||||
@@ -150,7 +150,7 @@ describe("threadDetails", () => {
|
||||
test("shows the run state, the context window left and the provider's limits", () => {
|
||||
const projection = { ...v2Projection, providerTurns: [{ tokenUsage: { usedTokens: 62_000, maxTokens: 100_000, updatedAt: "2026-06-20T00:00:00.000Z" } }] } as unknown as OrchestrationV2ThreadProjection;
|
||||
const serverConfig = {
|
||||
providers: [{ instanceId: "codex", driver: "codex", enabled: true, usageLimits: { checkedAt: "2026-06-20T00:00:00.000Z", windows: [{ id: "5h", kind: "session", label: "5h", usedPercent: 39 }, { id: "week", kind: "weekly", label: "week", usedPercent: 95 }] } }],
|
||||
providers: [{ instanceId: "codex", driver: "codex", enabled: true, auth: { status: "authenticated" }, usageLimits: { checkedAt: "2026-06-20T00:00:00.000Z", windows: [{ id: "5h", kind: "session", label: "5h", usedPercent: 39 }, { id: "week", kind: "weekly", label: "week", usedPercent: 95 }] } }],
|
||||
};
|
||||
const details = detailsOf(thread({ status: "running", activeRunId: "run-1", latestRunId: "run-1" }), null, null, { projection, serverConfig } as never);
|
||||
expect(details.context).toEqual({ left: 38, used: "62k" });
|
||||
|
||||
+17
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { OrchestrationV2Command, ThreadId, type OrchestrationV2ShellSnapshot, type OrchestrationV2ThreadShell, type ServerConfig } from "@t3tools/contracts";
|
||||
import { OrchestrationV2Command, RunId, ThreadId, type OrchestrationProjectShell, type OrchestrationV2ShellSnapshot, type OrchestrationV2ThreadShell, type ServerConfig } from "@t3tools/contracts";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Schema from "effect/Schema";
|
||||
|
||||
@@ -99,6 +99,7 @@ describe("thread menu", () => {
|
||||
await session.reorderThread(id, "pinned", "m");
|
||||
await session.reorderThread(id, "active", "t");
|
||||
await session.deleteThread(id, false);
|
||||
await session.forkThread({ sourceThreadId: id, runId: RunId.make("run-1"), title: "Thread fork" });
|
||||
expect(sent.filter((command) => !Schema.is(OrchestrationV2Command)(command))).toEqual([]);
|
||||
expect(sent.map((command) => (command as { type: string }).type)).toEqual([
|
||||
"thread.settle",
|
||||
@@ -116,6 +117,21 @@ describe("thread menu", () => {
|
||||
"thread.pin.reorder",
|
||||
"thread.active.reorder",
|
||||
"thread.delete",
|
||||
"thread.fork",
|
||||
]);
|
||||
});
|
||||
|
||||
test("guest sharing shows only when the server's Labs beta is on", () => {
|
||||
const guestConfig = { ...config, settings: { guestSharingEnabled: true } } as unknown as ServerConfig;
|
||||
expect(ids(threadMenu({ thread, config: guestConfig, timestampFormat: "24-hour" }).items)).toContain("share-guest");
|
||||
expect(ids(threadMenu({ thread, config, timestampFormat: "24-hour" }).items)).not.toContain("share-guest");
|
||||
});
|
||||
|
||||
test("a scratch thread with its own folder can turn into a project when the server allows it", () => {
|
||||
const scratch = { ...thread, worktreePath: "/tmp/scratch" } as unknown as OrchestrationV2ThreadShell;
|
||||
const capConfig = { ...config, scratchWorkspaceRoot: "/tmp/scratch", environment: { environmentId: "env-1", capabilities: { threadProjectFromScratch: true } } } as unknown as ServerConfig;
|
||||
const projects = [{ id: "p1", workspaceRoot: "/tmp/scratch" }] as unknown as OrchestrationProjectShell[];
|
||||
expect(ids(threadMenu({ thread: scratch, config: capConfig, timestampFormat: "24-hour", projects }).items)).toContain("turn-into-project");
|
||||
expect(ids(threadMenu({ thread, config, timestampFormat: "24-hour", projects }).items)).not.toContain("turn-into-project");
|
||||
});
|
||||
});
|
||||
+1
-1
@@ -33,7 +33,7 @@ describe("turn cursor and checkpoint targets", () => {
|
||||
test("rewinds before the prompt, using visible predecessors across ordinal gaps", () => {
|
||||
const turns = turnTargets(projection(), entries(), null, true);
|
||||
expect(turns.map((turn) => turn.revertTurnCount)).toEqual([0, 1, 2]);
|
||||
expect(findRevertCheckpoint(projection().checkpoints, turns[2]!.revertTurnCount!)?.id).toBe(CheckpointId.make("cp-2"));
|
||||
expect(findRevertCheckpoint(projection(), turns[2]!.revertTurnCount!)?.id).toBe(CheckpointId.make("cp-2"));
|
||||
});
|
||||
test("does not mistake the first message in paged history for the thread start", () => {
|
||||
const turns = turnTargets(projection(), entries().slice(1), null, false);
|
||||
|
||||
@@ -39,8 +39,8 @@ describe("workspace logic", () => {
|
||||
});
|
||||
|
||||
test("branch selection reuses worktrees and returns the default branch to the project", () => {
|
||||
expect(resolveBranchSelectionTarget({ activeProjectCwd: "/repo", activeWorktreePath: "/old", refName: { isDefault: false, worktreePath: "/existing" } })).toEqual({ checkoutCwd: "/existing", nextWorktreePath: "/existing", reuseExistingWorktree: true });
|
||||
expect(resolveBranchSelectionTarget({ activeProjectCwd: "/repo", activeWorktreePath: "/old", refName: { isDefault: true, worktreePath: null } })).toEqual({ checkoutCwd: "/repo", nextWorktreePath: null, reuseExistingWorktree: false });
|
||||
expect(resolveBranchSelectionTarget({ activeProjectCwd: "/repo", activeWorktreePath: "/old", refName: { isDefault: false, worktreePath: "/existing" } })).toEqual({ checkoutCwd: "/existing", nextWorktreePath: "/existing", reuseExistingWorktree: true, staysInActiveCheckout: false });
|
||||
expect(resolveBranchSelectionTarget({ activeProjectCwd: "/repo", activeWorktreePath: "/old", refName: { isDefault: true, worktreePath: null } })).toEqual({ checkoutCwd: "/repo", nextWorktreePath: null, reuseExistingWorktree: false, staysInActiveCheckout: false });
|
||||
});
|
||||
|
||||
test("setup progress names the web's stage, percent, details and failures", () => {
|
||||
|
||||
Reference in new issue
Block a user