diff --git a/apps/mobile/src/features/threads/ChildThreadApprovals.tsx b/apps/mobile/src/features/threads/ChildThreadApprovals.tsx index 11265a64d47f6..392d185e9afd4 100644 --- a/apps/mobile/src/features/threads/ChildThreadApprovals.tsx +++ b/apps/mobile/src/features/threads/ChildThreadApprovals.tsx @@ -1,9 +1,6 @@ import { useAtomValue } from "@effect/atom-react"; import { AuthOrchestrationOperateScope, type ScopedThreadRef } from "@t3tools/contracts"; -import type { - ChildThreadApproval, - ChildThreadSecretRequest, -} from "@t3tools/client-runtime/state/thread-requests"; +import type { ChildThreadApproval } from "@t3tools/client-runtime/state/thread-requests"; import { isAtomCommandInterrupted, squashAtomCommandFailure, @@ -13,15 +10,9 @@ import { useEnvironmentScope } from "../../state/session"; import { ScrollView, View } from "react-native"; import Animated, { useAnimatedStyle, type DerivedValue } from "react-native-reanimated"; import { AppText } from "../../components/ui/AppText"; -import { useUniwindTheme } from "../../lib/useUniwindTheme"; -import { - childThreadApprovalsAtom, - childThreadSecretRequestsAtom, - threadEnvironment, -} from "../../state/threads"; +import { childThreadApprovalsAtom, threadEnvironment } from "../../state/threads"; import { useAtomCommand } from "../../state/use-atom-command"; import { PendingApprovalCard } from "./PendingApprovalCard"; -import { SecretRequestCard } from "./SecretRequestCard"; function ChildApproval({ entry }: { entry: ChildThreadApproval }) { const canRespond = useEnvironmentScope(entry.thread.environmentId, AuthOrchestrationOperateScope); @@ -68,20 +59,6 @@ function ChildApproval({ entry }: { entry: ChildThreadApproval }) { ); } -function ChildSecret({ entry }: { entry: ChildThreadSecretRequest }) { - const iconColor = useUniwindTheme()["--color-icon-subtle"]; - return ( - - Secret from {entry.title} - - - ); -} - export function ChildThreadApprovals({ threadRef, maxHeight, @@ -90,18 +67,11 @@ export function ChildThreadApprovals({ maxHeight: DerivedValue; }) { const approvals = useAtomValue(childThreadApprovalsAtom(threadRef)); - const secrets = useAtomValue(childThreadSecretRequestsAtom(threadRef)); const heightStyle = useAnimatedStyle(() => ({ maxHeight: Math.min(320, maxHeight.value / 2) })); - if (approvals.length === 0 && secrets.length === 0) return null; + if (approvals.length === 0) return null; return ( - {secrets.map((entry) => ( - - ))} {approvals.map((entry) => ( ; + readonly projectedItem: OrchestrationV2ProjectedTurnItem; readonly iconColor: ColorValue; }) { const { item, visibility } = props.projectedItem; diff --git a/apps/mobile/src/state/threads.ts b/apps/mobile/src/state/threads.ts index 8b13d876e89dc..a3b2f2f59e069 100644 --- a/apps/mobile/src/state/threads.ts +++ b/apps/mobile/src/state/threads.ts @@ -1,7 +1,4 @@ -import { - createChildThreadApprovalsAtom, - createChildThreadSecretRequestsAtom, -} from "@t3tools/client-runtime/state/thread-requests"; +import { createChildThreadApprovalsAtom } from "@t3tools/client-runtime/state/thread-requests"; import { useAtomValue } from "@effect/atom-react"; import { createSandboxStartQueueAtoms } from "@t3tools/client-runtime/state/sandbox-mirror"; import { @@ -77,10 +74,6 @@ export const childThreadApprovalsAtom = createChildThreadApprovalsAtom({ childThreadInputsAtom: environmentThreadShells.childThreadInputsAtom, pendingRequestsAtom: environmentThreadDetails.pendingRequestsAtom, }); -export const childThreadSecretRequestsAtom = createChildThreadSecretRequestsAtom({ - childThreadInputsAtom: environmentThreadShells.childThreadInputsAtom, - visibleTurnItemsAtom: environmentThreadDetails.visibleTurnItemsAtom, -}); // Long enough for the opened screen to subscribe; its subscription keeps the thread after this. const OPENING_THREAD_HOLD_MS = 3_000; diff --git a/apps/server/src/mcp/OrchestratorMcpService.ts b/apps/server/src/mcp/OrchestratorMcpService.ts index 566474b31ac4f..614ecedfab105 100644 --- a/apps/server/src/mcp/OrchestratorMcpService.ts +++ b/apps/server/src/mcp/OrchestratorMcpService.ts @@ -2834,7 +2834,6 @@ const make = Effect.gen(function* () { parentNodeId: parentRun.rootNodeId, task: taskPrompt(input), ...(input.title === undefined ? {} : { title: input.title }), - ...(input.group === undefined ? {} : { group: input.group }), modelSelection: target.modelSelection, runtimeMode, interactionMode, diff --git a/apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts b/apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts index 00ba698390b04..2ec6e939927e4 100644 --- a/apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts +++ b/apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts @@ -359,7 +359,6 @@ describe("orchestrator MCP toolkit", () => { providerInstanceId: codexInstanceId, model: codexModel, }, - group: "Backend", mode: "async", clientRequestId: "delegate-codex-replay-1", }); @@ -466,11 +465,6 @@ describe("orchestrator MCP toolkit", () => { ); expect(followupTasks).toHaveLength(2); expect(followupTasks.every((task) => task.result === null)).toBe(true); - const parentNow = yield* orchestrator.getThreadProjection(parentThreadId); - expect(parentNow.subagents.find((task) => task.id === delegated.taskId)).toMatchObject({ - group: "Backend", - }); - expect(followupTasks.map((task) => task.group)).toEqual(["Backend", "Backend"]); expect(followupTasks.map((task) => task.id)).toEqual([ runningFollowup.taskId, queuedFollowup.taskId, diff --git a/apps/server/src/orchestration-v2/Orchestrator.ts b/apps/server/src/orchestration-v2/Orchestrator.ts index b73a7e8d1ea45..85fe3d97ab63e 100644 --- a/apps/server/src/orchestration-v2/Orchestrator.ts +++ b/apps/server/src/orchestration-v2/Orchestrator.ts @@ -9515,7 +9515,6 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio nativeTaskRef: null, prompt: command.task, title: command.title ?? null, - ...(command.group === undefined ? {} : { group: command.group }), model: command.modelSelection.model, modelSelection: command.modelSelection, ...(command.completionWake === undefined ? {} : { completionWake: command.completionWake }), @@ -9979,7 +9978,6 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio nativeTaskRef: null, prompt: command.task, title: command.title ?? null, - ...(command.group === undefined ? {} : { group: command.group }), model: command.modelSelection.model, modelSelection: command.modelSelection, ...(command.completionWake === undefined ? {} : { completionWake: command.completionWake }), diff --git a/apps/server/src/orchestration-v2/ProjectionStore.test.ts b/apps/server/src/orchestration-v2/ProjectionStore.test.ts index 691e9ee382ac0..b961ef1e0dc34 100644 --- a/apps/server/src/orchestration-v2/ProjectionStore.test.ts +++ b/apps/server/src/orchestration-v2/ProjectionStore.test.ts @@ -9350,139 +9350,6 @@ it.layer(layerTest)("ProjectionStoreV2", (it) => { }), ); - it.effect("shells carry the latest tool action, from the list and from the projection", () => - Effect.gen(function* () { - const projectionStore = yield* ProjectionStore.ProjectionStoreV2; - const sql = yield* SqlClient.SqlClient; - const suffix = "shell-latest-action"; - const threadId = yield* addRolledBackRecoveryCandidate(suffix); - const runId = RunId.make(`run:${suffix}:live`); - const nodeId = NodeId.make(`node:${suffix}:live`); - const now = yield* DateTime.now; - yield* projectionStore.apply({ - id: EventId.make(`event:${suffix}:live-run`), - type: "run.created", - threadId, - runId, - nodeId, - driver, - providerInstanceId, - occurredAt: now, - payload: { - id: runId, - threadId, - ordinal: 2, - providerInstanceId, - modelSelection, - providerThreadId: null, - userMessageId: MessageId.make(`message:${suffix}:live`), - rootNodeId: nodeId, - activeAttemptId: null, - status: "running", - requestedAt: now, - startedAt: now, - completedAt: null, - checkpointId: null, - contextHandoffId: null, - }, - }); - const base = { - threadId, - runId, - nodeId, - providerThreadId: null, - providerTurnId: null, - nativeItemRef: null, - parentItemId: null, - status: "running" as const, - title: null, - completedAt: null, - }; - const addItem = ( - id: string, - ordinal: number, - item: - | { readonly type: "command_execution"; readonly input: string; readonly output?: string } - | { readonly type: "file_change"; readonly fileName: string; readonly diffStr?: string } - | { readonly type: "reasoning"; readonly text: string; readonly streaming: boolean }, - ) => - projectionStore.apply({ - id: EventId.make(`event:${suffix}:${id}`), - type: "turn-item.updated", - threadId, - runId, - nodeId, - driver, - occurredAt: now, - payload: { - ...base, - ...item, - id: TurnItemId.make(`item:${suffix}:${id}`), - ordinal, - startedAt: DateTime.add(now, { seconds: ordinal }), - updatedAt: DateTime.add(now, { seconds: ordinal + 30 }), - }, - }); - const latestActions = Effect.gen(function* () { - const listed = (yield* projectionStore.getShellSnapshot()).threads.find( - (thread) => thread.id === threadId, - ); - const projected = ProjectionStore.threadShellFromProjection( - yield* projectionStore.getThreadProjection(threadId), - ); - return [listed?.latestAction, projected.latestAction]; - }); - - // Only the rolled-back run's command so far. - assert.deepEqual(yield* latestActions, [null, null]); - - yield* addItem("command", 2, { - type: "command_execution", - input: "pnpm test", - output: "x".repeat(4096), - }); - const ranCommand = { - summary: "Ran command", - detail: "pnpm test", - at: DateTime.add(now, { seconds: 2 }), - }; - assert.deepEqual(yield* latestActions, [ranCommand, ranCommand]); - - yield* addItem("edit", 3, { - type: "file_change", - fileName: "src/auth/session.ts", - diffStr: "+".repeat(4096), - }); - const changedFile = { - summary: "Changed files", - detail: "src/auth/session.ts", - at: DateTime.add(now, { seconds: 3 }), - }; - assert.deepEqual(yield* latestActions, [changedFile, changedFile]); - - yield* addItem("thought", 4, { type: "reasoning", text: "Next, the tests", streaming: true }); - assert.deepEqual(yield* latestActions, [changedFile, changedFile]); - - const longCommand = `echo ${"a".repeat(300)}`; - yield* addItem("long", 5, { type: "command_execution", input: longCommand }); - const [listed] = yield* latestActions; - assert.lengthOf(listed?.detail ?? "", 120); - assert.isTrue(listed?.detail?.endsWith("…")); - - const { statements, tracer } = traceSqlStatements(); - yield* projectionStore.getShellSnapshot().pipe(Effect.withTracer(tracer)); - const statement = statements.find((query) => query.includes("AS latest_tool_payload_json")); - assert.isDefined(statement); - const plan = (yield* sql.unsafe<{ readonly detail: string }>( - `EXPLAIN QUERY PLAN ${statement}`, - )).map((row) => row.detail); - assert.isTrue( - plan.some((detail) => detail.includes("turn_items_latest_tool_idx (thread_id=?)")), - plan.join("\n"), - ); - }), - ); - it.effect("counts history inherited by fork shells, but not by side chats", () => Effect.gen(function* () { const projectionStore = yield* ProjectionStore.ProjectionStoreV2; diff --git a/apps/server/src/orchestration-v2/ProjectionStore.ts b/apps/server/src/orchestration-v2/ProjectionStore.ts index bd6ece337d1b2..977bf428c99a2 100644 --- a/apps/server/src/orchestration-v2/ProjectionStore.ts +++ b/apps/server/src/orchestration-v2/ProjectionStore.ts @@ -96,7 +96,6 @@ import * as SqlClient from "effect/sql/SqlClient"; import type * as Statement from "effect/sql/Statement"; import { MCP_APP_OUTPUT_KEY } from "@t3tools/shared/mcpApp"; -import { LATEST_ACTION_ITEM_TYPES, latestActionFromTurnItem } from "./latestAction.ts"; import { threadHtmlRenderAttachmentIds } from "../attachmentStore.ts"; import { readableSearchText } from "./messageSearchIndex.ts"; import { @@ -1145,7 +1144,6 @@ type ShellThreadRow = { readonly blocking_failure_payload_json: string | null; readonly pending_request_payload_json: string | null; readonly pending_secret_request_payload_json: string | null; - readonly latest_tool_payload_json: string | null; readonly pending_link_request_payload_json: string | null; readonly latest_user_message_at: string | null; readonly latest_user_authored_message_at: string | null; @@ -1711,27 +1709,6 @@ const linkCardStillAsks = ( latestUserAuthoredMessageAt === null || !DateTime.isGreaterThan(latestUserAuthoredMessageAt, item.startedAt ?? item.updatedAt); -function latestToolItem( - projection: OrchestrationV2ThreadProjection, -): OrchestrationV2TurnItem | null { - const rolledBack = new Set( - projection.runs.filter((run) => run.status === "rolled_back").map((run) => run.id), - ); - const types: ReadonlyArray = LATEST_ACTION_ITEM_TYPES; - let latest: OrchestrationV2TurnItem | null = null; - for (const item of projection.turnItems) { - if (!types.includes(item.type) || (item.runId !== null && rolledBack.has(item.runId))) continue; - if ( - latest === null || - item.ordinal > latest.ordinal || - (item.ordinal === latest.ordinal && item.id > latest.id) - ) { - latest = item; - } - } - return latest; -} - export function threadShellFromProjection( projection: OrchestrationV2ThreadProjection, ): OrchestrationV2ThreadShell { @@ -1867,7 +1844,6 @@ export function threadShellFromProjection( // Thread detail owns message bodies. Keeping them out of shell rows makes // initial hydration and streaming updates independent of transcript size. latestVisibleMessage: null, - latestAction: latestActionFromTurnItem(latestToolItem(projection)), latestUserMessageAt: latestUserMessage?.updatedAt ?? null, latestUserAuthoredMessageAt, hasActionableProposedPlan: projection.plans.some( @@ -2006,7 +1982,6 @@ type ShellThreadState = { readonly pendingBackgroundTasks: OrchestrationV2ThreadShell["pendingBackgroundTasks"]; readonly providerInstanceHistory: OrchestrationV2ThreadShell["providerInstanceHistory"]; readonly goal: OrchestrationV2ThreadShell["goal"]; - readonly latestAction: OrchestrationV2ThreadShell["latestAction"]; readonly itemCount: number; readonly runlessItemCount: number; readonly updatedAt: OrchestrationV2ThreadProjection["updatedAt"]; @@ -2174,7 +2149,6 @@ function shellFromState(input: { pendingRuntimeRequest: input.state.pendingRuntimeRequest, pendingGuestMessageCount: pendingGuestMessageCount(input.state.thread.guestShare), latestVisibleMessage: null, - latestAction: input.state.latestAction, latestUserMessageAt: input.state.latestUserMessageAt, latestUserAuthoredMessageAt: input.state.latestUserAuthoredMessageAt, hasActionableProposedPlan: input.state.hasActionableProposedPlan, @@ -8013,19 +7987,6 @@ export const layer: Layer.Layer = ORDER BY link.updated_at DESC, link.turn_item_id DESC LIMIT 1 ) AS pending_link_request_payload_json, - ( - -- Tool output and diffs can be megabytes; the label needs none of them. - SELECT json_remove(tool.payload_json, - '$.output', '$.diffStr', '$.oldStr', '$.newStr', '$.changes', '$.results') - FROM orchestration_v2_projection_turn_items tool - INDEXED BY orchestration_v2_projection_turn_items_latest_tool_idx - LEFT JOIN orchestration_v2_projection_runs tool_run ON tool_run.run_id = tool.run_id - WHERE tool.thread_id = t.thread_id - AND tool.type IN ('command_execution', 'file_change', 'file_search', 'web_search', 'dynamic_tool') - AND (tool.run_id IS NULL OR tool_run.status <> 'rolled_back') - ORDER BY tool.ordinal DESC, tool.turn_item_id DESC - LIMIT 1 - ) AS latest_tool_payload_json, ( SELECT message.updated_at FROM orchestration_v2_projection_messages message @@ -8597,12 +8558,6 @@ export const layer: Layer.Layer = pendingRuntimeRequest = waitingCard; } } - const latestToolItem = - row.latest_tool_payload_json === null - ? null - : yield* decodeTurnItemPayload(row.latest_tool_payload_json).pipe( - Effect.orElseSucceed(() => null), - ); let terminalFailureItem = row.terminal_failure_payload_json === null ? null @@ -8717,7 +8672,6 @@ export const layer: Layer.Layer = providerThreadsByThreadId.get(thread.id) ?? [], thread.activeProviderThreadId, ), - latestAction: latestActionFromTurnItem(latestToolItem), itemCount: shellItemCountsByThreadId.get(thread.id)?.itemCount ?? 0, runlessItemCount: shellItemCountsByThreadId.get(thread.id)?.runlessItemCount ?? 0, updatedAt: thread.updatedAt, diff --git a/apps/server/src/orchestration-v2/RemoteDelegatedTask.test.ts b/apps/server/src/orchestration-v2/RemoteDelegatedTask.test.ts index 71ceaf4f6f84e..292882d0f894b 100644 --- a/apps/server/src/orchestration-v2/RemoteDelegatedTask.test.ts +++ b/apps/server/src/orchestration-v2/RemoteDelegatedTask.test.ts @@ -205,7 +205,6 @@ it.layer(layerTest)("a delegated task in a linked environment", (it) => { parentRunId: parent.runId, parentNodeId: parent.rootNodeId, task: "Run the suite there.", - group: "Backend", driver: ProviderDriverKind.make("remote"), modelSelection, remoteChild, @@ -220,7 +219,6 @@ it.layer(layerTest)("a delegated task in a linked environment", (it) => { assert.deepEqual(task?.remoteChild, remoteChild); assert.deepEqual(task?.modelSelection, modelSelection); assert.equal(task?.status, "running"); - assert.equal(task?.group, "Backend"); const item = projection.turnItems.find((candidate) => candidate.type === "subagent"); assert.deepEqual(item?.type === "subagent" ? item.remoteChild : undefined, remoteChild); // No thread was created here for the child. diff --git a/apps/server/src/orchestration-v2/ShellStream.test.ts b/apps/server/src/orchestration-v2/ShellStream.test.ts index 77ae0c8688c5e..fbc610235dd01 100644 --- a/apps/server/src/orchestration-v2/ShellStream.test.ts +++ b/apps/server/src/orchestration-v2/ShellStream.test.ts @@ -38,11 +38,8 @@ const emptyShellSnapshot = { } as OrchestrationV2ShellSnapshot; describe("subagent shell events", () => { - const stored = ( - threadId: string, - type: string, - payload: object = { type: "assistant_message", status: "running" }, - ) => ({ event: { threadId, type, payload } }) as ApplicationStoredEvent; + const stored = (threadId: string, type: string, itemType = "command_execution") => + ({ event: { threadId, type, payload: { type: itemType } } }) as ApplicationStoredEvent; it("keeps regular threads and subagent state changes while omitting subagent transcript updates", () => { const subagents = new Set(["child"]); @@ -55,7 +52,7 @@ describe("subagent shell events", () => { for (const itemType of ["secret_request", "link_request", "user_message"]) { expect( shouldPublishShellApplicationEvent( - stored("child", "turn-item.updated", { type: itemType, status: "running" }), + stored("child", "turn-item.updated", itemType), subagents, ), ).toBe(true); @@ -71,30 +68,6 @@ describe("subagent shell events", () => { ); }); - it("refreshes a subagent's latest action when one of its tools finishes", () => { - const subagents = new Set(["child"]); - const tool = (status: string) => - shouldPublishShellApplicationEvent( - stored("child", "turn-item.updated", { type: "command_execution", status }), - subagents, - ); - expect([tool("running"), tool("completed"), tool("failed")]).toEqual([false, true, true]); - }); - - it("publishes a subagent's secret or link card so its parent hears it waits on you", () => { - const subagents = new Set(["child"]); - const card = (type: string, status: string) => - shouldPublishShellApplicationEvent( - stored("child", "turn-item.updated", { type, status }), - subagents, - ); - expect([ - card("secret_request", "waiting"), - card("secret_request", "completed"), - card("link_request", "waiting"), - ]).toEqual([true, true, true]); - }); - it("tracks subagents created after the subscription starts", () => { const subagents = new Set(); const created = { @@ -235,7 +208,7 @@ describe("omitIdleSubagentShells", () => { event: { threadId: "idle", type: "turn-item.updated", - payload: { type: "reasoning", status: "running" }, + payload: { type: "command_execution" }, }, } as ApplicationStoredEvent, omitted.subagentThreadIds, diff --git a/apps/server/src/orchestration-v2/ShellStream.ts b/apps/server/src/orchestration-v2/ShellStream.ts index 446ca006d04a1..5ee1005b16830 100644 --- a/apps/server/src/orchestration-v2/ShellStream.ts +++ b/apps/server/src/orchestration-v2/ShellStream.ts @@ -36,7 +36,6 @@ import * as Stream from "effect/Stream"; import type * as OrchestrationEventStore from "../persistence/OrchestrationEventStore.ts"; import { bufferLatestLiveStream } from "./LiveStreamBudget.ts"; -import { LATEST_ACTION_ITEM_TYPES } from "./latestAction.ts"; import type { ActiveShellIndexEntry } from "./ProjectionStore.ts"; type ShellDelta = Extract; @@ -555,23 +554,12 @@ export function shouldPublishShellApplicationEvent( return !( subagentThreadIds.has(event.threadId) && (event.type === "node.updated" || - (event.type === "turn-item.updated" && !changesChildShell(event.payload)) || + event.type === "turn-item.updated" || event.type === "provider-turn.updated" || event.type === "message.updated") ); } -const LATEST_ACTION_TYPES: ReadonlySet = new Set(LATEST_ACTION_ITEM_TYPES); - -/** - * A secret or link card is the child's only record of waiting on you, so its parent must hear it. - * A finished tool moves the child's latest action; streaming tool output does not. - */ -const changesChildShell = (item: { readonly type: string; readonly status: string }) => - item.type === "secret_request" || - item.type === "link_request" || - (LATEST_ACTION_TYPES.has(item.type) && item.status !== "running" && item.status !== "pending"); - /** Shell updates refetch an aggregate; drop transcript bodies before retaining an event. */ export function toShellApplicationEvent(stored: ApplicationStoredEvent): ShellApplicationEvent { return "aggregateKind" in stored diff --git a/apps/server/src/orchestration-v2/latestAction.test.ts b/apps/server/src/orchestration-v2/latestAction.test.ts deleted file mode 100644 index 3e50498db922c..0000000000000 --- a/apps/server/src/orchestration-v2/latestAction.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - NodeId, - RunId, - ThreadId, - TurnItemId, - type OrchestrationV2TurnItem, -} from "@t3tools/contracts"; -import { describe, expect, it } from "@effect/vitest"; -import * as DateTime from "effect/DateTime"; - -import { latestActionFromTurnItem } from "./latestAction.ts"; - -const at = DateTime.makeUnsafe("2026-11-10T10:00:00.000Z"); -const base = { - id: TurnItemId.make("item:latest-action"), - threadId: ThreadId.make("thread:latest-action"), - runId: RunId.make("run:latest-action"), - nodeId: NodeId.make("node:latest-action"), - providerThreadId: null, - providerTurnId: null, - nativeItemRef: null, - parentItemId: null, - ordinal: 1, - status: "running", - title: null, - startedAt: at, - completedAt: null, - updatedAt: at, -} as const; - -describe("latestActionFromTurnItem", () => { - it.each([ - [{ type: "file_search", pattern: "useAuth" }, { summary: "Searched useAuth" }], - [{ type: "web_search", patterns: ["github oauth"] }, { summary: "Searched github oauth" }], - [ - { type: "dynamic_tool", toolName: "Read", input: { file_path: "src/auth/session.ts" } }, - { summary: "Read src/auth/session.ts" }, - ], - [ - { type: "dynamic_tool", toolName: "Grep", input: { pattern: "session", path: "src" } }, - { summary: "Searched session in src" }, - ], - [ - { type: "dynamic_tool", toolName: "mcp__t3-code__request_secret", input: {} }, - { summary: "Asked for a secret" }, - ], - [ - { - type: "dynamic_tool", - toolName: "mcp__t3-code__delegate_task", - input: {}, - status: "failed", - }, - { summary: "Failed to delegate a child task" }, - ], - [ - { type: "dynamic_tool", toolName: "mcp__linear__create_issue", input: {} }, - { summary: "create_issue" }, - ], - [ - { - type: "dynamic_tool", - toolName: "mcp__linear__create_issue", - title: "mcp__linear__create_issue", - input: {}, - }, - { summary: "create_issue" }, - ], - [{ type: "reasoning", text: "Thinking", streaming: false }, null], - [{ type: "assistant_message", messageId: "message:x", text: "Done", streaming: false }, null], - ] as const)("labels %o", (item, expected) => { - const action = latestActionFromTurnItem({ ...base, ...item } as OrchestrationV2TurnItem); - expect(action).toEqual(expected === null ? null : { ...expected, at }); - }); -}); diff --git a/apps/server/src/orchestration-v2/latestAction.ts b/apps/server/src/orchestration-v2/latestAction.ts deleted file mode 100644 index e6b345f0466f9..0000000000000 --- a/apps/server/src/orchestration-v2/latestAction.ts +++ /dev/null @@ -1,91 +0,0 @@ -import type { - OrchestrationV2LatestActionSummary, - OrchestrationV2TurnItem, -} from "@t3tools/contracts"; -import { - deriveToolActivityPresentation, - dynamicToolTitle, - type ToolActivityPresentation, -} from "@t3tools/shared/toolActivity"; -import { resolveT3McpToolDefinition } from "@t3tools/shared/t3McpToolPresentation"; - -/** Keep in sync with the latest-tool index and the shell row query in ProjectionStore. */ -export const LATEST_ACTION_ITEM_TYPES = [ - "command_execution", - "file_change", - "file_search", - "web_search", - "dynamic_tool", -] as const; - -const LATEST_ACTION_TEXT_LIMIT = 120; - -const clip = (text: string) => - text.length > LATEST_ACTION_TEXT_LIMIT - ? `${text.slice(0, LATEST_ACTION_TEXT_LIMIT - 1).trimEnd()}…` - : text; - -const withoutMcpPrefix = (name: string) => name.replace(/^mcp__.+?__(?=.)/, ""); - -function presentation(item: OrchestrationV2TurnItem): ToolActivityPresentation | null { - switch (item.type) { - case "command_execution": - return deriveToolActivityPresentation({ - itemType: "command_execution", - title: item.title, - data: { command: item.input }, - }); - case "file_change": - return deriveToolActivityPresentation({ - itemType: "file_change", - title: item.title, - data: { path: item.fileName }, - }); - case "file_search": - return deriveToolActivityPresentation({ - title: item.title, - data: { kind: "search", pattern: item.pattern }, - fallbackSummary: "Searched files", - }); - case "web_search": - return deriveToolActivityPresentation({ - itemType: "web_search", - title: item.title, - data: { query: item.patterns?.join(", ") }, - }); - case "dynamic_tool": { - const t3Tool = resolveT3McpToolDefinition(item.toolName, item.input); - if (t3Tool !== null) { - const [action, , completed, detail] = t3Tool.labels; - return { - summary: - item.status === "failed" - ? `Failed to ${action.toLowerCase()} ${detail}` - : `${completed} ${detail}`, - }; - } - const title = dynamicToolTitle(item.toolName, item.input, item.title) ?? item.title; - return deriveToolActivityPresentation({ - itemType: "dynamic_tool_call", - title: title && withoutMcpPrefix(title), - data: { toolName: item.toolName ?? undefined, input: item.input }, - fallbackSummary: item.toolName && withoutMcpPrefix(item.toolName), - }); - } - default: - return null; - } -} - -export function latestActionFromTurnItem( - item: OrchestrationV2TurnItem | null, -): OrchestrationV2LatestActionSummary | null { - if (item === null) return null; - const presented = presentation(item); - if (presented === null) return null; - return { - summary: clip(presented.summary), - ...(presented.detail ? { detail: clip(presented.detail) } : {}), - at: item.startedAt ?? item.updatedAt, - }; -} diff --git a/apps/server/src/peer/RemoteDelegation.ts b/apps/server/src/peer/RemoteDelegation.ts index 47ff4efdaac5b..99dc91be087ee 100644 --- a/apps/server/src/peer/RemoteDelegation.ts +++ b/apps/server/src/peer/RemoteDelegation.ts @@ -390,7 +390,6 @@ const make = Effect.gen(function* () { parentNodeId, task, ...(input.title === undefined ? {} : { title: input.title }), - ...(input.group === undefined ? {} : { group: input.group }), // The driver runs there; this side only labels the task with it. driver: ProviderDriverKind.make("remote"), modelSelection: launched.modelSelection, diff --git a/apps/server/src/persistence/ForkMigrations/004_LatestToolItemIndex.ts b/apps/server/src/persistence/ForkMigrations/004_LatestToolItemIndex.ts index 00f4dc96f3ac6..d40d5d453d956 100644 --- a/apps/server/src/persistence/ForkMigrations/004_LatestToolItemIndex.ts +++ b/apps/server/src/persistence/ForkMigrations/004_LatestToolItemIndex.ts @@ -4,7 +4,7 @@ import * as SqlClient from "effect/sql/SqlClient"; export default Effect.gen(function* () { const sql = yield* SqlClient.SqlClient; - // Keep this predicate aligned with the shell's latest tool action lookup in ProjectionStore. + // Unused since the shell's latest tool action was removed; kept so the migration history stays intact. yield* sql` CREATE INDEX orchestration_v2_projection_turn_items_latest_tool_idx ON orchestration_v2_projection_turn_items(thread_id, ordinal DESC, turn_item_id DESC) diff --git a/apps/server/src/provider/agentContextBudget.json b/apps/server/src/provider/agentContextBudget.json index 92e1f377bb765..625465cbaed41 100644 --- a/apps/server/src/provider/agentContextBudget.json +++ b/apps/server/src/provider/agentContextBudget.json @@ -1,5 +1,5 @@ { "claudeSystemAppendBytes": 5930, "codexAdditionalContextBytes": 7324, - "mcpToolListJsonBytes": 50013 + "mcpToolListJsonBytes": 49938 } diff --git a/apps/web/src/components/ChatView.logic.test.ts b/apps/web/src/components/ChatView.logic.test.ts index d1c14c6870447..579e8348b46a0 100644 --- a/apps/web/src/components/ChatView.logic.test.ts +++ b/apps/web/src/components/ChatView.logic.test.ts @@ -1640,6 +1640,7 @@ describe("waitingMessageCanResend", () => { waitingDraftId: "draft-1", draftId: "draft-1", isLocalDraftThread: true, + onSandbox: true, canOperateThread: true, isSendBusy: false, isRevertingCheckpoint: false, @@ -1657,8 +1658,11 @@ describe("waitingMessageCanResend", () => { // A sandbox paired a moment ago can show its project before its session grants this app any // scope; a send then would be dropped while the message no longer waits. - it("waits until the draft's machine lets this app start threads", () => { + it("waits until the draft's sandbox lets this app start threads", () => { expect(waitingMessageCanResend({ ...ready, canOperateThread: false })).toBe(false); + expect(waitingMessageCanResend({ ...ready, onSandbox: false, canOperateThread: false })).toBe( + true, + ); }); it("waits only for its own draft", () => { diff --git a/apps/web/src/components/ChatView.logic.ts b/apps/web/src/components/ChatView.logic.ts index 6d8b9db71015c..eeb3282b86c50 100644 --- a/apps/web/src/components/ChatView.logic.ts +++ b/apps/web/src/components/ChatView.logic.ts @@ -1595,15 +1595,15 @@ export function isThreadEnvironmentLocked(input: { } /** - * Whether a message held back while its draft changed machines (worked locally, or handed off to - * a sandbox) can be sent now. A send that fails a gate here is dropped, not retried, so this waits - * for every condition the send itself checks, including the operate scope on the draft's machine: - * a sandbox paired a moment ago can report its project before its session has loaded. + * Whether a message held back while its draft switched to working locally can be sent now. A send + * that fails a gate here is dropped, not retried. A draft on a sandbox also waits for the operate + * scope: a sandbox paired a moment ago can report its project before its session has loaded. */ export function waitingMessageCanResend(input: { readonly waitingDraftId: string | null; readonly draftId: string | null; readonly isLocalDraftThread: boolean; + readonly onSandbox: boolean; readonly canOperateThread: boolean; readonly isSendBusy: boolean; readonly isRevertingCheckpoint: boolean; @@ -1618,7 +1618,7 @@ export function waitingMessageCanResend(input: { input.waitingDraftId !== null && input.waitingDraftId === input.draftId && input.isLocalDraftThread && - input.canOperateThread && + (!input.onSandbox || input.canOperateThread) && !input.isSendBusy && !input.isRevertingCheckpoint && !input.threadDetailLoading && diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index d6f25e15d3237..f3138e3e5e818 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -215,6 +215,7 @@ import { stackedThreadToast, toastManager } from "./ui/toast"; import { useSandboxChatAliases, useSandboxMirrorModelSource, + useSandboxEnvironmentIds, useSandboxlessBridgeThread, useThreadSandbox, } from "../state/sandboxes"; @@ -1056,6 +1057,7 @@ export default function ChatView(props: ChatViewProps) { const activeThreadRef = useActiveThreadRef(activeThread); const activeThreadKey = activeThreadRef ? scopedThreadKey(activeThreadRef) : null; const activeSandbox = useThreadSandbox(activeThreadRef); + const sandboxEnvironmentIds = useSandboxEnvironmentIds(); // The host thread the sandbox bridge drives: its own server stays up, and the host resumes the // sandbox when a turn starts, so it sends like any other thread. const activeSandboxOnHost = @@ -3391,6 +3393,7 @@ export default function ChatView(props: ChatViewProps) { waitingDraftId: workLocallyResendDraftId, draftId, isLocalDraftThread, + onSandbox: sandboxEnvironmentIds.has(environmentId), canOperateThread, isSendBusy, isRevertingCheckpoint, diff --git a/apps/web/src/components/chat/ChildThreadApprovals.browser.test.tsx b/apps/web/src/components/chat/ChildThreadApprovals.browser.test.tsx index fd0ae87a20ec7..ef136a1760137 100644 --- a/apps/web/src/components/chat/ChildThreadApprovals.browser.test.tsx +++ b/apps/web/src/components/chat/ChildThreadApprovals.browser.test.tsx @@ -10,10 +10,8 @@ const state = vi.hoisted(() => ({ respond: vi.fn(), approvalsAtom: null as unkno vi.mock("../../state/session", () => ({ useEnvironmentScope: () => true })); vi.mock("../../state/use-atom-command", () => ({ useAtomCommand: () => state.respond })); -vi.mock("./SecretRequestCard", () => ({ SecretRequestCard: () => null })); vi.mock("../../state/threads", () => ({ childThreadApprovalsAtom: () => state.approvalsAtom, - childThreadSecretRequestsAtom: () => Atom.make([]), threadEnvironment: { respondToApproval: {} }, })); diff --git a/apps/web/src/components/chat/ChildThreadApprovals.tsx b/apps/web/src/components/chat/ChildThreadApprovals.tsx index 1c69fba07f444..5a7cb3074b4a6 100644 --- a/apps/web/src/components/chat/ChildThreadApprovals.tsx +++ b/apps/web/src/components/chat/ChildThreadApprovals.tsx @@ -8,14 +8,9 @@ import { } from "@t3tools/client-runtime/state/runtime"; import { useState } from "react"; import { useEnvironmentScope } from "../../state/session"; -import { - childThreadApprovalsAtom, - childThreadSecretRequestsAtom, - threadEnvironment, -} from "../../state/threads"; +import { childThreadApprovalsAtom, threadEnvironment } from "../../state/threads"; import { useAtomCommand } from "../../state/use-atom-command"; import { ComposerPendingApprovalActions } from "./ComposerPendingApprovalActions"; -import { SecretRequestCard } from "./SecretRequestCard"; function ChildApproval({ entry }: { entry: ChildThreadApproval }) { const canRespond = useEnvironmentScope(entry.thread.environmentId, AuthOrchestrationOperateScope); @@ -82,18 +77,9 @@ function ChildApproval({ entry }: { entry: ChildThreadApproval }) { export function ChildThreadApprovals({ threadRef }: { threadRef: ScopedThreadRef | null }) { const approvals = useAtomValue(childThreadApprovalsAtom(threadRef)); - const secrets = useAtomValue(childThreadSecretRequestsAtom(threadRef)); - if (approvals.length === 0 && secrets.length === 0) return null; + if (approvals.length === 0) return null; return (
- {secrets.map((entry) => ( - - ))} {approvals.map((entry) => ( "credentials-changed" as const), ), networkPathChanges, - computerWakeups, ], { concurrency: "unbounded" }, ), diff --git a/apps/web/src/connection/suspendWakeups.test.ts b/apps/web/src/connection/suspendWakeups.test.ts deleted file mode 100644 index 876d87f0f8548..0000000000000 --- a/apps/web/src/connection/suspendWakeups.test.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { describe, expect, it } from "vite-plus/test"; - -import { sleptBetweenTicks } from "./suspendWakeups.ts"; - -describe("sleptBetweenTicks", () => { - it("tells a computer's sleep from a busy page", () => { - expect(sleptBetweenTicks(0, 5_000, true)).toBe(false); - // A main thread stalled for a while is not a sleep. - expect(sleptBetweenTicks(0, 20_000, true)).toBe(false); - expect(sleptBetweenTicks(0, 30_000, true)).toBe(true); - expect(sleptBetweenTicks(0, 8 * 60 * 60_000, true)).toBe(true); - }); - - it("ignores a hidden page, whose timers the browser throttles to once a minute", () => { - expect(sleptBetweenTicks(0, 60_000, false)).toBe(false); - }); -}); diff --git a/apps/web/src/connection/suspendWakeups.ts b/apps/web/src/connection/suspendWakeups.ts deleted file mode 100644 index 946c35189b6da..0000000000000 --- a/apps/web/src/connection/suspendWakeups.ts +++ /dev/null @@ -1,38 +0,0 @@ -import * as Clock from "effect/Clock"; -import * as Effect from "effect/Effect"; -import * as Stream from "effect/Stream"; - -const TICK = "5 seconds"; -// Well past a busy main thread's stall, well short of a nap. -const SUSPENDED_AFTER_MS = 30_000; - -/** - * True when a timer fired so late that the computer must have slept in between. A hidden page's - * timers are throttled to once a minute, so only a visible page's late timer counts. - */ -export const sleptBetweenTicks = (previousMs: number, nowMs: number, visible: boolean): boolean => - visible && nowMs - previousMs >= SUSPENDED_AFTER_MS; - -const pageVisible = Effect.sync( - () => typeof document === "undefined" || document.visibilityState === "visible", -); - -/** - * Fires when the computer wakes from sleep, which no page event reports: timers stand still - * while it sleeps and the wall clock does not. Its sockets died silently meanwhile, and their - * piled-up retry backoff must not keep a finished run showing as working. - */ -export const computerWakeups: Stream.Stream<"application-active"> = Stream.unwrap( - Effect.gen(function* () { - let previous = yield* Clock.currentTimeMillis; - return Stream.tick(TICK).pipe( - Stream.mapEffect(() => Effect.all([Clock.currentTimeMillis, pageVisible])), - Stream.filter(([now, visible]) => { - const slept = sleptBetweenTicks(previous, now, visible); - previous = now; - return slept; - }), - Stream.map(() => "application-active" as const), - ); - }), -); diff --git a/apps/web/src/state/threads.ts b/apps/web/src/state/threads.ts index f4d554f473817..c8d2ffcbc8b7b 100644 --- a/apps/web/src/state/threads.ts +++ b/apps/web/src/state/threads.ts @@ -1,7 +1,4 @@ -import { - createChildThreadApprovalsAtom, - createChildThreadSecretRequestsAtom, -} from "@t3tools/client-runtime/state/thread-requests"; +import { createChildThreadApprovalsAtom } from "@t3tools/client-runtime/state/thread-requests"; import { useAtomValue } from "@effect/atom-react"; import { createSandboxStartQueueAtoms } from "@t3tools/client-runtime/state/sandbox-mirror"; import { enabledEnvironmentIds } from "@t3tools/client-runtime/state/connections"; @@ -61,10 +58,6 @@ export const childThreadApprovalsAtom = createChildThreadApprovalsAtom({ childThreadInputsAtom: environmentThreadShells.childThreadInputsAtom, pendingRequestsAtom: environmentThreadDetails.pendingRequestsAtom, }); -export const childThreadSecretRequestsAtom = createChildThreadSecretRequestsAtom({ - childThreadInputsAtom: environmentThreadShells.childThreadInputsAtom, - visibleTurnItemsAtom: environmentThreadDetails.visibleTurnItemsAtom, -}); const EMPTY_THREAD_STATE_ATOM = Atom.make(AsyncResult.success(EMPTY_ENVIRONMENT_THREAD_STATE)).pipe( Atom.withLabel("web-environment-thread:empty"), diff --git a/packages/client-runtime/src/state/threadRequests.test.ts b/packages/client-runtime/src/state/threadRequests.test.ts index f591c94346ada..f6eb4e1f76cb1 100644 --- a/packages/client-runtime/src/state/threadRequests.test.ts +++ b/packages/client-runtime/src/state/threadRequests.test.ts @@ -20,7 +20,6 @@ import { v2Now, v2Projection, v2ThreadShell } from "./orchestrationV2TestFixture import { createQuestionHistoryProjector, createChildThreadApprovalsAtom, - createChildThreadSecretRequestsAtom, type PendingThreadRequests, derivePendingThreadRequests, declinePendingApprovals, @@ -640,56 +639,6 @@ it("loads only child approvals and retains their destination across environments ); expect(registry.get(approvalsAtom(parent))).toEqual([]); expect(readDetails).not.toHaveBeenCalled(); - - // The same children now wait on a secret: only their waiting cards reach the parent. - const card = (id: string, secretStatus: "pending" | "saved") => ({ - position: 0, - visibility: "local" as const, - sourceThreadId: childId, - sourceItemId: TurnItemId.make(id), - item: { - id: TurnItemId.make(id), - threadId: childId, - runId: null, - nodeId, - providerThreadId: null, - providerTurnId: null, - nativeItemRef: null, - parentItemId: null, - ordinal: 1, - status: secretStatus === "pending" ? ("waiting" as const) : ("completed" as const), - title: "GITHUB_CLIENT_SECRET", - startedAt: v2Now, - completedAt: null, - updatedAt: v2Now, - type: "secret_request" as const, - label: "GITHUB_CLIENT_SECRET", - reason: "To test the real OAuth flow", - secretStatus, - }, - }); - const items = Atom.family((key: string) => - Atom.make( - key.startsWith(local) ? [card("saved", "saved"), card("asking", "pending")] : [], - ), - ); - const readItems = vi.fn((ref: ScopedThreadRef) => items(threadKey(ref))); - const secretsAtom = createChildThreadSecretRequestsAtom({ - childThreadInputsAtom: () => children, - visibleTurnItemsAtom: readItems, - }); - const unmountSecrets = registry.mount(secretsAtom(parent)); - expect( - registry.get(secretsAtom(parent)).map((entry) => [entry.thread.environmentId, entry.item.id]), - ).toEqual([[local, "asking"]]); - readItems.mockClear(); - registry.set( - children, - registry.get(children).map((child) => ({ ...child, hasPendingUserInput: false })), - ); - expect(registry.get(secretsAtom(parent))).toEqual([]); - expect(readItems).not.toHaveBeenCalled(); - unmountSecrets(); unmount(); registry.dispose(); }); diff --git a/packages/client-runtime/src/state/threadRequests.ts b/packages/client-runtime/src/state/threadRequests.ts index b9e67538d01ca..99fd12ba5b360 100644 --- a/packages/client-runtime/src/state/threadRequests.ts +++ b/packages/client-runtime/src/state/threadRequests.ts @@ -3,7 +3,6 @@ import type { ScopedThreadRef, ThreadId, OrchestrationV2ThreadProjection, - OrchestrationV2TurnItem, OrchestrationV2RuntimeRequest, OrchestrationV2UserInputQuestion, ProviderApprovalFullAccessOverride, @@ -404,53 +403,3 @@ export function createChildThreadApprovalsAtom(input: { const empty = Atom.make>([]); return (ref: ScopedThreadRef | null) => (ref === null ? empty : family(threadKey(ref))); } - -export interface ChildThreadSecretRequest { - readonly thread: ScopedThreadRef; - readonly title: string; - readonly item: Extract; -} - -/** Waiting secret cards of the child threads under `ref`, so the parent can answer them. */ -export function createChildThreadSecretRequestsAtom(input: { - readonly childThreadInputsAtom: ( - ref: ScopedThreadRef, - ) => Atom.Atom>; - readonly visibleTurnItemsAtom: ( - ref: ScopedThreadRef, - ) => Atom.Atom; -}) { - const family = Atom.family((key: string) => { - let previous: ReadonlyArray = []; - return Atom.make((get) => { - const next = get(input.childThreadInputsAtom(parseThreadKey(key))).flatMap((child) => { - if (!child.hasPendingUserInput) return []; - const thread = { environmentId: child.environmentId, threadId: child.id }; - // Only children waiting on input need a detail subscription. - return get(input.visibleTurnItemsAtom(thread)).flatMap(({ item, visibility }) => - item.type === "secret_request" && - item.secretStatus === "pending" && - visibility === "local" - ? [{ thread, title: child.title, item }] - : [], - ); - }); - if ( - next.length === previous.length && - next.every((entry, index) => { - const old = previous[index]!; - return ( - old.item === entry.item && - old.title === entry.title && - threadKey(old.thread) === threadKey(entry.thread) - ); - }) - ) - return previous; - previous = next; - return next; - }); - }); - const empty = Atom.make>([]); - return (ref: ScopedThreadRef | null) => (ref === null ? empty : family(threadKey(ref))); -} diff --git a/packages/client-runtime/src/state/threadShell.test.ts b/packages/client-runtime/src/state/threadShell.test.ts index b7d086889715c..d18a3e3adae1c 100644 --- a/packages/client-runtime/src/state/threadShell.test.ts +++ b/packages/client-runtime/src/state/threadShell.test.ts @@ -619,16 +619,7 @@ describe("v2 thread shell lists", () => { const dispose = harness.registry.mount(quietAtom); try { const first = harness.registry.get(quietAtom); - setThread( - { - ...running, - updatedAt: at(1), - itemCount: 4, - visibleItemCount: 3, - latestAction: { summary: "Ran command", detail: "pnpm test", at: at(1) }, - }, - 2, - ); + setThread({ ...running, updatedAt: at(1), itemCount: 4, visibleItemCount: 3 }, 2); expect(harness.registry.get(quietAtom)).toBe(first); expect(harness.registry.get(harness.threads.threadShellAtom(ref))?.itemCount).toBe(4); diff --git a/packages/client-runtime/src/state/threadShell.ts b/packages/client-runtime/src/state/threadShell.ts index 183d788a78b02..4d76051c47370 100644 --- a/packages/client-runtime/src/state/threadShell.ts +++ b/packages/client-runtime/src/state/threadShell.ts @@ -174,8 +174,8 @@ export function childThreadInputsTitle( const sameWireThreadShell = Schema.toEquivalence(OrchestrationV2ThreadShell); -// While a run streams, the server bumps the shell's timestamps, item counts, latest -// message and latest action several times a second. Only the zero crossing of the counts +// While a run streams, the server bumps the shell's timestamps, item counts and +// latest message several times a second. Only the zero crossing of the counts // says anything (whether the thread has started). Once the run stops every // field counts again, so snooze wakes and failure times read the current value. function sameApartFromStreaming( @@ -201,8 +201,6 @@ function sameApartFromStreaming( itemCount: after.itemCount, visibleItemCount: after.visibleItemCount, latestVisibleMessage: after.latestVisibleMessage, - // Optional on the wire: an explicit undefined would not equal an absent key. - ...("latestAction" in after ? { latestAction: after.latestAction } : {}), }, after, ) diff --git a/packages/contracts/src/orchestrationV2.ts b/packages/contracts/src/orchestrationV2.ts index 0bda169cb0a2e..378e0e0a67c96 100644 --- a/packages/contracts/src/orchestrationV2.ts +++ b/packages/contracts/src/orchestrationV2.ts @@ -921,9 +921,6 @@ export const OrchestrationV2RemoteTaskChild = Schema.Struct({ }); export type OrchestrationV2RemoteTaskChild = typeof OrchestrationV2RemoteTaskChild.Type; -/** A coordinator-chosen work stream, such as "UI" or "Backend", that clients group agents by. */ -export const SubagentGroup = TrimmedNonEmptyString.check(Schema.isMaxLength(40)); - export const OrchestrationV2Subagent = Schema.Struct({ id: NodeId, threadId: ThreadId, @@ -957,7 +954,6 @@ export const OrchestrationV2Subagent = Schema.Struct({ ]), progress: Schema.optional(Schema.String), workflow: Schema.optional(OrchestrationV2SubagentWorkflow), - group: Schema.optional(SubagentGroup), result: Schema.NullOr(Schema.String), startedAt: Schema.NullOr(Schema.DateTimeUtc), completedAt: Schema.NullOr(Schema.DateTimeUtc), @@ -2229,14 +2225,6 @@ export const OrchestrationV2LatestVisibleMessageSummary = Schema.Struct({ export type OrchestrationV2LatestVisibleMessageSummary = typeof OrchestrationV2LatestVisibleMessageSummary.Type; -/** The thread's most recent tool step, labeled as the chat's work log labels it. */ -export const OrchestrationV2LatestActionSummary = Schema.Struct({ - summary: Schema.String, - detail: Schema.optional(Schema.String), - at: Schema.DateTimeUtc, -}); -export type OrchestrationV2LatestActionSummary = typeof OrchestrationV2LatestActionSummary.Type; - export const OrchestrationV2ThreadShell = Schema.Struct({ ...OrchestrationV2CreationFields, id: ThreadId, @@ -2279,8 +2267,6 @@ export const OrchestrationV2ThreadShell = Schema.Struct({ /** Guest messages waiting for the owner to send or dismiss. Absent from older servers. */ pendingGuestMessageCount: Schema.optional(NonNegativeInt), latestVisibleMessage: Schema.NullOr(OrchestrationV2LatestVisibleMessageSummary), - /** Absent from older servers. */ - latestAction: Schema.optional(Schema.NullOr(OrchestrationV2LatestActionSummary)), latestUserMessageAt: Schema.NullOr(Schema.DateTimeUtc), /** Excludes wakes and agent messages that advance latestUserMessageAt through the user role. */ latestUserAuthoredMessageAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtc)), @@ -2918,10 +2904,6 @@ export const OrchestrationV2LatestVisibleMessageSummaryJson = export type OrchestrationV2LatestVisibleMessageSummaryJson = typeof OrchestrationV2LatestVisibleMessageSummaryJson.Type; -export const OrchestrationV2LatestActionSummaryJson = OrchestrationV2LatestActionSummary.mapFields( - (fields) => ({ ...fields, at: Schema.DateTimeUtcFromString }), -); - export const OrchestrationV2ThreadShellJson = OrchestrationV2ThreadShell.mapFields((fields) => ({ ...fields, latestRunRequestedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), @@ -2930,7 +2912,6 @@ export const OrchestrationV2ThreadShellJson = OrchestrationV2ThreadShell.mapFiel activityRunStartedAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), pendingRuntimeRequest: Schema.NullOr(OrchestrationV2PendingRuntimeRequestSummaryJson), latestVisibleMessage: Schema.NullOr(OrchestrationV2LatestVisibleMessageSummaryJson), - latestAction: Schema.optional(Schema.NullOr(OrchestrationV2LatestActionSummaryJson)), latestUserMessageAt: Schema.NullOr(Schema.DateTimeUtcFromString), latestUserAuthoredMessageAt: Schema.optional(Schema.NullOr(Schema.DateTimeUtcFromString)), createdAt: Schema.DateTimeUtcFromString, @@ -3594,7 +3575,6 @@ export const OrchestrationV2Command = Schema.Union([ parentNodeId: NodeId, task: TrimmedNonEmptyString, title: Schema.optional(TrimmedNonEmptyString), - group: Schema.optional(SubagentGroup), modelSelection: ModelSelection, runtimeMode: RuntimeMode, interactionMode: ProviderInteractionMode, @@ -3738,7 +3718,6 @@ const OrchestrationV2InternalCommand = Schema.Union([ parentNodeId: NodeId, task: TrimmedNonEmptyString, title: Schema.optional(TrimmedNonEmptyString), - group: Schema.optional(SubagentGroup), driver: ProviderDriverKind, modelSelection: ModelSelection, remoteChild: OrchestrationV2RemoteTaskChild, diff --git a/packages/contracts/src/orchestratorMcp.ts b/packages/contracts/src/orchestratorMcp.ts index a61285dfc4d54..210025ff7a0be 100644 --- a/packages/contracts/src/orchestratorMcp.ts +++ b/packages/contracts/src/orchestratorMcp.ts @@ -41,7 +41,6 @@ import { OrchestrationV2DelegatedFrom, OrchestrationV2RunStatus, OrchestrationV2TurnItemStatus, - SubagentGroup, } from "./orchestrationV2.ts"; import { ProviderOptionSelection, ProviderOptionSelectionValue } from "./model.ts"; import { ProviderDriverKind, ProviderInstanceId } from "./providerInstance.ts"; @@ -185,9 +184,6 @@ export const OrchestratorMcpDelegateTaskInput = Schema.Struct({ target: Schema.optional(OrchestratorMcpDelegateTaskTarget), title: Schema.optional(OrchestratorMcpTitle), role: Schema.optional(OrchestratorMcpTaskRole), - group: Schema.optional(SubagentGroup).annotate({ - description: "Parallel work stream, e.g. 'UI'.", - }), isolation: Schema.optional( Schema.Literals(["shared", "worktree"]).annotate({ description: diff --git a/vite.config.ts b/vite.config.ts index 8ae1ee18e3216..c7a92ccbc9ad1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -646,7 +646,6 @@ export default defineConfig({ "apps/mobile/src/features/review/ReviewSheet.tsx", "apps/mobile/src/features/review/useNativeReviewDiffBridge.ts", "apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx", - "apps/mobile/src/features/threads/ChildThreadApprovals.tsx", "apps/mobile/src/features/threads/ThreadComposer.tsx", "apps/mobile/src/features/threads/ThreadFeed.tsx", "apps/mobile/src/features/threads/ThreadQueueControl.tsx",