@constal/sdk 6.6.0 → 6.8.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": "6.6.0",
3
+ "version": "6.8.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": "6.6.0",
3
+ "version": "6.8.0",
4
4
  "exports": [
5
5
  "AGENT_UI_DEFAULTS",
6
6
  "Action",
@@ -347,6 +347,7 @@
347
347
  "SandboxCommandCollectionError",
348
348
  "SandboxCommandExecution",
349
349
  "SandboxCommandResult",
350
+ "SandboxEgressCredentialHeaderRule",
350
351
  "SandboxEgressCredentialRule",
351
352
  "SandboxEgressPolicy",
352
353
  "SandboxEgressRule",
@@ -371,6 +372,9 @@
371
372
  "SandboxReadFileOptions",
372
373
  "SandboxReadFileResult",
373
374
  "SandboxWorkspace",
375
+ "SandboxWorkspaceInspection",
376
+ "SandboxWorkspacePreparation",
377
+ "SandboxWorkspaceReceipt",
374
378
  "SandboxWriteFileResult",
375
379
  "Schedule",
376
380
  "ScheduleCancellation",
@@ -1292,8 +1292,10 @@ type ResourceCredentialBinding = CredentialCRN | ScopedCredentialRef;
1292
1292
  interface InvocationCredentialUse {
1293
1293
  binding: ResourceCredentialBinding;
1294
1294
  /** Who receives the value: a sandbox process (an env variable or a memory-backed file), a sandbox's egress gate,
1295
- * which adds it to requests as the named header and never shows it to the sandbox, or the invoked Resource itself: for
1296
- * this call only, its scoped slot of this name holds the Credential the Run's own owner holds under this key. */
1295
+ * which adds it to requests as the named header and never shows it to the sandbox, a browser Resource's service, which
1296
+ * types it, signs with it or restores it in the browsers it drives for the named login and never returns it (a login's
1297
+ * account name, password and authenticator seed, one of its passkeys, or its saved session), or the invoked Resource
1298
+ * itself: for this call only, its scoped slot of this name holds the Credential the Run's own owner holds under this key. */
1297
1299
  consumer: {
1298
1300
  kind: "process";
1299
1301
  delivery: "env" | "file";
@@ -1302,6 +1304,10 @@ interface InvocationCredentialUse {
1302
1304
  kind: "egress";
1303
1305
  delivery: "header";
1304
1306
  name: string;
1307
+ } | {
1308
+ kind: "browser";
1309
+ delivery: "login" | "passkey" | "session";
1310
+ name: string;
1305
1311
  } | {
1306
1312
  kind: "resource";
1307
1313
  };
@@ -1904,12 +1910,37 @@ interface SandboxEgressPolicy {
1904
1910
  rules: SandboxEgressRule[];
1905
1911
  default?: "allow" | "deny";
1906
1912
  }
1913
+ /** One header an egress Credential rule sets from its Credential. */
1914
+ interface SandboxEgressCredentialHeaderRule {
1915
+ /** The header to set; `authorization` when omitted. A header the sandbox sent under the same name is replaced. */
1916
+ header?: string;
1917
+ /** The header value, with `{value}` exactly once where the Credential goes; `Bearer {value}` when omitted. */
1918
+ value?: string;
1919
+ /** Instead of `value`: HTTP basic auth, `Basic base64(username:value)`, or `Basic base64(value)` without a username. */
1920
+ basic?: {
1921
+ username?: string;
1922
+ };
1923
+ /**
1924
+ * For a Credential whose value is JSON: the JSON Pointer (RFC 6901) of the text that goes in place of the whole value,
1925
+ * such as `/accessToken`. A value that is not JSON, or has no non-empty text there, refuses the request. Omitted: the
1926
+ * whole value.
1927
+ */
1928
+ field?: string;
1929
+ /**
1930
+ * `totp`: the text (after `field`) is an authenticator seed, RFC 4648 base32, and the header carries the RFC 6238
1931
+ * time-based code for the request's time in its place (`{value}` and `basic` apply to the code), such as npm's `npm-otp`.
1932
+ * The object the text sits in may give the code's `digits` (6 to 8, RFC 4226 5.3), `period` (whole seconds) and
1933
+ * `algorithm` (`SHA1`, `SHA256` or `SHA512`, the Key URI Format's names), each RFC 6238's default (6, 30, `SHA1`) when
1934
+ * absent. The seed is redacted from responses as a value is; the code, worthless past its period, is not.
1935
+ */
1936
+ code?: "totp";
1937
+ }
1907
1938
  /**
1908
- * The first rule whose host and path match a request adds its header: one built from a Credential, resolved at each
1939
+ * The first rule whose host and path match a request adds its headers: built from a Credential, resolved at each
1909
1940
  * request through the platform's Credential use (binding controls, scope, Policy, a use record naming the destination).
1910
1941
  * The sandbox never sees the value, and the gate redacts it from what the response echoes back.
1911
1942
  */
1912
- interface SandboxEgressCredentialRule {
1943
+ interface SandboxEgressCredentialRule extends SandboxEgressCredentialHeaderRule {
1913
1944
  /** Exact host names, or `*.example.com` for the apex and every name under it. Requests must be https. */
1914
1945
  hosts: string[];
1915
1946
  /**
@@ -1921,14 +1952,11 @@ interface SandboxEgressCredentialRule {
1921
1952
  slot?: string;
1922
1953
  /** Only on createSandbox: a Credential (or a scoped binding to one) the call delegates to this sandbox. */
1923
1954
  binding?: ResourceCredentialBinding;
1924
- /** The header to set; `authorization` when omitted. A header the sandbox sent under the same name is replaced. */
1925
- header?: string;
1926
- /** The header value, with `{value}` exactly once where the Credential goes; `Bearer {value}` when omitted. */
1927
- value?: string;
1928
- /** Instead of `value`: HTTP basic auth, `Basic base64(username:value)`, or `Basic base64(value)` without a username. */
1929
- basic?: {
1930
- username?: string;
1931
- };
1955
+ /**
1956
+ * More headers from the same Credential, each set as the rule's own is (such as a token and the account it belongs to,
1957
+ * two fields of one JSON value): at most SANDBOX_EGRESS_LIMITS.credentialRules, no header named twice in the rule.
1958
+ */
1959
+ headers?: SandboxEgressCredentialHeaderRule[];
1932
1960
  /**
1933
1961
  * For git over HTTPS through this rule: the refs a push (a `git-receive-pack` request) may update, each a full ref name
1934
1962
  * (`refs/heads/leonard/t-1`) or a prefix ending in `/*` for every ref under it (`refs/heads/leonard/t-1/*`). The gate
@@ -1987,7 +2015,18 @@ interface CreateSandboxOptions {
1987
2015
  credentials?: SandboxEgressCredentialRule[];
1988
2016
  /** Labels every egress event of this sandbox carries. */
1989
2017
  labels?: SandboxLabels;
2018
+ /**
2019
+ * Whose sandbox this is. `session` (the default): the Session's own. `entry`: one sandbox for the Run's whole end-to-end
2020
+ * run, shared by every Run it reaches, whatever its Agent or Session (InvokeOrigin `entry`): each such Run that calls
2021
+ * createSandbox with `entry` works in it, its files kept from one Run to the next, and the Session's calls that name no
2022
+ * sandbox (`workspace()`) go there until a createSandbox without it. No Session's end releases it: it is deleted 6 h
2023
+ * after it was last used, and the next createSandbox makes a new one. Credentials and push refs given replace those of
2024
+ * every Run sharing it. Make it a Run's first call to the pool: a Run's fast calls keep the sandbox their grant found.
2025
+ */
2026
+ scope?: SandboxScope;
1990
2027
  }
2028
+ /** CreateSandboxOptions `scope`. */
2029
+ type SandboxScope = "session" | "entry";
1991
2030
  /**
1992
2031
  * Optional immutable identity for a prepared image. Cache keys are supplied as
1993
2032
  * full SHA-256 digests so a SandboxPool can safely scope and reuse an image
@@ -2180,6 +2219,34 @@ interface SandboxWorkspace {
2180
2219
  }): InvocationHandle<SandboxMutationResult>;
2181
2220
  deleteFile(path: string, opts?: InvokeOpts): InvocationHandle<SandboxMutationResult>;
2182
2221
  }
2222
+ /** A retained disk's identity and activation fence, separate from any portable checkpoint of its contents. */
2223
+ interface SandboxWorkspaceReceipt {
2224
+ storageId: string;
2225
+ epoch: number;
2226
+ coordinator: string;
2227
+ /** Opaque provider identity; capabilities are expressed by retained and paths. */
2228
+ provider: string;
2229
+ paths: string[];
2230
+ retained: boolean;
2231
+ mutationEpoch: number;
2232
+ }
2233
+ interface SandboxWorkspacePreparation {
2234
+ /** Reuse this key when retrying the same lifecycle action, even across Runs. */
2235
+ key: string;
2236
+ paths: string[];
2237
+ expected?: SandboxWorkspaceReceipt;
2238
+ }
2239
+ interface SandboxWorkspaceInspection {
2240
+ workspace: SandboxWorkspaceReceipt | null;
2241
+ state: "active" | "stopping" | "checkpoint" | "stopped" | "missing" | "untracked";
2242
+ /** Admitted work may still be writing; the mutation counter alone does not prove backup consistency. */
2243
+ busy: boolean;
2244
+ /** A lifecycle call whose answer is still uncertain, so an owning Run can join it after recovery. */
2245
+ pending?: {
2246
+ key: string;
2247
+ operation: "resume" | "checkpoint" | "stop" | "discard";
2248
+ };
2249
+ }
2183
2250
  /** Explicit physical handle used only for lifecycle/image selection controls. */
2184
2251
  interface Sandbox extends SandboxWorkspace {
2185
2252
  readonly id: string;
@@ -2188,6 +2255,33 @@ interface Sandbox extends SandboxWorkspace {
2188
2255
  suspend(opts?: InvokeOpts): Promise<void>;
2189
2256
  resume(opts?: InvokeOpts): Promise<void>;
2190
2257
  delete(opts?: InvokeOpts): Promise<void>;
2258
+ /** Materialize or resume a workspace, verifying expected storage before reusing it. Unsupported paths retain the archive fallback. */
2259
+ prepareWorkspace(input: SandboxWorkspacePreparation, opts?: InvokeOpts): Promise<{
2260
+ workspace: SandboxWorkspaceReceipt;
2261
+ reused: boolean;
2262
+ }>;
2263
+ /** Fence admission, drain/cancel work, flush and stop a provider that retains these paths. */
2264
+ stopWorkspace(input: {
2265
+ key: string;
2266
+ expected: SandboxWorkspaceReceipt;
2267
+ discard?: boolean;
2268
+ }, opts?: InvokeOpts): Promise<{
2269
+ workspace: SandboxWorkspaceReceipt;
2270
+ }>;
2271
+ /** Revoke direct calls and drain work, allowing only the returned Run to export a checkpoint before stop/delete. */
2272
+ quiesceWorkspace(input: {
2273
+ key: string;
2274
+ expected: SandboxWorkspaceReceipt;
2275
+ }, opts?: InvokeOpts): Promise<{
2276
+ workspace: SandboxWorkspaceReceipt;
2277
+ run: string;
2278
+ }>;
2279
+ inspectWorkspace(input?: {
2280
+ expected?: SandboxWorkspaceReceipt;
2281
+ probe?: boolean;
2282
+ }, opts?: InvokeOpts): Promise<SandboxWorkspaceInspection>;
2283
+ /** Explicitly discard a retained workspace; the current activation receipt is required. */
2284
+ deleteWorkspace(expected: SandboxWorkspaceReceipt, opts?: InvokeOpts): Promise<void>;
2191
2285
  }
2192
2286
  /** Provider-neutral factory and owner for images and logical sandboxes. */
2193
2287
  interface SandboxPool {
@@ -5469,4 +5563,4 @@ declare function parseLedgerAddress(value: unknown): LedgerAddressParts | null;
5469
5563
  declare function formatLedgerAddress(parts: LedgerAddressParts): LedgerAddress;
5470
5564
 
5471
5565
  export { AGENT_UI_DEFAULTS, AfterYield, ApiError, CHAT_FORMAT_CAPABILITY, 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, DATA_SHARE_FEE_BPS, DirectNetworkDenied, EVALUATION_LIMITS, EffectCeilingExceeded, EmptyJoin, GENERAL_QUALITY_JUDGE, GateExhausted, IntegrationRequestNotSent, LeaseLost, MCP_CLIENT_CAPABILITY, MCP_PROTOCOL_VERSION, MEMORY_OPERATION_DECLARATIONS, MODEL_CHECKPOINT_IMPORT_CAPABILITY, MODEL_COMPLETION_CAPABILITY, MODEL_EVALUATION_CAPABILITY, McpClient, NondeterministicReplay, NotAppendOnly, OutcomeUnknown, PolicyConstraintFailed, PolicyDecisionFailed, RESOURCE_CREDENTIAL_BINDING_SCHEMA, RESOURCE_KINDS, ResourceDisabled, ResourceInvalid, ResourceUnbound, RollbackTargetInvalid, SANDBOX_EGRESS_LIMITS, SessionDeleted, SpawnCardinality, SwallowedYield, TRAINING_PROVIDER_CAPABILITY, TRAINING_RECIPE_DEFAULTS, 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, chatFormat, chatFormatMetadata, chatFormatPin, chatParseInput, chatParsed, chatRenderInput, chatRenderRequest, chatRendering, checkpointArtifactRef, checkpointDeploymentRequest, checkpointImportMetadata, checkpointImportRequest, codeScorerIR, containerImageReference, containerImageSelection, containerImageSource, credentialEvidence, credentialInteractionAction, credentialInteractionEvent, credentialInteractionResult, credentialName, credentialProvider, credentialProviderConfigSchema, credentialProviderName, credentialProviderSetupMetadata, credentialRotationDefaults, credentialSetupState, customerTenantName, cutBatches, cutPartitions, dataShareEarningMicroUsd, datasetName, evaluateCodeScorer, evaluatePolicyDefinition, evaluationArguments, evaluationProtocolRequest, evaluationProtocolResult, formatLedgerAddress, gateway, gatewayModelOffer, gatewayPackageMetadata, hash, hashValue, immutableContainerImageReference, integrationEgressPolicy, invocationCredentialUses, judgeAgent, labelSelector, matchesAction, matchesLabelSelector, matchesResource, mcpToolDescription, mcpToolResult, memoryStoreBinding, modelAdvertisedPricing, modelControls, modelGatewayBinding, modelGatewayEndpoint, modelGenerationOptions, modelLimit, modelMessages, modelPrompt, modelProtocolRequest, modelProtocolResult, murmur3_32, normalizeModelGatewayConfig, normalizeSandboxEgressCredentialRules, normalizeSandboxEgressPolicy, normalizeSandboxLabels, normalizeSandboxNetworkPolicy, normalizeSandboxWorkspacePath, noulDecision, opTool, opTools, parseLedgerAddress, parseResourceName, policy, policyName, race, resolveBindingOwner, resolveContainerImageSource, resolveGatewayEgress, resolveResourceDependencyRef, resourceContractRef, resourceCredentialBinding, resourceDependencyRef, resourceLabelMap, resourceName, resourceNeed, resourcePattern, resourceSelector, resourceTools, runLabels, sandboxControls, sandboxEgressCredentialRuleFor, sandboxEgressDecision, sandboxEgressHostMatches, sandboxLimit, scopedBindingKey, scopedCredentialRef, scopedResourceRef, scoreLevel, scorerDraftHash, scorerName, select, selectableResourceLabels, setupAwait, setupCredentialReceipt, setupPanelProviderIsCrn, setupScreen, setupScreenView, setupSubmission, sha256Hex, shareContributionRequest, shareContributionReview, shareEvaluation, sharePrices, shareRequest, skills, stageOutput, startTrainingRequest, subtask, tableDescribe, tableQuery, trainingCorrection, trainingProvider, trainingProviderMetadata, trainingRecipe, uiAssetContentType, uiBundle, uiBundleManifest, uiLimit, uiName, validateBatchSpec, validateFoldFn, validateJsonSchema, validateJsonSchemaDefinition, validatePartitionFn, validatePartitionSpec, validateStageOutputSpec, validateTool, validateView, webFetch, webSearch };
5472
- export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentCredentialSetupRequirement, AgentDef, AgentDeployPolicy, AgentGovernanceMeter, AgentSetupMetadata, AgentSetupRequirement, AgentSetupWorkflow, AgentUiDeclaration, AnalyticsClient, AnalyticsDimensionValue, AnalyticsEventDefinition, AnalyticsIntent, AnalyticsValues, AuthProvider, AuthProviderCRN, AuthProviderContext, AuthProviderRequest, AuthProviderResult, AwaitOpts, AwaitPresentation, BatchSpec, BindingCRN, BindingOwnerContext, BindingOwnerScope, BoundOperation, BoundResourceCapabilities, BranchRef, CRN, CRNKind, CanonicalEvent, CanonicalEventDraft, CapabilityContractRef, CapabilityGrant, CapabilityRef, CaptureCaseRequest, CaseRow, CatalogTool, Channel, ChannelContext, ChannelDeliveryError, ChannelDeliveryEvent, ChannelDeliveryOutcome, ChannelDeliveryReport, ChannelFailure, ChannelIngressEvent, ChannelIngressSource, ChannelMessage, ChannelProtocol, ChannelReceiveResult, ChannelRequest, ChannelResponse, ChannelSourceEvidence, ChannelSubscriptionRequest, ChannelTarget, ChatFormatDefinition, ChatFormatMetadata, ChatFormatPin, ChatMessage, ChatParseRequest, ChatParsed, ChatRenderRequest, ChatRendering, ChatSpan, ChatTool, 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, CredentialProviderConfigEgressBinding, CredentialProviderContext, CredentialProviderCredentialSlotSetup, CredentialProviderDefinition, CredentialProviderPackage, CredentialProviderPackageMetadata, CredentialProviderSecretInput, CredentialProviderSetupMetadata, CredentialSetupState, CredentialUninstallRequest, CredentialUninstallResult, CredentialVerifyResult, Ctx, CustomerTenantCRN, DataManifest, DataSharingScope, DatasetCRN, DatasetDraft, DatasetRef, DelegatedGrant, DelegationCeiling, DeliveryMode, DeliveryReceipt, DispatchResult, EffectClass, EvalComparison, EvalDivergence, EvalMode, EvalSubject, EvalSubjectSource, EvalSuiteCase, EvalSuiteCasePage, EvalSuiteCaseScore, EvalSuiteCaseState, EvalSuiteScoreState, 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, HistoryPage, HistoryView, HmacVerification, IgnoredChannelEvent, IngressRequest, IngressTarget, IntegrationArtifactEgressRequest, IntegrationArtifactEgressResponse, IntegrationAttachment, IntegrationContext, IntegrationEgressPolicy, IntegrationEgressRequest, IntegrationEgressResponse, IntegrationEgressRule, IntegrationLifecycle, IntegrationReleaseContext, IntegrationSecret, IntegrationState, InvocationCredentialUse, InvocationHandle, InvokableKind, InvokeOpts, JoinOutcome, JsonScalar, JsonValue, JudgeRubric, LabelRequest, LabelSelector, LabelSelectorOperator, LabelSelectorRequirement, LedgerAddress, LedgerAddressParts, LedgerEvent, ListSchedulesOptions, LocalResourceRef, ManifestIndexPage, MapFact, MapOpts, McpClientOptions, McpClientState, McpMessageTransport, MemoryDeleteArgs, MemoryGetArgs, MemoryRecord, MemoryRememberArgs, MemorySearchArgs, MemorySearchHit, MemoryStoreBinding, Mode, ModelAdvertisedPricing, ModelCacheHint, ModelCompletion, ModelCredentialHeader, ModelGatewayBinding, ModelGatewayConfig, ModelGatewayProtocol, ModelGenerationOptions, ModelGovernanceControls, ModelGovernanceMeter, ModelHistoryMessage, ModelHistoryToolCall, ModelInvocationArgs, ModelInvocationResult, ModelProtocolRequestOptions, 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, SandboxEgressCredentialRule, SandboxEgressPolicy, SandboxEgressRule, SandboxExecInput, SandboxFileResult, SandboxGovernanceControls, SandboxGovernanceMeter, SandboxImage, SandboxLabels, 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, ScorerDraft, ScorerEvaluation, ScorerKind, ScorerRef, ScorerVerdictIntent, SetEvalBaselineRequest, SetupAction, SetupCredentialCandidate, SetupCredentialInteractionPanel, SetupCredentialReceipt, SetupFormPanel, SetupPanel, SetupProgressPanel, SetupReviewPanel, SetupScreen, SetupStepStatus, SetupStepSummary, SetupSubmission, SetupTerminalPanel, SetupWorkflowStatus, Share, ShareAction, ShareContribution, ShareContributionImport, ShareContributionRequest, ShareContributionReview, ShareContributionReviewRequest, ShareContributionStatus, ShareEvaluation, ShareEvaluationPin, ShareEvaluationRequest, ShareEvaluationVerdict, ShareEvaluationView, ShareHistory, SharePrice, ShareRequest, ShareReviewDecision, SortField, SpawnAttenuation, SpawnBudget, SpawnHandle, SpawnOpts, SqlFold, StageInfo, StageOutputSpec, StartTrainingRequest, SteerEvent, StepJournal, SuiteFact, TableAggregate, TableDescribeArgs, TableFilter, TableFilterOperation, TableOrder, TableQueryArgs, TableQueryPlan, TableQueryResult, TableScalar, TableSnapshotDescription, Task, Tier, Tool, ToolCallRecord, TrainingCorrection, TrainingJobFact, TrainingJobReference, TrainingJobState, TrainingJobStatus, TrainingMethod, TrainingModelOffer, TrainingPreparation, TrainingProviderDefinition, TrainingProviderMetadata, TrainingProviderPin, TrainingRecipe, TrainingResumePoint, TrainingStep, TrainingUsageUnits, TurnDraft, TurnGate, TurnHistoryMessage, TurnRecord, TurnSpec, UiAccess, UiBundle, UiBundleManifest, UiCRN, UiCapability, UiExecution, UiGovernanceMeter, UiHandler, UiResource, UiRuntimeContext, UiSource, UiSqlResult, UiState, UpstreamPayer, Verdict, VerdictSamplingMode, ViewDef, WaitResolvedEvent };
5566
+ export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentCredentialSetupRequirement, AgentDef, AgentDeployPolicy, AgentGovernanceMeter, AgentSetupMetadata, AgentSetupRequirement, AgentSetupWorkflow, AgentUiDeclaration, AnalyticsClient, AnalyticsDimensionValue, AnalyticsEventDefinition, AnalyticsIntent, AnalyticsValues, AuthProvider, AuthProviderCRN, AuthProviderContext, AuthProviderRequest, AuthProviderResult, AwaitOpts, AwaitPresentation, BatchSpec, BindingCRN, BindingOwnerContext, BindingOwnerScope, BoundOperation, BoundResourceCapabilities, BranchRef, CRN, CRNKind, CanonicalEvent, CanonicalEventDraft, CapabilityContractRef, CapabilityGrant, CapabilityRef, CaptureCaseRequest, CaseRow, CatalogTool, Channel, ChannelContext, ChannelDeliveryError, ChannelDeliveryEvent, ChannelDeliveryOutcome, ChannelDeliveryReport, ChannelFailure, ChannelIngressEvent, ChannelIngressSource, ChannelMessage, ChannelProtocol, ChannelReceiveResult, ChannelRequest, ChannelResponse, ChannelSourceEvidence, ChannelSubscriptionRequest, ChannelTarget, ChatFormatDefinition, ChatFormatMetadata, ChatFormatPin, ChatMessage, ChatParseRequest, ChatParsed, ChatRenderRequest, ChatRendering, ChatSpan, ChatTool, 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, CredentialProviderConfigEgressBinding, CredentialProviderContext, CredentialProviderCredentialSlotSetup, CredentialProviderDefinition, CredentialProviderPackage, CredentialProviderPackageMetadata, CredentialProviderSecretInput, CredentialProviderSetupMetadata, CredentialSetupState, CredentialUninstallRequest, CredentialUninstallResult, CredentialVerifyResult, Ctx, CustomerTenantCRN, DataManifest, DataSharingScope, DatasetCRN, DatasetDraft, DatasetRef, DelegatedGrant, DelegationCeiling, DeliveryMode, DeliveryReceipt, DispatchResult, EffectClass, EvalComparison, EvalDivergence, EvalMode, EvalSubject, EvalSubjectSource, EvalSuiteCase, EvalSuiteCasePage, EvalSuiteCaseScore, EvalSuiteCaseState, EvalSuiteScoreState, 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, HistoryPage, HistoryView, HmacVerification, IgnoredChannelEvent, IngressRequest, IngressTarget, IntegrationArtifactEgressRequest, IntegrationArtifactEgressResponse, IntegrationAttachment, IntegrationContext, IntegrationEgressPolicy, IntegrationEgressRequest, IntegrationEgressResponse, IntegrationEgressRule, IntegrationLifecycle, IntegrationReleaseContext, IntegrationSecret, IntegrationState, InvocationCredentialUse, InvocationHandle, InvokableKind, InvokeOpts, JoinOutcome, JsonScalar, JsonValue, JudgeRubric, LabelRequest, LabelSelector, LabelSelectorOperator, LabelSelectorRequirement, LedgerAddress, LedgerAddressParts, LedgerEvent, ListSchedulesOptions, LocalResourceRef, ManifestIndexPage, MapFact, MapOpts, McpClientOptions, McpClientState, McpMessageTransport, MemoryDeleteArgs, MemoryGetArgs, MemoryRecord, MemoryRememberArgs, MemorySearchArgs, MemorySearchHit, MemoryStoreBinding, Mode, ModelAdvertisedPricing, ModelCacheHint, ModelCompletion, ModelCredentialHeader, ModelGatewayBinding, ModelGatewayConfig, ModelGatewayProtocol, ModelGenerationOptions, ModelGovernanceControls, ModelGovernanceMeter, ModelHistoryMessage, ModelHistoryToolCall, ModelInvocationArgs, ModelInvocationResult, ModelProtocolRequestOptions, 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, SandboxEgressCredentialHeaderRule, SandboxEgressCredentialRule, SandboxEgressPolicy, SandboxEgressRule, SandboxExecInput, SandboxFileResult, SandboxGovernanceControls, SandboxGovernanceMeter, SandboxImage, SandboxLabels, SandboxMutationResult, SandboxNetworkMode, SandboxNetworkPolicy, SandboxPool, SandboxProcess, SandboxProcessCredentials, SandboxProcessIoOperation, SandboxProcessOperation, SandboxProcessReadInput, SandboxProcessReadResult, SandboxProcessStatus, SandboxProcessWriteResult, SandboxReadFileOptions, SandboxReadFileResult, SandboxWorkspace, SandboxWorkspaceInspection, SandboxWorkspacePreparation, SandboxWorkspaceReceipt, 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, ScorerDraft, ScorerEvaluation, ScorerKind, ScorerRef, ScorerVerdictIntent, SetEvalBaselineRequest, SetupAction, SetupCredentialCandidate, SetupCredentialInteractionPanel, SetupCredentialReceipt, SetupFormPanel, SetupPanel, SetupProgressPanel, SetupReviewPanel, SetupScreen, SetupStepStatus, SetupStepSummary, SetupSubmission, SetupTerminalPanel, SetupWorkflowStatus, Share, ShareAction, ShareContribution, ShareContributionImport, ShareContributionRequest, ShareContributionReview, ShareContributionReviewRequest, ShareContributionStatus, ShareEvaluation, ShareEvaluationPin, ShareEvaluationRequest, ShareEvaluationVerdict, ShareEvaluationView, ShareHistory, SharePrice, ShareRequest, ShareReviewDecision, SortField, SpawnAttenuation, SpawnBudget, SpawnHandle, SpawnOpts, SqlFold, StageInfo, StageOutputSpec, StartTrainingRequest, SteerEvent, StepJournal, SuiteFact, TableAggregate, TableDescribeArgs, TableFilter, TableFilterOperation, TableOrder, TableQueryArgs, TableQueryPlan, TableQueryResult, TableScalar, TableSnapshotDescription, Task, Tier, Tool, ToolCallRecord, TrainingCorrection, TrainingJobFact, TrainingJobReference, TrainingJobState, TrainingJobStatus, TrainingMethod, TrainingModelOffer, TrainingPreparation, TrainingProviderDefinition, TrainingProviderMetadata, TrainingProviderPin, TrainingRecipe, TrainingResumePoint, TrainingStep, TrainingUsageUnits, TurnDraft, TurnGate, TurnHistoryMessage, 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
@@ -1173,7 +1173,7 @@ function invocationCredentialUses(value) {
1173
1173
  const result = {};
1174
1174
  for (const [slot, raw] of Object.entries(source).sort(([left], [right]) => left.localeCompare(right))) {
1175
1175
  const use = record2(raw), consumer = record2(use?.consumer);
1176
- if (!NAME3.test(slot) || !use || Object.keys(use).some((key) => key !== "binding" && key !== "consumer") || !consumer || (consumer.kind === "resource" ? Object.keys(consumer).length !== 1 || typeof use.binding === "string" : Object.keys(consumer).some((key) => !["kind", "delivery", "name"].includes(key)) || !(consumer.kind === "process" && (consumer.delivery === "env" || consumer.delivery === "file") || consumer.kind === "egress" && consumer.delivery === "header") || typeof consumer.name !== "string" || !consumer.name || consumer.name.includes("=") || /[\u0000-\u001f\u007f]/u.test(consumer.name))) throw new TypeError("invocation Credential selection is invalid");
1176
+ if (!NAME3.test(slot) || !use || Object.keys(use).some((key) => key !== "binding" && key !== "consumer") || !consumer || (consumer.kind === "resource" ? Object.keys(consumer).length !== 1 || typeof use.binding === "string" : Object.keys(consumer).some((key) => !["kind", "delivery", "name"].includes(key)) || !(consumer.kind === "process" && (consumer.delivery === "env" || consumer.delivery === "file") || consumer.kind === "egress" && consumer.delivery === "header" || consumer.kind === "browser" && (consumer.delivery === "login" || consumer.delivery === "passkey" || consumer.delivery === "session")) || typeof consumer.name !== "string" || !consumer.name || consumer.name.includes("=") || /[\u0000-\u001f\u007f]/u.test(consumer.name))) throw new TypeError("invocation Credential selection is invalid");
1177
1177
  result[slot] = { binding: resourceCredentialBinding(use.binding), consumer };
1178
1178
  }
1179
1179
  return result;
@@ -3552,6 +3552,22 @@ function host(value) {
3552
3552
  const [normalized] = normalizeSandboxDomains([value]);
3553
3553
  return normalized;
3554
3554
  }
3555
+ function headerRule(rule) {
3556
+ const header = rule.header === void 0 ? "authorization" : rule.header;
3557
+ if (typeof header !== "string" || !HEADER2.test(header.toLowerCase()) || RESERVED_HEADERS2.has(header.toLowerCase()) || header.toLowerCase().startsWith("x-constal-")) throw new TypeError("sandbox egress Credential header is invalid");
3558
+ if (rule.value !== void 0 && rule.basic !== void 0) throw new TypeError("sandbox egress Credential rule takes value or basic, not both");
3559
+ if (rule.value !== void 0 && (typeof rule.value !== "string" || rule.value.length > 256 || /[\r\n\0]/u.test(rule.value) || rule.value.split("{value}").length !== 2)) throw new TypeError("sandbox egress Credential value must contain {value} exactly once");
3560
+ const basic = rule.basic === void 0 ? void 0 : object4(rule.basic);
3561
+ if (rule.basic !== void 0 && (!basic || Object.keys(basic).some((key) => key !== "username") || basic.username !== void 0 && (typeof basic.username !== "string" || !basic.username || basic.username.length > 128 || /[:\r\n\0]/u.test(basic.username)))) throw new TypeError("sandbox egress Credential basic auth is invalid");
3562
+ if (rule.field !== void 0 && (typeof rule.field !== "string" || !rule.field.startsWith("/") || rule.field.length > 256 || SPACE_OR_CONTROL.test(rule.field) || /~(?![01])/u.test(rule.field))) throw new TypeError("sandbox egress Credential field must be a JSON Pointer");
3563
+ if (rule.code !== void 0 && rule.code !== "totp") throw new TypeError("sandbox egress Credential code must be totp");
3564
+ return {
3565
+ header: header.toLowerCase(),
3566
+ ...basic ? { basic: basic.username === void 0 ? {} : { username: basic.username } } : { value: rule.value ?? "Bearer {value}" },
3567
+ ...rule.field !== void 0 ? { field: rule.field } : {},
3568
+ ...rule.code !== void 0 ? { code: "totp" } : {}
3569
+ };
3570
+ }
3555
3571
  var SPACE_OR_CONTROL = /[\s\u0000-\u001f\u007f]/u;
3556
3572
  function paths(value) {
3557
3573
  if (!Array.isArray(value) || value.length === 0 || value.length > SANDBOX_EGRESS_LIMITS.hostsPerRule) {
@@ -3605,26 +3621,32 @@ function normalizeSandboxEgressCredentialRules(value, options = {}) {
3605
3621
  if (!Array.isArray(value) || value.length > SANDBOX_EGRESS_LIMITS.credentialRules) throw new TypeError("sandbox egress Credential rules are invalid");
3606
3622
  return value.map((raw) => {
3607
3623
  const rule = object4(raw);
3608
- const allowed = ["hosts", "paths", "slot", "header", "value", "basic", "push", ...options.bindings ? ["binding"] : [], ...options.uses ? ["use"] : []];
3624
+ const allowed = ["hosts", "paths", "slot", "header", "value", "basic", "field", "code", "headers", "push", ...options.bindings ? ["binding"] : [], ...options.uses ? ["use"] : []];
3609
3625
  if (!rule || Object.keys(rule).some((key) => !allowed.includes(key)) || !Array.isArray(rule.hosts) || rule.hosts.length === 0 || rule.hosts.length > SANDBOX_EGRESS_LIMITS.hostsPerRule) throw new TypeError("sandbox egress Credential rule is invalid");
3610
3626
  const sources = [rule.slot, rule.binding, rule.use].filter((source) => source !== void 0);
3611
3627
  if (sources.length !== 1 || rule.slot !== void 0 && (typeof rule.slot !== "string" || !SLOT.test(rule.slot)) || rule.use !== void 0 && (typeof rule.use !== "string" || !USE.test(rule.use))) {
3612
3628
  throw new TypeError("sandbox egress Credential rule names exactly one slot or binding");
3613
3629
  }
3614
- const header = rule.header === void 0 ? "authorization" : rule.header;
3615
- if (typeof header !== "string" || !HEADER2.test(header.toLowerCase()) || RESERVED_HEADERS2.has(header.toLowerCase()) || header.toLowerCase().startsWith("x-constal-")) throw new TypeError("sandbox egress Credential header is invalid");
3616
- if (rule.value !== void 0 && rule.basic !== void 0) throw new TypeError("sandbox egress Credential rule takes value or basic, not both");
3617
- if (rule.value !== void 0 && (typeof rule.value !== "string" || rule.value.length > 256 || /[\r\n\0]/u.test(rule.value) || rule.value.split("{value}").length !== 2)) throw new TypeError("sandbox egress Credential value must contain {value} exactly once");
3618
- const basic = rule.basic === void 0 ? void 0 : object4(rule.basic);
3619
- if (rule.basic !== void 0 && (!basic || Object.keys(basic).some((key) => key !== "username") || basic.username !== void 0 && (typeof basic.username !== "string" || !basic.username || basic.username.length > 128 || /[:\r\n\0]/u.test(basic.username)))) throw new TypeError("sandbox egress Credential basic auth is invalid");
3630
+ const own = headerRule(rule);
3631
+ if (rule.headers !== void 0 && (!Array.isArray(rule.headers) || rule.headers.length === 0 || rule.headers.length > SANDBOX_EGRESS_LIMITS.credentialRules)) throw new TypeError("sandbox egress Credential headers are invalid");
3632
+ const more = rule.headers?.map((raw2) => {
3633
+ const entry2 = object4(raw2);
3634
+ if (!entry2 || Object.keys(entry2).some((key) => !["header", "value", "basic", "field", "code"].includes(key))) {
3635
+ throw new TypeError("sandbox egress Credential header is invalid");
3636
+ }
3637
+ return headerRule(entry2);
3638
+ });
3639
+ if (more && (/* @__PURE__ */ new Set([own.header, ...more.map((entry2) => entry2.header)])).size !== more.length + 1) {
3640
+ throw new TypeError("sandbox egress Credential rule names a header twice");
3641
+ }
3620
3642
  return {
3621
3643
  hosts: normalizeSandboxDomains(rule.hosts),
3622
3644
  ...rule.paths !== void 0 ? { paths: paths(rule.paths) } : {},
3623
3645
  ...rule.slot !== void 0 ? { slot: rule.slot } : {},
3624
3646
  ...rule.binding !== void 0 ? { binding: resourceCredentialBinding(rule.binding) } : {},
3625
3647
  ...rule.use !== void 0 ? { use: rule.use } : {},
3626
- header: header.toLowerCase(),
3627
- ...basic ? { basic: basic.username === void 0 ? {} : { username: basic.username } } : { value: rule.value ?? "Bearer {value}" },
3648
+ ...own,
3649
+ ...more ? { headers: more } : {},
3628
3650
  ...rule.push !== void 0 ? { push: pushRefs(rule.push) } : {}
3629
3651
  };
3630
3652
  });