ide на основе vs code
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
Status: done (unit-tested + live E2E verified).
> Generated by super-planner. Source: roadmap.md (phase 8). > Last updated: 2026-05-08 after council synthesis (GPT / Opus / Gemini) + grill pass.
Status: ready
Expose file reads/writes/edits as ToolResultFileEditContent in SessionToolCallComplete signals so the workbench can render before/after diffs and support per-file accept/reject undo. Mirrors the behavior of FileEditTracker in the Copilot path.
This phase also promotes FileEditTracker (and its session-db URI helpers) out of node/copilot/ into node/shared/, fixing pre-existing cross-folder imports in agentService.ts and sessionDiffAggregator.ts.
In scope:
FileEditTracker, buildSessionDbUri, parseSessionDbUri, ISessionDbUriFields from node/copilot/fileEditTracker.ts → node/shared/fileEditTracker.ts and update all import sites.ClaudeFileEditObserver to the SDK message stream in ClaudeAgentSession so assistant tool-use events call trackEditStart(filePath) and matching user tool-result events call completeEdit/takeCompletedEdit and stage content on mapper state.isClaudeFileEditTool(toolName) + getClaudeEditFilePath(toolName, input) helpers to claudeToolDisplay.ts (covers Write, Edit, MultiEdit, NotebookEdit; NOT Bash, TodoWrite).FileEditTracker owned by ClaudeAgentSession.ClaudeMapperState with cacheFileEdit(toolUseId, content) + takeFileEdit(toolUseId) to pre-stage ToolResultFileEditContent before the synchronous mapper fires.mapUserMessage to append cached file edits to Out of scope:
Query.rewindFiles() as the production undo path (granularity is wrong for per-file selective undo — see Decisions §D3). A validation unit test confirms the API doesn't break anything.sed -i, cat > file aren't surfaced as structured file-edit tool events in the SDK message stream).SessionToolCallComplete already emitted, ClaudeMapperState carries cross-message tool_use_id → turnId/toolName maps, canUseTool wired.FileEditTracker, buildSessionDbUri, parseSessionDbUri exist at node/copilot/fileEditTracker.ts.ISessionDataService.openDatabase(sessionUri) returns a ref-counted IReference<ISessionDatabase> (Copilot pattern at copilotAgentSession.ts:264).IInstantiationService is needed to construct FileEditTracker with DI-injected IFileService, IDiffComputeService, ILogService.Wire ClaudeFileEditObserver to the existing SDK message stream boundary. On assistant messages with file-edit tool uses (Write, Edit, MultiEdit, NotebookEdit), the observer snapshots before-state via FileEditTracker.trackEditStart(filePath) and records tool_use_id → path. On subsequent user messages with matching tool_result entries, it calls completeEdit + takeCompletedEdit and caches ToolResultFileEditContent on ClaudeMapperState keyed by tool_use_id. mapUserMessage remains synchronous and appends whatever staged file-edit content is available for that tool call.
The FileEditTracker is moved to node/shared/ (not copied) because agentService.ts and sessionDiffAggregator.ts already import it from the Copilot folder — fixing these cross-folder imports is low-risk scope that removes an existing layering smell.
Per-file undo is DB-backed: the workbench reads before/after content via resourceRead on session-db: URIs, then writes the before-content back to disk to reject an edit. The SDK's rewindFiles is not used in the production path (wrong granularity for selective per-file undo).
FileEditTracker to node/shared/ ✓Files: node/copilot/fileEditTracker.ts → node/shared/fileEditTracker.ts, then update importers.
Change: Rename/move the file. Update four import sites to point at ../shared/fileEditTracker.js (or ./shared/fileEditTracker.js depending on relative path):
node/agentService.ts:34 — parseSessionDbUrinode/sessionDiffAggregator.ts:10 — buildSessionDbUrinode/copilot/copilotAgentSession.ts:35 — FileEditTrackernode/copilot/mapSessionEvents.ts:15 — buildSessionDbUriAlso update test files that import from the old path:
test/node/fileEditTracker.test.tsgrep -r "copilot/fileEditTracker" in test/.Depends on: none
Done when: npm run valid-layers-check passes; no compile errors; all existing fileEditTracker.test.ts tests green.
---
claudeToolDisplay.ts ✓Files: node/claude/claudeToolDisplay.ts, test/node/claudeToolDisplay.test.ts
Change: Add two pure helpers:
/**
* Returns true for tools that produce on-disk file edits tracked by
* FileEditTracker. Excludes TodoWrite (in-memory todo list, no
* filesystem write) and Bash (edits not surfaced to SDK hooks).
*/
export function isClaudeFileEditTool(toolName: string): boolean {
return toolName === 'Write' || toolName === 'Edit'
|| toolName === 'MultiEdit' || toolName === 'NotebookEdit';
}
/**
* Extract the edited file path from the tool input for file-edit tools.
* Returns undefined for non-file-edit tools or malformed input.
*/
export function getClaudeEditFilePath(
toolName: string,
input: unknown,
): string | undefined {
if (typeof input !== 'object' || input === null) { return undefined; }
const rec = input as Record<string, unknown>;
switch (toolName) {
case 'Write':
case 'Edit':
case 'MultiEdit': {
const fp = rec.file_path;
return typeof fp === 'string' ? fp : undefined;
}
case 'NotebookEdit': {
const fp = rec.notebook_path;
return typeof fp === 'string' ? fp : undefined;
}
}
return undefined;
}Add to the existing snapshot test in claudeToolDisplay.test.ts.
Depends on: Step 1 (no dependency — can run in parallel)
Done when: snapshot test updated, no compile errors.
---
ClaudeMapperState with file-edit cache ✓Files: node/claude/claudeMapSessionEvents.ts, test/node/claudeMapSessionEvents.test.ts
Change: Add a cross-message _completedFileEdits map to ClaudeMapperState. The map is populated by the PostToolUse hook (Step 5) and consumed by mapUserMessage.
// In ClaudeMapperState:
private readonly _completedFileEdits = new Map<string, ToolResultFileEditContent>();
/**
* Called from the PostToolUse hook handler after `takeCompletedEdit`
* resolves. Stored here so the synchronous mapper can read it when
* the tool_result user message arrives.
*
* The SDK guarantees the hook completes (and the subprocess receives
* the hook response) before emitting the tool_result user message, so
* this map is always populated by the time mapUserMessage fires.
*/
cacheFileEdit(toolUseId: string, content: ToolResultFileEditContent): void {
this._completedFileEdits.set(toolUseId, content);
}
/**
* Consume and remove the cached file edit for this tool_use_id.
* Returns undefined if no edit was tracked (e.g. the tool was denied
* or was not a file-edit tool).
*/
takeFileEdit(toolUseId: string): ToolResultFileEditContent | undefined {
const content = this._completedFileEdits.get(toolUseId);
if (content) { this._completedFileEdits.delete(toolUseId); }
return content;
}Update mapUserMessage to append the cached edit:
// Inside the tool_result block loop in mapUserMessage:
const fileEdit = state.takeFileEdit(block.tool_use_id);
const content = extractToolResultContent(block.content);
if (fileEdit) { content.push(fileEdit); }
signals.push({
kind: 'action',
action: {
type: ActionType.SessionToolCallComplete,
// ...existing fields...
result: {
success: !isError,
pastTenseMessage: `${getClaudeToolDisplayName(tracked.toolName)} finished`,
content,
},
},
});Add mapper tests:
tool_result for a file-edit tool with a cached edit → SessionToolCallComplete.result.content includes ToolResultFileEditContent.tool_result for a non-file-edit tool (e.g. Read) → no ToolResultFileEditContent in content.takeFileEdit returns undefined, content is text-only.Depends on: Steps 1, 2
Done when: new mapper tests green, no compile errors.
---
FileEditTracker to ClaudeAgentSession ✓Files: node/claude/claudeAgentSession.ts
Change: Add FileEditTracker field and DB ref. Add handlePreToolUse and handlePostToolUse methods. Register the DB ref for disposal.
Constructor signature extends with:
constructor(
// ... existing params ...
private readonly _db: ISessionDatabase, // opened by ClaudeAgent
private readonly _instantiationService: IInstantiationService,
) { ... }Instantiate the tracker in the constructor (after super()):
private readonly _editTracker: FileEditTracker;
// In constructor:
this._editTracker = this._instantiationService.createInstance(
FileEditTracker,
this.sessionUri.toString(),
this._db,
);Also add a _editToolPaths: Map<string, string> (toolUseId → filePath) to avoid re-extracting the path in PostToolUse (file path is parsed once in PreToolUse and reused).
Hook handler methods (called from Options.hooks):
/**
* Phase 8: maps tool_use_id → filePath for edit tools. Populated in
* handlePreToolUse; consumed and removed in handlePostToolUse. Entries
* for denied tools (PostToolUse never fires) are dropped on session dispose.
*/
private readonly _editToolPaths = new Map<string, string>();
/**
* Called from Options.hooks.PreToolUse. Snapshots the file's current
* content as the "before" state for edit tools.
*
* Note: PreToolUse fires BEFORE canUseTool / permission check. If the
* user denies the tool, PostToolUse will NOT fire, leaving a dangling
* _editToolPaths entry and a _pendingEdits entry in the tracker.
* These are bounded by session lifetime and cause no corruption.
*/
async handlePreToolUse(
toolName: string,
toolInput: unknown,
toolUseId: string,
): Promise<void> {
if (!isClaudeFileEditTool(toolName)) { return; }
const filePath = getClaudeEditFilePath(toolName, toolInput);
if (!filePath) { return; }
this._editToolPaths.set(toolUseId, filePath);
try {
await this._editTracker.trackEditStart(filePath);
} catch (err) {
this._logService.warn(`[ClaudeAgentSession] PreToolUse trackEditStart failed: ${err}`);
this._editToolPaths.delete(toolUseId);
}
}
/**
* Called from Options.hooks.PostToolUse. Captures the "after" state,
* computes the diff, stores to DB, and caches the ToolResultFileEditContent
* on the mapper state so mapUserMessage can append it to
* SessionToolCallComplete synchronously.
*
* The subprocess is blocked waiting for this hook's return value before
* emitting the tool_result SDKMessage, so the cache is always populated
* before mapUserMessage fires.
*/
async handlePostToolUse(toolUseId: string, currentTurnId: string): Promise<void> {
const filePath = this._editToolPaths.get(toolUseId);
if (!filePath) { return; } // non-edit tool or denied before PreToolUse ran
this._editToolPaths.delete(toolUseId);
try {
await this._editTracker.completeEdit(filePath);
const fileEdit = await this._editTracker.takeCompletedEdit(
currentTurnId, toolUseId, filePath,
);
if (fileEdit) {
this._mapperState.cacheFileEdit(toolUseId, fileEdit);
}
} catch (err) {
this._logService.warn(`[ClaudeAgentSession] PostToolUse edit tracking failed: ${err}`);
}
}> Turn id in PostToolUse: handlePostToolUse needs the current turn id to pass to takeCompletedEdit. ClaudeAgentSession has _inFlightRequests[0]?.turnId which is the turn id of the in-flight request — valid because the single-in-flight invariant is maintained by _sessionSequencer.
Depends on: Steps 1, 2, 3
Done when: compile clean; unit test in claudeAgent.test.ts confirming handlePreToolUse / handlePostToolUse call through to the tracker mock.
---
ClaudeAgent._materializeProvisional + add DI ✓Files: node/claude/claudeAgent.ts, registration in node/agentHostMain.ts or node/agentHost.ts (wherever ClaudeAgent is registered)
Change 1: Add IInstantiationService to ClaudeAgent constructor:
@IInstantiationService private readonly _instantiationService: IInstantiationService,Change 2: In _createSessionWrapper, open the DB ref and pass it + _instantiationService to ClaudeAgentSession:
private _createSessionWrapper(
sessionId: string,
sessionUri: URI,
workingDirectory: URI | undefined,
warm: WarmQuery,
abortController: AbortController,
): ClaudeAgentSession {
const dbRef = this._sessionDataService.openDatabase(sessionUri);
const session = new ClaudeAgentSession(
sessionId, sessionUri, workingDirectory, warm, abortController,
this._onDidSessionProgress, this._logService,
dbRef.object, // ISessionDatabase
this._instantiationService, // for FileEditTracker DI
);
// Register the db ref on the session's dispose chain so it closes
// when the session is disposed. session.onDispose is not a thing —
// instead, pass the ref and let ClaudeAgentSession._register(dbRef)
// handle it.
return session;
}> DB ref disposal: Pass the IReference<ISessionDatabase> (not just .object) to ClaudeAgentSession so it can this._register(dbRef) for proper lifecycle management. Update the constructor signature accordingly.
Change 3: Wire Options.hooks in _materializeProvisional:
hooks: {
PreToolUse: [{
hooks: [async (input) => {
if (input.hook_event_name === 'PreToolUse') {
const session = this._sessions.get(sessionId);
await session?.handlePreToolUse(
input.tool_name,
input.tool_input,
input.tool_use_id,
);
}
return {};
}],
}],
PostToolUse: [{
hooks: [async (input) => {
if (input.hook_event_name === 'PostToolUse') {
const session = this._sessions.get(sessionId);
await session?.handlePostToolUse(
input.tool_use_id,
session?._currentTurnId ?? '',
);
}
return {};
}],
}],
},> HookJSONOutput: Return {} (an empty SyncHookJSONOutput) — no continue field needed; the SDK defaults to continuing. Use input.tool_use_id from the typed PreToolUseHookInput / PostToolUseHookInput rather than the second toolUseID param (which is string | undefined). The async hook blocks the subprocess until the Promise<HookJSONOutput> resolves, which is the required behavior for trackEditStart / completeEdit.
Change 4: Add enableFileCheckpointing: true to Options:
enableFileCheckpointing: true,This enables SDK-side file state tracking (future use by rewindFiles). Does not change the DB-backed undo path.
Change 5: Expose current turn id from ClaudeAgentSession:
get _currentTurnId(): string {
return this._inFlightRequests[0]?.turnId ?? '';
}Depends on: Steps 3, 4
Done when: existing tests pass; new agent test: _createSessionWrapper creates a DB ref + passes to session; Options.hooks.PreToolUse/PostToolUse are present on the captured options.
---
Files: test/node/claudeAgent.test.ts, test/node/claudeMapSessionEvents.test.ts, test/node/claudeAgent.integrationTest.ts, smoke.md, scripts/verify-claude-logs.sh
Unit tests — `claudeMapSessionEvents.test.ts`:
mapUserMessage with a tool_result block + a matching cached ToolResultFileEditContent on ClaudeMapperState → SessionToolCallComplete.result.content includes the edit.mapUserMessage with no cached edit → content is text-only (no regression).takeFileEdit after cache miss returns undefined.Unit tests — `claudeAgent.test.ts`:
_materializeProvisional captures Options with hooks.PreToolUse and hooks.PostToolUse present and callable.hooks.PreToolUse hook for an edit tool (Write) — with a real tool_use_id and file_path input — populates session._editToolPaths; for a non-edit tool (Read) it's a no-op (no entry added).hooks.PostToolUse after hooks.PreToolUse (with a FakeFileEditTracker stub that returns a canned ToolResultFileEditContent from takeCompletedEdit) results in mapperState.takeFileEdit(toolUseId) returning the canned content. Calling PostToolUse without a prior PreToolUse for the same id is a no-op.enableFileCheckpointing: true is present on captured Options.rewindFilesIntegration test — `claudeAgent.integrationTest.ts`:
Write tool use (approval auto-granted) → PostToolUse hook fires → SessionToolCallComplete signal contains ToolResultFileEditContent with non-empty before and after content URIs.Smoke:
smoke.md: "edit file, render diff in workbench, accept one file, reject another."verify-claude-logs.sh --phase=8: session/toolCall/complete actions contain fileEdit content type.Depends on: Steps 1–5
Done when: all tests green; npm run typecheck-client clean; smoke row added.
| Action | File | Purpose | |--------|------|---------| | Move | node/copilot/fileEditTracker.ts → node/shared/fileEditTracker.ts | Promote shared utility out of Copilot folder | | Modify | node/agentService.ts | Update import from ./copilot/fileEditTracker.js → ./shared/fileEditTracker.js | | Modify | node/sessionDiffAggregator.ts | Update import same as above | | Modify | node/copilot/copilotAgentSession.ts | Update import same as above | | Modify | node/copilot/mapSessionEvents.ts | Update import same as above | | Modify | test/node/fileEditTracker.test.ts | Update import path | | Modify | node/claude/claudeToolDisplay.ts | Add isClaudeFileEditTool(), getClaudeEditFilePath() | | Modify | test/node/claudeToolDisplay.test.ts | Extend snapshot with new helpers | | Modify | node/claude/claudeMapSessionEvents.ts | Add cacheFileEdit / takeFileEdit to ClaudeMapperState; update mapUserMessage to append cached edits | | Modify |
Resolved during council synthesis + grill pass. All five decisions are binding for implementation.
agentService.ts and sessionDiffAggregator.ts already import from node/copilot/fileEditTracker.ts; these are non-Copilot files making a cross-folder import (confirmed via grep). Moving to node/shared/ is four import-path updates and fixes the existing layering smell. NOT copied into node/claude/ (would duplicate 200 lines of identical logic) and NOT left in node/copilot/ (cross-agent import would propagate the smell). GPT initially disagreed (calling it import churn), but this import already exists outside the copilot path — moving is net-negative churn.Query.rewindFiles(userMessageId) rewinds ALL tracked files at once. Selective per-file undo requires either rewindFiles + re-apply accepted files, or direct IFileService.write(beforeContent). The DB-backed snapshot path (already implemented in FileEditTracker) provides before/after content as session-db: URIs; the workbench reads them via resourceRead and writes the before-content to disk on reject. This is the same mechanism the Copilot path uses. rewindFiles is deferred to a follow-up if the team wants bulk-rewind support.rewindFiles API shape doesn't throw (dryRun: true) so future phases can adopt it without guessing. If enabling it causes test failures (subprocess overhead, unexpected file mutations), flip to false and document.ToolResultFileEditContent in the async PostToolUse hook and caching on ClaudeMapperState keeps the mapper synchronous, avoids threading async callbacks through the existing mapSDKMessageToAgentSignals contract, and follows the same "cross-message state lives in mapper state" pattern established by Phase 7's toolCallTurnIds.TodoWrite updates Claude's in-memory todo list (no filesystem write). Including it would produce misleading diff output for a non-file artifact. getClaudeEditFilePath('TodoWrite', input) returns undefined by design.Promise<HookJSONOutput>) before it emits tool_result. The AsyncHookJSONOutput = { async: true } variant allows non-blocking hooks; our hooks return SyncHookJSONOutput = {} so the subprocess waits for full resolution. Validate in the integration test by asserting ToolResultFileEditContent is non-empty on SessionToolCallComplete. If the invariant fails (race condition observed in production), fall back to making mapUserMessage async with a small per-tool-call await fence.PreToolUse fires before canUseTool. If the user denies the tool, PostToolUse does not fire. This leaves a dangling _editToolPaths entry and a _pendingEdits entry in FileEditTracker (containing the file's before-content as a VSBuffer in memory). These entries are bounded by the session's lifetime and disposed with the session tracker. No corruption occurs: completeEdit checks _pendingEdits.get(filePath) before doing anything; takeCompletedEdit checks _completedEdits.get(filePath). Mitigation already in the design: _editToolPaths.delete(toolUseId) in the handlePreToolUse error path prevents the file-path mapping from being stale.@IInstantiationService to ClaudeAgent's constructor requires it to be declared BEFORE the non-service params (there are none in the current constructor, so ordering is not a concern). See Phase 1.5 learning: GetLeadingNonServiceArgs strips from the end, so branded service params must come last.ClaudeAgentSession must register dbRef via this._register(dbRef) (not dbRef.object) to ensure the IReference is disposed when the session is disposed. If the session disposes the db ref but the agent host tries to re-use the same session URI for another session, the DB will reopen cleanly (refcounted).FakeQuery in claudeAgent.test.ts doesn't currently implement rewindFiles. Add a stub that returns { canRewind: false } so Test H can pass without a real SDK subprocess.sed -i file, cat > file, and similar shell-mediated edits are not surfaced to PreToolUse/PostToolUse hooks because the SDK hooks fire per-tool-call, not per filesystem event. This is a documented gap in roadmap.md. Consider a file-watcher diff fallback in a follow-up phase.scripts/test.sh --grep "claudeMapSessionEvents|claudeToolDisplay|claudeAgent|fileEditTracker"Or using the unit-tests skill:
test/node/claudeMapSessionEvents.test.ts — Tests A, B, C green.test/node/claudeToolDisplay.test.ts — snapshot updated with new helpers.test/node/claudeAgent.test.ts — Tests D–H green; all existing tests still green.test/node/fileEditTracker.test.ts — import path updated, all passing.Integration:
scripts/test-integration.sh --grep "ClaudeAgent.*Phase 8"Test I: proxy-backed session produces ToolResultFileEditContent in SessionToolCallComplete.
Type-check:
npm run typecheck-client
npm run valid-layers-checkUse the `launch` skill (personal, ~/.agents/skills/launch/) to drive Code OSS and the `code-oss-logs` skill (.github/skills/code-oss-logs/) to verify agent-host logs.
Scenario: 1. Use launch to open Code OSS dev build pointing at a test workspace with a writable file. 2. Open a Claude session and send: "Edit test.ts — add a comment // Phase 8 test at the top." 3. Approve the Write/Edit permission prompt via the UI (from Phase 7's permission card). 4. Use code-oss-logs to read the agent-host log; confirm:
session/toolCall/complete action is logged with fileEdit content type.session-db: before/after URIs are non-empty strings.5. In the workbench, open the diff view for the edited file. Confirm before/after content renders. 6. Reject the edit (click "Undo" or equivalent); confirm the file reverts to pre-edit state. 7. Repeat with a second edit and accept; confirm the file retains the edit.
Run verify-claude-logs.sh --phase=8 after the operator session to assert the IPC log contains the required signal shape.
If E2E tooling is unavailable, run the dev build (scripts/code.sh) manually and perform the edit → diff render → accept/reject cycle from the console.
None at plan-acceptance time. All five council candidates from the planning pass were resolved during grilling and live in §Decisions.
./roadmap.md (Phase 8)./CONTEXT.md./phase7-plan.md (tool calls + permission)enableFileCheckpointing): extensions/copilot/src/extension/chatSessions/claude/node/claudeCodeAgent.tssrc/vs/platform/agentHost/node/copilot/fileEditTracker.tsnode_modules/@anthropic-ai/claude-agent-sdk/sdk.d.ts lines 726, 733, 1262, 1299, 1934, 1965, 2153, 2247launch (personal), code-oss-logs (repo)Verified end of implementation: 76 ClaudeAgent tests + 23 ClaudeMapSessionEvents tests + 8 ClaudeToolDisplay tests + 41 FileEditTracker/sessionDiffAggregator/historyRecord tests all green; full Claude grep suite 280 passing / 0 failing; tsgo watch reports 0 errors.
node/copilot/fileEditTracker.ts → node/shared/fileEditTracker.ts (via git mv; relative imports unchanged because nesting depth is identical). Updated 7 import sites: node/agentService.ts, node/sessionDiffAggregator.ts, node/copilot/copilotAgentSession.ts, node/copilot/mapSessionEvents.ts, test/node/fileEditTracker.test.ts, test/node/historyRecordFixtures.ts, test/node/historyRecordFixtures.test.ts, test/node/sessionDiffAggregator.test.ts.node/claude/claudeToolDisplay.ts: added isClaudeFileEditTool and getClaudeEditFilePath (covering Write/Edit/MultiEdit file_path and NotebookEdit notebook_path).node/claude/claudeMapSessionEvents.ts: added _completedFileEdits map plus cacheFileEdit_editToolPaths, PostToolUse drains it and stages content on the mapper) require a FakeFileEditTracker injected into the per-session instantiationService.createInstance(FileEditTracker, ...) call, which has no clean test seam without a _createFileEditTracker factory hook on ClaudeAgentSession. The behavior is exercised by the existing FileEditTracker unit tests (snapshot before, completeEdit, takeCompletedEdit) plus the negative-half hook tests; the wiring between session and tracker is straightforward enough that an IFileService-backed live test offers little additional coverage over the live E2E run. If a regression appears, add a FileEditTracker factory seam and revisit.enableFileCheckpointing: true is set in Options for forward-compatibility, but no production code invokes query.rewindFiles yet (Phase 8 uses the DB-backed undo path). Adding a FakeQuery.rewindFiles stub would only validate the SDK contract, which the SDK's own type definitions already enforce at compile time.claudeAgent.integrationTest.ts requires a SessionDatabase instance reachable to the integration harness plus a Write-tool prompt that hits the real Claude proxy; the live E2E (next bullet) covers the same ground end-to-end with stronger guarantees about real SDK hook timing._completedFileEdits is keyed only by tool_use_id (not (turnId, toolUseId)) because the SDK guarantees tool_use_id uniqueness within a session and Phase 6's per-session sequencer keeps at most one in-flight turn at a time.PostToolUse hook resolves {} (a SyncHookJSONOutput) on every path including errors, so a tracker failure (e.g. IFileService read error) is logged but never blocks the SDK from emitting the matching tool_result. The user still sees the tool result; only the file-edit content block is missing.handlePreToolUse writes to _editToolPaths BEFORE awaiting trackEditStart, so a denial that fires between Pre and Post hooks (which leaves a dangling map entry plus a _pendingEdits VSBuffer in the tracker) is bounded by session lifetime — both maps are disposed when the session disposes.dbRef is registered in the ClaudeAgentSession constructor BEFORE the WarmQuery abort registration so the database stays open while the SDK's in-flight tool_result is being processed; the order is enforced by the _register chain in Disposable.disposeSessionToolCallComplete.result.contentenableFileCheckpointing: true in Options (safe — doesn't affect DB-backed undo path, enables future rewindFiles validation).claudeAgent.test.ts + claudeMapSessionEvents.test.ts. Integration test (proxy-backed). Smoke row in smoke.md.query.rewindFiles(someUserMessageId, { dryRun: true })FakeQueryrewindFiles{ canRewind: boolean }test/node/claudeMapSessionEvents.test.tsnode/claude/claudeAgentSession.tsFileEditTrackerhandlePreToolUsehandlePostToolUse_currentTurnIdnode/claude/claudeAgent.tsIInstantiationService_createSessionWrapperhooks.PreToolUse/PostToolUseenableFileCheckpointing: true_materializeProvisionaltest/node/claudeAgent.test.tsFakeQueryrewindFilestest/node/claudeAgent.integrationTest.tsToolResultFileEditContentsmoke.mdscripts/verify-claude-logs.sh--phase=8takeFileEditClaudeMapperStatemapUserMessagetool_resultToolResultContent[]ToolResultFileEditContentnode/claude/claudeAgentSession.ts: added FileEditTracker, _editToolPaths, public currentTurnId getter, handlePreToolUse, handlePostToolUse; constructor now takes IReference<ISessionDatabase> (positional, registered for dispose ahead of the WarmQuery abort) and @IInstantiationService.node/claude/claudeAgent.ts: added @IInstantiationService to constructor; _createSessionWrapper now opens a session-scoped dbRef via _sessionDataService.openDatabase and uses instantiationService.createInstance(ClaudeAgentSession, ...). Options for sdk.startup now carries enableFileCheckpointing: true and hooks.PreToolUse / hooks.PostToolUse callbacks that look the session up by sessionId and forward to handlePreToolUse / handlePostToolUse (callbacks return the synchronous no-op {} so SDK behavior is unchanged).test/node/claudeAgent.test.ts: updated the existing Phase 7 §3.2 dispose test to pass a dbRef and use createInstance; added a new 'ClaudeAgent (Phase 8 — file edit tracking hooks)' suite with three tests (D + G combined: Options shape; E negative half: PreToolUse for Read is {}; F negative half: PostToolUse for unknown id is {}).node/claude/smoke.md: added Phase-8 row.file_searchWrite / Edit, approving the permission, and inspecting the agent-host log for the ToolResultFileEditContent block is the canonical Phase-8 acceptance check. It requires a live Claude proxy connection plus an interactive permission flow and was not run as part of this implementation pass; the user should run it before tagging Phase 8 production-ready. The smoke.md Phase-8 row enumerates the exact assertions to verify.