@code-yeongyu/senpi-agent-core 2026.9.12-3 → 2026.9.12
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 +0 -4
- package/dist/harness/agent-harness.d.ts +384 -639
- package/dist/harness/agent-harness.d.ts.map +1 -1
- package/dist/harness/agent-harness.js +250 -5
- package/dist/harness/agent-harness.js.map +1 -1
- package/dist/harness/compaction/branch-summarization.d.ts +6 -12
- package/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/harness/compaction/branch-summarization.js +27 -33
- package/dist/harness/compaction/branch-summarization.js.map +1 -1
- package/dist/harness/compaction/compaction.d.ts +8 -30
- package/dist/harness/compaction/compaction.d.ts.map +1 -1
- package/dist/harness/compaction/compaction.js +64 -53
- package/dist/harness/compaction/compaction.js.map +1 -1
- package/dist/harness/env/nodejs.d.ts +28 -25
- package/dist/harness/env/nodejs.d.ts.map +1 -1
- package/dist/harness/env/nodejs.js +125 -368
- package/dist/harness/env/nodejs.js.map +1 -1
- package/dist/harness/events.d.ts +38 -20
- package/dist/harness/events.d.ts.map +1 -1
- package/dist/harness/events.js +55 -233
- package/dist/harness/events.js.map +1 -1
- 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 +2 -3
- 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/reducer.d.ts +100 -0
- package/dist/harness/reducer.d.ts.map +1 -0
- package/dist/harness/reducer.js +420 -0
- package/dist/harness/reducer.js.map +1 -0
- package/dist/harness/result.d.ts +0 -93
- package/dist/harness/result.d.ts.map +1 -1
- package/dist/harness/result.js +0 -39
- package/dist/harness/result.js.map +1 -1
- package/dist/harness/session/context.d.ts +19 -6
- package/dist/harness/session/context.d.ts.map +1 -1
- package/dist/harness/session/context.js +53 -31
- package/dist/harness/session/context.js.map +1 -1
- package/dist/harness/session/index.d.ts +5 -9
- package/dist/harness/session/index.d.ts.map +1 -1
- package/dist/harness/session/index.js +4 -7
- package/dist/harness/session/index.js.map +1 -1
- package/dist/harness/session/jsonl/codec.d.ts +8 -19
- package/dist/harness/session/jsonl/codec.d.ts.map +1 -1
- package/dist/harness/session/jsonl/codec.js +219 -34
- package/dist/harness/session/jsonl/codec.js.map +1 -1
- package/dist/harness/session/jsonl/errors.d.ts +9 -0
- package/dist/harness/session/jsonl/errors.d.ts.map +1 -0
- package/dist/harness/session/jsonl/errors.js +18 -0
- package/dist/harness/session/jsonl/errors.js.map +1 -0
- package/dist/harness/session/jsonl/repo.d.ts +24 -27
- package/dist/harness/session/jsonl/repo.d.ts.map +1 -1
- package/dist/harness/session/jsonl/repo.js +151 -276
- package/dist/harness/session/jsonl/repo.js.map +1 -1
- package/dist/harness/session/jsonl/storage.d.ts +41 -39
- package/dist/harness/session/jsonl/storage.d.ts.map +1 -1
- package/dist/harness/session/jsonl/storage.js +196 -175
- package/dist/harness/session/jsonl/storage.js.map +1 -1
- package/dist/harness/session/jsonl/types.d.ts +22 -23
- package/dist/harness/session/jsonl/types.d.ts.map +1 -1
- package/dist/harness/session/jsonl/types.js +1 -2
- package/dist/harness/session/jsonl/types.js.map +1 -1
- package/dist/harness/session/jsonl.d.ts +3 -0
- package/dist/harness/session/jsonl.d.ts.map +1 -0
- package/dist/harness/session/jsonl.js +2 -0
- package/dist/harness/session/jsonl.js.map +1 -0
- package/dist/harness/session/memory.d.ts +40 -44
- package/dist/harness/session/memory.d.ts.map +1 -1
- package/dist/harness/session/memory.js +115 -333
- package/dist/harness/session/memory.js.map +1 -1
- package/dist/harness/session/session.d.ts +51 -78
- package/dist/harness/session/session.d.ts.map +1 -1
- package/dist/harness/session/session.js +207 -327
- package/dist/harness/session/session.js.map +1 -1
- package/dist/harness/session/state.d.ts +65 -0
- package/dist/harness/session/state.d.ts.map +1 -0
- package/dist/harness/session/state.js +320 -0
- package/dist/harness/session/state.js.map +1 -0
- package/dist/harness/session/testing/conformance.d.ts +4 -0
- package/dist/harness/session/testing/conformance.d.ts.map +1 -0
- package/dist/harness/session/testing/conformance.js +762 -0
- package/dist/harness/session/testing/conformance.js.map +1 -0
- package/dist/harness/session/testing/index.d.ts +2 -9
- package/dist/harness/session/testing/index.d.ts.map +1 -1
- package/dist/harness/session/testing/index.js +1 -8
- package/dist/harness/session/testing/index.js.map +1 -1
- package/dist/harness/session/testing/types.d.ts +7 -5
- 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 +265 -425
- 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/skills.d.ts +2 -3
- package/dist/harness/skills.d.ts.map +1 -1
- package/dist/harness/skills.js +26 -29
- package/dist/harness/skills.js.map +1 -1
- package/dist/harness/telemetry.d.ts +43 -64
- package/dist/harness/telemetry.d.ts.map +1 -1
- package/dist/harness/telemetry.js +26 -45
- 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 +93 -66
- 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 +13 -17
- package/dist/harness/tools/edit.js.map +1 -1
- package/dist/harness/tools/file-mutation-queue.d.ts +1 -2
- 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 +2 -3
- 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 +1 -2
- package/dist/harness/tools/read.d.ts.map +1 -1
- package/dist/harness/tools/read.js +6 -4
- 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 +8 -12
- package/dist/harness/tools/write.js.map +1 -1
- package/dist/harness/types.d.ts +45 -128
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js.map +1 -1
- package/dist/harness/utils/shell-output.d.ts +5 -19
- package/dist/harness/utils/shell-output.d.ts.map +1 -1
- package/dist/harness/utils/shell-output.js +192 -65
- package/dist/harness/utils/shell-output.js.map +1 -1
- package/dist/harness/utils/truncate.d.ts +0 -1
- 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/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/search/index.d.ts +16 -24
- 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/search/scanning.d.ts +29 -0
- package/dist/search/scanning.d.ts.map +1 -0
- package/dist/search/scanning.js +103 -0
- package/dist/search/scanning.js.map +1 -0
- package/dist/types.d.ts +0 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +6 -27
- package/dist/harness/config.d.ts +0 -9
- package/dist/harness/config.d.ts.map +0 -1
- package/dist/harness/config.js +0 -35
- package/dist/harness/config.js.map +0 -1
- package/dist/harness/context.d.ts +0 -9
- package/dist/harness/context.d.ts.map +0 -1
- package/dist/harness/context.js +0 -13
- package/dist/harness/context.js.map +0 -1
- package/dist/harness/execution/assistant.d.ts +0 -42
- package/dist/harness/execution/assistant.d.ts.map +0 -1
- package/dist/harness/execution/assistant.js +0 -82
- package/dist/harness/execution/assistant.js.map +0 -1
- package/dist/harness/execution/effect-gate.d.ts +0 -22
- package/dist/harness/execution/effect-gate.d.ts.map +0 -1
- package/dist/harness/execution/effect-gate.js +0 -48
- package/dist/harness/execution/effect-gate.js.map +0 -1
- package/dist/harness/execution/tools.d.ts +0 -67
- package/dist/harness/execution/tools.d.ts.map +0 -1
- package/dist/harness/execution/tools.js +0 -121
- package/dist/harness/execution/tools.js.map +0 -1
- package/dist/harness/hooks.d.ts +0 -38
- package/dist/harness/hooks.d.ts.map +0 -1
- package/dist/harness/hooks.js +0 -404
- package/dist/harness/hooks.js.map +0 -1
- package/dist/harness/runtime/drive/boundary.d.ts +0 -28
- package/dist/harness/runtime/drive/boundary.d.ts.map +0 -1
- package/dist/harness/runtime/drive/boundary.js +0 -173
- package/dist/harness/runtime/drive/boundary.js.map +0 -1
- package/dist/harness/runtime/drive/checkpoint.d.ts +0 -8
- package/dist/harness/runtime/drive/checkpoint.d.ts.map +0 -1
- package/dist/harness/runtime/drive/checkpoint.js +0 -133
- package/dist/harness/runtime/drive/checkpoint.js.map +0 -1
- package/dist/harness/runtime/drive/deferred.d.ts +0 -15
- package/dist/harness/runtime/drive/deferred.d.ts.map +0 -1
- package/dist/harness/runtime/drive/deferred.js +0 -179
- package/dist/harness/runtime/drive/deferred.js.map +0 -1
- package/dist/harness/runtime/drive/generation.d.ts +0 -8
- package/dist/harness/runtime/drive/generation.d.ts.map +0 -1
- package/dist/harness/runtime/drive/generation.js +0 -205
- package/dist/harness/runtime/drive/generation.js.map +0 -1
- package/dist/harness/runtime/drive/reconcile.d.ts +0 -5
- package/dist/harness/runtime/drive/reconcile.d.ts.map +0 -1
- package/dist/harness/runtime/drive/reconcile.js +0 -140
- package/dist/harness/runtime/drive/reconcile.js.map +0 -1
- package/dist/harness/runtime/drive/recovery.d.ts +0 -8
- package/dist/harness/runtime/drive/recovery.d.ts.map +0 -1
- package/dist/harness/runtime/drive/recovery.js +0 -85
- package/dist/harness/runtime/drive/recovery.js.map +0 -1
- package/dist/harness/runtime/drive/response.d.ts +0 -23
- package/dist/harness/runtime/drive/response.d.ts.map +0 -1
- package/dist/harness/runtime/drive/response.js +0 -394
- package/dist/harness/runtime/drive/response.js.map +0 -1
- package/dist/harness/runtime/drive/retry.d.ts +0 -4
- package/dist/harness/runtime/drive/retry.d.ts.map +0 -1
- package/dist/harness/runtime/drive/retry.js +0 -34
- package/dist/harness/runtime/drive/retry.js.map +0 -1
- package/dist/harness/runtime/drive/structural.d.ts +0 -32
- package/dist/harness/runtime/drive/structural.d.ts.map +0 -1
- package/dist/harness/runtime/drive/structural.js +0 -929
- package/dist/harness/runtime/drive/structural.js.map +0 -1
- package/dist/harness/runtime/drive/terminal.d.ts +0 -7
- package/dist/harness/runtime/drive/terminal.d.ts.map +0 -1
- package/dist/harness/runtime/drive/terminal.js +0 -49
- package/dist/harness/runtime/drive/terminal.js.map +0 -1
- package/dist/harness/runtime/drive/tool-placement.d.ts +0 -14
- package/dist/harness/runtime/drive/tool-placement.d.ts.map +0 -1
- package/dist/harness/runtime/drive/tool-placement.js +0 -244
- package/dist/harness/runtime/drive/tool-placement.js.map +0 -1
- package/dist/harness/runtime/drive/tools.d.ts +0 -6
- package/dist/harness/runtime/drive/tools.d.ts.map +0 -1
- package/dist/harness/runtime/drive/tools.js +0 -449
- package/dist/harness/runtime/drive/tools.js.map +0 -1
- package/dist/harness/runtime/drive.d.ts +0 -6
- package/dist/harness/runtime/drive.d.ts.map +0 -1
- package/dist/harness/runtime/drive.js +0 -93
- package/dist/harness/runtime/drive.js.map +0 -1
- package/dist/harness/runtime/harness.d.ts +0 -59
- package/dist/harness/runtime/harness.d.ts.map +0 -1
- package/dist/harness/runtime/harness.js +0 -302
- package/dist/harness/runtime/harness.js.map +0 -1
- package/dist/harness/runtime/index.d.ts +0 -2
- package/dist/harness/runtime/index.d.ts.map +0 -1
- package/dist/harness/runtime/index.js +0 -2
- package/dist/harness/runtime/index.js.map +0 -1
- package/dist/harness/runtime/lane.d.ts +0 -118
- package/dist/harness/runtime/lane.d.ts.map +0 -1
- package/dist/harness/runtime/lane.js +0 -1559
- package/dist/harness/runtime/lane.js.map +0 -1
- package/dist/harness/runtime/progress.d.ts +0 -15
- package/dist/harness/runtime/progress.d.ts.map +0 -1
- package/dist/harness/runtime/progress.js +0 -66
- package/dist/harness/runtime/progress.js.map +0 -1
- package/dist/harness/runtime/reducer.d.ts +0 -5
- package/dist/harness/runtime/reducer.d.ts.map +0 -1
- package/dist/harness/runtime/reducer.js +0 -240
- package/dist/harness/runtime/reducer.js.map +0 -1
- package/dist/harness/runtime/restore.d.ts +0 -24
- package/dist/harness/runtime/restore.d.ts.map +0 -1
- package/dist/harness/runtime/restore.js +0 -117
- package/dist/harness/runtime/restore.js.map +0 -1
- package/dist/harness/runtime/transcript.d.ts +0 -21
- package/dist/harness/runtime/transcript.d.ts.map +0 -1
- package/dist/harness/runtime/transcript.js +0 -72
- package/dist/harness/runtime/transcript.js.map +0 -1
- package/dist/harness/runtime/types.d.ts +0 -105
- package/dist/harness/runtime/types.d.ts.map +0 -1
- package/dist/harness/runtime/types.js +0 -50
- package/dist/harness/runtime/types.js.map +0 -1
- package/dist/harness/session/commit.d.ts +0 -53
- package/dist/harness/session/commit.d.ts.map +0 -1
- package/dist/harness/session/commit.js +0 -57
- package/dist/harness/session/commit.js.map +0 -1
- package/dist/harness/session/fork-policy.d.ts +0 -21
- package/dist/harness/session/fork-policy.d.ts.map +0 -1
- package/dist/harness/session/fork-policy.js +0 -55
- package/dist/harness/session/fork-policy.js.map +0 -1
- package/dist/harness/session/fork.d.ts +0 -16
- package/dist/harness/session/fork.d.ts.map +0 -1
- package/dist/harness/session/fork.js +0 -79
- package/dist/harness/session/fork.js.map +0 -1
- package/dist/harness/session/in-memory-storage-state.d.ts +0 -39
- package/dist/harness/session/in-memory-storage-state.d.ts.map +0 -1
- package/dist/harness/session/in-memory-storage-state.js +0 -269
- package/dist/harness/session/in-memory-storage-state.js.map +0 -1
- package/dist/harness/session/jsonl/fork.d.ts +0 -38
- package/dist/harness/session/jsonl/fork.d.ts.map +0 -1
- package/dist/harness/session/jsonl/fork.js +0 -266
- package/dist/harness/session/jsonl/fork.js.map +0 -1
- package/dist/harness/session/jsonl/index.d.ts +0 -4
- package/dist/harness/session/jsonl/index.d.ts.map +0 -1
- package/dist/harness/session/jsonl/index.js +0 -4
- package/dist/harness/session/jsonl/index.js.map +0 -1
- package/dist/harness/session/jsonl/io.d.ts +0 -14
- package/dist/harness/session/jsonl/io.d.ts.map +0 -1
- package/dist/harness/session/jsonl/io.js +0 -86
- package/dist/harness/session/jsonl/io.js.map +0 -1
- package/dist/harness/session/jsonl/legacy-v3.d.ts +0 -44
- package/dist/harness/session/jsonl/legacy-v3.d.ts.map +0 -1
- package/dist/harness/session/jsonl/legacy-v3.js +0 -454
- package/dist/harness/session/jsonl/legacy-v3.js.map +0 -1
- package/dist/harness/session/mutation-line.d.ts +0 -8
- package/dist/harness/session/mutation-line.d.ts.map +0 -1
- package/dist/harness/session/mutation-line.js +0 -22
- package/dist/harness/session/mutation-line.js.map +0 -1
- package/dist/harness/session/testing/benchmark/datasets.d.ts +0 -12
- package/dist/harness/session/testing/benchmark/datasets.d.ts.map +0 -1
- package/dist/harness/session/testing/benchmark/datasets.js +0 -24
- package/dist/harness/session/testing/benchmark/datasets.js.map +0 -1
- package/dist/harness/session/testing/benchmark/session-repo.d.ts +0 -42
- package/dist/harness/session/testing/benchmark/session-repo.d.ts.map +0 -1
- package/dist/harness/session/testing/benchmark/session-repo.js +0 -127
- package/dist/harness/session/testing/benchmark/session-repo.js.map +0 -1
- package/dist/harness/session/testing/benchmark/storage.d.ts +0 -25
- package/dist/harness/session/testing/benchmark/storage.d.ts.map +0 -1
- package/dist/harness/session/testing/benchmark/storage.js +0 -114
- package/dist/harness/session/testing/benchmark/storage.js.map +0 -1
- package/dist/harness/session/testing/conformance/session-repo.d.ts +0 -23
- package/dist/harness/session/testing/conformance/session-repo.d.ts.map +0 -1
- package/dist/harness/session/testing/conformance/session-repo.js +0 -809
- package/dist/harness/session/testing/conformance/session-repo.js.map +0 -1
- package/dist/harness/session/testing/conformance/storage.d.ts +0 -4
- package/dist/harness/session/testing/conformance/storage.d.ts.map +0 -1
- package/dist/harness/session/testing/conformance/storage.js +0 -600
- package/dist/harness/session/testing/conformance/storage.js.map +0 -1
- package/dist/harness/session/testing/gating-storage.d.ts +0 -26
- package/dist/harness/session/testing/gating-storage.d.ts.map +0 -1
- package/dist/harness/session/testing/gating-storage.js +0 -103
- package/dist/harness/session/testing/gating-storage.js.map +0 -1
- package/dist/harness/session/testing/instrumented-storage.d.ts +0 -11
- package/dist/harness/session/testing/instrumented-storage.d.ts.map +0 -1
- package/dist/harness/session/testing/instrumented-storage.js +0 -19
- package/dist/harness/session/testing/instrumented-storage.js.map +0 -1
- package/dist/harness/session/testing/storage-decorator.d.ts +0 -20
- package/dist/harness/session/testing/storage-decorator.d.ts.map +0 -1
- package/dist/harness/session/testing/storage-decorator.js +0 -40
- package/dist/harness/session/testing/storage-decorator.js.map +0 -1
- package/dist/harness/session/values.d.ts +0 -95
- package/dist/harness/session/values.d.ts.map +0 -1
- package/dist/harness/session/values.js +0 -81
- package/dist/harness/session/values.js.map +0 -1
- package/dist/harness/utils/adaptive-publisher.d.ts +0 -24
- package/dist/harness/utils/adaptive-publisher.d.ts.map +0 -1
- package/dist/harness/utils/adaptive-publisher.js +0 -79
- package/dist/harness/utils/adaptive-publisher.js.map +0 -1
- package/dist/harness/utils/output-capture.d.ts +0 -31
- package/dist/harness/utils/output-capture.d.ts.map +0 -1
- package/dist/harness/utils/output-capture.js +0 -217
- package/dist/harness/utils/output-capture.js.map +0 -1
- package/dist/harness/utils/usage.d.ts +0 -4
- package/dist/harness/utils/usage.d.ts.map +0 -1
- package/dist/harness/utils/usage.js +0 -33
- package/dist/harness/utils/usage.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.js","sourceRoot":"","sources":["../../src/harness/reducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAkCtC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BAAgB,IAAI,MAAM,CAAC,OAAO,KAAK,cAAc,CAAC,EAAE,CACrG;YACD,CAAC,gBAAgB,EAAE,IAAI,KAAK,SAAS;gBACpC,gBAAgB,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW;gBAC7C,gBAAgB,CAAC,OAAO,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;QACtD,IAAI,cAAc,IAAI,uBAAuB,EAAE,CAAC;YAC/C,eAAe,GAAG;gBACjB,OAAO,EAAE,cAAc,CAAC,EAAE;gBAC1B,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB;gBAClD,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC;aACtC,CAAC;QACH,CAAC;IACF,CAAC;IAED,OAAO;QACN,SAAS,EAAE;YACV,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,SAAS,EAAE;gBACV,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;gBACzB,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAC7B,QAAQ;gBACR,IAAI;gBACJ,SAAS,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,CAAC;gBACnG,sBAAsB;gBACtB,YAAY;gBACZ,eAAe;gBACf,aAAa;gBACb,QAAQ;gBACR,oBAAoB;gBACpB,SAAS;gBACT,OAAO;aACP;YACD,cAAc;SACd;QACD,sBAAsB;QACtB,eAAe;KACf,CAAC;AACH,CAAC","sourcesContent":["import type { AssistantMessage, DeferredHandle, StopReason } from \"@earendil-works/pi-ai\";\nimport { Guard } from \"typebox/guard\";\nimport type { AgentMessage, AgentToolCall, ThinkingLevel } from \"../types.ts\";\nimport type {\n\tEntry,\n\tLaneRecord,\n\tOperationStartedRecord,\n\tProvisionedEntry,\n\tQueueEnqueuedRecord,\n\tStepAttemptRecord,\n\tToolStartedRecord,\n\tWriteDeferredRecord,\n} from \"./session/types.ts\";\n\n/**\n * Machine-readable category for a contradiction in a lane's durable recovery\n * slice. These indicate states the single-writer record protocol cannot\n * produce, not ordinary operation failures or incomplete-but-recoverable\n * intent/result prefixes. Restore must reject such states rather than repair or\n * continue it; the accompanying error message supplies human-readable detail.\n */\nexport type RecordLogCorruptionReason =\n\t| \"multiple_open_operations\"\n\t| \"unknown_operation\"\n\t| \"record_after_finish\"\n\t| \"non_consecutive_attempt\"\n\t| \"invalid_compaction_reason\"\n\t| \"queue_after_abort\"\n\t| \"invalid_queue_cancellation\"\n\t| \"inconsistent_step\"\n\t| \"tool_call_mismatch\"\n\t| \"duplicate_tool_invocation\"\n\t| \"provisioned_entry_mismatch\"\n\t| \"invalid_deferred_handle\";\n\nexport class RecordLogCorruption extends Error {\n\treadonly reason: RecordLogCorruptionReason;\n\n\tconstructor(reason: RecordLogCorruptionReason, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RecordLogCorruption\";\n\t\tthis.reason = reason;\n\t}\n}\n\nexport interface RecordLogSlice {\n\tlane: string;\n\topenOperations: readonly OperationStartedRecord[];\n\trecords: readonly LaneRecord[];\n\t/** Operation-owned entries plus entries fetched directly by provisioned or referenced ids. */\n\tentries: readonly Entry[];\n}\n\nexport interface EffectiveLaneConfiguration {\n\tmodel: { provider: string; modelId: string };\n\tthinkingLevel: ThinkingLevel;\n\tactiveToolNames: string[];\n}\n\nexport interface TerminalFailureState {\n\tentryId: string;\n\tsource: \"step\" | \"deferred_fetch\";\n\tmessage: AssistantMessage;\n}\n\nexport interface ToolBatchState {\n\tassistantEntryId: string;\n\tcalls: {\n\t\ttoolIndex: number;\n\t\ttoolCall: AgentToolCall;\n\t\tstarted?: ToolStartedRecord;\n\t\tresultExists: boolean;\n\t\tterminate?: boolean;\n\t}[];\n\ttruncated: boolean;\n\tunresolved: boolean;\n}\n\nexport interface LaneState {\n\tlane: string;\n\tleafId: string | null;\n\toperation: null | {\n\t\tid: string;\n\t\tkind: \"run\" | \"compaction\" | \"navigation\";\n\t\tintent: OperationStartedRecord[\"intent\"];\n\t\taborting: boolean;\n\t\tstep: null | {\n\t\t\tkind: \"assistant\" | \"compaction\" | \"branch_summary\";\n\t\t\tattempts: number;\n\t\t\tresultEntryId: string;\n\t\t\tcompactionReason?: \"manual\" | \"threshold\" | \"overflow\";\n\t\t};\n\t\ttoolBatch: ToolBatchState | null;\n\t\tmissingInitialMessages: ProvisionedEntry[];\n\t\tpendingSteer: ProvisionedEntry[];\n\t\tpendingFollowUp: ProvisionedEntry[];\n\t\tpendingWrites: ProvisionedEntry[];\n\t\tdeferred: DeferredHandle | null;\n\t\toverflowRecoveryUsed: boolean;\n\t\tnewestOwn: null | {\n\t\t\tentryId: string;\n\t\t\ttype: Entry[\"type\"];\n\t\t\trole?: AgentMessage[\"role\"];\n\t\t\tstopReason?: StopReason;\n\t\t};\n\t\ttargets: { result?: boolean; summary?: boolean };\n\t};\n\tpendingNextRun: ProvisionedEntry[];\n}\n\nexport interface LaneReductionInput extends RecordLogSlice {\n\tleafId: string | null;\n\t/** Entries appended by the open operation, oldest first. Empty when idle. */\n\townEntries: readonly Entry[];\n\t/** Bounded effective-state lookups at the operation anchor or idle leaf, oldest first. */\n\tconfigurationEntries: readonly Entry[];\n\t/** Harness option fallbacks used when no persisted value exists. */\n\tdefaults: EffectiveLaneConfiguration;\n}\n\nexport interface LaneReductionResult {\n\tlaneState: LaneState;\n\teffectiveConfiguration: EffectiveLaneConfiguration;\n\tterminalFailure: TerminalFailureState | null;\n}\n\ninterface AttemptSeries {\n\trecord: StepAttemptRecord;\n}\n\nfunction corrupt(reason: RecordLogCorruptionReason, message: string): never {\n\tthrow new RecordLogCorruption(reason, message);\n}\n\nfunction hasRunId(record: LaneRecord): record is Exclude<LaneRecord, OperationStartedRecord> & { runId: string } {\n\treturn \"runId\" in record && typeof record.runId === \"string\";\n}\n\nfunction matchesProvisionedEntry(entry: Entry, target: ProvisionedEntry): boolean {\n\tconst { parentId: _parentId, seq: _seq, timestamp: _timestamp, ...payload } = entry;\n\treturn Guard.IsDeepEqual(payload, target);\n}\n\nfunction validateExactProvisionedEntry(entriesById: ReadonlyMap<string, Entry>, target: ProvisionedEntry): void {\n\tconst entry = entriesById.get(target.id);\n\tif (entry && !matchesProvisionedEntry(entry, target)) {\n\t\tcorrupt(\n\t\t\t\"provisioned_entry_mismatch\",\n\t\t\t`Provisioned entry ${target.id} exists with content different from its intent`,\n\t\t);\n\t}\n}\n\nfunction validateResultEntry(\n\tentriesById: ReadonlyMap<string, Entry>,\n\tresultEntryId: string,\n\tmatches: (entry: Entry) => boolean,\n\tdescription: string,\n): void {\n\tconst entry = entriesById.get(resultEntryId);\n\tif (entry && !matches(entry)) {\n\t\tcorrupt(\n\t\t\t\"provisioned_entry_mismatch\",\n\t\t\t`Provisioned ${description} entry ${resultEntryId} exists with different content`,\n\t\t);\n\t}\n}\n\nfunction validateAttemptReason(record: StepAttemptRecord): void {\n\tconst reason = (record as { compactionReason?: unknown }).compactionReason;\n\tif (record.step === \"compaction\") {\n\t\tif (reason !== \"manual\" && reason !== \"threshold\" && reason !== \"overflow\") {\n\t\t\tcorrupt(\"invalid_compaction_reason\", `Compaction attempt ${record.id} has no valid compaction reason`);\n\t\t}\n\t} else if (reason !== undefined) {\n\t\tcorrupt(\"invalid_compaction_reason\", `${record.step} attempt ${record.id} has a compaction reason`);\n\t}\n}\n\nfunction validateAttemptSequence(\n\trecord: StepAttemptRecord,\n\tprevious: AttemptSeries | undefined,\n\tentriesById: ReadonlyMap<string, Entry>,\n): void {\n\tconst previousRecord = previous?.record;\n\tconst previousResult = previousRecord ? entriesById.get(previousRecord.resultEntryId) : undefined;\n\tconst continuesSeries =\n\t\tpreviousRecord !== undefined &&\n\t\tpreviousRecord.step === record.step &&\n\t\t(previousResult === undefined || previousResult.seq >= record.seq);\n\tconst expectedAttempt = continuesSeries ? previousRecord.attempt + 1 : 1;\n\tif (record.attempt !== expectedAttempt) {\n\t\tcorrupt(\n\t\t\t\"non_consecutive_attempt\",\n\t\t\t`${record.step} attempt ${record.id} is ${record.attempt}; expected ${expectedAttempt}`,\n\t\t);\n\t}\n\tif (!continuesSeries || record.step === \"assistant\" || previousRecord === undefined) return;\n\tif (record.resultEntryId !== previousRecord.resultEntryId) {\n\t\tcorrupt(\"inconsistent_step\", `${record.step} attempts disagree on their result entry id`);\n\t}\n\tif (record.compactionReason !== previousRecord.compactionReason) {\n\t\tcorrupt(\"inconsistent_step\", `${record.step} attempts disagree on their compaction reason`);\n\t}\n}\n\nfunction validateAttemptResult(entriesById: ReadonlyMap<string, Entry>, record: StepAttemptRecord): void {\n\tswitch (record.step) {\n\t\tcase \"assistant\":\n\t\t\tvalidateResultEntry(\n\t\t\t\tentriesById,\n\t\t\t\trecord.resultEntryId,\n\t\t\t\t(entry) => entry.type === \"message\" && entry.message.role === \"assistant\",\n\t\t\t\t\"assistant result\",\n\t\t\t);\n\t\t\tbreak;\n\t\tcase \"compaction\":\n\t\t\tvalidateResultEntry(\n\t\t\t\tentriesById,\n\t\t\t\trecord.resultEntryId,\n\t\t\t\t(entry) => entry.type === \"compaction\",\n\t\t\t\t\"compaction result\",\n\t\t\t);\n\t\t\tbreak;\n\t\tcase \"branch_summary\":\n\t\t\tvalidateResultEntry(\n\t\t\t\tentriesById,\n\t\t\t\trecord.resultEntryId,\n\t\t\t\t(entry) => entry.type === \"branch_summary\",\n\t\t\t\t\"branch-summary result\",\n\t\t\t);\n\t\t\tbreak;\n\t}\n}\n\nfunction validateToolStart(\n\trecord: Extract<LaneRecord, { type: \"tool_started\" }>,\n\tentriesById: ReadonlyMap<string, Entry>,\n\tinvocations: Set<string>,\n): void {\n\tconst invocation = `${record.assistantEntryId}\\u0000${record.toolIndex}`;\n\tif (invocations.has(invocation)) {\n\t\tcorrupt(\n\t\t\t\"duplicate_tool_invocation\",\n\t\t\t`Tool invocation ${record.assistantEntryId}:${record.toolIndex} is duplicated`,\n\t\t);\n\t}\n\tinvocations.add(invocation);\n\n\tconst assistantEntry = entriesById.get(record.assistantEntryId);\n\tif (assistantEntry?.type !== \"message\" || assistantEntry.message.role !== \"assistant\") {\n\t\tcorrupt(\"tool_call_mismatch\", `Tool start ${record.id} does not reference an assistant entry`);\n\t}\n\tconst toolCalls = assistantEntry.message.content.filter((content) => content.type === \"toolCall\");\n\tconst toolCall = toolCalls[record.toolIndex];\n\tif (!toolCall || toolCall.id !== record.toolCallId || toolCall.name !== record.toolName) {\n\t\tcorrupt(\"tool_call_mismatch\", `Tool start ${record.id} does not match its assistant tool-call ordinal`);\n\t}\n\n\tvalidateResultEntry(\n\t\tentriesById,\n\t\trecord.resultEntryId,\n\t\t(entry) =>\n\t\t\tentry.type === \"message\" &&\n\t\t\tentry.message.role === \"toolResult\" &&\n\t\t\tentry.message.toolCallId === record.toolCallId &&\n\t\t\tentry.message.toolName === record.toolName,\n\t\t\"tool result\",\n\t);\n}\n\nfunction validateDeferredHandles(entries: Iterable<Entry>): void {\n\tfor (const entry of entries) {\n\t\tif (\n\t\t\tentry.type === \"message\" &&\n\t\t\tentry.message.role === \"assistant\" &&\n\t\t\tentry.message.stopReason === \"deferred\" &&\n\t\t\t!entry.message.deferred\n\t\t) {\n\t\t\tcorrupt(\"invalid_deferred_handle\", `Deferred assistant entry ${entry.id} does not carry a handle`);\n\t\t}\n\t}\n}\n\nfunction validateOperationResult(entriesById: ReadonlyMap<string, Entry>, record: OperationStartedRecord): void {\n\tswitch (record.intent.kind) {\n\t\tcase \"run\":\n\t\t\tfor (const target of record.intent.initialMessages) validateExactProvisionedEntry(entriesById, target);\n\t\t\tbreak;\n\t\tcase \"compaction\":\n\t\t\tvalidateResultEntry(\n\t\t\t\tentriesById,\n\t\t\t\trecord.intent.resultEntryId,\n\t\t\t\t(entry) => entry.type === \"compaction\",\n\t\t\t\t\"manual compaction\",\n\t\t\t);\n\t\t\tbreak;\n\t\tcase \"navigation\":\n\t\t\tif (record.intent.summaryEntryId) {\n\t\t\t\tvalidateResultEntry(\n\t\t\t\t\tentriesById,\n\t\t\t\t\trecord.intent.summaryEntryId,\n\t\t\t\t\t(entry) => entry.type === \"branch_summary\",\n\t\t\t\t\t\"navigation summary\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tbreak;\n\t}\n}\n\n/** Validates a bounded lane recovery slice without reading or mutating session state. */\nexport function validateRecordLog(input: RecordLogSlice): void {\n\tif (input.openOperations.length > 1) {\n\t\tcorrupt(\"multiple_open_operations\", `Lane ${input.lane} has at least two open operations`);\n\t}\n\n\tconst entriesById = new Map(input.entries.map((entry) => [entry.id, entry]));\n\tvalidateDeferredHandles(entriesById.values());\n\tconst starts = new Map<string, OperationStartedRecord>();\n\tconst finishedAt = new Map<string, number>();\n\tconst abortedAt = new Map<string, number>();\n\tconst queueEnqueues = new Map<string, Extract<LaneRecord, { type: \"queue_enqueued\" }>>();\n\tconst latestAttempt = new Map<string, AttemptSeries>();\n\tconst toolInvocations = new Set<string>();\n\tconst records = [...input.records].sort((left, right) => left.seq - right.seq);\n\n\tfor (const record of records) {\n\t\tif (record.type === \"operation_started\") {\n\t\t\tstarts.set(record.id, record);\n\t\t\tvalidateOperationResult(entriesById, record);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (hasRunId(record)) {\n\t\t\tif (!starts.has(record.runId)) {\n\t\t\t\tcorrupt(\"unknown_operation\", `Record ${record.id} references unknown operation ${record.runId}`);\n\t\t\t}\n\t\t\tconst finishSeq = finishedAt.get(record.runId);\n\t\t\tif (finishSeq !== undefined && record.seq > finishSeq) {\n\t\t\t\tcorrupt(\"record_after_finish\", `Record ${record.id} follows the finish of operation ${record.runId}`);\n\t\t\t}\n\t\t}\n\n\t\tswitch (record.type) {\n\t\t\tcase \"operation_finished\":\n\t\t\t\tfinishedAt.set(record.runId, record.seq);\n\t\t\t\tbreak;\n\t\t\tcase \"abort_requested\":\n\t\t\t\tabortedAt.set(record.runId, record.seq);\n\t\t\t\tbreak;\n\t\t\tcase \"step_attempt\":\n\t\t\t\tvalidateAttemptReason(record);\n\t\t\t\tvalidateAttemptSequence(record, latestAttempt.get(record.runId), entriesById);\n\t\t\t\tvalidateAttemptResult(entriesById, record);\n\t\t\t\tlatestAttempt.set(record.runId, { record });\n\t\t\t\tbreak;\n\t\t\tcase \"tool_started\":\n\t\t\t\tvalidateToolStart(record, entriesById, toolInvocations);\n\t\t\t\tbreak;\n\t\t\tcase \"queue_enqueued\":\n\t\t\t\tif (\n\t\t\t\t\trecord.queue !== \"nextRun\" &&\n\t\t\t\t\tabortedAt.get(record.runId) !== undefined &&\n\t\t\t\t\trecord.seq > abortedAt.get(record.runId)!\n\t\t\t\t) {\n\t\t\t\t\tcorrupt(\"queue_after_abort\", `${record.queue} item ${record.target.id} was enqueued after abort`);\n\t\t\t\t}\n\t\t\t\tqueueEnqueues.set(record.target.id, record);\n\t\t\t\tvalidateExactProvisionedEntry(entriesById, record.target);\n\t\t\t\tbreak;\n\t\t\tcase \"queue_cancelled\": {\n\t\t\t\tconst enqueue = queueEnqueues.get(record.entryId);\n\t\t\t\tif (\n\t\t\t\t\t!enqueue ||\n\t\t\t\t\tenqueue.seq >= record.seq ||\n\t\t\t\t\tenqueue.runId !== record.runId ||\n\t\t\t\t\tentriesById.has(record.entryId)\n\t\t\t\t) {\n\t\t\t\t\tcorrupt(\"invalid_queue_cancellation\", `Queue cancellation ${record.id} has no pending matching enqueue`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"write_deferred\":\n\t\t\t\tvalidateExactProvisionedEntry(entriesById, record.target);\n\t\t\t\tbreak;\n\t\t\tcase \"usage\":\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\nfunction clone<T>(value: T): T {\n\treturn structuredClone(value);\n}\n\nfunction bySequence<T extends { seq: number }>(values: readonly T[]): T[] {\n\treturn [...values].sort((left, right) => left.seq - right.seq);\n}\n\nfunction deriveEffectiveConfiguration(input: LaneReductionInput): EffectiveLaneConfiguration {\n\tlet configuration = clone(input.defaults);\n\tconst entriesById = new Map<string, Entry>();\n\tfor (const entry of [...input.configurationEntries, ...input.ownEntries]) entriesById.set(entry.id, entry);\n\n\tfor (const entry of bySequence([...entriesById.values()])) {\n\t\tswitch (entry.type) {\n\t\t\tcase \"model_change\":\n\t\t\t\tconfiguration = { ...configuration, model: { provider: entry.provider, modelId: entry.modelId } };\n\t\t\t\tbreak;\n\t\t\tcase \"thinking_level_change\":\n\t\t\t\tconfiguration = { ...configuration, thinkingLevel: entry.thinkingLevel as ThinkingLevel };\n\t\t\t\tbreak;\n\t\t\tcase \"configuration_update\":\n\t\t\t\tconfiguration = {\n\t\t\t\t\t...configuration,\n\t\t\t\t\tthinkingLevel: entry.reasoning.effort as ThinkingLevel,\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tcase \"active_tools_change\":\n\t\t\t\tconfiguration = { ...configuration, activeToolNames: [...entry.activeToolNames] };\n\t\t\t\tbreak;\n\t\t\tcase \"message\":\n\t\t\t\tif (entry.message.role === \"assistant\") {\n\t\t\t\t\tconfiguration = {\n\t\t\t\t\t\t...configuration,\n\t\t\t\t\t\tmodel: { provider: entry.message.provider, modelId: entry.message.model },\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn configuration;\n}\n\nfunction deriveNewestOwn(\n\tentry: Entry | undefined,\n): NonNullable<NonNullable<LaneState[\"operation\"]>[\"newestOwn\"]> | null {\n\tif (!entry) return null;\n\tif (entry.type !== \"message\") return { entryId: entry.id, type: entry.type };\n\tif (entry.message.role !== \"assistant\") {\n\t\treturn { entryId: entry.id, type: entry.type, role: entry.message.role };\n\t}\n\treturn {\n\t\tentryId: entry.id,\n\t\ttype: entry.type,\n\t\trole: entry.message.role,\n\t\tstopReason: entry.message.stopReason,\n\t};\n}\n\nfunction deriveToolBatch(\n\toperationId: string,\n\trecords: readonly LaneRecord[],\n\townEntries: readonly Entry[],\n\tentriesById: ReadonlyMap<string, Entry>,\n\tdeferredWriteIds: ReadonlySet<string>,\n): ToolBatchState | null {\n\tconst assistantEntry = [...ownEntries]\n\t\t.reverse()\n\t\t.find(\n\t\t\t(entry) =>\n\t\t\t\tentry.type === \"message\" &&\n\t\t\t\tentry.message.role === \"assistant\" &&\n\t\t\t\tentry.message.content.some((content) => content.type === \"toolCall\"),\n\t\t);\n\tif (assistantEntry?.type !== \"message\" || assistantEntry.message.role !== \"assistant\") return null;\n\n\tconst toolCalls = assistantEntry.message.content.filter(\n\t\t(content): content is AgentToolCall => content.type === \"toolCall\",\n\t);\n\tconst starts = new Map<number, ToolStartedRecord>();\n\tfor (const record of records) {\n\t\tif (\n\t\t\trecord.type === \"tool_started\" &&\n\t\t\trecord.runId === operationId &&\n\t\t\trecord.assistantEntryId === assistantEntry.id\n\t\t) {\n\t\t\tstarts.set(record.toolIndex, record);\n\t\t}\n\t}\n\n\tconst calls = toolCalls.map((toolCall, toolIndex) => {\n\t\tconst started = starts.get(toolIndex);\n\t\tconst startedResult = started ? entriesById.get(started.resultEntryId) : undefined;\n\t\tconst blockedResult = ownEntries.find(\n\t\t\t(entry) =>\n\t\t\t\tentry.seq > assistantEntry.seq &&\n\t\t\t\t!deferredWriteIds.has(entry.id) &&\n\t\t\t\tentry.type === \"message\" &&\n\t\t\t\tentry.message.role === \"toolResult\" &&\n\t\t\t\tentry.message.toolCallId === toolCall.id,\n\t\t);\n\t\tconst result = startedResult ?? blockedResult;\n\t\treturn {\n\t\t\ttoolIndex,\n\t\t\ttoolCall: clone(toolCall),\n\t\t\t...(started ? { started: clone(started) } : {}),\n\t\t\tresultExists: result !== undefined,\n\t\t\t...(result?.type === \"message\" && result.terminate === true ? { terminate: true } : {}),\n\t\t};\n\t});\n\n\treturn {\n\t\tassistantEntryId: assistantEntry.id,\n\t\tcalls,\n\t\ttruncated: assistantEntry.message.stopReason === \"length\",\n\t\tunresolved: calls.some((call) => !call.resultExists),\n\t};\n}\n\n/** Purely reconstructs one lane's orchestration state from its bounded recovery inputs. */\nexport function reduceLaneState(input: LaneReductionInput): LaneReductionResult {\n\tvalidateRecordLog(input);\n\n\tconst records = bySequence(input.records);\n\tconst ownEntries = bySequence(input.ownEntries);\n\tconst entriesById = new Map<string, Entry>();\n\tfor (const entry of [...input.entries, ...ownEntries]) entriesById.set(entry.id, entry);\n\tconst cancelledQueueIds = new Set(\n\t\trecords.filter((record) => record.type === \"queue_cancelled\").map((record) => record.entryId),\n\t);\n\tconst pendingQueueRecords = records.filter(\n\t\t(record): record is QueueEnqueuedRecord =>\n\t\t\trecord.type === \"queue_enqueued\" &&\n\t\t\t!entriesById.has(record.target.id) &&\n\t\t\t!cancelledQueueIds.has(record.target.id),\n\t);\n\tconst started = input.openOperations[0];\n\tconst capturedInitialMessageIds = new Set(\n\t\tstarted?.intent.kind === \"run\" ? started.intent.initialMessages.map((target) => target.id) : [],\n\t);\n\tconst pendingNextRun = pendingQueueRecords\n\t\t.filter((record) => record.queue === \"nextRun\" && !capturedInitialMessageIds.has(record.target.id))\n\t\t.map((record) => clone(record.target));\n\tconst effectiveConfiguration = deriveEffectiveConfiguration(input);\n\n\tif (!started) {\n\t\treturn {\n\t\t\tlaneState: { lane: input.lane, leafId: input.leafId, operation: null, pendingNextRun },\n\t\t\teffectiveConfiguration,\n\t\t\tterminalFailure: null,\n\t\t};\n\t}\n\n\tconst operationRecords = records.filter((record) =>\n\t\trecord.type === \"operation_started\" ? record.id === started.id : \"runId\" in record && record.runId === started.id,\n\t);\n\tconst aborting = operationRecords.some((record) => record.type === \"abort_requested\");\n\tconst pendingSteer = aborting\n\t\t? []\n\t\t: pendingQueueRecords\n\t\t\t\t.filter((record) => record.queue === \"steer\" && record.runId === started.id)\n\t\t\t\t.map((record) => clone(record.target));\n\tconst pendingFollowUp = aborting\n\t\t? []\n\t\t: pendingQueueRecords\n\t\t\t\t.filter((record) => record.queue === \"followUp\" && record.runId === started.id)\n\t\t\t\t.map((record) => clone(record.target));\n\tconst pendingWrites = operationRecords\n\t\t.filter(\n\t\t\t(record): record is WriteDeferredRecord =>\n\t\t\t\trecord.type === \"write_deferred\" && !entriesById.has(record.target.id),\n\t\t)\n\t\t.map((record) => clone(record.target));\n\tconst missingInitialMessages =\n\t\tstarted.intent.kind === \"run\"\n\t\t\t? started.intent.initialMessages.filter((target) => !entriesById.has(target.id)).map(clone)\n\t\t\t: [];\n\n\tconst newestAttempt = operationRecords.filter((record) => record.type === \"step_attempt\").at(-1);\n\tconst step =\n\t\tnewestAttempt && !entriesById.has(newestAttempt.resultEntryId)\n\t\t\t? {\n\t\t\t\t\tkind: newestAttempt.step,\n\t\t\t\t\tattempts: newestAttempt.attempt,\n\t\t\t\t\tresultEntryId: newestAttempt.resultEntryId,\n\t\t\t\t\t...(newestAttempt.step === \"compaction\" ? { compactionReason: newestAttempt.compactionReason } : {}),\n\t\t\t\t}\n\t\t\t: null;\n\n\tconst consumedInputIds = new Set<string>();\n\tif (started.intent.kind === \"run\") {\n\t\tfor (const target of started.intent.initialMessages) consumedInputIds.add(target.id);\n\t}\n\tfor (const record of operationRecords) {\n\t\tif (record.type === \"queue_enqueued\" && record.queue !== \"nextRun\") consumedInputIds.add(record.target.id);\n\t}\n\tlet newestConsumedInputSequence = Number.NEGATIVE_INFINITY;\n\tfor (const id of consumedInputIds) {\n\t\tconst entry = entriesById.get(id);\n\t\tif (entry?.type === \"message\") newestConsumedInputSequence = Math.max(newestConsumedInputSequence, entry.seq);\n\t}\n\tconst overflowRecoveryUsed = operationRecords.some(\n\t\t(record) =>\n\t\t\trecord.type === \"step_attempt\" &&\n\t\t\trecord.step === \"compaction\" &&\n\t\t\trecord.compactionReason === \"overflow\" &&\n\t\t\trecord.seq > newestConsumedInputSequence,\n\t);\n\n\tconst newestOwnEntry = ownEntries.at(-1);\n\tconst newestOwn = deriveNewestOwn(newestOwnEntry);\n\tconst deferred =\n\t\tnewestOwnEntry?.type === \"message\" &&\n\t\tnewestOwnEntry.message.role === \"assistant\" &&\n\t\tnewestOwnEntry.message.stopReason === \"deferred\" &&\n\t\tnewestOwnEntry.message.deferred\n\t\t\t? clone(newestOwnEntry.message.deferred)\n\t\t\t: null;\n\tconst targets: { result?: boolean; summary?: boolean } = {};\n\tif (started.intent.kind === \"compaction\") {\n\t\ttargets.result = entriesById.has(started.intent.resultEntryId);\n\t} else if (started.intent.kind === \"navigation\" && started.intent.summaryEntryId) {\n\t\ttargets.summary = entriesById.has(started.intent.summaryEntryId);\n\t}\n\n\tconst deferredWriteIds = new Set(\n\t\toperationRecords.filter((record) => record.type === \"write_deferred\").map((record) => record.target.id),\n\t);\n\tlet terminalFailure: TerminalFailureState | null = null;\n\tif (\n\t\tnewestOwnEntry?.type === \"message\" &&\n\t\tnewestOwnEntry.message.role === \"assistant\" &&\n\t\tnewestOwnEntry.message.stopReason === \"error\" &&\n\t\t!deferredWriteIds.has(newestOwnEntry.id)\n\t) {\n\t\tconst producedByStep = operationRecords.some(\n\t\t\t(record) => record.type === \"step_attempt\" && record.resultEntryId === newestOwnEntry.id,\n\t\t);\n\t\tconst previousOwnEntry = ownEntries.at(-2);\n\t\tconst producedByDeferredFetch =\n\t\t\toperationRecords.some(\n\t\t\t\t(record) =>\n\t\t\t\t\trecord.type === \"usage\" && record.cause === \"deferred_fetch\" && record.entryId === newestOwnEntry.id,\n\t\t\t) ||\n\t\t\t(previousOwnEntry?.type === \"message\" &&\n\t\t\t\tpreviousOwnEntry.message.role === \"assistant\" &&\n\t\t\t\tpreviousOwnEntry.message.stopReason === \"deferred\");\n\t\tif (producedByStep || producedByDeferredFetch) {\n\t\t\tterminalFailure = {\n\t\t\t\tentryId: newestOwnEntry.id,\n\t\t\t\tsource: producedByStep ? \"step\" : \"deferred_fetch\",\n\t\t\t\tmessage: clone(newestOwnEntry.message),\n\t\t\t};\n\t\t}\n\t}\n\n\treturn {\n\t\tlaneState: {\n\t\t\tlane: input.lane,\n\t\t\tleafId: input.leafId,\n\t\t\toperation: {\n\t\t\t\tid: started.id,\n\t\t\t\tkind: started.intent.kind,\n\t\t\t\tintent: clone(started.intent),\n\t\t\t\taborting,\n\t\t\t\tstep,\n\t\t\t\ttoolBatch: deriveToolBatch(started.id, operationRecords, ownEntries, entriesById, deferredWriteIds),\n\t\t\t\tmissingInitialMessages,\n\t\t\t\tpendingSteer,\n\t\t\t\tpendingFollowUp,\n\t\t\t\tpendingWrites,\n\t\t\t\tdeferred,\n\t\t\t\toverflowRecoveryUsed,\n\t\t\t\tnewestOwn,\n\t\t\t\ttargets,\n\t\t\t},\n\t\t\tpendingNextRun,\n\t\t},\n\t\teffectiveConfiguration,\n\t\tterminalFailure,\n\t};\n}\n"]}
|
package/dist/harness/result.d.ts
CHANGED
|
@@ -31,103 +31,10 @@ export interface TaggedErrorFactory<Tag extends string> {
|
|
|
31
31
|
is(value: unknown): value is TaggedErrorValue<Tag>;
|
|
32
32
|
}
|
|
33
33
|
export declare function TaggedError<Tag extends string>(tag: Tag): TaggedErrorFactory<Tag>;
|
|
34
|
-
declare const LaneBusy_base: TaggedErrorFactory<"LaneBusy">;
|
|
35
|
-
export declare class LaneBusy extends LaneBusy_base<{
|
|
36
|
-
lane: string;
|
|
37
|
-
operationId: string;
|
|
38
|
-
operationKind: "run" | "compaction" | "navigation";
|
|
39
|
-
message: string;
|
|
40
|
-
}> {
|
|
41
|
-
}
|
|
42
|
-
declare const OperationMismatch_base: TaggedErrorFactory<"OperationMismatch">;
|
|
43
|
-
export declare class OperationMismatch extends OperationMismatch_base<{
|
|
44
|
-
lane: string;
|
|
45
|
-
expectedOperationId: string;
|
|
46
|
-
currentOperationId?: string;
|
|
47
|
-
lastOperationId?: string;
|
|
48
|
-
message: string;
|
|
49
|
-
}> {
|
|
50
|
-
}
|
|
51
|
-
declare const NoActiveRun_base: TaggedErrorFactory<"NoActiveRun">;
|
|
52
|
-
export declare class NoActiveRun extends NoActiveRun_base<{
|
|
53
|
-
lane: string;
|
|
54
|
-
message: string;
|
|
55
|
-
}> {
|
|
56
|
-
}
|
|
57
|
-
declare const NoActiveOperation_base: TaggedErrorFactory<"NoActiveOperation">;
|
|
58
|
-
export declare class NoActiveOperation extends NoActiveOperation_base<{
|
|
59
|
-
lane: string;
|
|
60
|
-
message: string;
|
|
61
|
-
}> {
|
|
62
|
-
}
|
|
63
|
-
declare const NothingToResume_base: TaggedErrorFactory<"NothingToResume">;
|
|
64
|
-
export declare class NothingToResume extends NothingToResume_base<{
|
|
65
|
-
lane: string;
|
|
66
|
-
message: string;
|
|
67
|
-
}> {
|
|
68
|
-
}
|
|
69
|
-
declare const NothingToCompact_base: TaggedErrorFactory<"NothingToCompact">;
|
|
70
|
-
export declare class NothingToCompact extends NothingToCompact_base<{
|
|
71
|
-
lane: string;
|
|
72
|
-
message: string;
|
|
73
|
-
}> {
|
|
74
|
-
}
|
|
75
|
-
declare const InvalidMessage_base: TaggedErrorFactory<"InvalidMessage">;
|
|
76
|
-
export declare class InvalidMessage extends InvalidMessage_base<{
|
|
77
|
-
lane: string;
|
|
78
|
-
reason: string;
|
|
79
|
-
message: string;
|
|
80
|
-
}> {
|
|
81
|
-
}
|
|
82
|
-
declare const InvalidNavigation_base: TaggedErrorFactory<"InvalidNavigation">;
|
|
83
|
-
export declare class InvalidNavigation extends InvalidNavigation_base<{
|
|
84
|
-
lane: string;
|
|
85
|
-
reason: string;
|
|
86
|
-
message: string;
|
|
87
|
-
}> {
|
|
88
|
-
}
|
|
89
|
-
declare const UnknownSkill_base: TaggedErrorFactory<"UnknownSkill">;
|
|
90
|
-
export declare class UnknownSkill extends UnknownSkill_base<{
|
|
91
|
-
name: string;
|
|
92
|
-
message: string;
|
|
93
|
-
}> {
|
|
94
|
-
}
|
|
95
|
-
declare const UnknownTemplate_base: TaggedErrorFactory<"UnknownTemplate">;
|
|
96
|
-
export declare class UnknownTemplate extends UnknownTemplate_base<{
|
|
97
|
-
name: string;
|
|
98
|
-
message: string;
|
|
99
|
-
}> {
|
|
100
|
-
}
|
|
101
|
-
declare const UnknownTarget_base: TaggedErrorFactory<"UnknownTarget">;
|
|
102
|
-
export declare class UnknownTarget extends UnknownTarget_base<{
|
|
103
|
-
targetId: string;
|
|
104
|
-
message: string;
|
|
105
|
-
}> {
|
|
106
|
-
}
|
|
107
|
-
declare const InvalidLane_base: TaggedErrorFactory<"InvalidLane">;
|
|
108
|
-
export declare class InvalidLane extends InvalidLane_base<{
|
|
109
|
-
lane: string;
|
|
110
|
-
reason: string;
|
|
111
|
-
message: string;
|
|
112
|
-
}> {
|
|
113
|
-
}
|
|
114
|
-
declare const Closed_base: TaggedErrorFactory<"Closed">;
|
|
115
|
-
export declare class Closed extends Closed_base<{
|
|
116
|
-
message: string;
|
|
117
|
-
}> {
|
|
118
|
-
}
|
|
119
|
-
export declare class HarnessFault extends Error {
|
|
120
|
-
readonly cause: unknown;
|
|
121
|
-
constructor(message: string, cause: unknown);
|
|
122
|
-
}
|
|
123
|
-
export declare class HarnessClosed extends Error {
|
|
124
|
-
constructor();
|
|
125
|
-
}
|
|
126
34
|
export type ErrorMatchers<TError extends TaggedErrorValue<string>, TValue> = {
|
|
127
35
|
[Tag in TError["_tag"]]: (error: Extract<TError, {
|
|
128
36
|
_tag: Tag;
|
|
129
37
|
}>) => TValue;
|
|
130
38
|
};
|
|
131
39
|
export declare function matchError<TError extends TaggedErrorValue<string>, TValue>(error: TError, matchers: ErrorMatchers<TError, TValue>): TValue;
|
|
132
|
-
export {};
|
|
133
40
|
//# sourceMappingURL=result.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/harness/result.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhG,eAAO,MAAM,MAA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I,gBAAgB,CAAC,GAAG,CAAC,CAAC;CACnD;AAED,wBAAgB,WAAW,CAAC,GAAG,SAAS,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAuBjF;AAED,MAAM,MAAM,aAAa,CAAC,MAAM,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,IAAI;KAC3E,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,GAAG,CAAA;KAAE,CAAC,KAAK,MAAM;CAC1E,CAAC;AAEF,wBAAgB,UAAU,CAAC,MAAM,SAAS,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EACzE,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,MAAM,CAGR"}
|
package/dist/harness/result.js
CHANGED
|
@@ -34,45 +34,6 @@ export function TaggedError(tag) {
|
|
|
34
34
|
}
|
|
35
35
|
return TaggedErrorClass;
|
|
36
36
|
}
|
|
37
|
-
export class LaneBusy extends TaggedError("LaneBusy") {
|
|
38
|
-
}
|
|
39
|
-
export class OperationMismatch extends TaggedError("OperationMismatch") {
|
|
40
|
-
}
|
|
41
|
-
export class NoActiveRun extends TaggedError("NoActiveRun") {
|
|
42
|
-
}
|
|
43
|
-
export class NoActiveOperation extends TaggedError("NoActiveOperation") {
|
|
44
|
-
}
|
|
45
|
-
export class NothingToResume extends TaggedError("NothingToResume") {
|
|
46
|
-
}
|
|
47
|
-
export class NothingToCompact extends TaggedError("NothingToCompact") {
|
|
48
|
-
}
|
|
49
|
-
export class InvalidMessage extends TaggedError("InvalidMessage") {
|
|
50
|
-
}
|
|
51
|
-
export class InvalidNavigation extends TaggedError("InvalidNavigation") {
|
|
52
|
-
}
|
|
53
|
-
export class UnknownSkill extends TaggedError("UnknownSkill") {
|
|
54
|
-
}
|
|
55
|
-
export class UnknownTemplate extends TaggedError("UnknownTemplate") {
|
|
56
|
-
}
|
|
57
|
-
export class UnknownTarget extends TaggedError("UnknownTarget") {
|
|
58
|
-
}
|
|
59
|
-
export class InvalidLane extends TaggedError("InvalidLane") {
|
|
60
|
-
}
|
|
61
|
-
export class Closed extends TaggedError("Closed") {
|
|
62
|
-
}
|
|
63
|
-
export class HarnessFault extends Error {
|
|
64
|
-
constructor(message, cause) {
|
|
65
|
-
super(message);
|
|
66
|
-
this.name = "HarnessFault";
|
|
67
|
-
this.cause = cause;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
export class HarnessClosed extends Error {
|
|
71
|
-
constructor() {
|
|
72
|
-
super("AgentHarness was closed while the operation was active");
|
|
73
|
-
this.name = "HarnessClosed";
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
37
|
export function matchError(error, matchers) {
|
|
77
38
|
const matcher = matchers[error._tag];
|
|
78
39
|
return matcher(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/harness/result.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAAG;IACrB,EAAE,CAAS,KAAa;QACvB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IACD,GAAG,CAAS,KAAa;QACxB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IACD,IAAI,CAAiB,MAA8B;QAClD,OAAO,MAAM,CAAC,EAAE,CAAC;IAClB,CAAC;IACD,KAAK,CAAiB,MAA8B;QACnD,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IACnB,CAAC;CACD,CAAC;AAYF,MAAM,UAAU,WAAW,CAAqB,GAAQ;IACvD,MAAM,gBAAiB,SAAQ,KAAK;QAGnC,YAAY,KAAoD;YAC/D,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAHb,SAAI,GA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I,GAAG,GAAG,CAAC;YAInB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;YAChB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC;QAED,MAAM;YACL,MAAM,OAAO,GAA4B,EAAE,CAAC;YAC5C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrC,IAAI,GAAG,KAAK,MAAM;oBAAE,OAAO,CAAC,GAAG,CAAC,GAAI,IAA2C,CAAC,GAAG,CAAC,CAAC;YACtF,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;QACzD,CAAC;QAED,MAAM,CAAC,EAAE,CAAC,KAAc;YACvB,OAAO,KAAK,YAAY,gBAAgB,CAAC;QAC1C,CAAC;KACD;IACD,OAAO,gBAAsD,CAAC;AAC/D,CAAC;AAMD,MAAM,UAAU,UAAU,CACzB,KAAa,EACb,QAAuC;IAEvC,MAAM,OAAO,GAAI,QAAiE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/F,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","sourcesContent":["export type Result<TValue, TError> = { ok: true; value: TValue } | { ok: false; error: TError };\n\nexport const Result = {\n\tok<TValue>(value: TValue): Result<TValue, never> {\n\t\treturn { ok: true, value };\n\t},\n\terr<TError>(error: TError): Result<never, TError> {\n\t\treturn { ok: false, error };\n\t},\n\tisOk<TValue, TError>(result: Result<TValue, TError>): result is { ok: true; value: TValue } {\n\t\treturn result.ok;\n\t},\n\tisErr<TValue, TError>(result: Result<TValue, TError>): result is { ok: false; error: TError } {\n\t\treturn !result.ok;\n\t},\n};\n\nexport interface TaggedErrorValue<Tag extends string> extends Error {\n\treadonly _tag: Tag;\n\ttoJSON(): { _tag: Tag; message: string } & Record<string, unknown>;\n}\n\nexport interface TaggedErrorFactory<Tag extends string> {\n\tnew <Props extends { message: string }>(props: Props): TaggedErrorValue<Tag> & Readonly<Props>;\n\tis(value: unknown): value is TaggedErrorValue<Tag>;\n}\n\nexport function TaggedError<Tag extends string>(tag: Tag): TaggedErrorFactory<Tag> {\n\tclass TaggedErrorClass extends Error {\n\t\treadonly _tag = tag;\n\n\t\tconstructor(props: { message: string } & Record<string, unknown>) {\n\t\t\tsuper(props.message);\n\t\t\tthis.name = tag;\n\t\t\tObject.assign(this, props);\n\t\t}\n\n\t\ttoJSON(): { _tag: Tag; message: string } & Record<string, unknown> {\n\t\t\tconst payload: Record<string, unknown> = {};\n\t\t\tfor (const key of Object.keys(this)) {\n\t\t\t\tif (key !== \"_tag\") payload[key] = (this as unknown as Record<string, unknown>)[key];\n\t\t\t}\n\t\t\treturn { _tag: tag, message: this.message, ...payload };\n\t\t}\n\n\t\tstatic is(value: unknown): value is TaggedErrorValue<Tag> {\n\t\t\treturn value instanceof TaggedErrorClass;\n\t\t}\n\t}\n\treturn TaggedErrorClass as unknown as TaggedErrorFactory<Tag>;\n}\n\nexport type ErrorMatchers<TError extends TaggedErrorValue<string>, TValue> = {\n\t[Tag in TError[\"_tag\"]]: (error: Extract<TError, { _tag: Tag }>) => TValue;\n};\n\nexport function matchError<TError extends TaggedErrorValue<string>, TValue>(\n\terror: TError,\n\tmatchers: ErrorMatchers<TError, TValue>,\n): TValue {\n\tconst matcher = (matchers as unknown as Record<string, (value: TError) => TValue>)[error._tag];\n\treturn matcher(error);\n}\n"]}
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import type { AgentMessage } from "../../types.ts";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { ConfigurationUpdateEntry, CustomEntry, Entry } from "./types.ts";
|
|
3
|
+
export interface SessionContext {
|
|
4
|
+
messages: AgentMessage[];
|
|
5
|
+
thinkingLevel: string;
|
|
6
|
+
configurationUpdate: ConfigurationUpdateEntry["reasoning"] | null;
|
|
7
|
+
model: {
|
|
8
|
+
provider: string;
|
|
9
|
+
modelId: string;
|
|
10
|
+
} | null;
|
|
11
|
+
activeToolNames: string[] | null;
|
|
12
|
+
}
|
|
13
|
+
export type ContextEntryTransform = (entries: readonly Entry[]) => readonly Entry[];
|
|
14
|
+
export type CustomEntryContextMessageProjector = (entry: CustomEntry, index: number, entries: readonly Entry[]) => readonly AgentMessage[] | undefined;
|
|
4
15
|
export interface SessionContextBuildOptions {
|
|
5
|
-
|
|
16
|
+
entryTransforms?: readonly ContextEntryTransform[];
|
|
17
|
+
entryProjectors?: Readonly<Record<string, CustomEntryContextMessageProjector>>;
|
|
6
18
|
}
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
19
|
+
export declare function defaultContextEntryTransform(pathEntries: readonly Entry[]): Entry[];
|
|
20
|
+
export declare function buildContextEntries(pathEntries: readonly Entry[], options?: SessionContextBuildOptions): Entry[];
|
|
21
|
+
export declare function sessionEntryToContextMessages(entry: Entry, index: number, entries: readonly Entry[], options?: SessionContextBuildOptions): AgentMessage[];
|
|
22
|
+
export declare function buildSessionContext(pathEntries: readonly Entry[], options?: SessionContextBuildOptions): SessionContext;
|
|
10
23
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/harness/session/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/harness/session/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,KAAK,EAAmB,wBAAwB,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEhG,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,aAAa,EA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
+
function deriveSessionContextState(pathEntries) {
|
|
3
|
+
let thinkingLevel = "off";
|
|
4
|
+
let configurationUpdate = null;
|
|
5
|
+
let model = null;
|
|
6
|
+
let activeToolNames = null;
|
|
7
|
+
for (const entry of pathEntries) {
|
|
8
|
+
if (entry.type === "thinking_level_change") {
|
|
9
|
+
thinkingLevel = entry.thinkingLevel;
|
|
10
|
+
}
|
|
11
|
+
else if (entry.type === "configuration_update") {
|
|
12
|
+
configurationUpdate = { ...entry.reasoning };
|
|
13
|
+
}
|
|
14
|
+
else if (entry.type === "model_change") {
|
|
15
|
+
model = { provider: entry.provider, modelId: entry.modelId };
|
|
16
|
+
}
|
|
17
|
+
else if (entry.type === "message" && entry.message.role === "assistant") {
|
|
18
|
+
model = { provider: entry.message.provider, modelId: entry.message.model };
|
|
19
|
+
}
|
|
20
|
+
else if (entry.type === "active_tools_change") {
|
|
21
|
+
activeToolNames = [...entry.activeToolNames];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return { thinkingLevel, configurationUpdate, model, activeToolNames };
|
|
25
|
+
}
|
|
26
|
+
export function defaultContextEntryTransform(pathEntries) {
|
|
3
27
|
let compaction;
|
|
4
28
|
let compactionIndex = -1;
|
|
5
29
|
for (let index = pathEntries.length - 1; index >= 0; index--) {
|
|
6
30
|
const entry = pathEntries[index];
|
|
7
|
-
if (entry
|
|
31
|
+
if (entry.type === "compaction") {
|
|
8
32
|
compaction = entry;
|
|
9
33
|
compactionIndex = index;
|
|
10
34
|
break;
|
|
@@ -12,38 +36,36 @@ export function buildContextEntries(pathEntries) {
|
|
|
12
36
|
}
|
|
13
37
|
return compaction === undefined ? [...pathEntries] : [compaction, ...pathEntries.slice(compactionIndex + 1)];
|
|
14
38
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
39
|
+
export function buildContextEntries(pathEntries, options = {}) {
|
|
40
|
+
let entries = defaultContextEntryTransform(pathEntries);
|
|
41
|
+
for (const transform of options.entryTransforms ?? [])
|
|
42
|
+
entries = [...transform(entries)];
|
|
43
|
+
return entries;
|
|
18
44
|
}
|
|
19
|
-
export function sessionEntryToContextMessages(entry) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return isContextMessage(entry.message) ? [entry.message] : [];
|
|
23
|
-
case "compaction":
|
|
24
|
-
return [
|
|
25
|
-
createCompactionSummaryMessage(entry.summary, entry.tokensBefore, entry.timestamp),
|
|
26
|
-
...entry.retainedTail.filter(isContextMessage),
|
|
27
|
-
];
|
|
28
|
-
case "branch_summary":
|
|
29
|
-
return entry.summary ? [createBranchSummaryMessage(entry.summary, entry.fromId, entry.timestamp)] : [];
|
|
30
|
-
case "custom":
|
|
45
|
+
export function sessionEntryToContextMessages(entry, index, entries, options = {}) {
|
|
46
|
+
if (entry.type === "message") {
|
|
47
|
+
if (entry.message.role === "assistant" && entry.message.stopReason === "deferred")
|
|
31
48
|
return [];
|
|
49
|
+
return [entry.message];
|
|
32
50
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
for (const entry of entries) {
|
|
39
|
-
if (entry.type !== "custom") {
|
|
40
|
-
messages.push(...sessionEntryToContextMessages(entry));
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const projector = options.entryProjectors?.[entry.customType];
|
|
44
|
-
if (projector !== undefined)
|
|
45
|
-
messages.push(...((await projector(entry, context)) ?? []));
|
|
51
|
+
if (entry.type === "compaction") {
|
|
52
|
+
return [
|
|
53
|
+
createCompactionSummaryMessage(entry.summary, entry.tokensBefore, entry.timestamp),
|
|
54
|
+
...entry.retainedTail,
|
|
55
|
+
];
|
|
46
56
|
}
|
|
47
|
-
|
|
57
|
+
if (entry.type === "branch_summary" && entry.summary) {
|
|
58
|
+
return [createBranchSummaryMessage(entry.summary, entry.fromId, entry.timestamp)];
|
|
59
|
+
}
|
|
60
|
+
if (entry.type === "custom") {
|
|
61
|
+
return [...(options.entryProjectors?.[entry.customType]?.(entry, index, entries) ?? [])];
|
|
62
|
+
}
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
export function buildSessionContext(pathEntries, options = {}) {
|
|
66
|
+
const state = deriveSessionContextState(pathEntries);
|
|
67
|
+
const contextEntries = buildContextEntries(pathEntries, options);
|
|
68
|
+
const messages = contextEntries.flatMap((entry, index) => sessionEntryToContextMessages(entry, index, contextEntries, options));
|
|
69
|
+
return { ...state, messages };
|
|
48
70
|
}
|
|
49
71
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/harness/session/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/harness/session/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAwB5F,SAAS,yBAAyB,CAAC,WAA6B;IAC/D,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,IAAI,mBAAmB,GAAiD,IAAI,CAAC;IAC7E,IAAI,KAAK,GAAiD,IAAI,CAAC;IAC/D,IAAI,eAAe,GAAoB,IAAI,CAAC;IAE5C,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;QACjC,IAAI,KAAK,CAAC,IAAI,KAAK,uBAAuB,EAAE,CAAC;YAC5C,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;QACrC,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,sBAAsB,EAAE,CAAC;YAClD,mBAAmB,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC1C,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAC9D,CAAC;aAAM,IAAI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B,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CACxD,6BAA6B,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,CACpE,CAAC;IACF,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["import type { AgentMessage } from \"../../types.ts\";\nimport { createBranchSummaryMessage, createCompactionSummaryMessage } from \"../messages.ts\";\nimport type { CompactionEntry, ConfigurationUpdateEntry, CustomEntry, Entry } from \"./types.ts\";\n\nexport interface SessionContext {\n\tmessages: AgentMessage[];\n\tthinkingLevel: string;\n\tconfigurationUpdate: ConfigurationUpdateEntry[\"reasoning\"] | null;\n\tmodel: { provider: string; modelId: string } | null;\n\tactiveToolNames: string[] | null;\n}\n\nexport type ContextEntryTransform = (entries: readonly Entry[]) => readonly Entry[];\n\nexport type CustomEntryContextMessageProjector = (\n\tentry: CustomEntry,\n\tindex: number,\n\tentries: readonly Entry[],\n) => readonly AgentMessage[] | undefined;\n\nexport interface SessionContextBuildOptions {\n\tentryTransforms?: readonly ContextEntryTransform[];\n\tentryProjectors?: Readonly<Record<string, CustomEntryContextMessageProjector>>;\n}\n\nfunction deriveSessionContextState(pathEntries: readonly Entry[]): Omit<SessionContext, \"messages\"> {\n\tlet thinkingLevel = \"off\";\n\tlet configurationUpdate: ConfigurationUpdateEntry[\"reasoning\"] | null = null;\n\tlet model: { provider: string; modelId: string } | null = null;\n\tlet activeToolNames: string[] | null = null;\n\n\tfor (const entry of pathEntries) {\n\t\tif (entry.type === \"thinking_level_change\") {\n\t\t\tthinkingLevel = entry.thinkingLevel;\n\t\t} else if (entry.type === \"configuration_update\") {\n\t\t\tconfigurationUpdate = { ...entry.reasoning };\n\t\t} else if (entry.type === \"model_change\") {\n\t\t\tmodel = { provider: entry.provider, modelId: entry.modelId };\n\t\t} else if (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\tmodel = { provider: entry.message.provider, modelId: entry.message.model };\n\t\t} else if (entry.type === \"active_tools_change\") {\n\t\t\tactiveToolNames = [...entry.activeToolNames];\n\t\t}\n\t}\n\n\treturn { thinkingLevel, configurationUpdate, model, activeToolNames };\n}\n\nexport function defaultContextEntryTransform(pathEntries: readonly Entry[]): Entry[] {\n\tlet compaction: CompactionEntry | undefined;\n\tlet compactionIndex = -1;\n\tfor (let index = pathEntries.length - 1; index >= 0; index--) {\n\t\tconst entry = pathEntries[index]!;\n\t\tif (entry.type === \"compaction\") {\n\t\t\tcompaction = entry;\n\t\t\tcompactionIndex = index;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn compaction === undefined ? [...pathEntries] : [compaction, ...pathEntries.slice(compactionIndex + 1)];\n}\n\nexport function buildContextEntries(pathEntries: readonly Entry[], options: SessionContextBuildOptions = {}): Entry[] {\n\tlet entries = defaultContextEntryTransform(pathEntries);\n\tfor (const transform of options.entryTransforms ?? []) entries = [...transform(entries)];\n\treturn entries;\n}\n\nexport function sessionEntryToContextMessages(\n\tentry: Entry,\n\tindex: number,\n\tentries: readonly Entry[],\n\toptions: SessionContextBuildOptions = {},\n): AgentMessage[] {\n\tif (entry.type === \"message\") {\n\t\tif (entry.message.role === \"assistant\" && entry.message.stopReason === \"deferred\") return [];\n\t\treturn [entry.message];\n\t}\n\tif (entry.type === \"compaction\") {\n\t\treturn [\n\t\t\tcreateCompactionSummaryMessage(entry.summary, entry.tokensBefore, entry.timestamp),\n\t\t\t...entry.retainedTail,\n\t\t];\n\t}\n\tif (entry.type === \"branch_summary\" && entry.summary) {\n\t\treturn [createBranchSummaryMessage(entry.summary, entry.fromId, entry.timestamp)];\n\t}\n\tif (entry.type === \"custom\") {\n\t\treturn [...(options.entryProjectors?.[entry.customType]?.(entry, index, entries) ?? [])];\n\t}\n\treturn [];\n}\n\nexport function buildSessionContext(\n\tpathEntries: readonly Entry[],\n\toptions: SessionContextBuildOptions = {},\n): SessionContext {\n\tconst state = deriveSessionContextState(pathEntries);\n\tconst contextEntries = buildContextEntries(pathEntries, options);\n\tconst messages = contextEntries.flatMap((entry, index) =>\n\t\tsessionEntryToContextMessages(entry, index, contextEntries, options),\n\t);\n\treturn { ...state, messages };\n}\n"]}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export type { MemorySessionRepoOptions } from "./memory.ts";
|
|
7
|
-
export { MemorySessionRepo } from "./memory.ts";
|
|
8
|
-
export { SessionBranchExistsError, SessionInvalidBranchError, SessionInvariantError, SessionPendingAssistantMessageError, SessionUnknownTargetError, StorageBackedSession, type StorageBackedSessionOptions, } from "./session.ts";
|
|
1
|
+
export * from "./context.ts";
|
|
2
|
+
export type { JsonlSessionCreateOptions, JsonlSessionListOptions, JsonlSessionMetadata, JsonlSessionRepoFileSystem, JsonlSessionRepoOptions, JsonlV4Header, } from "./jsonl.ts";
|
|
3
|
+
export { JsonlSessionRepo } from "./jsonl.ts";
|
|
4
|
+
export * from "./memory.ts";
|
|
5
|
+
export * from "./session.ts";
|
|
9
6
|
export * from "./types.ts";
|
|
10
|
-
export * from "./values.ts";
|
|
11
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/harness/session/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/harness/session/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,YAAY,EACX,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export { MemorySessionRepo } from "./memory.js";
|
|
6
|
-
export { SessionBranchExistsError, SessionInvalidBranchError, SessionInvariantError, SessionPendingAssistantMessageError, SessionUnknownTargetError, StorageBackedSession, } from "./session.js";
|
|
1
|
+
export * from "./context.js";
|
|
2
|
+
export { JsonlSessionRepo } from "./jsonl.js";
|
|
3
|
+
export * from "./memory.js";
|
|
4
|
+
export * from "./session.js";
|
|
7
5
|
export * from "./types.js";
|
|
8
|
-
export * from "./values.js";
|
|
9
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/harness/session/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/harness/session/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAS7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC","sourcesContent":["export * from \"./context.ts\";\nexport type {\n\tJsonlSessionCreateOptions,\n\tJsonlSessionListOptions,\n\tJsonlSessionMetadata,\n\tJsonlSessionRepoFileSystem,\n\tJsonlSessionRepoOptions,\n\tJsonlV4Header,\n} from \"./jsonl.ts\";\nexport { JsonlSessionRepo } from \"./jsonl.ts\";\nexport * from \"./memory.ts\";\nexport * from \"./session.ts\";\nexport * from \"./types.ts\";\n"]}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import { type Result } from "../../types.ts";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
export declare function isLegacyV3SessionHeader(value: unknown): value is LegacyV3SessionHeader;
|
|
12
|
-
export declare function isJsonlStorageHeader(value: unknown): value is JsonlStorageHeader;
|
|
13
|
-
export type JsonlParsedSessionHeader = {
|
|
14
|
-
format: "v4";
|
|
15
|
-
header: JsonlStorageHeader;
|
|
16
|
-
} | {
|
|
17
|
-
format: "v3-legacy";
|
|
18
|
-
header: LegacyV3SessionHeader;
|
|
19
|
-
};
|
|
20
|
-
export declare function parseJsonlSessionHeader(line: string): Result<JsonlParsedSessionHeader, Error>;
|
|
2
|
+
import type { SessionMutation } from "../state.ts";
|
|
3
|
+
import { JsonlDecodeError } from "./errors.ts";
|
|
4
|
+
import type { JsonlSessionMetadata, JsonlV4Header } from "./types.ts";
|
|
5
|
+
export declare function parseHeader(line: string): Result<JsonlV4Header, JsonlDecodeError>;
|
|
6
|
+
export declare function encodeHeader(header: JsonlV4Header): string;
|
|
7
|
+
export declare function metadataFromHeader(header: JsonlV4Header, path: string, modifiedAt: number): JsonlSessionMetadata;
|
|
8
|
+
export declare function parseMutation(line: string): Result<SessionMutation, JsonlDecodeError>;
|
|
9
|
+
export declare function encodeMutation(mutation: SessionMutation): string;
|
|
21
10
|
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../../src/harness/session/jsonl/codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../../src/harness/session/jsonl/codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAkGtE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAOjF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAE1D;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAchH;AA2FD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAOrF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAWhE"}
|