@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
|
@@ -1,352 +1,512 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import "
|
|
3
|
-
import type { AgentMessage } from "../../types.ts";
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { JsonValue } from "@earendil-works/chord";
|
|
2
|
+
import type { AssistantMessage, StopReason, Usage } from "@earendil-works/pi-ai";
|
|
3
|
+
import type { AgentMessage, QueueMode, ThinkingLevel } from "../../types.ts";
|
|
4
|
+
import type { BranchPreparation } from "../compaction/branch-summarization.ts";
|
|
5
|
+
import type { CompactionPreparation, CompactionSettings } from "../compaction/compaction.ts";
|
|
6
|
+
import type { Context } from "../context.ts";
|
|
7
|
+
import type { AgentHarnessStreamOptions } from "../types.ts";
|
|
8
|
+
import type { ListElement, ListReadOptions, ListWrite, StoredValue, Value, ValueList, ValueWrite } from "./values.ts";
|
|
9
|
+
export type { JsonValue } from "@earendil-works/chord";
|
|
10
|
+
export type SettledAssistantMessage = AssistantMessage & {
|
|
11
|
+
stopReason: Exclude<StopReason, "pending">;
|
|
7
12
|
};
|
|
8
|
-
export type
|
|
9
|
-
export interface IdGenerator {
|
|
10
|
-
next(): string;
|
|
11
|
-
}
|
|
13
|
+
export type EntryType = "message" | "compaction" | "branch_summary" | "custom";
|
|
12
14
|
export interface EntryBase {
|
|
13
|
-
type: string;
|
|
14
15
|
id: string;
|
|
15
|
-
seq: number;
|
|
16
16
|
parentId: string | null;
|
|
17
|
+
seq: number;
|
|
17
18
|
timestamp: number;
|
|
19
|
+
type: EntryType;
|
|
20
|
+
customType?: string;
|
|
18
21
|
}
|
|
19
22
|
export interface MessageEntry extends EntryBase {
|
|
20
23
|
type: "message";
|
|
21
24
|
message: AgentMessage;
|
|
22
25
|
terminate?: true;
|
|
23
26
|
}
|
|
24
|
-
export interface ModelChangeEntry extends EntryBase {
|
|
25
|
-
type: "model_change";
|
|
26
|
-
provider: string;
|
|
27
|
-
modelId: string;
|
|
28
|
-
}
|
|
29
|
-
export interface ThinkingLevelEntry extends EntryBase {
|
|
30
|
-
type: "thinking_level_change";
|
|
31
|
-
thinkingLevel: string;
|
|
32
|
-
}
|
|
33
|
-
export interface ConfigurationUpdateEntry extends EntryBase {
|
|
34
|
-
type: "configuration_update";
|
|
35
|
-
reasoning: {
|
|
36
|
-
effort: string;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export interface ActiveToolsEntry extends EntryBase {
|
|
40
|
-
type: "active_tools_change";
|
|
41
|
-
activeToolNames: string[];
|
|
42
|
-
}
|
|
43
27
|
export interface CompactionEntry extends EntryBase {
|
|
44
28
|
type: "compaction";
|
|
45
29
|
summary: string;
|
|
46
30
|
retainedTail: AgentMessage[];
|
|
47
31
|
tokensBefore: number;
|
|
48
|
-
details?:
|
|
32
|
+
details?: JsonValue;
|
|
49
33
|
usage?: Usage;
|
|
34
|
+
fromHook: boolean;
|
|
50
35
|
}
|
|
51
36
|
export interface BranchSummaryEntry extends EntryBase {
|
|
52
37
|
type: "branch_summary";
|
|
53
|
-
fromId: string;
|
|
38
|
+
fromId: string | null;
|
|
54
39
|
summary: string;
|
|
55
|
-
details?:
|
|
40
|
+
details?: JsonValue;
|
|
56
41
|
usage?: Usage;
|
|
42
|
+
fromHook: boolean;
|
|
57
43
|
}
|
|
58
44
|
export interface CustomEntry extends EntryBase {
|
|
59
45
|
type: "custom";
|
|
60
46
|
customType: string;
|
|
61
|
-
data?:
|
|
47
|
+
data?: JsonValue;
|
|
62
48
|
}
|
|
63
|
-
|
|
64
|
-
export type
|
|
65
|
-
export
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
49
|
+
/** Convert an application-defined custom entry into model context. */
|
|
50
|
+
export type EntryProjector = (entry: CustomEntry, context: Context) => AgentMessage[] | undefined | Promise<AgentMessage[] | undefined>;
|
|
51
|
+
export type Entry = MessageEntry | CompactionEntry | BranchSummaryEntry | CustomEntry;
|
|
52
|
+
/** Entry supplied to a transaction before storage assigns sequence and timestamp. */
|
|
53
|
+
export type NewEntry<TEntry extends Entry = Entry> = TEntry extends Entry ? Omit<TEntry, "seq" | "timestamp"> : never;
|
|
54
|
+
export interface LaneConfiguration {
|
|
55
|
+
model: {
|
|
56
|
+
provider: string;
|
|
57
|
+
modelId: string;
|
|
58
|
+
};
|
|
59
|
+
thinkingLevel: ThinkingLevel;
|
|
60
|
+
activeToolNames: string[];
|
|
70
61
|
}
|
|
71
|
-
export interface
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
export interface OperationMeta {
|
|
63
|
+
operationId: string;
|
|
64
|
+
lane: string;
|
|
65
|
+
sourceTipId: string | null;
|
|
66
|
+
startedAt: number;
|
|
74
67
|
intent: {
|
|
75
68
|
kind: "run";
|
|
76
|
-
|
|
77
|
-
originalPrompt: AgentMessage[];
|
|
78
|
-
/** Captured nextRun items, then the prompt, then before_run injections. */
|
|
79
|
-
initialMessages: ProvisionedEntry[];
|
|
80
|
-
systemPromptOverride?: string;
|
|
81
|
-
resumeData?: {
|
|
82
|
-
[extensionId: string]: JsonValue;
|
|
83
|
-
};
|
|
69
|
+
promptEntryIds: string[];
|
|
84
70
|
} | {
|
|
85
71
|
kind: "compaction";
|
|
86
72
|
customInstructions?: string;
|
|
87
|
-
resultEntryId: string;
|
|
88
73
|
} | {
|
|
89
74
|
kind: "navigation";
|
|
90
75
|
targetId: string | null;
|
|
91
76
|
summarize: boolean;
|
|
92
|
-
customInstructions?: string;
|
|
93
77
|
label?: string;
|
|
94
|
-
|
|
78
|
+
customInstructions?: string;
|
|
95
79
|
};
|
|
96
80
|
}
|
|
97
|
-
export
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
message: string;
|
|
108
|
-
};
|
|
81
|
+
export type Control = {
|
|
82
|
+
status: "running";
|
|
83
|
+
} | {
|
|
84
|
+
status: "cancel_requested";
|
|
85
|
+
requestedAt: number;
|
|
86
|
+
};
|
|
87
|
+
export interface OperationError {
|
|
88
|
+
code: string;
|
|
89
|
+
message: string;
|
|
90
|
+
details?: JsonValue;
|
|
109
91
|
}
|
|
110
|
-
export type
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
92
|
+
export type TerminalStatus = "completed" | "declined" | "aborted" | "failed";
|
|
93
|
+
/** Immutable lane-lived observation record written by one terminal transaction. */
|
|
94
|
+
export interface OperationResultRecord {
|
|
95
|
+
operationId: string;
|
|
96
|
+
kind: OperationMeta["intent"]["kind"];
|
|
97
|
+
status: TerminalStatus;
|
|
98
|
+
error?: OperationError;
|
|
99
|
+
fromTipId: string | null;
|
|
100
|
+
tipId: string | null;
|
|
101
|
+
startedAt: number;
|
|
102
|
+
endedAt: number;
|
|
103
|
+
}
|
|
104
|
+
export type Continuation = {
|
|
105
|
+
kind: "need_assistant";
|
|
106
|
+
overflowRecoveryUsed: boolean;
|
|
118
107
|
} | {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
108
|
+
kind: "may_finish";
|
|
109
|
+
includeFinalAssistant: boolean;
|
|
110
|
+
};
|
|
111
|
+
/** Checkpoint payload; the flat leaf literal replaces the old nested phase tag. */
|
|
112
|
+
export interface CheckpointData {
|
|
113
|
+
continuation: Continuation;
|
|
114
|
+
triggerEntryId: string;
|
|
115
|
+
}
|
|
116
|
+
export type InboxItemKind = "steer" | "followUp" | "nextRun" | "write";
|
|
117
|
+
export interface InboxItem {
|
|
118
|
+
entryId: string;
|
|
119
|
+
kind: InboxItemKind;
|
|
120
|
+
}
|
|
121
|
+
export interface NormalizedRetryPolicy {
|
|
122
|
+
maxAttempts: number;
|
|
123
|
+
baseDelayMs: number;
|
|
124
|
+
maxAgentDelayMs: number;
|
|
125
|
+
}
|
|
126
|
+
export interface GenerationContext {
|
|
127
|
+
stepId: string;
|
|
128
|
+
triggerEntryId: string;
|
|
129
|
+
configuration: LaneConfiguration;
|
|
130
|
+
streamOptions: AgentHarnessStreamOptions;
|
|
131
|
+
retryPolicy: NormalizedRetryPolicy;
|
|
132
|
+
overflowRecoveryUsed: boolean;
|
|
133
|
+
}
|
|
134
|
+
interface ToolCallSource {
|
|
135
|
+
/** Zero-based index in the assistant message's complete content array, not a filtered tool-call ordinal. */
|
|
136
|
+
sourceIndex: number;
|
|
123
137
|
resultEntryId: string;
|
|
124
|
-
|
|
125
|
-
|
|
138
|
+
}
|
|
139
|
+
export type ToolCall = ToolCallSource & ({
|
|
140
|
+
status: "planned";
|
|
141
|
+
} | {
|
|
142
|
+
status: "effect_pending";
|
|
143
|
+
replay: "never" | "safe";
|
|
144
|
+
} | {
|
|
145
|
+
status: "outcome_ready";
|
|
146
|
+
terminate: boolean;
|
|
147
|
+
} | {
|
|
148
|
+
status: "completed";
|
|
149
|
+
terminate: boolean;
|
|
126
150
|
});
|
|
127
|
-
export interface
|
|
128
|
-
type: "tool_started";
|
|
129
|
-
runId: string;
|
|
151
|
+
export interface ToolBatch {
|
|
130
152
|
assistantEntryId: string;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
};
|
|
153
|
+
configuration: LaneConfiguration;
|
|
154
|
+
turnId: string;
|
|
155
|
+
calls: ToolCall[];
|
|
156
|
+
}
|
|
157
|
+
export interface SummaryContext {
|
|
137
158
|
resultEntryId: string;
|
|
138
|
-
|
|
159
|
+
configuration: LaneConfiguration;
|
|
160
|
+
streamOptions: AgentHarnessStreamOptions;
|
|
161
|
+
retryPolicy: NormalizedRetryPolicy;
|
|
162
|
+
}
|
|
163
|
+
export interface Cancellable {
|
|
164
|
+
control: Control;
|
|
165
|
+
}
|
|
166
|
+
export interface RunSettings {
|
|
167
|
+
compaction: CompactionSettings;
|
|
168
|
+
steeringMode: QueueMode;
|
|
169
|
+
followUpMode: QueueMode;
|
|
170
|
+
toolExecution: "sequential" | "parallel";
|
|
171
|
+
}
|
|
172
|
+
/** Uniform scope carried by every operation leaf. */
|
|
173
|
+
export interface OperationScope extends Cancellable {
|
|
174
|
+
settings: RunSettings;
|
|
175
|
+
latestAssistantEntryId: string | null;
|
|
176
|
+
}
|
|
177
|
+
/** Shared backoff data for every retry-wait leaf. */
|
|
178
|
+
export interface RetryWait {
|
|
179
|
+
nextAttempt: number;
|
|
180
|
+
notBefore: number;
|
|
181
|
+
errorMessage: string;
|
|
182
|
+
}
|
|
183
|
+
export interface AssistantGenerationScope {
|
|
184
|
+
generationContext: GenerationContext;
|
|
139
185
|
}
|
|
140
|
-
export type
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
runId: string;
|
|
144
|
-
target: ProvisionedEntry;
|
|
186
|
+
export type ResultBoundary = {
|
|
187
|
+
kind: "resume_checkpoint";
|
|
188
|
+
resumeAfter: CheckpointData;
|
|
145
189
|
} | {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
190
|
+
kind: "finish";
|
|
191
|
+
} | {
|
|
192
|
+
kind: "commit_navigation";
|
|
193
|
+
targetId: string;
|
|
194
|
+
label?: string;
|
|
195
|
+
};
|
|
196
|
+
export interface SummaryTask {
|
|
197
|
+
taskId: string;
|
|
198
|
+
reason?: "manual" | "threshold" | "overflow";
|
|
199
|
+
customInstructions?: string;
|
|
200
|
+
boundary: ResultBoundary;
|
|
155
201
|
}
|
|
156
|
-
export interface
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
target: ProvisionedEntry;
|
|
202
|
+
export interface SummaryGenerationScope {
|
|
203
|
+
task: SummaryTask;
|
|
204
|
+
summaryContext: SummaryContext;
|
|
160
205
|
}
|
|
161
|
-
export
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
cause: "assistant" | "compaction" | "branch_summary" | "deferred_fetch";
|
|
166
|
-
runId: string;
|
|
167
|
-
entryId: string;
|
|
206
|
+
export interface SummaryGenerationReady extends SummaryGenerationScope {
|
|
207
|
+
nextAttempt: number;
|
|
208
|
+
}
|
|
209
|
+
export interface SummaryGenerationEffectPending extends SummaryGenerationScope {
|
|
168
210
|
attempt: number;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
211
|
+
request?: {
|
|
212
|
+
index: number;
|
|
213
|
+
usageId: string;
|
|
214
|
+
};
|
|
215
|
+
usageIds: string[];
|
|
216
|
+
}
|
|
217
|
+
export interface SummaryGenerationRetryWait extends SummaryGenerationScope, RetryWait {
|
|
218
|
+
}
|
|
219
|
+
export interface DeferredScope extends OperationScope {
|
|
220
|
+
stepId: string;
|
|
221
|
+
sourceEntryId: string;
|
|
222
|
+
poll: number;
|
|
223
|
+
configuration: LaneConfiguration;
|
|
224
|
+
streamOptions: AgentHarnessStreamOptions;
|
|
225
|
+
}
|
|
226
|
+
export interface StartingOperation extends OperationScope {
|
|
227
|
+
at: "starting";
|
|
228
|
+
}
|
|
229
|
+
export interface CheckpointOperation extends OperationScope, CheckpointData {
|
|
230
|
+
at: "checkpoint";
|
|
231
|
+
}
|
|
232
|
+
export interface AssistantReadyOperation extends OperationScope, AssistantGenerationScope {
|
|
233
|
+
at: "assistant.ready";
|
|
234
|
+
nextAttempt: number;
|
|
235
|
+
}
|
|
236
|
+
export interface AssistantEffectPendingOperation extends OperationScope, AssistantGenerationScope {
|
|
237
|
+
at: "assistant.effect_pending";
|
|
238
|
+
attempt: number;
|
|
239
|
+
responseEntryId: string;
|
|
240
|
+
usageId: string;
|
|
241
|
+
intendedOutputLimit: number;
|
|
242
|
+
contextWindow: number;
|
|
243
|
+
}
|
|
244
|
+
export interface AssistantRetryWaitOperation extends OperationScope, AssistantGenerationScope, RetryWait {
|
|
245
|
+
at: "assistant.retry_wait";
|
|
246
|
+
}
|
|
247
|
+
export interface ToolsOperation extends OperationScope {
|
|
248
|
+
at: "tools";
|
|
249
|
+
batch: ToolBatch;
|
|
250
|
+
}
|
|
251
|
+
export interface DeferredSuspendedOperation extends DeferredScope {
|
|
252
|
+
at: "deferred.suspended";
|
|
253
|
+
}
|
|
254
|
+
export interface DeferredEffectPendingOperation extends DeferredScope {
|
|
255
|
+
at: "deferred.effect_pending";
|
|
256
|
+
responseEntryId: string;
|
|
257
|
+
usageId: string;
|
|
258
|
+
}
|
|
259
|
+
export interface SummaryDecidingOperation extends OperationScope {
|
|
260
|
+
at: "summary.deciding";
|
|
261
|
+
task: SummaryTask;
|
|
262
|
+
}
|
|
263
|
+
export interface SummaryReadyOperation extends OperationScope, SummaryGenerationReady {
|
|
264
|
+
at: "summary.ready";
|
|
265
|
+
}
|
|
266
|
+
export interface SummaryEffectPendingOperation extends OperationScope, SummaryGenerationEffectPending {
|
|
267
|
+
at: "summary.effect_pending";
|
|
268
|
+
}
|
|
269
|
+
export interface SummaryRetryWaitOperation extends OperationScope, SummaryGenerationRetryWait {
|
|
270
|
+
at: "summary.retry_wait";
|
|
271
|
+
}
|
|
272
|
+
export interface NavigationReadyToCommitOperation extends OperationScope {
|
|
273
|
+
at: "navigation.ready_to_commit";
|
|
274
|
+
/** Unsummarized navigation may target the branch root (null). */
|
|
275
|
+
targetId: string | null;
|
|
276
|
+
label?: string;
|
|
277
|
+
}
|
|
278
|
+
/** Flat durable operation state: exactly 13 family-neutral dispatcher leaves. */
|
|
279
|
+
export type OperationState = StartingOperation | CheckpointOperation | AssistantReadyOperation | AssistantEffectPendingOperation | AssistantRetryWaitOperation | ToolsOperation | DeferredSuspendedOperation | DeferredEffectPendingOperation | SummaryDecidingOperation | SummaryReadyOperation | SummaryEffectPendingOperation | SummaryRetryWaitOperation | NavigationReadyToCommitOperation;
|
|
280
|
+
export type OperationAt = OperationState["at"];
|
|
281
|
+
/** Copy only the uniform operation scope when constructing a successor leaf. */
|
|
282
|
+
export declare function operationScopeOf(state: OperationState): OperationScope;
|
|
283
|
+
export type Operation = {
|
|
284
|
+
meta: OperationMeta;
|
|
285
|
+
state: OperationState;
|
|
286
|
+
};
|
|
287
|
+
export interface LaneState {
|
|
288
|
+
currentOperationId: string | null;
|
|
289
|
+
lastOperationId: string | null;
|
|
290
|
+
inbox: InboxItem[];
|
|
291
|
+
}
|
|
292
|
+
export type PendingEntry = {
|
|
293
|
+
type: "message";
|
|
294
|
+
payload: AgentMessage;
|
|
175
295
|
} | {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
296
|
+
type: "custom";
|
|
297
|
+
customType: string;
|
|
298
|
+
payload?: JsonValue;
|
|
299
|
+
};
|
|
300
|
+
export interface DurableFileOperations {
|
|
301
|
+
read: string[];
|
|
302
|
+
written: string[];
|
|
303
|
+
edited: string[];
|
|
304
|
+
}
|
|
305
|
+
export type DurableStructuralPreparation = {
|
|
306
|
+
kind: "compaction";
|
|
307
|
+
messagesToSummarize: CompactionPreparation["messagesToSummarize"];
|
|
308
|
+
turnPrefixMessages: CompactionPreparation["turnPrefixMessages"];
|
|
309
|
+
retainedTail: CompactionPreparation["retainedTail"];
|
|
310
|
+
isSplitTurn: boolean;
|
|
311
|
+
tokensBefore: number;
|
|
312
|
+
previousSummary?: string;
|
|
313
|
+
fileOps: DurableFileOperations;
|
|
314
|
+
settings: CompactionSettings;
|
|
179
315
|
} | {
|
|
180
|
-
|
|
181
|
-
|
|
316
|
+
kind: "branch_summary";
|
|
317
|
+
messages: BranchPreparation["messages"];
|
|
318
|
+
fileOps: DurableFileOperations;
|
|
319
|
+
totalTokens: number;
|
|
320
|
+
};
|
|
321
|
+
export interface UsageRow {
|
|
322
|
+
id: string;
|
|
323
|
+
seq: number;
|
|
324
|
+
usage: Usage;
|
|
182
325
|
entryId?: string;
|
|
326
|
+
adjustment: boolean;
|
|
183
327
|
details?: JsonValue;
|
|
184
|
-
}
|
|
185
|
-
export
|
|
186
|
-
|
|
187
|
-
|
|
328
|
+
}
|
|
329
|
+
export interface EntryWrite {
|
|
330
|
+
kind: "entry";
|
|
331
|
+
entry: NewEntry;
|
|
332
|
+
}
|
|
333
|
+
export interface UsageWrite {
|
|
334
|
+
kind: "usage";
|
|
335
|
+
row: Omit<UsageRow, "seq">;
|
|
336
|
+
}
|
|
337
|
+
export type Write = EntryWrite | UsageWrite | ValueWrite | ListWrite;
|
|
338
|
+
export interface CommitResult {
|
|
339
|
+
firstSeq: number;
|
|
340
|
+
seqs: number[];
|
|
341
|
+
timestamp: number;
|
|
342
|
+
/** Session totals immediately after this commit was applied. */
|
|
343
|
+
stats: SessionStats;
|
|
344
|
+
}
|
|
345
|
+
export interface EntryStructure {
|
|
346
|
+
id: string;
|
|
347
|
+
parentId: string | null;
|
|
348
|
+
seq: number;
|
|
349
|
+
timestamp: number;
|
|
350
|
+
type: EntryType;
|
|
351
|
+
customType?: string;
|
|
352
|
+
}
|
|
188
353
|
export interface EntryCursor {
|
|
189
|
-
|
|
354
|
+
seq: number;
|
|
190
355
|
}
|
|
191
|
-
export interface
|
|
192
|
-
|
|
356
|
+
export interface BranchScan {
|
|
357
|
+
start?: string;
|
|
358
|
+
stopAtType?: EntryType;
|
|
359
|
+
stopAtId?: string;
|
|
360
|
+
type?: EntryType;
|
|
193
361
|
customType?: string;
|
|
194
|
-
order?:
|
|
362
|
+
order?: "newestFirst" | "oldestFirst";
|
|
195
363
|
limit?: number;
|
|
196
364
|
cursor?: EntryCursor;
|
|
197
365
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
366
|
+
export type StorageBranchScan = BranchScan & {
|
|
367
|
+
start: string;
|
|
368
|
+
};
|
|
369
|
+
export interface EntryScan {
|
|
370
|
+
type?: EntryType;
|
|
371
|
+
customType?: string;
|
|
372
|
+
fromSeq?: number;
|
|
373
|
+
toSeq?: number;
|
|
374
|
+
order?: "asc" | "desc";
|
|
375
|
+
limit?: number;
|
|
203
376
|
}
|
|
204
|
-
export interface
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
type?: LaneRecord["type"];
|
|
209
|
-
/**
|
|
210
|
-
* Operation identity. Matches OperationStartedRecord.id and the runId
|
|
211
|
-
* property of operation-owned records. Records without an operation
|
|
212
|
-
* identity do not match.
|
|
213
|
-
*/
|
|
214
|
-
runId?: string;
|
|
215
|
-
/** Exact operation intent kind. Valid only with type "operation_started". */
|
|
216
|
-
operationKind?: OperationStartedRecord["intent"]["kind"];
|
|
217
|
-
/** Exclusive chronological lower bound: seq > afterSeq, regardless of order. */
|
|
218
|
-
afterSeq?: number;
|
|
219
|
-
/** Sequence order. Default: "newestFirst". */
|
|
220
|
-
order?: EntryOrder;
|
|
221
|
-
/** Positive maximum number of matching records. */
|
|
377
|
+
export interface UsageScan {
|
|
378
|
+
fromSeq?: number;
|
|
379
|
+
toSeq?: number;
|
|
380
|
+
order?: "asc" | "desc";
|
|
222
381
|
limit?: number;
|
|
223
382
|
}
|
|
383
|
+
export interface SessionStats {
|
|
384
|
+
messageCount: number;
|
|
385
|
+
usage: Usage;
|
|
386
|
+
}
|
|
387
|
+
export interface Storage {
|
|
388
|
+
commit(writes: Write[], context: Context): Promise<CommitResult>;
|
|
389
|
+
getEntries(ids: string[], context: Context): Promise<Map<string, Entry>>;
|
|
390
|
+
getValue<T>(address: Value<T>, context: Context): Promise<StoredValue<T> | undefined>;
|
|
391
|
+
scanValues<T>(prefix: Value<T>, context: Context): Promise<StoredValue<T>[]>;
|
|
392
|
+
readList<T>(address: ValueList<T>, options: ListReadOptions | undefined, context: Context): Promise<ListElement<T>[]>;
|
|
393
|
+
scanBranch(query: StorageBranchScan, context: Context): Promise<Entry[]>;
|
|
394
|
+
scanBranchStructure(query: StorageBranchScan, context: Context): Promise<EntryStructure[]>;
|
|
395
|
+
scanEntries(query: EntryScan, context: Context): Promise<Entry[]>;
|
|
396
|
+
scanUsage(query: UsageScan, context: Context): Promise<UsageRow[]>;
|
|
397
|
+
getStats(context: Context): Promise<SessionStats>;
|
|
398
|
+
close(context: Context): Promise<void>;
|
|
399
|
+
}
|
|
224
400
|
export interface SessionMetadata {
|
|
225
401
|
id: string;
|
|
226
402
|
createdAt: number;
|
|
403
|
+
storageVersion: number;
|
|
404
|
+
cwd?: string;
|
|
227
405
|
parentSessionId?: string;
|
|
406
|
+
legacyParentSessionPath?: string;
|
|
228
407
|
}
|
|
229
|
-
export interface
|
|
230
|
-
|
|
231
|
-
cachedTokens: number;
|
|
232
|
-
uncachedTokens: number;
|
|
233
|
-
totalTokens: number;
|
|
234
|
-
costTotal: number;
|
|
235
|
-
}
|
|
236
|
-
export interface LanePointer {
|
|
237
|
-
lane: string;
|
|
238
|
-
leafId: string | null;
|
|
408
|
+
export interface IdGenerator {
|
|
409
|
+
next(timestampMs?: number): string;
|
|
239
410
|
}
|
|
240
|
-
export
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
} | {
|
|
245
|
-
kind: "record";
|
|
246
|
-
seq: number;
|
|
247
|
-
record: LaneRecord;
|
|
248
|
-
} | {
|
|
249
|
-
kind: "lane";
|
|
250
|
-
seq: number;
|
|
251
|
-
lane: string;
|
|
252
|
-
leafId: string | null;
|
|
253
|
-
} | {
|
|
254
|
-
kind: "fact";
|
|
255
|
-
seq: number;
|
|
256
|
-
fact: "name";
|
|
257
|
-
name: string | undefined;
|
|
258
|
-
} | {
|
|
259
|
-
kind: "fact";
|
|
260
|
-
seq: number;
|
|
261
|
-
fact: "label";
|
|
262
|
-
targetId: string;
|
|
263
|
-
label: string | undefined;
|
|
264
|
-
};
|
|
265
|
-
export interface LogOptions {
|
|
266
|
-
afterSeq?: number;
|
|
411
|
+
export interface EntryQuery {
|
|
412
|
+
type?: EntryType;
|
|
413
|
+
customType?: string;
|
|
414
|
+
order?: "asc" | "desc";
|
|
267
415
|
limit?: number;
|
|
416
|
+
cursor?: EntryCursor;
|
|
417
|
+
}
|
|
418
|
+
export interface SessionReader {
|
|
419
|
+
getEntries(ids: string[], context: Context): Promise<Map<string, Entry>>;
|
|
420
|
+
getStats(context: Context): Promise<SessionStats>;
|
|
421
|
+
getValue<T>(address: Value<T>, context: Context): Promise<StoredValue<T> | undefined>;
|
|
422
|
+
scanValues<T>(prefix: Value<T>, context: Context): Promise<StoredValue<T>[]>;
|
|
423
|
+
readList<T>(address: ValueList<T>, options: ListReadOptions | undefined, context: Context): Promise<ListElement<T>[]>;
|
|
424
|
+
/** Scan a branch from an explicit entry while this reader capability remains valid. */
|
|
425
|
+
scanBranch(query: StorageBranchScan, context: Context): Promise<Entry[]>;
|
|
426
|
+
}
|
|
427
|
+
/** Exclusive keyless mutation barrier for one Session. */
|
|
428
|
+
export interface SessionMutation extends SessionReader {
|
|
429
|
+
/** Exactly zero or one commit attempt. A second attempt rejects. */
|
|
430
|
+
commit(writes: Write[], context: Context): Promise<CommitResult>;
|
|
431
|
+
/** Wait for any commit attempt, invalidate the capability, and release the barrier. */
|
|
432
|
+
end(context: Context): Promise<void>;
|
|
268
433
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
434
|
+
/** Callback-scoped mutation capability without authority to release its Session barrier. */
|
|
435
|
+
export type SessionMutator = Omit<SessionMutation, "end">;
|
|
436
|
+
export type SessionMutationCallback<T> = (mutator: SessionMutator, context: Context) => T | Promise<T>;
|
|
437
|
+
export interface Branch {
|
|
438
|
+
readonly name: string;
|
|
439
|
+
getTipId(context: Context): Promise<string | null>;
|
|
440
|
+
findEntries(query: BranchScan | undefined, context: Context): Promise<Entry[]>;
|
|
441
|
+
findEntry(query: BranchScan | undefined, context: Context): Promise<Entry | undefined>;
|
|
442
|
+
appendMessage(message: AgentMessage, context: Context): Promise<string>;
|
|
443
|
+
appendCustomEntry(customType: string, data: JsonValue | undefined, context: Context): Promise<string>;
|
|
444
|
+
}
|
|
445
|
+
export interface Session<TMetadata extends SessionMetadata = SessionMetadata> extends SessionReader {
|
|
446
|
+
readonly metadata: TMetadata;
|
|
447
|
+
readonly idGenerator: IdGenerator;
|
|
448
|
+
getEntry(id: string, context: Context): Promise<Entry | undefined>;
|
|
449
|
+
getStats(context: Context): Promise<SessionStats>;
|
|
450
|
+
getName(context: Context): Promise<string | undefined>;
|
|
451
|
+
getLabel(targetId: string, context: Context): Promise<string | undefined>;
|
|
452
|
+
findEntries(query: EntryQuery | undefined, context: Context): Promise<Entry[]>;
|
|
453
|
+
findEntry(query: EntryQuery | undefined, context: Context): Promise<Entry | undefined>;
|
|
454
|
+
branch(name: string, context: Context): Promise<Branch | undefined>;
|
|
455
|
+
createBranch(name: string, at: string | null, context: Context): Promise<Branch>;
|
|
456
|
+
beginMutation(context: Context): Promise<SessionMutation>;
|
|
291
457
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
* results provide no additional recovery state.
|
|
458
|
+
* Trusted exclusive callback over the Session mutation line. Calling a public Session writer from
|
|
459
|
+
* this callback queues it behind the callback; awaiting that nested writer therefore deadlocks.
|
|
460
|
+
* Use the supplied mutator for the callback's sole commit.
|
|
296
461
|
*/
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
setName(name: string | undefined): Promise<void>;
|
|
306
|
-
getLabel(id: string): Promise<string | undefined>;
|
|
307
|
-
setLabel(id: string, label: string | undefined): Promise<void>;
|
|
308
|
-
getStats(): Promise<SessionStats>;
|
|
309
|
-
}
|
|
310
|
-
export interface SessionTree {
|
|
311
|
-
getLeafId(): Promise<string | null>;
|
|
312
|
-
getEntry(id: string): Promise<Entry | undefined>;
|
|
313
|
-
getStats(): Promise<SessionStats>;
|
|
314
|
-
getName(): Promise<string | undefined>;
|
|
315
|
-
setName(name: string | undefined): Promise<void>;
|
|
316
|
-
getLabel(targetId: string): Promise<string | undefined>;
|
|
317
|
-
setLabel(targetId: string, label: string | undefined): Promise<void>;
|
|
318
|
-
/** Session-wide, all branches, sequence order. */
|
|
319
|
-
findEntries(query?: EntryQuery): Promise<Entry[]>;
|
|
320
|
-
findEntry(query?: EntryQuery): Promise<Entry | undefined>;
|
|
321
|
-
/** Branch-scoped: the path from start toward root. */
|
|
322
|
-
findEntriesOnBranch(query?: EntryQuery & BranchBounds): Promise<Entry[]>;
|
|
323
|
-
findEntryOnBranch(query?: EntryQuery & BranchBounds): Promise<Entry | undefined>;
|
|
324
|
-
appendMessage(message: AgentMessage): Promise<string>;
|
|
325
|
-
appendCustomEntry(customType: string, data?: unknown): Promise<string>;
|
|
462
|
+
mutate<T>(mutation: SessionMutationCallback<T>, context: Context): Promise<T>;
|
|
463
|
+
setValue<T>(address: Value<T>, next: NoInfer<T>, context: Context): Promise<void>;
|
|
464
|
+
deleteValue<T>(address: Value<T>, context: Context): Promise<void>;
|
|
465
|
+
appendList<T>(address: ValueList<T>, element: NoInfer<T>, context: Context): Promise<void>;
|
|
466
|
+
deleteList<T>(address: ValueList<T>, context: Context): Promise<void>;
|
|
467
|
+
setName(name: string | undefined, context: Context): Promise<void>;
|
|
468
|
+
setLabel(targetId: string, label: string | undefined, context: Context): Promise<void>;
|
|
469
|
+
close(context: Context): Promise<void>;
|
|
326
470
|
}
|
|
327
471
|
export interface SessionCreateOptions {
|
|
328
472
|
id?: string;
|
|
329
473
|
parentSessionId?: string;
|
|
330
474
|
}
|
|
331
475
|
export type ForkOptions = {
|
|
332
|
-
|
|
476
|
+
/**
|
|
477
|
+
* Copy one path from a complete configured source AgentLane under the same
|
|
478
|
+
* Branch name, with copied configuration and fresh idle lane state.
|
|
479
|
+
*/
|
|
480
|
+
scope: "branch";
|
|
481
|
+
/** Source Branch to copy. */
|
|
482
|
+
branch: string;
|
|
483
|
+
/** Entry on the source Branch's current tip ancestry. Defaults to the current tip. */
|
|
333
484
|
entryId?: string;
|
|
485
|
+
/**
|
|
486
|
+
* Whether the fork includes the selected entry or stops at its parent.
|
|
487
|
+
* Defaults to including the selected entry.
|
|
488
|
+
*/
|
|
334
489
|
position?: "before" | "at";
|
|
490
|
+
/** Optional destination session id. */
|
|
491
|
+
id?: string;
|
|
335
492
|
} | {
|
|
493
|
+
/**
|
|
494
|
+
* Copy the whole conversation tree and every Branch tip. Each configured
|
|
495
|
+
* AgentLane copies configuration plus fresh idle state; data-only Branches
|
|
496
|
+
* remain data-only. Operation/pending/result/usage state is excluded.
|
|
497
|
+
*/
|
|
336
498
|
scope: "tree";
|
|
499
|
+
/** Optional destination session id. */
|
|
500
|
+
id?: string;
|
|
337
501
|
};
|
|
338
|
-
export interface SessionRepo<TMetadata extends SessionMetadata = SessionMetadata, TCreateOptions extends
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
export type SessionErrorCode = "not_found" | "already_exists" | "invalid_entry" | "invalid_payload" | "invalid_lane" | "invalid_query" | "invalid_fork_target" | "storage";
|
|
348
|
-
export declare class SessionError extends Error {
|
|
349
|
-
readonly code: SessionErrorCode;
|
|
350
|
-
constructor(code: SessionErrorCode, message: string, cause?: Error);
|
|
502
|
+
export interface SessionRepo<TMetadata extends SessionMetadata = SessionMetadata, TCreateOptions extends {
|
|
503
|
+
id?: string;
|
|
504
|
+
parentSessionId?: string;
|
|
505
|
+
} = SessionCreateOptions, TListOptions = void> {
|
|
506
|
+
create(options: TCreateOptions, context: Context): Promise<Session<TMetadata>>;
|
|
507
|
+
open(metadata: TMetadata, context: Context): Promise<Session<TMetadata>>;
|
|
508
|
+
list(options: TListOptions | undefined, context: Context): Promise<TMetadata[]>;
|
|
509
|
+
delete(metadata: TMetadata, context: Context): Promise<void>;
|
|
510
|
+
fork(source: TMetadata, options: ForkOptions, context: Context): Promise<Session<TMetadata>>;
|
|
351
511
|
}
|
|
352
512
|
//# sourceMappingURL=types.d.ts.map
|