@constal/sdk 2.5.0 → 3.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/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "@constal/sdk",
3
- "version": "2.5.0",
3
+ "version": "3.0.0",
4
4
  "description": "Public TypeScript SDK for authoring Constal agents, integrations, policies, channels, and credential providers",
5
- "keywords": ["constal", "agents", "integrations", "typescript", "sdk"],
5
+ "keywords": [
6
+ "constal",
7
+ "agents",
8
+ "integrations",
9
+ "typescript",
10
+ "sdk"
11
+ ],
6
12
  "license": "UNLICENSED",
7
13
  "homepage": "https://constal.ai",
8
14
  "type": "module",
@@ -15,8 +21,12 @@
15
21
  "import": "./publish/index.js"
16
22
  }
17
23
  },
18
- "files": ["publish"],
19
- "publishConfig": { "access": "public" },
24
+ "files": [
25
+ "publish"
26
+ ],
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
20
30
  "scripts": {
21
31
  "build": "node ../../scripts/build-sdk-boundaries.mjs --public-only",
22
32
  "test": "vitest run test",
package/publish/api.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@constal/sdk",
3
- "version": "2.5.0",
3
+ "version": "3.0.0",
4
4
  "exports": [
5
5
  "Action",
6
6
  "ActionPattern",
@@ -11,8 +11,12 @@
11
11
  "AdmissionLimitWindow",
12
12
  "AfterYield",
13
13
  "Agent",
14
+ "AgentCredentialSetupRequirement",
14
15
  "AgentDef",
15
16
  "AgentDeployPolicy",
17
+ "AgentSetupMetadata",
18
+ "AgentSetupRequirement",
19
+ "AgentSetupWorkflow",
16
20
  "AnalyticsClient",
17
21
  "AnalyticsDimensionValue",
18
22
  "AnalyticsEventDefinition",
@@ -28,11 +32,15 @@
28
32
  "AwaitPresentation",
29
33
  "BatchSpec",
30
34
  "BindingCRN",
35
+ "BindingOwnerContext",
31
36
  "BindingOwnerScope",
32
37
  "BranchRef",
33
38
  "CONSTAL_API_CAPABILITY",
39
+ "CONSTAL_API_GET_KINDS",
40
+ "CONSTAL_API_MODEL_TOOL_DESCRIPTIONS",
34
41
  "CONSTAL_API_OPERATIONS",
35
42
  "CONSTAL_API_OPERATION_SCHEMAS",
43
+ "CONSTAL_API_QUERY_KINDS",
36
44
  "CONSTAL_API_VERSION",
37
45
  "CRN",
38
46
  "CRNKind",
@@ -48,11 +56,16 @@
48
56
  "ChannelAlarm",
49
57
  "ChannelAlarmResult",
50
58
  "ChannelContext",
59
+ "ChannelIngressEvent",
60
+ "ChannelIngressSource",
51
61
  "ChannelMessage",
52
62
  "ChannelProtocol",
53
63
  "ChannelReceiveResult",
54
64
  "ChannelRequest",
55
65
  "ChannelResponse",
66
+ "ChannelSourceEvidence",
67
+ "ChannelSubscriptionRequest",
68
+ "ChannelTarget",
56
69
  "CheckpointDeploymentRequest",
57
70
  "CheckpointImportMetadata",
58
71
  "CheckpointImportRequest",
@@ -83,6 +96,7 @@
83
96
  "CreateSandboxOptions",
84
97
  "CredentialCRN",
85
98
  "CredentialDestroyResult",
99
+ "CredentialEvidence",
86
100
  "CredentialInteractionAction",
87
101
  "CredentialInteractionAdvanceRequest",
88
102
  "CredentialInteractionEvent",
@@ -102,6 +116,7 @@
102
116
  "CredentialProviderSecretInput",
103
117
  "CredentialProviderSetupMetadata",
104
118
  "CredentialRevoked",
119
+ "CredentialSetupState",
105
120
  "CredentialUnavailable",
106
121
  "CredentialVerifyResult",
107
122
  "Ctx",
@@ -260,6 +275,9 @@
260
275
  "SandboxNetworkMode",
261
276
  "SandboxNetworkPolicy",
262
277
  "SandboxPool",
278
+ "SandboxReadFileOptions",
279
+ "SandboxReadFileResult",
280
+ "SandboxWriteFileResult",
263
281
  "ScopedBindingKey",
264
282
  "ScopedCredentialRef",
265
283
  "ScopedMemoryStoreRef",
@@ -276,6 +294,7 @@
276
294
  "SessionDeleted",
277
295
  "SetEvalBaselineRequest",
278
296
  "SetupAction",
297
+ "SetupCredentialCandidate",
279
298
  "SetupCredentialInteractionPanel",
280
299
  "SetupFormPanel",
281
300
  "SetupPanel",
@@ -358,6 +377,8 @@
358
377
  "actionPattern",
359
378
  "agent",
360
379
  "agentResourceBinding",
380
+ "agentSetupMetadata",
381
+ "agentSetupRequirements",
361
382
  "analyticsEvent",
362
383
  "approximateTokens",
363
384
  "authProvider",
@@ -368,11 +389,17 @@
368
389
  "capabilityContractRef",
369
390
  "casTool",
370
391
  "channel",
392
+ "channelIngressRequest",
393
+ "channelIngressSource",
394
+ "channelSourceEvidence",
395
+ "channelSubscriptionRequest",
396
+ "channelTarget",
371
397
  "checkpointArtifactRef",
372
398
  "checkpointDeploymentRequest",
373
399
  "checkpointImportMetadata",
374
400
  "checkpointImportRequest",
375
401
  "codeScorerIR",
402
+ "credentialEvidence",
376
403
  "credentialInteractionAction",
377
404
  "credentialInteractionEvent",
378
405
  "credentialInteractionResult",
@@ -382,6 +409,7 @@
382
409
  "credentialProviderName",
383
410
  "credentialProviderSetupMetadata",
384
411
  "credentialRotationDefaults",
412
+ "credentialSetupState",
385
413
  "customerTenantName",
386
414
  "cutBatches",
387
415
  "cutPartitions",
@@ -416,6 +444,7 @@
416
444
  "policy",
417
445
  "policyName",
418
446
  "renderTrainingCompletion",
447
+ "resolveBindingOwner",
419
448
  "resolveGatewayEgress",
420
449
  "resolveResourceDependencyRef",
421
450
  "resourceContractRef",
@@ -432,6 +461,7 @@
432
461
  "scopedCredentialRef",
433
462
  "scopedResourceRef",
434
463
  "scorerName",
464
+ "selectableResourceLabels",
435
465
  "setupAwait",
436
466
  "setupScreen",
437
467
  "setupScreenView",
@@ -745,6 +745,14 @@ declare function resourceLabelMap(value: unknown, options?: {
745
745
  declare function labelSelector(value: unknown): LabelSelector;
746
746
  declare function resourceSelector<K extends CRNKind>(value: unknown, allowedKinds: readonly K[]): ResourceSelector<K>;
747
747
  declare function matchesLabelSelector(selector: LabelSelector, labels: Record<string, string>): boolean;
748
+ declare function selectableResourceLabels(input: {
749
+ crn: string;
750
+ name: string;
751
+ namespace: string;
752
+ kind: string;
753
+ version?: string;
754
+ labels?: Record<string, string>;
755
+ }): Record<string, string>;
748
756
 
749
757
  declare const RESOURCE_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"];
750
758
  declare const PLATFORM_ADDRESS_KINDS: readonly ["analytics", "role", "principal", "customer", "binding", "session", "run", "ledger", "table", "artifact", "deployment"];
@@ -806,6 +814,24 @@ interface CapabilityContractRef {
806
814
  version: string;
807
815
  hash: Hash;
808
816
  }
817
+ type BindingOwner = {
818
+ kind: "tenant";
819
+ tenant: string;
820
+ } | {
821
+ kind: "customer";
822
+ customer: CustomerTenantCRN;
823
+ } | {
824
+ kind: "principal";
825
+ principal: ResourceName;
826
+ };
827
+ /** Authenticated context from which a scoped binding's owner is derived. */
828
+ interface BindingOwnerContext {
829
+ environment: string;
830
+ tenant: string;
831
+ principal?: ResourceName;
832
+ customer?: CustomerTenantCRN;
833
+ }
834
+ declare function resolveBindingOwner(scope: BindingOwnerScope, context: BindingOwnerContext, required?: boolean): BindingOwner | null;
809
835
  interface ScopedResourceRef {
810
836
  kind: "scoped";
811
837
  key: ScopedBindingKey;
@@ -861,6 +887,32 @@ interface ScopedCredentialRef {
861
887
  }
862
888
  type AgentResourceBinding = CRN | ScopedResourceRef;
863
889
  type ResourceCredentialBinding = CredentialCRN | ScopedCredentialRef;
890
+ interface BindingAssignmentRevision {
891
+ binding: BindingCRN;
892
+ revisionHash: Hash;
893
+ environment: string;
894
+ tenant: string;
895
+ namespace: string;
896
+ targetClass: "resource" | "credential";
897
+ key: ScopedBindingKey;
898
+ owner: BindingOwner;
899
+ target: {
900
+ crn: CRN;
901
+ hash: Hash;
902
+ };
903
+ contract: ResourceContractRef | null;
904
+ createdAt: number;
905
+ createdBy: ResourceName;
906
+ eventId: string;
907
+ }
908
+ interface BindingAssignmentHead {
909
+ binding: BindingCRN;
910
+ revisionHash: Hash;
911
+ headSeq: number;
912
+ controlSeq: number;
913
+ state: "enabled" | "disabled" | "revoked";
914
+ revision: BindingAssignmentRevision;
915
+ }
864
916
  interface ResourceNameParts {
865
917
  environment: string;
866
918
  tenant: string;
@@ -934,6 +986,48 @@ interface PolicyDelegationCeiling {
934
986
  resources: ResourcePattern[];
935
987
  maxTtlMs: number;
936
988
  }
989
+ /** Optional durable setup workflow advertised by an Agent deployment. */
990
+ interface AgentSetupWorkflow {
991
+ protocol: "constal.setup.v1";
992
+ agent: string;
993
+ session: string;
994
+ input: Record<string, unknown>;
995
+ }
996
+ interface AgentSetupRequirementFields {
997
+ id: string;
998
+ title: string;
999
+ description?: string;
1000
+ optional?: boolean;
1001
+ /** Credential eligibility is expressed exclusively through the Resource selector. */
1002
+ provider?: never;
1003
+ }
1004
+ /** One reusable credential slot in an explicitly declared owner scope. */
1005
+ interface AgentCredentialSetupRequirement extends AgentSetupRequirementFields, ResourceSelector<"credential"> {
1006
+ binding: {
1007
+ key: string;
1008
+ owner: BindingOwnerScope;
1009
+ };
1010
+ }
1011
+ type AgentSetupRequirement = AgentCredentialSetupRequirement | AgentSetupRequirementFields & ResourceSelector<Exclude<ResourceKind, "credential">> & {
1012
+ binding?: never;
1013
+ };
1014
+ type AgentSetupMetadata = AgentSetupWorkflow | {
1015
+ requirements: AgentSetupRequirement[];
1016
+ };
1017
+ declare function agentSetupRequirements(value: unknown, options?: {
1018
+ allowLegacyTenantOwner?: boolean;
1019
+ }): AgentSetupRequirement[];
1020
+ declare function agentSetupMetadata(value: unknown, options?: {
1021
+ allowLegacyTenantOwner?: boolean;
1022
+ }): AgentSetupMetadata;
1023
+ /** Route to tenant-local Agents or to explicitly authorized Channel subscriptions. */
1024
+ type ChannelTarget = ResourceSelector<"agent"> | {
1025
+ resourceKind: "channel";
1026
+ subscriptions: {
1027
+ provider: string;
1028
+ };
1029
+ };
1030
+ declare function channelTarget(value: unknown): ChannelTarget;
937
1031
  type UiSource = {
938
1032
  kind: "template";
939
1033
  template: "chat";
@@ -1156,14 +1250,14 @@ type PolicyInvocationOrigin = {
1156
1250
  } | {
1157
1251
  kind: "ingress";
1158
1252
  target: {
1159
- kind: "channel" | "ui";
1253
+ kind: "channel" | "ui" | InvokableKind;
1160
1254
  crn: CRN;
1161
1255
  };
1162
1256
  authProvider: CRN | null;
1163
1257
  } | {
1164
1258
  kind: "channel";
1165
1259
  channel: CRN;
1166
- phase: "receive" | "respond" | "send" | "alarm";
1260
+ phase: "receive" | "respond" | "send" | "alarm" | "authorize-subscription";
1167
1261
  } | {
1168
1262
  kind: "sandbox";
1169
1263
  agent: CRN;
@@ -1299,6 +1393,25 @@ interface SandboxFileResult {
1299
1393
  ref: Ref;
1300
1394
  bytes: number;
1301
1395
  }
1396
+ interface SandboxReadFileOptions {
1397
+ offset?: number;
1398
+ limit?: number;
1399
+ invoke?: InvokeOpts;
1400
+ }
1401
+ interface SandboxReadFileResult {
1402
+ path: string;
1403
+ content: string;
1404
+ contentHash: Ref;
1405
+ bytes: number;
1406
+ offset: number;
1407
+ returnedBytes: number;
1408
+ nextOffset: number | null;
1409
+ }
1410
+ interface SandboxWriteFileResult {
1411
+ path: string;
1412
+ contentHash: Ref;
1413
+ bytes: number;
1414
+ }
1302
1415
  interface SandboxMutationResult {
1303
1416
  ok: boolean;
1304
1417
  }
@@ -1319,6 +1432,11 @@ interface Sandbox {
1319
1432
  resume(opts?: InvokeOpts): Promise<void>;
1320
1433
  delete(opts?: InvokeOpts): Promise<void>;
1321
1434
  exec(input: SandboxExecInput, opts?: InvokeOpts): Handle<SandboxCommandResult>;
1435
+ readFile(path: string, options?: SandboxReadFileOptions): Promise<SandboxReadFileResult>;
1436
+ writeFile(path: string, content: string, options?: {
1437
+ mode?: number;
1438
+ invoke?: InvokeOpts;
1439
+ }): Promise<SandboxWriteFileResult>;
1322
1440
  getFile(path: string, opts?: InvokeOpts): Handle<SandboxFileResult>;
1323
1441
  putFile(path: string, ref: Ref, options?: {
1324
1442
  mode?: number;
@@ -1638,8 +1756,9 @@ interface Tool {
1638
1756
  tier?: Tier;
1639
1757
  guard?(args: any, ctx: Ctx): string | null;
1640
1758
  /**
1641
- * Return a bounded, deterministic, secret-safe projection of a large result
1642
- * for later model Turns. The runtime retains the complete result by Ref.
1759
+ * Return a bounded, deterministic, secret-safe projection for durable records
1760
+ * and operator views. Agent code receives the complete result; the runtime also
1761
+ * retains it by Ref for replay.
1643
1762
  */
1644
1763
  preview?(result: any): unknown;
1645
1764
  once?: "per-run-and-args" | "per-run";
@@ -1693,6 +1812,7 @@ interface ToolCallRecord {
1693
1812
  maxEffect: EffectClass;
1694
1813
  effectObserved: EffectClass | null;
1695
1814
  status: "ok" | "error" | "refused" | "unknown" | "repeated" | "outcome-unknown" | "substituted";
1815
+ /** Complete successful value available to Agent code. CAS-backed values are omitted from durable serialization and materialized on replay. */
1696
1816
  result?: unknown;
1697
1817
  ref?: Ref;
1698
1818
  preview?: unknown;
@@ -1977,9 +2097,54 @@ declare function validateTool(tool: Tool, path?: string): Tool;
1977
2097
  declare function validateView<V extends ViewDef<any, any>>(view: V, path?: string): V;
1978
2098
  declare function validatePartitionFn<I, O, R>(fn: PartitionFn<I, O, R>): PartitionFn<I, O, R>;
1979
2099
  declare function validateFoldFn<I, O>(fn: FoldFn<I, O> | SqlFold): FoldFn<I, O> | SqlFold;
1980
- declare function agent<S>(def: AgentDef<S>): AgentDef<S>;
2100
+ declare function agent<S>(input: Omit<AgentDef<S>, "version"> & {
2101
+ version?: string;
2102
+ }): AgentDef<S>;
1981
2103
  declare function subtask<T>(def: Task<T>): Task<T>;
1982
2104
 
2105
+ interface ChannelIngressSource {
2106
+ provider: string;
2107
+ key: string;
2108
+ }
2109
+ /** Provenance supplied by the Channel host for a durably captured source delivery. */
2110
+ interface ChannelSourceEvidence {
2111
+ channel: {
2112
+ crn: CRN;
2113
+ hash: string;
2114
+ };
2115
+ authProvider: {
2116
+ crn: CRN;
2117
+ hash: string;
2118
+ };
2119
+ source: ChannelIngressSource;
2120
+ id: string;
2121
+ requestHash: string;
2122
+ }
2123
+ interface CredentialEvidence {
2124
+ credential: CRN;
2125
+ provider: {
2126
+ crn: CRN;
2127
+ hash: string;
2128
+ };
2129
+ version: number;
2130
+ expiresAt: number | null;
2131
+ claims: Record<string, string | number | boolean | string[]>;
2132
+ }
2133
+ interface ChannelSubscriptionRequest {
2134
+ source: ChannelIngressSource;
2135
+ channel: CRN;
2136
+ principal: ResourceName;
2137
+ configuration: Record<string, unknown>;
2138
+ /** Current proofs produced by the selected Credentials' pinned providers. */
2139
+ credentials: CredentialEvidence[];
2140
+ }
2141
+ /** Structural validation only; authenticity comes from the host-owned delivery path. */
2142
+ declare function channelSourceEvidence(value: unknown): ChannelSourceEvidence;
2143
+ declare function credentialEvidence(value: unknown): CredentialEvidence;
2144
+ declare function channelIngressSource(value: unknown): ChannelIngressSource;
2145
+ declare function channelSubscriptionRequest(value: unknown): ChannelSubscriptionRequest;
2146
+ declare function channelIngressRequest(value: unknown): ChannelRequest;
2147
+
1983
2148
  interface IngressRequest {
1984
2149
  method: string;
1985
2150
  url: string;
@@ -2024,7 +2189,13 @@ interface IgnoredChannelEvent {
2024
2189
  reason: string;
2025
2190
  response: ChannelResponse;
2026
2191
  }
2027
- type ChannelReceiveResult<T = unknown> = CanonicalEventDraft<T> | IgnoredChannelEvent;
2192
+ /** Authenticated source delivery captured once and dispatched to authorized subscribers. */
2193
+ interface ChannelIngressEvent {
2194
+ id: string;
2195
+ source: ChannelIngressSource;
2196
+ request: ChannelRequest;
2197
+ }
2198
+ type ChannelReceiveResult<T = unknown> = CanonicalEventDraft<T> | IgnoredChannelEvent | ChannelIngressEvent;
2028
2199
  interface DispatchResult<T = unknown> {
2029
2200
  event: CanonicalEvent;
2030
2201
  runId: string;
@@ -2084,6 +2255,8 @@ interface ChannelProtocol<Input = unknown, Output = unknown, Delivery = Output>
2084
2255
  respond(result: DispatchResult<Output>, context: ChannelContext): Promise<ChannelResponse> | ChannelResponse;
2085
2256
  send?(message: ChannelMessage<Delivery>, context: ChannelContext): Promise<DeliveryReceipt> | DeliveryReceipt;
2086
2257
  alarm?(alarm: ChannelAlarm, context: ChannelContext): Promise<ChannelAlarmResult<Delivery> | void> | ChannelAlarmResult<Delivery> | void;
2258
+ /** Prove external access before a subscriber's Channel, bindings, or routes are installed. */
2259
+ authorizeSubscription?(request: ChannelSubscriptionRequest, context: ChannelContext): Promise<boolean> | boolean;
2087
2260
  }
2088
2261
  interface Channel<Input = unknown, Output = unknown, Delivery = Output> {
2089
2262
  id: string;
@@ -2122,6 +2295,9 @@ interface AuthProviderContext {
2122
2295
  provider: AuthProviderCRN;
2123
2296
  ingress: IngressTarget;
2124
2297
  resources: Record<string, CRN>;
2298
+ config?: unknown;
2299
+ /** Host-authenticated source provenance. HTTP callers cannot supply this field. */
2300
+ source?: ChannelSourceEvidence;
2125
2301
  invoke<T>(resource: CRN, op: string, args: unknown): Promise<T>;
2126
2302
  }
2127
2303
  interface AuthProvider {
@@ -2301,6 +2477,29 @@ declare function setupAwait(screen: SetupScreen): AwaitOpts<SetupSubmission>;
2301
2477
  /** A deterministic latest-screen projection for Console discovery and reload. */
2302
2478
  declare function setupScreenView(id?: string): ViewDef<SetupScreen | null, Fact>;
2303
2479
 
2480
+ /** Non-secret inventory from an authorized credential listing and availability check. */
2481
+ interface SetupCredentialCandidate {
2482
+ crn: CredentialCRN;
2483
+ labels?: Record<string, string>;
2484
+ version?: string;
2485
+ available: boolean;
2486
+ }
2487
+ interface CredentialSetupState {
2488
+ status: "missing" | "choose" | "ready" | "blocked";
2489
+ required: boolean;
2490
+ credential: CredentialCRN | null;
2491
+ candidates: CredentialCRN[];
2492
+ }
2493
+ /**
2494
+ * Projects setup from the existing selector and saved owner-scoped binding. Never
2495
+ * chooses a credential implicitly or replaces an unavailable saved choice.
2496
+ * Persist explicit choices through the ordinary binding API, which rechecks
2497
+ * authorization and the current target. This helper grants no authority.
2498
+ */
2499
+ declare function credentialSetupState(requirement: AgentCredentialSetupRequirement, scope: BindingOwnerContext & {
2500
+ namespace: string;
2501
+ }, inventory: readonly SetupCredentialCandidate[], binding: BindingAssignmentHead | null): CredentialSetupState;
2502
+
2304
2503
  declare const CONSTAL_API_CAPABILITY: "constal.api";
2305
2504
  declare const CONSTAL_API_VERSION: "1";
2306
2505
  declare const CONSTAL_API_OPERATIONS: readonly ["describe", "query", "get", "relations", "explainPolicy", "plan", "apply", "observe"];
@@ -2425,6 +2624,17 @@ interface ConstalApiError {
2425
2624
  evidence?: ConstalApiObjectRef[];
2426
2625
  details?: unknown;
2427
2626
  }
2627
+ /**
2628
+ * Exact object kinds backed by both query and get projections in the Constal
2629
+ * management Resource. Keep authorization-only CRN families such as ledger,
2630
+ * table, and artifact out of this model-facing inventory contract.
2631
+ */
2632
+ 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"];
2633
+ 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"];
2634
+ declare const CONSTAL_API_MODEL_TOOL_DESCRIPTIONS: {
2635
+ 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.";
2636
+ 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.";
2637
+ };
2428
2638
  /** Shared schemas pinned into the Resource catalog and Agent Tools. */
2429
2639
  declare const CONSTAL_API_OPERATION_SCHEMAS: {
2430
2640
  readonly describe: {
@@ -2481,14 +2691,14 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
2481
2691
  readonly type: "object";
2482
2692
  readonly required: readonly ["kind", "scope"];
2483
2693
  readonly additionalProperties: false;
2694
+ 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.";
2484
2695
  readonly properties: {
2485
2696
  readonly kind: {
2486
- readonly type: "string";
2487
- readonly minLength: 1;
2488
- readonly maxLength: 128;
2489
- readonly pattern: "^[A-Za-z][A-Za-z0-9._-]{0,127}$";
2697
+ 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"];
2698
+ readonly description: "Exact queryable kind. Never guess a kind or change its casing.";
2490
2699
  };
2491
2700
  readonly scope: {
2701
+ readonly description: "Use namespace with an exact namespace allowed by the delegated Run authority. Use tenant only for an explicitly tenant-wide request.";
2492
2702
  readonly anyOf: readonly [{
2493
2703
  readonly type: "object";
2494
2704
  readonly required: readonly ["kind", "namespace"];
@@ -2498,10 +2708,11 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
2498
2708
  readonly const: "namespace";
2499
2709
  };
2500
2710
  readonly namespace: {
2711
+ readonly description: "Exact authorized namespace. Do not infer it from an object name or repository.";
2501
2712
  readonly type: "string";
2502
2713
  readonly minLength: 1;
2503
2714
  readonly maxLength: 128;
2504
- readonly pattern: "^[A-Za-z][A-Za-z0-9._-]{0,127}$";
2715
+ readonly pattern: "^[a-z0-9][a-z0-9._-]{0,127}$";
2505
2716
  };
2506
2717
  };
2507
2718
  }, {
@@ -2517,6 +2728,7 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
2517
2728
  };
2518
2729
  readonly filter: {
2519
2730
  readonly type: "object";
2731
+ readonly description: "Optional catalog-advertised filter expression.";
2520
2732
  };
2521
2733
  readonly search: {
2522
2734
  readonly type: "string";
@@ -2585,23 +2797,32 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
2585
2797
  readonly type: "object";
2586
2798
  readonly required: readonly ["ref"];
2587
2799
  readonly additionalProperties: false;
2800
+ readonly description: "Read one addressable object using a complete ref returned by query, relations, runtime inspection, or a governed receipt. Do not synthesize refs.";
2588
2801
  readonly properties: {
2589
2802
  readonly ref: {
2803
+ readonly description: "Copy a complete object ref from governed output, or supply an exact supported CRN.";
2590
2804
  readonly anyOf: readonly [{
2591
2805
  readonly type: "object";
2592
2806
  readonly additionalProperties: false;
2593
2807
  readonly properties: {
2594
2808
  readonly kind: {
2595
- readonly type: "string";
2596
- readonly maxLength: 128;
2809
+ 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"];
2810
+ readonly description: "Exact lower-case object kind returned by a governed platform result.";
2597
2811
  };
2598
2812
  readonly id: {
2599
2813
  readonly type: "string";
2814
+ readonly minLength: 1;
2600
2815
  readonly maxLength: 512;
2601
2816
  };
2602
2817
  readonly crn: {
2603
- readonly type: readonly ["string", "null"];
2604
- readonly maxLength: 2048;
2818
+ readonly anyOf: readonly [{
2819
+ readonly type: "null";
2820
+ }, {
2821
+ readonly type: "string";
2822
+ readonly minLength: 1;
2823
+ readonly maxLength: 2048;
2824
+ readonly pattern: string;
2825
+ }];
2605
2826
  };
2606
2827
  readonly hash: {
2607
2828
  readonly anyOf: readonly [{
@@ -2614,12 +2835,14 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
2614
2835
  readonly namespace: {
2615
2836
  readonly type: readonly ["string", "null"];
2616
2837
  readonly maxLength: 128;
2838
+ readonly pattern: "^[a-z0-9][a-z0-9._-]{0,127}$";
2617
2839
  };
2618
2840
  readonly version: {
2619
2841
  readonly type: readonly ["string", "null"];
2620
2842
  readonly maxLength: 128;
2621
2843
  };
2622
2844
  };
2845
+ readonly required: readonly ["kind", "id", "namespace"];
2623
2846
  }, {
2624
2847
  readonly type: "object";
2625
2848
  readonly required: readonly ["crn"];
@@ -2629,6 +2852,8 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
2629
2852
  readonly type: "string";
2630
2853
  readonly minLength: 1;
2631
2854
  readonly maxLength: 2048;
2855
+ readonly description: "Exact addressable CRN obtained from governed platform evidence.";
2856
+ readonly pattern: string;
2632
2857
  };
2633
2858
  readonly hash: {
2634
2859
  readonly type: "string";
@@ -2674,16 +2899,23 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
2674
2899
  readonly additionalProperties: false;
2675
2900
  readonly properties: {
2676
2901
  readonly kind: {
2677
- readonly type: "string";
2678
- readonly maxLength: 128;
2902
+ 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"];
2903
+ readonly description: "Exact lower-case object kind returned by a governed platform result.";
2679
2904
  };
2680
2905
  readonly id: {
2681
2906
  readonly type: "string";
2907
+ readonly minLength: 1;
2682
2908
  readonly maxLength: 512;
2683
2909
  };
2684
2910
  readonly crn: {
2685
- readonly type: readonly ["string", "null"];
2686
- readonly maxLength: 2048;
2911
+ readonly anyOf: readonly [{
2912
+ readonly type: "null";
2913
+ }, {
2914
+ readonly type: "string";
2915
+ readonly minLength: 1;
2916
+ readonly maxLength: 2048;
2917
+ readonly pattern: string;
2918
+ }];
2687
2919
  };
2688
2920
  readonly hash: {
2689
2921
  readonly anyOf: readonly [{
@@ -2696,12 +2928,14 @@ declare const CONSTAL_API_OPERATION_SCHEMAS: {
2696
2928
  readonly namespace: {
2697
2929
  readonly type: readonly ["string", "null"];
2698
2930
  readonly maxLength: 128;
2931
+ readonly pattern: "^[a-z0-9][a-z0-9._-]{0,127}$";
2699
2932
  };
2700
2933
  readonly version: {
2701
2934
  readonly type: readonly ["string", "null"];
2702
2935
  readonly maxLength: 128;
2703
2936
  };
2704
2937
  };
2938
+ readonly required: readonly ["kind", "id", "namespace"];
2705
2939
  }, {
2706
2940
  readonly type: "object";
2707
2941
  readonly required: readonly ["crn"];
@@ -3064,27 +3298,6 @@ declare const WEB_SEARCH_ARGUMENT_SCHEMA: {
3064
3298
  readonly pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
3065
3299
  readonly description: "Optional earliest publication date in YYYY-MM-DD form.";
3066
3300
  };
3067
- readonly searchDepth: {
3068
- readonly type: "string";
3069
- readonly enum: readonly ["basic", "advanced"];
3070
- readonly description: "Provider search depth when supported.";
3071
- };
3072
- readonly includeAnswer: {
3073
- readonly type: "boolean";
3074
- readonly description: "Request a provider-synthesized answer when supported.";
3075
- };
3076
- readonly includeRawContent: {
3077
- readonly type: "boolean";
3078
- readonly description: "Include bounded raw source content when supported.";
3079
- };
3080
- readonly includeImages: {
3081
- readonly type: "boolean";
3082
- readonly description: "Include relevant image results when supported.";
3083
- };
3084
- readonly includeImageDescriptions: {
3085
- readonly type: "boolean";
3086
- readonly description: "Include image descriptions when supported.";
3087
- };
3088
3301
  };
3089
3302
  };
3090
3303
  declare const webFetch: CatalogTool;
@@ -3305,6 +3518,8 @@ interface CredentialMaterialRequest {
3305
3518
  }
3306
3519
  interface CredentialVerifyResult {
3307
3520
  verified: boolean;
3521
+ /** Non-secret external identity and access facts verified by this provider. */
3522
+ claims?: Record<string, string | number | boolean | string[]>;
3308
3523
  }
3309
3524
  interface CredentialDestroyResult {
3310
3525
  destroyed: boolean;
@@ -3627,5 +3842,5 @@ declare class SessionDeleted extends Error {
3627
3842
  constructor(session: string);
3628
3843
  }
3629
3844
 
3630
- export { AfterYield, ApiError, CONSTAL_API_CAPABILITY, CONSTAL_API_OPERATIONS, CONSTAL_API_OPERATION_SCHEMAS, CONSTAL_API_VERSION, CommitConflict, CommitGateRejected, CredentialRevoked, CredentialUnavailable, DirectNetworkDenied, EffectCeilingExceeded, GateExhausted, IntegrationRequestNotSent, LeaseLost, MCP_CLIENT_CAPABILITY, MEMORY_OPERATION_DECLARATIONS, MODEL_CHECKPOINT_IMPORT_CAPABILITY, MODEL_COMPLETION_CAPABILITY, NondeterministicReplay, OutcomeUnknown, PolicyConstraintFailed, PolicyDecisionFailed, RESOURCE_KINDS, ResourceDisabled, ResourceInvalid, ResourceUnbound, RollbackTargetInvalid, SessionDeleted, SpawnCardinality, SwallowedYield, TRAINING_PROVIDER_CAPABILITY, TerminalIntegrationFailure, ToolUnavailable, UI_BUNDLE_BOUNDS, UnknownTool, WEB_FETCH_ARGUMENT_SCHEMA, WEB_SEARCH_ARGUMENT_SCHEMA, action, actionPattern, agent, agentResourceBinding, analyticsEvent, approximateTokens, authProvider, authProviderName, bindingName, bucketFor, canonicalJson, capabilityContractRef, casTool, channel, checkpointArtifactRef, checkpointDeploymentRequest, checkpointImportMetadata, checkpointImportRequest, codeScorerIR, credentialInteractionAction, credentialInteractionEvent, credentialInteractionResult, credentialName, credentialProvider, credentialProviderConfigSchema, credentialProviderName, credentialProviderSetupMetadata, credentialRotationDefaults, customerTenantName, cutBatches, cutPartitions, datasetName, evaluateCodeScorer, evaluatePolicyDefinition, gateway, gatewayModelOffer, gatewayPackageMetadata, hash, hashValue, integrationEgressPolicy, labelSelector, matchesAction, matchesLabelSelector, matchesResource, memoryStoreBinding, modelAdvertisedPricing, modelControls, modelGatewayBinding, modelGatewayEndpoint, modelLimit, modelPrompt, modelProtocolRequest, modelProtocolResult, murmur3_32, normalizeModelGatewayConfig, normalizeSandboxNetworkPolicy, opTool, opTools, parseResourceName, policy, policyName, renderTrainingCompletion, resolveGatewayEgress, resolveResourceDependencyRef, resourceContractRef, resourceCredentialBinding, resourceDependencyRef, resourceLabelMap, resourceName, resourceNeed, resourcePattern, resourceSelector, sandboxControls, sandboxLimit, scopedBindingKey, scopedCredentialRef, scopedResourceRef, scorerName, setupAwait, setupScreen, setupScreenView, setupSubmission, sha256Hex, stageOutput, startTrainingRequest, subtask, tableDescribe, tableQuery, trainingProvider, trainingProviderMetadata, trainingRecipe, uiBundle, uiBundleManifest, uiLimit, uiName, validateBatchSpec, validateFoldFn, validateJsonSchema, validateJsonSchemaDefinition, validatePartitionFn, validatePartitionSpec, validateStageOutputSpec, validateTool, validateView, webFetch, webSearch };
3631
- export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentDef, AgentDeployPolicy, AnalyticsClient, AnalyticsDimensionValue, AnalyticsEventDefinition, AnalyticsIntent, AnalyticsValues, AuthProvider, AuthProviderCRN, AuthProviderContext, AuthProviderRequest, AuthProviderResult, AwaitOpts, AwaitPresentation, BatchSpec, BindingCRN, BindingOwnerScope, BranchRef, CRN, CRNKind, CanonicalEvent, CanonicalEventDraft, CapabilityContractRef, CapabilityGrant, CapabilityRef, CaptureCaseRequest, CaseRow, CatalogTool, Channel, ChannelAlarm, ChannelAlarmResult, ChannelContext, ChannelMessage, ChannelProtocol, ChannelReceiveResult, ChannelRequest, ChannelResponse, CheckpointDeploymentRequest, CheckpointImportMetadata, CheckpointImportRequest, CodeScoreResult, CodeScorerIR, CodeScorerRule, CommitOpts, CompareSuitesRequest, Compensation, ConnectionCancelRequest, ConnectionIdentity, ConnectionOperation, ConnectionRecoveryRequest, ConnectionRecoveryResult, ConnectionRequest, ConnectionUsageReport, ConstalApiApplyRequest, ConstalApiChangePlan, ConstalApiChangePlanRef, ConstalApiChangePlanRequest, ConstalApiChangeReceipt, ConstalApiOperationReceipt, ControlEvent, Cost, CreateSandboxImageOptions, CreateSandboxOptions, CredentialCRN, CredentialDestroyResult, CredentialInteractionAction, CredentialInteractionAdvanceRequest, CredentialInteractionEvent, CredentialInteractionPrimaryAction, CredentialInteractionProof, CredentialInteractionResult, CredentialInteractionStartRequest, CredentialMaterialRequest, CredentialMintRequest, CredentialMintResult, CredentialProviderCRN, CredentialProviderContext, CredentialProviderCredentialSlotSetup, CredentialProviderDefinition, CredentialProviderPackage, CredentialProviderPackageMetadata, CredentialProviderSecretInput, CredentialProviderSetupMetadata, CredentialVerifyResult, Ctx, CustomerTenantCRN, DataManifest, DatasetCRN, DatasetDraft, DatasetRef, DelegatedGrant, DelegationCeiling, DeliveryMode, DeliveryReceipt, DispatchResult, EffectClass, EvalComparison, EvalDivergence, EvalMode, EvalSubject, EvalSubjectSource, 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, IgnoredChannelEvent, IngressRequest, IngressTarget, IntegrationArtifactEgressRequest, IntegrationArtifactEgressResponse, IntegrationContext, IntegrationEgressPolicy, IntegrationEgressRequest, IntegrationEgressResponse, IntegrationEgressRule, IntegrationSecret, IntegrationState, InvokableKind, InvokeOpts, JsonScalar, JsonValue, LabelRequest, LabelSelector, LabelSelectorOperator, LabelSelectorRequirement, LedgerAddress, LedgerEvent, LocalResourceRef, ManifestIndexPage, MapFact, MapOpts, MemoryDeleteArgs, MemoryGetArgs, MemoryRecord, MemoryRememberArgs, MemorySearchArgs, MemorySearchHit, MemoryStoreBinding, Mode, ModelAdvertisedPricing, ModelCredentialHeader, ModelGatewayBinding, ModelGatewayConfig, ModelGatewayProtocol, ModelGovernanceControls, ModelGovernanceMeter, ModelInvocationArgs, ModelInvocationResult, ModelTechnicalCapabilities, ModelTool, NormalizedModelGatewayConfig, 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, SandboxCommandResult, SandboxExecInput, SandboxFileResult, SandboxGovernanceControls, SandboxGovernanceMeter, SandboxImage, SandboxMutationResult, SandboxNetworkMode, SandboxNetworkPolicy, SandboxPool, ScopedBindingKey, ScopedCredentialRef, ScopedMemoryStoreRef, ScopedModelGatewayRef, ScopedResourceRef, ScoreRequest, ScorerApplies, ScorerCRN, ScorerDef, ScorerEvaluation, ScorerKind, ScorerRef, ScorerVerdictIntent, SetEvalBaselineRequest, SetupAction, SetupCredentialInteractionPanel, SetupFormPanel, SetupPanel, SetupProgressPanel, SetupReviewPanel, SetupScreen, SetupStepStatus, SetupStepSummary, SetupSubmission, SetupTerminalPanel, SetupWorkflowStatus, 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 };
3845
+ export { 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, EffectCeilingExceeded, GateExhausted, IntegrationRequestNotSent, LeaseLost, MCP_CLIENT_CAPABILITY, MEMORY_OPERATION_DECLARATIONS, MODEL_CHECKPOINT_IMPORT_CAPABILITY, MODEL_COMPLETION_CAPABILITY, NondeterministicReplay, OutcomeUnknown, PolicyConstraintFailed, PolicyDecisionFailed, RESOURCE_KINDS, ResourceDisabled, ResourceInvalid, ResourceUnbound, RollbackTargetInvalid, SessionDeleted, SpawnCardinality, SwallowedYield, TRAINING_PROVIDER_CAPABILITY, TerminalIntegrationFailure, ToolUnavailable, UI_BUNDLE_BOUNDS, UnknownTool, WEB_FETCH_ARGUMENT_SCHEMA, WEB_SEARCH_ARGUMENT_SCHEMA, action, actionPattern, agent, agentResourceBinding, agentSetupMetadata, agentSetupRequirements, analyticsEvent, approximateTokens, authProvider, authProviderName, bindingName, bucketFor, canonicalJson, capabilityContractRef, casTool, channel, channelIngressRequest, channelIngressSource, channelSourceEvidence, channelSubscriptionRequest, channelTarget, checkpointArtifactRef, checkpointDeploymentRequest, checkpointImportMetadata, checkpointImportRequest, codeScorerIR, credentialEvidence, credentialInteractionAction, credentialInteractionEvent, credentialInteractionResult, credentialName, credentialProvider, credentialProviderConfigSchema, credentialProviderName, credentialProviderSetupMetadata, credentialRotationDefaults, credentialSetupState, customerTenantName, cutBatches, cutPartitions, datasetName, evaluateCodeScorer, evaluatePolicyDefinition, gateway, gatewayModelOffer, gatewayPackageMetadata, hash, hashValue, integrationEgressPolicy, labelSelector, matchesAction, matchesLabelSelector, matchesResource, memoryStoreBinding, modelAdvertisedPricing, modelControls, modelGatewayBinding, modelGatewayEndpoint, modelLimit, modelPrompt, modelProtocolRequest, modelProtocolResult, murmur3_32, normalizeModelGatewayConfig, normalizeSandboxNetworkPolicy, opTool, opTools, parseResourceName, policy, policyName, renderTrainingCompletion, resolveBindingOwner, resolveGatewayEgress, resolveResourceDependencyRef, resourceContractRef, resourceCredentialBinding, resourceDependencyRef, resourceLabelMap, resourceName, resourceNeed, resourcePattern, resourceSelector, sandboxControls, sandboxLimit, scopedBindingKey, scopedCredentialRef, scopedResourceRef, scorerName, selectableResourceLabels, setupAwait, setupScreen, setupScreenView, setupSubmission, sha256Hex, stageOutput, startTrainingRequest, subtask, tableDescribe, tableQuery, trainingProvider, trainingProviderMetadata, trainingRecipe, uiBundle, uiBundleManifest, uiLimit, uiName, validateBatchSpec, validateFoldFn, validateJsonSchema, validateJsonSchemaDefinition, validatePartitionFn, validatePartitionSpec, validateStageOutputSpec, validateTool, validateView, webFetch, webSearch };
3846
+ export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentCredentialSetupRequirement, AgentDef, AgentDeployPolicy, AgentSetupMetadata, AgentSetupRequirement, AgentSetupWorkflow, AnalyticsClient, AnalyticsDimensionValue, AnalyticsEventDefinition, AnalyticsIntent, AnalyticsValues, AuthProvider, AuthProviderCRN, AuthProviderContext, AuthProviderRequest, AuthProviderResult, AwaitOpts, AwaitPresentation, BatchSpec, BindingCRN, BindingOwnerContext, BindingOwnerScope, BranchRef, CRN, CRNKind, CanonicalEvent, CanonicalEventDraft, CapabilityContractRef, CapabilityGrant, CapabilityRef, CaptureCaseRequest, CaseRow, CatalogTool, Channel, ChannelAlarm, ChannelAlarmResult, ChannelContext, ChannelIngressEvent, ChannelIngressSource, ChannelMessage, ChannelProtocol, ChannelReceiveResult, ChannelRequest, ChannelResponse, ChannelSourceEvidence, ChannelSubscriptionRequest, ChannelTarget, CheckpointDeploymentRequest, CheckpointImportMetadata, CheckpointImportRequest, CodeScoreResult, CodeScorerIR, CodeScorerRule, CommitOpts, CompareSuitesRequest, Compensation, ConnectionCancelRequest, ConnectionIdentity, ConnectionOperation, ConnectionRecoveryRequest, ConnectionRecoveryResult, ConnectionRequest, ConnectionUsageReport, ConstalApiApplyRequest, ConstalApiChangePlan, ConstalApiChangePlanRef, ConstalApiChangePlanRequest, ConstalApiChangeReceipt, ConstalApiOperationReceipt, 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, 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, IgnoredChannelEvent, IngressRequest, IngressTarget, IntegrationArtifactEgressRequest, IntegrationArtifactEgressResponse, IntegrationContext, IntegrationEgressPolicy, IntegrationEgressRequest, IntegrationEgressResponse, IntegrationEgressRule, IntegrationSecret, IntegrationState, InvokableKind, InvokeOpts, JsonScalar, JsonValue, LabelRequest, LabelSelector, LabelSelectorOperator, LabelSelectorRequirement, LedgerAddress, LedgerEvent, LocalResourceRef, ManifestIndexPage, MapFact, MapOpts, MemoryDeleteArgs, MemoryGetArgs, MemoryRecord, MemoryRememberArgs, MemorySearchArgs, MemorySearchHit, MemoryStoreBinding, Mode, ModelAdvertisedPricing, ModelCredentialHeader, ModelGatewayBinding, ModelGatewayConfig, ModelGatewayProtocol, ModelGovernanceControls, ModelGovernanceMeter, ModelInvocationArgs, ModelInvocationResult, ModelTechnicalCapabilities, ModelTool, NormalizedModelGatewayConfig, 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, SandboxCommandResult, SandboxExecInput, SandboxFileResult, SandboxGovernanceControls, SandboxGovernanceMeter, SandboxImage, SandboxMutationResult, SandboxNetworkMode, SandboxNetworkPolicy, SandboxPool, SandboxReadFileOptions, SandboxReadFileResult, SandboxWriteFileResult, ScopedBindingKey, ScopedCredentialRef, ScopedMemoryStoreRef, ScopedModelGatewayRef, ScopedResourceRef, ScoreRequest, ScorerApplies, ScorerCRN, ScorerDef, ScorerEvaluation, ScorerKind, ScorerRef, ScorerVerdictIntent, SetEvalBaselineRequest, SetupAction, SetupCredentialCandidate, SetupCredentialInteractionPanel, SetupFormPanel, SetupPanel, SetupProgressPanel, SetupReviewPanel, SetupScreen, SetupStepStatus, SetupStepSummary, SetupSubmission, SetupTerminalPanel, SetupWorkflowStatus, 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 };
package/publish/index.js CHANGED
@@ -311,6 +311,13 @@ function validateJsonSchema(value, schema, path = "$") {
311
311
 
312
312
  // src/selector.ts
313
313
  var PROTECTED_RESOURCE_LABEL_PREFIX = "constal.ai/";
314
+ var RESOURCE_IDENTITY_LABELS = {
315
+ crn: "constal.ai/crn",
316
+ name: "constal.ai/name",
317
+ namespace: "constal.ai/namespace",
318
+ kind: "constal.ai/kind",
319
+ version: "constal.ai/version"
320
+ };
314
321
  var MAX_LABELS = 64;
315
322
  var MAX_EXPRESSIONS = 64;
316
323
  var MAX_VALUES = 64;
@@ -387,6 +394,17 @@ function matchesLabelSelector(selector, labels) {
387
394
  }
388
395
  return true;
389
396
  }
397
+ function selectableResourceLabels(input) {
398
+ const labels = {
399
+ ...resourceLabelMap(input.labels ?? {}, { allowProtected: true }),
400
+ [RESOURCE_IDENTITY_LABELS.crn]: input.crn,
401
+ [RESOURCE_IDENTITY_LABELS.name]: input.name,
402
+ [RESOURCE_IDENTITY_LABELS.namespace]: input.namespace,
403
+ [RESOURCE_IDENTITY_LABELS.kind]: input.kind,
404
+ ...input.version === void 0 ? {} : { [RESOURCE_IDENTITY_LABELS.version]: input.version }
405
+ };
406
+ return resourceLabelMap(labels, { allowProtected: true });
407
+ }
390
408
 
391
409
  // src/resources.ts
392
410
  var RESOURCE_KINDS = [
@@ -426,6 +444,71 @@ var PLATFORM_ADDRESS_KINDS = [
426
444
  ];
427
445
  var INVOKABLE_KINDS = ["model", "memory", "cas", "web", "service", "mcp", "db", "browser", "sandbox-pool", "vault"];
428
446
  var POLICY_TARGET_KINDS = [...RESOURCE_KINDS, ...PLATFORM_ADDRESS_KINDS];
447
+ function resolveBindingOwner(scope2, context, required2 = true) {
448
+ bindingOwnerScope(scope2);
449
+ if (!SEGMENT.test(context.environment) || !SEGMENT.test(context.tenant)) throw new TypeError("Binding owner context is invalid");
450
+ for (const kind of ["principal", "customer"]) {
451
+ if (context[kind] === void 0) continue;
452
+ const parts2 = parseResourceName(context[kind]);
453
+ if (parts2.environment !== context.environment || parts2.tenant !== context.tenant || parts2.kind !== kind) {
454
+ throw new TypeError("Binding owner is outside the authenticated context");
455
+ }
456
+ }
457
+ if (scope2 === "tenant") return { kind: "tenant", tenant: context.tenant };
458
+ const name = scope2 === "principal" ? context.principal : context.customer;
459
+ if (!name) {
460
+ if (!required2) return null;
461
+ throw new TypeError(`A ${scope2} is required for this binding`);
462
+ }
463
+ const parts = parseResourceName(name);
464
+ if (parts.environment !== context.environment || parts.tenant !== context.tenant || parts.kind !== scope2) {
465
+ throw new TypeError("Binding owner is outside the authenticated context");
466
+ }
467
+ return scope2 === "principal" ? { kind: "principal", principal: name } : { kind: "customer", customer: name };
468
+ }
469
+ function agentSetupRequirements(value, options = {}) {
470
+ if (!Array.isArray(value) || value.length < 1 || value.length > 64) throw new TypeError("Agent setup requirements are invalid");
471
+ const requirements = value.map((raw) => {
472
+ const item = record2(raw);
473
+ if (!item || typeof item.id !== "string" || !NAME2.test(item.id) || typeof item.title !== "string" || !item.title.trim() || item.title.length > 128 || item.description !== void 0 && (typeof item.description !== "string" || item.description.length > 4096) || item.optional !== void 0 && typeof item.optional !== "boolean" || Object.keys(item).some((key) => !["id", "title", "description", "optional", "resourceKind", "selector", "binding"].includes(key))) {
474
+ throw new TypeError("Agent setup requirement is invalid");
475
+ }
476
+ const selection = resourceSelector({ resourceKind: item.resourceKind, selector: item.selector === void 0 ? {} : item.selector }, RESOURCE_KINDS);
477
+ if (item.resourceKind === "credential") {
478
+ const binding = record2(item.binding);
479
+ if (!binding || typeof binding.key !== "string" || !NAME2.test(binding.key) || Object.keys(binding).some((key) => key !== "key" && key !== "owner")) {
480
+ throw new TypeError("Credential setup requires one binding key and an explicit owner scope");
481
+ }
482
+ const owner = binding.owner === void 0 && options.allowLegacyTenantOwner ? "tenant" : binding.owner;
483
+ bindingOwnerScope(owner);
484
+ return { ...item, ...selection, binding: { key: binding.key, owner } };
485
+ } else if (item.binding !== void 0) {
486
+ throw new TypeError("Resource setup requirements use selectors; only Credentials declare binding keys");
487
+ }
488
+ return { ...item, ...selection };
489
+ });
490
+ if (new Set(requirements.map(({ id: id2 }) => id2)).size !== requirements.length) throw new TypeError("Agent setup requirement ids must be unique");
491
+ const credentialKeys = requirements.flatMap((item) => item.resourceKind === "credential" ? [`${item.binding.owner}:${item.binding.key}`] : []);
492
+ if (new Set(credentialKeys).size !== credentialKeys.length) throw new TypeError("Credential setup binding keys must be unique");
493
+ return requirements;
494
+ }
495
+ function agentSetupMetadata(value, options = {}) {
496
+ const source = record2(value);
497
+ if (source && Object.keys(source).length === 1 && source.requirements !== void 0) {
498
+ return { requirements: agentSetupRequirements(source.requirements, options) };
499
+ }
500
+ if (!source || source.protocol !== "constal.setup.v1" || typeof source.agent !== "string" || !NAME2.test(source.agent) || typeof source.session !== "string" || !source.session || source.session.length > 256 || !record2(source.input) || Object.keys(source).some((key) => !["protocol", "agent", "session", "input"].includes(key))) {
501
+ throw new TypeError("Agent setup metadata is invalid");
502
+ }
503
+ return source;
504
+ }
505
+ function channelTarget(value) {
506
+ const target = record2(value);
507
+ if (target?.resourceKind !== "channel") return resourceSelector(value, ["agent"]);
508
+ const subscriptions = record2(target.subscriptions);
509
+ if (!subscriptions || typeof subscriptions.provider !== "string" || !/^[a-z0-9][a-z0-9-]{0,62}$/u.test(subscriptions.provider) || Object.keys(target).some((key) => !["resourceKind", "subscriptions"].includes(key)) || Object.keys(subscriptions).some((key) => key !== "provider")) throw new TypeError("Channel subscription target is invalid");
510
+ return { resourceKind: "channel", subscriptions: { provider: subscriptions.provider } };
511
+ }
429
512
  var UI_RESOURCE_BOUNDS = Object.freeze({
430
513
  maximumRequestBodyBytes: 1048576,
431
514
  maximumResponseBodyBytes: 16777216,
@@ -847,7 +930,8 @@ function validateFoldFn(fn) {
847
930
  if (fn.associative !== true && fn.associative.orderBy !== "partition") throw new TypeError("fold.associative is required");
848
931
  return fn;
849
932
  }
850
- function agent(def) {
933
+ function agent(input) {
934
+ const def = { ...input, version: input.version === void 0 ? "current" : input.version };
851
935
  validateExecutable(def, "agent");
852
936
  requiredString(def.model, "agent.model");
853
937
  const mode = def.mode ?? "script";
@@ -901,8 +985,8 @@ function executable(value, path) {
901
985
  function channel(definition) {
902
986
  executable(definition, "channel");
903
987
  executable(definition.protocol, "channel.protocol");
904
- if (typeof definition.protocol.receive !== "function" || typeof definition.protocol.respond !== "function" || definition.protocol.send !== void 0 && typeof definition.protocol.send !== "function" || definition.protocol.alarm !== void 0 && typeof definition.protocol.alarm !== "function") {
905
- throw new TypeError("channel.protocol must define receive and respond, with optional send and alarm handlers");
988
+ if (typeof definition.protocol.receive !== "function" || typeof definition.protocol.respond !== "function" || definition.protocol.send !== void 0 && typeof definition.protocol.send !== "function" || definition.protocol.alarm !== void 0 && typeof definition.protocol.alarm !== "function" || definition.protocol.authorizeSubscription !== void 0 && typeof definition.protocol.authorizeSubscription !== "function") {
989
+ throw new TypeError("channel.protocol must define receive and respond; optional handlers must be functions");
906
990
  }
907
991
  resourceDependencyRef(definition.authProvider, ["auth-provider"]);
908
992
  definition.needs?.forEach(resourceNeed);
@@ -1218,6 +1302,108 @@ function setupScreenView(id2 = "setup-screen") {
1218
1302
  };
1219
1303
  }
1220
1304
 
1305
+ // src/agent-setup.ts
1306
+ function credentialSetupState(requirement, scope2, inventory, binding) {
1307
+ const parsed = agentSetupRequirements([requirement])[0];
1308
+ if (parsed.resourceKind !== "credential") throw new TypeError("Credential setup requires a Credential requirement");
1309
+ const required2 = parsed.optional !== true;
1310
+ const owner = resolveBindingOwner(parsed.binding.owner, scope2, required2);
1311
+ if (!owner) return { status: "missing", required: required2, credential: null, candidates: [] };
1312
+ const candidates = [...new Set(inventory.flatMap((candidate) => {
1313
+ if (candidate.available !== true) return [];
1314
+ try {
1315
+ const parts = parseResourceName(candidate.crn);
1316
+ if (parts.kind !== "credential" || parts.environment !== scope2.environment || parts.tenant !== scope2.tenant) return [];
1317
+ const labels = selectableResourceLabels({
1318
+ crn: candidate.crn,
1319
+ name: parts.path,
1320
+ namespace: parts.namespace,
1321
+ kind: parts.kind,
1322
+ ...candidate.labels === void 0 ? {} : { labels: candidate.labels },
1323
+ ...candidate.version === void 0 ? {} : { version: candidate.version }
1324
+ });
1325
+ return matchesLabelSelector(parsed.selector, labels) ? [candidate.crn] : [];
1326
+ } catch {
1327
+ return [];
1328
+ }
1329
+ }))].sort();
1330
+ if (!binding) return { status: candidates.length ? "choose" : "missing", required: required2, credential: null, candidates };
1331
+ const revision = binding.revision;
1332
+ if (revision.environment !== scope2.environment || revision.tenant !== scope2.tenant || revision.namespace !== scope2.namespace || revision.targetClass !== "credential" || revision.key !== parsed.binding.key || canonicalJson(revision.owner) !== canonicalJson(owner)) {
1333
+ throw new TypeError("Saved Credential binding does not belong to this setup slot");
1334
+ }
1335
+ const target = parseResourceName(revision.target.crn);
1336
+ if (target.kind !== "credential" || target.environment !== scope2.environment || target.tenant !== scope2.tenant) {
1337
+ throw new TypeError("Saved Credential target is outside this setup slot");
1338
+ }
1339
+ const credential = revision.target.crn;
1340
+ return {
1341
+ status: binding.state === "enabled" && candidates.includes(credential) ? "ready" : "blocked",
1342
+ required: required2,
1343
+ credential,
1344
+ candidates
1345
+ };
1346
+ }
1347
+
1348
+ // src/ingress.ts
1349
+ var encoder3 = new TextEncoder();
1350
+ function object2(value) {
1351
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
1352
+ }
1353
+ function channelSourceEvidence(value) {
1354
+ const input = object2(value), channel2 = object2(input?.channel), authProvider2 = object2(input?.authProvider);
1355
+ if (!input || !channel2 || !authProvider2 || typeof authProvider2.crn !== "string" || typeof authProvider2.hash !== "string" || !/^[a-f0-9]{64}$/u.test(authProvider2.hash) || typeof channel2.crn !== "string" || typeof channel2.hash !== "string" || !/^[a-f0-9]{64}$/u.test(channel2.hash) || typeof input.id !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/u.test(input.id) || typeof input.requestHash !== "string" || !/^[a-f0-9]{64}$/u.test(input.requestHash)) throw new TypeError("Channel source evidence is invalid");
1356
+ const source = channelIngressSource(input.source), name = parseResourceName(channel2.crn), authentication = parseResourceName(authProvider2.crn);
1357
+ if (name.kind !== "channel" || name.tenant !== "platform" || name.namespace !== "ingress" || name.path !== source.provider || authentication.kind !== "auth-provider" || authentication.environment !== name.environment || authentication.tenant !== name.tenant || authentication.namespace !== name.namespace) {
1358
+ throw new TypeError("Channel source evidence is outside its source");
1359
+ }
1360
+ return { channel: { crn: channel2.crn, hash: channel2.hash }, authProvider: { crn: authProvider2.crn, hash: authProvider2.hash }, source, id: input.id, requestHash: input.requestHash };
1361
+ }
1362
+ function credentialEvidence(value) {
1363
+ const input = object2(value), provider = object2(input?.provider), claims = object2(input?.claims);
1364
+ if (!input || typeof input.credential !== "string" || !provider || typeof provider.crn !== "string" || typeof provider.hash !== "string" || !/^[a-f0-9]{64}$/u.test(provider.hash) || !Number.isSafeInteger(input.version) || Number(input.version) < 1 || input.expiresAt !== null && (!Number.isSafeInteger(input.expiresAt) || Number(input.expiresAt) < 1) || !claims || Object.keys(claims).length > 32 || encoder3.encode(JSON.stringify(claims)).byteLength > 65536 || Object.entries(claims).some(([key, value2]) => !/^[A-Za-z0-9._-]{1,128}$/u.test(key) || !(typeof value2 === "string" && value2.length <= 2048 || typeof value2 === "boolean" || typeof value2 === "number" && Number.isFinite(value2) || Array.isArray(value2) && value2.length <= 500 && value2.every((item) => typeof item === "string" && item.length <= 256)))) {
1365
+ throw new TypeError("Credential evidence is invalid");
1366
+ }
1367
+ if (parseResourceName(input.credential).kind !== "credential" || parseResourceName(provider.crn).kind !== "credential-provider") {
1368
+ throw new TypeError("Credential evidence identity is invalid");
1369
+ }
1370
+ return {
1371
+ credential: input.credential,
1372
+ provider: { crn: provider.crn, hash: provider.hash },
1373
+ version: Number(input.version),
1374
+ expiresAt: input.expiresAt,
1375
+ claims
1376
+ };
1377
+ }
1378
+ function channelIngressSource(value) {
1379
+ const source = object2(value);
1380
+ if (!source || typeof source.provider !== "string" || !/^[a-z0-9][a-z0-9._-]{0,63}$/u.test(source.provider) || typeof source.key !== "string" || !/^[A-Za-z0-9._:-]{1,256}$/u.test(source.key)) throw new TypeError("Channel ingress source is invalid");
1381
+ return { provider: source.provider, key: source.key };
1382
+ }
1383
+ function channelSubscriptionRequest(value) {
1384
+ const input = object2(value), configuration = object2(input?.configuration);
1385
+ if (!input || !configuration || typeof input.channel !== "string" || typeof input.principal !== "string") throw new TypeError("Channel subscription is invalid");
1386
+ const channel2 = parseResourceName(input.channel), principal = parseResourceName(input.principal);
1387
+ if (channel2.kind !== "channel" || principal.kind !== "principal" || channel2.environment !== principal.environment || channel2.tenant !== principal.tenant) {
1388
+ throw new TypeError("Channel subscription crosses the authenticated tenant");
1389
+ }
1390
+ const credentials = input.credentials ?? [];
1391
+ if (!Array.isArray(credentials) || credentials.length > 32) throw new TypeError("Channel subscription Credentials are invalid");
1392
+ const proofs = credentials.map(credentialEvidence);
1393
+ for (const proof of proofs) {
1394
+ const owner = parseResourceName(proof.credential), provider = parseResourceName(proof.provider.crn);
1395
+ if (owner.tenant !== channel2.tenant || owner.environment !== channel2.environment || provider.environment !== channel2.environment) {
1396
+ throw new TypeError("Channel subscription Credential crosses the authenticated tenant");
1397
+ }
1398
+ }
1399
+ return { source: channelIngressSource(input.source), channel: input.channel, principal: input.principal, configuration, credentials: proofs };
1400
+ }
1401
+ function channelIngressRequest(value) {
1402
+ const input = object2(value), headers = object2(input?.headers);
1403
+ if (!input || !["GET", "POST", "PUT", "PATCH", "DELETE"].includes(String(input.method)) || typeof input.url !== "string" || !input.url || input.url.length > 2048 || !headers || Object.keys(headers).length > 128 || Object.entries(headers).some(([key, value2]) => !/^[a-z0-9-]{1,128}$/u.test(key) || typeof value2 !== "string" || value2.length > 8192) || input.bodyBase64 !== null && (typeof input.bodyBase64 !== "string" || input.bodyBase64.length > 5592408) || encoder3.encode(JSON.stringify(input)).byteLength > 6 * 1024 * 1024) throw new TypeError("Channel ingress request is invalid");
1404
+ return { method: input.method, url: input.url, headers, bodyBase64: input.bodyBase64 };
1405
+ }
1406
+
1221
1407
  // src/constal-api.ts
1222
1408
  var CONSTAL_API_CAPABILITY = "constal.api";
1223
1409
  var CONSTAL_API_VERSION = "1";
@@ -1239,28 +1425,107 @@ var CONSTAL_API_BOUNDS = {
1239
1425
  maximumInputBytes: 1048576,
1240
1426
  planTtlMs: 15 * 6e4
1241
1427
  };
1428
+ var CONSTAL_API_QUERY_KINDS = [
1429
+ ...RESOURCE_KINDS,
1430
+ "analytics",
1431
+ "customer",
1432
+ "binding",
1433
+ "session",
1434
+ "run",
1435
+ "deployment",
1436
+ "documentation",
1437
+ "analytics-event",
1438
+ "namespace",
1439
+ "team-member",
1440
+ "team-invite",
1441
+ "api-key",
1442
+ "billing-account",
1443
+ "invoice",
1444
+ "subscription",
1445
+ "resource-contract",
1446
+ "dataset-draft",
1447
+ "dataset-case",
1448
+ "eval-score",
1449
+ "eval-sample",
1450
+ "eval-policy",
1451
+ "eval-suite",
1452
+ "eval-baseline",
1453
+ "eval-schedule",
1454
+ "training-job",
1455
+ "checkpoint",
1456
+ "training-provider",
1457
+ "training-model",
1458
+ "checkpoint-gateway",
1459
+ "credential-provider-package",
1460
+ "credential-consumer",
1461
+ "credential-use",
1462
+ "credential-event",
1463
+ "gateway-package",
1464
+ "rollout",
1465
+ "wait"
1466
+ ];
1467
+ var CONSTAL_API_GET_KINDS = CONSTAL_API_QUERY_KINDS;
1468
+ var CONSTAL_API_MODEL_TOOL_DESCRIPTIONS = {
1469
+ 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.",
1470
+ 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."
1471
+ };
1472
+ var CONSTAL_API_GET_CRN_KINDS = [
1473
+ ...RESOURCE_KINDS,
1474
+ "analytics",
1475
+ "binding",
1476
+ "session",
1477
+ "run",
1478
+ "deployment"
1479
+ ];
1480
+ var CONSTAL_API_OBJECT_REF_CRN_KINDS = [...CONSTAL_API_GET_CRN_KINDS, "customer"];
1242
1481
  var boundedNameSchema = { type: "string", minLength: 1, maxLength: 128, pattern: "^[A-Za-z][A-Za-z0-9._-]{0,127}$" };
1482
+ var namespaceSchema = {
1483
+ type: "string",
1484
+ minLength: 1,
1485
+ maxLength: 128,
1486
+ pattern: "^[a-z0-9][a-z0-9._-]{0,127}$"
1487
+ };
1243
1488
  var actionSchema = { type: "string", pattern: ACTION_PATTERN.source };
1244
1489
  var boundedIdSchema = { type: "string", minLength: 1, maxLength: 256, pattern: "^[A-Za-z0-9][A-Za-z0-9._~:-]{0,255}$" };
1245
1490
  var hashSchema = { type: "string", pattern: "^[a-f0-9]{64}$" };
1246
1491
  var stringListSchema = { type: "array", maxItems: 128, items: { type: "string", minLength: 1, maxLength: 256 } };
1247
- var scopeSchema = { anyOf: [
1492
+ var scopeSchema = { description: "Use namespace with an exact namespace allowed by the delegated Run authority. Use tenant only for an explicitly tenant-wide request.", anyOf: [
1248
1493
  {
1249
1494
  type: "object",
1250
1495
  required: ["kind", "namespace"],
1251
1496
  additionalProperties: false,
1252
- properties: { kind: { const: "namespace" }, namespace: boundedNameSchema }
1497
+ properties: { kind: { const: "namespace" }, namespace: {
1498
+ ...namespaceSchema,
1499
+ description: "Exact authorized namespace. Do not infer it from an object name or repository."
1500
+ } }
1253
1501
  },
1254
1502
  { type: "object", required: ["kind"], additionalProperties: false, properties: { kind: { const: "tenant" } } }
1255
1503
  ] };
1504
+ var crnPattern = (kinds) => `^crn:constal:[a-z0-9][a-z0-9._-]{0,127}:[a-z0-9][a-z0-9._-]{0,127}:[a-z0-9][a-z0-9._-]{0,127}:(?:${kinds.join("|")})/[A-Za-z0-9._~/%-]{1,512}$`;
1256
1505
  var objectRefSchema = { type: "object", additionalProperties: false, properties: {
1257
- kind: { type: "string", maxLength: 128 },
1258
- id: { type: "string", maxLength: 512 },
1259
- crn: { type: ["string", "null"], maxLength: 2048 },
1506
+ kind: { enum: [...CONSTAL_API_GET_KINDS], description: "Exact lower-case object kind returned by a governed platform result." },
1507
+ id: { type: "string", minLength: 1, maxLength: 512 },
1508
+ crn: { anyOf: [{ type: "null" }, {
1509
+ type: "string",
1510
+ minLength: 1,
1511
+ maxLength: 2048,
1512
+ pattern: crnPattern(CONSTAL_API_OBJECT_REF_CRN_KINDS)
1513
+ }] },
1260
1514
  hash: { anyOf: [{ type: "null" }, hashSchema] },
1261
- namespace: { type: ["string", "null"], maxLength: 128 },
1515
+ namespace: {
1516
+ type: ["string", "null"],
1517
+ maxLength: 128,
1518
+ pattern: "^[a-z0-9][a-z0-9._-]{0,127}$"
1519
+ },
1262
1520
  version: { type: ["string", "null"], maxLength: 128 }
1263
- } };
1521
+ }, required: ["kind", "id", "namespace"] };
1522
+ var exactGetCrnSchema = {
1523
+ type: "string",
1524
+ minLength: 1,
1525
+ maxLength: 2048,
1526
+ description: "Exact addressable CRN obtained from governed platform evidence.",
1527
+ pattern: crnPattern(CONSTAL_API_GET_CRN_KINDS)
1528
+ };
1264
1529
  var CONSTAL_API_OPERATION_SCHEMAS = {
1265
1530
  describe: { type: "object", additionalProperties: false, properties: {
1266
1531
  domains: stringListSchema,
@@ -1275,39 +1540,54 @@ var CONSTAL_API_OPERATION_SCHEMAS = {
1275
1540
  cursor: { type: "string", maxLength: 4096 },
1276
1541
  limit: { type: "integer", minimum: 1, maximum: CONSTAL_API_BOUNDS.maximumPageSize }
1277
1542
  } },
1278
- query: { type: "object", required: ["kind", "scope"], additionalProperties: false, properties: {
1279
- kind: boundedNameSchema,
1280
- scope: scopeSchema,
1281
- filter: { type: "object" },
1282
- search: { type: "string", maxLength: 512 },
1283
- order: { type: "array", maxItems: 8, items: {
1284
- type: "object",
1285
- required: ["field", "direction"],
1286
- additionalProperties: false,
1287
- properties: { field: boundedNameSchema, direction: { enum: ["ascending", "descending"] } }
1288
- } },
1289
- fields: stringListSchema,
1290
- limit: { type: "integer", minimum: 1, maximum: CONSTAL_API_BOUNDS.maximumPageSize },
1291
- cursor: { type: "string", maxLength: 4096 },
1292
- asOf: { type: "integer", minimum: 0 },
1293
- range: { type: "object", required: ["start", "end"], additionalProperties: false, properties: {
1294
- start: { type: "integer", minimum: 0 },
1295
- end: { type: "integer", minimum: 0 }
1296
- } }
1297
- } },
1298
- get: { type: "object", required: ["ref"], additionalProperties: false, properties: {
1299
- ref: { anyOf: [objectRefSchema, {
1300
- type: "object",
1301
- required: ["crn"],
1302
- additionalProperties: false,
1303
- properties: { crn: { type: "string", minLength: 1, maxLength: 2048 }, hash: hashSchema }
1304
- }] },
1305
- fields: stringListSchema,
1306
- page: { type: "object", additionalProperties: false, properties: {
1543
+ query: {
1544
+ type: "object",
1545
+ required: ["kind", "scope"],
1546
+ additionalProperties: false,
1547
+ 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.",
1548
+ properties: {
1549
+ kind: { enum: [...CONSTAL_API_QUERY_KINDS], description: "Exact queryable kind. Never guess a kind or change its casing." },
1550
+ scope: scopeSchema,
1551
+ filter: { type: "object", description: "Optional catalog-advertised filter expression." },
1552
+ search: { type: "string", maxLength: 512 },
1553
+ order: { type: "array", maxItems: 8, items: {
1554
+ type: "object",
1555
+ required: ["field", "direction"],
1556
+ additionalProperties: false,
1557
+ properties: { field: boundedNameSchema, direction: { enum: ["ascending", "descending"] } }
1558
+ } },
1559
+ fields: stringListSchema,
1560
+ limit: { type: "integer", minimum: 1, maximum: CONSTAL_API_BOUNDS.maximumPageSize },
1307
1561
  cursor: { type: "string", maxLength: 4096 },
1308
- limit: { type: "integer", minimum: 1, maximum: 500 }
1309
- } }
1310
- } },
1562
+ asOf: { type: "integer", minimum: 0 },
1563
+ range: { type: "object", required: ["start", "end"], additionalProperties: false, properties: {
1564
+ start: { type: "integer", minimum: 0 },
1565
+ end: { type: "integer", minimum: 0 }
1566
+ } }
1567
+ }
1568
+ },
1569
+ get: {
1570
+ type: "object",
1571
+ required: ["ref"],
1572
+ additionalProperties: false,
1573
+ description: "Read one addressable object using a complete ref returned by query, relations, runtime inspection, or a governed receipt. Do not synthesize refs.",
1574
+ properties: {
1575
+ ref: {
1576
+ description: "Copy a complete object ref from governed output, or supply an exact supported CRN.",
1577
+ anyOf: [objectRefSchema, {
1578
+ type: "object",
1579
+ required: ["crn"],
1580
+ additionalProperties: false,
1581
+ properties: { crn: exactGetCrnSchema, hash: hashSchema }
1582
+ }]
1583
+ },
1584
+ fields: stringListSchema,
1585
+ page: { type: "object", additionalProperties: false, properties: {
1586
+ cursor: { type: "string", maxLength: 4096 },
1587
+ limit: { type: "integer", minimum: 1, maximum: 500 }
1588
+ } }
1589
+ }
1590
+ },
1311
1591
  relations: { type: "object", required: ["start"], additionalProperties: false, properties: {
1312
1592
  start: { anyOf: [objectRefSchema, {
1313
1593
  type: "object",
@@ -1466,12 +1746,12 @@ var MAX_CONSTRAINTS = 64;
1466
1746
  var MAX_OUTCOME_BYTES = 65536;
1467
1747
  var MAX_REASON_BYTES = 1024;
1468
1748
  var DENIAL_CODE = /^[a-z][a-z0-9._-]{0,127}$/u;
1469
- var encoder3 = new TextEncoder();
1749
+ var encoder4 = new TextEncoder();
1470
1750
  function record4(value) {
1471
1751
  return !!value && typeof value === "object" && !Array.isArray(value);
1472
1752
  }
1473
1753
  function requiredString2(value, path, maximum = 1024) {
1474
- if (typeof value !== "string" || value.length === 0 || encoder3.encode(value).byteLength > maximum) {
1754
+ if (typeof value !== "string" || value.length === 0 || encoder4.encode(value).byteLength > maximum) {
1475
1755
  throw new TypeError(`${path} must be a bounded non-empty string`);
1476
1756
  }
1477
1757
  }
@@ -1554,7 +1834,7 @@ function policyOutcome(value) {
1554
1834
  exactKeys2(value, ["kind", "grant"], ["kind", "grant"], "Policy grant outcome");
1555
1835
  validateGrant(value.grant, "Policy grant");
1556
1836
  } else throw new TypeError("Policy outcome kind is invalid");
1557
- if (encoder3.encode(canonicalJson(value)).byteLength > MAX_OUTCOME_BYTES) throw new TypeError("Policy outcome is oversized");
1837
+ if (encoder4.encode(canonicalJson(value)).byteLength > MAX_OUTCOME_BYTES) throw new TypeError("Policy outcome is oversized");
1558
1838
  return value;
1559
1839
  }
1560
1840
 
@@ -1767,12 +2047,7 @@ var WEB_SEARCH_ARGUMENT_SCHEMA = {
1767
2047
  type: "string",
1768
2048
  pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
1769
2049
  description: "Optional earliest publication date in YYYY-MM-DD form."
1770
- },
1771
- searchDepth: { type: "string", enum: ["basic", "advanced"], description: "Provider search depth when supported." },
1772
- includeAnswer: { type: "boolean", description: "Request a provider-synthesized answer when supported." },
1773
- includeRawContent: { type: "boolean", description: "Include bounded raw source content when supported." },
1774
- includeImages: { type: "boolean", description: "Include relevant image results when supported." },
1775
- includeImageDescriptions: { type: "boolean", description: "Include image descriptions when supported." }
2050
+ }
1776
2051
  }
1777
2052
  };
1778
2053
  var webFetch = opTool("web", "get", {
@@ -3106,8 +3381,11 @@ export {
3106
3381
  AfterYield,
3107
3382
  ApiError,
3108
3383
  CONSTAL_API_CAPABILITY,
3384
+ CONSTAL_API_GET_KINDS,
3385
+ CONSTAL_API_MODEL_TOOL_DESCRIPTIONS,
3109
3386
  CONSTAL_API_OPERATIONS,
3110
3387
  CONSTAL_API_OPERATION_SCHEMAS,
3388
+ CONSTAL_API_QUERY_KINDS,
3111
3389
  CONSTAL_API_VERSION,
3112
3390
  CommitConflict,
3113
3391
  CommitGateRejected,
@@ -3145,6 +3423,8 @@ export {
3145
3423
  actionPattern,
3146
3424
  agent,
3147
3425
  agentResourceBinding,
3426
+ agentSetupMetadata,
3427
+ agentSetupRequirements,
3148
3428
  analyticsEvent,
3149
3429
  approximateTokens,
3150
3430
  authProvider,
@@ -3155,11 +3435,17 @@ export {
3155
3435
  capabilityContractRef,
3156
3436
  casTool,
3157
3437
  channel,
3438
+ channelIngressRequest,
3439
+ channelIngressSource,
3440
+ channelSourceEvidence,
3441
+ channelSubscriptionRequest,
3442
+ channelTarget,
3158
3443
  checkpointArtifactRef,
3159
3444
  checkpointDeploymentRequest,
3160
3445
  checkpointImportMetadata,
3161
3446
  checkpointImportRequest,
3162
3447
  codeScorerIR,
3448
+ credentialEvidence,
3163
3449
  credentialInteractionAction,
3164
3450
  credentialInteractionEvent,
3165
3451
  credentialInteractionResult,
@@ -3169,6 +3455,7 @@ export {
3169
3455
  credentialProviderName,
3170
3456
  credentialProviderSetupMetadata,
3171
3457
  credentialRotationDefaults,
3458
+ credentialSetupState,
3172
3459
  customerTenantName,
3173
3460
  cutBatches,
3174
3461
  cutPartitions,
@@ -3203,6 +3490,7 @@ export {
3203
3490
  policy,
3204
3491
  policyName,
3205
3492
  renderTrainingCompletion,
3493
+ resolveBindingOwner,
3206
3494
  resolveGatewayEgress,
3207
3495
  resolveResourceDependencyRef,
3208
3496
  resourceContractRef,
@@ -3219,6 +3507,7 @@ export {
3219
3507
  scopedCredentialRef,
3220
3508
  scopedResourceRef,
3221
3509
  scorerName,
3510
+ selectableResourceLabels,
3222
3511
  setupAwait,
3223
3512
  setupScreen,
3224
3513
  setupScreenView,