@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
|
@@ -1,512 +1,352 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
import type { AgentMessage
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
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">;
|
|
1
|
+
import type { StopReason, Usage } from "@earendil-works/pi-ai";
|
|
2
|
+
import "../messages.ts";
|
|
3
|
+
import type { AgentMessage } from "../../types.ts";
|
|
4
|
+
import type { Session } from "./session.ts";
|
|
5
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
6
|
+
[key: string]: JsonValue;
|
|
12
7
|
};
|
|
13
|
-
export type
|
|
8
|
+
export type SessionStopReason = Exclude<StopReason, "pending"> | "deferred";
|
|
9
|
+
export interface IdGenerator {
|
|
10
|
+
next(): string;
|
|
11
|
+
}
|
|
14
12
|
export interface EntryBase {
|
|
13
|
+
type: string;
|
|
15
14
|
id: string;
|
|
16
|
-
parentId: string | null;
|
|
17
15
|
seq: number;
|
|
16
|
+
parentId: string | null;
|
|
18
17
|
timestamp: number;
|
|
19
|
-
type: EntryType;
|
|
20
|
-
customType?: string;
|
|
21
18
|
}
|
|
22
19
|
export interface MessageEntry extends EntryBase {
|
|
23
20
|
type: "message";
|
|
24
21
|
message: AgentMessage;
|
|
25
22
|
terminate?: true;
|
|
26
23
|
}
|
|
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
|
+
}
|
|
27
43
|
export interface CompactionEntry extends EntryBase {
|
|
28
44
|
type: "compaction";
|
|
29
45
|
summary: string;
|
|
30
46
|
retainedTail: AgentMessage[];
|
|
31
47
|
tokensBefore: number;
|
|
32
|
-
details?:
|
|
48
|
+
details?: unknown;
|
|
33
49
|
usage?: Usage;
|
|
34
|
-
fromHook: boolean;
|
|
35
50
|
}
|
|
36
51
|
export interface BranchSummaryEntry extends EntryBase {
|
|
37
52
|
type: "branch_summary";
|
|
38
|
-
fromId: string
|
|
53
|
+
fromId: string;
|
|
39
54
|
summary: string;
|
|
40
|
-
details?:
|
|
55
|
+
details?: unknown;
|
|
41
56
|
usage?: Usage;
|
|
42
|
-
fromHook: boolean;
|
|
43
57
|
}
|
|
44
58
|
export interface CustomEntry extends EntryBase {
|
|
45
59
|
type: "custom";
|
|
46
60
|
customType: string;
|
|
47
|
-
data?:
|
|
48
|
-
}
|
|
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[];
|
|
61
|
+
data?: unknown;
|
|
61
62
|
}
|
|
62
|
-
export
|
|
63
|
-
|
|
63
|
+
export type Entry = MessageEntry | ModelChangeEntry | ThinkingLevelEntry | ConfigurationUpdateEntry | ActiveToolsEntry | CompactionEntry | BranchSummaryEntry | CustomEntry;
|
|
64
|
+
export type ProvisionedEntry<TEntry extends Entry = Entry> = TEntry extends Entry ? Omit<TEntry, "parentId" | "seq" | "timestamp"> : never;
|
|
65
|
+
export interface RecordBase {
|
|
66
|
+
id: string;
|
|
67
|
+
seq: number;
|
|
64
68
|
lane: string;
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
timestamp: number;
|
|
70
|
+
}
|
|
71
|
+
export interface OperationStartedRecord extends RecordBase {
|
|
72
|
+
type: "operation_started";
|
|
73
|
+
sourceLeafId: string | null;
|
|
67
74
|
intent: {
|
|
68
75
|
kind: "run";
|
|
69
|
-
|
|
76
|
+
/** Normalized caller input before before_run; kept for suspended operations and before_resume. */
|
|
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
|
+
};
|
|
70
84
|
} | {
|
|
71
85
|
kind: "compaction";
|
|
72
86
|
customInstructions?: string;
|
|
87
|
+
resultEntryId: string;
|
|
73
88
|
} | {
|
|
74
89
|
kind: "navigation";
|
|
75
90
|
targetId: string | null;
|
|
76
91
|
summarize: boolean;
|
|
77
|
-
label?: string;
|
|
78
92
|
customInstructions?: string;
|
|
93
|
+
label?: string;
|
|
94
|
+
summaryEntryId?: string;
|
|
79
95
|
};
|
|
80
96
|
}
|
|
81
|
-
export
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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;
|
|
107
|
-
} | {
|
|
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;
|
|
97
|
+
export interface AbortRequestedRecord extends RecordBase {
|
|
98
|
+
type: "abort_requested";
|
|
99
|
+
runId: string;
|
|
100
|
+
}
|
|
101
|
+
export interface OperationFinishedRecord extends RecordBase {
|
|
102
|
+
type: "operation_finished";
|
|
103
|
+
runId: string;
|
|
104
|
+
outcome: "completed" | "aborted" | "failed" | "declined";
|
|
105
|
+
error?: {
|
|
106
|
+
code: string;
|
|
107
|
+
message: string;
|
|
108
|
+
};
|
|
133
109
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
110
|
+
export type CompactionReason = "manual" | "threshold" | "overflow";
|
|
111
|
+
export type StepAttemptRecord = RecordBase & ({
|
|
112
|
+
type: "step_attempt";
|
|
113
|
+
runId: string;
|
|
114
|
+
step: "assistant" | "branch_summary";
|
|
115
|
+
attempt: number;
|
|
137
116
|
resultEntryId: string;
|
|
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;
|
|
117
|
+
compactionReason?: never;
|
|
147
118
|
} | {
|
|
148
|
-
|
|
149
|
-
|
|
119
|
+
type: "step_attempt";
|
|
120
|
+
runId: string;
|
|
121
|
+
step: "compaction";
|
|
122
|
+
attempt: number;
|
|
123
|
+
resultEntryId: string;
|
|
124
|
+
/** Persists why compaction summary generation started so recovery resumes the same work. */
|
|
125
|
+
compactionReason: CompactionReason;
|
|
150
126
|
});
|
|
151
|
-
export interface
|
|
127
|
+
export interface ToolStartedRecord extends RecordBase {
|
|
128
|
+
type: "tool_started";
|
|
129
|
+
runId: string;
|
|
152
130
|
assistantEntryId: string;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
131
|
+
toolIndex: number;
|
|
132
|
+
toolCallId: string;
|
|
133
|
+
toolName: string;
|
|
134
|
+
effectiveArgs: {
|
|
135
|
+
[key: string]: unknown;
|
|
136
|
+
};
|
|
158
137
|
resultEntryId: string;
|
|
159
|
-
|
|
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;
|
|
138
|
+
replay: "never" | "safe";
|
|
185
139
|
}
|
|
186
|
-
export type
|
|
187
|
-
|
|
188
|
-
|
|
140
|
+
export type QueueEnqueuedRecord = RecordBase & ({
|
|
141
|
+
type: "queue_enqueued";
|
|
142
|
+
queue: "steer" | "followUp";
|
|
143
|
+
runId: string;
|
|
144
|
+
target: ProvisionedEntry;
|
|
189
145
|
} | {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
customInstructions?: string;
|
|
200
|
-
boundary: ResultBoundary;
|
|
201
|
-
}
|
|
202
|
-
export interface SummaryGenerationScope {
|
|
203
|
-
task: SummaryTask;
|
|
204
|
-
summaryContext: SummaryContext;
|
|
205
|
-
}
|
|
206
|
-
export interface SummaryGenerationReady extends SummaryGenerationScope {
|
|
207
|
-
nextAttempt: number;
|
|
208
|
-
}
|
|
209
|
-
export interface SummaryGenerationEffectPending extends SummaryGenerationScope {
|
|
210
|
-
attempt: number;
|
|
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";
|
|
146
|
+
type: "queue_enqueued";
|
|
147
|
+
queue: "nextRun";
|
|
148
|
+
runId?: never;
|
|
149
|
+
target: ProvisionedEntry;
|
|
150
|
+
});
|
|
151
|
+
export interface QueueCancelledRecord extends RecordBase {
|
|
152
|
+
type: "queue_cancelled";
|
|
153
|
+
runId?: string;
|
|
154
|
+
entryId: string;
|
|
231
155
|
}
|
|
232
|
-
export interface
|
|
233
|
-
|
|
234
|
-
|
|
156
|
+
export interface WriteDeferredRecord extends RecordBase {
|
|
157
|
+
type: "write_deferred";
|
|
158
|
+
runId: string;
|
|
159
|
+
target: ProvisionedEntry;
|
|
235
160
|
}
|
|
236
|
-
export
|
|
237
|
-
|
|
161
|
+
export type UsageRecord = RecordBase & {
|
|
162
|
+
type: "usage";
|
|
163
|
+
usage: Usage;
|
|
164
|
+
} & ({
|
|
165
|
+
cause: "assistant" | "compaction" | "branch_summary" | "deferred_fetch";
|
|
166
|
+
runId: string;
|
|
167
|
+
entryId: string;
|
|
238
168
|
attempt: number;
|
|
239
|
-
|
|
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;
|
|
169
|
+
stopReason: SessionStopReason;
|
|
295
170
|
} | {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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;
|
|
171
|
+
cause: "tool";
|
|
172
|
+
runId: string;
|
|
173
|
+
entryId: string;
|
|
174
|
+
toolCallId: string;
|
|
315
175
|
} | {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
id: string;
|
|
323
|
-
seq: number;
|
|
324
|
-
usage: Usage;
|
|
176
|
+
cause: "hook";
|
|
177
|
+
runId: string;
|
|
178
|
+
entryId: string;
|
|
179
|
+
} | {
|
|
180
|
+
cause: "adjustment";
|
|
181
|
+
runId?: string;
|
|
325
182
|
entryId?: string;
|
|
326
|
-
adjustment: boolean;
|
|
327
183
|
details?: JsonValue;
|
|
328
|
-
}
|
|
329
|
-
export
|
|
330
|
-
|
|
331
|
-
|
|
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
|
-
}
|
|
184
|
+
});
|
|
185
|
+
export type LaneRecord = OperationStartedRecord | AbortRequestedRecord | OperationFinishedRecord | StepAttemptRecord | ToolStartedRecord | QueueEnqueuedRecord | QueueCancelledRecord | WriteDeferredRecord | UsageRecord;
|
|
186
|
+
export type NewRecord<TRecord extends LaneRecord = LaneRecord> = TRecord extends LaneRecord ? Omit<TRecord, "seq" | "timestamp"> : never;
|
|
187
|
+
export type EntryOrder = "newestFirst" | "oldestFirst";
|
|
353
188
|
export interface EntryCursor {
|
|
354
|
-
|
|
189
|
+
afterSeq: number;
|
|
355
190
|
}
|
|
356
|
-
export interface
|
|
357
|
-
|
|
358
|
-
stopAtType?: EntryType;
|
|
359
|
-
stopAtId?: string;
|
|
360
|
-
type?: EntryType;
|
|
191
|
+
export interface EntryQuery {
|
|
192
|
+
type?: Entry["type"];
|
|
361
193
|
customType?: string;
|
|
362
|
-
order?:
|
|
194
|
+
order?: EntryOrder;
|
|
363
195
|
limit?: number;
|
|
364
196
|
cursor?: EntryCursor;
|
|
365
197
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
customType?: string;
|
|
372
|
-
fromSeq?: number;
|
|
373
|
-
toSeq?: number;
|
|
374
|
-
order?: "asc" | "desc";
|
|
375
|
-
limit?: number;
|
|
198
|
+
/** Bounds of a branch scan. Default: the whole path, leaf to root. */
|
|
199
|
+
export interface BranchBounds {
|
|
200
|
+
start?: string;
|
|
201
|
+
stopAtType?: Entry["type"];
|
|
202
|
+
stopAtId?: string;
|
|
376
203
|
}
|
|
377
|
-
export interface
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
204
|
+
export interface RecordQuery {
|
|
205
|
+
/** Exact lane match. Omit to query every lane. */
|
|
206
|
+
lane?: string;
|
|
207
|
+
/** Exact record discriminant match. Omit to query every record type. */
|
|
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. */
|
|
381
222
|
limit?: number;
|
|
382
223
|
}
|
|
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
|
-
}
|
|
400
224
|
export interface SessionMetadata {
|
|
401
225
|
id: string;
|
|
402
226
|
createdAt: number;
|
|
403
|
-
storageVersion: number;
|
|
404
|
-
cwd?: string;
|
|
405
227
|
parentSessionId?: string;
|
|
406
|
-
legacyParentSessionPath?: string;
|
|
407
|
-
}
|
|
408
|
-
export interface IdGenerator {
|
|
409
|
-
next(timestampMs?: number): string;
|
|
410
|
-
}
|
|
411
|
-
export interface EntryQuery {
|
|
412
|
-
type?: EntryType;
|
|
413
|
-
customType?: string;
|
|
414
|
-
order?: "asc" | "desc";
|
|
415
|
-
limit?: number;
|
|
416
|
-
cursor?: EntryCursor;
|
|
417
228
|
}
|
|
418
|
-
export interface
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
/** Scan a branch from an explicit entry while this reader capability remains valid. */
|
|
425
|
-
scanBranch(query: StorageBranchScan, context: Context): Promise<Entry[]>;
|
|
229
|
+
export interface SessionStats {
|
|
230
|
+
messageCount: number;
|
|
231
|
+
cachedTokens: number;
|
|
232
|
+
uncachedTokens: number;
|
|
233
|
+
totalTokens: number;
|
|
234
|
+
costTotal: number;
|
|
426
235
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
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>;
|
|
236
|
+
export interface LanePointer {
|
|
237
|
+
lane: string;
|
|
238
|
+
leafId: string | null;
|
|
433
239
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
240
|
+
export type LogItem = {
|
|
241
|
+
kind: "entry";
|
|
242
|
+
seq: number;
|
|
243
|
+
entry: Entry;
|
|
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;
|
|
267
|
+
limit?: number;
|
|
444
268
|
}
|
|
445
|
-
export interface
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
269
|
+
export interface SessionStorage<TMetadata extends SessionMetadata = SessionMetadata> {
|
|
270
|
+
getMetadata(): Promise<TMetadata>;
|
|
271
|
+
getLanes(): Promise<{
|
|
272
|
+
lane: string;
|
|
273
|
+
leafId: string | null;
|
|
274
|
+
}[]>;
|
|
275
|
+
createLane(lane: string, at: string | null): Promise<void>;
|
|
276
|
+
moveLane(lane: string, to: string | null): Promise<void>;
|
|
277
|
+
appendEntry<TEntry extends Entry>(entry: ProvisionedEntry<TEntry>, lane: string): Promise<TEntry>;
|
|
278
|
+
appendRecord<TRecord extends LaneRecord>(record: NewRecord<TRecord>): Promise<TRecord>;
|
|
279
|
+
getEntry(id: string): Promise<Entry | undefined>;
|
|
280
|
+
findEntries(query?: EntryQuery): Promise<Entry[]>;
|
|
281
|
+
/** start is mandatory here (as opposed to SessionTree's findEntriesOnBranch); defaulting to a lane's leaf is view sugar. */
|
|
282
|
+
findEntriesOnBranch(query: EntryQuery & BranchBounds & {
|
|
283
|
+
start: string;
|
|
284
|
+
}): Promise<Entry[]>;
|
|
285
|
+
findRecords<K extends LaneRecord["type"]>(query: RecordQuery & {
|
|
286
|
+
type: K;
|
|
287
|
+
}): Promise<Extract<LaneRecord, {
|
|
288
|
+
type: K;
|
|
289
|
+
}>[]>;
|
|
290
|
+
findRecords(query?: RecordQuery): Promise<LaneRecord[]>;
|
|
457
291
|
/**
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
292
|
+
* Returns unfinished operation starts newest first. Recovery uses `limit: 2`:
|
|
293
|
+
* zero results mean the lane is idle, one means it is suspended, and two
|
|
294
|
+
* mean at least two operations are open, which is corruption. Further
|
|
295
|
+
* results provide no additional recovery state.
|
|
461
296
|
*/
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
297
|
+
findOpenOperations(lane: string, options?: {
|
|
298
|
+
limit?: number;
|
|
299
|
+
}): Promise<OperationStartedRecord[]>;
|
|
300
|
+
getLog(options?: {
|
|
301
|
+
afterSeq?: number;
|
|
302
|
+
limit?: number;
|
|
303
|
+
}): Promise<LogItem[]>;
|
|
304
|
+
getName(): Promise<string | undefined>;
|
|
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>;
|
|
470
326
|
}
|
|
471
327
|
export interface SessionCreateOptions {
|
|
472
328
|
id?: string;
|
|
473
329
|
parentSessionId?: string;
|
|
474
330
|
}
|
|
475
331
|
export type ForkOptions = {
|
|
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. */
|
|
332
|
+
scope?: "branch";
|
|
484
333
|
entryId?: string;
|
|
485
|
-
/**
|
|
486
|
-
* Whether the fork includes the selected entry or stops at its parent.
|
|
487
|
-
* Defaults to including the selected entry.
|
|
488
|
-
*/
|
|
489
334
|
position?: "before" | "at";
|
|
490
|
-
/** Optional destination session id. */
|
|
491
|
-
id?: string;
|
|
492
335
|
} | {
|
|
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
|
-
*/
|
|
498
336
|
scope: "tree";
|
|
499
|
-
/** Optional destination session id. */
|
|
500
|
-
id?: string;
|
|
501
337
|
};
|
|
502
|
-
export interface SessionRepo<TMetadata extends SessionMetadata = SessionMetadata, TCreateOptions extends {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
338
|
+
export interface SessionRepo<TMetadata extends SessionMetadata = SessionMetadata, TCreateOptions extends SessionCreateOptions = SessionCreateOptions, TListOptions = void> {
|
|
339
|
+
create(options: TCreateOptions): Promise<Session<TMetadata>>;
|
|
340
|
+
/** Opens the session for writing and acquires any backend writer claim. */
|
|
341
|
+
open(metadata: TMetadata): Promise<Session<TMetadata>>;
|
|
342
|
+
/** Lists session metadata without opening sessions or acquiring writer claims. */
|
|
343
|
+
list(options?: TListOptions): Promise<TMetadata[]>;
|
|
344
|
+
delete(metadata: TMetadata): Promise<void>;
|
|
345
|
+
fork(source: TMetadata, options: ForkOptions & TCreateOptions): Promise<Session<TMetadata>>;
|
|
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);
|
|
511
351
|
}
|
|
512
352
|
//# sourceMappingURL=types.d.ts.map
|