@yanlinglabs/winter-agent-runtime 0.0.27
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/LICENSE +21 -0
- package/NOTICE +41 -0
- package/README.md +64 -0
- package/dist/checkpoint/file-history.d.ts +81 -0
- package/dist/checkpoint/rewind.d.ts +55 -0
- package/dist/checkpoint/seam.d.ts +47 -0
- package/dist/checkpoint/sink.d.ts +66 -0
- package/dist/commands/builtins-listing.d.ts +40 -0
- package/dist/commands/resolver.d.ts +103 -0
- package/dist/commands/seam.d.ts +53 -0
- package/dist/compaction/controller.d.ts +23 -0
- package/dist/compaction/retention.d.ts +35 -0
- package/dist/compaction/seam.d.ts +115 -0
- package/dist/compaction/summarizer.d.ts +79 -0
- package/dist/context/agent-listing.d.ts +39 -0
- package/dist/context/assembler.d.ts +46 -0
- package/dist/context/attachments.d.ts +104 -0
- package/dist/context/dynamic-sections.d.ts +31 -0
- package/dist/context/git-fixture.d.ts +18 -0
- package/dist/context/git-status.d.ts +16 -0
- package/dist/context/imports.d.ts +22 -0
- package/dist/context/injection.d.ts +53 -0
- package/dist/context/memory-key.d.ts +46 -0
- package/dist/context/memory.d.ts +28 -0
- package/dist/context/minimal-prompt.d.ts +5 -0
- package/dist/context/output-styles.d.ts +68 -0
- package/dist/context/plan-mode.d.ts +29 -0
- package/dist/context/request-layout.d.ts +138 -0
- package/dist/context/rules.d.ts +63 -0
- package/dist/context/seam.d.ts +136 -0
- package/dist/context/tool-epoch.d.ts +118 -0
- package/dist/context/winter-code-preset.d.ts +39 -0
- package/dist/context/winter-md.d.ts +81 -0
- package/dist/embedded-host.d.ts +48 -0
- package/dist/embedded-host.js +155 -0
- package/dist/embedded-protocol.d.ts +44 -0
- package/dist/embedded-worker.d.ts +1 -0
- package/dist/embedded-worker.js +74 -0
- package/dist/embedded.d.ts +34 -0
- package/dist/embedded.js +9 -0
- package/dist/engine.d.ts +1298 -0
- package/dist/hooks/additional-context.d.ts +21 -0
- package/dist/hooks/bounds.d.ts +6 -0
- package/dist/hooks/bridge-invoker.d.ts +3 -0
- package/dist/hooks/command-invoker.d.ts +52 -0
- package/dist/hooks/from-config.d.ts +31 -0
- package/dist/hooks/hook-stage.d.ts +25 -0
- package/dist/hooks/input-validator.d.ts +6 -0
- package/dist/hooks/reducer.d.ts +74 -0
- package/dist/hooks/registry.d.ts +33 -0
- package/dist/hooks/runner.d.ts +105 -0
- package/dist/index-584yahed.js +6037 -0
- package/dist/index-97t2rmtf.js +42 -0
- package/dist/index-9qgkpv56.js +27183 -0
- package/dist/index-bef62z3r.js +437 -0
- package/dist/index-rkhh0457.js +187 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +353 -0
- package/dist/main.d.ts +1 -0
- package/dist/mcp/client.d.ts +105 -0
- package/dist/mcp/control-seam.d.ts +25 -0
- package/dist/mcp/control.d.ts +5 -0
- package/dist/mcp/elicitation.d.ts +35 -0
- package/dist/mcp/env.d.ts +12 -0
- package/dist/mcp/lifecycle.d.ts +142 -0
- package/dist/mcp/output-cap.d.ts +15 -0
- package/dist/mcp/state.d.ts +24 -0
- package/dist/mcp/test-fixtures.d.ts +88 -0
- package/dist/mcp/transports/__fixtures__/stdio-server.d.ts +1 -0
- package/dist/mcp/transports/http.d.ts +5 -0
- package/dist/mcp/transports/sdk.d.ts +5 -0
- package/dist/mcp/transports/sse.d.ts +3 -0
- package/dist/mcp/transports/stdio.d.ts +35 -0
- package/dist/mcp/winter-server.d.ts +2 -0
- package/dist/messaging/reference-adapter.d.ts +88 -0
- package/dist/messaging/router.d.ts +8 -0
- package/dist/paths/project-dir-name.d.ts +2 -0
- package/dist/paths/temp.d.ts +25 -0
- package/dist/permissions/approvals.d.ts +107 -0
- package/dist/permissions/auto/caches.d.ts +53 -0
- package/dist/permissions/auto/config.d.ts +37 -0
- package/dist/permissions/auto/engine.d.ts +74 -0
- package/dist/permissions/auto/envelope.d.ts +45 -0
- package/dist/permissions/auto/inheritance.d.ts +27 -0
- package/dist/permissions/edit-recognition.d.ts +30 -0
- package/dist/permissions/evaluator.d.ts +284 -0
- package/dist/permissions/file-rules.d.ts +384 -0
- package/dist/permissions/grammar.d.ts +113 -0
- package/dist/permissions/paths.d.ts +32 -0
- package/dist/permissions/policy-state.d.ts +64 -0
- package/dist/permissions/prompt-stage.d.ts +3 -0
- package/dist/permissions/protected.d.ts +54 -0
- package/dist/permissions/ruleset.d.ts +134 -0
- package/dist/permissions/shell-structure.d.ts +41 -0
- package/dist/plugins/bundle.d.ts +100 -0
- package/dist/plugins/installed.d.ts +30 -0
- package/dist/plugins/loader.d.ts +56 -0
- package/dist/plugins/manifest.d.ts +115 -0
- package/dist/production-wiring.d.ts +340 -0
- package/dist/protocol/channel.d.ts +22 -0
- package/dist/provider/advisor-route.d.ts +47 -0
- package/dist/provider/bridge.d.ts +124 -0
- package/dist/provider/classifier/model-classifier.d.ts +82 -0
- package/dist/provider/classifier/prompt.d.ts +62 -0
- package/dist/provider/classifier/verdict-schema.d.ts +83 -0
- package/dist/provider/credential-api.d.ts +160 -0
- package/dist/provider/family-listing.d.ts +27 -0
- package/dist/provider/first-party.d.ts +4 -0
- package/dist/provider/keychain-store.d.ts +59 -0
- package/dist/provider/lean-prompt.d.ts +7 -0
- package/dist/provider/mock.d.ts +55 -0
- package/dist/provider/scenario-fake.d.ts +96 -0
- package/dist/provider/selection.d.ts +115 -0
- package/dist/provider/session-provider.d.ts +426 -0
- package/dist/provider/slots.d.ts +120 -0
- package/dist/provider/stream-frames.d.ts +25 -0
- package/dist/provider/tool-secret.d.ts +57 -0
- package/dist/rpc/bridge.d.ts +14 -0
- package/dist/rpc/mcp-control.d.ts +26 -0
- package/dist/runtime.d.ts +14 -0
- package/dist/sandbox/profile.d.ts +249 -0
- package/dist/sandbox/spawn.d.ts +139 -0
- package/dist/settings/env-filter.d.ts +52 -0
- package/dist/settings/loaders/hooks.d.ts +44 -0
- package/dist/settings/loaders/mcp-config.d.ts +83 -0
- package/dist/settings/loaders/plugin-mcp.d.ts +3 -0
- package/dist/settings/loaders/strict-plugin-only.d.ts +13 -0
- package/dist/settings/resolve.d.ts +2 -0
- package/dist/settings/sources.d.ts +2 -0
- package/dist/settings/trust.d.ts +36 -0
- package/dist/skills/attachment.d.ts +25 -0
- package/dist/skills/frontmatter.d.ts +64 -0
- package/dist/skills/index.d.ts +16 -0
- package/dist/skills/listing.d.ts +89 -0
- package/dist/skills/loader.d.ts +104 -0
- package/dist/skills/option.d.ts +68 -0
- package/dist/skills/permission-rules.d.ts +21 -0
- package/dist/skills/runtime.d.ts +21 -0
- package/dist/skills/store.d.ts +163 -0
- package/dist/store/continuation-attach.d.ts +44 -0
- package/dist/store/dialect.d.ts +526 -0
- package/dist/store/provider-state.d.ts +188 -0
- package/dist/store/resume.d.ts +92 -0
- package/dist/structured/ajv-seam.d.ts +7 -0
- package/dist/structured/descriptor.d.ts +9 -0
- package/dist/structured/seam.d.ts +51 -0
- package/dist/structured/validator.d.ts +22 -0
- package/dist/subagents/activity.d.ts +13 -0
- package/dist/subagents/availability.d.ts +30 -0
- package/dist/subagents/builtin-agents.d.ts +37 -0
- package/dist/subagents/child-engine.d.ts +198 -0
- package/dist/subagents/child-handle.d.ts +344 -0
- package/dist/subagents/definitions.d.ts +189 -0
- package/dist/subagents/fork.d.ts +55 -0
- package/dist/subagents/git-root.d.ts +1 -0
- package/dist/subagents/limits.d.ts +28 -0
- package/dist/subagents/notification-queue.d.ts +233 -0
- package/dist/subagents/plugin-agents.d.ts +5 -0
- package/dist/subagents/policy.d.ts +46 -0
- package/dist/subagents/register-default-factory.d.ts +66 -0
- package/dist/subagents/resolution.d.ts +56 -0
- package/dist/subagents/restore.d.ts +9 -0
- package/dist/subagents/roster.d.ts +17 -0
- package/dist/subagents/test-fakes.d.ts +12 -0
- package/dist/subagents/tool-pools.d.ts +69 -0
- package/dist/subagents/watchdog.d.ts +13 -0
- package/dist/subagents/workspace.d.ts +27 -0
- package/dist/testing.d.ts +5 -0
- package/dist/testing.js +194 -0
- package/dist/tools/background-tasks.d.ts +10 -0
- package/dist/tools/descriptors/_shared.d.ts +34 -0
- package/dist/tools/descriptors/advisor.d.ts +1 -0
- package/dist/tools/descriptors/agent.d.ts +47 -0
- package/dist/tools/descriptors/artifact.d.ts +1 -0
- package/dist/tools/descriptors/ask-user-question.d.ts +1 -0
- package/dist/tools/descriptors/bash.d.ts +20 -0
- package/dist/tools/descriptors/claude-design.d.ts +1 -0
- package/dist/tools/descriptors/cron-create.d.ts +1 -0
- package/dist/tools/descriptors/cron-delete.d.ts +1 -0
- package/dist/tools/descriptors/cron-list.d.ts +1 -0
- package/dist/tools/descriptors/edit.d.ts +1 -0
- package/dist/tools/descriptors/end-conversation.d.ts +1 -0
- package/dist/tools/descriptors/enter-plan-mode.d.ts +1 -0
- package/dist/tools/descriptors/enter-worktree.d.ts +1 -0
- package/dist/tools/descriptors/exit-plan-mode.d.ts +1 -0
- package/dist/tools/descriptors/exit-worktree.d.ts +1 -0
- package/dist/tools/descriptors/glob.d.ts +1 -0
- package/dist/tools/descriptors/grep.d.ts +1 -0
- package/dist/tools/descriptors/index.d.ts +59 -0
- package/dist/tools/descriptors/list-agents.d.ts +1 -0
- package/dist/tools/descriptors/list-mcp-resources-tool.d.ts +1 -0
- package/dist/tools/descriptors/lsp.d.ts +1 -0
- package/dist/tools/descriptors/monitor.d.ts +1 -0
- package/dist/tools/descriptors/notebook-edit.d.ts +1 -0
- package/dist/tools/descriptors/powershell.d.ts +1 -0
- package/dist/tools/descriptors/projects.d.ts +1 -0
- package/dist/tools/descriptors/propose-goal.d.ts +1 -0
- package/dist/tools/descriptors/propose-skills.d.ts +1 -0
- package/dist/tools/descriptors/push-notification.d.ts +1 -0
- package/dist/tools/descriptors/read-mcp-resource-dir-tool.d.ts +1 -0
- package/dist/tools/descriptors/read-mcp-resource-tool.d.ts +1 -0
- package/dist/tools/descriptors/read-notifications.d.ts +1 -0
- package/dist/tools/descriptors/read.d.ts +1 -0
- package/dist/tools/descriptors/refresh-mcp-tools.d.ts +1 -0
- package/dist/tools/descriptors/remote-trigger.d.ts +1 -0
- package/dist/tools/descriptors/repl.d.ts +1 -0
- package/dist/tools/descriptors/report-findings.d.ts +1 -0
- package/dist/tools/descriptors/schedule-wakeup.d.ts +1 -0
- package/dist/tools/descriptors/send-feedback.d.ts +1 -0
- package/dist/tools/descriptors/send-message.d.ts +1 -0
- package/dist/tools/descriptors/send-user-file.d.ts +1 -0
- package/dist/tools/descriptors/share-onboarding-guide.d.ts +1 -0
- package/dist/tools/descriptors/show-onboarding-role-picker.d.ts +1 -0
- package/dist/tools/descriptors/skill.d.ts +1 -0
- package/dist/tools/descriptors/structured-output.d.ts +1 -0
- package/dist/tools/descriptors/task-create.d.ts +1 -0
- package/dist/tools/descriptors/task-get.d.ts +1 -0
- package/dist/tools/descriptors/task-list.d.ts +1 -0
- package/dist/tools/descriptors/task-output.d.ts +1 -0
- package/dist/tools/descriptors/task-stop.d.ts +1 -0
- package/dist/tools/descriptors/task-update.d.ts +1 -0
- package/dist/tools/descriptors/todo-write.d.ts +1 -0
- package/dist/tools/descriptors/tool-search.d.ts +1 -0
- package/dist/tools/descriptors/wait-for-mcp-servers.d.ts +1 -0
- package/dist/tools/descriptors/web-fetch.d.ts +8 -0
- package/dist/tools/descriptors/web-search.d.ts +15 -0
- package/dist/tools/descriptors/winter-list-agents.d.ts +1 -0
- package/dist/tools/descriptors/winter-send-message.d.ts +1 -0
- package/dist/tools/descriptors/workflow.d.ts +1 -0
- package/dist/tools/descriptors/write.d.ts +1 -0
- package/dist/tools/impl/_caller.d.ts +14 -0
- package/dist/tools/impl/_domains.d.ts +25 -0
- package/dist/tools/impl/_exa-client.d.ts +122 -0
- package/dist/tools/impl/_exa-session-client.d.ts +23 -0
- package/dist/tools/impl/_inner-model.d.ts +135 -0
- package/dist/tools/impl/_search-budget.d.ts +36 -0
- package/dist/tools/impl/_web-fetch-cache.d.ts +37 -0
- package/dist/tools/impl/_web-fetch-html.d.ts +26 -0
- package/dist/tools/impl/_web-fetch-net.d.ts +99 -0
- package/dist/tools/impl/_web-search-assembler.d.ts +57 -0
- package/dist/tools/impl/advisor.d.ts +37 -0
- package/dist/tools/impl/agent.d.ts +10 -0
- package/dist/tools/impl/ask-user-question.d.ts +5 -0
- package/dist/tools/impl/background-task-runtime.d.ts +272 -0
- package/dist/tools/impl/bash.d.ts +78 -0
- package/dist/tools/impl/cron.d.ts +11 -0
- package/dist/tools/impl/edit.d.ts +1 -0
- package/dist/tools/impl/enter-plan-mode.d.ts +4 -0
- package/dist/tools/impl/enter-worktree.d.ts +25 -0
- package/dist/tools/impl/exit-plan-mode.d.ts +4 -0
- package/dist/tools/impl/exit-worktree.d.ts +4 -0
- package/dist/tools/impl/glob.d.ts +1 -0
- package/dist/tools/impl/grep.d.ts +19 -0
- package/dist/tools/impl/index.d.ts +37 -0
- package/dist/tools/impl/list-agents.d.ts +7 -0
- package/dist/tools/impl/list-mcp-resources-tool.d.ts +9 -0
- package/dist/tools/impl/monitor.d.ts +66 -0
- package/dist/tools/impl/notebook-edit.d.ts +1 -0
- package/dist/tools/impl/push-notification.d.ts +4 -0
- package/dist/tools/impl/read-ladder.d.ts +25 -0
- package/dist/tools/impl/read-mcp-resource-dir-tool.d.ts +9 -0
- package/dist/tools/impl/read-mcp-resource-tool.d.ts +9 -0
- package/dist/tools/impl/read-notifications.d.ts +5 -0
- package/dist/tools/impl/read.d.ts +44 -0
- package/dist/tools/impl/refresh-mcp-tools.d.ts +8 -0
- package/dist/tools/impl/report-findings.d.ts +1 -0
- package/dist/tools/impl/schedule-wakeup.d.ts +2 -0
- package/dist/tools/impl/send-message.d.ts +7 -0
- package/dist/tools/impl/skill.d.ts +5 -0
- package/dist/tools/impl/task-graph.d.ts +1 -0
- package/dist/tools/impl/task-output.d.ts +16 -0
- package/dist/tools/impl/task-stop.d.ts +11 -0
- package/dist/tools/impl/todo-write.d.ts +8 -0
- package/dist/tools/impl/tool-search.d.ts +4 -0
- package/dist/tools/impl/wait-for-mcp-servers.d.ts +29 -0
- package/dist/tools/impl/web-fetch.d.ts +36 -0
- package/dist/tools/impl/web-search.d.ts +30 -0
- package/dist/tools/impl/workflow.d.ts +5 -0
- package/dist/tools/impl/write.d.ts +8 -0
- package/dist/tools/paths-seam.d.ts +6 -0
- package/dist/tools/read-state.d.ts +12 -0
- package/dist/tools/registry.d.ts +423 -0
- package/dist/tools/task-graph-store.d.ts +61 -0
- package/dist/toolsearch/aliases.d.ts +26 -0
- package/dist/toolsearch/exposure.d.ts +30 -0
- package/dist/toolsearch/ranking.d.ts +6 -0
- package/dist/toolsearch/search.d.ts +45 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/dist/web/fetchable-url.d.ts +28 -0
- package/dist/web/preapproved-hosts.d.ts +52 -0
- package/dist/web/private-address.d.ts +55 -0
- package/dist/web/session-runtime.d.ts +86 -0
- package/dist/workflows/bridge.d.ts +87 -0
- package/dist/workflows/budget.d.ts +24 -0
- package/dist/workflows/host-registry.d.ts +142 -0
- package/dist/workflows/journal.d.ts +29 -0
- package/dist/workflows/meta.d.ts +45 -0
- package/dist/workflows/registry.d.ts +24 -0
- package/dist/workflows/runtime.d.ts +254 -0
- package/dist/workflows/sandbox.d.ts +49 -0
- package/dist/workflows/script-api.d.ts +58 -0
- package/dist/workflows/seam.d.ts +92 -0
- package/dist/workflows/semaphore.d.ts +16 -0
- package/dist/workflows/store.d.ts +177 -0
- package/dist/workflows/subprocess-entry.d.ts +38 -0
- package/dist/workflows/subprocess-entry.js +14 -0
- package/dist/workflows/transcript.d.ts +56 -0
- package/dist/workflows/types.d.ts +84 -0
- package/dist/workflows/worker-harness.d.ts +45 -0
- package/package.json +76 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import type { RuntimeConfig } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
import { type SessionKey, type SessionStore, type SessionStoreEntry } from "@yanlinglabs/winter-agent-sdk";
|
|
3
|
+
import type { ContentBlock, ProviderMessage, SessionPersistence } from "../engine.js";
|
|
4
|
+
import type { CompactBoundaryRecord, CompactBoundaryWriteResult } from "../compaction/seam.js";
|
|
5
|
+
import { type DurableApprovalStore } from "../permissions/approvals.js";
|
|
6
|
+
import { type AutoCounterStore } from "../permissions/auto/caches.js";
|
|
7
|
+
import { type ProviderStateRecord, type ProviderStateRecordInput } from "./provider-state.js";
|
|
8
|
+
export interface ProviderStateSink {
|
|
9
|
+
append(input: ProviderStateRecordInput): Promise<ProviderStateRecord>;
|
|
10
|
+
load(): Promise<ProviderStateRecord[]>;
|
|
11
|
+
}
|
|
12
|
+
/** The neighbour-file sink: `<sessionId>.provider-state.jsonl`, 0600, append-only, fsync per record. */
|
|
13
|
+
export declare function createFileProviderStateSink(sidecarPath: string): ProviderStateSink;
|
|
14
|
+
/**
|
|
15
|
+
* The external-store sink. Records ride the `provider-state` subkey as ordinary `SessionStoreEntry`s.
|
|
16
|
+
*
|
|
17
|
+
* `load()` reads THAT KEY DIRECTLY and never calls `listSubkeys`: the method is optional on the
|
|
18
|
+
* pinned `SessionStore` and, when a host's adapter omits it, resume materialises only the main
|
|
19
|
+
* transcript -- so a chain discovered by enumeration is a chain that silently vanishes for half the
|
|
20
|
+
* hosts that could implement this interface.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createStoreProviderStateSink(store: SessionStore, key: {
|
|
23
|
+
projectKey: string;
|
|
24
|
+
sessionId: string;
|
|
25
|
+
}): ProviderStateSink;
|
|
26
|
+
/**
|
|
27
|
+
* R6-9 / WS-16 §4: the resolved provider identity a dialect record carries, so a resumed session can
|
|
28
|
+
* be told WHICH provider produced it without re-resolving.
|
|
29
|
+
*
|
|
30
|
+
* `authRefKind` is the credential ref's KIND and nothing else. R6-10 makes credential material a host
|
|
31
|
+
* responsibility that the SDK never persists, and this record is durable session state -- the kind is
|
|
32
|
+
* what a later reader needs ("this session authenticated from the keychain"), the material is what it
|
|
33
|
+
* must never find.
|
|
34
|
+
*/
|
|
35
|
+
export interface DialectProviderIdentity {
|
|
36
|
+
providerId: string;
|
|
37
|
+
modelKey: string;
|
|
38
|
+
/**
|
|
39
|
+
* WIDENED in review round 1 (I1): the four catalog/credential fields are OPTIONAL.
|
|
40
|
+
*
|
|
41
|
+
* The engine must be able to write an identity block from whatever it has -- and what it has is
|
|
42
|
+
* whatever its caller resolved. Requiring all four forced the alternative of fabricating
|
|
43
|
+
* `"unknown"` strings, which would put a claim in durable session state that nothing verified.
|
|
44
|
+
* `providerId`/`modelKey` stay required because they are what makes the block an IDENTITY at all,
|
|
45
|
+
* and they are what the resume side reads to tell "this session had provider state" from "this
|
|
46
|
+
* session predates the concept".
|
|
47
|
+
*/
|
|
48
|
+
adapterId?: string;
|
|
49
|
+
adapterVersion?: string;
|
|
50
|
+
catalogVersion?: string;
|
|
51
|
+
authRefKind?: string;
|
|
52
|
+
/** R6-14: the classifier identity PINNED by the session's first successful classification. */
|
|
53
|
+
classifierPin?: string;
|
|
54
|
+
}
|
|
55
|
+
/** One entry of the dialect record's `providerHistory` (R6-C: a swap is recorded, not only framed). */
|
|
56
|
+
export interface DialectProviderSwitch {
|
|
57
|
+
from: string;
|
|
58
|
+
to: string;
|
|
59
|
+
reason: "fallback" | "set_model" | "interrupt";
|
|
60
|
+
}
|
|
61
|
+
export type Block = ContentBlock;
|
|
62
|
+
export interface Chain {
|
|
63
|
+
parentUuid: string | null;
|
|
64
|
+
}
|
|
65
|
+
export interface SessionCtx {
|
|
66
|
+
sessionId: string;
|
|
67
|
+
cwd: string;
|
|
68
|
+
version: string;
|
|
69
|
+
projectDirName?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface DialectEntryBase {
|
|
72
|
+
type: string;
|
|
73
|
+
uuid: string;
|
|
74
|
+
parentUuid: string | null;
|
|
75
|
+
sessionId: string;
|
|
76
|
+
timestamp: string;
|
|
77
|
+
cwd: string;
|
|
78
|
+
version: string;
|
|
79
|
+
isSidechain: boolean;
|
|
80
|
+
[k: string]: unknown;
|
|
81
|
+
}
|
|
82
|
+
export interface SidechainStamp {
|
|
83
|
+
agentId: string;
|
|
84
|
+
parentToolUseId: string;
|
|
85
|
+
}
|
|
86
|
+
export type UserEntryOpts = {
|
|
87
|
+
chain: Chain;
|
|
88
|
+
ctx: SessionCtx;
|
|
89
|
+
sidechain?: SidechainStamp;
|
|
90
|
+
meta?: {
|
|
91
|
+
isMeta?: boolean;
|
|
92
|
+
origin?: {
|
|
93
|
+
kind: string;
|
|
94
|
+
[k: string]: unknown;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
} & ({
|
|
98
|
+
text: string;
|
|
99
|
+
} | {
|
|
100
|
+
content: Block[];
|
|
101
|
+
});
|
|
102
|
+
export declare function userEntry(opts: UserEntryOpts): DialectEntryBase & {
|
|
103
|
+
type: "user";
|
|
104
|
+
message: {
|
|
105
|
+
role: "user";
|
|
106
|
+
content: string | Block[];
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export declare function winterMessageIdFor(uuid: string): string;
|
|
110
|
+
export declare function assistantEntry(opts: {
|
|
111
|
+
content: Block[];
|
|
112
|
+
chain: Chain;
|
|
113
|
+
ctx: SessionCtx;
|
|
114
|
+
sidechain?: SidechainStamp;
|
|
115
|
+
/**
|
|
116
|
+
* Phase 6 Task 3 (R6-7): the PRE-ALLOCATED entry uuid.
|
|
117
|
+
*
|
|
118
|
+
* `baseFields` mints one unconditionally, which is exactly what write-ahead ordering cannot live
|
|
119
|
+
* with: the sidecar record has to name the entry's uuid BEFORE the entry exists, so the engine
|
|
120
|
+
* mints it and passes it down. Omitted by every pre-P6 caller -- the entry is then byte-identical
|
|
121
|
+
* to before this task.
|
|
122
|
+
*/
|
|
123
|
+
uuid?: string;
|
|
124
|
+
/**
|
|
125
|
+
* WS-23: claude's own assistant-entry fields, verbatim names -- `effort` is the top-level effort the
|
|
126
|
+
* request sent, `perTurnEffort` the level in force for the turn (they differ only under per-message
|
|
127
|
+
* effort). TOP-LEVEL entry fields, exactly where claude 2.1.282 writes them; spread conditionally so
|
|
128
|
+
* an entry written without them stays byte-identical (the goldens compare whole entries).
|
|
129
|
+
*/
|
|
130
|
+
effort?: string;
|
|
131
|
+
perTurnEffort?: string;
|
|
132
|
+
}): DialectEntryBase & {
|
|
133
|
+
type: "assistant";
|
|
134
|
+
message: {
|
|
135
|
+
id: string;
|
|
136
|
+
type: "message";
|
|
137
|
+
role: "assistant";
|
|
138
|
+
content: Block[];
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
export declare const COMPACT_SUMMARY_ENTRY_TYPE = "compact_summary";
|
|
142
|
+
export declare const COMPACT_BOUNDARY_ENTRY_TYPE = "compact_boundary";
|
|
143
|
+
export interface CompactMetadata {
|
|
144
|
+
trigger: "manual" | "auto";
|
|
145
|
+
pre_tokens: number;
|
|
146
|
+
post_tokens?: number;
|
|
147
|
+
duration_ms?: number;
|
|
148
|
+
preserved_messages?: {
|
|
149
|
+
anchor_uuid: string;
|
|
150
|
+
uuids: string[];
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
export declare function compactSummaryEntry(opts: {
|
|
154
|
+
summary: string;
|
|
155
|
+
chain: Chain;
|
|
156
|
+
ctx: SessionCtx;
|
|
157
|
+
sidechain?: SidechainStamp;
|
|
158
|
+
}): DialectEntryBase & {
|
|
159
|
+
type: "compact_summary";
|
|
160
|
+
message: {
|
|
161
|
+
role: "user";
|
|
162
|
+
content: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
export declare function compactBoundaryEntry(opts: {
|
|
166
|
+
metadata: CompactMetadata;
|
|
167
|
+
chain: Chain;
|
|
168
|
+
ctx: SessionCtx;
|
|
169
|
+
sidechain?: SidechainStamp;
|
|
170
|
+
}): DialectEntryBase & {
|
|
171
|
+
type: "compact_boundary";
|
|
172
|
+
compact_metadata: CompactMetadata;
|
|
173
|
+
};
|
|
174
|
+
export declare const CLAUDE_COMPACT_SUMMARY_PREAMBLE = "This session is being continued from a previous conversation that ran out of context. The summary below covers the earlier portion of the conversation.";
|
|
175
|
+
/**
|
|
176
|
+
* Fix round 1 (controller ruling, LOAD-BEARING): the live engine's in-memory history and a cold
|
|
177
|
+
* resume's rebuilt history must never diverge after a compaction. `recordCompactBoundary` below
|
|
178
|
+
* computes exactly which conversational uuids the live run retained (`preserved`) -- omitting them
|
|
179
|
+
* from the persisted boundary (as the original P10b-7 comment here did) meant the LIVE session kept
|
|
180
|
+
* seeing its retained tail for the rest of that run while a COLD RESUME rebuilt only the summary,
|
|
181
|
+
* silently losing that tail forever the instant the process restarted. `anchorUuid`/`uuids` and their
|
|
182
|
+
* ordering are byte-exact to the real capture (`conformance/goldens/claude-2.1.250/compaction.jsonl`)
|
|
183
|
+
* -- `anchorUuid` names the summary (the entries in `uuids` relink AFTER it, never before), which is
|
|
184
|
+
* also exactly the retained set's own natural anchor: the summary IS the first surviving entry.
|
|
185
|
+
*/
|
|
186
|
+
export interface ClaudeCompactPreservedMessages {
|
|
187
|
+
anchorUuid: string;
|
|
188
|
+
uuids: string[];
|
|
189
|
+
}
|
|
190
|
+
export interface ClaudeCompactMetadata {
|
|
191
|
+
trigger: "manual" | "auto";
|
|
192
|
+
preTokens: number;
|
|
193
|
+
postTokens?: number;
|
|
194
|
+
durationMs?: number;
|
|
195
|
+
preservedMessages?: ClaudeCompactPreservedMessages;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The boundary half of Claude's native compaction shape (W18-12). A SECOND `parentUuid: null` root
|
|
199
|
+
* BY DESIGN (I-5 is worded to allow exactly this) -- `logicalParentUuid` is the backward-looking link
|
|
200
|
+
* to the pre-compaction leaf, which is what lets a transcript reader (and claude itself) find where
|
|
201
|
+
* the cut happened without the boundary sitting IN the chain it cuts.
|
|
202
|
+
*/
|
|
203
|
+
export declare function claudeCompactBoundaryEntry(opts: {
|
|
204
|
+
trigger: "manual" | "auto";
|
|
205
|
+
preTokens: number;
|
|
206
|
+
postTokens?: number;
|
|
207
|
+
durationMs?: number;
|
|
208
|
+
/** The pre-compaction chain's own leaf uuid -- never this entry's OWN chain parent (that is always `null`). */
|
|
209
|
+
logicalParentUuid: string;
|
|
210
|
+
/**
|
|
211
|
+
* Fix round 1: OMITTED entirely (never an empty `{uuids: []}`) when nothing was retained --
|
|
212
|
+
* absence stays semantic ("compaction summarized everything"), matching the golden and the reader
|
|
213
|
+
* (`resume.ts`) both.
|
|
214
|
+
*/
|
|
215
|
+
preservedMessages?: ClaudeCompactPreservedMessages;
|
|
216
|
+
ctx: SessionCtx;
|
|
217
|
+
}): DialectEntryBase & {
|
|
218
|
+
type: "system";
|
|
219
|
+
subtype: "compact_boundary";
|
|
220
|
+
content: "Conversation compacted";
|
|
221
|
+
level: "info";
|
|
222
|
+
logicalParentUuid: string;
|
|
223
|
+
compactMetadata: ClaudeCompactMetadata;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* The summary half: a CONVERSATIONAL `user` entry (it carries a `message`, unlike the boundary),
|
|
227
|
+
* parented ON the boundary -- `resume.ts`'s ancestry walk stops at the boundary's own `null` parent,
|
|
228
|
+
* so this is the first entry a resumed lineage actually rebuilds into provider history.
|
|
229
|
+
*/
|
|
230
|
+
export declare function claudeCompactSummaryEntry(opts: {
|
|
231
|
+
summary: string;
|
|
232
|
+
boundaryUuid: string;
|
|
233
|
+
ctx: SessionCtx;
|
|
234
|
+
/**
|
|
235
|
+
* Fix round 1: a PRE-ALLOCATED entry uuid, mirroring `assistantEntry`'s own write-ahead pattern
|
|
236
|
+
* (R6-7). `recordCompactBoundary` needs the summary's uuid to name it as the boundary's OWN
|
|
237
|
+
* `compactMetadata.preservedMessages.anchorUuid` -- but the boundary is written FIRST (W18-12's
|
|
238
|
+
* order) -- so it mints this uuid before either entry exists and passes it to both. Omitted ->
|
|
239
|
+
* a fresh uuid is minted here, byte-identical to every pre-fix-round-1 caller.
|
|
240
|
+
*/
|
|
241
|
+
uuid?: string;
|
|
242
|
+
}): DialectEntryBase & {
|
|
243
|
+
type: "user";
|
|
244
|
+
message: {
|
|
245
|
+
role: "user";
|
|
246
|
+
content: string;
|
|
247
|
+
};
|
|
248
|
+
isCompactSummary: true;
|
|
249
|
+
isVisibleInTranscriptOnly: true;
|
|
250
|
+
};
|
|
251
|
+
/** Lane S's `invoked_skills` (skills/attachment.ts) -- the one authority on the payload shape. */
|
|
252
|
+
export declare const INVOKED_SKILLS_ENTRY_TYPE = "invoked_skills";
|
|
253
|
+
/**
|
|
254
|
+
* Lane K's checkpoint records (checkpoint/file-history.ts's `CheckpointRecord`), one entry per
|
|
255
|
+
* intercepted mutation.
|
|
256
|
+
*
|
|
257
|
+
* WHAT THIS DOES AND DOES NOT CHANGE, stated plainly because rider 16 asks for more than this
|
|
258
|
+
* lands. Lane K's concern 1 named ONE cost of the private sidecar: "a transcript reader cannot see
|
|
259
|
+
* that a rewind is possible". That cost is what this closes -- the record is now visible to anyone
|
|
260
|
+
* reading the session's own transcript. `<home>/backups/<session>/index.jsonl` REMAINS the rewind's
|
|
261
|
+
* read authority, and rider 16's "retire the sidecar" half is NOT done. Two concrete blockers, both
|
|
262
|
+
* behavioural rather than cosmetic:
|
|
263
|
+
*
|
|
264
|
+
* 1. SCOPING -- CORRECTED IN THE FIX WAVE (B-M2). This used to say the seam's `req.sessionUuid`
|
|
265
|
+
* is "how a child engine's edits land in the CHILD's subtree", and that routing records through
|
|
266
|
+
* the sink's single parent `SessionPersistence` would move them into the parent's. Both halves
|
|
267
|
+
* were wrong, and checking beats reasoning here:
|
|
268
|
+
*
|
|
269
|
+
* * A CHILD HAS NO SINK AT ALL. `fileCheckpointSink` is in `production-wiring.ts`'s
|
|
270
|
+
* `engineOptions` and NOT in its `childFactoryOptions`, so in a child engine it is
|
|
271
|
+
* `undefined` and the `beforeMutation` call site never runs. There are no child records to
|
|
272
|
+
* misroute.
|
|
273
|
+
* * AND IF THERE WERE, `sessionUuid` WOULD NOT SEPARATE THEM. The engine stamps
|
|
274
|
+
* `sessionUuid: config.sessionId`, and a child's `config.sessionId` IS the owning parent's
|
|
275
|
+
* (`runCtx.parentSessionId` -- Phase 4's I1, deliberate, and every session-keyed registry
|
|
276
|
+
* downstream reads it that way). The seam field the old text called the scoping mechanism
|
|
277
|
+
* carries the parent's identity in both engines.
|
|
278
|
+
*
|
|
279
|
+
* So the real blocker is the inverse of the one recorded: giving children a sink needs a
|
|
280
|
+
* scoping key that DOES distinguish them (the `agentId`, which `childTranscriptSubpath` already
|
|
281
|
+
* uses for the child's own transcript) before any routing question arises at all.
|
|
282
|
+
* 2. THE READ PATH. `rewindToCheckpoint` is synchronous and reads `index.jsonl` next to the blobs
|
|
283
|
+
* it names; `SessionPersistence` is an append-only write sink with no read surface at all, and
|
|
284
|
+
* the store's own reader is async.
|
|
285
|
+
*
|
|
286
|
+
* So the two are deliberately asymmetric and each says what it is: the transcript entry is the
|
|
287
|
+
* READABLE record, the sidecar is the OPERATIONAL index co-located with the blobs. Nothing reads the
|
|
288
|
+
* transcript entry for behaviour, which is what keeps this from being a second producer of a
|
|
289
|
+
* consumed value -- it is the same shape `recordHookAudit` already has.
|
|
290
|
+
*/
|
|
291
|
+
export declare const FILE_HISTORY_ENTRY_TYPE_BY_KIND: {
|
|
292
|
+
readonly snapshot: "file-history-snapshot";
|
|
293
|
+
readonly delta: "file-history-delta";
|
|
294
|
+
};
|
|
295
|
+
/** Lane K's `CheckpointRecord`, verbatim -- this module never reshapes it. */
|
|
296
|
+
export interface FileHistoryEntryPayload {
|
|
297
|
+
kind: "snapshot" | "delta";
|
|
298
|
+
userMessageUuid: string;
|
|
299
|
+
path: string;
|
|
300
|
+
pathHash: string;
|
|
301
|
+
tool: string;
|
|
302
|
+
at: string;
|
|
303
|
+
version: number;
|
|
304
|
+
absent?: boolean;
|
|
305
|
+
parentRealPath?: string;
|
|
306
|
+
anchorPath?: string;
|
|
307
|
+
anchorRealPath?: string;
|
|
308
|
+
}
|
|
309
|
+
export declare function invokedSkillsEntry(opts: {
|
|
310
|
+
attachment: {
|
|
311
|
+
type: string;
|
|
312
|
+
skills: unknown[];
|
|
313
|
+
};
|
|
314
|
+
chain: Chain;
|
|
315
|
+
ctx: SessionCtx;
|
|
316
|
+
sidechain?: SidechainStamp;
|
|
317
|
+
}): DialectEntryBase & {
|
|
318
|
+
type: "invoked_skills";
|
|
319
|
+
skills: unknown[];
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* SDK 0.0.16 (P16-5/P16-6): claude 0.3.250's persisted ATTACHMENT entry --
|
|
323
|
+
* `{type: "attachment", attachment: {type, ...payload}, uuid, parentUuid, ...}`, captured from the
|
|
324
|
+
* pinned binary's own transcript. No `message` field: the model-facing text is rendered from the
|
|
325
|
+
* payload on resume (store/resume.ts, through context/attachments.ts), exactly as claude does.
|
|
326
|
+
*/
|
|
327
|
+
export declare const ATTACHMENT_ENTRY_TYPE = "attachment";
|
|
328
|
+
export declare function attachmentEntry(opts: {
|
|
329
|
+
attachment: {
|
|
330
|
+
type: string;
|
|
331
|
+
[key: string]: unknown;
|
|
332
|
+
};
|
|
333
|
+
chain: Chain;
|
|
334
|
+
ctx: SessionCtx;
|
|
335
|
+
sidechain?: SidechainStamp;
|
|
336
|
+
}): DialectEntryBase & {
|
|
337
|
+
type: "attachment";
|
|
338
|
+
attachment: {
|
|
339
|
+
type: string;
|
|
340
|
+
[key: string]: unknown;
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
export declare function fileHistoryEntry(opts: {
|
|
344
|
+
record: FileHistoryEntryPayload;
|
|
345
|
+
chain: Chain;
|
|
346
|
+
ctx: SessionCtx;
|
|
347
|
+
sidechain?: SidechainStamp;
|
|
348
|
+
}): DialectEntryBase & {
|
|
349
|
+
type: string;
|
|
350
|
+
file_history: FileHistoryEntryPayload;
|
|
351
|
+
};
|
|
352
|
+
export declare class TranscriptWriterError extends Error {
|
|
353
|
+
constructor(message: string);
|
|
354
|
+
}
|
|
355
|
+
export interface TranscriptWriterOptions {
|
|
356
|
+
store: SessionStore;
|
|
357
|
+
key: SessionKey;
|
|
358
|
+
ctx: SessionCtx;
|
|
359
|
+
initialParentUuid?: string | null;
|
|
360
|
+
sidechain?: SidechainStamp;
|
|
361
|
+
initialConversationalUuids?: readonly string[];
|
|
362
|
+
/**
|
|
363
|
+
* Phase 6 Task 3 (R6-7): where this session's provider-state records go. Omitted -> the session
|
|
364
|
+
* keeps an IN-MEMORY chain only, which is the honest state for a writer with no durable home for
|
|
365
|
+
* one (and byte-identical to every pre-P6 writer).
|
|
366
|
+
*/
|
|
367
|
+
providerStateSink?: ProviderStateSink;
|
|
368
|
+
}
|
|
369
|
+
export declare class TranscriptWriter implements SessionPersistence {
|
|
370
|
+
private readonly store;
|
|
371
|
+
private readonly key;
|
|
372
|
+
private readonly ctx;
|
|
373
|
+
private readonly sidechain;
|
|
374
|
+
private parentUuid;
|
|
375
|
+
private readonly conversationalUuids;
|
|
376
|
+
private readonly providerStateSink;
|
|
377
|
+
private providerIdentity;
|
|
378
|
+
private readonly providerHistory;
|
|
379
|
+
constructor(opts: TranscriptWriterOptions);
|
|
380
|
+
recordUserEntry(content: string | Block[], opts?: {
|
|
381
|
+
isMeta?: boolean;
|
|
382
|
+
origin?: {
|
|
383
|
+
kind: string;
|
|
384
|
+
[k: string]: unknown;
|
|
385
|
+
};
|
|
386
|
+
}): Promise<void>;
|
|
387
|
+
recordAssistantEntry(content: Block[], opts?: {
|
|
388
|
+
uuid?: string;
|
|
389
|
+
effort?: string;
|
|
390
|
+
perTurnEffort?: string;
|
|
391
|
+
}): Promise<void>;
|
|
392
|
+
/**
|
|
393
|
+
* SDK 0.0.16: one persisted attachment. It is CONVERSATIONAL -- it is a message in the engine's
|
|
394
|
+
* history -- so it is tracked with the user/assistant entries, which keeps a compaction boundary's
|
|
395
|
+
* preserved-message uuids aligned with the retained history.
|
|
396
|
+
*/
|
|
397
|
+
recordAttachmentEntry(attachment: {
|
|
398
|
+
type: string;
|
|
399
|
+
[key: string]: unknown;
|
|
400
|
+
}): Promise<void>;
|
|
401
|
+
/**
|
|
402
|
+
* Appends one sidecar record. Called BEFORE `recordAssistantEntry` for the same `anchorUuid`.
|
|
403
|
+
*
|
|
404
|
+
* A writer with no sink (a bare test fixture, a store shape with nowhere to put it) records
|
|
405
|
+
* nothing and says so by returning `undefined` -- never an error, matching the whole seam's
|
|
406
|
+
* "entirely optional" contract. The chain is then in-memory only for that run.
|
|
407
|
+
*/
|
|
408
|
+
recordProviderState(record: ProviderStateRecordInput): Promise<void>;
|
|
409
|
+
loadProviderState(): Promise<ProviderStateRecord[]>;
|
|
410
|
+
/**
|
|
411
|
+
* Review round 1 (I1): did THIS session ever record a provider identity?
|
|
412
|
+
*
|
|
413
|
+
* The one question that separates R6-7's two indistinguishable-looking resumes. A session with no
|
|
414
|
+
* records could be pre-P6 (nothing to degrade from, resume silently) or one whose sidecar was
|
|
415
|
+
* DELETED (every message degraded, and the user deserves to be told). The identity block is the
|
|
416
|
+
* marker that tells them apart, and it lives in the summary sidecar because that is where the
|
|
417
|
+
* store folds every dialect record.
|
|
418
|
+
*
|
|
419
|
+
* Read through the store's OWN per-session reader rather than by re-deriving the summary path here:
|
|
420
|
+
* this writer already holds the key the store resolves paths from, and a second path derivation is
|
|
421
|
+
* the drift `providerStateSidecarPath` exists to avoid.
|
|
422
|
+
*
|
|
423
|
+
* `readSessionSummary` is a Winter-only capability on the concrete store, reached through a LOCAL
|
|
424
|
+
* intersection type so the pinned six-member `SessionStore` surface stays untouched (the same
|
|
425
|
+
* pattern `resume.ts` uses for `listProjectKeys`). It replaces a `listSessionSummaries` scan that
|
|
426
|
+
* read and parsed EVERY summary in the project directory -- O(#sessions) on every resume, paid by
|
|
427
|
+
* the busiest projects (review round 2, M2). A store without it degrades to `undefined`, which
|
|
428
|
+
* reads as "unknown" and keeps the resume silent rather than guessing.
|
|
429
|
+
*/
|
|
430
|
+
loadProviderIdentity(): Promise<{
|
|
431
|
+
providerId: string;
|
|
432
|
+
modelKey: string;
|
|
433
|
+
} | undefined>;
|
|
434
|
+
/**
|
|
435
|
+
* R6-9: the resolved provider identity every subsequent dialect record carries.
|
|
436
|
+
*
|
|
437
|
+
* SET, not appended: the identity is the session's CURRENT one, and `appendWithDialectRecord`'s
|
|
438
|
+
* own stateless/self-healing contract means the freshest value simply wins on the next append.
|
|
439
|
+
* A model swap is recorded separately, in `providerHistory`, because that is a HISTORY and
|
|
440
|
+
* overwriting it would erase the very thing it exists to preserve.
|
|
441
|
+
*/
|
|
442
|
+
setProviderIdentity(identity: DialectProviderIdentity): void;
|
|
443
|
+
/** R6-C: records a model swap in the dialect record's `providerHistory`, alongside the Winter-only `system/model_switch` frame the engine emits. */
|
|
444
|
+
recordProviderSwitch(entry: DialectProviderSwitch): void;
|
|
445
|
+
/**
|
|
446
|
+
* Appends the dialect record ALONE -- no transcript entry beside it.
|
|
447
|
+
*
|
|
448
|
+
* The store partitions `DIALECT_RECORD_ENTRY_TYPE` out of the jsonl by construction and folds its
|
|
449
|
+
* fields into the summary sidecar, and `append()` explicitly allows a batch with zero native
|
|
450
|
+
* entries. So this writes the identity block and nothing else, which is exactly what a FORK needs:
|
|
451
|
+
* its transcript is already a byte-for-byte copy of the source's, and re-appending an entry to
|
|
452
|
+
* carry the block would corrupt the chain it just copied (review round 2, M3).
|
|
453
|
+
*/
|
|
454
|
+
stampDialectRecord(): Promise<void>;
|
|
455
|
+
private trackConversational;
|
|
456
|
+
recordCompactBoundary(record: CompactBoundaryRecord): Promise<CompactBoundaryWriteResult>;
|
|
457
|
+
/**
|
|
458
|
+
* Phase 5 Task 8 (rider 16): Lane S's `invoked_skills` attachment, as a real transcript entry.
|
|
459
|
+
*
|
|
460
|
+
* Lane S's NEEDS_CONTEXT 1: the payload went to `SkillSessionRuntime.onInvoked`, a HOST sink, and
|
|
461
|
+
* with no entry the record existed only for as long as the host chose to keep it. Nothing else
|
|
462
|
+
* about the payload changes -- `skills/attachment.ts` is still its one producer.
|
|
463
|
+
*/
|
|
464
|
+
recordInvokedSkills(attachment: {
|
|
465
|
+
type: string;
|
|
466
|
+
skills: unknown[];
|
|
467
|
+
}): Promise<void>;
|
|
468
|
+
/**
|
|
469
|
+
* Phase 5 Task 8 (riders 9/16): one checkpoint record, as a transcript entry. See
|
|
470
|
+
* `FILE_HISTORY_ENTRY_TYPE_BY_KIND`'s own header for exactly what this closes and what it does
|
|
471
|
+
* NOT (the sidecar remains the rewind's read authority).
|
|
472
|
+
*/
|
|
473
|
+
recordFileHistory(record: FileHistoryEntryPayload): Promise<void>;
|
|
474
|
+
writeMetadata(metadata: Record<string, unknown>): Promise<void>;
|
|
475
|
+
flush(): Promise<void>;
|
|
476
|
+
private appendWithDialectRecord;
|
|
477
|
+
/** The dialect record this writer stamps beside every append. Factored out so the fork path can write it ALONE (`stampDialectRecord`). */
|
|
478
|
+
private dialectRecord;
|
|
479
|
+
static readBack(store: SessionStore, key: SessionKey): Promise<SessionStoreEntry[]>;
|
|
480
|
+
}
|
|
481
|
+
export declare const RUNTIME_ENGINE_VERSION = "0.0.27";
|
|
482
|
+
export interface ResolvedEngineSession {
|
|
483
|
+
config: RuntimeConfig;
|
|
484
|
+
store: SessionPersistence | undefined;
|
|
485
|
+
initialMessages: ProviderMessage[];
|
|
486
|
+
approvalStore?: DurableApprovalStore;
|
|
487
|
+
autoStateStore?: AutoCounterStore;
|
|
488
|
+
}
|
|
489
|
+
export declare function childTranscriptSubpath(agentId: string): string;
|
|
490
|
+
export interface ChildTranscriptWriterOptions {
|
|
491
|
+
store: SessionStore;
|
|
492
|
+
projectKey: string;
|
|
493
|
+
parentSessionId: string;
|
|
494
|
+
agentId: string;
|
|
495
|
+
parentToolUseId: string;
|
|
496
|
+
cwd: string;
|
|
497
|
+
/** Phase 6 Task 3 (R6-7): the resolved winter root, so the child's provider-state sidecar can be located beside the child's own transcript. Omitted -> that child keeps an in-memory chain only. */
|
|
498
|
+
winterHome?: string;
|
|
499
|
+
}
|
|
500
|
+
export declare function buildChildTranscriptWriter(opts: ChildTranscriptWriterOptions): TranscriptWriter;
|
|
501
|
+
export declare function listChildAgentIds(store: SessionStore, key: {
|
|
502
|
+
projectKey: string;
|
|
503
|
+
sessionId: string;
|
|
504
|
+
}): Promise<string[]>;
|
|
505
|
+
export declare function resolveEngineSession(opts: {
|
|
506
|
+
config: RuntimeConfig;
|
|
507
|
+
resolveWinterHome: () => string;
|
|
508
|
+
/**
|
|
509
|
+
* WS-21 §3.7/§6.3 item 3 (durable-write audit, fix round 2): the shared STORE home, when this
|
|
510
|
+
* incarnation has one -- called ONLY when persistence is active, same discipline as
|
|
511
|
+
* `resolveWinterHome`'s own thunk (a caller that wants "never touch the real environment unless a
|
|
512
|
+
* session actually persists" must be able to defer this too). Every durable write this function
|
|
513
|
+
* makes (the transcript store, the provider-state sidecar, the permission journal, the approval
|
|
514
|
+
* store, the auto-counter store) anchors on THIS value, never on `resolveWinterHome`'s own return
|
|
515
|
+
* -- `winterHome` is the per-run folder (WS-21 §2.1: deleted after the run), and a durable write
|
|
516
|
+
* rooted there is durable in name only. Omitted, or returning `undefined`, degrades to
|
|
517
|
+
* `winterHome` itself: byte-identical to every pre-WS-21 caller (`testing.ts`'s in-memory leg,
|
|
518
|
+
* deliberately -- its own hermetic root is already the single source of truth for a virtual
|
|
519
|
+
* session, and splitting it further would buy that leg nothing while adding a second root a test
|
|
520
|
+
* could disagree with itself about).
|
|
521
|
+
*/
|
|
522
|
+
resolveStoreHome?: () => string | undefined;
|
|
523
|
+
env: Record<string, string | undefined>;
|
|
524
|
+
}): Promise<ResolvedEngineSession>;
|
|
525
|
+
export declare function resolveProductionWinterHome(config: RuntimeConfig, env: Record<string, string | undefined>): string;
|
|
526
|
+
export declare function resolveProductionStoreHome(config: RuntimeConfig, env: Record<string, string | undefined>): string | undefined;
|