ide на основе vs code
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
> Generated by super-planner. Source: roadmap.md (phase 13). > Last updated: 2026-05-13 after 3-model council synthesis (GPT-5.5, Claude Opus 4.6, GPT-5.3-Codex).
Status: ✅ done — unit + integration tests green (101 tests across mapper + agent suites), typecheck-client clean, council-reviewed. Live E2E (restart-and-restore via the launch skill) deferred — the read path is straightforward and fixtures cover the M7 grouping rules; can run anytime self-hosting surfaces a real issue.
Implement IAgent.getSessionMessages(session) for the Claude provider so the workbench can reload an existing Claude session's full transcript across agent-host restarts. Unblocks self-hosting.
Fork support (Phase 6.5) is explicitly *not* a Phase 13 concern. The earlier plan proposed returning a protocolTurnId → lastSdkAssistantMessageUuid map as a by-product for fork to consume — dropped during impl. Fork is rare; if/when Phase 6.5 lands, it walks the JSONL transcript itself rather than paying ongoing complexity for an O(1) lookup that's exercised on a cold path.
In scope
getSessionMessages(sessionId, { dir?, includeSystemMessages: true }).claudeReplayMapper.ts: flat SessionMessage[] → Turn[] per CONTEXT M7 grouping rules.ClaudeAgent.getSessionMessages end-to-end: parse URI, fetch transcript, map to turns, resilient error handling.Complete if no orphan tool_use remains, otherwise Cancelled.Task / Agent tool_use flattens to a terminal ToolCall with _meta.toolKind = 'subagent' plus an inlined ToolResultContentType.Subagent content marker.<parent>/subagent/<toolCallId>): rejected with TODO: Phase 12 (no SDK call).Out of scope
IAgent.getSessionMessages shape forever. If a future consumer needs the mapping, it can either (a) reconstruct it by walking the SDK's SessionMessage[] itself, or (b) reintroduce a per-turn DB row (~30 lines on ClaudeSessionMetadataStore). Phase 13 owns neither path.getSubagentMessages) — owned by Phase 12.IAgent.truncateSession — explicitly NOT implemented; clients fork instead. Truncate is fork-by-another-name.SessionMessage.uuid itself when it lands; one JSONL read per fork. Phase 13 leaves no hooks for it.IClaudeSessionTranscriptStore seam (originally deferred from Phase 5). Dropped per Q4 — a one-method passthrough wrapper around IClaudeAgentSdkService.getSessionMessages adds no behavior. Introduce when a second consumer exists.TurnState variant.ClaudeMapperState) ✅, Phase 9 (abort/steering polish) ✅.AgentHostClaudeSdkRootEnvVar (current dev mechanism) and matches whatever version is on disk; long-term distribution is Phase 15's marketplace-extension story. Phase 13 binds against the SDK shape currently exposed by `claudeAgentSdkService.ts` and does not assume a specific package version.Replay produces `Turn[]` directly. Council unanimous: do not synthesize AgentSignal[] and run them through the protocol reducer. Replay has no live result metadata, no stream_event lifecycle, and IAgent.getSessionMessages already returns readonly Turn[] (`agentService.ts:454`). Copilot's reference does the same (`copilot/mapSessionEvents.ts` → getMessages at `copilotAgentSession.ts:776`).
Shared invariant, not shared code. The two drivers (live mapSDKMessageToAgentSignals and the new replay mapSessionMessagesToTurns) operate on different SDK input shapes (SDKMessage union vs. SessionMessage union) and different output shapes (AgentSignal[] vs. Turn[]). What they share is the Map<tool_use_id, turnId> attribution invariant from CONTEXT M7. Lower-level helpers (tool-display lookup via `claudeToolDisplay.ts`, tool-result content extraction, subagent marker construction) are extracted and reused.
No turn-mapping by-product. The mapper returns readonly Turn[] and nothing else. The earlier plan threaded a turnIdToLastAssistantUuid map through the return type for Phase 6.5 fork; reverted entirely. Rationale: fork is rare, the only consumer is hypothetical Phase 6.5, and paying a wider return type plus the discipline to keep that map correct forever isn't worth optimizing a cold path. Phase 6.5, if/when it lands, reconstructs the mapping itself from the same SessionMessage[] the mapper consumes.
> Critical id-correctness note (for future fork work). The SDK distinguishes the envelope uuid (SessionMessage.uuid / SDKAssistantMessage.uuid — a UUID v4 the SDK assigns and persists in JSONL) from the Anthropic message id (event.message.id — a msg_… string from Anthropic's API). forkSession({ upToMessageId }) accepts the envelope uuid only (`sdk.d.ts:3561-3567`, `sdk.d.ts:610-614`). Phase 13 doesn't surface either id; this note exists for Phase 6.5's benefit so it picks the right id class when it lands.
1. ✓ Add `getSessionMessages` to the SDK service. Extend IClaudeAgentSdkService and IClaudeSdkBindings with the new method.
IClaudeAgentSdkService.getSessionMessages(id, { includeSystemMessages: true }) forwards to SDK and returns SessionMessage[]. New unit test stubs the binding via the existing _loadSdk override.2. ✓ Build replay mapper `mapSessionMessagesToTurns`. Single-pass over SessionMessage[] per CONTEXT M7 grouping rules:
('user', text) → start Turn with id = sessionMessage.uuid.('user', tool_result) → attach to open ToolCall. NOT a turn boundary.('user', empty / hook-injected / shouldQuery: false) → drop.('assistant', blocks…) → push Markdown / Reasoning / ToolCall (terminal Completed only) parts.('system', compact_boundary | allowlisted subtype) → push SystemNotificationResponsePart on the active turn. NOT a turn boundary.('system', other) → drop.toolUseToTurnId: Map<string, string> (the M7 attribution invariant — tool_result legitimately lands in a *later* user message), and a per-turn Set<string> of tool_use_ids announced by that turn. Tool-use additions go into both; tool_result removes from the per-turn set of the *announcing* turn (looked up via the cross-turn map).TurnState.Complete3. ✓ Replace `ClaudeAgent.getSessionMessages` stub. Replace the 7-line stub at `claudeAgent.ts:604`.
<parent>/subagent/<toolCallId> per `parseSubagentSessionUri`) → throw Error('TODO: Phase 12: subagent transcript fetch not yet implemented'). No SDK call.[].this._sdkService.getSessionMessages(AgentSession.id(session), { includeSystemMessages: true }) → run replay mapper → return Turn[].listSessions resilience pattern at `claudeAgent.ts:636`: warn-log + return [] on transcript-fetch / mapping failure.SessionMessage[] and returns the mapped Turn[].5. ~~Live `(turnId, lastAssistantEnvelopeUuid)` ingest.~~ Removed during impl. No persistence at all. Fork is rare and is owned by Phase 6.5; if it ever lands, it reads SessionMessage.uuid directly off the SDK transcript rather than relying on a Phase 13 by-product. See "Out of scope" above.
6. ✓ Unit tests. See Verification.
src/vs/platform/agentHost/test/node/claudeReplayMapper.test.tstypecheck-client clean, valid-layers-check clean.| Path | Change | Notes | |------|--------|-------| | claudeAgentSdkService.ts | modify | Add getSessionMessages to interface + bindings + impl | | claudeReplayMapper.ts | create | mapSessionMessagesToTurns() — flat SessionMessage[] → readonly Turn[] per CONTEXT M7 | | claudeAgent.ts | modify | Replace getSessionMessages stub at line 604; call _sdkService.getSessionMessages directly | | claudeAgent.test.ts | modify | Extend fake SDK with getSessionMessages; add subagent-URI throw test, error-path test, happy-path test | | claudeReplayMapper.test.ts | create | 10 fixture-driven unit tests |
Turn[] directly; it does NOT round-trip through AgentSignal[] + reducer. IAgent.getSessionMessages returns readonly Turn[] so the indirection would buy nothing, and replay lacks the live result metadata the reducer expects. Mirrors Copilot's reference at `copilot/mapSessionEvents.ts:223`. Shared invariant is the Map<tool_use_id, turnId> attribution + the M7 grouping rules — shared as a doc + extracted helpers, not a shared mapper module.setTurnEventId/getTurnEventId~~ Reverted during impl — not persisted *and* not returned as a by-product. Phase 6.5 fork, if/when it lands, reconstructs the mapping itself from SessionMessage[]. Rationale: fork is the only consumer of this mapping and it's a cold path; not worth widening the mapper's return type forever.'Task' and 'Agent'. SDK-confirmed: built-in subagents are invoked "via the Task tool" (`sdk.d.ts:95`) and custom subagents "via the Agent tool" (`sdk.d.ts:36`). The production extension's dispatcher matches both at `claudeMessageDispatch.ts:194`. Marker shape: _meta: { toolKind: 'subagent' } plus a ToolResultContentType.Subagent content block, matching Copilot's makeCompletedToolCallPart.SessionToolCallStart / SessionToolCallComplete actions) and through the replay mapper (asserting the matching Turn/ToolCall shape) and assert they produce the same logical attribution.type === 'user' + Array.isArray(content), etc.). Drop unrecognizable messages silently — matches the production extension's parser semantics per CONTEXT M7 glossary.SessionMessage.uuid is the envelope uuid forkSession({ upToMessageId }) accepts; message.id is the Anthropic msg_… id, which fork does *not* accept) so Phase 6.5 picks the right id class when it consumes SessionMessage itself.claudeToolDisplay.ts is the single source of truth for tool kinds — add new entries there and the replay mapper picks them up via the same lookup.includeSystemMessages: true adds many subtypes. Mitigation: explicit allowlist from CONTEXT M7 (only claudeReplayMapper.test.ts): 1. Single-text turn → one Turn, id === userMessage.uuid, usage === undefined, state === Complete. 2. Tool-use + tool-result → one Turn containing one ToolCall with state === Completed; no extra turn for the synthetic-user tool_result. 3. Multi-turn (text→assistant→text→assistant) → two Turns in order. 4. compact_boundary mid-turn → SystemNotificationResponsePart on the active turn, no boundary. 5. Task tool_use + tool-result → _meta.toolKind === 'subagent' and ToolResultContentType.Subagent marker present in content[]. 6. Tail-Turn with orphan tool_use (no matching tool_result) → state === Cancelled. 7. Non-allowlisted system subtype → dropped.
SessionMessage[] → assert the resulting Turn[] matches snapshot.TODO: Phase 12 and makes no SDK call.[].[] and logs a warning.typecheck-client clean, valid-layers-check clean, npm run eslint clean, npm run gulp hygiene clean.Run via VS Code's runTests tool against the test files, or fall back to scripts/test.sh --grep "Phase 13|getSessionMessages|claudeReplayMapper".
Workspace skills available for E2E:
Scenario — restart-and-restore: 1. Use launch to start Code OSS Agents (./scripts/code.sh --agents), open the Agents window, create a new Claude session, send a prompt that triggers at least one tool call (e.g., "list files in the current directory" → Bash or Read). 2. Wait for the turn to settle. Take a screenshot of the rendered turn. 3. Close the Agents window (do not quit the agent host process initially). 4. Re-open the same session via the sessions sidebar. 5. Confirm the full turn (user message + assistant text + tool call card) renders identically. Screenshot for comparison. 6. Use code-oss-logs to read agenthost.log for the run; grep for [Claude] warnings during getSessionMessages — none expected on the happy path. 7. Quit and relaunch the agent host (Run and Compile Agents - OSS). Re-open the same session. Confirm restoration still works (no in-memory _sessions entry). 8. Append a new turn to the restored session and confirm it lands cleanly (validates that a restored session can still take new messages).
Not used: chat-perf — Phase 13 adds no rendering-hot paths or response-streaming changes; chat-perf belongs to Phase 14 hardening.
getSessionMessages returns the full transcript._None remaining._ All grilling-phase questions resolved — see Decisions table.
Turn.id + Tool-call attribution map)getSessionMessages (line 1056), ../copilot/copilotAgentSession.ts getMessages (line 776), ../copilot/mapSessionEvents.tsgetSessionMessages wrapperIClaudeSessionTranscriptStore deferral note at line 367), phase6-plan.md, phase9-plan.md, phase6.1-plan.mdProduction:
getSessionMessages to interface + bindings + impl.mapSessionMessagesToTurns(messages, session, logService): readonly Turn[] per CONTEXT M7. Pure function; no by-products, no persistence.getSessionMessages stub with subagent-URI dispatch + provisional check + transcript fetch + replay (no persistence).Tests:
Agent-name, and CLI-echo synthetic-message drop.[]).getSessionMessages no-op stub on ProxyRoundTripSdkService to satisfy the updated interface.claudeSdkPipeline.ts, claudeMapSessionEvents.ts, claudeSdkMessageRouter.ts, or claudeSessionMetadataStore.ts. Phase 6.5 will read SessionMessage.uuid itself if/when it lands.{ turns, turnIdToLastAssistantUuid } so fork could consume the map without persistence. Reverted during architectural cleanup — same rationale as the persistence drop, applied one layer up: fork is rare, the mapping is reconstructible from SessionMessage[], and a wider return type taxes every caller forever to optimize a cold path. Plan/Scope/Approach/Steps/Files-table/Decisions sections updated to reflect readonly Turn[] as the sole return.mapSessionMessagesToTurns(messages, session) returns turns. Real signature is (messages, session, logService) — the logger is needed for orphan-tool warns. Cosmetic difference.ReplayBuilder. Pure internal refactor; public API unchanged.ReplayBuilder.consume()'s switch arms per the avoid-private-methods audit. Builder now has 5 privates (down from 7) covering the state-machine transitions only.Three-model council review (GPT-5.5, Claude Opus 4.6, GPT-5.3-Codex) caught documentation drift between the plan and the shipped code, plus one missing test. Resolved:
turnIdToLastAssistantUuid map documented in ~15 places but never shipped. Captured the drop across plan + roadmap.incorrectly implements diagnostic on ProxyRoundTripSdkService. Native typecheck was already clean; tightened the stub signature for IDE consistency.[]" integration test. Added.claudeToolDisplay.ts is the single source of truth for subagent tool names" claim was inaccurate (the mapper hard-codes SUBAGENT_TOOL_NAMES). Risks section corrected.Full synthesis saved to session memory as review.md for the record.
'ClaudeAgent (Phase 13 — getSessionMessages)' suite — all green.claudeSdkPipeline.test.ts, claudeSessionMetadataStore.test.ts, full claudeAgent.test.ts) green: 118 tests pass; zero regressions.typecheck-client clean.avoid-private-methods auditRun against changed production files in claudeReplayMapper.ts after refactors #1–#3. Findings:
ReplayBuilder has 5 private methods after the inlining round (_consumeAssistant, _openToolUse, _attachToolResult, _findToolCallPart, _closeActive). All operate on the same private state (_active, _turns, _toolUseToTurnId) and form a single state machine. Class-level signal: NONE. No extractions recommended; the parser was already extracted as parseSessionMessage in refactor #2._consume{User,Assistant,System} cluster was the only flagged item; refactor #2 dissolved it by moving SDK shape detection into the parseSessionMessage adapter.extractToolResultContent helper — currently duplicated across `claudeMapSessionEvents.ts` and `claudeReplayMapper.ts`. Plan said "extract to shared"; in practice the two copies are 12 lines each and diverge in handling. Defer extraction until a third consumer or the divergence becomes a maintenance burden.notification at all priorities (the mapper's current behavior). Re-introduce a priority ≥ medium gate once we have real-world data on what priority: 'low' notifications actually carry; if they turn out to be noise, drop them on replay.Unit + integration suites all green (101 tests); typecheck-client clean. Live restart-and-restore E2E deferred — the launch + log skills are documented in the Verification section if a real bug ever motivates running them; for now the fixture coverage of M7 grouping rules is enough to trust the read path.
TurnState.CancelledIncompleteusage = undefined (live-only metadata, M8 asymmetry).'Task' or 'Agent' → _meta: { toolKind: 'subagent' } + ToolResultContentType.Subagent marker block (mirrors `copilot/mapSessionEvents.ts:617-639`).readonly Turn[].src/vs/platform/agentHost/node/claude/claudeReplayMapper.tsTurnState.CompletependingToolUseIds.size === 0TurnState.CancelledIncompleteCancelledClaudeSdkPipeline._processMessages 'result' branch~~ Removed during impl along with Q2 — no live ingest, no hook.getSessionMessages, idempotent.~~ Removed during impl — no backfill at all.sessionStore hybrid impl) actually exists. Direct _sdkService.getSessionMessages call at the one consumer site.GetSessionMessagesOptions includes the field). Surfaces compact_boundary and notification subtypes; replay applies the M7 allowlist (only compact_boundary and a small set of explicit subtypes become SystemNotificationResponsePart; everything else drops).[]. Mirrors listSessions at `claudeAgent.ts:636` and the AgentService resilience pattern. One corrupt session must not break the whole restoration flow.IClaudeAgentSdkService.getSessionMessages returning canned SessionMessage[] fixtures. Integration tests for the agent surface (happy path, subagent URI throw, SDK throw → []).compact_boundaryAgentHostClaudeSdkRootEnvVar and Phase 13 binds against whatever shape claudeAgentSdkService.ts currently exposes; long-term version distribution is Phase 15's marketplace-extension problem (see roadmap.md §Phase 15).notification (priority ≥ medium); the mapper allowlists all priorities. CONTEXT M7 updated to match shipped behavior with a TODO to re-introduce the gate once real-world data shows whether priority: 'low' notifications are noise.ProxyRoundTripSdkService had to grow a getSessionMessages stub when the interface widened. Trivial.