@constal/sdk 3.6.0 → 3.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 +1 -1
- package/publish/api.json +3 -3
- package/publish/index.d.ts +35 -11
- package/publish/index.js +1 -1
package/package.json
CHANGED
package/publish/api.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "@constal/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"exports": [
|
|
5
5
|
"AGENT_UI_DEFAULTS",
|
|
6
6
|
"Action",
|
|
@@ -60,9 +60,8 @@
|
|
|
60
60
|
"CaseRow",
|
|
61
61
|
"CatalogTool",
|
|
62
62
|
"Channel",
|
|
63
|
-
"ChannelAlarm",
|
|
64
|
-
"ChannelAlarmResult",
|
|
65
63
|
"ChannelContext",
|
|
64
|
+
"ChannelFailure",
|
|
66
65
|
"ChannelIngressEvent",
|
|
67
66
|
"ChannelIngressSource",
|
|
68
67
|
"ChannelMessage",
|
|
@@ -193,6 +192,7 @@
|
|
|
193
192
|
"HandleOutcome",
|
|
194
193
|
"Hash",
|
|
195
194
|
"HistoryView",
|
|
195
|
+
"HmacVerification",
|
|
196
196
|
"IgnoredChannelEvent",
|
|
197
197
|
"IngressRequest",
|
|
198
198
|
"IngressTarget",
|
package/publish/index.d.ts
CHANGED
|
@@ -1446,7 +1446,7 @@ type PolicyInvocationOrigin = {
|
|
|
1446
1446
|
} | {
|
|
1447
1447
|
kind: "channel";
|
|
1448
1448
|
channel: CRN;
|
|
1449
|
-
phase: "receive" | "respond" | "send" | "
|
|
1449
|
+
phase: "receive" | "respond" | "send" | "failed" | "authorize-subscription";
|
|
1450
1450
|
} | {
|
|
1451
1451
|
kind: "sandbox";
|
|
1452
1452
|
agent: CRN;
|
|
@@ -2796,14 +2796,21 @@ interface DeliveryReceipt {
|
|
|
2796
2796
|
error?: string;
|
|
2797
2797
|
metadata?: Record<string, string | number | boolean>;
|
|
2798
2798
|
}
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2799
|
+
/** An event the platform acknowledged and then failed to process, as the Channel's `failed` hook receives it. */
|
|
2800
|
+
interface ChannelFailure {
|
|
2801
|
+
event: {
|
|
2802
|
+
id: string;
|
|
2803
|
+
type: string;
|
|
2804
|
+
session: string;
|
|
2805
|
+
};
|
|
2806
|
+
/** The reply address the Channel pinned in receive(), or null when it pinned none. */
|
|
2807
|
+
reply: {
|
|
2808
|
+
destination: string;
|
|
2809
|
+
replyTo?: string;
|
|
2810
|
+
metadata?: Record<string, string | number | boolean>;
|
|
2811
|
+
} | null;
|
|
2812
|
+
code: string;
|
|
2813
|
+
message: string;
|
|
2807
2814
|
}
|
|
2808
2815
|
interface ChannelProtocol<Input = unknown, Output = unknown, Delivery = Output> {
|
|
2809
2816
|
id: string;
|
|
@@ -2811,7 +2818,8 @@ interface ChannelProtocol<Input = unknown, Output = unknown, Delivery = Output>
|
|
|
2811
2818
|
receive(request: ChannelRequest, context: ChannelContext): Promise<ChannelReceiveResult<Input>> | ChannelReceiveResult<Input>;
|
|
2812
2819
|
respond(result: DispatchResult<Output>, context: ChannelContext): Promise<ChannelResponse> | ChannelResponse;
|
|
2813
2820
|
send?(message: ChannelMessage<Delivery>, context: ChannelContext): Promise<DeliveryReceipt> | DeliveryReceipt;
|
|
2814
|
-
|
|
2821
|
+
/** Decide whether to tell the person their acknowledged event failed. Delivery is at-least-once: dedupe by event id. */
|
|
2822
|
+
failed?(failure: ChannelFailure, context: ChannelContext): Promise<void> | void;
|
|
2815
2823
|
/** Prove external access before a subscriber's Channel, bindings, or routes are installed. */
|
|
2816
2824
|
authorizeSubscription?(request: ChannelSubscriptionRequest, context: ChannelContext): Promise<boolean> | boolean;
|
|
2817
2825
|
}
|
|
@@ -2847,6 +2855,17 @@ type AuthProviderResult = {
|
|
|
2847
2855
|
claims?: Record<string, string | number | boolean | string[]>;
|
|
2848
2856
|
expiresAt?: number | null;
|
|
2849
2857
|
};
|
|
2858
|
+
/** A request signature an AuthProvider checks with one of its own Credential bindings. */
|
|
2859
|
+
interface HmacVerification {
|
|
2860
|
+
/** The name of one of this AuthProvider's Credential bindings. */
|
|
2861
|
+
credential: string;
|
|
2862
|
+
algorithm: "HMAC-SHA256" | "HMAC-SHA384" | "HMAC-SHA512";
|
|
2863
|
+
/** Exactly what the provider signed, as this AuthProvider builds it; a string is signed as UTF-8. */
|
|
2864
|
+
message: string | Uint8Array;
|
|
2865
|
+
/** The signature the request carries, without any provider prefix. */
|
|
2866
|
+
signature: string;
|
|
2867
|
+
encoding: "hex" | "base64";
|
|
2868
|
+
}
|
|
2850
2869
|
interface AuthProviderContext {
|
|
2851
2870
|
requestId: string;
|
|
2852
2871
|
provider: AuthProviderCRN;
|
|
@@ -2856,6 +2875,11 @@ interface AuthProviderContext {
|
|
|
2856
2875
|
/** Host-authenticated source provenance. HTTP callers cannot supply this field. */
|
|
2857
2876
|
source?: ChannelSourceEvidence;
|
|
2858
2877
|
invoke<T>(resource: CRN, op: string, args: unknown): Promise<T>;
|
|
2878
|
+
/**
|
|
2879
|
+
* Whether `signature` is the HMAC of `message` under the Credential bound as `credential`, compared in constant time.
|
|
2880
|
+
* The key never leaves Constal, and no HMAC is computed for the caller. A signature not in `encoding` is not verified.
|
|
2881
|
+
*/
|
|
2882
|
+
verifyHmac(input: HmacVerification): Promise<boolean>;
|
|
2859
2883
|
}
|
|
2860
2884
|
interface AuthProvider {
|
|
2861
2885
|
id: string;
|
|
@@ -4429,4 +4453,4 @@ declare class SessionDeleted extends Error {
|
|
|
4429
4453
|
}
|
|
4430
4454
|
|
|
4431
4455
|
export { AGENT_UI_DEFAULTS, AfterYield, ApiError, CONSTAL_API_CAPABILITY, CONSTAL_API_GET_KINDS, CONSTAL_API_MODEL_TOOL_DESCRIPTIONS, CONSTAL_API_OPERATIONS, CONSTAL_API_OPERATION_SCHEMAS, CONSTAL_API_QUERY_KINDS, CONSTAL_API_VERSION, CommitConflict, CommitGateRejected, CredentialRevoked, CredentialUnavailable, DirectNetworkDenied, EVALUATION_LIMITS, EffectCeilingExceeded, GateExhausted, IntegrationRequestNotSent, LeaseLost, MCP_CLIENT_CAPABILITY, MCP_PROTOCOL_VERSION, MEMORY_OPERATION_DECLARATIONS, MODEL_CHECKPOINT_IMPORT_CAPABILITY, MODEL_COMPLETION_CAPABILITY, MODEL_EVALUATION_CAPABILITY, McpClient, NondeterministicReplay, OutcomeUnknown, PolicyConstraintFailed, PolicyDecisionFailed, RESOURCE_CREDENTIAL_BINDING_SCHEMA, RESOURCE_KINDS, ResourceDisabled, ResourceInvalid, ResourceUnbound, RollbackTargetInvalid, SessionDeleted, SpawnCardinality, SwallowedYield, TRAINING_PROVIDER_CAPABILITY, TerminalIntegrationFailure, ToolUnavailable, UI_ASSET_CONTENT_TYPES, UI_BUNDLE_BOUNDS, UnknownTool, WEB_FETCH_ARGUMENT_SCHEMA, WEB_SEARCH_ARGUMENT_SCHEMA, action, actionPattern, agent, agentResourceBinding, agentSetupMetadata, agentSetupRequirements, agentUiBundleManifest, agentUiDeclaration, analyticsEvent, approximateTokens, authProvider, authProviderName, bindingName, bucketFor, canonicalJson, capabilityContractRef, casTool, channel, channelIngressRequest, channelIngressSource, channelSourceEvidence, channelSubscriptionRequest, channelTarget, checkpointArtifactRef, checkpointDeploymentRequest, checkpointImportMetadata, checkpointImportRequest, codeScorerIR, containerImageReference, containerImageSelection, containerImageSource, credentialEvidence, credentialInteractionAction, credentialInteractionEvent, credentialInteractionResult, credentialName, credentialProvider, credentialProviderConfigSchema, credentialProviderName, credentialProviderSetupMetadata, credentialRotationDefaults, credentialSetupState, customerTenantName, cutBatches, cutPartitions, datasetName, evaluateCodeScorer, evaluatePolicyDefinition, evaluationArguments, evaluationProtocolRequest, evaluationProtocolResult, gateway, gatewayModelOffer, gatewayPackageMetadata, hash, hashValue, immutableContainerImageReference, integrationEgressPolicy, invocationCredentialUses, labelSelector, matchesAction, matchesLabelSelector, matchesResource, mcpToolDescription, mcpToolResult, memoryStoreBinding, modelAdvertisedPricing, modelControls, modelGatewayBinding, modelGatewayEndpoint, modelGenerationOptions, modelLimit, modelMessages, modelPrompt, modelProtocolRequest, modelProtocolResult, murmur3_32, normalizeModelGatewayConfig, normalizeSandboxNetworkPolicy, normalizeSandboxWorkspacePath, noulDecision, opTool, opTools, parseResourceName, policy, policyName, renderTrainingCompletion, resolveBindingOwner, resolveContainerImageSource, resolveGatewayEgress, resolveResourceDependencyRef, resourceContractRef, resourceCredentialBinding, resourceDependencyRef, resourceLabelMap, resourceName, resourceNeed, resourcePattern, resourceSelector, resourceTools, sandboxControls, sandboxLimit, scopedBindingKey, scopedCredentialRef, scopedResourceRef, scoreLevel, scorerName, selectableResourceLabels, setupAwait, setupCredentialReceipt, setupPanelProviderIsCrn, setupScreen, setupScreenView, setupSubmission, sha256Hex, skills, stageOutput, startTrainingRequest, subtask, tableDescribe, tableQuery, trainingProvider, trainingProviderMetadata, trainingRecipe, uiAssetContentType, uiBundle, uiBundleManifest, uiLimit, uiName, validateBatchSpec, validateFoldFn, validateJsonSchema, validateJsonSchemaDefinition, validatePartitionFn, validatePartitionSpec, validateStageOutputSpec, validateTool, validateView, webFetch, webSearch };
|
|
4432
|
-
export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentCredentialSetupRequirement, AgentDef, AgentDeliveryReceipt, AgentDeployPolicy, AgentResultDelivery, AgentSendOpts, AgentSetupMetadata, AgentSetupRequirement, AgentSetupWorkflow, AgentUiDeclaration, AnalyticsClient, AnalyticsDimensionValue, AnalyticsEventDefinition, AnalyticsIntent, AnalyticsValues, AuthProvider, AuthProviderCRN, AuthProviderContext, AuthProviderRequest, AuthProviderResult, AwaitOpts, AwaitPresentation, BatchSpec, BindingCRN, BindingOwnerContext, BindingOwnerScope, BoundOperation, BoundResourceCapabilities, BranchRef, CRN, CRNKind, CanonicalEvent, CanonicalEventDraft, CapabilityContractRef, CapabilityGrant, CapabilityRef, CaptureCaseRequest, CaseRow, CatalogTool, Channel,
|
|
4456
|
+
export type { Action, ActionPattern, Actor, AdmissionLimitConstraint, AdmissionLimitInput, AdmissionLimitScope, AdmissionLimitWindow, Agent, AgentCredentialSetupRequirement, AgentDef, AgentDeliveryReceipt, AgentDeployPolicy, AgentResultDelivery, AgentSendOpts, AgentSetupMetadata, AgentSetupRequirement, AgentSetupWorkflow, AgentUiDeclaration, AnalyticsClient, AnalyticsDimensionValue, AnalyticsEventDefinition, AnalyticsIntent, AnalyticsValues, AuthProvider, AuthProviderCRN, AuthProviderContext, AuthProviderRequest, AuthProviderResult, AwaitOpts, AwaitPresentation, BatchSpec, BindingCRN, BindingOwnerContext, BindingOwnerScope, BoundOperation, BoundResourceCapabilities, BranchRef, CRN, CRNKind, CanonicalEvent, CanonicalEventDraft, CapabilityContractRef, CapabilityGrant, CapabilityRef, CaptureCaseRequest, CaseRow, CatalogTool, Channel, ChannelContext, ChannelFailure, ChannelIngressEvent, ChannelIngressSource, ChannelMessage, ChannelProtocol, ChannelReceiveResult, ChannelRequest, ChannelResponse, ChannelSourceEvidence, ChannelSubscriptionRequest, ChannelTarget, CheckpointDeploymentRequest, CheckpointImportMetadata, CheckpointImportRequest, ChoiceAnswer, ChoiceQuestion, CodeScoreResult, CodeScorerIR, CodeScorerRule, CommitOpts, CompareSuitesRequest, Compensation, ConnectionCancelRequest, ConnectionIdentity, ConnectionOperation, ConnectionRecoveryRequest, ConnectionRecoveryResult, ConnectionRequest, ConnectionUsageReport, ConstalApiApplyRequest, ConstalApiChangePlan, ConstalApiChangePlanRef, ConstalApiChangePlanRequest, ConstalApiChangeReceipt, ConstalApiOperationReceipt, ContainerImageReference, ContainerImageSelection, ContainerImageSource, ContainerRegistryRequest, ContainerRegistryResponse, ControlEvent, Cost, CreateSandboxImageOptions, CreateSandboxOptions, CredentialCRN, CredentialDestroyResult, CredentialEvidence, CredentialInteractionAction, CredentialInteractionAdvanceRequest, CredentialInteractionEvent, CredentialInteractionPrimaryAction, CredentialInteractionProof, CredentialInteractionResult, CredentialInteractionStartRequest, CredentialMaterialRequest, CredentialMintRequest, CredentialMintResult, CredentialProviderCRN, CredentialProviderContext, CredentialProviderCredentialSlotSetup, CredentialProviderDefinition, CredentialProviderPackage, CredentialProviderPackageMetadata, CredentialProviderSecretInput, CredentialProviderSetupMetadata, CredentialSetupState, CredentialVerifyResult, Ctx, CustomerTenantCRN, DataManifest, DatasetCRN, DatasetDraft, DatasetRef, DelegatedGrant, DelegationCeiling, DeliveryMode, DeliveryReceipt, DispatchResult, EffectClass, EvalComparison, EvalDivergence, EvalMode, EvalSubject, EvalSubjectSource, EvaluationAnswer, EvaluationAnswerFor, EvaluationAnswers, EvaluationEntry, EvaluationInvocationArgs, EvaluationInvocationResult, EvaluationProtocol, EvaluationQuestion, EvaluationQuestions, EvaluationRecord, EvaluationSpec, EventBase, Fact, FactRef, FileEntry, FixedMemoryStoreRef, FixedModelGatewayRef, FoldFn, GateEvidence, GateResult, GateVerdict, GatewayCancelRequest, GatewayConfigEgressBinding, GatewayContext, GatewayCredentialSlotSetup, GatewayDefinition, GatewayDiscoverySetup, GatewayModelOffer, GatewayOperation, GatewayPackage, GatewayPackageMetadata, GatewayRecoveryRequest, GatewayRecoveryResult, GatewayRequest, GovernanceContractRef, Handle, HandleOutcome, Hash, HistoryView, HmacVerification, IgnoredChannelEvent, IngressRequest, IngressTarget, IntegrationArtifactEgressRequest, IntegrationArtifactEgressResponse, IntegrationAttachment, IntegrationContext, IntegrationEgressPolicy, IntegrationEgressRequest, IntegrationEgressResponse, IntegrationEgressRule, IntegrationLifecycle, IntegrationReleaseContext, IntegrationSecret, IntegrationState, InvocationCredentialUse, InvocationHandle, InvokableKind, InvokeOpts, JsonScalar, JsonValue, LabelRequest, LabelSelector, LabelSelectorOperator, LabelSelectorRequirement, LedgerAddress, LedgerEvent, LoadedSkill, LocalResourceRef, ManifestIndexPage, MapFact, MapOpts, McpClientOptions, McpClientState, McpMessageTransport, MemoryDeleteArgs, MemoryGetArgs, MemoryRecord, MemoryRememberArgs, MemorySearchArgs, MemorySearchHit, MemoryStoreBinding, Mode, ModelAdvertisedPricing, ModelCompletion, ModelCredentialHeader, ModelGatewayBinding, ModelGatewayConfig, ModelGatewayProtocol, ModelGenerationOptions, ModelGovernanceControls, ModelGovernanceMeter, ModelHistoryMessage, ModelInvocationArgs, ModelInvocationResult, ModelTechnicalCapabilities, ModelTool, NormalizedModelGatewayConfig, NoulAnswer, NoulQuestion, Out, Over, PartitionFn, PartitionSpec, Partitioning, PolicyCRN, PolicyConstraint, PolicyContextValue, PolicyDefinition, PolicyInput, PolicyInvocationOrigin, PolicyOutcome, Principal, PrincipalKind, Provenance, RawModelProtocol, Recovery, ReduceFact, ReduceOpts, Ref, RequestLabelRequest, ResourceContractRef, ResourceControlsConstraint, ResourceCredentialBinding, ResourceDependencyRef, ResourceKind, ResourceName, ResourceNameParts, ResourceNeed, ResourcePattern, ResourceSelector, RollbackReport, RunIdentityView, RunInfo, RunStatusDetail, RunSuiteRequest, Sandbox, SandboxCommandCollectionError, SandboxCommandExecution, SandboxCommandResult, SandboxExecInput, SandboxFileResult, SandboxGovernanceControls, SandboxGovernanceMeter, SandboxImage, SandboxMutationResult, SandboxNetworkMode, SandboxNetworkPolicy, SandboxPool, SandboxProcess, SandboxProcessCredentials, SandboxProcessIoOperation, SandboxProcessOperation, SandboxProcessReadInput, SandboxProcessReadResult, SandboxProcessStatus, SandboxProcessWriteResult, SandboxReadFileOptions, SandboxReadFileResult, SandboxWorkspace, SandboxWriteFileResult, ScopedBindingKey, ScopedCredentialRef, ScopedMemoryStoreRef, ScopedModelGatewayRef, ScopedResourceRef, ScoreAnswer, ScoreQuestion, ScoreRequest, ScorerApplies, ScorerCRN, ScorerDef, ScorerEvaluation, ScorerKind, ScorerRef, ScorerVerdictIntent, SetEvalBaselineRequest, SetupAction, SetupCredentialCandidate, SetupCredentialInteractionPanel, SetupCredentialReceipt, SetupFormPanel, SetupPanel, SetupProgressPanel, SetupReviewPanel, SetupScreen, SetupStepStatus, SetupStepSummary, SetupSubmission, SetupTerminalPanel, SetupWorkflowStatus, Skill, SkillDescription, SkillLibrary, SkillSource, SortField, SpawnAttenuation, SpawnBudget, SpawnOpts, SqlFold, StageInfo, StageOutputSpec, StartTrainingRequest, SteerEvent, SuiteFact, TableAggregate, TableDescribeArgs, TableFilter, TableFilterOperation, TableOrder, TableQueryArgs, TableQueryPlan, TableQueryResult, TableScalar, TableSnapshotDescription, Task, Tier, Tool, ToolCallRecord, TrainingJobFact, TrainingJobReference, TrainingJobState, TrainingJobStatus, TrainingMethod, TrainingModelOffer, TrainingProviderDefinition, TrainingProviderMetadata, TrainingProviderPin, TrainingRecipe, TrainingResumePoint, TrainingUsageUnits, TurnDraft, TurnGate, TurnRecord, TurnSpec, UiAccess, UiBundle, UiBundleManifest, UiCRN, UiCapability, UiExecution, UiGovernanceMeter, UiHandler, UiResource, UiRuntimeContext, UiSource, UiSqlResult, UiState, UpstreamPayer, Verdict, VerdictSamplingMode, ViewDef, WaitResolvedEvent };
|
package/publish/index.js
CHANGED
|
@@ -1180,7 +1180,7 @@ function executable(value, path) {
|
|
|
1180
1180
|
function channel(definition) {
|
|
1181
1181
|
executable(definition, "channel");
|
|
1182
1182
|
executable(definition.protocol, "channel.protocol");
|
|
1183
|
-
if (typeof definition.protocol.receive !== "function" || typeof definition.protocol.respond !== "function" || definition.protocol.send !== void 0 && typeof definition.protocol.send !== "function" || definition.protocol.
|
|
1183
|
+
if (typeof definition.protocol.receive !== "function" || typeof definition.protocol.respond !== "function" || definition.protocol.send !== void 0 && typeof definition.protocol.send !== "function" || definition.protocol.failed !== void 0 && typeof definition.protocol.failed !== "function" || definition.protocol.authorizeSubscription !== void 0 && typeof definition.protocol.authorizeSubscription !== "function") {
|
|
1184
1184
|
throw new TypeError("channel.protocol must define receive and respond; optional handlers must be functions");
|
|
1185
1185
|
}
|
|
1186
1186
|
resourceDependencyRef(definition.authProvider, ["auth-provider"]);
|