@constal/sdk 4.3.0 → 5.0.0

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 CHANGED
@@ -96,29 +96,6 @@ configuration, and control-plane operations. Returned objects are independent
96
96
  copies. A configured operation is not a promise of authorization: Policy still
97
97
  applies when it is invoked.
98
98
 
99
- ## Agent delivery
100
-
101
- Bind another Agent Resource to the caller, then address that bound Agent by CRN:
102
-
103
- ```ts
104
- const peer = ctx.resources.reviewer;
105
- const receipt = await ctx.send(peer, { request: "Review this change" },
106
- { session: "review-123" });
107
-
108
- const delivery = await ctx.send<{ verdict: string }>(peer,
109
- { request: "Review this change" }, { completion: "run-result" });
110
- const answer = await delivery.result;
111
- ```
112
-
113
- Each delivery queues a distinct Run in the target Agent's Session. Receipt mode
114
- requires a Session and acknowledges the durable enqueue; result mode may omit
115
- the Session to create a fresh one and returns a cancellable Handle for the target
116
- Run's result. The target executes under the initiating principal's authority.
117
- Policy evaluates `agent:invoke` on the exact bound target for each new send, and
118
- the platform rechecks that authority when the target accepts the message.
119
- Session and Run reads remain separate Policy actions. `ctx.commit` continues to
120
- address the caller's own ledger.
121
-
122
99
  For model-selected operations, add the optional `resourceTools` to the Agent's
123
100
  ordinary Tool catalog:
124
101
 
@@ -181,6 +158,56 @@ array. Declare its normal `needs` and `maxEffect` when loading uses Resources.
181
158
  source when supplied, and content hash. These are ordinary authorized Tool calls.
182
159
  Skill instructions do not grant additional authority.
183
160
 
161
+ ## Ledger addresses and delivery
162
+
163
+ A ledger address names a Session's main ledger,
164
+ `agent:<agent>/session:<session>`, or a spawned loop's,
165
+ `agent:<agent>/session:<session>/spawn:<handle>`, within the Run's tenant,
166
+ namespace, and Customer. `ctx.run.ledger` is the current Run's own address (null
167
+ for an operator branch, an eval fork, a compensation, or a loop one of them
168
+ spawned, and for a Run of an existing Session whose id has a `/` or a control
169
+ character or is longer than 256 characters, which ingress no longer accepts for
170
+ a new one), and the Handle
171
+ `ctx.spawn` returns names its loop in `ledger`, the same across the spawn's
172
+ retries. A Run omits `of` and `to` for its own ledger; `session:<id>` is
173
+ refused.
174
+
175
+ ```ts
176
+ const notes = await ctx.ledger.view("notes", { of: "agent:memory/session:team" });
177
+ await ctx.commit({ text: "Fix the failing build", data: { issue: 7 } },
178
+ { to: "agent:task/session:fix-7", deliver: "live", delegate: true });
179
+ const investigation = ctx.spawn(investigate, { issue: 7 });
180
+ await ctx.commit("Also check the flaky test", { to: investigation.ledger, deliver: "live" });
181
+ const woken = ctx.await("next", { afterRun: "delivery", timeout: 3_600_000 });
182
+ ```
183
+
184
+ `ctx.ledger.view` reads another ledger at its head. `ctx.commit` with `to` is
185
+ the one way agent code delivers to another ledger: `deliver: "queue"`, the
186
+ default, queues the item; `"live"` steers the addressed Run or starts one. A
187
+ live item is a non-empty string or `{ text, data? }`, and a delivery to a spawn
188
+ is live. `delegate: true` makes this Session the owner of the receiving Session,
189
+ which takes its owner only before its first Run. A delegation to a Session whose
190
+ live Run's cancel awaits its Driver waits behind that Run and starts the next
191
+ one; any other live delivery steers that Run. The platform then delivers to
192
+ the owner, as a `RunReport`, each end of that Session's root Runs (`complete`
193
+ with its result, `failed`, `stopped`) but one a stop of the owner's ledger
194
+ caused, each hold of one at its turn or spend limit (`held`), and each refused
195
+ or dropped start of one whose event did not come from the owner's Session
196
+ (`refused`). A delivery refused when it reaches
197
+ its Session, or failing there for good, is reported to its sender as a
198
+ `RunReport` with status `refused`. `ctx.await(label, { afterRun: "delivery" })`
199
+ settles when a delivery steers the waiting Run and resolves to `{ seq, eventId }`
200
+ of the steer that woke it; the delivery itself stays in the ledger.
201
+
202
+ Policy decides a view of another Session (`ledger:read`; the pages its cursor
203
+ then reads need no further check) and a delivery to another Session at its
204
+ commit (`agent:invoke` on the receiving Agent, `session:steer` when live,
205
+ `run:cancel` when delegating). A refused view or
206
+ delivery throws its refusal, which is journaled, so a replay throws the same
207
+ error at the same position: a Policy denial is `PolicyDecisionFailed` with its
208
+ `decisionHash`, and any other refusal an `Error` with the platform's message and
209
+ `status`.
210
+
184
211
  ## Session schedules
185
212
 
186
213
  Schedule a future invocation of the current Agent and Session:
@@ -200,8 +227,7 @@ Recurring schedules preserve missed occurrences by default; explicitly request
200
227
 
201
228
  `ctx.listSchedules()` pages the owning Session's schedules; calling `schedule()`
202
229
  again with the same name replaces future work. `ctx.cancelSchedule(name)` stops
203
- future work and identifies accepted or unresolved deliveries. Another bound
204
- Agent can be selected with `agent` and an explicit `session`. Use `ctx.await()`
230
+ future work and identifies accepted or unresolved deliveries. Use `ctx.await()`
205
231
  for sleeping within the current Run.
206
232
 
207
233
  See [Schedule Agent follow-ups](https://constal.ai/docs/agents/schedules) for replay,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constal/sdk",
3
- "version": "4.3.0",
3
+ "version": "5.0.0",
4
4
  "description": "Public TypeScript SDK for authoring Constal agents, integrations, policies, channels, and credential providers",
5
5
  "keywords": [
6
6
  "constal",
package/publish/api.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@constal/sdk",
3
- "version": "4.3.0",
3
+ "version": "5.0.0",
4
4
  "exports": [
5
5
  "AGENT_UI_DEFAULTS",
6
6
  "Action",
@@ -14,11 +14,8 @@
14
14
  "Agent",
15
15
  "AgentCredentialSetupRequirement",
16
16
  "AgentDef",
17
- "AgentDeliveryReceipt",
18
17
  "AgentDeployPolicy",
19
18
  "AgentGovernanceMeter",
20
- "AgentResultDelivery",
21
- "AgentSendOpts",
22
19
  "AgentSetupMetadata",
23
20
  "AgentSetupRequirement",
24
21
  "AgentSetupWorkflow",
@@ -132,6 +129,8 @@
132
129
  "CredentialRevoked",
133
130
  "CredentialSetupState",
134
131
  "CredentialUnavailable",
132
+ "CredentialUninstallRequest",
133
+ "CredentialUninstallResult",
135
134
  "CredentialVerifyResult",
136
135
  "Ctx",
137
136
  "CustomerTenantCRN",
@@ -224,6 +223,7 @@
224
223
  "LabelSelectorRequirement",
225
224
  "LeaseLost",
226
225
  "LedgerAddress",
226
+ "LedgerAddressParts",
227
227
  "LedgerEvent",
228
228
  "ListSchedulesOptions",
229
229
  "LoadedSkill",
@@ -310,6 +310,7 @@
310
310
  "RollbackTargetInvalid",
311
311
  "RunIdentityView",
312
312
  "RunInfo",
313
+ "RunReport",
313
314
  "RunStatusDetail",
314
315
  "RunSuiteRequest",
315
316
  "Sandbox",
@@ -389,6 +390,7 @@
389
390
  "SpawnAttenuation",
390
391
  "SpawnBudget",
391
392
  "SpawnCardinality",
393
+ "SpawnHandle",
392
394
  "SpawnOpts",
393
395
  "SqlFold",
394
396
  "StageInfo",
@@ -506,6 +508,7 @@
506
508
  "evaluationArguments",
507
509
  "evaluationProtocolRequest",
508
510
  "evaluationProtocolResult",
511
+ "formatLedgerAddress",
509
512
  "gateway",
510
513
  "gatewayModelOffer",
511
514
  "gatewayPackageMetadata",
@@ -538,6 +541,7 @@
538
541
  "noulDecision",
539
542
  "opTool",
540
543
  "opTools",
544
+ "parseLedgerAddress",
541
545
  "parseResourceName",
542
546
  "policy",
543
547
  "policyName",
@@ -149,7 +149,9 @@ declare class ApiError extends Error {
149
149
  readonly status: number;
150
150
  readonly body: string;
151
151
  readonly disposition: "terminal" | "uncertain";
152
- constructor(status: number, body: string, disposition?: "terminal" | "uncertain");
152
+ readonly retryAfterMs?: number | undefined;
153
+ /** `retryAfterMs`: the interval the remote API stated, such as its `retry-after`; absent when it stated none. */
154
+ constructor(status: number, body: string, disposition?: "terminal" | "uncertain", retryAfterMs?: number | undefined);
153
155
  }
154
156
  /** The integration can prove that no external request was sent. */
155
157
  declare class IntegrationRequestNotSent extends Error {
@@ -1943,13 +1945,9 @@ type ScheduleWhen = {
1943
1945
  after?: never;
1944
1946
  missed?: ScheduleMissed;
1945
1947
  };
1946
- /** Future invocations of this Agent, or an explicitly bound Agent in an explicit Session. */
1948
+ /** Future invocations of this Agent in this Session. A scheduled Run reaches another ledger with ctx.commit(item, { to }). */
1947
1949
  type ScheduleOptions<Input = unknown> = ScheduleWhen & {
1948
1950
  input: Input;
1949
- /** Omission selects the current Agent and its normal Session routing. */
1950
- agent?: CRN;
1951
- /** Omission selects the current Session. Another Agent requires an explicit Session. */
1952
- session?: string;
1953
1951
  };
1954
1952
  type ScheduleTiming = {
1955
1953
  kind: "after";
@@ -2202,6 +2200,10 @@ type LedgerEvent = SteerEvent | ControlEvent | WaitResolvedEvent | (EventBase &
2202
2200
  itemId: string;
2203
2201
  target: LedgerAddress | "export";
2204
2202
  fact: FactRef;
2203
+ /** The sending Run. */
2204
+ run?: string;
2205
+ /** The delivery made the sending Run's Session the owner of its target Session. */
2206
+ delegate?: true;
2205
2207
  }) | (EventBase & {
2206
2208
  kind: "delivery-acknowledged";
2207
2209
  itemId: string;
@@ -2258,7 +2260,9 @@ interface SpawnBudget {
2258
2260
  wallMs: number;
2259
2261
  }
2260
2262
  /** Exact local Resource and Tool names retained by a child Run. Omitted names
2261
- * are unavailable to the child even when they are bound to the parent. */
2263
+ * are unavailable to the child even when they are bound to the parent.
2264
+ * Attenuation bounds what the child runs, not what it reads or the Runs its deliveries start: Policy decides its
2265
+ * views and its deliveries, and a Run that a delivery starts runs under the receiving ledger's own grants. */
2262
2266
  interface SpawnAttenuation {
2263
2267
  bindings: readonly string[];
2264
2268
  tools: readonly string[];
@@ -2287,7 +2291,10 @@ interface AwaitOpts<T> {
2287
2291
  schema?: object;
2288
2292
  /** Optional caller-selected response size limit, in UTF-8 bytes. */
2289
2293
  maxBytes?: number;
2290
- afterRun?: "ignore" | "message";
2294
+ /** "message": the Session's next queued input answers the wait with its value. "delivery": the wait settles when a
2295
+ * delivery steers this Run after the wait opened, and resolves to `{ seq, eventId }` of the steer that woke it; the
2296
+ * delivery itself stays in the ledger and is consumed by nothing. */
2297
+ afterRun?: "ignore" | "message" | "delivery";
2291
2298
  /** Explicitly public presentation; never include Credential material or private evidence. */
2292
2299
  presentation?: AwaitPresentation;
2293
2300
  }
@@ -2305,25 +2312,11 @@ interface Handle<T> extends PromiseLike<T> {
2305
2312
  interface InvocationHandle<T> extends Handle<T> {
2306
2313
  start(): Promise<void>;
2307
2314
  }
2308
- /** A message to an exactly bound Agent creates one distinct target Run. */
2309
- type AgentSendOpts = {
2310
- session: string;
2311
- completion?: "receipt";
2312
- } | {
2313
- session?: string;
2314
- completion: "run-result";
2315
- timeoutMs?: number;
2316
- };
2317
- interface AgentDeliveryReceipt {
2318
- id: string;
2319
- state: "enqueued";
2320
- target: {
2321
- agent: CRN;
2322
- session: string;
2323
- };
2324
- }
2325
- interface AgentResultDelivery<T> extends AgentDeliveryReceipt {
2326
- result: Handle<T>;
2315
+ /** A spawn's Handle names the spawned loop's ledger, the same across the spawn's retries. */
2316
+ interface SpawnHandle<T> extends Handle<T> {
2317
+ /** Reading it throws a TypeError in a Session whose id the address grammar excludes (more than 256 characters, a `/` or
2318
+ * a control character): such a Session has no ledger addresses. */
2319
+ readonly ledger: LedgerAddress;
2327
2320
  }
2328
2321
  interface CommitOpts {
2329
2322
  tier?: Tier;
@@ -2333,15 +2326,46 @@ interface CommitOpts {
2333
2326
  /** Filled by the runtime after a scorer-backed gate; callers must not provide it. */
2334
2327
  gateVerdict?: GateVerdict;
2335
2328
  compensate?: Compensation;
2329
+ /** Delivers the item to another ledger: `agent:<agent>/session:<session>` (that Session's main ledger) or
2330
+ * `agent:<agent>/session:<session>/spawn:<handle>` (a spawned loop's); or commits it to `memory`. Omit it for this
2331
+ * Run's own ledger; `session:<id>` is refused. */
2336
2332
  to?: LedgerAddress;
2337
2333
  checkpoint?: {
2338
2334
  upTo: FactRef;
2339
2335
  };
2340
2336
  expectedHead?: FactRef;
2337
+ /** "queue" (the default) or "live", which steers the addressed Run or starts one. A live item is a non-empty string or
2338
+ * { text, data? } with a non-empty text. A delivery to a spawn is live. */
2341
2339
  deliver?: DeliveryMode;
2340
+ /** Makes this Run's Session the owner of the Session whose main ledger `to` names. */
2341
+ delegate?: boolean;
2342
2342
  /** Explicitly public presentation delivered by the originating Channel when this Run was admitted through one. */
2343
2343
  presentation?: AwaitPresentation;
2344
2344
  }
2345
+ /** A Run's end, hold or refused start, delivered by the platform as the body { text, data } to the Session's owner, to the
2346
+ * refused event's origin, or to the Session itself. */
2347
+ interface RunReport {
2348
+ /** One sentence the platform writes. */
2349
+ text: string;
2350
+ data: {
2351
+ object: "constal.run.report";
2352
+ version: 1;
2353
+ /** The reporting Session. */
2354
+ session: LedgerAddress;
2355
+ /** Null for a refusal. */
2356
+ run: string | null;
2357
+ /** The event that started the Run, or the refused event. */
2358
+ event: string;
2359
+ status: "complete" | "failed" | "stopped" | "held" | "refused";
2360
+ /** The Run's error, its limit, or the refusal's code. */
2361
+ error: string | null;
2362
+ /** A completed Run's result, read through a view of its ledger. */
2363
+ result: {
2364
+ fact: string;
2365
+ ref: string;
2366
+ } | null;
2367
+ };
2368
+ }
2345
2369
  interface Cost {
2346
2370
  accounting: {
2347
2371
  trackedCost: {
@@ -2668,6 +2692,9 @@ interface RunInfo {
2668
2692
  crn: CRN;
2669
2693
  };
2670
2694
  mode: Mode;
2695
+ /** This Run's own ledger address: its Session's main ledger for a root Run, its spawn's for a spawned Run, null for a
2696
+ * Run that nothing addresses (an operator branch, an eval fork, a compensation, or a loop one of them spawned). */
2697
+ ledger: LedgerAddress | null;
2671
2698
  /** Present for an independently scheduled invocation; input remains unchanged. */
2672
2699
  schedule?: ScheduleTrigger;
2673
2700
  }
@@ -2731,6 +2758,9 @@ interface Ctx {
2731
2758
  /** Judge one state with constrained, probabilistic answers instead of a generated turn. Journaled and priced like a model call. */
2732
2759
  evaluate<Q extends EvaluationQuestions>(spec: EvaluationSpec<Q>): Promise<EvaluationRecord<Q>>;
2733
2760
  ledger: {
2761
+ /** `of` names another ledger: `agent:<agent>/session:<session>` (that Session's main ledger, read at its head),
2762
+ * `agent:<agent>/session:<session>/spawn:<handle>` (a spawned loop's), `memory` or `table:<table>@<branch>`.
2763
+ * Omit it for this Run's own ledger, pinned at dispatch; `session:<id>` is refused. */
2734
2764
  view<S = HistoryView>(name?: string, opts?: {
2735
2765
  of?: LedgerAddress;
2736
2766
  }): Promise<S>;
@@ -2749,7 +2779,7 @@ interface Ctx {
2749
2779
  cancelSchedule(name: string): Promise<ScheduleCancellation>;
2750
2780
  /** Inspect this Session's schedules through a journaled, paginated read. */
2751
2781
  listSchedules(options?: ListSchedulesOptions): Promise<SchedulePage>;
2752
- spawn<T>(task: Task<T>, input: unknown, opts?: SpawnOpts): Handle<T>;
2782
+ spawn<T>(task: Task<T>, input: unknown, opts?: SpawnOpts): SpawnHandle<T>;
2753
2783
  map<I, O, R = never>(f: PartitionFn<I, O, R>, over: Over<I>, opts: MapOpts): Handle<MapFact>;
2754
2784
  reduce<I, O>(g: FoldFn<I, O> | SqlFold, over: Over<I>, opts?: ReduceOpts): Handle<ReduceFact>;
2755
2785
  step<T>(name: string, fn: () => Promise<T>): Promise<T>;
@@ -2760,13 +2790,6 @@ interface Ctx {
2760
2790
  sandboxPool(resource: CRN): SandboxPool;
2761
2791
  invoke<T>(resource: CRN, op: string, args: unknown, opts?: InvokeOpts): Promise<T>;
2762
2792
  invokeAsync<T>(resource: CRN, op: string, args: unknown, opts?: InvokeOpts): InvocationHandle<T>;
2763
- send<T>(agent: CRN, input: unknown, opts: AgentSendOpts & {
2764
- completion: "run-result";
2765
- }): Promise<AgentResultDelivery<T>>;
2766
- send(agent: CRN, input: unknown, opts: {
2767
- session: string;
2768
- completion?: "receipt";
2769
- }): Promise<AgentDeliveryReceipt>;
2770
2793
  request(policy: PolicyCRN, grant: CapabilityGrant): Handle<CapabilityRef>;
2771
2794
  analytics: AnalyticsClient;
2772
2795
  run: RunInfo;
@@ -2921,6 +2944,10 @@ interface CanonicalEventDraft<T = unknown> {
2921
2944
  data: T;
2922
2945
  occurredAt?: number;
2923
2946
  deliver?: DeliveryMode;
2947
+ /** When respond() runs: "receipt" once the event is durably in its Session's inbox; "run-result" once the Run it
2948
+ * starts settles, up to 120 s. Default: "receipt" for queue, "run-result" for live. `queue` with "run-result" is an
2949
+ * invalid draft. */
2950
+ completion?: "receipt" | "run-result";
2924
2951
  /** Channel-owned reply address pinned at admission; Agent input cannot replace it. */
2925
2952
  reply?: {
2926
2953
  destination: string;
@@ -2932,6 +2959,9 @@ interface IgnoredChannelEvent {
2932
2959
  ignored: true;
2933
2960
  reason: string;
2934
2961
  response: ChannelResponse;
2962
+ /** Names of this Channel's bindings whose Credentials the platform checks with their providers before it answers,
2963
+ * such as on a provider's own installation lifecycle event. Only a request with a Customer resolves them. */
2964
+ recheck?: string[];
2935
2965
  }
2936
2966
  /** Authenticated source delivery captured once and dispatched to authorized subscribers. */
2937
2967
  interface ChannelIngressEvent {
@@ -4288,10 +4318,31 @@ interface CredentialVerifyResult {
4288
4318
  verified: boolean;
4289
4319
  /** Non-secret external identity and access facts verified by this provider. */
4290
4320
  claims?: Record<string, string | number | boolean | string[]>;
4321
+ /** With verified:false only: the provider states that the installation this version stands for no longer exists.
4322
+ * The platform revokes this version and the Credential's older live versions. A failure that may pass, and any
4323
+ * answer that is not such a statement (a suspension, a mismatch, a refusal), is thrown instead. */
4324
+ revoked?: true;
4291
4325
  }
4292
4326
  interface CredentialDestroyResult {
4293
4327
  destroyed: boolean;
4294
4328
  }
4329
+ interface CredentialUninstallRequest extends CredentialMaterialRequest {
4330
+ /**
4331
+ * The external identity the caller owns and expects to remove, such as an installation or workspace id. A provider
4332
+ * that reaches a different one must answer `unable` and remove nothing.
4333
+ */
4334
+ expectedIdentity: string | null;
4335
+ }
4336
+ /**
4337
+ * `removed`: the provider removed it. `absent`: it was already gone. `unable`: it is still there and this provider could
4338
+ * not remove it, with a short machine-readable reason. A failure that may pass, such as an outage, is thrown instead.
4339
+ */
4340
+ type CredentialUninstallResult = {
4341
+ outcome: "removed" | "absent";
4342
+ } | {
4343
+ outcome: "unable";
4344
+ reason: string;
4345
+ };
4295
4346
  type CredentialProviderSecretInput = "secret" | "multiline" | "file";
4296
4347
  interface CredentialProviderCredentialSlotSetup {
4297
4348
  /** Human-readable name shown while the provider is configured. */
@@ -4351,6 +4402,11 @@ interface CredentialProviderDefinition<C = unknown> extends Omit<CredentialProvi
4351
4402
  mint(request: CredentialMintRequest, context: IntegrationContext): Promise<CredentialMintResult>;
4352
4403
  verify?(request: CredentialMaterialRequest, context: IntegrationContext): Promise<CredentialVerifyResult>;
4353
4404
  destroy?(request: CredentialMaterialRequest, context: IntegrationContext): Promise<CredentialDestroyResult>;
4405
+ /**
4406
+ * Removes what the Credential stands for at its source, such as an app installation. Destroy ends one version and
4407
+ * runs on every rotation; this ends the grant, and runs only when a deletion of the Credential asks for it.
4408
+ */
4409
+ uninstall?(request: CredentialUninstallRequest, context: IntegrationContext): Promise<CredentialUninstallResult>;
4354
4410
  }
4355
4411
  type CredentialProviderContext = IntegrationContext;
4356
4412
  /** Validated user-authored Credential Provider package. */
@@ -4583,5 +4639,29 @@ declare class SessionDeleted extends Error {
4583
4639
  constructor(session: string);
4584
4640
  }
4585
4641
 
4586
- export { AGENT_UI_DEFAULTS, AfterYield, ApiError, CONSTAL_API_CAPABILITY, CONSTAL_API_GET_KINDS, CONSTAL_API_MODEL_TOOL_DESCRIPTIONS, CONSTAL_API_OPERATIONS, CONSTAL_API_OPERATION_SCHEMAS, CONSTAL_API_QUERY_KINDS, CONSTAL_API_VERSION, CommitConflict, CommitGateRejected, CredentialRevoked, CredentialUnavailable, DirectNetworkDenied, EVALUATION_LIMITS, EffectCeilingExceeded, EmptyJoin, GateExhausted, IntegrationRequestNotSent, LeaseLost, MCP_CLIENT_CAPABILITY, MCP_PROTOCOL_VERSION, MEMORY_OPERATION_DECLARATIONS, MODEL_CHECKPOINT_IMPORT_CAPABILITY, MODEL_COMPLETION_CAPABILITY, MODEL_EVALUATION_CAPABILITY, McpClient, NondeterministicReplay, OutcomeUnknown, PolicyConstraintFailed, PolicyDecisionFailed, RESOURCE_CREDENTIAL_BINDING_SCHEMA, RESOURCE_KINDS, ResourceDisabled, ResourceInvalid, ResourceUnbound, RollbackTargetInvalid, SessionDeleted, SpawnCardinality, SwallowedYield, TRAINING_PROVIDER_CAPABILITY, TerminalIntegrationFailure, ToolUnavailable, UI_ASSET_CONTENT_TYPES, UI_BUNDLE_BOUNDS, UnknownTool, WEB_FETCH_ARGUMENT_SCHEMA, WEB_SEARCH_ARGUMENT_SCHEMA, action, actionPattern, agent, agentLimit, agentResourceBinding, agentSetupMetadata, agentSetupRequirements, agentUiBundleManifest, agentUiDeclaration, all, analyticsEvent, approximateTokens, authProvider, authProviderName, bindingName, bucketFor, canonicalJson, capabilityContractRef, casTool, channel, channelIngressRequest, channelIngressSource, channelSourceEvidence, channelSubscriptionRequest, channelTarget, checkpointArtifactRef, checkpointDeploymentRequest, checkpointImportMetadata, checkpointImportRequest, codeScorerIR, containerImageReference, containerImageSelection, containerImageSource, credentialEvidence, credentialInteractionAction, credentialInteractionEvent, credentialInteractionResult, credentialName, credentialProvider, credentialProviderConfigSchema, credentialProviderName, credentialProviderSetupMetadata, credentialRotationDefaults, credentialSetupState, customerTenantName, cutBatches, cutPartitions, datasetName, evaluateCodeScorer, evaluatePolicyDefinition, evaluationArguments, evaluationProtocolRequest, evaluationProtocolResult, gateway, gatewayModelOffer, gatewayPackageMetadata, hash, hashValue, immutableContainerImageReference, integrationEgressPolicy, invocationCredentialUses, labelSelector, matchesAction, matchesLabelSelector, matchesResource, mcpToolDescription, mcpToolResult, memoryStoreBinding, modelAdvertisedPricing, modelControls, modelGatewayBinding, modelGatewayEndpoint, modelGenerationOptions, modelLimit, modelMessages, modelPrompt, modelProtocolRequest, modelProtocolResult, murmur3_32, normalizeModelGatewayConfig, normalizeSandboxNetworkPolicy, normalizeSandboxWorkspacePath, noulDecision, opTool, opTools, parseResourceName, policy, policyName, race, renderTrainingCompletion, resolveBindingOwner, resolveContainerImageSource, resolveGatewayEgress, resolveResourceDependencyRef, resourceContractRef, resourceCredentialBinding, resourceDependencyRef, resourceLabelMap, resourceName, resourceNeed, resourcePattern, resourceSelector, resourceTools, sandboxControls, sandboxLimit, scopedBindingKey, scopedCredentialRef, scopedResourceRef, scoreLevel, scorerName, select, selectableResourceLabels, setupAwait, setupCredentialReceipt, setupPanelProviderIsCrn, setupScreen, setupScreenView, setupSubmission, sha256Hex, skills, stageOutput, startTrainingRequest, subtask, tableDescribe, tableQuery, trainingProvider, trainingProviderMetadata, trainingRecipe, uiAssetContentType, uiBundle, uiBundleManifest, uiLimit, uiName, validateBatchSpec, validateFoldFn, validateJsonSchema, validateJsonSchemaDefinition, validatePartitionFn, validatePartitionSpec, validateStageOutputSpec, validateTool, validateView, webFetch, webSearch };
4587
- export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentCredentialSetupRequirement, AgentDef, AgentDeliveryReceipt, AgentDeployPolicy, AgentGovernanceMeter, AgentResultDelivery, AgentSendOpts, AgentSetupMetadata, AgentSetupRequirement, AgentSetupWorkflow, AgentUiDeclaration, AnalyticsClient, AnalyticsDimensionValue, AnalyticsEventDefinition, AnalyticsIntent, AnalyticsValues, AuthProvider, AuthProviderCRN, AuthProviderContext, AuthProviderRequest, AuthProviderResult, AwaitOpts, AwaitPresentation, BatchSpec, BindingCRN, BindingOwnerContext, BindingOwnerScope, BoundOperation, BoundResourceCapabilities, BranchRef, CRN, CRNKind, CanonicalEvent, CanonicalEventDraft, CapabilityContractRef, CapabilityGrant, CapabilityRef, CaptureCaseRequest, CaseRow, CatalogTool, Channel, ChannelContext, ChannelFailure, ChannelIngressEvent, ChannelIngressSource, ChannelMessage, ChannelProtocol, ChannelReceiveResult, ChannelRequest, ChannelResponse, ChannelSourceEvidence, ChannelSubscriptionRequest, ChannelTarget, CheckpointDeploymentRequest, CheckpointImportMetadata, CheckpointImportRequest, ChoiceAnswer, ChoiceQuestion, CodeScoreResult, CodeScorerIR, CodeScorerRule, CommitOpts, CompareSuitesRequest, Compensation, ConnectionCancelRequest, ConnectionIdentity, ConnectionOperation, ConnectionRecoveryRequest, ConnectionRecoveryResult, ConnectionRequest, ConnectionUsageReport, ConstalApiApplyRequest, ConstalApiChangePlan, ConstalApiChangePlanRef, ConstalApiChangePlanRequest, ConstalApiChangeReceipt, ConstalApiOperationReceipt, ContainerImageReference, ContainerImageSelection, ContainerImageSource, ContainerRegistryRequest, ContainerRegistryResponse, ControlEvent, Cost, CreateSandboxImageOptions, CreateSandboxOptions, CredentialCRN, CredentialDestroyResult, CredentialEvidence, CredentialInteractionAction, CredentialInteractionAdvanceRequest, CredentialInteractionEvent, CredentialInteractionPrimaryAction, CredentialInteractionProof, CredentialInteractionResult, CredentialInteractionStartRequest, CredentialMaterialRequest, CredentialMintRequest, CredentialMintResult, CredentialProviderCRN, CredentialProviderContext, CredentialProviderCredentialSlotSetup, CredentialProviderDefinition, CredentialProviderPackage, CredentialProviderPackageMetadata, CredentialProviderSecretInput, CredentialProviderSetupMetadata, CredentialSetupState, CredentialVerifyResult, Ctx, CustomerTenantCRN, DataManifest, DatasetCRN, DatasetDraft, DatasetRef, DelegatedGrant, DelegationCeiling, DeliveryMode, DeliveryReceipt, DispatchResult, EffectClass, EvalComparison, EvalDivergence, EvalMode, EvalSubject, EvalSubjectSource, EvaluationAnswer, EvaluationAnswerFor, EvaluationAnswers, EvaluationEntry, EvaluationInvocationArgs, EvaluationInvocationResult, EvaluationProtocol, EvaluationQuestion, EvaluationQuestions, EvaluationRecord, EvaluationSpec, EventBase, Fact, FactRef, FileEntry, FixedMemoryStoreRef, FixedModelGatewayRef, FoldFn, GateEvidence, GateResult, GateVerdict, GatewayCancelRequest, GatewayConfigEgressBinding, GatewayContext, GatewayCredentialSlotSetup, GatewayDefinition, GatewayDiscoverySetup, GatewayModelOffer, GatewayOperation, GatewayPackage, GatewayPackageMetadata, GatewayRecoveryRequest, GatewayRecoveryResult, GatewayRequest, GovernanceContractRef, Handle, HandleOutcome, Hash, HistoryView, HmacVerification, IgnoredChannelEvent, IngressRequest, IngressTarget, IntegrationArtifactEgressRequest, IntegrationArtifactEgressResponse, IntegrationAttachment, IntegrationContext, IntegrationEgressPolicy, IntegrationEgressRequest, IntegrationEgressResponse, IntegrationEgressRule, IntegrationLifecycle, IntegrationReleaseContext, IntegrationSecret, IntegrationState, InvocationCredentialUse, InvocationHandle, InvokableKind, InvokeOpts, JoinOutcome, JsonScalar, JsonValue, LabelRequest, LabelSelector, LabelSelectorOperator, LabelSelectorRequirement, LedgerAddress, LedgerEvent, ListSchedulesOptions, LoadedSkill, LocalResourceRef, ManifestIndexPage, MapFact, MapOpts, McpClientOptions, McpClientState, McpMessageTransport, MemoryDeleteArgs, MemoryGetArgs, MemoryRecord, MemoryRememberArgs, MemorySearchArgs, MemorySearchHit, MemoryStoreBinding, Mode, ModelAdvertisedPricing, ModelCompletion, ModelCredentialHeader, ModelGatewayBinding, ModelGatewayConfig, ModelGatewayProtocol, ModelGenerationOptions, ModelGovernanceControls, ModelGovernanceMeter, ModelHistoryMessage, ModelInvocationArgs, ModelInvocationResult, ModelTechnicalCapabilities, ModelTool, NormalizedModelGatewayConfig, NoulAnswer, NoulQuestion, Out, Over, PartitionFn, PartitionSpec, Partitioning, PolicyCRN, PolicyConstraint, PolicyContextValue, PolicyDefinition, PolicyInput, PolicyInvocationOrigin, PolicyOutcome, Principal, PrincipalKind, Provenance, RawModelProtocol, Recovery, ReduceFact, ReduceOpts, Ref, RequestLabelRequest, ResourceContractRef, ResourceControlsConstraint, ResourceCredentialBinding, ResourceDependencyRef, ResourceKind, ResourceName, ResourceNameParts, ResourceNeed, ResourcePattern, ResourceSelector, RollbackReport, RunIdentityView, RunInfo, RunStatusDetail, RunSuiteRequest, Sandbox, SandboxCommandCollectionError, SandboxCommandExecution, SandboxCommandResult, SandboxExecInput, SandboxFileResult, SandboxGovernanceControls, SandboxGovernanceMeter, SandboxImage, SandboxMutationResult, SandboxNetworkMode, SandboxNetworkPolicy, SandboxPool, SandboxProcess, SandboxProcessCredentials, SandboxProcessIoOperation, SandboxProcessOperation, SandboxProcessReadInput, SandboxProcessReadResult, SandboxProcessStatus, SandboxProcessWriteResult, SandboxReadFileOptions, SandboxReadFileResult, SandboxWorkspace, SandboxWriteFileResult, Schedule, ScheduleCancellation, ScheduleDuration, ScheduleMissed, ScheduleOccurrence, ScheduleOccurrencePage, ScheduleOptions, SchedulePage, ScheduleState, ScheduleTarget, ScheduleTiming, ScheduleTrigger, ScheduleWhen, ScopedBindingKey, ScopedCredentialRef, ScopedMemoryStoreRef, ScopedModelGatewayRef, ScopedResourceRef, ScoreAnswer, ScoreQuestion, ScoreRequest, ScorerApplies, ScorerCRN, ScorerDef, ScorerEvaluation, ScorerKind, ScorerRef, ScorerVerdictIntent, SetEvalBaselineRequest, SetupAction, SetupCredentialCandidate, SetupCredentialInteractionPanel, SetupCredentialReceipt, SetupFormPanel, SetupPanel, SetupProgressPanel, SetupReviewPanel, SetupScreen, SetupStepStatus, SetupStepSummary, SetupSubmission, SetupTerminalPanel, SetupWorkflowStatus, Skill, SkillDescription, SkillLibrary, SkillSource, SortField, SpawnAttenuation, SpawnBudget, SpawnOpts, SqlFold, StageInfo, StageOutputSpec, StartTrainingRequest, SteerEvent, SuiteFact, TableAggregate, TableDescribeArgs, TableFilter, TableFilterOperation, TableOrder, TableQueryArgs, TableQueryPlan, TableQueryResult, TableScalar, TableSnapshotDescription, Task, Tier, Tool, ToolCallRecord, TrainingJobFact, TrainingJobReference, TrainingJobState, TrainingJobStatus, TrainingMethod, TrainingModelOffer, TrainingProviderDefinition, TrainingProviderMetadata, TrainingProviderPin, TrainingRecipe, TrainingResumePoint, TrainingUsageUnits, TurnDraft, TurnGate, TurnRecord, TurnSpec, UiAccess, UiBundle, UiBundleManifest, UiCRN, UiCapability, UiExecution, UiGovernanceMeter, UiHandler, UiResource, UiRuntimeContext, UiSource, UiSqlResult, UiState, UpstreamPayer, Verdict, VerdictSamplingMode, ViewDef, WaitResolvedEvent };
4642
+ /**
4643
+ * The ledger a LedgerAddress names, within the addressing Run's tenant, namespace and Customer partition.
4644
+ * `session`: `agent:<agent>/session:<session>`, that Session's main ledger.
4645
+ * `spawn`: `agent:<agent>/session:<session>/spawn:<handle>`, a spawned loop's ledger, named by its spawn's Handle id.
4646
+ * `legacy-session`: `session:<session>`, relative to the addressing Run's agent, kept for bundles already deployed.
4647
+ */
4648
+ type LedgerAddressParts = {
4649
+ kind: "session";
4650
+ agent: string;
4651
+ session: string;
4652
+ } | {
4653
+ kind: "spawn";
4654
+ agent: string;
4655
+ session: string;
4656
+ handle: string;
4657
+ } | {
4658
+ kind: "legacy-session";
4659
+ session: string;
4660
+ };
4661
+ /** Parses a ledger address into its parts; null when the value is not one of the three forms. */
4662
+ declare function parseLedgerAddress(value: unknown): LedgerAddressParts | null;
4663
+ /** Formats ledger address parts; throws when a part breaks its id rule. */
4664
+ declare function formatLedgerAddress(parts: LedgerAddressParts): LedgerAddress;
4665
+
4666
+ export { AGENT_UI_DEFAULTS, AfterYield, ApiError, CONSTAL_API_CAPABILITY, CONSTAL_API_GET_KINDS, CONSTAL_API_MODEL_TOOL_DESCRIPTIONS, CONSTAL_API_OPERATIONS, CONSTAL_API_OPERATION_SCHEMAS, CONSTAL_API_QUERY_KINDS, CONSTAL_API_VERSION, CommitConflict, CommitGateRejected, CredentialRevoked, CredentialUnavailable, DirectNetworkDenied, EVALUATION_LIMITS, EffectCeilingExceeded, EmptyJoin, GateExhausted, IntegrationRequestNotSent, LeaseLost, MCP_CLIENT_CAPABILITY, MCP_PROTOCOL_VERSION, MEMORY_OPERATION_DECLARATIONS, MODEL_CHECKPOINT_IMPORT_CAPABILITY, MODEL_COMPLETION_CAPABILITY, MODEL_EVALUATION_CAPABILITY, McpClient, NondeterministicReplay, OutcomeUnknown, PolicyConstraintFailed, PolicyDecisionFailed, RESOURCE_CREDENTIAL_BINDING_SCHEMA, RESOURCE_KINDS, ResourceDisabled, ResourceInvalid, ResourceUnbound, RollbackTargetInvalid, SessionDeleted, SpawnCardinality, SwallowedYield, TRAINING_PROVIDER_CAPABILITY, TerminalIntegrationFailure, ToolUnavailable, UI_ASSET_CONTENT_TYPES, UI_BUNDLE_BOUNDS, UnknownTool, WEB_FETCH_ARGUMENT_SCHEMA, WEB_SEARCH_ARGUMENT_SCHEMA, action, actionPattern, agent, agentLimit, agentResourceBinding, agentSetupMetadata, agentSetupRequirements, agentUiBundleManifest, agentUiDeclaration, all, analyticsEvent, approximateTokens, authProvider, authProviderName, bindingName, bucketFor, canonicalJson, capabilityContractRef, casTool, channel, channelIngressRequest, channelIngressSource, channelSourceEvidence, channelSubscriptionRequest, channelTarget, checkpointArtifactRef, checkpointDeploymentRequest, checkpointImportMetadata, checkpointImportRequest, codeScorerIR, containerImageReference, containerImageSelection, containerImageSource, credentialEvidence, credentialInteractionAction, credentialInteractionEvent, credentialInteractionResult, credentialName, credentialProvider, credentialProviderConfigSchema, credentialProviderName, credentialProviderSetupMetadata, credentialRotationDefaults, credentialSetupState, customerTenantName, cutBatches, cutPartitions, datasetName, evaluateCodeScorer, evaluatePolicyDefinition, evaluationArguments, evaluationProtocolRequest, evaluationProtocolResult, formatLedgerAddress, gateway, gatewayModelOffer, gatewayPackageMetadata, hash, hashValue, immutableContainerImageReference, integrationEgressPolicy, invocationCredentialUses, labelSelector, matchesAction, matchesLabelSelector, matchesResource, mcpToolDescription, mcpToolResult, memoryStoreBinding, modelAdvertisedPricing, modelControls, modelGatewayBinding, modelGatewayEndpoint, modelGenerationOptions, modelLimit, modelMessages, modelPrompt, modelProtocolRequest, modelProtocolResult, murmur3_32, normalizeModelGatewayConfig, normalizeSandboxNetworkPolicy, normalizeSandboxWorkspacePath, noulDecision, opTool, opTools, parseLedgerAddress, parseResourceName, policy, policyName, race, renderTrainingCompletion, resolveBindingOwner, resolveContainerImageSource, resolveGatewayEgress, resolveResourceDependencyRef, resourceContractRef, resourceCredentialBinding, resourceDependencyRef, resourceLabelMap, resourceName, resourceNeed, resourcePattern, resourceSelector, resourceTools, sandboxControls, sandboxLimit, scopedBindingKey, scopedCredentialRef, scopedResourceRef, scoreLevel, scorerName, select, selectableResourceLabels, setupAwait, setupCredentialReceipt, setupPanelProviderIsCrn, setupScreen, setupScreenView, setupSubmission, sha256Hex, skills, stageOutput, startTrainingRequest, subtask, tableDescribe, tableQuery, trainingProvider, trainingProviderMetadata, trainingRecipe, uiAssetContentType, uiBundle, uiBundleManifest, uiLimit, uiName, validateBatchSpec, validateFoldFn, validateJsonSchema, validateJsonSchemaDefinition, validatePartitionFn, validatePartitionSpec, validateStageOutputSpec, validateTool, validateView, webFetch, webSearch };
4667
+ export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentCredentialSetupRequirement, AgentDef, AgentDeployPolicy, AgentGovernanceMeter, AgentSetupMetadata, AgentSetupRequirement, AgentSetupWorkflow, AgentUiDeclaration, AnalyticsClient, AnalyticsDimensionValue, AnalyticsEventDefinition, AnalyticsIntent, AnalyticsValues, AuthProvider, AuthProviderCRN, AuthProviderContext, AuthProviderRequest, AuthProviderResult, AwaitOpts, AwaitPresentation, BatchSpec, BindingCRN, BindingOwnerContext, BindingOwnerScope, BoundOperation, BoundResourceCapabilities, BranchRef, CRN, CRNKind, CanonicalEvent, CanonicalEventDraft, CapabilityContractRef, CapabilityGrant, CapabilityRef, CaptureCaseRequest, CaseRow, CatalogTool, Channel, ChannelContext, ChannelFailure, ChannelIngressEvent, ChannelIngressSource, ChannelMessage, ChannelProtocol, ChannelReceiveResult, ChannelRequest, ChannelResponse, ChannelSourceEvidence, ChannelSubscriptionRequest, ChannelTarget, CheckpointDeploymentRequest, CheckpointImportMetadata, CheckpointImportRequest, ChoiceAnswer, ChoiceQuestion, CodeScoreResult, CodeScorerIR, CodeScorerRule, CommitOpts, CompareSuitesRequest, Compensation, ConnectionCancelRequest, ConnectionIdentity, ConnectionOperation, ConnectionRecoveryRequest, ConnectionRecoveryResult, ConnectionRequest, ConnectionUsageReport, ConstalApiApplyRequest, ConstalApiChangePlan, ConstalApiChangePlanRef, ConstalApiChangePlanRequest, ConstalApiChangeReceipt, ConstalApiOperationReceipt, ContainerImageReference, ContainerImageSelection, ContainerImageSource, ContainerRegistryRequest, ContainerRegistryResponse, ControlEvent, Cost, CreateSandboxImageOptions, CreateSandboxOptions, CredentialCRN, CredentialDestroyResult, CredentialEvidence, CredentialInteractionAction, CredentialInteractionAdvanceRequest, CredentialInteractionEvent, CredentialInteractionPrimaryAction, CredentialInteractionProof, CredentialInteractionResult, CredentialInteractionStartRequest, CredentialMaterialRequest, CredentialMintRequest, CredentialMintResult, CredentialProviderCRN, CredentialProviderContext, CredentialProviderCredentialSlotSetup, CredentialProviderDefinition, CredentialProviderPackage, CredentialProviderPackageMetadata, CredentialProviderSecretInput, CredentialProviderSetupMetadata, CredentialSetupState, CredentialUninstallRequest, CredentialUninstallResult, CredentialVerifyResult, Ctx, CustomerTenantCRN, DataManifest, DatasetCRN, DatasetDraft, DatasetRef, DelegatedGrant, DelegationCeiling, DeliveryMode, DeliveryReceipt, DispatchResult, EffectClass, EvalComparison, EvalDivergence, EvalMode, EvalSubject, EvalSubjectSource, EvaluationAnswer, EvaluationAnswerFor, EvaluationAnswers, EvaluationEntry, EvaluationInvocationArgs, EvaluationInvocationResult, EvaluationProtocol, EvaluationQuestion, EvaluationQuestions, EvaluationRecord, EvaluationSpec, EventBase, Fact, FactRef, FileEntry, FixedMemoryStoreRef, FixedModelGatewayRef, FoldFn, GateEvidence, GateResult, GateVerdict, GatewayCancelRequest, GatewayConfigEgressBinding, GatewayContext, GatewayCredentialSlotSetup, GatewayDefinition, GatewayDiscoverySetup, GatewayModelOffer, GatewayOperation, GatewayPackage, GatewayPackageMetadata, GatewayRecoveryRequest, GatewayRecoveryResult, GatewayRequest, GovernanceContractRef, Handle, HandleOutcome, Hash, HistoryView, HmacVerification, IgnoredChannelEvent, IngressRequest, IngressTarget, IntegrationArtifactEgressRequest, IntegrationArtifactEgressResponse, IntegrationAttachment, IntegrationContext, IntegrationEgressPolicy, IntegrationEgressRequest, IntegrationEgressResponse, IntegrationEgressRule, IntegrationLifecycle, IntegrationReleaseContext, IntegrationSecret, IntegrationState, InvocationCredentialUse, InvocationHandle, InvokableKind, InvokeOpts, JoinOutcome, JsonScalar, JsonValue, LabelRequest, LabelSelector, LabelSelectorOperator, LabelSelectorRequirement, LedgerAddress, LedgerAddressParts, LedgerEvent, ListSchedulesOptions, LoadedSkill, LocalResourceRef, ManifestIndexPage, MapFact, MapOpts, McpClientOptions, McpClientState, McpMessageTransport, MemoryDeleteArgs, MemoryGetArgs, MemoryRecord, MemoryRememberArgs, MemorySearchArgs, MemorySearchHit, MemoryStoreBinding, Mode, ModelAdvertisedPricing, ModelCompletion, ModelCredentialHeader, ModelGatewayBinding, ModelGatewayConfig, ModelGatewayProtocol, ModelGenerationOptions, ModelGovernanceControls, ModelGovernanceMeter, ModelHistoryMessage, ModelInvocationArgs, ModelInvocationResult, ModelTechnicalCapabilities, ModelTool, NormalizedModelGatewayConfig, NoulAnswer, NoulQuestion, Out, Over, PartitionFn, PartitionSpec, Partitioning, PolicyCRN, PolicyConstraint, PolicyContextValue, PolicyDefinition, PolicyInput, PolicyInvocationOrigin, PolicyOutcome, Principal, PrincipalKind, Provenance, RawModelProtocol, Recovery, ReduceFact, ReduceOpts, Ref, RequestLabelRequest, ResourceContractRef, ResourceControlsConstraint, ResourceCredentialBinding, ResourceDependencyRef, ResourceKind, ResourceName, ResourceNameParts, ResourceNeed, ResourcePattern, ResourceSelector, RollbackReport, RunIdentityView, RunInfo, RunReport, RunStatusDetail, RunSuiteRequest, Sandbox, SandboxCommandCollectionError, SandboxCommandExecution, SandboxCommandResult, SandboxExecInput, SandboxFileResult, SandboxGovernanceControls, SandboxGovernanceMeter, SandboxImage, SandboxMutationResult, SandboxNetworkMode, SandboxNetworkPolicy, SandboxPool, SandboxProcess, SandboxProcessCredentials, SandboxProcessIoOperation, SandboxProcessOperation, SandboxProcessReadInput, SandboxProcessReadResult, SandboxProcessStatus, SandboxProcessWriteResult, SandboxReadFileOptions, SandboxReadFileResult, SandboxWorkspace, SandboxWriteFileResult, Schedule, ScheduleCancellation, ScheduleDuration, ScheduleMissed, ScheduleOccurrence, ScheduleOccurrencePage, ScheduleOptions, SchedulePage, ScheduleState, ScheduleTarget, ScheduleTiming, ScheduleTrigger, ScheduleWhen, ScopedBindingKey, ScopedCredentialRef, ScopedMemoryStoreRef, ScopedModelGatewayRef, ScopedResourceRef, ScoreAnswer, ScoreQuestion, ScoreRequest, ScorerApplies, ScorerCRN, ScorerDef, ScorerEvaluation, ScorerKind, ScorerRef, ScorerVerdictIntent, SetEvalBaselineRequest, SetupAction, SetupCredentialCandidate, SetupCredentialInteractionPanel, SetupCredentialReceipt, SetupFormPanel, SetupPanel, SetupProgressPanel, SetupReviewPanel, SetupScreen, SetupStepStatus, SetupStepSummary, SetupSubmission, SetupTerminalPanel, SetupWorkflowStatus, Skill, SkillDescription, SkillLibrary, SkillSource, SortField, SpawnAttenuation, SpawnBudget, SpawnHandle, SpawnOpts, SqlFold, StageInfo, StageOutputSpec, StartTrainingRequest, SteerEvent, SuiteFact, TableAggregate, TableDescribeArgs, TableFilter, TableFilterOperation, TableOrder, TableQueryArgs, TableQueryPlan, TableQueryResult, TableScalar, TableSnapshotDescription, Task, Tier, Tool, ToolCallRecord, TrainingJobFact, TrainingJobReference, TrainingJobState, TrainingJobStatus, TrainingMethod, TrainingModelOffer, TrainingProviderDefinition, TrainingProviderMetadata, TrainingProviderPin, TrainingRecipe, TrainingResumePoint, TrainingUsageUnits, TurnDraft, TurnGate, TurnRecord, TurnSpec, UiAccess, UiBundle, UiBundleManifest, UiCRN, UiCapability, UiExecution, UiGovernanceMeter, UiHandler, UiResource, UiRuntimeContext, UiSource, UiSqlResult, UiState, UpstreamPayer, Verdict, VerdictSamplingMode, ViewDef, WaitResolvedEvent };
package/publish/index.js CHANGED
@@ -2667,16 +2667,19 @@ var MEMORY_OPERATION_DECLARATIONS = [
2667
2667
 
2668
2668
  // packages/sdk/src/integration.ts
2669
2669
  var ApiError = class extends Error {
2670
- constructor(status, body, disposition = "uncertain") {
2670
+ /** `retryAfterMs`: the interval the remote API stated, such as its `retry-after`; absent when it stated none. */
2671
+ constructor(status, body, disposition = "uncertain", retryAfterMs) {
2671
2672
  super(`${status}: ${body}`);
2672
2673
  this.status = status;
2673
2674
  this.body = body;
2674
2675
  this.disposition = disposition;
2676
+ this.retryAfterMs = retryAfterMs;
2675
2677
  this.name = "ApiError";
2676
2678
  }
2677
2679
  status;
2678
2680
  body;
2679
2681
  disposition;
2682
+ retryAfterMs;
2680
2683
  };
2681
2684
  var IntegrationRequestNotSent = class extends Error {
2682
2685
  constructor(message2 = "integration request was not sent") {
@@ -3729,7 +3732,7 @@ function credentialProviderSetupMetadata(value, slots) {
3729
3732
  return value;
3730
3733
  }
3731
3734
  function credentialProvider(definition) {
3732
- if (!/^[a-z0-9][a-z0-9._-]{0,127}$/u.test(definition.id) || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u.test(definition.version) || !definition.displayName || !definition.description || typeof definition.mint !== "function" || definition.verify !== void 0 && typeof definition.verify !== "function" || definition.destroy !== void 0 && typeof definition.destroy !== "function") {
3735
+ if (!/^[a-z0-9][a-z0-9._-]{0,127}$/u.test(definition.id) || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u.test(definition.version) || !definition.displayName || !definition.description || typeof definition.mint !== "function" || definition.verify !== void 0 && typeof definition.verify !== "function" || definition.destroy !== void 0 && typeof definition.destroy !== "function" || definition.uninstall !== void 0 && typeof definition.uninstall !== "function") {
3733
3736
  throw new TypeError("credential provider metadata is invalid");
3734
3737
  }
3735
3738
  if (definition.documentationUrl !== void 0) {
@@ -4408,6 +4411,37 @@ var SessionDeleted = class extends Error {
4408
4411
  }
4409
4412
  session;
4410
4413
  };
4414
+
4415
+ // packages/sdk/src/ledger-address.ts
4416
+ var AGENT = /^[a-z0-9][a-z0-9-]{0,62}$/u;
4417
+ var HANDLE = /^[0-9a-f]{64}$/u;
4418
+ function validSession(session) {
4419
+ return session.length > 0 && session.length <= 256 && !/[\u0000-\u001f/]/u.test(session);
4420
+ }
4421
+ function parseLedgerAddress(value) {
4422
+ if (typeof value !== "string") return null;
4423
+ if (value.startsWith("session:")) {
4424
+ const session2 = value.slice("session:".length);
4425
+ return validSession(session2) ? { kind: "legacy-session", session: session2 } : null;
4426
+ }
4427
+ const [agentSegment, sessionSegment, spawnSegment, ...rest] = value.split("/");
4428
+ if (rest.length > 0 || !agentSegment?.startsWith("agent:") || !sessionSegment?.startsWith("session:")) return null;
4429
+ const agent2 = agentSegment.slice("agent:".length);
4430
+ const session = sessionSegment.slice("session:".length);
4431
+ if (!AGENT.test(agent2) || !validSession(session)) return null;
4432
+ if (spawnSegment === void 0) return { kind: "session", agent: agent2, session };
4433
+ if (!spawnSegment.startsWith("spawn:")) return null;
4434
+ const handle = spawnSegment.slice("spawn:".length);
4435
+ return HANDLE.test(handle) ? { kind: "spawn", agent: agent2, session, handle } : null;
4436
+ }
4437
+ function formatLedgerAddress(parts) {
4438
+ if (!validSession(parts.session)) throw new TypeError("ledger address session is invalid");
4439
+ if (parts.kind === "legacy-session") return `session:${parts.session}`;
4440
+ if (!AGENT.test(parts.agent)) throw new TypeError("ledger address agent is invalid");
4441
+ if (parts.kind === "session") return `agent:${parts.agent}/session:${parts.session}`;
4442
+ if (!HANDLE.test(parts.handle)) throw new TypeError("ledger address spawn handle is invalid");
4443
+ return `agent:${parts.agent}/session:${parts.session}/spawn:${parts.handle}`;
4444
+ }
4411
4445
  export {
4412
4446
  AGENT_UI_DEFAULTS,
4413
4447
  AfterYield,
@@ -4511,6 +4545,7 @@ export {
4511
4545
  evaluationArguments,
4512
4546
  evaluationProtocolRequest,
4513
4547
  evaluationProtocolResult,
4548
+ formatLedgerAddress,
4514
4549
  gateway,
4515
4550
  gatewayModelOffer,
4516
4551
  gatewayPackageMetadata,
@@ -4543,6 +4578,7 @@ export {
4543
4578
  noulDecision,
4544
4579
  opTool,
4545
4580
  opTools,
4581
+ parseLedgerAddress,
4546
4582
  parseResourceName,
4547
4583
  policy,
4548
4584
  policyName,