@yanlinglabs/winter-runtime-sdk 0.0.1
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/README.md +249 -0
- package/dist/directory/directory.d.ts +55 -0
- package/dist/directory/entries.d.ts +82 -0
- package/dist/directory/recovery.d.ts +49 -0
- package/dist/door.d.ts +247 -0
- package/dist/errors.d.ts +104 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +6679 -0
- package/dist/messaging/attribution.d.ts +47 -0
- package/dist/messaging/dispatch.d.ts +78 -0
- package/dist/messaging/handlers.d.ts +56 -0
- package/dist/messaging/inbound.d.ts +110 -0
- package/dist/messaging/index.d.ts +39 -0
- package/dist/messaging/official-adapter.d.ts +36 -0
- package/dist/messaging/router.d.ts +101 -0
- package/dist/messaging/sessions.d.ts +49 -0
- package/dist/messaging/winter-adapter.d.ts +47 -0
- package/dist/native-args.d.ts +76 -0
- package/dist/official/adapter.d.ts +88 -0
- package/dist/official/aliases.d.ts +48 -0
- package/dist/official/auth.d.ts +117 -0
- package/dist/official/branding.d.ts +31 -0
- package/dist/official/callbacks.d.ts +143 -0
- package/dist/official/containment.d.ts +130 -0
- package/dist/official/env-allowlist.d.ts +237 -0
- package/dist/official/env-registry-rule.d.ts +12 -0
- package/dist/official/env-registry.d.ts +3 -0
- package/dist/official/errors.d.ts +250 -0
- package/dist/official/index.d.ts +31 -0
- package/dist/official/mcp-descriptors.d.ts +130 -0
- package/dist/official/options-template.d.ts +110 -0
- package/dist/official/spawn-proxy.d.ts +144 -0
- package/dist/official/spool.d.ts +80 -0
- package/dist/official/supervision.d.ts +49 -0
- package/dist/official/sweep.d.ts +65 -0
- package/dist/sdk.d.ts +214 -0
- package/dist/seams/context.d.ts +26 -0
- package/dist/seams/directory-store.d.ts +274 -0
- package/dist/seams/directory.d.ts +46 -0
- package/dist/seams/global-messaging.d.ts +30 -0
- package/dist/seams/handoff.d.ts +77 -0
- package/dist/seams/index.d.ts +11 -0
- package/dist/seams/keychain.d.ts +11 -0
- package/dist/seams/materialized-resume.d.ts +46 -0
- package/dist/seams/messaging-contract.d.ts +29 -0
- package/dist/seams/official-adapter.d.ts +125 -0
- package/dist/seams/official-sdk-shapes.d.ts +126 -0
- package/dist/seams/stubs.d.ts +34 -0
- package/dist/selection/child-runtime.d.ts +81 -0
- package/dist/selection/runtime-selection.d.ts +217 -0
- package/dist/selection/select-runtime.d.ts +213 -0
- package/dist/store/handoff-barrier.d.ts +238 -0
- package/dist/store/index.d.ts +11 -0
- package/dist/store/materialized-resume.d.ts +100 -0
- package/dist/store/pinned-probes.d.ts +17 -0
- package/dist/store/reconcile.d.ts +157 -0
- package/dist/store/temp-continuity.d.ts +92 -0
- package/dist/store/wiring.d.ts +250 -0
- package/dist/vendor-paths.d.ts +21 -0
- package/dist/version-matrix.d.ts +84 -0
- package/docs/conformance-rows.md +195 -0
- package/package.json +65 -0
package/dist/door.d.ts
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import type { BrandProfile, CredentialRef, Options, ProviderSelection, Query } from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
import type { GlobalMessagingHandle } from "./messaging/router.js";
|
|
3
|
+
import type { ContainmentPolicy } from "./official/containment.js";
|
|
4
|
+
import { type OfficialPermissionMode } from "./official/callbacks.js";
|
|
5
|
+
import { type OfficialEnvPolicy } from "./official/env-allowlist.js";
|
|
6
|
+
import { type AuthCredentialPlan } from "./official/auth.js";
|
|
7
|
+
import { type OptionsTemplatePolicy } from "./official/options-template.js";
|
|
8
|
+
import type { RuntimeDirectory } from "./seams/directory.js";
|
|
9
|
+
import type { OfficialAdapter, RemoteConfigPolicy } from "./seams/official-adapter.js";
|
|
10
|
+
import type { OfficialQuery, OfficialUserMessage } from "./seams/official-sdk-shapes.js";
|
|
11
|
+
import type { RuntimeKind, RuntimeSelection } from "./selection/runtime-selection.js";
|
|
12
|
+
import type { SharedSessionStore } from "./store/wiring.js";
|
|
13
|
+
/**
|
|
14
|
+
* What the door returns.
|
|
15
|
+
*
|
|
16
|
+
* A UNION, BECAUSE THE TWO LEGS RETURN THEIR OWN RUNTIME'S HANDLE AND NEITHER IS THE OTHER. The Winter
|
|
17
|
+
* `Query` carries `messaging` and `listModelFamilies`, which the pinned official `Query` does not have
|
|
18
|
+
* and this package will not fake; the official one carries a dozen members the router deliberately
|
|
19
|
+
* does not name (it never imports the vendor's types onto its published surface — see
|
|
20
|
+
* `seams/official-sdk-shapes.ts`). Collapsing them into one type would mean either a wrapper that
|
|
21
|
+
* translates — the one thing D19b says this package must not be — or a declared type that lies.
|
|
22
|
+
*
|
|
23
|
+
* A HOST PAYS NOTHING FOR THIS UNLESS IT ASKS FOR IT: `query()` is overloaded so that a call with no
|
|
24
|
+
* runtime input is typed `Query`, which is sound because the official leg is reachable ONLY through a
|
|
25
|
+
* runtime input. A host that passes one knows which runtime it selected and narrows accordingly.
|
|
26
|
+
*/
|
|
27
|
+
export type RouterQuery = Query | OfficialQuery;
|
|
28
|
+
/** True for a handle THIS package opened on the official leg. Registry-based: nothing is sniffed. */
|
|
29
|
+
export declare function isOfficialQuery(value: RouterQuery): value is OfficialQuery;
|
|
30
|
+
/**
|
|
31
|
+
* The official leg's host-owned inputs, carried on `RouterOptions.runtime.official`.
|
|
32
|
+
*
|
|
33
|
+
* EVERY FIELD IS SOMETHING ONLY THE HOST KNOWS. The router will not guess a session id (the directory
|
|
34
|
+
* row's identity), invent an auto-memory directory (WS-14 §2's ONE shared directory is a host-wide
|
|
35
|
+
* decision), or resolve a vendored runtime path (§5.1: "never the user's installed binary" is only
|
|
36
|
+
* enforceable if the host names the copy it vendored).
|
|
37
|
+
*/
|
|
38
|
+
export interface RouterOfficialInput {
|
|
39
|
+
/**
|
|
40
|
+
* This session's Winter session id. Its directory address is `session:<id>`.
|
|
41
|
+
*
|
|
42
|
+
* REQUIRED, and it is the one field with no plausible default: §6 rule 2's durable record is written
|
|
43
|
+
* onto this address, the messaging registry attaches under it, and a listed object that no model can
|
|
44
|
+
* send to is worse than no listing at all (`UnaddressableEntryError`'s own note).
|
|
45
|
+
*/
|
|
46
|
+
sessionId: string;
|
|
47
|
+
/**
|
|
48
|
+
* R-7b-1: this session is a CHILD of `parentSessionId`, on its own runtime.
|
|
49
|
+
*
|
|
50
|
+
* "A child runs on the runtime its OWN slot's family selects at spawn time, independent of the
|
|
51
|
+
* parent's runtime" — so a `claude`-family child of a Winter parent is not a native subagent inside
|
|
52
|
+
* another official process, it is an official session in its own right, addressed as
|
|
53
|
+
* `agent:<parent>:<sessionId>` with `transport: "claude-handle"`. That transport is the field WS-15
|
|
54
|
+
* §6.1 uses to tell the two apart, and Lane B's official adapter branches on it: a `claude-handle`
|
|
55
|
+
* child is delivered to DIRECTLY, a `claude-child` only through its owning parent.
|
|
56
|
+
*
|
|
57
|
+
* Absent = a top-level session, addressed `session:<sessionId>`.
|
|
58
|
+
*/
|
|
59
|
+
parentSessionId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Secret variables for families whose mapping this module cannot derive — a cloud credential chain,
|
|
62
|
+
* or a `custom` family, whose set is open by design (WS-14 §12).
|
|
63
|
+
*
|
|
64
|
+
* Each entry is a NAME and a REF, never material: the read happens at spawn, through the host's own
|
|
65
|
+
* `KeychainSeam`, and nothing here holds the answer.
|
|
66
|
+
*/
|
|
67
|
+
credentials?: readonly AuthCredentialPlan[];
|
|
68
|
+
/**
|
|
69
|
+
* NON-SECRET family variables: a gateway's `ANTHROPIC_BASE_URL`, a region, a project.
|
|
70
|
+
*
|
|
71
|
+
* Separate from `credentials` because they are not secrets and must not travel through a keychain
|
|
72
|
+
* read — and because §12's gateway caveat ("set the full credential pair or neither") is checked
|
|
73
|
+
* across both halves by the auth validator, whichever side each variable came from.
|
|
74
|
+
*/
|
|
75
|
+
connectionEnv?: Readonly<Record<string, string>>;
|
|
76
|
+
/** §3's minimal OS set. Build it with `minimalOsEnvironmentFrom(process.env)` at the host's call site. */
|
|
77
|
+
base?: Readonly<Record<string, string>>;
|
|
78
|
+
/** §2's ONE shared auto-memory directory, identical for both branches. */
|
|
79
|
+
autoMemoryDirectory?: string;
|
|
80
|
+
/** §3's `CLAUDE_CODE_PROJECT_DIR_NAME` — Winter's stable transcript key. Defaults to `sessionId`. */
|
|
81
|
+
projectKey?: string;
|
|
82
|
+
/** §3's `CLAUDE_CODE_TMPDIR` — the shared per-user temp root the host derives from the brand. */
|
|
83
|
+
sharedTempRoot?: string;
|
|
84
|
+
/** §11's servers, already materialized by the host (`officialMcpServers`). */
|
|
85
|
+
mcpServers?: Readonly<Record<string, unknown>>;
|
|
86
|
+
/** §1 profile 2's staging root. Defaults to the vendor's own `<tmpdir>/claude-resume-<resume id>`. */
|
|
87
|
+
stagingRoot?: string;
|
|
88
|
+
/** §1 profile 1's spool. Defaults to `<winter home>/runtimes/official-agent-spool`. */
|
|
89
|
+
spool?: string;
|
|
90
|
+
/**
|
|
91
|
+
* §5: `"eager"` mirroring for a session that advertises cross-runtime handoff. DEFAULT TRUE here,
|
|
92
|
+
* because a session the ROUTER created is one `sdk.handoff()` can be called on by construction.
|
|
93
|
+
*/
|
|
94
|
+
advertisesHandoff?: boolean;
|
|
95
|
+
/** R-7b-11: `"allow"` lets this session's child fetch the runtime's remote feature configuration. */
|
|
96
|
+
remoteConfig?: RemoteConfigPolicy;
|
|
97
|
+
/** The display name this session answers to in `ListAgents`. */
|
|
98
|
+
displayName?: string;
|
|
99
|
+
/** Extra template policy the host has already checked against the runtime's own schema. */
|
|
100
|
+
options?: Omit<OptionsTemplatePolicy, "env" | "mcpServers" | "resume" | "forkSession" | "sessionId">;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The official branch's deployment-wide policy, as a host sets it on `createRuntimeSdk`.
|
|
104
|
+
*
|
|
105
|
+
* A SUBSET OF `OfficialAdapterPolicy`, DECLARED HERE RATHER THAN REFERENCED, and the reason is the
|
|
106
|
+
* published-declaration rule this package already lives by (`seams/official-sdk-shapes.ts`'s header):
|
|
107
|
+
* naming `OfficialAdapterPolicy` on an exported member pulls `official/adapter.d.ts` — and with it
|
|
108
|
+
* `spawn-proxy.d.ts`, whose child-process shape is written in Node's own types — into the declaration
|
|
109
|
+
* graph a CONSUMER type-checks, and a consumer without `@types/node` then fails to compile this
|
|
110
|
+
* package. The installed-tarball smoke is the gate that says so.
|
|
111
|
+
*
|
|
112
|
+
* WHAT IS LEFT OUT IS THE SUPERVISED-SPAWN INJECTION POINTS (`sink`, `reconcile`, `verifyCleanup`,
|
|
113
|
+
* `spawnChild`), and leaving them out is right on its own terms: the router DEFAULTS the record sink
|
|
114
|
+
* to the directory row addressed by the launch, which is the answer §6 rule 2 wants, and a host that
|
|
115
|
+
* genuinely needs to replace the spawn machinery builds its own adapter and reaches it through
|
|
116
|
+
* `runtimeSdkInternals`.
|
|
117
|
+
*/
|
|
118
|
+
export interface RouterOfficialPolicy {
|
|
119
|
+
/** §3's child-environment policy: declared extras, host prefixes, the two reviewed hatches, `remoteConfig`. */
|
|
120
|
+
env?: OfficialEnvPolicy;
|
|
121
|
+
/** §8's dispositions, threaded into the floor every launch installs. */
|
|
122
|
+
containment?: ContainmentPolicy;
|
|
123
|
+
/** The permission mode the bridge is built with when a query supplies no broker. */
|
|
124
|
+
permissionMode?: OfficialPermissionMode;
|
|
125
|
+
/** §2's template policy every official session in this deployment starts from. */
|
|
126
|
+
options?: OptionsTemplatePolicy;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The canonical address this leg's session is recorded under — `session:<id>`, or R-7b-1's
|
|
130
|
+
* `agent:<parent>:<id>` for a cross-runtime child.
|
|
131
|
+
*
|
|
132
|
+
* EXPORTED because the door is not the only party that needs it: `query()`'s in-process ledger is
|
|
133
|
+
* keyed by ADDRESS rather than by the bare session id (review r1, L-3), since a top-level Winter
|
|
134
|
+
* session `x` and a claude child `x` of some parent are different objects that would otherwise share
|
|
135
|
+
* one slot and refuse each other as `handoff-required`.
|
|
136
|
+
*/
|
|
137
|
+
export declare function officialLegAddress(input: Pick<RouterOfficialInput, "sessionId" | "parentSessionId">): string;
|
|
138
|
+
/** The same key for a session named on either leg — the Winter leg has no parent to name. */
|
|
139
|
+
export declare function sessionLedgerKey(sessionId: string): string;
|
|
140
|
+
/** The collaborators the leg composes. Built once by `createRuntimeSdk`; not part of any public shape. */
|
|
141
|
+
export interface OfficialLegDeps {
|
|
142
|
+
brand: BrandProfile;
|
|
143
|
+
official: OfficialAdapter;
|
|
144
|
+
directory: RuntimeDirectory;
|
|
145
|
+
messaging: GlobalMessagingHandle;
|
|
146
|
+
keychain: {
|
|
147
|
+
read(ref: CredentialRef): Promise<string | undefined>;
|
|
148
|
+
};
|
|
149
|
+
/** Lane C's ONE shared store, resolved on first use (the identity also carries the winter home). */
|
|
150
|
+
shared: () => SharedSessionStore;
|
|
151
|
+
/**
|
|
152
|
+
* R-7b-13: the Winter SDK's OWN transcript project key for a working directory.
|
|
153
|
+
*
|
|
154
|
+
* INJECTED FROM THE PEER, NEVER RE-DERIVED. WS-14 §3 calls `CLAUDE_CODE_PROJECT_DIR_NAME` "Winter's
|
|
155
|
+
* stable transcript key" and §2 wants ONE shared auto-memory directory "identical for both
|
|
156
|
+
* branches" — which is only true if the official leg writes under the key the WINTER leg writes
|
|
157
|
+
* under. The SDK exports `transcriptProjectKey(cwd)`; re-implementing its sanitizer here would give
|
|
158
|
+
* two branches two keys for one cwd the first time either changed.
|
|
159
|
+
*/
|
|
160
|
+
transcriptProjectKey: (cwd: string) => string;
|
|
161
|
+
/** WS-14 §5.1's vendored runtime, from the constructor. A per-query `Options` value wins over it. */
|
|
162
|
+
vendoredOfficialRuntime?: string;
|
|
163
|
+
/** The adapter's own policy, so a host's `env`/`containment` choices reach the door's own builders. */
|
|
164
|
+
policy?: RouterOfficialPolicy;
|
|
165
|
+
/**
|
|
166
|
+
* "A leg opened on this runtime" — the door's in-process ledger, told only when it is true
|
|
167
|
+
* (review r1, I-1).
|
|
168
|
+
*
|
|
169
|
+
* CALLED AFTER THE LAUNCH RETURNS, never before. `query()` used to write the ledger the moment it
|
|
170
|
+
* DECIDED, which poisoned it on every path that then refused: a claude-agent selection with no
|
|
171
|
+
* `runtime.official` threw, and the session's own correct Winter runtime was refused ever after with
|
|
172
|
+
* `from=claude-agent`. Worse on the restart path — the durable row says `winter-agent`, the official
|
|
173
|
+
* leg is correctly refused by the row, and the honest follow-up (a Winter query) was then refused by
|
|
174
|
+
* a ledger that contradicted the row the door had just read. The session was wedged on both legs and
|
|
175
|
+
* `sdk.handoff()` could not move it, because it had never been where the ledger claimed.
|
|
176
|
+
*
|
|
177
|
+
* It is also called with the ROW's runtime when the durable check refuses, so the ledger learns the
|
|
178
|
+
* truth it just read rather than keeping a guess.
|
|
179
|
+
*/
|
|
180
|
+
onOpened?: (runtimeKind: RuntimeKind) => void;
|
|
181
|
+
}
|
|
182
|
+
/** A turn stream with backpressure: `push` resolves when the consumer has taken the turn. */
|
|
183
|
+
export interface OfficialInputStream extends AsyncIterable<string> {
|
|
184
|
+
push(text: string): Promise<void>;
|
|
185
|
+
close(): void;
|
|
186
|
+
readonly closed: boolean;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* A single-slot handoff between producers and the runtime.
|
|
190
|
+
*
|
|
191
|
+
* BACKPRESSURE IS THE POINT, not a refinement. The alternative — an unbounded queue drained eagerly
|
|
192
|
+
* from the caller's own iterable — would buffer a whole conversation in memory and, worse, would drain
|
|
193
|
+
* a caller's generator at a rate the runtime never asked for, so a host streaming from a UI would see
|
|
194
|
+
* its turns consumed before the model was ready for them. Here nothing moves until the runtime pulls.
|
|
195
|
+
*
|
|
196
|
+
* A PUSH AFTER `close()` IS A TYPED REJECTION rather than a silent drop: the messaging adapter turns a
|
|
197
|
+
* throw into `delivery_uncertain`, and "the session's input ended" is at least an answer the sender's
|
|
198
|
+
* ledger can record.
|
|
199
|
+
*/
|
|
200
|
+
export declare function createOfficialInputStream(): OfficialInputStream;
|
|
201
|
+
/**
|
|
202
|
+
* One turn, in the shape the official runtime's streaming input takes.
|
|
203
|
+
*
|
|
204
|
+
* The vendor's `SDKUserMessage` is `{ type: "user"; message: MessageParam; parent_tool_use_id }` — a
|
|
205
|
+
* public Messages-API user message plus two envelope fields. `parent_tool_use_id: null` says this turn
|
|
206
|
+
* belongs to the session itself rather than to a tool call, which is what a top-level push is.
|
|
207
|
+
*/
|
|
208
|
+
export declare function officialUserTurn(text: string, sessionId: string): OfficialUserMessage;
|
|
209
|
+
/**
|
|
210
|
+
* Which variable each of this session's credentials fills, and where it lives.
|
|
211
|
+
*
|
|
212
|
+
* DERIVED ONLY WHERE THE MAPPING IS UNAMBIGUOUS. `api-key` is one variable; `console-oauth` is a
|
|
213
|
+
* bearer token whose endpoint is non-secret and travels in `connectionEnv` (§12's "gateway configs
|
|
214
|
+
* MUST set the full credential pair" is then checked by the auth validator, across both halves). The
|
|
215
|
+
* two families that inject nothing inject nothing. A cloud credential chain and a `custom` family name
|
|
216
|
+
* their own variables, because their sets are the host's: a chain's variables depend on which of
|
|
217
|
+
* Bedrock's or Vertex's several auth modes the deployment uses, and `custom` is open by definition.
|
|
218
|
+
*/
|
|
219
|
+
export declare function officialCredentialPlan(args: {
|
|
220
|
+
selection: RuntimeSelection;
|
|
221
|
+
provider: ProviderSelection | undefined;
|
|
222
|
+
explicit: readonly AuthCredentialPlan[] | undefined;
|
|
223
|
+
}): readonly AuthCredentialPlan[];
|
|
224
|
+
/** Non-secret connection variables a family sets, from the contract's own `ProviderConnectionConfig`. */
|
|
225
|
+
export declare function officialConnectionEnv(args: {
|
|
226
|
+
selection: RuntimeSelection;
|
|
227
|
+
provider: ProviderSelection | undefined;
|
|
228
|
+
explicit: Readonly<Record<string, string>> | undefined;
|
|
229
|
+
}): Record<string, string>;
|
|
230
|
+
export interface OfficialLegRequest {
|
|
231
|
+
prompt: string | AsyncIterable<string>;
|
|
232
|
+
options: Options;
|
|
233
|
+
input: RouterOfficialInput;
|
|
234
|
+
selection: RuntimeSelection;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Opens the official leg, synchronously, returning the vendor's `Query` through a handle that defers
|
|
238
|
+
* the launch to the first pull (see this module's header, note 1).
|
|
239
|
+
*/
|
|
240
|
+
export declare function openOfficialLeg(deps: OfficialLegDeps, request: OfficialLegRequest): OfficialQuery;
|
|
241
|
+
/**
|
|
242
|
+
* Starts the caller's own iterable feeding the stream, and closes the stream when it ends.
|
|
243
|
+
*
|
|
244
|
+
* SEPARATE FROM `mapPrompt` because the two ends have different owners: the caller's iterable decides
|
|
245
|
+
* when the session's input is over, and the messaging registry writes into the same stream until it is.
|
|
246
|
+
*/
|
|
247
|
+
export declare function pumpCallerPrompt(prompt: AsyncIterable<string>, stream: OfficialInputStream, onFailure?: (error: unknown) => void): void;
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/** The base class of every error this package throws. */
|
|
2
|
+
export declare class RuntimeSdkError extends Error {
|
|
3
|
+
constructor(message: string, options?: {
|
|
4
|
+
cause?: unknown;
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A session's runtime was changed MID-SESSION, and the door will not rewrite the past to serve it.
|
|
9
|
+
*
|
|
10
|
+
* D13's own words: "the certified handoff or a visible fork, never a silent rewrite". A persisted
|
|
11
|
+
* `RuntimeSelection` is a fact about a transcript that already exists — which runtime wrote it, in
|
|
12
|
+
* which dialect, against which backend session id. Honouring a different `runtimeKind` on the next
|
|
13
|
+
* `query()` would continue that transcript on a runtime that never wrote any of it, which is the
|
|
14
|
+
* silent rewrite, and it would do it at the one door where nothing else is watching.
|
|
15
|
+
*
|
|
16
|
+
* SO THE DOOR REFUSES AND NAMES THE TWO LEGITIMATE ROUTES. `sdk.handoff(session, to)` runs WS-05
|
|
17
|
+
* §12's eight steps — drain, compare, validate, persist, transfer the lease, confirm the destination
|
|
18
|
+
* — and produces a `HandoffOutcome` the host renders; a `forkSession` resume is the visible fork.
|
|
19
|
+
* Both leave evidence; neither pretends the change did not happen.
|
|
20
|
+
*/
|
|
21
|
+
export declare class RuntimeHandoffRequiredError extends RuntimeSdkError {
|
|
22
|
+
/** The runtime this session is persisted on. */
|
|
23
|
+
readonly from: string;
|
|
24
|
+
/** The runtime the caller asked for. */
|
|
25
|
+
readonly to: string;
|
|
26
|
+
readonly address: string;
|
|
27
|
+
constructor(args: {
|
|
28
|
+
from: string;
|
|
29
|
+
to: string;
|
|
30
|
+
address: string;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The official leg was asked for and something only the HOST can supply was missing.
|
|
35
|
+
*
|
|
36
|
+
* WHY ITS OWN CLASS RATHER THAN `OfficialConfigurationError`. That class is WS-14 §13's, and it is
|
|
37
|
+
* about an options object that is wrong — a field this branch refuses, a combination the runtime
|
|
38
|
+
* cannot run. This one is about the DOOR's own inputs: the session id its directory row is addressed
|
|
39
|
+
* by, the credential its auth family needs, the vendored runtime path §5.1 will not guess. A host
|
|
40
|
+
* catching it knows to fix a call site, not a configuration.
|
|
41
|
+
*/
|
|
42
|
+
export declare class RuntimeLaunchInputError extends RuntimeSdkError {
|
|
43
|
+
readonly field: string;
|
|
44
|
+
constructor(args: {
|
|
45
|
+
field: string;
|
|
46
|
+
reason: string;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A directory row whose address the router cannot name — refused at the door rather than listed.
|
|
51
|
+
*
|
|
52
|
+
* WHY IT IS AN ERROR AND NOT A DROPPED ROW (review r4, NEW-13). Every row the directory holds is
|
|
53
|
+
* shown to a model by `ListAgents` and is then expected to answer `SendMessage`. An address that does
|
|
54
|
+
* not parse fails all three resolution doors — by the listed string, by its canonicalised form, and
|
|
55
|
+
* by `deliver()` on the row's own address — so the listing advertises an object nothing can reach and
|
|
56
|
+
* no error explains why. A LISTED OBJECT IS ALWAYS ADDRESSABLE; the writer is an adapter recording a
|
|
57
|
+
* launch, and the fix is always one line at the call site, so it is told.
|
|
58
|
+
*
|
|
59
|
+
* SPINE-OWNED because two lanes throw it: the directory's `record()` door and the official adapter's
|
|
60
|
+
* default record sink, which is where the non-canonical address actually came from.
|
|
61
|
+
*/
|
|
62
|
+
export declare class UnaddressableEntryError extends RuntimeSdkError {
|
|
63
|
+
readonly address: string;
|
|
64
|
+
constructor(address: string);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* D19a: the injected peers are outside the tested compatibility matrix, so construction refuses.
|
|
68
|
+
*
|
|
69
|
+
* `expected`/`actual` are the two fields the plan pins. They are STRINGS, not objects, because the
|
|
70
|
+
* one thing a host does with them is print them: `expected` is the matrix entry that was violated
|
|
71
|
+
* (`"@yanlinglabs/winter-agent-sdk >=0.0.2 <0.1.0"`), `actual` is what the injected peer reported
|
|
72
|
+
* (`"0.0.1"`, or `"unknown (the injected module exports no version identity and no installed copy
|
|
73
|
+
* could be resolved)"`).
|
|
74
|
+
*/
|
|
75
|
+
export declare class RuntimeSdkVersionError extends RuntimeSdkError {
|
|
76
|
+
readonly expected: string;
|
|
77
|
+
readonly actual: string;
|
|
78
|
+
constructor(args: {
|
|
79
|
+
expected: string;
|
|
80
|
+
actual: string;
|
|
81
|
+
message?: string;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/** Which lane of Phase 7b owns a seam that is declared but not yet implemented. */
|
|
85
|
+
export type LaneId = "lane-a" | "lane-b" | "lane-c" | "lane-d";
|
|
86
|
+
/**
|
|
87
|
+
* A seam the spine pinned and a lane has not landed yet.
|
|
88
|
+
*
|
|
89
|
+
* DELIBERATELY A THROW, not a silent no-op or a plausible default. The spine's whole job is to let
|
|
90
|
+
* four lanes build against final signatures in parallel; a stub that returned something shaped right
|
|
91
|
+
* would let a lane (or a host) build on an answer nobody computed, and the failure would surface as
|
|
92
|
+
* wrong behaviour somewhere else. The lane id is a field, not just prose, so a test can assert WHICH
|
|
93
|
+
* seam is still open (`test/spine/seams.test.ts` does exactly that) and so a close-out check can
|
|
94
|
+
* enumerate the remaining ones.
|
|
95
|
+
*/
|
|
96
|
+
export declare class NotImplementedYet extends RuntimeSdkError {
|
|
97
|
+
readonly lane: LaneId;
|
|
98
|
+
readonly seam: string;
|
|
99
|
+
constructor(lane: LaneId, seam: string);
|
|
100
|
+
}
|
|
101
|
+
/** A `RuntimeSdk` method called after `dispose()`. */
|
|
102
|
+
export declare class RuntimeSdkDisposedError extends RuntimeSdkError {
|
|
103
|
+
constructor(method: string);
|
|
104
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from "@yanlinglabs/winter-agent-sdk";
|
|
2
|
+
export { createRuntimeSdk, forwardableOptions, runtimeSdkInternals, ROUTER_ONLY_OPTION_KEYS } from "./sdk.js";
|
|
3
|
+
export type { RouterOnlyOptionKey, RouterOptions, RouterRuntimeInput, RuntimeSdk, RuntimeSdkInternals, RuntimeSdkOptions, RuntimeSdkPeers } from "./sdk.js";
|
|
4
|
+
export { assertVersionMatrix, parseVersion, readExportedVersion, readResolvedManifestVersion, satisfiesRange, SUPPORTED, SUPPORTED_PROTOCOL_VERSIONS, VERSION_EXPORT_NAMES } from "./version-matrix.js";
|
|
5
|
+
export type { PeerVersionIdentity, PeerVersionSource, VersionMatrixReport } from "./version-matrix.js";
|
|
6
|
+
export { isSelectionRefusal, selectChildRuntime, selectRuntime, SelectionRefusedError } from "./selection/runtime-selection.js";
|
|
7
|
+
export type { ChildSelectionInput, CredentialPresence, RuntimeKind, RuntimeSelection, SelectionInput, SelectionRefusal } from "./selection/runtime-selection.js";
|
|
8
|
+
export { CHILD_PROVIDER_UNAVAILABLE, resumeChildSelection, selectChildRuntimePairing } from "./selection/child-runtime.js";
|
|
9
|
+
export type { ChildResumeOutcome, ChildRuntimePairing } from "./selection/child-runtime.js";
|
|
10
|
+
export type { ProviderAuthView, SelectionAuthFamily, SelectionVersions } from "./selection/runtime-selection.js";
|
|
11
|
+
export { D14_CLAUDE_OAUTH_APPROVED_DEFAULT, SELECTION_RULES, UNKNOWN_VERSION, reviewPersistedSelection, ruleIdOf, selectionVersionsFrom } from "./selection/select-runtime.js";
|
|
12
|
+
export type { SelectionReview, SelectionRuleId } from "./selection/select-runtime.js";
|
|
13
|
+
export { RESUME_STAGING_PREFIX, isResumeStagingRoot, resumeStagingRoot } from "./vendor-paths.js";
|
|
14
|
+
export { MATERIALIZED_RESUME_PROBE_REPORTS, materializedResumeReportForPin } from "./store/pinned-probes.js";
|
|
15
|
+
export { EXECUTION_INDIRECTION_ENV_NAMES, EXECUTION_INDIRECTION_ENV_PREFIXES, isExecutionIndirectionVariable } from "./official/env-allowlist.js";
|
|
16
|
+
export { TRAFFIC_OPT_OUT_VARIABLES, TRAFFIC_OPT_OUT_VARIABLE_NAMES } from "./official/env-allowlist.js";
|
|
17
|
+
export { LIST_AGENTS_FIELD_MAX, NATIVE_LIST_AGENTS_OUTPUT_SCHEMA, NATIVE_LIST_AGENTS_SCHEMA, NATIVE_SEND_MESSAGE_SCHEMA, SEND_MESSAGE_SUMMARY_MAX, SEND_MESSAGE_TO_MAX, acceptNativeListAgentsArgs, acceptNativeSendMessageArgs, } from "./native-args.js";
|
|
18
|
+
export type { NativeArgsResult, NativeListAgentsArgs, NativeSendMessageArgs } from "./native-args.js";
|
|
19
|
+
export * from "./seams/index.js";
|
|
20
|
+
export { NotImplementedYet, RuntimeHandoffRequiredError, RuntimeLaunchInputError, RuntimeSdkDisposedError, RuntimeSdkError, RuntimeSdkVersionError, UnaddressableEntryError } from "./errors.js";
|
|
21
|
+
export { createOfficialInputStream, isOfficialQuery, officialCredentialPlan, officialConnectionEnv, officialUserTurn } from "./door.js";
|
|
22
|
+
export type { OfficialInputStream, RouterOfficialInput, RouterOfficialPolicy, RouterQuery } from "./door.js";
|
|
23
|
+
export type { LaneId } from "./errors.js";
|
|
24
|
+
export { createRuntimeMessaging, createMessagingToolHandlers, createAttachedSessionRegistry } from "./messaging/index.js";
|
|
25
|
+
export type { AttachedOfficialSession, AttachedSession, AttachedSessionRegistry, AttachedWinterSession, DirectorySnapshot, GlobalMessagingHandle, GlobalMessagingOptions, MessagingToolCaller, MessagingToolHandlers, MessagingToolResult, ReplyRequest, RouterMessagingAdapter, RuntimeDirectoryHandle, RuntimeDirectoryOptions, RuntimeDirectoryRecoveryHooks, } from "./messaging/index.js";
|