@code-yeongyu/senpi-agent-core 2026.9.12 → 2026.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/harness/agent-harness.d.ts +639 -384
- package/dist/harness/agent-harness.d.ts.map +1 -1
- package/dist/harness/agent-harness.js +5 -250
- package/dist/harness/agent-harness.js.map +1 -1
- package/dist/harness/compaction/branch-summarization.d.ts +12 -6
- package/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/harness/compaction/branch-summarization.js +33 -27
- package/dist/harness/compaction/branch-summarization.js.map +1 -1
- package/dist/harness/compaction/compaction.d.ts +30 -8
- package/dist/harness/compaction/compaction.d.ts.map +1 -1
- package/dist/harness/compaction/compaction.js +53 -64
- package/dist/harness/compaction/compaction.js.map +1 -1
- package/dist/harness/config.d.ts +9 -0
- package/dist/harness/config.d.ts.map +1 -0
- package/dist/harness/config.js +35 -0
- package/dist/harness/config.js.map +1 -0
- package/dist/harness/context.d.ts +9 -0
- package/dist/harness/context.d.ts.map +1 -0
- package/dist/harness/context.js +13 -0
- package/dist/harness/context.js.map +1 -0
- package/dist/harness/env/nodejs.d.ts +25 -28
- package/dist/harness/env/nodejs.d.ts.map +1 -1
- package/dist/harness/env/nodejs.js +368 -125
- package/dist/harness/env/nodejs.js.map +1 -1
- package/dist/harness/events.d.ts +20 -38
- package/dist/harness/events.d.ts.map +1 -1
- package/dist/harness/events.js +233 -55
- package/dist/harness/events.js.map +1 -1
- package/dist/harness/execution/assistant.d.ts +42 -0
- package/dist/harness/execution/assistant.d.ts.map +1 -0
- package/dist/harness/execution/assistant.js +82 -0
- package/dist/harness/execution/assistant.js.map +1 -0
- package/dist/harness/execution/effect-gate.d.ts +22 -0
- package/dist/harness/execution/effect-gate.d.ts.map +1 -0
- package/dist/harness/execution/effect-gate.js +48 -0
- package/dist/harness/execution/effect-gate.js.map +1 -0
- package/dist/harness/execution/tools.d.ts +67 -0
- package/dist/harness/execution/tools.d.ts.map +1 -0
- package/dist/harness/execution/tools.js +121 -0
- package/dist/harness/execution/tools.js.map +1 -0
- package/dist/harness/hooks.d.ts +38 -0
- package/dist/harness/hooks.d.ts.map +1 -0
- package/dist/harness/hooks.js +404 -0
- package/dist/harness/hooks.js.map +1 -0
- package/dist/harness/messages.d.ts +2 -2
- package/dist/harness/messages.d.ts.map +1 -1
- package/dist/harness/messages.js.map +1 -1
- package/dist/harness/prompt-templates.d.ts +3 -2
- package/dist/harness/prompt-templates.d.ts.map +1 -1
- package/dist/harness/prompt-templates.js +17 -17
- package/dist/harness/prompt-templates.js.map +1 -1
- package/dist/harness/result.d.ts +93 -0
- package/dist/harness/result.d.ts.map +1 -1
- package/dist/harness/result.js +39 -0
- package/dist/harness/result.js.map +1 -1
- package/dist/harness/runtime/drive/boundary.d.ts +28 -0
- package/dist/harness/runtime/drive/boundary.d.ts.map +1 -0
- package/dist/harness/runtime/drive/boundary.js +173 -0
- package/dist/harness/runtime/drive/boundary.js.map +1 -0
- package/dist/harness/runtime/drive/checkpoint.d.ts +8 -0
- package/dist/harness/runtime/drive/checkpoint.d.ts.map +1 -0
- package/dist/harness/runtime/drive/checkpoint.js +133 -0
- package/dist/harness/runtime/drive/checkpoint.js.map +1 -0
- package/dist/harness/runtime/drive/deferred.d.ts +15 -0
- package/dist/harness/runtime/drive/deferred.d.ts.map +1 -0
- package/dist/harness/runtime/drive/deferred.js +179 -0
- package/dist/harness/runtime/drive/deferred.js.map +1 -0
- package/dist/harness/runtime/drive/generation.d.ts +8 -0
- package/dist/harness/runtime/drive/generation.d.ts.map +1 -0
- package/dist/harness/runtime/drive/generation.js +205 -0
- package/dist/harness/runtime/drive/generation.js.map +1 -0
- package/dist/harness/runtime/drive/reconcile.d.ts +5 -0
- package/dist/harness/runtime/drive/reconcile.d.ts.map +1 -0
- package/dist/harness/runtime/drive/reconcile.js +140 -0
- package/dist/harness/runtime/drive/reconcile.js.map +1 -0
- package/dist/harness/runtime/drive/recovery.d.ts +8 -0
- package/dist/harness/runtime/drive/recovery.d.ts.map +1 -0
- package/dist/harness/runtime/drive/recovery.js +85 -0
- package/dist/harness/runtime/drive/recovery.js.map +1 -0
- package/dist/harness/runtime/drive/response.d.ts +23 -0
- package/dist/harness/runtime/drive/response.d.ts.map +1 -0
- package/dist/harness/runtime/drive/response.js +394 -0
- package/dist/harness/runtime/drive/response.js.map +1 -0
- package/dist/harness/runtime/drive/retry.d.ts +4 -0
- package/dist/harness/runtime/drive/retry.d.ts.map +1 -0
- package/dist/harness/runtime/drive/retry.js +34 -0
- package/dist/harness/runtime/drive/retry.js.map +1 -0
- package/dist/harness/runtime/drive/structural.d.ts +32 -0
- package/dist/harness/runtime/drive/structural.d.ts.map +1 -0
- package/dist/harness/runtime/drive/structural.js +929 -0
- package/dist/harness/runtime/drive/structural.js.map +1 -0
- package/dist/harness/runtime/drive/terminal.d.ts +7 -0
- package/dist/harness/runtime/drive/terminal.d.ts.map +1 -0
- package/dist/harness/runtime/drive/terminal.js +49 -0
- package/dist/harness/runtime/drive/terminal.js.map +1 -0
- package/dist/harness/runtime/drive/tool-placement.d.ts +14 -0
- package/dist/harness/runtime/drive/tool-placement.d.ts.map +1 -0
- package/dist/harness/runtime/drive/tool-placement.js +244 -0
- package/dist/harness/runtime/drive/tool-placement.js.map +1 -0
- package/dist/harness/runtime/drive/tools.d.ts +6 -0
- package/dist/harness/runtime/drive/tools.d.ts.map +1 -0
- package/dist/harness/runtime/drive/tools.js +449 -0
- package/dist/harness/runtime/drive/tools.js.map +1 -0
- package/dist/harness/runtime/drive.d.ts +6 -0
- package/dist/harness/runtime/drive.d.ts.map +1 -0
- package/dist/harness/runtime/drive.js +93 -0
- package/dist/harness/runtime/drive.js.map +1 -0
- package/dist/harness/runtime/harness.d.ts +59 -0
- package/dist/harness/runtime/harness.d.ts.map +1 -0
- package/dist/harness/runtime/harness.js +302 -0
- package/dist/harness/runtime/harness.js.map +1 -0
- package/dist/harness/runtime/index.d.ts +2 -0
- package/dist/harness/runtime/index.d.ts.map +1 -0
- package/dist/harness/runtime/index.js +2 -0
- package/dist/harness/runtime/index.js.map +1 -0
- package/dist/harness/runtime/lane.d.ts +118 -0
- package/dist/harness/runtime/lane.d.ts.map +1 -0
- package/dist/harness/runtime/lane.js +1559 -0
- package/dist/harness/runtime/lane.js.map +1 -0
- package/dist/harness/runtime/progress.d.ts +15 -0
- package/dist/harness/runtime/progress.d.ts.map +1 -0
- package/dist/harness/runtime/progress.js +66 -0
- package/dist/harness/runtime/progress.js.map +1 -0
- package/dist/harness/runtime/reducer.d.ts +5 -0
- package/dist/harness/runtime/reducer.d.ts.map +1 -0
- package/dist/harness/runtime/reducer.js +240 -0
- package/dist/harness/runtime/reducer.js.map +1 -0
- package/dist/harness/runtime/restore.d.ts +24 -0
- package/dist/harness/runtime/restore.d.ts.map +1 -0
- package/dist/harness/runtime/restore.js +117 -0
- package/dist/harness/runtime/restore.js.map +1 -0
- package/dist/harness/runtime/transcript.d.ts +21 -0
- package/dist/harness/runtime/transcript.d.ts.map +1 -0
- package/dist/harness/runtime/transcript.js +72 -0
- package/dist/harness/runtime/transcript.js.map +1 -0
- package/dist/harness/runtime/types.d.ts +105 -0
- package/dist/harness/runtime/types.d.ts.map +1 -0
- package/dist/harness/runtime/types.js +50 -0
- package/dist/harness/runtime/types.js.map +1 -0
- package/dist/harness/session/commit.d.ts +53 -0
- package/dist/harness/session/commit.d.ts.map +1 -0
- package/dist/harness/session/commit.js +57 -0
- package/dist/harness/session/commit.js.map +1 -0
- package/dist/harness/session/context.d.ts +6 -19
- package/dist/harness/session/context.d.ts.map +1 -1
- package/dist/harness/session/context.js +31 -53
- package/dist/harness/session/context.js.map +1 -1
- package/dist/harness/session/fork-policy.d.ts +21 -0
- package/dist/harness/session/fork-policy.d.ts.map +1 -0
- package/dist/harness/session/fork-policy.js +55 -0
- package/dist/harness/session/fork-policy.js.map +1 -0
- package/dist/harness/session/fork.d.ts +16 -0
- package/dist/harness/session/fork.d.ts.map +1 -0
- package/dist/harness/session/fork.js +79 -0
- package/dist/harness/session/fork.js.map +1 -0
- package/dist/harness/session/in-memory-storage-state.d.ts +39 -0
- package/dist/harness/session/in-memory-storage-state.d.ts.map +1 -0
- package/dist/harness/session/in-memory-storage-state.js +269 -0
- package/dist/harness/session/in-memory-storage-state.js.map +1 -0
- package/dist/harness/session/index.d.ts +9 -5
- package/dist/harness/session/index.d.ts.map +1 -1
- package/dist/harness/session/index.js +7 -4
- package/dist/harness/session/index.js.map +1 -1
- package/dist/harness/session/jsonl/codec.d.ts +19 -8
- package/dist/harness/session/jsonl/codec.d.ts.map +1 -1
- package/dist/harness/session/jsonl/codec.js +34 -219
- package/dist/harness/session/jsonl/codec.js.map +1 -1
- package/dist/harness/session/jsonl/fork.d.ts +38 -0
- package/dist/harness/session/jsonl/fork.d.ts.map +1 -0
- package/dist/harness/session/jsonl/fork.js +266 -0
- package/dist/harness/session/jsonl/fork.js.map +1 -0
- package/dist/harness/session/jsonl/index.d.ts +4 -0
- package/dist/harness/session/jsonl/index.d.ts.map +1 -0
- package/dist/harness/session/jsonl/index.js +4 -0
- package/dist/harness/session/jsonl/index.js.map +1 -0
- package/dist/harness/session/jsonl/io.d.ts +14 -0
- package/dist/harness/session/jsonl/io.d.ts.map +1 -0
- package/dist/harness/session/jsonl/io.js +86 -0
- package/dist/harness/session/jsonl/io.js.map +1 -0
- package/dist/harness/session/jsonl/legacy-v3.d.ts +44 -0
- package/dist/harness/session/jsonl/legacy-v3.d.ts.map +1 -0
- package/dist/harness/session/jsonl/legacy-v3.js +454 -0
- package/dist/harness/session/jsonl/legacy-v3.js.map +1 -0
- package/dist/harness/session/jsonl/repo.d.ts +27 -24
- package/dist/harness/session/jsonl/repo.d.ts.map +1 -1
- package/dist/harness/session/jsonl/repo.js +276 -151
- package/dist/harness/session/jsonl/repo.js.map +1 -1
- package/dist/harness/session/jsonl/storage.d.ts +39 -41
- package/dist/harness/session/jsonl/storage.d.ts.map +1 -1
- package/dist/harness/session/jsonl/storage.js +175 -196
- package/dist/harness/session/jsonl/storage.js.map +1 -1
- package/dist/harness/session/jsonl/types.d.ts +23 -22
- package/dist/harness/session/jsonl/types.d.ts.map +1 -1
- package/dist/harness/session/jsonl/types.js +2 -1
- package/dist/harness/session/jsonl/types.js.map +1 -1
- package/dist/harness/session/memory.d.ts +44 -40
- package/dist/harness/session/memory.d.ts.map +1 -1
- package/dist/harness/session/memory.js +333 -115
- package/dist/harness/session/memory.js.map +1 -1
- package/dist/harness/session/mutation-line.d.ts +8 -0
- package/dist/harness/session/mutation-line.d.ts.map +1 -0
- package/dist/harness/session/mutation-line.js +22 -0
- package/dist/harness/session/mutation-line.js.map +1 -0
- package/dist/harness/session/session.d.ts +78 -51
- package/dist/harness/session/session.d.ts.map +1 -1
- package/dist/harness/session/session.js +327 -207
- package/dist/harness/session/session.js.map +1 -1
- package/dist/harness/session/testing/benchmark/datasets.d.ts +12 -0
- package/dist/harness/session/testing/benchmark/datasets.d.ts.map +1 -0
- package/dist/harness/session/testing/benchmark/datasets.js +24 -0
- package/dist/harness/session/testing/benchmark/datasets.js.map +1 -0
- package/dist/harness/session/testing/benchmark/session-repo.d.ts +42 -0
- package/dist/harness/session/testing/benchmark/session-repo.d.ts.map +1 -0
- package/dist/harness/session/testing/benchmark/session-repo.js +127 -0
- package/dist/harness/session/testing/benchmark/session-repo.js.map +1 -0
- package/dist/harness/session/testing/benchmark/storage.d.ts +25 -0
- package/dist/harness/session/testing/benchmark/storage.d.ts.map +1 -0
- package/dist/harness/session/testing/benchmark/storage.js +114 -0
- package/dist/harness/session/testing/benchmark/storage.js.map +1 -0
- package/dist/harness/session/testing/conformance/session-repo.d.ts +23 -0
- package/dist/harness/session/testing/conformance/session-repo.d.ts.map +1 -0
- package/dist/harness/session/testing/conformance/session-repo.js +809 -0
- package/dist/harness/session/testing/conformance/session-repo.js.map +1 -0
- package/dist/harness/session/testing/conformance/storage.d.ts +4 -0
- package/dist/harness/session/testing/conformance/storage.d.ts.map +1 -0
- package/dist/harness/session/testing/conformance/storage.js +600 -0
- package/dist/harness/session/testing/conformance/storage.js.map +1 -0
- package/dist/harness/session/testing/gating-storage.d.ts +26 -0
- package/dist/harness/session/testing/gating-storage.d.ts.map +1 -0
- package/dist/harness/session/testing/gating-storage.js +103 -0
- package/dist/harness/session/testing/gating-storage.js.map +1 -0
- package/dist/harness/session/testing/index.d.ts +9 -2
- package/dist/harness/session/testing/index.d.ts.map +1 -1
- package/dist/harness/session/testing/index.js +8 -1
- package/dist/harness/session/testing/index.js.map +1 -1
- package/dist/harness/session/testing/instrumented-storage.d.ts +11 -0
- package/dist/harness/session/testing/instrumented-storage.d.ts.map +1 -0
- package/dist/harness/session/testing/instrumented-storage.js +19 -0
- package/dist/harness/session/testing/instrumented-storage.js.map +1 -0
- package/dist/harness/session/testing/storage-decorator.d.ts +20 -0
- package/dist/harness/session/testing/storage-decorator.d.ts.map +1 -0
- package/dist/harness/session/testing/storage-decorator.js +40 -0
- package/dist/harness/session/testing/storage-decorator.js.map +1 -0
- package/dist/harness/session/testing/types.d.ts +5 -7
- package/dist/harness/session/testing/types.d.ts.map +1 -1
- package/dist/harness/session/testing/types.js.map +1 -1
- package/dist/harness/session/types.d.ts +425 -265
- package/dist/harness/session/types.d.ts.map +1 -1
- package/dist/harness/session/types.js +7 -7
- package/dist/harness/session/types.js.map +1 -1
- package/dist/harness/session/values.d.ts +95 -0
- package/dist/harness/session/values.d.ts.map +1 -0
- package/dist/harness/session/values.js +81 -0
- package/dist/harness/session/values.js.map +1 -0
- package/dist/harness/skills.d.ts +3 -2
- package/dist/harness/skills.d.ts.map +1 -1
- package/dist/harness/skills.js +29 -26
- package/dist/harness/skills.js.map +1 -1
- package/dist/harness/telemetry.d.ts +64 -43
- package/dist/harness/telemetry.d.ts.map +1 -1
- package/dist/harness/telemetry.js +45 -26
- package/dist/harness/telemetry.js.map +1 -1
- package/dist/harness/tools/bash.d.ts +4 -4
- package/dist/harness/tools/bash.d.ts.map +1 -1
- package/dist/harness/tools/bash.js +66 -93
- package/dist/harness/tools/bash.js.map +1 -1
- package/dist/harness/tools/edit.d.ts.map +1 -1
- package/dist/harness/tools/edit.js +17 -13
- package/dist/harness/tools/edit.js.map +1 -1
- package/dist/harness/tools/file-mutation-queue.d.ts +2 -1
- package/dist/harness/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/harness/tools/file-mutation-queue.js +5 -5
- package/dist/harness/tools/file-mutation-queue.js.map +1 -1
- package/dist/harness/tools/path-utils.d.ts +3 -2
- package/dist/harness/tools/path-utils.d.ts.map +1 -1
- package/dist/harness/tools/path-utils.js +5 -5
- package/dist/harness/tools/path-utils.js.map +1 -1
- package/dist/harness/tools/read.d.ts +2 -1
- package/dist/harness/tools/read.d.ts.map +1 -1
- package/dist/harness/tools/read.js +4 -6
- package/dist/harness/tools/read.js.map +1 -1
- package/dist/harness/tools/write.d.ts.map +1 -1
- package/dist/harness/tools/write.js +12 -8
- package/dist/harness/tools/write.js.map +1 -1
- package/dist/harness/types.d.ts +128 -45
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js.map +1 -1
- package/dist/harness/utils/adaptive-publisher.d.ts +24 -0
- package/dist/harness/utils/adaptive-publisher.d.ts.map +1 -0
- package/dist/harness/utils/adaptive-publisher.js +79 -0
- package/dist/harness/utils/adaptive-publisher.js.map +1 -0
- package/dist/harness/utils/output-capture.d.ts +31 -0
- package/dist/harness/utils/output-capture.d.ts.map +1 -0
- package/dist/harness/utils/output-capture.js +217 -0
- package/dist/harness/utils/output-capture.js.map +1 -0
- package/dist/harness/utils/shell-output.d.ts +19 -5
- package/dist/harness/utils/shell-output.d.ts.map +1 -1
- package/dist/harness/utils/shell-output.js +65 -192
- package/dist/harness/utils/shell-output.js.map +1 -1
- package/dist/harness/utils/truncate.d.ts +1 -0
- package/dist/harness/utils/truncate.d.ts.map +1 -1
- package/dist/harness/utils/truncate.js +1 -1
- package/dist/harness/utils/truncate.js.map +1 -1
- package/dist/harness/utils/usage.d.ts +4 -0
- package/dist/harness/utils/usage.d.ts.map +1 -0
- package/dist/harness/utils/usage.js +33 -0
- package/dist/harness/utils/usage.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/search/index.d.ts +24 -16
- package/dist/search/index.d.ts.map +1 -1
- package/dist/search/index.js +1 -1
- package/dist/search/index.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +27 -6
- package/dist/harness/reducer.d.ts +0 -100
- package/dist/harness/reducer.d.ts.map +0 -1
- package/dist/harness/reducer.js +0 -420
- package/dist/harness/reducer.js.map +0 -1
- package/dist/harness/session/jsonl/errors.d.ts +0 -9
- package/dist/harness/session/jsonl/errors.d.ts.map +0 -1
- package/dist/harness/session/jsonl/errors.js +0 -18
- package/dist/harness/session/jsonl/errors.js.map +0 -1
- package/dist/harness/session/jsonl.d.ts +0 -3
- package/dist/harness/session/jsonl.d.ts.map +0 -1
- package/dist/harness/session/jsonl.js +0 -2
- package/dist/harness/session/jsonl.js.map +0 -1
- package/dist/harness/session/state.d.ts +0 -65
- package/dist/harness/session/state.d.ts.map +0 -1
- package/dist/harness/session/state.js +0 -320
- package/dist/harness/session/state.js.map +0 -1
- package/dist/harness/session/testing/conformance.d.ts +0 -4
- package/dist/harness/session/testing/conformance.d.ts.map +0 -1
- package/dist/harness/session/testing/conformance.js +0 -762
- package/dist/harness/session/testing/conformance.js.map +0 -1
- package/dist/search/scanning.d.ts +0 -29
- package/dist/search/scanning.d.ts.map +0 -1
- package/dist/search/scanning.js +0 -103
- package/dist/search/scanning.js.map +0 -1
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { uuidv7 } from "@earendil-works/pi-ai/utils/uuid";
|
|
2
|
+
import { createBranchSummaryMessage, createCompactionSummaryMessage } from "../../messages.js";
|
|
3
|
+
import { addUsage, emptyUsage } from "../../utils/usage.js";
|
|
4
|
+
import { branchTip, entryLabel, laneConfig, laneState, sessionName, setValue } from "../values.js";
|
|
5
|
+
import { parseJsonlSessionHeader } from "./codec.js";
|
|
6
|
+
import { fileValue, readJsonlHeader } from "./io.js";
|
|
7
|
+
import { JSONL_FORMAT_VERSION, JSONL_STORAGE_VERSION, } from "./types.js";
|
|
8
|
+
async function resolveLegacyV3ParentSessionId(fileSystem, parentSessionPath, context) {
|
|
9
|
+
const lines = await fileSystem.readTextLines(parentSessionPath, { maxLines: 1 }, context);
|
|
10
|
+
if (!lines.ok || lines.value[0] === undefined)
|
|
11
|
+
return undefined;
|
|
12
|
+
const parsed = parseJsonlSessionHeader(lines.value[0]);
|
|
13
|
+
return parsed.ok ? parsed.value.header.id : undefined;
|
|
14
|
+
}
|
|
15
|
+
export async function metadataFromLegacyV3Header(fileSystem, header, context) {
|
|
16
|
+
const metadata = {
|
|
17
|
+
id: header.id,
|
|
18
|
+
createdAt: Date.parse(header.timestamp),
|
|
19
|
+
storageVersion: JSONL_STORAGE_VERSION,
|
|
20
|
+
cwd: header.cwd,
|
|
21
|
+
};
|
|
22
|
+
if (header.parentSession !== undefined) {
|
|
23
|
+
const parentSessionId = await resolveLegacyV3ParentSessionId(fileSystem, header.parentSession, context);
|
|
24
|
+
if (parentSessionId !== undefined)
|
|
25
|
+
metadata.parentSessionId = parentSessionId;
|
|
26
|
+
else
|
|
27
|
+
metadata.legacyParentSessionPath = header.parentSession;
|
|
28
|
+
}
|
|
29
|
+
return metadata;
|
|
30
|
+
}
|
|
31
|
+
export async function normalizeLegacyV3Header(fileSystem, header, context) {
|
|
32
|
+
return {
|
|
33
|
+
v: JSONL_FORMAT_VERSION,
|
|
34
|
+
kind: "header",
|
|
35
|
+
...(await metadataFromLegacyV3Header(fileSystem, header, context)),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function parseLegacyV3Entry(line) {
|
|
39
|
+
let entry;
|
|
40
|
+
try {
|
|
41
|
+
entry = JSON.parse(line);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
throw new Error("Invalid legacy v3 JSONL record: not valid JSON", { cause: error });
|
|
45
|
+
}
|
|
46
|
+
const recordType = entry?.type;
|
|
47
|
+
if (recordType !== "message" &&
|
|
48
|
+
recordType !== "custom" &&
|
|
49
|
+
recordType !== "custom_message" &&
|
|
50
|
+
recordType !== "branch_summary" &&
|
|
51
|
+
recordType !== "compaction" &&
|
|
52
|
+
recordType !== "model_change" &&
|
|
53
|
+
recordType !== "thinking_level_change" &&
|
|
54
|
+
recordType !== "active_tools_change" &&
|
|
55
|
+
recordType !== "session_info" &&
|
|
56
|
+
recordType !== "label") {
|
|
57
|
+
throw new Error(`Unsupported legacy v3 record type: ${String(recordType)}`);
|
|
58
|
+
}
|
|
59
|
+
return entry;
|
|
60
|
+
}
|
|
61
|
+
function importedCustomMessage(entry) {
|
|
62
|
+
const message = {
|
|
63
|
+
role: "custom",
|
|
64
|
+
customType: entry.customType,
|
|
65
|
+
content: entry.content,
|
|
66
|
+
details: entry.details,
|
|
67
|
+
display: entry.display,
|
|
68
|
+
timestamp: Date.parse(entry.timestamp),
|
|
69
|
+
};
|
|
70
|
+
// The coding-agent CustomAgentMessages declaration merge is not visible in this package.
|
|
71
|
+
return message;
|
|
72
|
+
}
|
|
73
|
+
function isRetainedEntry(entry) {
|
|
74
|
+
return (entry.type !== "model_change" &&
|
|
75
|
+
entry.type !== "thinking_level_change" &&
|
|
76
|
+
entry.type !== "active_tools_change" &&
|
|
77
|
+
entry.type !== "session_info" &&
|
|
78
|
+
entry.type !== "label");
|
|
79
|
+
}
|
|
80
|
+
/** Parent mappings are already folded during the scan; later references need only a lookup. */
|
|
81
|
+
function createLegacyIdResolver(entries) {
|
|
82
|
+
return (legacyId) => {
|
|
83
|
+
if (legacyId === null)
|
|
84
|
+
return null;
|
|
85
|
+
const mappedId = entries.get(legacyId)?.mappedId;
|
|
86
|
+
if (mappedId === undefined)
|
|
87
|
+
throw new Error(`Missing legacy v3 entry reference: ${legacyId}`);
|
|
88
|
+
return mappedId;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function resolveBranchSummaryFromId(resolveLegacyId, legacyFromId) {
|
|
92
|
+
// Legacy branchWithSummary() encoded a root source as the "root" sentinel instead of null.
|
|
93
|
+
return legacyFromId === "root" ? null : resolveLegacyId(legacyFromId);
|
|
94
|
+
}
|
|
95
|
+
function projectContextMessage(entry, resolveLegacyId) {
|
|
96
|
+
switch (entry.type) {
|
|
97
|
+
case "message":
|
|
98
|
+
return entry.message;
|
|
99
|
+
case "custom_message":
|
|
100
|
+
return importedCustomMessage(entry);
|
|
101
|
+
case "branch_summary":
|
|
102
|
+
return entry.summary
|
|
103
|
+
? createBranchSummaryMessage(entry.summary, resolveBranchSummaryFromId(resolveLegacyId, entry.fromId), entry.timestamp)
|
|
104
|
+
: undefined;
|
|
105
|
+
case "compaction":
|
|
106
|
+
return createCompactionSummaryMessage(entry.summary, entry.tokensBefore, entry.timestamp);
|
|
107
|
+
case "custom":
|
|
108
|
+
case "model_change":
|
|
109
|
+
case "thinking_level_change":
|
|
110
|
+
case "active_tools_change":
|
|
111
|
+
case "session_info":
|
|
112
|
+
case "label":
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Walk physical ancestry, including discarded nodes and the exact kept boundary. */
|
|
117
|
+
function* retainedTailStructure(compaction, entriesById) {
|
|
118
|
+
let currentId = compaction.parentId;
|
|
119
|
+
while (currentId !== null) {
|
|
120
|
+
// The scan guarantees that every parent exists earlier in the file, so cycles are impossible.
|
|
121
|
+
const entry = entriesById.get(currentId);
|
|
122
|
+
yield entry;
|
|
123
|
+
if (currentId === compaction.firstKeptEntryId)
|
|
124
|
+
return;
|
|
125
|
+
currentId = entry.parentId;
|
|
126
|
+
}
|
|
127
|
+
throw new Error(`Legacy v3 compaction ${compaction.id} firstKeptEntryId is not on its parent branch: ${compaction.firstKeptEntryId}`);
|
|
128
|
+
}
|
|
129
|
+
function normalizeRetainedEntry(entry, indexed, retainedTail, resolveLegacyId) {
|
|
130
|
+
const committedBase = {
|
|
131
|
+
kind: "entry",
|
|
132
|
+
id: indexed.mappedId,
|
|
133
|
+
parentId: resolveLegacyId(indexed.parentId),
|
|
134
|
+
seq: indexed.seq,
|
|
135
|
+
timestamp: Date.parse(entry.timestamp),
|
|
136
|
+
};
|
|
137
|
+
if (entry.type === "message") {
|
|
138
|
+
return { ...committedBase, type: "message", message: entry.message };
|
|
139
|
+
}
|
|
140
|
+
if (entry.type === "custom_message") {
|
|
141
|
+
return {
|
|
142
|
+
...committedBase,
|
|
143
|
+
type: "message",
|
|
144
|
+
message: importedCustomMessage(entry),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (entry.type === "branch_summary") {
|
|
148
|
+
return {
|
|
149
|
+
...committedBase,
|
|
150
|
+
type: "branch_summary",
|
|
151
|
+
fromId: resolveBranchSummaryFromId(resolveLegacyId, entry.fromId),
|
|
152
|
+
summary: entry.summary,
|
|
153
|
+
details: entry.details,
|
|
154
|
+
usage: entry.usage,
|
|
155
|
+
fromHook: entry.fromHook ?? false,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (entry.type === "compaction") {
|
|
159
|
+
return {
|
|
160
|
+
...committedBase,
|
|
161
|
+
type: "compaction",
|
|
162
|
+
summary: entry.summary,
|
|
163
|
+
retainedTail,
|
|
164
|
+
tokensBefore: entry.tokensBefore,
|
|
165
|
+
details: entry.details,
|
|
166
|
+
usage: entry.usage,
|
|
167
|
+
fromHook: entry.fromHook ?? false,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
...committedBase,
|
|
172
|
+
type: "custom",
|
|
173
|
+
customType: entry.customType,
|
|
174
|
+
data: entry.data,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function selectedConfiguration(entriesById, selectedId) {
|
|
178
|
+
const remaining = new Set([
|
|
179
|
+
"model_change",
|
|
180
|
+
"thinking_level_change",
|
|
181
|
+
"active_tools_change",
|
|
182
|
+
]);
|
|
183
|
+
let model;
|
|
184
|
+
let thinkingLevel;
|
|
185
|
+
let activeToolNames;
|
|
186
|
+
let currentId = selectedId;
|
|
187
|
+
while (currentId !== null && remaining.size !== 0) {
|
|
188
|
+
const entry = entriesById.get(currentId);
|
|
189
|
+
// Consume the nearest change even when invalid: older values must not become fallbacks.
|
|
190
|
+
if (remaining.delete(entry.type)) {
|
|
191
|
+
switch (entry.type) {
|
|
192
|
+
case "model_change":
|
|
193
|
+
model = { provider: entry.provider, modelId: entry.modelId };
|
|
194
|
+
break;
|
|
195
|
+
case "thinking_level_change":
|
|
196
|
+
thinkingLevel = entry.thinkingLevel;
|
|
197
|
+
break;
|
|
198
|
+
case "active_tools_change":
|
|
199
|
+
activeToolNames = [...entry.activeToolNames];
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
currentId = entry.parentId;
|
|
204
|
+
}
|
|
205
|
+
if (model === undefined || thinkingLevel === undefined)
|
|
206
|
+
return undefined;
|
|
207
|
+
return { model, thinkingLevel, activeToolNames: activeToolNames ?? [] };
|
|
208
|
+
}
|
|
209
|
+
function indexLegacyV3Entry(entry, lineNumber, seq, entries) {
|
|
210
|
+
// SessionManager appends after an existing leaf and writes extracted branches in parent order.
|
|
211
|
+
const mappedParentId = entry.parentId === null ? null : entries.get(entry.parentId)?.mappedId;
|
|
212
|
+
if (mappedParentId === undefined) {
|
|
213
|
+
throw new Error(`Legacy v3 entry ${entry.id} has a missing or forward parent at line ${lineNumber}: ${entry.parentId}`);
|
|
214
|
+
}
|
|
215
|
+
const structure = {
|
|
216
|
+
id: entry.id,
|
|
217
|
+
parentId: entry.parentId,
|
|
218
|
+
mappedId: mappedParentId,
|
|
219
|
+
};
|
|
220
|
+
if (!isRetainedEntry(entry)) {
|
|
221
|
+
switch (entry.type) {
|
|
222
|
+
case "label":
|
|
223
|
+
return { ...structure, type: entry.type, targetId: entry.targetId, label: entry.label };
|
|
224
|
+
case "model_change":
|
|
225
|
+
return { ...structure, type: entry.type, provider: entry.provider, modelId: entry.modelId };
|
|
226
|
+
case "thinking_level_change":
|
|
227
|
+
return { ...structure, type: entry.type, thinkingLevel: entry.thinkingLevel };
|
|
228
|
+
case "active_tools_change":
|
|
229
|
+
return { ...structure, type: entry.type, activeToolNames: entry.activeToolNames };
|
|
230
|
+
case "session_info":
|
|
231
|
+
return { ...structure, type: entry.type };
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// Null denotes the root, not a retained node identity that can be reminted.
|
|
235
|
+
if (entry.id === null)
|
|
236
|
+
throw new Error("Legacy v3 entry reference has no retained ancestor: null");
|
|
237
|
+
const retained = {
|
|
238
|
+
...structure,
|
|
239
|
+
mappedId: uuidv7(Date.parse(entry.timestamp)),
|
|
240
|
+
seq,
|
|
241
|
+
};
|
|
242
|
+
switch (entry.type) {
|
|
243
|
+
case "branch_summary":
|
|
244
|
+
return { ...retained, type: entry.type, fromId: entry.fromId };
|
|
245
|
+
case "compaction":
|
|
246
|
+
return { ...retained, type: entry.type, firstKeptEntryId: entry.firstKeptEntryId };
|
|
247
|
+
default:
|
|
248
|
+
return { ...retained, type: entry.type };
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function legacyEntryUsage(entry) {
|
|
252
|
+
switch (entry.type) {
|
|
253
|
+
case "message":
|
|
254
|
+
return entry.message.role === "assistant" || entry.message.role === "toolResult"
|
|
255
|
+
? entry.message.usage
|
|
256
|
+
: undefined;
|
|
257
|
+
case "compaction":
|
|
258
|
+
case "branch_summary":
|
|
259
|
+
return entry.usage;
|
|
260
|
+
default:
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async function readLegacyV3Inventory(reader, context) {
|
|
265
|
+
const entries = new Map();
|
|
266
|
+
let nextSeq = 1;
|
|
267
|
+
let importedUsage = emptyUsage();
|
|
268
|
+
let name;
|
|
269
|
+
let finalId = null;
|
|
270
|
+
while (true) {
|
|
271
|
+
const line = fileValue(await reader.readLine(context), "Failed to read legacy v3 source");
|
|
272
|
+
if (line === undefined || !line.terminated)
|
|
273
|
+
break;
|
|
274
|
+
const lineNumber = entries.size + 2;
|
|
275
|
+
const entry = parseLegacyV3Entry(line.text);
|
|
276
|
+
if (entries.has(entry.id))
|
|
277
|
+
throw new Error(`Duplicate legacy v3 entry id: ${entry.id}`);
|
|
278
|
+
const indexed = indexLegacyV3Entry(entry, lineNumber, nextSeq, entries);
|
|
279
|
+
entries.set(entry.id, indexed);
|
|
280
|
+
if (isRetainedEntry(indexed))
|
|
281
|
+
nextSeq++;
|
|
282
|
+
finalId = entry.id;
|
|
283
|
+
if (entry.type === "session_info")
|
|
284
|
+
name = entry.name;
|
|
285
|
+
const usage = legacyEntryUsage(entry);
|
|
286
|
+
if (usage !== undefined)
|
|
287
|
+
importedUsage = addUsage(importedUsage, usage);
|
|
288
|
+
}
|
|
289
|
+
return { entries, nextSeq, importedUsage, name, finalId };
|
|
290
|
+
}
|
|
291
|
+
function normalizeLegacyV3Values(inventory) {
|
|
292
|
+
const { entries, name, finalId } = inventory;
|
|
293
|
+
const resolveLegacyId = createLegacyIdResolver(entries);
|
|
294
|
+
let nextSeq = inventory.nextSeq;
|
|
295
|
+
const values = [];
|
|
296
|
+
// session name
|
|
297
|
+
if (name)
|
|
298
|
+
values.push({ ...setValue(sessionName, name), seq: nextSeq++ });
|
|
299
|
+
// labels
|
|
300
|
+
const labels = new Map();
|
|
301
|
+
for (const entry of entries.values()) {
|
|
302
|
+
if (entry.type !== "label")
|
|
303
|
+
continue;
|
|
304
|
+
const targetId = resolveLegacyId(entry.targetId);
|
|
305
|
+
if (targetId === null)
|
|
306
|
+
continue;
|
|
307
|
+
if (entry.label)
|
|
308
|
+
labels.set(targetId, entry.label);
|
|
309
|
+
else
|
|
310
|
+
labels.delete(targetId);
|
|
311
|
+
}
|
|
312
|
+
for (const [targetId, label] of labels) {
|
|
313
|
+
values.push({ ...setValue(entryLabel(targetId), label), seq: nextSeq++ });
|
|
314
|
+
}
|
|
315
|
+
// branch tip
|
|
316
|
+
values.push({ ...setValue(branchTip("main"), resolveLegacyId(finalId)), seq: nextSeq++ });
|
|
317
|
+
// configuration
|
|
318
|
+
const configuration = selectedConfiguration(entries, finalId);
|
|
319
|
+
if (configuration !== undefined) {
|
|
320
|
+
values.push({ ...setValue(laneConfig("main"), configuration), seq: nextSeq++ });
|
|
321
|
+
values.push({
|
|
322
|
+
...setValue(laneState("main"), { currentOperationId: null, lastOperationId: null, inbox: [] }),
|
|
323
|
+
seq: nextSeq++,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
return values;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* A captured legacy file exposed as repeatable logical v4 writes.
|
|
330
|
+
* Each pass reopens the path; callers must not replace or edit the source between passes.
|
|
331
|
+
* Structural indexes, label/configuration metadata, and derived current values survive between scans.
|
|
332
|
+
*/
|
|
333
|
+
export class LegacyV3Source {
|
|
334
|
+
constructor(fileSystem, path, header, entries, importedUsage, values, nextSeq) {
|
|
335
|
+
this.fileSystem = fileSystem;
|
|
336
|
+
this.path = path;
|
|
337
|
+
this.header = header;
|
|
338
|
+
this.entries = entries;
|
|
339
|
+
this.resolveLegacyId = createLegacyIdResolver(entries);
|
|
340
|
+
this.importedUsage = importedUsage;
|
|
341
|
+
this.values = values;
|
|
342
|
+
this.nextSeq = nextSeq;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Scan complete v3 records without modifying the file, ignoring an unterminated final line.
|
|
346
|
+
* Build parent mappings, assign IDs stable for this source instance, and derive current values
|
|
347
|
+
* and imported usage. Retain metadata, not conversation payloads or an open reader. writes()
|
|
348
|
+
* reopens the path to materialize captured records and resolve their payload-specific references.
|
|
349
|
+
*/
|
|
350
|
+
static async read(fileSystem, path, context) {
|
|
351
|
+
const reader = fileValue(await fileSystem.openTextLineReader(path, context), `Failed to open legacy v3 source ${path}`);
|
|
352
|
+
try {
|
|
353
|
+
const parsed = await readJsonlHeader(reader, path, context);
|
|
354
|
+
if (parsed.format !== "v3-legacy") {
|
|
355
|
+
throw new Error(`Invalid legacy v3 JSONL storage ${path}: expected format 3 header`);
|
|
356
|
+
}
|
|
357
|
+
const inventory = await readLegacyV3Inventory(reader, context);
|
|
358
|
+
const values = normalizeLegacyV3Values(inventory);
|
|
359
|
+
return new LegacyV3Source(fileSystem, path, await normalizeLegacyV3Header(fileSystem, parsed.header, context), inventory.entries, inventory.importedUsage, values, inventory.nextSeq + values.length);
|
|
360
|
+
}
|
|
361
|
+
finally {
|
|
362
|
+
await reader.close(context);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
*entryStructures() {
|
|
366
|
+
for (const entry of this.entries.values()) {
|
|
367
|
+
if (!isRetainedEntry(entry))
|
|
368
|
+
continue;
|
|
369
|
+
yield { id: entry.mappedId, parentId: this.resolveLegacyId(entry.parentId), seq: entry.seq };
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
translateForkEntryId(legacyId) {
|
|
373
|
+
const entry = this.entries.get(legacyId);
|
|
374
|
+
if (entry === undefined)
|
|
375
|
+
throw new Error(`Legacy v3 fork entry does not exist: ${legacyId}`);
|
|
376
|
+
if (!isRetainedEntry(entry))
|
|
377
|
+
throw new Error(`Legacy v3 fork entry is not a retained entry: ${legacyId}`);
|
|
378
|
+
return entry.mappedId;
|
|
379
|
+
}
|
|
380
|
+
collectRequiredTailMessageIds(isEntrySelected) {
|
|
381
|
+
const requiredIds = new Set();
|
|
382
|
+
for (const entry of this.entries.values()) {
|
|
383
|
+
if (entry.type !== "compaction")
|
|
384
|
+
continue;
|
|
385
|
+
const compactionIsSelected = isEntrySelected === undefined || isEntrySelected(entry.mappedId);
|
|
386
|
+
if (!compactionIsSelected)
|
|
387
|
+
continue;
|
|
388
|
+
// Walk from the compaction's parent through firstKeptEntryId, inclusive.
|
|
389
|
+
for (const tailEntry of retainedTailStructure(entry, this.entries)) {
|
|
390
|
+
const canProduceContextMessage = isRetainedEntry(tailEntry) && tailEntry.type !== "custom";
|
|
391
|
+
if (canProduceContextMessage)
|
|
392
|
+
requiredIds.add(tailEntry.id);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return requiredIds;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Stream normalized v4 entries, optionally filtered by reminted ID, followed by derived current values.
|
|
399
|
+
* Each pass owns its reader and message cache, sharing only the captured IDs and metadata.
|
|
400
|
+
*/
|
|
401
|
+
async *writes(context, isEntrySelected) {
|
|
402
|
+
const requiredTailMessageIds = this.collectRequiredTailMessageIds(isEntrySelected);
|
|
403
|
+
// Keep needed context messages for this entire pass; tails may revisit old or shared branches.
|
|
404
|
+
const tailMessagesByLegacyId = new Map();
|
|
405
|
+
for await (const { entry, indexed } of this.readCapturedEntries(context)) {
|
|
406
|
+
if (requiredTailMessageIds.has(entry.id)) {
|
|
407
|
+
const message = projectContextMessage(entry, this.resolveLegacyId);
|
|
408
|
+
if (message !== undefined)
|
|
409
|
+
tailMessagesByLegacyId.set(entry.id, message);
|
|
410
|
+
}
|
|
411
|
+
if (!isRetainedEntry(indexed) || !isRetainedEntry(entry))
|
|
412
|
+
continue;
|
|
413
|
+
if (isEntrySelected !== undefined && !isEntrySelected(indexed.mappedId))
|
|
414
|
+
continue;
|
|
415
|
+
const retainedTail = [];
|
|
416
|
+
if (indexed.type === "compaction") {
|
|
417
|
+
for (const ancestor of retainedTailStructure(indexed, this.entries)) {
|
|
418
|
+
const message = tailMessagesByLegacyId.get(ancestor.id);
|
|
419
|
+
if (message !== undefined)
|
|
420
|
+
retainedTail.push(message);
|
|
421
|
+
}
|
|
422
|
+
retainedTail.reverse();
|
|
423
|
+
}
|
|
424
|
+
yield normalizeRetainedEntry(entry, indexed, retainedTail, this.resolveLegacyId);
|
|
425
|
+
}
|
|
426
|
+
yield* this.values;
|
|
427
|
+
}
|
|
428
|
+
/** Replay only the captured prefix and verify its physical identities before materialization. */
|
|
429
|
+
async *readCapturedEntries(context) {
|
|
430
|
+
const reader = fileValue(await this.fileSystem.openTextLineReader(this.path, context), `Failed to reopen legacy v3 source ${this.path}`);
|
|
431
|
+
try {
|
|
432
|
+
const parsed = await readJsonlHeader(reader, this.path, context);
|
|
433
|
+
if (parsed.format !== "v3-legacy" ||
|
|
434
|
+
parsed.header.id !== this.header.id ||
|
|
435
|
+
parsed.header.cwd !== this.header.cwd) {
|
|
436
|
+
throw new Error("Legacy v3 source header changed");
|
|
437
|
+
}
|
|
438
|
+
for (const indexed of this.entries.values()) {
|
|
439
|
+
const line = fileValue(await reader.readLine(context), "Failed to reread legacy v3 source");
|
|
440
|
+
if (line === undefined || !line.terminated)
|
|
441
|
+
throw new Error("Legacy v3 source ended before captured entries");
|
|
442
|
+
const entry = parseLegacyV3Entry(line.text);
|
|
443
|
+
if (entry.id !== indexed.id || entry.type !== indexed.type) {
|
|
444
|
+
throw new Error("Legacy v3 source changed");
|
|
445
|
+
}
|
|
446
|
+
yield { entry, indexed };
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
finally {
|
|
450
|
+
await reader.close(context);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
//# sourceMappingURL=legacy-v3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-v3.js","sourceRoot":"","sources":["../../../../src/harness/session/jsonl/legacy-v3.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG1D,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAE/F,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc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ImageContent, TextContent, Usage } from \"@earendil-works/pi-ai\";\nimport { uuidv7 } from \"@earendil-works/pi-ai/utils/uuid\";\nimport type { AgentMessage, ThinkingLevel } from \"../../../types.ts\";\nimport type { Context } from \"../../context.ts\";\nimport { createBranchSummaryMessage, createCompactionSummaryMessage } from \"../../messages.ts\";\nimport type { FileSystem, TextLineReader } from \"../../types.ts\";\nimport { addUsage, emptyUsage } from \"../../utils/usage.ts\";\nimport type { CommittedEntryWrite, CommittedValueSetWrite } from \"../commit.ts\";\nimport type { JsonValue, LaneConfiguration } from \"../types.ts\";\nimport { branchTip, entryLabel, laneConfig, laneState, sessionName, setValue } from \"../values.ts\";\nimport { type LegacyV3SessionHeader, parseJsonlSessionHeader } from \"./codec.ts\";\nimport { fileValue, readJsonlHeader } from \"./io.ts\";\nimport {\n\tJSONL_FORMAT_VERSION,\n\tJSONL_STORAGE_VERSION,\n\ttype JsonlSessionMetadata,\n\ttype JsonlStorageHeader,\n} from \"./types.ts\";\n\ninterface LegacyV3EntryBase {\n\ttype: string;\n\tid: string;\n\tparentId: string | null;\n\ttimestamp: string;\n}\n\ninterface LegacyV3MessageEntry extends LegacyV3EntryBase {\n\ttype: \"message\";\n\tmessage: AgentMessage;\n}\n\ninterface LegacyV3CustomEntry extends LegacyV3EntryBase {\n\ttype: \"custom\";\n\tcustomType: string;\n\tdata?: JsonValue;\n}\n\ninterface LegacyV3CustomMessageEntry extends LegacyV3EntryBase {\n\ttype: \"custom_message\";\n\tcustomType: string;\n\tcontent: string | (TextContent | ImageContent)[];\n\tdetails?: unknown;\n\tdisplay: boolean;\n}\n\ninterface LegacyV3BranchSummaryEntry extends LegacyV3EntryBase {\n\ttype: \"branch_summary\";\n\tfromId: string;\n\tsummary: string;\n\tdetails?: JsonValue;\n\tusage?: Usage;\n\tfromHook?: boolean;\n}\n\ninterface LegacyV3CompactionEntry extends LegacyV3EntryBase {\n\ttype: \"compaction\";\n\tsummary: string;\n\tfirstKeptEntryId: string;\n\ttokensBefore: number;\n\tdetails?: JsonValue;\n\tusage?: Usage;\n\tfromHook?: boolean;\n}\n\ninterface LegacyV3ModelChangeEntry extends LegacyV3EntryBase {\n\ttype: \"model_change\";\n\tprovider: string;\n\tmodelId: string;\n}\n\ninterface LegacyV3ThinkingLevelChangeEntry extends LegacyV3EntryBase {\n\ttype: \"thinking_level_change\";\n\tthinkingLevel: ThinkingLevel;\n}\n\ninterface LegacyV3ActiveToolsChangeEntry extends LegacyV3EntryBase {\n\ttype: \"active_tools_change\";\n\tactiveToolNames: string[];\n}\n\ninterface LegacyV3SessionInfoEntry extends LegacyV3EntryBase {\n\ttype: \"session_info\";\n\tname?: string;\n}\n\ninterface LegacyV3LabelEntry extends LegacyV3EntryBase {\n\ttype: \"label\";\n\ttargetId: string;\n\tlabel?: string;\n}\n\ninterface ImportedCustomMessage {\n\trole: \"custom\";\n\tcustomType: string;\n\tcontent: string | (TextContent | ImageContent)[];\n\tdetails?: unknown;\n\tdisplay: boolean;\n\ttimestamp: number;\n}\n\ntype RetainedLegacyV3Entry =\n\t| LegacyV3MessageEntry\n\t| LegacyV3CustomEntry\n\t| LegacyV3CustomMessageEntry\n\t| LegacyV3BranchSummaryEntry\n\t| LegacyV3CompactionEntry;\n\ntype DiscardedLegacyV3Entry =\n\t| LegacyV3ModelChangeEntry\n\t| LegacyV3ThinkingLevelChangeEntry\n\t| LegacyV3ActiveToolsChangeEntry\n\t| LegacyV3SessionInfoEntry\n\t| LegacyV3LabelEntry;\n\ntype LegacyV3Entry = RetainedLegacyV3Entry | DiscardedLegacyV3Entry;\n\ninterface LegacyV3IndexBase {\n\tid: string;\n\tparentId: string | null;\n\t/** This node's new ID, or its parent's mapped ID when the node is discarded. */\n\tmappedId: string | null;\n}\n\ntype RetainedLegacyV3IndexEntry = LegacyV3IndexBase & { mappedId: string; seq: number } & (\n\t\t| { type: \"message\" | \"custom\" | \"custom_message\" }\n\t\t| { type: \"branch_summary\"; fromId: string }\n\t\t| { type: \"compaction\"; firstKeptEntryId: string }\n\t);\n\n/** Keep structure, labels, and configuration changes, but not conversation payloads. */\ntype LegacyV3IndexEntry =\n\t| RetainedLegacyV3IndexEntry\n\t| (LegacyV3IndexBase &\n\t\t\t(\n\t\t\t\t| Pick<LegacyV3LabelEntry, \"type\" | \"targetId\" | \"label\">\n\t\t\t\t| Pick<LegacyV3ModelChangeEntry, \"type\" | \"provider\" | \"modelId\">\n\t\t\t\t| Pick<LegacyV3ThinkingLevelChangeEntry, \"type\" | \"thinkingLevel\">\n\t\t\t\t| Pick<LegacyV3ActiveToolsChangeEntry, \"type\" | \"activeToolNames\">\n\t\t\t\t| { type: \"session_info\" }\n\t\t\t));\n\ntype LegacyV3CompactionIndexEntry = Extract<RetainedLegacyV3IndexEntry, { type: \"compaction\" }>;\n\ninterface LegacyV3Inventory {\n\tentries: ReadonlyMap<string, LegacyV3IndexEntry>;\n\timportedUsage: Usage;\n\tname: string | undefined;\n\tfinalId: string | null;\n\tnextSeq: number;\n}\n\ntype JsonlSessionMetadataBase = Omit<JsonlSessionMetadata, \"path\" | \"modifiedAt\">;\n\nasync function resolveLegacyV3ParentSessionId(\n\tfileSystem: FileSystem,\n\tparentSessionPath: string,\n\tcontext: Context,\n): Promise<string | undefined> {\n\tconst lines = await fileSystem.readTextLines(parentSessionPath, { maxLines: 1 }, context);\n\tif (!lines.ok || lines.value[0] === undefined) return undefined;\n\tconst parsed = parseJsonlSessionHeader(lines.value[0]);\n\treturn parsed.ok ? parsed.value.header.id : undefined;\n}\n\nexport async function metadataFromLegacyV3Header(\n\tfileSystem: FileSystem,\n\theader: LegacyV3SessionHeader,\n\tcontext: Context,\n): Promise<JsonlSessionMetadataBase> {\n\tconst metadata: JsonlSessionMetadataBase = {\n\t\tid: header.id,\n\t\tcreatedAt: Date.parse(header.timestamp),\n\t\tstorageVersion: JSONL_STORAGE_VERSION,\n\t\tcwd: header.cwd,\n\t};\n\tif (header.parentSession !== undefined) {\n\t\tconst parentSessionId = await resolveLegacyV3ParentSessionId(fileSystem, header.parentSession, context);\n\t\tif (parentSessionId !== undefined) metadata.parentSessionId = parentSessionId;\n\t\telse metadata.legacyParentSessionPath = header.parentSession;\n\t}\n\treturn metadata;\n}\n\nexport async function normalizeLegacyV3Header(\n\tfileSystem: FileSystem,\n\theader: LegacyV3SessionHeader,\n\tcontext: Context,\n): Promise<JsonlStorageHeader> {\n\treturn {\n\t\tv: JSONL_FORMAT_VERSION,\n\t\tkind: \"header\",\n\t\t...(await metadataFromLegacyV3Header(fileSystem, header, context)),\n\t};\n}\n\nfunction parseLegacyV3Entry(line: string): LegacyV3Entry {\n\tlet entry: LegacyV3Entry;\n\ttry {\n\t\tentry = JSON.parse(line) as LegacyV3Entry;\n\t} catch (error) {\n\t\tthrow new Error(\"Invalid legacy v3 JSONL record: not valid JSON\", { cause: error });\n\t}\n\tconst recordType: unknown = entry?.type;\n\tif (\n\t\trecordType !== \"message\" &&\n\t\trecordType !== \"custom\" &&\n\t\trecordType !== \"custom_message\" &&\n\t\trecordType !== \"branch_summary\" &&\n\t\trecordType !== \"compaction\" &&\n\t\trecordType !== \"model_change\" &&\n\t\trecordType !== \"thinking_level_change\" &&\n\t\trecordType !== \"active_tools_change\" &&\n\t\trecordType !== \"session_info\" &&\n\t\trecordType !== \"label\"\n\t) {\n\t\tthrow new Error(`Unsupported legacy v3 record type: ${String(recordType)}`);\n\t}\n\treturn entry;\n}\n\nfunction importedCustomMessage(entry: LegacyV3CustomMessageEntry): AgentMessage {\n\tconst message: ImportedCustomMessage = {\n\t\trole: \"custom\",\n\t\tcustomType: entry.customType,\n\t\tcontent: entry.content,\n\t\tdetails: entry.details,\n\t\tdisplay: entry.display,\n\t\ttimestamp: Date.parse(entry.timestamp),\n\t};\n\t// The coding-agent CustomAgentMessages declaration merge is not visible in this package.\n\treturn message as unknown as AgentMessage;\n}\n\nfunction isRetainedEntry<T extends LegacyV3Entry | LegacyV3IndexEntry>(\n\tentry: T,\n): entry is Extract<T, { type: RetainedLegacyV3Entry[\"type\"] }> {\n\treturn (\n\t\tentry.type !== \"model_change\" &&\n\t\tentry.type !== \"thinking_level_change\" &&\n\t\tentry.type !== \"active_tools_change\" &&\n\t\tentry.type !== \"session_info\" &&\n\t\tentry.type !== \"label\"\n\t);\n}\n\n/**\n * Resolve a legacy ID to its imported ID. Discarded records resolve to the minted ID of their\n * nearest retained ancestor.\n */\ntype ResolveLegacyId = (legacyId: string | null) => string | null;\n\n/** Parent mappings are already folded during the scan; later references need only a lookup. */\nfunction createLegacyIdResolver(entries: ReadonlyMap<string, LegacyV3IndexEntry>): ResolveLegacyId {\n\treturn (legacyId) => {\n\t\tif (legacyId === null) return null;\n\t\tconst mappedId = entries.get(legacyId)?.mappedId;\n\t\tif (mappedId === undefined) throw new Error(`Missing legacy v3 entry reference: ${legacyId}`);\n\t\treturn mappedId;\n\t};\n}\n\nfunction resolveBranchSummaryFromId(resolveLegacyId: ResolveLegacyId, legacyFromId: string): string | null {\n\t// Legacy branchWithSummary() encoded a root source as the \"root\" sentinel instead of null.\n\treturn legacyFromId === \"root\" ? null : resolveLegacyId(legacyFromId);\n}\n\nfunction projectContextMessage(entry: LegacyV3Entry, resolveLegacyId: ResolveLegacyId): AgentMessage | undefined {\n\tswitch (entry.type) {\n\t\tcase \"message\":\n\t\t\treturn entry.message;\n\t\tcase \"custom_message\":\n\t\t\treturn importedCustomMessage(entry);\n\t\tcase \"branch_summary\":\n\t\t\treturn entry.summary\n\t\t\t\t? createBranchSummaryMessage(\n\t\t\t\t\t\tentry.summary,\n\t\t\t\t\t\tresolveBranchSummaryFromId(resolveLegacyId, entry.fromId),\n\t\t\t\t\t\tentry.timestamp,\n\t\t\t\t\t)\n\t\t\t\t: undefined;\n\t\tcase \"compaction\":\n\t\t\treturn createCompactionSummaryMessage(entry.summary, entry.tokensBefore, entry.timestamp);\n\t\tcase \"custom\":\n\t\tcase \"model_change\":\n\t\tcase \"thinking_level_change\":\n\t\tcase \"active_tools_change\":\n\t\tcase \"session_info\":\n\t\tcase \"label\":\n\t\t\treturn undefined;\n\t}\n}\n\n/** Walk physical ancestry, including discarded nodes and the exact kept boundary. */\nfunction* retainedTailStructure(\n\tcompaction: LegacyV3CompactionIndexEntry,\n\tentriesById: ReadonlyMap<string, LegacyV3IndexEntry>,\n): Iterable<LegacyV3IndexEntry> {\n\tlet currentId = compaction.parentId;\n\twhile (currentId !== null) {\n\t\t// The scan guarantees that every parent exists earlier in the file, so cycles are impossible.\n\t\tconst entry = entriesById.get(currentId)!;\n\t\tyield entry;\n\t\tif (currentId === compaction.firstKeptEntryId) return;\n\t\tcurrentId = entry.parentId;\n\t}\n\tthrow new Error(\n\t\t`Legacy v3 compaction ${compaction.id} firstKeptEntryId is not on its parent branch: ${compaction.firstKeptEntryId}`,\n\t);\n}\n\nfunction normalizeRetainedEntry(\n\tentry: RetainedLegacyV3Entry,\n\tindexed: RetainedLegacyV3IndexEntry,\n\tretainedTail: AgentMessage[],\n\tresolveLegacyId: ResolveLegacyId,\n): CommittedEntryWrite {\n\tconst committedBase = {\n\t\tkind: \"entry\" as const,\n\t\tid: indexed.mappedId,\n\t\tparentId: resolveLegacyId(indexed.parentId),\n\t\tseq: indexed.seq,\n\t\ttimestamp: Date.parse(entry.timestamp),\n\t};\n\tif (entry.type === \"message\") {\n\t\treturn { ...committedBase, type: \"message\", message: entry.message };\n\t}\n\tif (entry.type === \"custom_message\") {\n\t\treturn {\n\t\t\t...committedBase,\n\t\t\ttype: \"message\",\n\t\t\tmessage: importedCustomMessage(entry),\n\t\t};\n\t}\n\tif (entry.type === \"branch_summary\") {\n\t\treturn {\n\t\t\t...committedBase,\n\t\t\ttype: \"branch_summary\",\n\t\t\tfromId: resolveBranchSummaryFromId(resolveLegacyId, entry.fromId),\n\t\t\tsummary: entry.summary,\n\t\t\tdetails: entry.details,\n\t\t\tusage: entry.usage,\n\t\t\tfromHook: entry.fromHook ?? false,\n\t\t};\n\t}\n\tif (entry.type === \"compaction\") {\n\t\treturn {\n\t\t\t...committedBase,\n\t\t\ttype: \"compaction\",\n\t\t\tsummary: entry.summary,\n\t\t\tretainedTail,\n\t\t\ttokensBefore: entry.tokensBefore,\n\t\t\tdetails: entry.details,\n\t\t\tusage: entry.usage,\n\t\t\tfromHook: entry.fromHook ?? false,\n\t\t};\n\t}\n\treturn {\n\t\t...committedBase,\n\t\ttype: \"custom\",\n\t\tcustomType: entry.customType,\n\t\tdata: entry.data,\n\t};\n}\n\nfunction selectedConfiguration(\n\tentriesById: ReadonlyMap<string, LegacyV3IndexEntry>,\n\tselectedId: string | null,\n): LaneConfiguration | undefined {\n\tconst remaining = new Set<LegacyV3IndexEntry[\"type\"]>([\n\t\t\"model_change\",\n\t\t\"thinking_level_change\",\n\t\t\"active_tools_change\",\n\t]);\n\tlet model: LaneConfiguration[\"model\"] | undefined;\n\tlet thinkingLevel: ThinkingLevel | undefined;\n\tlet activeToolNames: string[] | undefined;\n\tlet currentId = selectedId;\n\twhile (currentId !== null && remaining.size !== 0) {\n\t\tconst entry = entriesById.get(currentId)!;\n\t\t// Consume the nearest change even when invalid: older values must not become fallbacks.\n\t\tif (remaining.delete(entry.type)) {\n\t\t\tswitch (entry.type) {\n\t\t\t\tcase \"model_change\":\n\t\t\t\t\tmodel = { provider: entry.provider, modelId: entry.modelId };\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"thinking_level_change\":\n\t\t\t\t\tthinkingLevel = entry.thinkingLevel;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"active_tools_change\":\n\t\t\t\t\tactiveToolNames = [...entry.activeToolNames];\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcurrentId = entry.parentId;\n\t}\n\tif (model === undefined || thinkingLevel === undefined) return undefined;\n\treturn { model, thinkingLevel, activeToolNames: activeToolNames ?? [] };\n}\n\nfunction indexLegacyV3Entry(\n\tentry: LegacyV3Entry,\n\tlineNumber: number,\n\tseq: number,\n\tentries: ReadonlyMap<string, LegacyV3IndexEntry>,\n): LegacyV3IndexEntry {\n\t// SessionManager appends after an existing leaf and writes extracted branches in parent order.\n\tconst mappedParentId = entry.parentId === null ? null : entries.get(entry.parentId)?.mappedId;\n\tif (mappedParentId === undefined) {\n\t\tthrow new Error(\n\t\t\t`Legacy v3 entry ${entry.id} has a missing or forward parent at line ${lineNumber}: ${entry.parentId}`,\n\t\t);\n\t}\n\tconst structure: LegacyV3IndexBase = {\n\t\tid: entry.id,\n\t\tparentId: entry.parentId,\n\t\tmappedId: mappedParentId,\n\t};\n\tif (!isRetainedEntry(entry)) {\n\t\tswitch (entry.type) {\n\t\t\tcase \"label\":\n\t\t\t\treturn { ...structure, type: entry.type, targetId: entry.targetId, label: entry.label };\n\t\t\tcase \"model_change\":\n\t\t\t\treturn { ...structure, type: entry.type, provider: entry.provider, modelId: entry.modelId };\n\t\t\tcase \"thinking_level_change\":\n\t\t\t\treturn { ...structure, type: entry.type, thinkingLevel: entry.thinkingLevel };\n\t\t\tcase \"active_tools_change\":\n\t\t\t\treturn { ...structure, type: entry.type, activeToolNames: entry.activeToolNames };\n\t\t\tcase \"session_info\":\n\t\t\t\treturn { ...structure, type: entry.type };\n\t\t}\n\t}\n\t// Null denotes the root, not a retained node identity that can be reminted.\n\tif (entry.id === null) throw new Error(\"Legacy v3 entry reference has no retained ancestor: null\");\n\tconst retained = {\n\t\t...structure,\n\t\tmappedId: uuidv7(Date.parse(entry.timestamp)),\n\t\tseq,\n\t};\n\tswitch (entry.type) {\n\t\tcase \"branch_summary\":\n\t\t\treturn { ...retained, type: entry.type, fromId: entry.fromId };\n\t\tcase \"compaction\":\n\t\t\treturn { ...retained, type: entry.type, firstKeptEntryId: entry.firstKeptEntryId };\n\t\tdefault:\n\t\t\treturn { ...retained, type: entry.type };\n\t}\n}\n\nfunction legacyEntryUsage(entry: LegacyV3Entry): Usage | undefined {\n\tswitch (entry.type) {\n\t\tcase \"message\":\n\t\t\treturn entry.message.role === \"assistant\" || entry.message.role === \"toolResult\"\n\t\t\t\t? entry.message.usage\n\t\t\t\t: undefined;\n\t\tcase \"compaction\":\n\t\tcase \"branch_summary\":\n\t\t\treturn entry.usage;\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\nasync function readLegacyV3Inventory(reader: TextLineReader, context: Context): Promise<LegacyV3Inventory> {\n\tconst entries = new Map<string, LegacyV3IndexEntry>();\n\tlet nextSeq = 1;\n\tlet importedUsage = emptyUsage();\n\tlet name: string | undefined;\n\tlet finalId: string | null = null;\n\twhile (true) {\n\t\tconst line = fileValue(await reader.readLine(context), \"Failed to read legacy v3 source\");\n\t\tif (line === undefined || !line.terminated) break;\n\t\tconst lineNumber = entries.size + 2;\n\t\tconst entry = parseLegacyV3Entry(line.text);\n\t\tif (entries.has(entry.id)) throw new Error(`Duplicate legacy v3 entry id: ${entry.id}`);\n\t\tconst indexed = indexLegacyV3Entry(entry, lineNumber, nextSeq, entries);\n\t\tentries.set(entry.id, indexed);\n\t\tif (isRetainedEntry(indexed)) nextSeq++;\n\t\tfinalId = entry.id;\n\t\tif (entry.type === \"session_info\") name = entry.name;\n\t\tconst usage = legacyEntryUsage(entry);\n\t\tif (usage !== undefined) importedUsage = addUsage(importedUsage, usage);\n\t}\n\treturn { entries, nextSeq, importedUsage, name, finalId };\n}\n\nfunction normalizeLegacyV3Values(inventory: LegacyV3Inventory): CommittedValueSetWrite[] {\n\tconst { entries, name, finalId } = inventory;\n\tconst resolveLegacyId = createLegacyIdResolver(entries);\n\tlet nextSeq = inventory.nextSeq;\n\tconst values: CommittedValueSetWrite[] = [];\n\n\t// session name\n\tif (name) values.push({ ...setValue(sessionName, name), seq: nextSeq++ });\n\n\t// labels\n\tconst labels = new Map<string, string>();\n\tfor (const entry of entries.values()) {\n\t\tif (entry.type !== \"label\") continue;\n\t\tconst targetId = resolveLegacyId(entry.targetId);\n\t\tif (targetId === null) continue;\n\t\tif (entry.label) labels.set(targetId, entry.label);\n\t\telse labels.delete(targetId);\n\t}\n\tfor (const [targetId, label] of labels) {\n\t\tvalues.push({ ...setValue(entryLabel(targetId), label), seq: nextSeq++ });\n\t}\n\n\t// branch tip\n\tvalues.push({ ...setValue(branchTip(\"main\"), resolveLegacyId(finalId)), seq: nextSeq++ });\n\n\t// configuration\n\tconst configuration = selectedConfiguration(entries, finalId);\n\tif (configuration !== undefined) {\n\t\tvalues.push({ ...setValue(laneConfig(\"main\"), configuration), seq: nextSeq++ });\n\t\tvalues.push({\n\t\t\t...setValue(laneState(\"main\"), { currentOperationId: null, lastOperationId: null, inbox: [] }),\n\t\t\tseq: nextSeq++,\n\t\t});\n\t}\n\treturn values;\n}\n\n/**\n * A captured legacy file exposed as repeatable logical v4 writes.\n * Each pass reopens the path; callers must not replace or edit the source between passes.\n * Structural indexes, label/configuration metadata, and derived current values survive between scans.\n */\nexport class LegacyV3Source {\n\treadonly header: JsonlStorageHeader;\n\treadonly importedUsage: Usage;\n\treadonly nextSeq: number;\n\treadonly values: readonly CommittedValueSetWrite[];\n\tprivate readonly fileSystem: FileSystem;\n\tprivate readonly path: string;\n\tprivate readonly entries: ReadonlyMap<string, LegacyV3IndexEntry>;\n\tprivate readonly resolveLegacyId: ResolveLegacyId;\n\n\tprivate constructor(\n\t\tfileSystem: FileSystem,\n\t\tpath: string,\n\t\theader: JsonlStorageHeader,\n\t\tentries: ReadonlyMap<string, LegacyV3IndexEntry>,\n\t\timportedUsage: Usage,\n\t\tvalues: readonly CommittedValueSetWrite[],\n\t\tnextSeq: number,\n\t) {\n\t\tthis.fileSystem = fileSystem;\n\t\tthis.path = path;\n\t\tthis.header = header;\n\t\tthis.entries = entries;\n\t\tthis.resolveLegacyId = createLegacyIdResolver(entries);\n\t\tthis.importedUsage = importedUsage;\n\t\tthis.values = values;\n\t\tthis.nextSeq = nextSeq;\n\t}\n\n\t/**\n\t * Scan complete v3 records without modifying the file, ignoring an unterminated final line.\n\t * Build parent mappings, assign IDs stable for this source instance, and derive current values\n\t * and imported usage. Retain metadata, not conversation payloads or an open reader. writes()\n\t * reopens the path to materialize captured records and resolve their payload-specific references.\n\t */\n\tstatic async read(fileSystem: FileSystem, path: string, context: Context): Promise<LegacyV3Source> {\n\t\tconst reader = fileValue(\n\t\t\tawait fileSystem.openTextLineReader(path, context),\n\t\t\t`Failed to open legacy v3 source ${path}`,\n\t\t);\n\t\ttry {\n\t\t\tconst parsed = await readJsonlHeader(reader, path, context);\n\t\t\tif (parsed.format !== \"v3-legacy\") {\n\t\t\t\tthrow new Error(`Invalid legacy v3 JSONL storage ${path}: expected format 3 header`);\n\t\t\t}\n\t\t\tconst inventory = await readLegacyV3Inventory(reader, context);\n\t\t\tconst values = normalizeLegacyV3Values(inventory);\n\t\t\treturn new LegacyV3Source(\n\t\t\t\tfileSystem,\n\t\t\t\tpath,\n\t\t\t\tawait normalizeLegacyV3Header(fileSystem, parsed.header, context),\n\t\t\t\tinventory.entries,\n\t\t\t\tinventory.importedUsage,\n\t\t\t\tvalues,\n\t\t\t\tinventory.nextSeq + values.length,\n\t\t\t);\n\t\t} finally {\n\t\t\tawait reader.close(context);\n\t\t}\n\t}\n\n\t*entryStructures(): Iterable<Pick<CommittedEntryWrite, \"id\" | \"parentId\" | \"seq\">> {\n\t\tfor (const entry of this.entries.values()) {\n\t\t\tif (!isRetainedEntry(entry)) continue;\n\t\t\tyield { id: entry.mappedId, parentId: this.resolveLegacyId(entry.parentId), seq: entry.seq };\n\t\t}\n\t}\n\n\ttranslateForkEntryId(legacyId: string): string {\n\t\tconst entry = this.entries.get(legacyId);\n\t\tif (entry === undefined) throw new Error(`Legacy v3 fork entry does not exist: ${legacyId}`);\n\t\tif (!isRetainedEntry(entry)) throw new Error(`Legacy v3 fork entry is not a retained entry: ${legacyId}`);\n\t\treturn entry.mappedId;\n\t}\n\n\tprivate collectRequiredTailMessageIds(isEntrySelected?: (id: string) => boolean): Set<string> {\n\t\tconst requiredIds = new Set<string>();\n\t\tfor (const entry of this.entries.values()) {\n\t\t\tif (entry.type !== \"compaction\") continue;\n\t\t\tconst compactionIsSelected = isEntrySelected === undefined || isEntrySelected(entry.mappedId);\n\t\t\tif (!compactionIsSelected) continue;\n\n\t\t\t// Walk from the compaction's parent through firstKeptEntryId, inclusive.\n\t\t\tfor (const tailEntry of retainedTailStructure(entry, this.entries)) {\n\t\t\t\tconst canProduceContextMessage = isRetainedEntry(tailEntry) && tailEntry.type !== \"custom\";\n\t\t\t\tif (canProduceContextMessage) requiredIds.add(tailEntry.id);\n\t\t\t}\n\t\t}\n\t\treturn requiredIds;\n\t}\n\n\t/**\n\t * Stream normalized v4 entries, optionally filtered by reminted ID, followed by derived current values.\n\t * Each pass owns its reader and message cache, sharing only the captured IDs and metadata.\n\t */\n\tasync *writes(\n\t\tcontext: Context,\n\t\tisEntrySelected?: (id: string) => boolean,\n\t): AsyncIterable<CommittedEntryWrite | CommittedValueSetWrite> {\n\t\tconst requiredTailMessageIds = this.collectRequiredTailMessageIds(isEntrySelected);\n\t\t// Keep needed context messages for this entire pass; tails may revisit old or shared branches.\n\t\tconst tailMessagesByLegacyId = new Map<string, AgentMessage>();\n\t\tfor await (const { entry, indexed } of this.readCapturedEntries(context)) {\n\t\t\tif (requiredTailMessageIds.has(entry.id)) {\n\t\t\t\tconst message = projectContextMessage(entry, this.resolveLegacyId);\n\t\t\t\tif (message !== undefined) tailMessagesByLegacyId.set(entry.id, message);\n\t\t\t}\n\t\t\tif (!isRetainedEntry(indexed) || !isRetainedEntry(entry)) continue;\n\t\t\tif (isEntrySelected !== undefined && !isEntrySelected(indexed.mappedId)) continue;\n\t\t\tconst retainedTail: AgentMessage[] = [];\n\t\t\tif (indexed.type === \"compaction\") {\n\t\t\t\tfor (const ancestor of retainedTailStructure(indexed, this.entries)) {\n\t\t\t\t\tconst message = tailMessagesByLegacyId.get(ancestor.id);\n\t\t\t\t\tif (message !== undefined) retainedTail.push(message);\n\t\t\t\t}\n\t\t\t\tretainedTail.reverse();\n\t\t\t}\n\t\t\tyield normalizeRetainedEntry(entry, indexed, retainedTail, this.resolveLegacyId);\n\t\t}\n\t\tyield* this.values;\n\t}\n\n\t/** Replay only the captured prefix and verify its physical identities before materialization. */\n\tprivate async *readCapturedEntries(\n\t\tcontext: Context,\n\t): AsyncIterable<{ entry: LegacyV3Entry; indexed: LegacyV3IndexEntry }> {\n\t\tconst reader = fileValue(\n\t\t\tawait this.fileSystem.openTextLineReader(this.path, context),\n\t\t\t`Failed to reopen legacy v3 source ${this.path}`,\n\t\t);\n\t\ttry {\n\t\t\tconst parsed = await readJsonlHeader(reader, this.path, context);\n\t\t\tif (\n\t\t\t\tparsed.format !== \"v3-legacy\" ||\n\t\t\t\tparsed.header.id !== this.header.id ||\n\t\t\t\tparsed.header.cwd !== this.header.cwd\n\t\t\t) {\n\t\t\t\tthrow new Error(\"Legacy v3 source header changed\");\n\t\t\t}\n\t\t\tfor (const indexed of this.entries.values()) {\n\t\t\t\tconst line = fileValue(await reader.readLine(context), \"Failed to reread legacy v3 source\");\n\t\t\t\tif (line === undefined || !line.terminated)\n\t\t\t\t\tthrow new Error(\"Legacy v3 source ended before captured entries\");\n\t\t\t\tconst entry = parseLegacyV3Entry(line.text);\n\t\t\t\tif (entry.id !== indexed.id || entry.type !== indexed.type) {\n\t\t\t\t\tthrow new Error(\"Legacy v3 source changed\");\n\t\t\t\t}\n\t\t\t\tyield { entry, indexed };\n\t\t\t}\n\t\t} finally {\n\t\t\tawait reader.close(context);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare function listJsonlSessionMetadata(options: JsonlSessionRepoOptions, query?: JsonlSessionListOptions): Promise<JsonlSessionMetadata[]>;
|
|
6
|
-
export declare function loadJsonlSessionStorage(options: JsonlSessionRepoOptions, metadata: JsonlSessionMetadata): Promise<JsonlSessionStorage>;
|
|
1
|
+
import type { Context } from "../../context.ts";
|
|
2
|
+
import type { ForkOptions, Session, SessionRepo } from "../types.ts";
|
|
3
|
+
import { type JsonlSessionCreateOptions, type JsonlSessionListOptions, type JsonlSessionMetadata, type JsonlSessionRepoOptions } from "./types.ts";
|
|
4
|
+
/** File-backed format-4 session repository lifecycle. */
|
|
7
5
|
export declare class JsonlSessionRepo implements SessionRepo<JsonlSessionMetadata, JsonlSessionCreateOptions, JsonlSessionListOptions> {
|
|
8
|
-
private readonly
|
|
6
|
+
private readonly fileSystem;
|
|
9
7
|
private readonly sessionsRootInput;
|
|
10
|
-
private readonly
|
|
11
|
-
private
|
|
8
|
+
private readonly now;
|
|
9
|
+
private readonly openSessions;
|
|
10
|
+
private readonly pendingCreates;
|
|
11
|
+
private closed;
|
|
12
|
+
private closePromise;
|
|
12
13
|
constructor(options: JsonlSessionRepoOptions);
|
|
13
|
-
create(options: JsonlSessionCreateOptions): Promise<Session<JsonlSessionMetadata>>;
|
|
14
|
-
open(metadata: JsonlSessionMetadata): Promise<Session<JsonlSessionMetadata>>;
|
|
15
|
-
list(options
|
|
16
|
-
delete(metadata: JsonlSessionMetadata): Promise<void>;
|
|
17
|
-
fork(source: JsonlSessionMetadata, options: ForkOptions
|
|
18
|
-
|
|
14
|
+
create(options: JsonlSessionCreateOptions, context: Context): Promise<Session<JsonlSessionMetadata>>;
|
|
15
|
+
open(metadata: JsonlSessionMetadata, context: Context): Promise<Session<JsonlSessionMetadata>>;
|
|
16
|
+
list(options: JsonlSessionListOptions | undefined, context: Context): Promise<JsonlSessionMetadata[]>;
|
|
17
|
+
delete(metadata: JsonlSessionMetadata, context: Context): Promise<void>;
|
|
18
|
+
fork(source: JsonlSessionMetadata, options: ForkOptions, context: Context): Promise<Session<JsonlSessionMetadata>>;
|
|
19
|
+
close(_context: Context): Promise<void>;
|
|
19
20
|
private resolveCreateDestination;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* same {cwd, id} is free and publish duplicate sessions.
|
|
24
|
-
*/
|
|
25
|
-
private claimCreateDestination;
|
|
26
|
-
private prepareCreate;
|
|
27
|
-
private listDirect;
|
|
28
|
-
private sessionIdExists;
|
|
21
|
+
private listDirectory;
|
|
22
|
+
private readSessionMetadata;
|
|
23
|
+
private sessionDirectories;
|
|
29
24
|
private sessionDirectory;
|
|
25
|
+
private resolveNewSessionPath;
|
|
26
|
+
private assertSessionIdAvailable;
|
|
27
|
+
private resolveForkInput;
|
|
28
|
+
private isLegacyV3ForkSource;
|
|
29
|
+
private publishOpenSession;
|
|
30
|
+
private sessionKey;
|
|
31
|
+
private loadStorage;
|
|
30
32
|
private root;
|
|
33
|
+
private assertOpen;
|
|
31
34
|
}
|
|
32
35
|
//# sourceMappingURL=repo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../../src/harness/session/jsonl/repo.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../../../src/harness/session/jsonl/repo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAMrE,OAAO,EAGN,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAE5B,MAAM,YAAY,CAAC;AA0BpB,yDAAyD;AACzD,qBAAa,gBACZ,YAAW,WAAW,CAAC,oBAAoB,EAAE,yBAAyB,EAAE,uBAAuB,CAAC;IAEhG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmC;IAChE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAA4B;IAEhD,YAAY,OAAO,EAA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