Skip to content

feat: transcript export, conversation import picker, and subagent worktree setup on v2 - #153

Merged
adampeterhiggins merged 1 commit into
t3code/sync-upstream-2026-10-05from
t3code/stack-export-import
Oct 5, 2026
Merged

adampeterhiggins merged 1 commit into
t3code/sync-upstream-2026-10-05from
t3code/stack-export-import

Conversation

@adampeterhiggins

Copy link
Copy Markdown
Owner

The orchestration v2 merge (#149) deleted or half-wired four fork features: Export a transcript (#87, dialog, builder, snapshot loader, and every entry point removed), the Import a CLI conversation picker (#99, contracts reverted to upstream's bulk-only import, agentSessions.list and the dialog gone), Claude subagent worktrees get the project setup (#127, SubagentWorktreeSetup deleted with the v1 Claude adapter), and mobile's half of Commands and file paths shown relative to the workspace (#88, upstream's rewritten mobile feed never got the workspace root).

How it is restored on v2

Export a transcript

  • buildThreadTranscript (apps/web/src/lib/threadTranscript.ts) now renders an OrchestrationV2ThreadProjection. It takes messages, proposed plans, and the work log from upstream's deriveTimelineEntriesFromVisibleTurnItems, so the order matches the timeline. Reasoning, todo lists, and event cards are left out. The front matter header comes from projection.thread.
  • Re-added loadFullThreadSnapshot to packages/client-runtime/src/state/threadSnapshotHttp.ts. It wraps the full GET /api/orchestration/threads/:id route and uses upstream's ManagedRelay.ManagedRelayDpopSigner / RemoteEnvironmentAuthorization.RemoteEnvironmentAuthorization.
  • Restored TranscriptExportDialog.tsx (including the chat-tab picker) and every entry point: thread action menu (threadActionMenu.logic, useThreadActionMenu, Sidebar), the LegacySidebar thread menu, the command palette, and the host in routes/__root.tsx. The desktop saveTextFile IPC and lib/saveTextFile.ts had survived and are reused.

Import a CLI conversation (built on upstream's bulk AgentSessionImporter)

  • Contracts: AgentSessionRef, optional session on AgentSessionImportInput, threadIds on the result, AgentSessionListInput / AgentSessionSummary / AgentSessionListResult, and WS_METHODS.agentSessionsList with its RPC. Added the RpcAuthorization read-scope entry. The agentSessionPicker capability was already advertised.
  • AgentSessionScanner.recentThreads takes { session, refresh } options, and parsed threads carry messageCount (the full transcript count, not just the 200 kept messages).
  • AgentSessionImporter.listProjectAgentSessions returns the newest 50 sessions plus truncated. Each session is marked with the thread already holding it, found in one projection query: upstream's deterministic import:<instance>:<session> id, or any unarchived, undeleted thread in the project whose active provider thread's native id is that session (this covers threads T3 started itself). A single-session import runs upstream's importer path with a fresh, narrowed scan and returns threadIds.
  • Restored the web ImportConversationDialog.tsx, which now shows provider icons through <ProviderInstanceIcon driverKind=…/>. Its entry points are back: Import conversation into … in the command palette, and Import conversation… in the legacy sidebar's project menu, both gated on the capability.

Claude subagent worktrees get the project setup

  • apps/server/src/project/SubagentWorktreeSetup.ts is ported. It looks the project up through ProjectionStoreV2.getThreadShell, and ProjectSetupScriptRunner.runForThread is unchanged.
  • makeClaudeQueryOptions accepts hooks. ClaudeAdapterV2 builds a SubagentStart hook (makeSubagentWorktreeSetupHooks) when the setup service is present and the thread has a cwd. Each real path is prepared once per provider session, and the thread's own worktree is never prepared.
  • In server.ts, SubagentWorktreeSetup.layer sits beside the provider loggers so driver creation sees it, and installLive sits in the runtime core where the projection store and setup runner exist.

Relative commands and paths on mobile

  • buildThreadFeed takes workspaceRoot, and use-thread-composer-state passes the thread cwd. Work entries get relative commands (a leading cd to the workspace is dropped), tool labels, details, tool titles, and changed files. Copy text keeps the exact command.
  • workEntryRowLabel takes the root for read paths that come straight from tool input. ThreadFeed passes its existing workspaceRoot through ThreadWorkLog.
  • Fixed client-runtime's stale formatToolTextForWorkspace, which only recognised v1 item types. It now keys on the work entry's tone === "tool", like v2. Web's duplicate workEntryTextForWorkspace is removed in its favour.

Verification

  • npx tsc --noEmit -p . in apps/server, apps/web, apps/mobile, apps/desktop, packages/client-runtime, packages/contracts: clean.
  • apps/server: npx vp test run src/project/AgentSessionImporter.test.ts src/project/AgentSessionScanner.test.ts src/project/SubagentWorktreeSetup.test.ts src/auth/RpcAuthorization.test.ts src/orchestration-v2/Adapters/ClaudeSubagentWorktreeHooks.test.ts (100 passed), and src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts (140 passed).
  • apps/web: npx vp test run src/lib/threadTranscript.test.ts src/components/threadActionMenu.logic.test.ts src/components/chat/MessagesTimeline.logic.test.ts (164 passed).
  • apps/mobile: npx vp test run src/lib/threadActivity.test.ts (81 passed).
  • packages/client-runtime: npx vp test run src/work-log/commandDisplay.test.ts (32 passed).
  • npx vp check --fix on the changed files: 0 errors.

New tests:

  • Transcript builder on a v2 projection fixture.
  • Single-session import returning threadIds, and listing against a real in-memory projection that marks imported, T3-started, and archived holders.
  • List truncation.
  • Scanner narrowing, refresh, and message count.
  • The SubagentStart hook preparing each worktree once and skipping the thread's own.
  • Mobile label relativization.

Not restored / notes

  • No dev server or real-client pass was run.
  • The import picker stays web and desktop only, as before. There is no MCP tool for it, and the fork never had one.
  • The new sidebar's project control is a filter combobox with no context menu. There, the import picker is reached from the command palette, as in the fork.
  • docs/fork-differences.md still links packages/client-runtime/src/state/agentPanelView.ts for the Agents panel part of the relative-paths section. That file belongs to the Agents panel feature group, which is not restored on this base.

Done by Claude Opus 5.5 in Claude Code (via T3 Code).

🤖 Generated with Claude Code

…ktree setup on v2

Restores four fork features the orchestration v2 merge removed or left
half-wired:

- Export a transcript: buildThreadTranscript renders an
  OrchestrationV2ThreadProjection (timeline order via
  deriveTimelineEntriesFromVisibleTurnItems, header from projection.thread),
  loaded with a restored loadFullThreadSnapshot. The dialog and every entry
  point (thread action menu, sidebar, legacy sidebar, command palette) are back.
- Import a CLI conversation: agentSessions.list and single-session
  agentSessions.import on top of upstream's bulk importer. Sessions are marked
  with the thread holding them, by the deterministic import id or an unarchived
  thread's active provider thread. The web picker and its entry points return.
- Claude subagent worktrees get the project setup: a SubagentStart hook through
  makeClaudeQueryOptions in ClaudeAdapterV2, with SubagentWorktreeSetup reading
  the project from ProjectionStoreV2.
- Mobile work rows show commands and file paths relative to the thread
  workspace. formatToolTextForWorkspace now keys on the work entry's tone so it
  recognises v2 items, and web uses it instead of its own copy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant