@constal/sdk 4.2.0 → 4.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constal/sdk",
3
- "version": "4.2.0",
3
+ "version": "4.4.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.2.0",
3
+ "version": "4.4.0",
4
4
  "exports": [
5
5
  "AGENT_UI_DEFAULTS",
6
6
  "Action",
@@ -16,6 +16,7 @@
16
16
  "AgentDef",
17
17
  "AgentDeliveryReceipt",
18
18
  "AgentDeployPolicy",
19
+ "AgentGovernanceMeter",
19
20
  "AgentResultDelivery",
20
21
  "AgentSendOpts",
21
22
  "AgentSetupMetadata",
@@ -131,6 +132,8 @@
131
132
  "CredentialRevoked",
132
133
  "CredentialSetupState",
133
134
  "CredentialUnavailable",
135
+ "CredentialUninstallRequest",
136
+ "CredentialUninstallResult",
134
137
  "CredentialVerifyResult",
135
138
  "Ctx",
136
139
  "CustomerTenantCRN",
@@ -223,6 +226,7 @@
223
226
  "LabelSelectorRequirement",
224
227
  "LeaseLost",
225
228
  "LedgerAddress",
229
+ "LedgerAddressParts",
226
230
  "LedgerEvent",
227
231
  "ListSchedulesOptions",
228
232
  "LoadedSkill",
@@ -309,6 +313,7 @@
309
313
  "RollbackTargetInvalid",
310
314
  "RunIdentityView",
311
315
  "RunInfo",
316
+ "RunReport",
312
317
  "RunStatusDetail",
313
318
  "RunSuiteRequest",
314
319
  "Sandbox",
@@ -388,6 +393,7 @@
388
393
  "SpawnAttenuation",
389
394
  "SpawnBudget",
390
395
  "SpawnCardinality",
396
+ "SpawnHandle",
391
397
  "SpawnOpts",
392
398
  "SqlFold",
393
399
  "StageInfo",
@@ -455,6 +461,7 @@
455
461
  "action",
456
462
  "actionPattern",
457
463
  "agent",
464
+ "agentLimit",
458
465
  "agentResourceBinding",
459
466
  "agentSetupMetadata",
460
467
  "agentSetupRequirements",
@@ -504,6 +511,7 @@
504
511
  "evaluationArguments",
505
512
  "evaluationProtocolRequest",
506
513
  "evaluationProtocolResult",
514
+ "formatLedgerAddress",
507
515
  "gateway",
508
516
  "gatewayModelOffer",
509
517
  "gatewayPackageMetadata",
@@ -536,6 +544,7 @@
536
544
  "noulDecision",
537
545
  "opTool",
538
546
  "opTools",
547
+ "parseLedgerAddress",
539
548
  "parseResourceName",
540
549
  "policy",
541
550
  "policyName",
@@ -1379,6 +1379,8 @@ interface AdmissionLimitConstraint {
1379
1379
  window: AdmissionLimitWindow;
1380
1380
  maximum: number;
1381
1381
  continuity: "target" | "target-version";
1382
+ /** Absent rejects. "queue" makes a Run start wait for a slot. */
1383
+ overLimit?: "reject" | "queue";
1382
1384
  }
1383
1385
  type AdmissionLimitInput<M extends string = string> = Omit<AdmissionLimitConstraint, "kind" | "contract" | "meter"> & {
1384
1386
  meter: M;
@@ -1390,11 +1392,13 @@ interface ModelGovernanceControls {
1390
1392
  }
1391
1393
  type ModelGovernanceMeter = "cached_input_tokens" | "input_tokens" | "output_tokens" | "requests";
1392
1394
  type UiGovernanceMeter = "requests";
1395
+ type AgentGovernanceMeter = "runs";
1393
1396
  declare function sandboxControls(values: Partial<SandboxGovernanceControls>): ResourceControlsConstraint;
1394
1397
  declare function sandboxLimit(input: AdmissionLimitInput<SandboxGovernanceMeter>): AdmissionLimitConstraint;
1395
1398
  declare function modelControls(values: Partial<ModelGovernanceControls>, contract?: GovernanceContractRef): ResourceControlsConstraint;
1396
1399
  declare function modelLimit(input: AdmissionLimitInput<ModelGovernanceMeter>, contract?: GovernanceContractRef): AdmissionLimitConstraint;
1397
1400
  declare function uiLimit(input: AdmissionLimitInput<UiGovernanceMeter>): AdmissionLimitConstraint;
1401
+ declare function agentLimit(input: AdmissionLimitInput<AgentGovernanceMeter>): AdmissionLimitConstraint;
1398
1402
 
1399
1403
  type PrincipalKind = "user" | "service" | "channel" | "agent" | "anonymous";
1400
1404
  interface CustomerPrincipalContext {
@@ -2198,6 +2202,10 @@ type LedgerEvent = SteerEvent | ControlEvent | WaitResolvedEvent | (EventBase &
2198
2202
  itemId: string;
2199
2203
  target: LedgerAddress | "export";
2200
2204
  fact: FactRef;
2205
+ /** The sending Run. */
2206
+ run?: string;
2207
+ /** The delivery made the sending Run's Session the owner of its target Session. */
2208
+ delegate?: true;
2201
2209
  }) | (EventBase & {
2202
2210
  kind: "delivery-acknowledged";
2203
2211
  itemId: string;
@@ -2283,7 +2291,9 @@ interface AwaitOpts<T> {
2283
2291
  schema?: object;
2284
2292
  /** Optional caller-selected response size limit, in UTF-8 bytes. */
2285
2293
  maxBytes?: number;
2286
- 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; it returns no value and the delivery stays in the ledger. */
2296
+ afterRun?: "ignore" | "message" | "delivery";
2287
2297
  /** Explicitly public presentation; never include Credential material or private evidence. */
2288
2298
  presentation?: AwaitPresentation;
2289
2299
  }
@@ -2301,6 +2311,10 @@ interface Handle<T> extends PromiseLike<T> {
2301
2311
  interface InvocationHandle<T> extends Handle<T> {
2302
2312
  start(): Promise<void>;
2303
2313
  }
2314
+ /** A spawn's Handle names the spawned loop's ledger, the same across the spawn's retries. */
2315
+ interface SpawnHandle<T> extends Handle<T> {
2316
+ readonly ledger: LedgerAddress;
2317
+ }
2304
2318
  /** A message to an exactly bound Agent creates one distinct target Run. */
2305
2319
  type AgentSendOpts = {
2306
2320
  session: string;
@@ -2335,9 +2349,35 @@ interface CommitOpts {
2335
2349
  };
2336
2350
  expectedHead?: FactRef;
2337
2351
  deliver?: DeliveryMode;
2352
+ /** Makes this Run's Session the owner of the Session whose main ledger `to` names. */
2353
+ delegate?: boolean;
2338
2354
  /** Explicitly public presentation delivered by the originating Channel when this Run was admitted through one. */
2339
2355
  presentation?: AwaitPresentation;
2340
2356
  }
2357
+ /** A Run's end, hold or refused start, delivered by the platform as the body { text, data } to the Session's owner, to the
2358
+ * refused event's origin, or to the Session itself. */
2359
+ interface RunReport {
2360
+ /** One sentence the platform writes. */
2361
+ text: string;
2362
+ data: {
2363
+ object: "constal.run.report";
2364
+ version: 1;
2365
+ /** The reporting Session. */
2366
+ session: LedgerAddress;
2367
+ /** Null for a refusal. */
2368
+ run: string | null;
2369
+ /** The event that started the Run, or the refused event. */
2370
+ event: string;
2371
+ status: "complete" | "failed" | "stopped" | "held" | "refused";
2372
+ /** The Run's error, its limit, or the refusal's code. */
2373
+ error: string | null;
2374
+ /** A completed Run's result, read through a view of its ledger. */
2375
+ result: {
2376
+ fact: string;
2377
+ ref: string;
2378
+ } | null;
2379
+ };
2380
+ }
2341
2381
  interface Cost {
2342
2382
  accounting: {
2343
2383
  trackedCost: {
@@ -2664,6 +2704,9 @@ interface RunInfo {
2664
2704
  crn: CRN;
2665
2705
  };
2666
2706
  mode: Mode;
2707
+ /** 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
2708
+ * Run that nothing addresses (an operator branch, an eval fork, a compensation). */
2709
+ ledger?: LedgerAddress | null;
2667
2710
  /** Present for an independently scheduled invocation; input remains unchanged. */
2668
2711
  schedule?: ScheduleTrigger;
2669
2712
  }
@@ -2917,6 +2960,9 @@ interface CanonicalEventDraft<T = unknown> {
2917
2960
  data: T;
2918
2961
  occurredAt?: number;
2919
2962
  deliver?: DeliveryMode;
2963
+ /** When respond() runs: "receipt" once the event is durably in its Session's inbox; "run-result" once the Run it
2964
+ * starts settles, up to 120 s. Default: "receipt" for queue, "run-result" for live. */
2965
+ completion?: "receipt" | "run-result";
2920
2966
  /** Channel-owned reply address pinned at admission; Agent input cannot replace it. */
2921
2967
  reply?: {
2922
2968
  destination: string;
@@ -3452,8 +3498,8 @@ interface ConstalApiError {
3452
3498
  * management Resource. Keep authorization-only CRN families such as ledger,
3453
3499
  * table, and artifact out of this model-facing inventory contract.
3454
3500
  */
3455
- declare const CONSTAL_API_QUERY_KINDS: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait"];
3456
- declare const CONSTAL_API_GET_KINDS: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait"];
3501
+ declare const CONSTAL_API_QUERY_KINDS: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
3502
+ declare const CONSTAL_API_GET_KINDS: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
3457
3503
  declare const CONSTAL_API_MODEL_TOOL_DESCRIPTIONS: {
3458
3504
  readonly query: "Query authorized Constal objects with bounded pagination and evidence. Select the exact lower-case singular kind from the schema enum; never pluralize, recase, or substitute an abstract kind. If context supplies platformToolContract.queryScope, copy it unchanged. Otherwise use only an exact namespace allowed by the delegated Run authority, and tenant scope only for an explicitly tenant-wide request. Use catalog-advertised fields and filters; constrained kinds require their advertised filter. Preserve next and evidence completeness.";
3459
3505
  readonly get: "Retrieve one exact authorized Constal object or immutable revision. Pass a complete ref unchanged from query, relations, runtime inspection, or a governed receipt; never construct a kind, id, namespace, CRN, hash, or cursor from display text. The schema enum contains every supported addressable kind. For a Run, omit fields for complete diagnosis or request only documented top-level fields, and follow only the returned page cursor.";
@@ -3509,7 +3555,7 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
3509
3555
  readonly description: "Query one exact catalog kind. Kind ids are lower-case, singular, and must be selected from the enum; abstract names and pluralizations are invalid.";
3510
3556
  readonly properties: {
3511
3557
  readonly kind: {
3512
- readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait"];
3558
+ readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
3513
3559
  readonly description: "Exact queryable kind. Never guess a kind or change its casing.";
3514
3560
  };
3515
3561
  readonly scope: {
@@ -3614,7 +3660,7 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
3614
3660
  readonly additionalProperties: false;
3615
3661
  readonly properties: {
3616
3662
  readonly kind: {
3617
- readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait"];
3663
+ readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
3618
3664
  readonly description: "Exact lower-case object kind returned by a governed platform result.";
3619
3665
  };
3620
3666
  readonly id: {
@@ -3698,7 +3744,7 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
3698
3744
  readonly additionalProperties: false;
3699
3745
  readonly properties: {
3700
3746
  readonly kind: {
3701
- readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait"];
3747
+ readonly enum: readonly ["agent", "channel", "ui", "auth-provider", "policy", "credential-provider", "credential", "tool", "scorer", "dataset", "model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault", "analytics", "customer", "binding", "session", "run", "deployment", "documentation", "analytics-event", "namespace", "team-member", "team-invite", "api-key", "billing-account", "invoice", "subscription", "resource-contract", "dataset-draft", "dataset-case", "eval-score", "eval-sample", "eval-policy", "eval-suite", "eval-baseline", "eval-schedule", "training-job", "checkpoint", "training-provider", "training-model", "checkpoint-gateway", "credential-provider-package", "credential-consumer", "credential-use", "credential-event", "gateway-package", "rollout", "wait", "run-queue-item"];
3702
3748
  readonly description: "Exact lower-case object kind returned by a governed platform result.";
3703
3749
  };
3704
3750
  readonly id: {
@@ -4288,6 +4334,23 @@ interface CredentialVerifyResult {
4288
4334
  interface CredentialDestroyResult {
4289
4335
  destroyed: boolean;
4290
4336
  }
4337
+ interface CredentialUninstallRequest extends CredentialMaterialRequest {
4338
+ /**
4339
+ * The external identity the caller owns and expects to remove, such as an installation or workspace id. A provider
4340
+ * that reaches a different one must answer `unable` and remove nothing.
4341
+ */
4342
+ expectedIdentity: string | null;
4343
+ }
4344
+ /**
4345
+ * `removed`: the provider removed it. `absent`: it was already gone. `unable`: it is still there and this provider could
4346
+ * not remove it, with a short machine-readable reason. A failure that may pass, such as an outage, is thrown instead.
4347
+ */
4348
+ type CredentialUninstallResult = {
4349
+ outcome: "removed" | "absent";
4350
+ } | {
4351
+ outcome: "unable";
4352
+ reason: string;
4353
+ };
4291
4354
  type CredentialProviderSecretInput = "secret" | "multiline" | "file";
4292
4355
  interface CredentialProviderCredentialSlotSetup {
4293
4356
  /** Human-readable name shown while the provider is configured. */
@@ -4347,6 +4410,11 @@ interface CredentialProviderDefinition<C = unknown> extends Omit<CredentialProvi
4347
4410
  mint(request: CredentialMintRequest, context: IntegrationContext): Promise<CredentialMintResult>;
4348
4411
  verify?(request: CredentialMaterialRequest, context: IntegrationContext): Promise<CredentialVerifyResult>;
4349
4412
  destroy?(request: CredentialMaterialRequest, context: IntegrationContext): Promise<CredentialDestroyResult>;
4413
+ /**
4414
+ * Removes what the Credential stands for at its source, such as an app installation. Destroy ends one version and
4415
+ * runs on every rotation; this ends the grant, and runs only when a deletion of the Credential asks for it.
4416
+ */
4417
+ uninstall?(request: CredentialUninstallRequest, context: IntegrationContext): Promise<CredentialUninstallResult>;
4350
4418
  }
4351
4419
  type CredentialProviderContext = IntegrationContext;
4352
4420
  /** Validated user-authored Credential Provider package. */
@@ -4579,5 +4647,29 @@ declare class SessionDeleted extends Error {
4579
4647
  constructor(session: string);
4580
4648
  }
4581
4649
 
4582
- 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, 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 };
4583
- export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentCredentialSetupRequirement, AgentDef, AgentDeliveryReceipt, AgentDeployPolicy, 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 };
4650
+ /**
4651
+ * The ledger a LedgerAddress names, within the addressing Run's tenant, namespace and Customer partition.
4652
+ * `session`: `agent:<agent>/session:<session>`, that Session's main ledger.
4653
+ * `spawn`: `agent:<agent>/session:<session>/spawn:<handle>`, a spawned loop's ledger, named by its spawn's Handle id.
4654
+ * `legacy-session`: `session:<session>`, relative to the addressing Run's agent, kept for bundles already deployed.
4655
+ */
4656
+ type LedgerAddressParts = {
4657
+ kind: "session";
4658
+ agent: string;
4659
+ session: string;
4660
+ } | {
4661
+ kind: "spawn";
4662
+ agent: string;
4663
+ session: string;
4664
+ handle: string;
4665
+ } | {
4666
+ kind: "legacy-session";
4667
+ session: string;
4668
+ };
4669
+ /** Parses a ledger address into its parts; null when the value is not one of the three forms. */
4670
+ declare function parseLedgerAddress(value: unknown): LedgerAddressParts | null;
4671
+ /** Formats ledger address parts; throws when a part breaks its id rule. */
4672
+ declare function formatLedgerAddress(parts: LedgerAddressParts): LedgerAddress;
4673
+
4674
+ 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 };
4675
+ 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, 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
@@ -1888,7 +1888,8 @@ var CONSTAL_API_QUERY_KINDS = [
1888
1888
  "credential-event",
1889
1889
  "gateway-package",
1890
1890
  "rollout",
1891
- "wait"
1891
+ "wait",
1892
+ "run-queue-item"
1892
1893
  ];
1893
1894
  var CONSTAL_API_GET_KINDS = CONSTAL_API_QUERY_KINDS;
1894
1895
  var CONSTAL_API_MODEL_TOOL_DESCRIPTIONS = {
@@ -2136,6 +2137,11 @@ var UI_CONTRACT = {
2136
2137
  version: "1",
2137
2138
  hash: "133f0ab76ca2f1435dfbaa151652cfc79926ea5237c0892d0c4d3b96d7bb6f48"
2138
2139
  };
2140
+ var AGENT_CONTRACT = {
2141
+ id: "constal.agent",
2142
+ version: "1",
2143
+ hash: "5c07310dba13e0a3982ee8c370f25f9411979bcf6fd105af27a245b04ed38ad1"
2144
+ };
2139
2145
  var sandboxSchema = SANDBOX_CONTROLS_SCHEMA;
2140
2146
  var modelSchema = MODEL_CONTROLS_SCHEMA;
2141
2147
  function controls(contract, values, schema) {
@@ -2144,7 +2150,10 @@ function controls(contract, values, schema) {
2144
2150
  return { kind: "resource-controls", contract, values };
2145
2151
  }
2146
2152
  function limit(contract, meters, input) {
2147
- if (!input || typeof input !== "object" || !/^[a-z][a-z0-9._-]{0,127}$/u.test(input.id) || !meters.includes(input.meter) || !["run", "session", "subject", "customer", "tenant", "binding", "resource"].includes(input.scope) || !input.window || !["concurrency", "fixed", "lifetime"].includes(input.window.kind) || input.window.kind === "fixed" && (!Number.isSafeInteger(input.window.milliseconds) || input.window.milliseconds < 1) || !Number.isFinite(input.maximum) || input.maximum < 0 || !["target", "target-version"].includes(input.continuity)) throw new TypeError("governance limit is invalid");
2153
+ if (!input || typeof input !== "object" || !/^[a-z][a-z0-9._-]{0,127}$/u.test(input.id) || !meters.includes(input.meter) || !["run", "session", "subject", "customer", "tenant", "binding", "resource"].includes(input.scope) || !input.window || !["concurrency", "fixed", "lifetime"].includes(input.window.kind) || input.window.kind === "fixed" && (!Number.isSafeInteger(input.window.milliseconds) || input.window.milliseconds < 1) || !Number.isFinite(input.maximum) || input.maximum < 0 || !["target", "target-version"].includes(input.continuity) || Object.hasOwn(input, "overLimit") && input.overLimit !== "reject" && input.overLimit !== "queue") throw new TypeError("governance limit is invalid");
2154
+ if (input.overLimit === "queue" && (contract?.id !== "constal.agent" || input.window.kind !== "concurrency" || input.continuity !== "target")) {
2155
+ throw new TypeError("admission limit overLimit queue requires the constal.agent contract, a concurrency window and target continuity");
2156
+ }
2148
2157
  return { kind: "admission-limit", contract, ...input };
2149
2158
  }
2150
2159
  function sandboxControls(values) {
@@ -2162,6 +2171,10 @@ function modelLimit(input, contract = MODEL_CONTRACT) {
2162
2171
  function uiLimit(input) {
2163
2172
  return limit(UI_CONTRACT, ["requests"], input);
2164
2173
  }
2174
+ function agentLimit(input) {
2175
+ if (input?.window?.kind !== "concurrency") throw new TypeError("agent limits count concurrent Runs; window must be concurrency");
2176
+ return limit(AGENT_CONTRACT, ["runs"], input);
2177
+ }
2165
2178
  function validatePolicyGovernanceConstraint(value) {
2166
2179
  if (value.kind === "resource-controls") {
2167
2180
  if (!value.contract || typeof value.contract.id !== "string" || typeof value.contract.version !== "string" || !/^[a-f0-9]{64}$/u.test(value.contract.hash) || !value.values || typeof value.values !== "object" || Array.isArray(value.values)) {
@@ -3716,7 +3729,7 @@ function credentialProviderSetupMetadata(value, slots) {
3716
3729
  return value;
3717
3730
  }
3718
3731
  function credentialProvider(definition) {
3719
- 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") {
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" || definition.uninstall !== void 0 && typeof definition.uninstall !== "function") {
3720
3733
  throw new TypeError("credential provider metadata is invalid");
3721
3734
  }
3722
3735
  if (definition.documentationUrl !== void 0) {
@@ -4395,6 +4408,37 @@ var SessionDeleted = class extends Error {
4395
4408
  }
4396
4409
  session;
4397
4410
  };
4411
+
4412
+ // packages/sdk/src/ledger-address.ts
4413
+ var AGENT = /^[a-z0-9][a-z0-9-]{0,62}$/u;
4414
+ var HANDLE = /^[0-9a-f]{64}$/u;
4415
+ function validSession(session) {
4416
+ return session.length > 0 && session.length <= 256 && !/[\u0000-\u001f/]/u.test(session);
4417
+ }
4418
+ function parseLedgerAddress(value) {
4419
+ if (typeof value !== "string") return null;
4420
+ if (value.startsWith("session:")) {
4421
+ const session2 = value.slice("session:".length);
4422
+ return validSession(session2) ? { kind: "legacy-session", session: session2 } : null;
4423
+ }
4424
+ const [agentSegment, sessionSegment, spawnSegment, ...rest] = value.split("/");
4425
+ if (rest.length > 0 || !agentSegment?.startsWith("agent:") || !sessionSegment?.startsWith("session:")) return null;
4426
+ const agent2 = agentSegment.slice("agent:".length);
4427
+ const session = sessionSegment.slice("session:".length);
4428
+ if (!AGENT.test(agent2) || !validSession(session)) return null;
4429
+ if (spawnSegment === void 0) return { kind: "session", agent: agent2, session };
4430
+ if (!spawnSegment.startsWith("spawn:")) return null;
4431
+ const handle = spawnSegment.slice("spawn:".length);
4432
+ return HANDLE.test(handle) ? { kind: "spawn", agent: agent2, session, handle } : null;
4433
+ }
4434
+ function formatLedgerAddress(parts) {
4435
+ if (!validSession(parts.session)) throw new TypeError("ledger address session is invalid");
4436
+ if (parts.kind === "legacy-session") return `session:${parts.session}`;
4437
+ if (!AGENT.test(parts.agent)) throw new TypeError("ledger address agent is invalid");
4438
+ if (parts.kind === "session") return `agent:${parts.agent}/session:${parts.session}`;
4439
+ if (!HANDLE.test(parts.handle)) throw new TypeError("ledger address spawn handle is invalid");
4440
+ return `agent:${parts.agent}/session:${parts.session}/spawn:${parts.handle}`;
4441
+ }
4398
4442
  export {
4399
4443
  AGENT_UI_DEFAULTS,
4400
4444
  AfterYield,
@@ -4448,6 +4492,7 @@ export {
4448
4492
  action,
4449
4493
  actionPattern,
4450
4494
  agent,
4495
+ agentLimit,
4451
4496
  agentResourceBinding,
4452
4497
  agentSetupMetadata,
4453
4498
  agentSetupRequirements,
@@ -4497,6 +4542,7 @@ export {
4497
4542
  evaluationArguments,
4498
4543
  evaluationProtocolRequest,
4499
4544
  evaluationProtocolResult,
4545
+ formatLedgerAddress,
4500
4546
  gateway,
4501
4547
  gatewayModelOffer,
4502
4548
  gatewayPackageMetadata,
@@ -4529,6 +4575,7 @@ export {
4529
4575
  noulDecision,
4530
4576
  opTool,
4531
4577
  opTools,
4578
+ parseLedgerAddress,
4532
4579
  parseResourceName,
4533
4580
  policy,
4534
4581
  policyName,