@constal/sdk 3.6.0 → 3.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 +1 -1
- package/publish/api.json +3 -3
- package/publish/index.d.ts +40 -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.8.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;
|
|
@@ -2780,6 +2780,11 @@ interface ChannelContext {
|
|
|
2780
2780
|
timeoutMs?: number;
|
|
2781
2781
|
dedupeKey?: string;
|
|
2782
2782
|
}): Promise<T>;
|
|
2783
|
+
/**
|
|
2784
|
+
* Keeps the Channel's code running after it answers; its Resource calls stay under this invocation's capability until it
|
|
2785
|
+
* expires. In send() and failed() the Session refuses them once it has finished the item.
|
|
2786
|
+
*/
|
|
2787
|
+
waitUntil(promise: Promise<unknown>): void;
|
|
2783
2788
|
}
|
|
2784
2789
|
interface ChannelMessage<T = unknown> {
|
|
2785
2790
|
id: string;
|
|
@@ -2796,14 +2801,21 @@ interface DeliveryReceipt {
|
|
|
2796
2801
|
error?: string;
|
|
2797
2802
|
metadata?: Record<string, string | number | boolean>;
|
|
2798
2803
|
}
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2804
|
+
/** An event the platform acknowledged and then failed to process, as the Channel's `failed` hook receives it. */
|
|
2805
|
+
interface ChannelFailure {
|
|
2806
|
+
event: {
|
|
2807
|
+
id: string;
|
|
2808
|
+
type: string;
|
|
2809
|
+
session: string;
|
|
2810
|
+
};
|
|
2811
|
+
/** The reply address the Channel pinned in receive(), or null when it pinned none. */
|
|
2812
|
+
reply: {
|
|
2813
|
+
destination: string;
|
|
2814
|
+
replyTo?: string;
|
|
2815
|
+
metadata?: Record<string, string | number | boolean>;
|
|
2816
|
+
} | null;
|
|
2817
|
+
code: string;
|
|
2818
|
+
message: string;
|
|
2807
2819
|
}
|
|
2808
2820
|
interface ChannelProtocol<Input = unknown, Output = unknown, Delivery = Output> {
|
|
2809
2821
|
id: string;
|
|
@@ -2811,7 +2823,8 @@ interface ChannelProtocol<Input = unknown, Output = unknown, Delivery = Output>
|
|
|
2811
2823
|
receive(request: ChannelRequest, context: ChannelContext): Promise<ChannelReceiveResult<Input>> | ChannelReceiveResult<Input>;
|
|
2812
2824
|
respond(result: DispatchResult<Output>, context: ChannelContext): Promise<ChannelResponse> | ChannelResponse;
|
|
2813
2825
|
send?(message: ChannelMessage<Delivery>, context: ChannelContext): Promise<DeliveryReceipt> | DeliveryReceipt;
|
|
2814
|
-
|
|
2826
|
+
/** Decide whether to tell the person their acknowledged event failed. Delivery is at-least-once: dedupe by event id. */
|
|
2827
|
+
failed?(failure: ChannelFailure, context: ChannelContext): Promise<void> | void;
|
|
2815
2828
|
/** Prove external access before a subscriber's Channel, bindings, or routes are installed. */
|
|
2816
2829
|
authorizeSubscription?(request: ChannelSubscriptionRequest, context: ChannelContext): Promise<boolean> | boolean;
|
|
2817
2830
|
}
|
|
@@ -2847,6 +2860,17 @@ type AuthProviderResult = {
|
|
|
2847
2860
|
claims?: Record<string, string | number | boolean | string[]>;
|
|
2848
2861
|
expiresAt?: number | null;
|
|
2849
2862
|
};
|
|
2863
|
+
/** A request signature an AuthProvider checks with one of its own Credential bindings. */
|
|
2864
|
+
interface HmacVerification {
|
|
2865
|
+
/** The name of one of this AuthProvider's Credential bindings. */
|
|
2866
|
+
credential: string;
|
|
2867
|
+
algorithm: "HMAC-SHA256" | "HMAC-SHA384" | "HMAC-SHA512";
|
|
2868
|
+
/** Exactly what the provider signed, as this AuthProvider builds it; a string is signed as UTF-8. */
|
|
2869
|
+
message: string | Uint8Array;
|
|
2870
|
+
/** The signature the request carries, without any provider prefix. */
|
|
2871
|
+
signature: string;
|
|
2872
|
+
encoding: "hex" | "base64";
|
|
2873
|
+
}
|
|
2850
2874
|
interface AuthProviderContext {
|
|
2851
2875
|
requestId: string;
|
|
2852
2876
|
provider: AuthProviderCRN;
|
|
@@ -2856,6 +2880,11 @@ interface AuthProviderContext {
|
|
|
2856
2880
|
/** Host-authenticated source provenance. HTTP callers cannot supply this field. */
|
|
2857
2881
|
source?: ChannelSourceEvidence;
|
|
2858
2882
|
invoke<T>(resource: CRN, op: string, args: unknown): Promise<T>;
|
|
2883
|
+
/**
|
|
2884
|
+
* Whether `signature` is the HMAC of `message` under the Credential bound as `credential`, compared in constant time.
|
|
2885
|
+
* The key never leaves Constal, and no HMAC is computed for the caller. A signature not in `encoding` is not verified.
|
|
2886
|
+
*/
|
|
2887
|
+
verifyHmac(input: HmacVerification): Promise<boolean>;
|
|
2859
2888
|
}
|
|
2860
2889
|
interface AuthProvider {
|
|
2861
2890
|
id: string;
|
|
@@ -4429,4 +4458,4 @@ declare class SessionDeleted extends Error {
|
|
|
4429
4458
|
}
|
|
4430
4459
|
|
|
4431
4460
|
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,
|
|
4461
|
+
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"]);
|