@constal/sdk 6.5.0 → 6.7.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.5.0",
3
+ "version": "6.7.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.5.0",
3
+ "version": "6.7.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",
@@ -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
@@ -3591,7 +3630,10 @@ type AuthProviderResult = {
3591
3630
  };
3592
3631
  /** A request signature an AuthProvider returns for Constal to check with one of its own Credential bindings. */
3593
3632
  interface HmacVerification {
3594
- /** The name of one of this AuthProvider's Credential bindings. */
3633
+ /**
3634
+ * The name of one of this AuthProvider's Credential bindings. The key is that Credential's value in its key format: its
3635
+ * UTF-8 bytes, or for a `"base64"` Credential the bytes the value decodes to.
3636
+ */
3595
3637
  credential: string;
3596
3638
  algorithm: "HMAC-SHA256" | "HMAC-SHA384" | "HMAC-SHA512";
3597
3639
  /** Exactly what the provider signed, as this AuthProvider builds it; a string is signed as UTF-8. */
@@ -5125,6 +5167,12 @@ interface CredentialProviderPackageMetadata {
5125
5167
  credentialSlots: string[];
5126
5168
  /** Non-secret configuration collected separately for each Credential created from this provider. */
5127
5169
  credentialConfigSchema: object;
5170
+ /**
5171
+ * How each Credential's value becomes the key an AuthProvider's HMAC check verifies with: `"text"`, the default, is its
5172
+ * UTF-8 bytes; `"base64"` is the bytes it decodes to as standard base64. Only that check reads it: wherever the Credential
5173
+ * is injected as a secret, its value is as stored. It cannot change across the provider's versions.
5174
+ */
5175
+ key?: "text" | "base64";
5128
5176
  /**
5129
5177
  * Interactive acquisition metadata. Null for non-interactive providers. `origins` are fixed when the package is published;
5130
5178
  * `urlProperty` names the top-level config property whose HTTPS URL's origin each install may send a browser to.
@@ -5460,4 +5508,4 @@ declare function parseLedgerAddress(value: unknown): LedgerAddressParts | null;
5460
5508
  declare function formatLedgerAddress(parts: LedgerAddressParts): LedgerAddress;
5461
5509
 
5462
5510
  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 };
5463
- 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 };
5511
+ 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, 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
  });
@@ -4438,6 +4460,9 @@ function credentialProvider(definition) {
4438
4460
  credentialRotationDefaults(definition.rotation);
4439
4461
  credentialProviderConfigSchema(definition.configSchema);
4440
4462
  credentialProviderConfigSchema(definition.credentialConfigSchema);
4463
+ if (definition.key !== void 0 && definition.key !== "text" && definition.key !== "base64") {
4464
+ throw new TypeError("credential provider key format is invalid");
4465
+ }
4441
4466
  if (!Array.isArray(definition.credentialSlots) || new Set(definition.credentialSlots).size !== definition.credentialSlots.length || definition.credentialSlots.some((slot) => typeof slot !== "string" || !/^[a-z0-9][a-z0-9._-]{0,127}$/u.test(slot))) {
4442
4467
  throw new TypeError("credential provider bootstrap slots are invalid");
4443
4468
  }
@@ -4479,6 +4504,7 @@ function credentialProvider(definition) {
4479
4504
  ...setup ? { setup } : {},
4480
4505
  credentialSlots: [...definition.credentialSlots].sort(),
4481
4506
  credentialConfigSchema: definition.credentialConfigSchema,
4507
+ ...definition.key === void 0 ? {} : { key: definition.key },
4482
4508
  interaction: !interaction ? null : "urlProperty" in interaction ? { urlProperty: interaction.urlProperty } : { origins: [...interaction.origins].sort() },
4483
4509
  rotation: definition.rotation,
4484
4510
  egress: integrationEgressPolicy(definition.egress),