@ablehi/server-execution-contract 0.1.5 → 0.1.6
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/dist/edge.d.ts +1 -1
- package/dist/edge.js +1 -1
- package/dist/index.d.ts +74 -5
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/edge.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CONTEXT_STATE_CLEANUP_ROUTE_PATH, CompleteFlowRunWaitBody, CompleteFlowRunWaitData, ContextStateCleanupRequestBody, ContextStateCleanupResponseData, ContextStateScope, CreateHumanInputRequestBody, DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES, DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES, DEPLOYMENT_HANDSHAKE_ROUTE, DeploymentHandshakeData, DeploymentHandshakeRequestBody, DeploymentHandshakeResponse, EGRESS_GRANT_AUDIT_ROUTE_SUBPATH, EGRESS_GRANT_CONSUME_ROUTE_SUBPATH, EGRESS_GRANT_SCOPE_KINDS, EVENT_WAIT_ROUTE_SUBPATH, EXECUTION_CONTEXT_ROUTE_SUBPATH, EgressGrant, EgressGrantAuditBody, EgressGrantBodyParseResult, EgressGrantConsumeBody, EgressGrantCredentialMaterial, EgressGrantFileRuntime, EgressGrantScopeKind, ExecutionBinding, ExecutionBindingConnection, ExecutionContextCompiled, ExecutionContextData, FILE_ACCESS_ROUTE_SUBPATH, FILE_COMPLETE_ROUTE_SUBPATH, FILE_CONTENT_ROUTE_SUBPATH, FILE_STAT_ROUTE_SUBPATH, FILE_UPLOAD_SESSION_ROUTE_SUBPATH, FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH, FLOW_RUN_EXECUTION_EVENTS_ROUTE_SUBPATH, FLOW_RUN_EXECUTION_EVENT_TYPES, FLOW_RUN_RESULT_ROUTE_SUBPATH, FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, FileMetadataData, FileRefData, FileRuntimeLimits, FileRuntimeScope, FileRuntimeScopeKind, FileUploadSessionData, FlowActionGrantBody, FlowExecutionContextFileRuntime, FlowRunExecutionEventBody, FlowRunExecutionEventData, FlowRunExecutionEventType, FlowRunInputFactBody, FlowRunResultData, FlowRunResultRequestBody, FlowRuntimeCredentialBody, HANDLER_BUNDLES_ROUTE_SUBPATH, HANDSHAKE_CAPABILITY_MISSING, HANDSHAKE_CONTRACT_VERSION_MISMATCH, HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH, HANDSHAKE_REQUEST_INVALID, HANDSHAKE_SECRET_MISMATCH, HANDSHAKE_SECRET_UNCONFIGURED, HUMAN_INPUTS_ROUTE_SUBPATH, HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH, HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH, HUMAN_INPUT_REQUEST_ROUTE_SUBPATH, HUMAN_INPUT_RESOLVED_EVENT_PREFIX, HandlerBundle, HandlerBundleModule, HandlerBundlesData, HandlerBundlesParseResult, HumanInputActor, HumanInputOutput, HumanInputRequestView, HumanInputResolvedEvent, HumanInputResponse, INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX, INTERNAL_FILES_ROUTE_PREFIX, INTERNAL_FLOW_RUNS_ROUTE_PREFIX, INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX, INTERNAL_INSTALLATIONS_ROUTE_PREFIX, INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX, INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX, INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX, InternalFileAccessData, InternalFileAccessIntent, POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH, POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH, PackagePollingTriggerRuntimeDescriptor, PackageWebhookTriggerRuntimeDescriptor, ParsedFlowRunResultBody, PartiallyRenderedHumanInputDelivery, PartiallyRenderedMapping, PartiallyRenderedTemplatePart, PartiallyRenderedValue, PollingPublishBody, PollingPublishEvent, PollingRuntimeCredentialBody, PollingTriggerContext, PollingTriggerDispatchData, PollingTriggerGrantBody, PresignedFileUrlData, PublishPollingTickEventResult, PublishPollingTickEventsData, RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS, RegisterFlowRunWaitBody, RegisterFlowRunWaitData, RenderedFlowComposition, RenderedHumanInputPrompt, RuntimeCredentialSession, RuntimeCredentialSessionNetwork, RuntimeCredentialSessionScopeKind, RuntimeNetwork, RuntimeNetworkModel, SERVER_EXECUTION_CONTRACT_VERSION, STEP_RESULT_ROUTE_SUBPATH, ServerExecutionContractVersion, SingleToolGrantBody, StepRecordBody, StepRecordBodyParseResult, StepRecordData, StepRecordResult, TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH, TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH, TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, ToolHandlerBundlesData, TriggerConnectionInfo, TriggerFileRuntimeDispatch, TriggerHandlerBundlesData, TriggerHandlerModule, WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH, WEBHOOK_PROTOCOL_ADAPTER_MODULE, WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH, WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH, WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH, WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH, WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION, WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION, WebhookDelivery, WebhookDeliveryDispatchData, WebhookProtocolAdapterBundleData, WebhookProtocolAdapterModule, WebhookPublishEvent, WebhookPublishEventsBody, WebhookPublishEventsData, WebhookRearmBody, WebhookRearmData, WebhookRuntimeCredentialBody, WebhookTriggerGrantBody, WebhookTriggerVerificationMethod, WebhookWatcherContext, WfpUserRuntimeManifest, deploymentHandshakeProbePayload, deploymentHandshakeResponseProofPayload, egressGrantAuditPath, egressGrantConsumePath, eventWaitPath, executionContextPath, flowRunEgressGrantPath, flowRunExecutionEventsPath, flowRunResultPath, flowRunRuntimeCredentialPath, flowScriptProtocolAdapterModuleName, handlerBundlesPath, humanInputAcknowledgePath, humanInputExpirePath, humanInputRequestPath, humanInputResolvedEventType, humanInputsPath, internalFileAccessPath, internalFileCompletePath, internalFileContentPath, internalFileStatPath, internalFileUploadSessionPath, internalFilesPath, isValidRequestDigest, parseCompleteFlowRunWaitBody, parseContextStateCleanupRequestBody, parseContextStateCleanupResponseData, parseContextStateScope, parseCreateHumanInputBody, parseEgressGrantAuditBody, parseEgressGrantConsumeBody, parseEgressGrantConsumeData, parseEgressGrantData, parseExecutionContextData, parseFileMetadataData, parseFileRefData, parseFileRuntimeLimits, parseFileUploadSessionData, parseFlowActionGrantBody, parseFlowRunExecutionEventBody, parseFlowRunExecutionEventData, parseFlowRunResultBody, parseFlowRunResultData, parseFlowRuntimeCredentialBody, parseHandlerBundle, parseHandlerBundlesData, parseHumanInputAcknowledgeData, parseHumanInputCreateData, parseHumanInputRequestViewData, parseInternalFileAccessData, parsePollingPublishBody, parsePollingRuntimeCredentialBody, parsePollingTriggerContext, parsePollingTriggerDispatchData, parsePollingTriggerGrantBody, parsePublishPollingTickEventsData, parseRegisterFlowRunWaitBody, parseRegisterFlowRunWaitData, parseRuntimeCredentialSessionCredential, parseRuntimeNetwork, parseSingleToolGrantBody, parseSingleToolRuntimeCredentialBody, parseStepRecordBody, parseStepRecordData, parseToolHandlerBundlesData, parseTriggerFileRuntimeDispatch, parseTriggerHandlerBundlesData, parseWebhookDelivery, parseWebhookDeliveryDispatchData, parseWebhookPublishEventsBody, parseWebhookRearmBody, parseWebhookRuntimeCredentialBody, parseWebhookTriggerGrantBody, parseWebhookWatcherContext, pollingTriggerContextPath, pollingTriggerEgressGrantPath, pollingTriggerHandlerBundlesPath, pollingTriggerRuntimeCredentialPath, pollingTriggerTickEventsPath, requestHasMultipartFileParts, stepResultPath, toolHandlerBundlesPath, toolInvocationEgressGrantPath, toolInvocationRuntimeCredentialPath, webhookProtocolAdapterBundlePath, webhookTriggerContextPath, webhookTriggerDeliveryPath, webhookTriggerEgressGrantPath, webhookTriggerEventsPath, webhookTriggerHandlerBundlesPath, webhookTriggerRearmPath, webhookTriggerRuntimeCredentialPath, wfpUserRuntimeManifestPath } from './index.js';
|
|
1
|
+
export { CONTEXT_STATE_CLEANUP_ROUTE_PATH, CompleteFlowRunWaitBody, CompleteFlowRunWaitData, ContextStateCleanupRequestBody, ContextStateCleanupResponseData, ContextStateScope, CreateHumanInputRequestBody, DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES, DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES, DEPLOYMENT_HANDSHAKE_ROUTE, DISCOVERY_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH, DISCOVERY_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, DeploymentHandshakeData, DeploymentHandshakeRequestBody, DeploymentHandshakeResponse, DiscoveryDispatchBody, DiscoveryEgressGrantBinding, DiscoveryExecutionBinding, DiscoveryGrantBody, DiscoveryInvokeRequest, DiscoveryRuntimeCredentialBinding, EGRESS_GRANT_AUDIT_ROUTE_SUBPATH, EGRESS_GRANT_CONSUME_ROUTE_SUBPATH, EGRESS_GRANT_SCOPE_KINDS, EVENT_WAIT_ROUTE_SUBPATH, EXECUTION_CONTEXT_ROUTE_SUBPATH, EgressGrant, EgressGrantAuditBody, EgressGrantBodyParseResult, EgressGrantConsumeBody, EgressGrantCredentialMaterial, EgressGrantFileRuntime, EgressGrantScopeKind, ExecutionBinding, ExecutionBindingConnection, ExecutionContextCompiled, ExecutionContextData, FILE_ACCESS_ROUTE_SUBPATH, FILE_COMPLETE_ROUTE_SUBPATH, FILE_CONTENT_ROUTE_SUBPATH, FILE_STAT_ROUTE_SUBPATH, FILE_UPLOAD_SESSION_ROUTE_SUBPATH, FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH, FLOW_RUN_EXECUTION_EVENTS_ROUTE_SUBPATH, FLOW_RUN_EXECUTION_EVENT_TYPES, FLOW_RUN_RESULT_ROUTE_SUBPATH, FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, FileMetadataData, FileRefData, FileRuntimeLimits, FileRuntimeScope, FileRuntimeScopeKind, FileUploadSessionData, FlowActionGrantBody, FlowExecutionContextFileRuntime, FlowRunExecutionEventBody, FlowRunExecutionEventData, FlowRunExecutionEventType, FlowRunInputFactBody, FlowRunResultData, FlowRunResultRequestBody, FlowRuntimeCredentialBody, HANDLER_BUNDLES_ROUTE_SUBPATH, HANDSHAKE_CAPABILITY_MISSING, HANDSHAKE_CONTRACT_VERSION_MISMATCH, HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH, HANDSHAKE_REQUEST_INVALID, HANDSHAKE_SECRET_MISMATCH, HANDSHAKE_SECRET_UNCONFIGURED, HUMAN_INPUTS_ROUTE_SUBPATH, HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH, HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH, HUMAN_INPUT_REQUEST_ROUTE_SUBPATH, HUMAN_INPUT_RESOLVED_EVENT_PREFIX, HandlerBundle, HandlerBundleModule, HandlerBundlesData, HandlerBundlesParseResult, HumanInputActor, HumanInputOutput, HumanInputRequestView, HumanInputResolvedEvent, HumanInputResponse, INTERNAL_DISCOVERY_INVOCATIONS_ROUTE_PREFIX, INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX, INTERNAL_FILES_ROUTE_PREFIX, INTERNAL_FLOW_RUNS_ROUTE_PREFIX, INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX, INTERNAL_INSTALLATIONS_ROUTE_PREFIX, INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX, INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX, INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX, IntegrationDiscoverySubject, InternalFileAccessData, InternalFileAccessIntent, POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH, POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH, PackageInputDiscoveryDescriptor, PackageInputDiscoveryKind, PackagePollingTriggerRuntimeDescriptor, PackageWebhookTriggerRuntimeDescriptor, ParsedFlowRunResultBody, PartiallyRenderedHumanInputDelivery, PartiallyRenderedMapping, PartiallyRenderedTemplatePart, PartiallyRenderedValue, PollingPublishBody, PollingPublishEvent, PollingRuntimeCredentialBody, PollingTriggerContext, PollingTriggerDispatchData, PollingTriggerGrantBody, PresignedFileUrlData, PublishPollingTickEventResult, PublishPollingTickEventsData, RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS, RegisterFlowRunWaitBody, RegisterFlowRunWaitData, RenderedFlowComposition, RenderedHumanInputPrompt, RuntimeCredentialSession, RuntimeCredentialSessionNetwork, RuntimeCredentialSessionScopeKind, RuntimeNetwork, RuntimeNetworkModel, SERVER_EXECUTION_CONTRACT_VERSION, STEP_RESULT_ROUTE_SUBPATH, ServerExecutionContractVersion, SingleToolGrantBody, StepRecordBody, StepRecordBodyParseResult, StepRecordData, StepRecordResult, TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH, TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH, TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, ToolHandlerBundlesData, TriggerConnectionInfo, TriggerFileRuntimeDispatch, TriggerHandlerBundlesData, TriggerHandlerModule, WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH, WEBHOOK_PROTOCOL_ADAPTER_MODULE, WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH, WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH, WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH, WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH, WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION, WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION, WebhookDelivery, WebhookDeliveryDispatchData, WebhookProtocolAdapterBundleData, WebhookProtocolAdapterModule, WebhookPublishEvent, WebhookPublishEventsBody, WebhookPublishEventsData, WebhookRearmBody, WebhookRearmData, WebhookRuntimeCredentialBody, WebhookTriggerGrantBody, WebhookTriggerVerificationMethod, WebhookWatcherContext, WfpUserRuntimeManifest, deploymentHandshakeProbePayload, deploymentHandshakeResponseProofPayload, discoveryInvocationEgressGrantPath, discoveryInvocationRuntimeCredentialPath, egressGrantAuditPath, egressGrantConsumePath, eventWaitPath, executionContextPath, flowRunEgressGrantPath, flowRunExecutionEventsPath, flowRunResultPath, flowRunRuntimeCredentialPath, flowScriptProtocolAdapterModuleName, handlerBundlesPath, humanInputAcknowledgePath, humanInputExpirePath, humanInputRequestPath, humanInputResolvedEventType, humanInputsPath, internalFileAccessPath, internalFileCompletePath, internalFileContentPath, internalFileStatPath, internalFileUploadSessionPath, internalFilesPath, isValidRequestDigest, parseCompleteFlowRunWaitBody, parseContextStateCleanupRequestBody, parseContextStateCleanupResponseData, parseContextStateScope, parseCreateHumanInputBody, parseDiscoveryGrantBody, parseDiscoveryRuntimeCredentialBody, parseEgressGrantAuditBody, parseEgressGrantConsumeBody, parseEgressGrantConsumeData, parseEgressGrantData, parseExecutionContextData, parseFileMetadataData, parseFileRefData, parseFileRuntimeLimits, parseFileUploadSessionData, parseFlowActionGrantBody, parseFlowRunExecutionEventBody, parseFlowRunExecutionEventData, parseFlowRunResultBody, parseFlowRunResultData, parseFlowRuntimeCredentialBody, parseHandlerBundle, parseHandlerBundlesData, parseHumanInputAcknowledgeData, parseHumanInputCreateData, parseHumanInputRequestViewData, parseInternalFileAccessData, parsePollingPublishBody, parsePollingRuntimeCredentialBody, parsePollingTriggerContext, parsePollingTriggerDispatchData, parsePollingTriggerGrantBody, parsePublishPollingTickEventsData, parseRegisterFlowRunWaitBody, parseRegisterFlowRunWaitData, parseRuntimeCredentialSessionCredential, parseRuntimeNetwork, parseSingleToolGrantBody, parseSingleToolRuntimeCredentialBody, parseStepRecordBody, parseStepRecordData, parseToolHandlerBundlesData, parseTriggerFileRuntimeDispatch, parseTriggerHandlerBundlesData, parseWebhookDelivery, parseWebhookDeliveryDispatchData, parseWebhookPublishEventsBody, parseWebhookRearmBody, parseWebhookRuntimeCredentialBody, parseWebhookTriggerGrantBody, parseWebhookWatcherContext, pollingTriggerContextPath, pollingTriggerEgressGrantPath, pollingTriggerHandlerBundlesPath, pollingTriggerRuntimeCredentialPath, pollingTriggerTickEventsPath, requestHasMultipartFileParts, stepResultPath, toolHandlerBundlesPath, toolInvocationEgressGrantPath, toolInvocationRuntimeCredentialPath, webhookProtocolAdapterBundlePath, webhookTriggerContextPath, webhookTriggerDeliveryPath, webhookTriggerEgressGrantPath, webhookTriggerEventsPath, webhookTriggerHandlerBundlesPath, webhookTriggerRearmPath, webhookTriggerRuntimeCredentialPath, wfpUserRuntimeManifestPath } from './index.js';
|
|
2
2
|
import '@ablehi/flow-contract';
|
|
3
3
|
import '@ablehi/error-contract';
|
package/dist/edge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ne="0.2.10";function u(e){return{ok:!0,value:e}}function r(e){return{ok:!1,reason:e}}function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ze="/cleanup-state-scopes";function k(e){if(!i(e)||typeof e.kind!="string")return r("context state scope surface shape is invalid");switch(e.kind){case"webhook-trigger":return re(e);case"polling-trigger":return oe(e);case"flow-action":return ie(e);default:return r("context state scope kind is invalid")}}function Qe(e){if(!i(e))return r("cleanup request body must be a JSON object");let t=b(e,["scopes"]);if(t!==void 0)return r(`cleanup request does not accept the "${t}" field`);if(!Array.isArray(e.scopes))return r("cleanup request scopes must be an array");let n=[];for(let o of e.scopes){let s=k(o);if(!s.ok)return s;n.push(s.value)}return u({scopes:n})}function Ze(e){return!i(e)||typeof e.deleted!="number"||!Number.isSafeInteger(e.deleted)||e.deleted<0?r("cleanup response data surface shape is invalid"):u({deleted:e.deleted})}function re(e){let t=b(e,["kind","workspaceId","triggerInstanceId"]);return t!==void 0?r(`webhook trigger scope does not accept "${t}"`):e.kind!=="webhook-trigger"||!R(e.workspaceId)||!R(e.triggerInstanceId)?r("webhook trigger state scope is invalid"):u({kind:"webhook-trigger",workspaceId:e.workspaceId,triggerInstanceId:e.triggerInstanceId})}function oe(e){let t=b(e,["kind","workspaceId","pollingInstanceId"]);return t!==void 0?r(`polling trigger scope does not accept "${t}"`):e.kind!=="polling-trigger"||!R(e.workspaceId)||!R(e.pollingInstanceId)?r("polling trigger state scope is invalid"):u({kind:"polling-trigger",workspaceId:e.workspaceId,pollingInstanceId:e.pollingInstanceId})}function ie(e){let t=b(e,["kind","workspaceId","flowId","nodeId","connectionId"]);if(t!==void 0)return r(`flow action scope does not accept "${t}"`);let n=e.connectionId;return e.kind!=="flow-action"||!R(e.workspaceId)||!R(e.flowId)||!R(e.nodeId)||n!==null&&!R(n)?r("flow action state scope is invalid"):u({kind:"flow-action",workspaceId:e.workspaceId,flowId:e.flowId,nodeId:e.nodeId,connectionId:n})}function R(e){return typeof e=="string"&&e.length>0}function b(e,t){return Object.keys(e).find(n=>!t.includes(n))}var g="/internal/flow-runs",rt="/:flowRunId/execution-context";function ot(e){return`${g}/${encodeURIComponent(e)}/execution-context`}function F(e){return!i(e)||!B(e.fileMaxBytes)||!B(e.fileReadMaxBytes)||!B(e.inlineMultipartBytesMax)?r("file runtime limits must carry three positive integer bounds"):u({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function it(e){if(!i(e))return r("execution context must be a JSON object");let t=e.compiled;if(typeof e.flowRunId!="string"||typeof e.workspaceId!="string"||!i(e.input)||!i(t)||typeof t.irSchemaVersion!="string"||typeof t.interpreterContractVersion!="string"||typeof t.compiledArtifactId!="string"||!i(t.ir)||!Array.isArray(t.ir.nodes)||!ue(e.executionBindings))return r("execution context surface shape is invalid");let n=se(e.fileRuntime);return n.ok?u({...e,fileRuntime:n.value}):r(n.reason)}function se(e){if(e===null)return u(null);if(!i(e))return r("fileRuntime must be null or an object");let t=F(e.limits);return t.ok?u({limits:t.value}):r(t.reason)}function ue(e){return Array.isArray(e)?e.every(t=>{if(!i(t))return!1;let n=t.connection,o=k(t.stateScope);return typeof t.nodeId=="string"&&typeof t.toolRef=="string"&&i(t.toolDescriptor)&&i(t.integrationDescriptor)&&i(n)&&typeof n.installationId=="string"&&typeof n.connectionRef=="string"&&typeof n.connectionId=="string"&&typeof n.authProfileRef=="string"&&typeof n.authType=="string"&&o.ok}):!1}function B(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}import{parseAblehiErrorDigest as H}from"@ablehi/error-contract";var ct="/:flowRunId/steps/:nodeId/result",lt="/:flowRunId/result",pt="/:flowRunId/execution-events",ft="/:flowRunId/event-waits/:nodeId";function gt(e,t){return`${g}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function mt(e){return`${g}/${encodeURIComponent(e)}/result`}function Rt(e){return`${g}/${encodeURIComponent(e)}/execution-events`}function yt(e,t){return`${g}/${encodeURIComponent(e)}/event-waits/${encodeURIComponent(t)}`}function kt(e){if(!i(e))return{ok:!1,kind:"validation",reason:"step record body must be a JSON object"};let t=m(e,["attempt","result","durationMs"]);if(t!==void 0)return{ok:!1,kind:"validation",reason:`step record does not accept the "${t}" field`};let n=e.attempt;if(typeof n!="number"||!Number.isInteger(n)||n<=0)return{ok:!1,kind:"validation",reason:"attempt must be a positive integer"};let o=ae(e.result);if(!o.ok)return o;let s={attempt:n,result:o.value};if(e.durationMs!==void 0){let d=e.durationMs;if(typeof d!="number"||!Number.isFinite(d)||d<0)return{ok:!1,kind:"validation",reason:"durationMs must be a non-negative number"};s.durationMs=d}return{ok:!0,value:s}}function ae(e){if(!i(e))return{ok:!1,kind:"step_result_invalid",reason:"result must be a JSON object"};let t=e.status;if(t==="succeeded"){let n=m(e,["status","output"]);return n!==void 0?{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`}:"output"in e?{ok:!0,value:{status:"succeeded",output:e.output}}:{ok:!1,kind:"step_result_invalid",reason:"a succeeded result must carry output"}}if(t==="failed"){let n=m(e,["status","error"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=H(e.error);return o.ok?{ok:!0,value:{status:"failed",error:o.value}}:{ok:!1,kind:"step_result_invalid",reason:`a failed result must carry an AblehiErrorDigest: ${o.reason}`}}if(t==="skipped"){let n=m(e,["status","reason"]);return n!==void 0?{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`}:e.reason!=="run_if_false"?{ok:!1,kind:"step_result_invalid",reason:'a skipped result reason must be "run_if_false"'}:{ok:!0,value:{status:"skipped",reason:"run_if_false"}}}if(t==="timed_out"){let n=m(e,["status","error"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=H(e.error);return o.ok?{ok:!0,value:{status:"timed_out",error:o.value}}:{ok:!1,kind:"step_result_invalid",reason:`a timed_out result must carry an AblehiErrorDigest: ${o.reason}`}}return{ok:!1,kind:"step_result_invalid",reason:'result status must be "succeeded", "failed", "skipped", or "timed_out"'}}function It(e){return!i(e)||typeof e.flowRunId!="string"||typeof e.nodeId!="string"||!de(e.recorded)?r("step record data surface shape is invalid"):u({flowRunId:e.flowRunId,nodeId:e.nodeId,recorded:e.recorded})}function de(e){return e==="succeeded"||e==="failed"||e==="skipped"||e==="timed_out"}function _t(e){if(!i(e))return r("result body must be a JSON object");let t=m(e,["status","output","error","composition"]);if(t!==void 0)return r(`result does not accept the "${t}" field`);let n=e.status;if(n!=="succeeded"&&n!=="failed")return r('result status must be "succeeded" or "failed"');let o={status:n};if(e.output!==void 0){if(n!=="succeeded")return r("output is only allowed on a succeeded result");o.output=e.output}if(e.error!==void 0){if(n!=="failed")return r("error is only allowed on a failed result");let s=H(e.error);if(!s.ok)return r(`result error must be an AblehiErrorDigest: ${s.reason}`);o.error=s.value}if(n==="failed"&&o.error===void 0)return r("a failed result must carry an AblehiErrorDigest");if(e.composition!==void 0){if(n!=="succeeded")return r("composition is only allowed on a succeeded result");o.composition=e.composition}return u(o)}function ht(e){return i(e)?u(e):r("flow run result data must be a JSON object")}var ce=["flow_run_started","step_started","step_retry_scheduled","wait_registered","wait_event_received","wait_event_timed_out","human_input_created","human_input_submitted","human_input_expired","flow_run_succeeded","flow_run_failed","flow_run_interrupted","flow_run_cancelled"];function wt(e){if(!i(e))return r("execution event data must be a JSON object");let t=m(e,["flowRunId","eventId","accepted"]);return t!==void 0?r(`execution event data does not accept the "${t}" field`):typeof e.flowRunId!="string"||e.flowRunId.length===0?r("flowRunId must be a non-empty string"):typeof e.eventId!="string"||e.eventId.length===0?r("eventId must be a non-empty string"):e.accepted!==!0?r("accepted must be true"):u({flowRunId:e.flowRunId,eventId:e.eventId,accepted:!0})}function Et(e){if(!i(e))return r("execution event body must be a JSON object");let t=m(e,["eventId","eventType","nodeId","stepRunId","attempt","durationMs","occurredAt","errorId","payloadRef","inputFact"]);if(t!==void 0)return r(`execution event does not accept the "${t}" field`);let n=e.eventId;if(typeof n!="string"||n.length===0)return r("eventId must be a non-empty string");let o=e.eventType;if(!le(o))return r("eventType is not a known flow execution event type");let s=e.occurredAt;if(typeof s!="string"||s.length===0)return r("occurredAt must be a non-empty string");let d={eventId:n,eventType:o,occurredAt:s};for(let a of["nodeId","stepRunId","errorId","payloadRef"]){let c=e[a];if(c!==void 0){if(typeof c!="string"||c.length===0)return r(`${a} must be a non-empty string`);d[a]=c}}for(let a of["attempt","durationMs"]){let c=e[a];if(c!==void 0){if(typeof c!="number"||!Number.isFinite(c)||!Number.isInteger(c)||c<0)return r(`${a} must be a non-negative integer`);d[a]=c}}if(e.inputFact!==void 0){if(o!=="step_started")return r("inputFact is only allowed on step_started events");if(d.attempt===void 0)return r("inputFact requires attempt");let a=pe(e.inputFact);if(!a.ok)return a;d.inputFact=a.value}return u(d)}function le(e){return typeof e=="string"&&ce.includes(e)}function pe(e){if(!i(e))return r("inputFact must be a JSON object");let t=m(e,["digestAlgorithm","digest","domain"]);if(t!==void 0)return r(`inputFact does not accept the "${t}" field`);if(e.digestAlgorithm!=="sha256")return r('inputFact.digestAlgorithm must be "sha256"');let n=e.digest;if(typeof n!="string"||!/^[0-9a-f]{64}$/.test(n))return r("inputFact.digest must be a sha256 hex string");let o=e.domain;if(!i(o))return r("inputFact.domain must be a JSON object");let s=m(o,["irSchemaVersion","interpreterContractVersion","compiledArtifactId","nodeId","algorithmVersion"]);return s!==void 0?r(`inputFact.domain does not accept the "${s}" field`):typeof o.irSchemaVersion!="string"||o.irSchemaVersion.length===0||typeof o.interpreterContractVersion!="string"||o.interpreterContractVersion.length===0||typeof o.compiledArtifactId!="string"||o.compiledArtifactId.length===0||typeof o.nodeId!="string"||o.nodeId.length===0?r("inputFact.domain string fields must be non-empty strings"):o.algorithmVersion!=="flow_input_digest.v1"?r('inputFact.domain.algorithmVersion must be "flow_input_digest.v1"'):u({digestAlgorithm:"sha256",digest:n,domain:{irSchemaVersion:o.irSchemaVersion,interpreterContractVersion:o.interpreterContractVersion,compiledArtifactId:o.compiledArtifactId,nodeId:o.nodeId,algorithmVersion:"flow_input_digest.v1"}})}var fe=/^[A-Za-z0-9_-]{1,100}$/;function xt(e){if(!i(e))return r("register body must be a JSON object");let t=m(e,["eventType","correlationKey"]);if(t!==void 0)return r(`register wait does not accept the "${t}" field`);let n=V(e.eventType);if(!n.ok)return r(n.reason);let o=e.correlationKey;return typeof o!="string"||o.length===0?r("correlationKey must be a non-empty string"):u({eventType:n.value,correlationKey:o})}function Tt(e){if(!i(e))return r("complete body must be a JSON object");let t=m(e,["eventType","correlationKey","outcome","eventId"]);if(t!==void 0)return r(`complete wait does not accept the "${t}" field`);let n=e.outcome;if(n!=="received"&&n!=="timed_out")return r('outcome must be "received" or "timed_out"');let o=V(e.eventType);if(!o.ok)return r(o.reason);let s=e.correlationKey;if(typeof s!="string"||s.length===0)return r("correlationKey must be a non-empty string");let d={eventType:o.value,correlationKey:s,outcome:n};if(e.eventId!==void 0){if(typeof e.eventId!="string"||e.eventId.length===0)return r("eventId must be a non-empty string");d.eventId=e.eventId}return u(d)}function Pt(e){return!i(e)||e.registered!==!0?r("register wait data surface shape is invalid"):u({registered:!0})}function V(e){return typeof e!="string"||e.length===0?r("eventType must be a non-empty string"):fe.test(e)?u(e):r("eventType must match ^[A-Za-z0-9_-]{1,100}$")}function m(e,t){return Object.keys(e).find(n=>!t.includes(n))}var ge="/internal/flow-versions",vt="/:flowVersionId/handler-bundles",M="/internal/installations",bt="/:installationId/handler-bundles";function Ct(e,t){return`${ge}/${encodeURIComponent(e)}/handler-bundles?compiledArtifactId=${encodeURIComponent(t)}`}function At(e){return`${M}/${encodeURIComponent(e.installationId)}/handler-bundles?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var me=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function C(e){if(!_(e))return $("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!me.has(t)?$("runtimeNetwork.networkModel is unknown"):!j(e.apiHosts)||!j(e.authHosts)||typeof e.httpsOnly!="boolean"?$("runtimeNetwork host/https fields are invalid"):{ok:!0,value:{networkModel:t,apiHosts:e.apiHosts,authHosts:e.authHosts,httpsOnly:e.httpsOnly}}}function Nt(e){if(!_(e)||typeof e.flowVersionId!="string"||typeof e.compiledArtifactId!="string"||!Array.isArray(e.bundles))return E("handler bundles data surface shape is invalid");let t=J(e.bundles);return t.ok?{ok:!0,value:{flowVersionId:e.flowVersionId,compiledArtifactId:e.compiledArtifactId,bundles:t.value}}:t}function Dt(e){if(!_(e)||typeof e.installationId!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.bundles))return E("tool handler bundles data surface shape is invalid");let t=J(e.bundles);return t.ok?{ok:!0,value:{installationId:e.installationId,artifactDigest:e.artifactDigest,bundles:t.value}}:t}function J(e){let t=[];for(let n of e){let o=Re(n);if(!o.ok)return o;t.push(o.value)}return{ok:!0,value:t}}function Re(e){if(!_(e)||typeof e.toolRef!="string"||e.kind!=="handler"&&e.kind!=="request")return E("handler bundle entry shape is invalid");if(e.kind==="request"){if(e.module!==void 0)return E("a request bundle must not carry a module");let o=C(e.runtimeNetwork);return o.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"request",runtimeNetwork:o.value}}:o}let t=e.module;if(!_(t)||typeof t.entry!="string"||t.entry.length===0||!ye(t.files))return E("a handler bundle must carry a { entry, files } module");let n=C(e.runtimeNetwork);return n.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"handler",module:{entry:t.entry,files:t.files},runtimeNetwork:n.value}}:n}function E(e){return{ok:!1,kind:"shape",reason:e}}function $(e){return{ok:!1,kind:"runtime_network",reason:e}}function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function j(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ye(e){return _(e)&&Object.values(e).every(t=>typeof t=="string")}var x="/internal/webhook-trigger-instances",Mt="/:triggerInstanceId/context",Gt="/:triggerInstanceId/handler-bundles",Kt="/:triggerInstanceId/deliveries/:deliveryId",Lt="/:triggerInstanceId/events",qt="/:triggerInstanceId/rearm",T=e=>`${x}/${encodeURIComponent(e)}`;function Wt(e,t){return`${T(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function Vt(e,t){return`${T(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function jt(e,t){return`${T(e)}/deliveries/${encodeURIComponent(t)}`}function Jt(e){return`${T(e)}/events`}function Xt(e){return`${T(e)}/rearm`}var Yt="/:installationId/webhook-protocol-adapter-bundle";function zt(e){return`${M}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var Qt="modules/webhook/protocol-adapter.js";function Zt(e){return`modules/webhook/protocol-adapter-${e}.js`}function en(e){let t=i(e)?k(e.stateScope):r("webhook watcher context state scope is invalid");return!i(e)||typeof e.artifactDigest!="string"||typeof e.triggerRef!="string"||typeof e.triggerName!="string"||typeof e.integrationRef!="string"||!i(e.inputs)||e.connection!==null&&!ke(e.connection)||!Ie(e.runtime)||!t.ok||t.value.kind!=="webhook-trigger"?r("webhook watcher context surface shape is invalid"):u(e)}function ke(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authProfileRef=="string"&&typeof e.authType=="string"}function Ie(e){if(!i(e)||e.type!=="webhook"||typeof e.trigger_ref!="string")return!1;let t=e.webhook;return i(t)&&typeof t.event_handler_module=="string"&&typeof t.enable_handler_module=="string"&&typeof t.disable_handler_module=="string"}function _e(e){if(!i(e)||typeof e.deliveryId!="string"||typeof e.receivedAt!="string"||!i(e.request))return r("webhook delivery surface shape is invalid");let t=e.request;return t.method!=="POST"||!i(t.headers)||typeof t.rawBody!="string"?r("webhook delivery request shape is invalid"):u(e)}function G(e){if(!i(e)||typeof e.token!="string"||typeof e.expiresAt!="string")return r("trigger file runtime dispatch shape is invalid");let t=F(e.limits);return t.ok?u({token:e.token,expiresAt:e.expiresAt,limits:t.value}):r(t.reason)}function tn(e){if(!i(e))return r("webhook delivery dispatch data is invalid");let t=_e(e.delivery);if(!t.ok)return r(t.reason);let n=e.fileRuntime;if(n===null)return u({delivery:t.value,fileRuntime:null});let o=G(n);return o.ok?u({delivery:t.value,fileRuntime:o.value}):r(o.reason)}function nn(e){if(!i(e)||typeof e.triggerRef!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.modules)||!e.modules.every(he))return{ok:!1,kind:"shape",reason:"trigger handler bundles data surface shape is invalid"};let t=C(e.runtimeNetwork);return t.ok?{ok:!0,value:{triggerRef:e.triggerRef,artifactDigest:e.artifactDigest,modules:e.modules,runtimeNetwork:t.value}}:t}function he(e){return i(e)&&typeof e.specifier=="string"&&e.specifier.length>0&&typeof e.source=="string"}function rn(e){if(!i(e))return r("publish events body must be a JSON object");let t=K(e,["deliveryId","events"]);if(t!==void 0)return r(`publish events does not accept the "${t}" field`);let n=e.deliveryId;if(typeof n!="string"||n.length===0)return r("deliveryId must be a non-empty string");let o=e.events;if(!Array.isArray(o))return r("events must be an array");let s=[];for(let d of o){let a=we(d);if(!a.ok)return a;s.push(a.value)}return u({deliveryId:n,events:s})}function we(e){if(!i(e))return r("each event must be a JSON object");let t=K(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return r(`event does not accept the "${t}" field`);let n=e.eventId;if(typeof n!="string"||n.length===0)return r("eventId must be a non-empty string");let o=e.occurredAt;if(typeof o!="string"||o.length===0)return r("occurredAt must be a non-empty string");if(!i(e.payload))return r("event payload must be a JSON object");let s={eventId:n,occurredAt:o,payload:e.payload};if(e.dedupeKey!==void 0){if(typeof e.dedupeKey!="string"||e.dedupeKey.length===0)return r("dedupeKey must be a non-empty string");s.dedupeKey=e.dedupeKey}return u(s)}function on(e){if(!i(e))return r("rearm body must be a JSON object");let t=K(e,["expectedWatcherInstanceId"]);if(t!==void 0)return r(`rearm does not accept the "${t}" field`);let n=e.expectedWatcherInstanceId;return typeof n!="string"||n.length===0?r("expectedWatcherInstanceId must be a non-empty string"):u({expectedWatcherInstanceId:n})}function K(e,t){return Object.keys(e).find(n=>!t.includes(n))}var P="/internal/polling-trigger-instances",cn="/:pollingInstanceId/context",ln="/:pollingInstanceId/handler-bundles",pn="/:pollingInstanceId/ticks/:tickId/events",L=e=>`${P}/${encodeURIComponent(e)}`;function fn(e,t,n){return`${L(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function gn(e,t){return`${L(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function mn(e,t){return`${L(e)}/ticks/${encodeURIComponent(t)}/events`}function Ee(e){let t=i(e)?k(e.stateScope):r("polling trigger context state scope is invalid");return!i(e)||typeof e.artifactDigest!="string"||typeof e.triggerRef!="string"||typeof e.triggerName!="string"||typeof e.integrationRef!="string"||!i(e.inputs)||e.connection!==null&&!xe(e.connection)||!Te(e.runtime)||!t.ok||t.value.kind!=="polling-trigger"||!Pe(e.tick)||!Se(e.limits)?r("polling trigger context surface shape is invalid"):u(e)}function Rn(e){if(!i(e))return r("polling trigger dispatch data is invalid");let t=Ee(e.context);if(!t.ok)return r(t.reason);let n=e.fileRuntime;if(n===null)return u({context:t.value,fileRuntime:null});let o=G(n);return o.ok?u({context:t.value,fileRuntime:o.value}):r(o.reason)}function xe(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authProfileRef=="string"&&typeof e.authType=="string"}function Te(e){if(!i(e)||e.type!=="polling"||typeof e.trigger_id!="string"||typeof e.trigger_ref!="string")return!1;let t=e.polling;if(!i(t)||typeof t.run_handler_module!="string")return!1;let n=t.schedule;if(!i(n)||n.type!=="interval"||typeof n.every_seconds!="number")return!1;let o=t.dedup;return i(o)&&(o.strategy==="cursor"||o.strategy==="hash"||o.strategy==="id_field")}function Pe(e){return i(e)&&typeof e.tickId=="string"&&typeof e.scheduledAt=="string"&&typeof e.attempt=="number"}function Se(e){return i(e)&&typeof e.maxEventsPerTick=="number"}function yn(e){if(!i(e))return r("publish body must be a JSON object");let t=X(e,["events","nextCursor"]);if(t!==void 0)return r(`publish does not accept the "${t}" field`);let n=e.events;if(!Array.isArray(n))return r("events must be an array");let o=[];for(let d of n){let a=ve(d);if(!a.ok)return a;o.push(a.value)}let s={events:o};if("nextCursor"in e){let d=e.nextCursor;if(d!==null&&typeof d!="string")return r("nextCursor must be a string, null, or omitted");s.nextCursor=d}return u(s)}function ve(e){if(!i(e))return r("each event must be a JSON object");let t=X(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return r(`event does not accept the "${t}" field`);if(typeof e.eventId!="string"||e.eventId.length===0)return r("event eventId must be a non-empty string");if(!i(e.payload))return r("event payload must be a JSON object");let n={eventId:e.eventId,payload:e.payload};if(e.occurredAt!==void 0){if(typeof e.occurredAt!="string"||e.occurredAt.length===0)return r("event occurredAt must be a non-empty string");n.occurredAt=e.occurredAt}if(e.dedupeKey!==void 0){if(typeof e.dedupeKey!="string"||e.dedupeKey.length===0)return r("event dedupeKey must be a non-empty string");n.dedupeKey=e.dedupeKey}return u(n)}function kn(e){return!i(e)||typeof e.tickId!="string"||typeof e.cursorUpdated!="boolean"||!Array.isArray(e.results)||!e.results.every(be)?r("publish polling tick events data surface shape is invalid"):u(e)}function be(e){return i(e)&&typeof e.eventId=="string"&&typeof e.dedupeKey=="string"&&typeof e.duplicate=="boolean"&&(e.flowRunId===null||typeof e.flowRunId=="string")}function X(e,t){return Object.keys(e).find(n=>!t.includes(n))}var Y="/internal/egress-grants",q="/internal/tool-invocations",xn="/:flowRunId/egress-grant",Tn="/:invocationId/egress-grant",Pn="/:pollingInstanceId/egress-grant",Sn="/:triggerInstanceId/egress-grant",vn="/:grantId/consume",bn="/:grantId/audit",Cn=e=>`${g}/${encodeURIComponent(e)}/egress-grant`,An=e=>`${q}/${encodeURIComponent(e)}/egress-grant`,Nn=e=>`${P}/${encodeURIComponent(e)}/egress-grant`,Dn=e=>`${x}/${encodeURIComponent(e)}/egress-grant`,On=e=>`${Y}/${encodeURIComponent(e)}/consume`,Un=e=>`${Y}/${encodeURIComponent(e)}/audit`,Ce=["flow_action","single_tool","polling_trigger","webhook_trigger"],Ae=/^[A-Za-z0-9][A-Za-z0-9:_+/=.-]{15,1023}$/;function S(e){return typeof e=="string"&&Ae.test(e)}function Ne(e){if(!i(e)||e.body_type!=="multipart")return!1;let t=e.body;if(!i(t))return!1;let n=t.parts;return Array.isArray(n)?n.some(o=>i(o)?o.kind==="file"&&typeof o.file_id=="string"&&o.file_id.length>0:!1):!1}function l(e){return{ok:!1,kind:"shape",reason:e}}function v(){return{ok:!1,kind:"request_digest",reason:"request digest is missing or malformed"}}function N(e,t){if(!i(e))return{ok:!1,reason:"grant request body must be a JSON object"};for(let n of Object.keys(e))if(!t.includes(n))return{ok:!1,reason:`grant request does not accept the "${n}" field`};return{ok:!0,record:e}}function D(e){if(!i(e))return"request must be a JSON object"}function Bn(e){let t=N(e,["nodeId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.nodeId;if(typeof n!="string"||n.length===0)return l("nodeId is required");let o=D(t.record.request);if(o!==void 0)return l(o);let s=t.record.requestDigest;return S(s)?{ok:!0,value:{nodeId:n,requestDigest:s,requestHasMultipartFiles:Ne(t.record.request)}}:v()}function Fn(e){let t=N(e,["request","requestDigest"]);if(!t.ok)return l(t.reason);let n=D(t.record.request);if(n!==void 0)return l(n);let o=t.record.requestDigest;return S(o)?{ok:!0,value:{requestDigest:o}}:v()}function Hn(e){let t=N(e,["tickId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.tickId;if(typeof n!="string"||n.length===0)return l("tickId is required");let o=D(t.record.request);if(o!==void 0)return l(o);let s=t.record.requestDigest;return S(s)?{ok:!0,value:{tickId:n,requestDigest:s}}:v()}function $n(e){let t=N(e,["phase","lifecycle","deliveryId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.phase;if(n!=="lifecycle"&&n!=="handler")return l('phase must be "lifecycle" or "handler"');let o=t.record.lifecycle,s;if(o!==void 0){if(o!=="enable"&&o!=="disable"&&o!=="renew")return l('lifecycle must be "enable", "disable", or "renew"');s=o}if(n==="lifecycle"&&s===void 0)return l("lifecycle is required for the lifecycle phase");let d=t.record.deliveryId,a;if(d!==void 0){if(typeof d!="string"||d.length===0)return l("deliveryId must be a non-empty string");a=d}if(n==="handler"&&a===void 0)return l("deliveryId is required for the handler phase");let c=D(t.record.request);if(c!==void 0)return l(c);let I=t.record.requestDigest;return S(I)?{ok:!0,value:{phase:n,...s!==void 0?{lifecycle:s}:{},...a!==void 0?{deliveryId:a}:{},requestDigest:I}}:v()}function z(e){return Ce.includes(e)?e:void 0}var De=["scopeKind","scopeId","requestDigest"];function Mn(e){if(!i(e))return l("consume body must be a JSON object");for(let s of Object.keys(e))if(!De.includes(s))return l(`consume does not accept the "${s}" field`);let t=z(e.scopeKind);if(t===void 0)return l("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return l("scopeId is required");let o=e.requestDigest;return S(o)?{ok:!0,value:{scopeKind:t,scopeId:n,requestDigest:o}}:v()}var Oe=["scopeKind","scopeId","providerHost","status","durationMs","requestBytes","responseBytes","errorCode"];function A(e,t){return typeof e!="number"||!Number.isInteger(e)||e<0?{ok:!1,reason:`${t} must be a non-negative integer`}:{ok:!0,value:e}}function Gn(e){if(!i(e))return l("audit body must be a JSON object");for(let p of Object.keys(e))if(!Oe.includes(p))return l(`audit does not accept the "${p}" field`);let t=z(e.scopeKind);if(t===void 0)return l("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return l("scopeId is required");let o=e.providerHost;if(typeof o!="string"||o.length===0)return l("providerHost is required");let s=A(e.durationMs,"durationMs");if(!s.ok)return l(s.reason);let d;if(e.status!==void 0){let p=A(e.status,"status");if(!p.ok)return l(p.reason);d=p.value}let a;if(e.requestBytes!==void 0){let p=A(e.requestBytes,"requestBytes");if(!p.ok)return l(p.reason);a=p.value}let c;if(e.responseBytes!==void 0){let p=A(e.responseBytes,"responseBytes");if(!p.ok)return l(p.reason);c=p.value}let I;if(e.errorCode!==void 0){let p=e.errorCode;if(typeof p!="string"||p.length===0)return l("errorCode must be a non-empty string");I=p}return{ok:!0,value:{scopeKind:t,scopeId:n,providerHost:o,...d!==void 0?{status:d}:{},durationMs:s.value,...a!==void 0?{requestBytes:a}:{},...c!==void 0?{responseBytes:c}:{},...I!==void 0?{errorCode:I}:{}}}}function Kn(e){return!i(e)||!i(e.grant)?r("egress grant envelope must carry a grant object"):u(e.grant)}function Ln(e){return!i(e)||e.consumed!==!0?r("egress grant consume data must carry consumed:true"):u({consumed:!0})}var Yn="/:flowRunId/runtime-credential",zn="/:invocationId/runtime-credential",Qn="/:pollingInstanceId/runtime-credential",Zn="/:triggerInstanceId/runtime-credential",er=e=>`${g}/${encodeURIComponent(e)}/runtime-credential`,tr=e=>`${q}/${encodeURIComponent(e)}/runtime-credential`,nr=e=>`${P}/${encodeURIComponent(e)}/runtime-credential`,rr=e=>`${x}/${encodeURIComponent(e)}/runtime-credential`,or=["flow_action","tool_invoke","polling_trigger","webhook_trigger"];function O(e,t){if(!i(e))return{ok:!1,reason:"runtime credential request body must be a JSON object"};for(let n of Object.keys(e))if(!t.includes(n))return{ok:!1,reason:`runtime credential request does not accept the "${n}" field`};return{ok:!0,record:e}}function ir(e){let t=O(e,["nodeId"]);if(!t.ok)return r(t.reason);let n=t.record.nodeId;return typeof n!="string"||n.length===0?r("nodeId is required"):u({nodeId:n})}function sr(e){let t=O(e??{},[]);return t.ok?u(null):r(t.reason)}function ur(e){let t=O(e,["tickId"]);if(!t.ok)return r(t.reason);let n=t.record.tickId;return typeof n!="string"||n.length===0?r("tickId is required"):u({tickId:n})}function ar(e){let t=O(e,["executionKind","deliveryId","lifecycleOperation"]);if(!t.ok)return r(t.reason);let n=t.record.executionKind;if(n!=="event_handler"&&n!=="lifecycle")return r('executionKind must be "event_handler" or "lifecycle"');let o,s=t.record.deliveryId;if(s!==void 0){if(typeof s!="string"||s.length===0)return r("deliveryId must be a non-empty string");o=s}let d,a=t.record.lifecycleOperation;if(a!==void 0){if(a!=="enable"&&a!=="disable"&&a!=="renew")return r('lifecycleOperation must be "enable", "disable", or "renew"');d=a}return n==="lifecycle"&&d===void 0?r("lifecycleOperation is required for the lifecycle execution kind"):u({executionKind:n,...o!==void 0?{deliveryId:o}:{},...d!==void 0?{lifecycleOperation:d}:{}})}function dr(e){return!i(e)||typeof e.sessionId!="string"||typeof e.connectionId!="string"||typeof e.authProfileRef!="string"||typeof e.authType!="string"||!i(e.credential)?r("runtime credential session must carry sessionId, connectionId, auth profile facts and a credential object"):u(e.credential)}function U(e){return!i(e)||typeof e.file_id!="string"||typeof e.name!="string"||typeof e.size_bytes!="number"||typeof e.created_at!="string"||typeof e.expires_at!="string"||e.mime_type!==void 0&&typeof e.mime_type!="string"||e.sha256!==void 0&&typeof e.sha256!="string"||e.source!==void 0&&typeof e.source!="string"?r("file ref data does not match the AIS file-ref shape"):u(e)}function W(e){return!i(e)||e.method!=="GET"&&e.method!=="PUT"||typeof e.url!="string"||typeof e.expires_at!="string"||!Fe(e.headers)?r("presigned file URL data is invalid"):u(e)}function Ue(e){if(!i(e))return r("file upload session data is invalid");let t=U(e.file);if(!t.ok)return r(t.reason);let n=W(e.upload);return n.ok?u({file:t.value,upload:n.value}):r(n.reason)}function Be(e){if(!i(e))return r("file metadata data is invalid");let t=U(e.file);return t.ok?u({file:t.value}):r(t.reason)}function Fe(e){return i(e)?Object.values(e).every(t=>typeof t=="string"):!1}var h="/internal/files",mr="/upload-session",Rr="/:fileId/complete",yr="/:fileId/access",kr="/:fileId/stat",Ir="/:fileId/content",_r=()=>h,hr=()=>`${h}/upload-session`,wr=e=>`${h}/${encodeURIComponent(e)}/complete`,Er=(e,t)=>`${h}/${encodeURIComponent(e)}/access?intent=${encodeURIComponent(t)}`,Q=e=>`?scope_kind=${encodeURIComponent(e.scopeKind)}&scope_id=${encodeURIComponent(e.scopeId)}`,xr=(e,t)=>`${h}/${encodeURIComponent(e)}/stat${Q(t)}`,Tr=(e,t)=>`${h}/${encodeURIComponent(e)}/content${Q(t)}`;function Pr(e){if(!i(e))return r("internal file access data is invalid");if(e.intent==="runtime_read"||e.intent==="provider_multipart"){let t=U(e.file);if(!t.ok)return r(t.reason);let n=W(e.access);return n.ok?u({file:t.value,access:n.value,intent:e.intent}):r(n.reason)}return r("internal file access intent is invalid")}var Cr="/:flowRunId/human-inputs",Ar="/:flowRunId/human-inputs/:requestId",Nr="/:flowRunId/human-inputs/:requestId/expire",Dr="/:flowRunId/human-inputs/:requestId/acknowledge",He=e=>`${g}/${encodeURIComponent(e)}/human-inputs`,Z=(e,t)=>`${He(e)}/${encodeURIComponent(t)}`,Or=(e,t)=>`${Z(e,t)}/expire`,Ur=(e,t)=>`${Z(e,t)}/acknowledge`,$e="human_input_resolved";function Br(e){return`${$e}_${e}`}function f(e){return{ok:!1,reason:e}}function y(e,t){return i(e)?{ok:!0,value:e}:f(`${t} must be an object`)}function w(e,t){return typeof e!="string"||e.length===0?f(`${t} must be a non-empty string`):{ok:!0,value:e}}var Me=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function Ge(e,t){return typeof e!="string"||!Me.test(e)||Number.isNaN(Date.parse(e))?f(`${t} must be an ISO-8601 timestamp`):{ok:!0,value:e}}function Ke(e){let t=y(e,"renderedPrompt");if(!t.ok)return t;let n=w(t.value.title,"renderedPrompt.title");if(!n.ok)return n;let o={title:n.value};if(t.value.body!==void 0){if(typeof t.value.body!="string")return f("renderedPrompt.body must be a string");o.body=t.value.body}if(t.value.format!==void 0){if(t.value.format!=="plain"&&t.value.format!=="markdown")return f("renderedPrompt.format is invalid");o.format=t.value.format}return{ok:!0,value:o}}function Le(e){let t=y(e,"input");if(!t.ok)return t;let n=t.value.kind;if(n==="choice"){if(!Array.isArray(t.value.choices))return f("input.choices must be an array")}else if(n!=="text")if(n==="form"){if(!Array.isArray(t.value.fields))return f("input.fields must be an array")}else return f("input.kind is invalid");return{ok:!0,value:t.value}}function qe(e){if(e==null)return{ok:!0,value:void 0};let t=y(e,"partiallyRenderedDelivery");if(!t.ok)return t;let n=t.value.actions;if(n===void 0)return{ok:!0,value:{}};if(!Array.isArray(n))return f("partiallyRenderedDelivery.actions must be an array");let o=[];for(let s of n){let d=y(s,"delivery action");if(!d.ok)return d;let a=w(d.value.id,"delivery action id");if(!a.ok)return a;let c=ee(d.value.inputs,`delivery action '${a.value}' inputs`);if(!c.ok)return c;o.push({id:a.value,inputs:c.value})}return{ok:!0,value:{actions:o}}}function ee(e,t){let n=y(e,t);if(!n.ok)return n;let o={};for(let[s,d]of Object.entries(n.value)){let a=te(d,`${t}.${s}`);if(!a.ok)return a;o[s]=a.value}return{ok:!0,value:o}}function te(e,t){let n=y(e,t);if(!n.ok)return n;switch(n.value.kind){case"literal":return{ok:!0,value:{kind:"literal",value:n.value.value}};case"human_input_ref":{let s=w(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}case"array":{if(!Array.isArray(n.value.items))return f(`${t}.items must be an array`);let s=[];for(let[d,a]of n.value.items.entries()){let c=te(a,`${t}[${d}]`);if(!c.ok)return c;s.push(c.value)}return{ok:!0,value:{kind:"array",items:s}}}case"object":{let s=ee(n.value.entries,`${t}.entries`);return s.ok?{ok:!0,value:{kind:"object",entries:s.value}}:s}case"template":{if(!Array.isArray(n.value.parts))return f(`${t}.parts must be an array`);let s=[];for(let[d,a]of n.value.parts.entries()){let c=We(a,`${t}.parts[${d}]`);if(!c.ok)return c;s.push(c.value)}return{ok:!0,value:{kind:"template",parts:s}}}default:return f(`${t}.kind is invalid`)}}function We(e,t){let n=y(e,t);if(!n.ok)return n;let o=n.value.kind;if(o==="literal")return typeof n.value.value!="string"?f(`${t}.value must be a string`):{ok:!0,value:{kind:"literal",value:n.value.value}};if(o==="human_input_ref"){let s=w(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}return f(`${t}.kind is invalid`)}function Fr(e){let t=y(e,"request body");if(!t.ok)return r(t.reason);let n=w(t.value.nodeId,"nodeId");if(!n.ok)return r(n.reason);let o=Ke(t.value.renderedPrompt);if(!o.ok)return r(o.reason);let s=Le(t.value.input);if(!s.ok)return r(s.reason);let d=w(t.value.timeout,"timeout");if(!d.ok)return r(d.reason);let a=Ge(t.value.expiresAt,"expiresAt");if(!a.ok)return r(a.reason);let c=qe(t.value.partiallyRenderedDelivery);return c.ok?u({nodeId:n.value,renderedPrompt:o.value,input:s.value,timeout:d.value,expiresAt:a.value,...c.value!==void 0?{partiallyRenderedDelivery:c.value}:{}}):r(c.reason)}function Ve(e){return!i(e)||typeof e.id!="string"||e.id.length===0||typeof e.nodeId!="string"||typeof e.status!="string"||!(e.output===null||i(e.output))?r("human input request view must carry id, nodeId, status and output"):u(e)}function Hr(e){if(!i(e)||typeof e.created!="boolean")return r("human input create data must carry created:boolean");let t=Ve(e.request);return t.ok?u({created:e.created,request:t.value}):t}function $r(e){return!i(e)||e.acknowledged!==!0?r("human input acknowledge data must carry acknowledged:true"):u({acknowledged:!0})}var Gr="ablehi-wfp-user-runtime-manifest/v1",Kr="unknown";function Lr(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var Wr="/internal/deployment-handshake",je=["start","terminate","send-event","start-webhook-watcher","run-polling-tick","invoke-tool","invoke-trigger-handler","invoke-webhook-protocol-adapter","deployment-handshake"],Vr=je,jr="HANDSHAKE_REQUEST_INVALID",Jr="HANDSHAKE_SECRET_UNCONFIGURED",Xr="HANDSHAKE_SECRET_MISMATCH",Yr="HANDSHAKE_CONTRACT_VERSION_MISMATCH",zr="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",Qr="HANDSHAKE_CAPABILITY_MISSING";function Zr(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function eo(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}export{ze as CONTEXT_STATE_CLEANUP_ROUTE_PATH,je as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,Vr as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,Wr as DEPLOYMENT_HANDSHAKE_ROUTE,bn as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,vn as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,Ce as EGRESS_GRANT_SCOPE_KINDS,ft as EVENT_WAIT_ROUTE_SUBPATH,rt as EXECUTION_CONTEXT_ROUTE_SUBPATH,yr as FILE_ACCESS_ROUTE_SUBPATH,Rr as FILE_COMPLETE_ROUTE_SUBPATH,Ir as FILE_CONTENT_ROUTE_SUBPATH,kr as FILE_STAT_ROUTE_SUBPATH,mr as FILE_UPLOAD_SESSION_ROUTE_SUBPATH,xn as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,pt as FLOW_RUN_EXECUTION_EVENTS_ROUTE_SUBPATH,ce as FLOW_RUN_EXECUTION_EVENT_TYPES,lt as FLOW_RUN_RESULT_ROUTE_SUBPATH,Yn as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,vt as HANDLER_BUNDLES_ROUTE_SUBPATH,Qr as HANDSHAKE_CAPABILITY_MISSING,Yr as HANDSHAKE_CONTRACT_VERSION_MISMATCH,zr as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,jr as HANDSHAKE_REQUEST_INVALID,Xr as HANDSHAKE_SECRET_MISMATCH,Jr as HANDSHAKE_SECRET_UNCONFIGURED,Cr as HUMAN_INPUTS_ROUTE_SUBPATH,Dr as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,Nr as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,Ar as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,$e as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,Y as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX,h as INTERNAL_FILES_ROUTE_PREFIX,g as INTERNAL_FLOW_RUNS_ROUTE_PREFIX,ge as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX,M as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,P as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,q as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,x as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,cn as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,Pn as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,ln as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,Qn as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,pn as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,or as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,ne as SERVER_EXECUTION_CONTRACT_VERSION,ct as STEP_RESULT_ROUTE_SUBPATH,bt as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,Tn as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,zn as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Yt as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,Qt as WEBHOOK_PROTOCOL_ADAPTER_MODULE,Mt as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,Kt as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,Sn as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,Lt as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,Gt as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,qt as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,Zn as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Gr as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,Kr as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,Zr as deploymentHandshakeProbePayload,eo as deploymentHandshakeResponseProofPayload,Un as egressGrantAuditPath,On as egressGrantConsumePath,yt as eventWaitPath,ot as executionContextPath,Cn as flowRunEgressGrantPath,Rt as flowRunExecutionEventsPath,mt as flowRunResultPath,er as flowRunRuntimeCredentialPath,Zt as flowScriptProtocolAdapterModuleName,Ct as handlerBundlesPath,Ur as humanInputAcknowledgePath,Or as humanInputExpirePath,Z as humanInputRequestPath,Br as humanInputResolvedEventType,He as humanInputsPath,Er as internalFileAccessPath,wr as internalFileCompletePath,Tr as internalFileContentPath,xr as internalFileStatPath,hr as internalFileUploadSessionPath,_r as internalFilesPath,S as isValidRequestDigest,Tt as parseCompleteFlowRunWaitBody,Qe as parseContextStateCleanupRequestBody,Ze as parseContextStateCleanupResponseData,k as parseContextStateScope,Fr as parseCreateHumanInputBody,Gn as parseEgressGrantAuditBody,Mn as parseEgressGrantConsumeBody,Ln as parseEgressGrantConsumeData,Kn as parseEgressGrantData,it as parseExecutionContextData,Be as parseFileMetadataData,U as parseFileRefData,F as parseFileRuntimeLimits,Ue as parseFileUploadSessionData,Bn as parseFlowActionGrantBody,Et as parseFlowRunExecutionEventBody,wt as parseFlowRunExecutionEventData,_t as parseFlowRunResultBody,ht as parseFlowRunResultData,ir as parseFlowRuntimeCredentialBody,Re as parseHandlerBundle,Nt as parseHandlerBundlesData,$r as parseHumanInputAcknowledgeData,Hr as parseHumanInputCreateData,Ve as parseHumanInputRequestViewData,Pr as parseInternalFileAccessData,yn as parsePollingPublishBody,ur as parsePollingRuntimeCredentialBody,Ee as parsePollingTriggerContext,Rn as parsePollingTriggerDispatchData,Hn as parsePollingTriggerGrantBody,kn as parsePublishPollingTickEventsData,xt as parseRegisterFlowRunWaitBody,Pt as parseRegisterFlowRunWaitData,dr as parseRuntimeCredentialSessionCredential,C as parseRuntimeNetwork,Fn as parseSingleToolGrantBody,sr as parseSingleToolRuntimeCredentialBody,kt as parseStepRecordBody,It as parseStepRecordData,Dt as parseToolHandlerBundlesData,G as parseTriggerFileRuntimeDispatch,nn as parseTriggerHandlerBundlesData,_e as parseWebhookDelivery,tn as parseWebhookDeliveryDispatchData,rn as parseWebhookPublishEventsBody,on as parseWebhookRearmBody,ar as parseWebhookRuntimeCredentialBody,$n as parseWebhookTriggerGrantBody,en as parseWebhookWatcherContext,fn as pollingTriggerContextPath,Nn as pollingTriggerEgressGrantPath,gn as pollingTriggerHandlerBundlesPath,nr as pollingTriggerRuntimeCredentialPath,mn as pollingTriggerTickEventsPath,Ne as requestHasMultipartFileParts,gt as stepResultPath,At as toolHandlerBundlesPath,An as toolInvocationEgressGrantPath,tr as toolInvocationRuntimeCredentialPath,zt as webhookProtocolAdapterBundlePath,Wt as webhookTriggerContextPath,jt as webhookTriggerDeliveryPath,Dn as webhookTriggerEgressGrantPath,Jt as webhookTriggerEventsPath,Vt as webhookTriggerHandlerBundlesPath,Xt as webhookTriggerRearmPath,rr as webhookTriggerRuntimeCredentialPath,Lr as wfpUserRuntimeManifestPath};
|
|
1
|
+
var re="0.2.10";function u(e){return{ok:!0,value:e}}function r(e){return{ok:!1,reason:e}}function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Qe="/cleanup-state-scopes";function k(e){if(!i(e)||typeof e.kind!="string")return r("context state scope surface shape is invalid");switch(e.kind){case"webhook-trigger":return oe(e);case"polling-trigger":return ie(e);case"flow-action":return se(e);default:return r("context state scope kind is invalid")}}function Ze(e){if(!i(e))return r("cleanup request body must be a JSON object");let t=N(e,["scopes"]);if(t!==void 0)return r(`cleanup request does not accept the "${t}" field`);if(!Array.isArray(e.scopes))return r("cleanup request scopes must be an array");let n=[];for(let o of e.scopes){let s=k(o);if(!s.ok)return s;n.push(s.value)}return u({scopes:n})}function et(e){return!i(e)||typeof e.deleted!="number"||!Number.isSafeInteger(e.deleted)||e.deleted<0?r("cleanup response data surface shape is invalid"):u({deleted:e.deleted})}function oe(e){let t=N(e,["kind","workspaceId","triggerInstanceId"]);return t!==void 0?r(`webhook trigger scope does not accept "${t}"`):e.kind!=="webhook-trigger"||!R(e.workspaceId)||!R(e.triggerInstanceId)?r("webhook trigger state scope is invalid"):u({kind:"webhook-trigger",workspaceId:e.workspaceId,triggerInstanceId:e.triggerInstanceId})}function ie(e){let t=N(e,["kind","workspaceId","pollingInstanceId"]);return t!==void 0?r(`polling trigger scope does not accept "${t}"`):e.kind!=="polling-trigger"||!R(e.workspaceId)||!R(e.pollingInstanceId)?r("polling trigger state scope is invalid"):u({kind:"polling-trigger",workspaceId:e.workspaceId,pollingInstanceId:e.pollingInstanceId})}function se(e){let t=N(e,["kind","workspaceId","flowId","nodeId","connectionId"]);if(t!==void 0)return r(`flow action scope does not accept "${t}"`);let n=e.connectionId;return e.kind!=="flow-action"||!R(e.workspaceId)||!R(e.flowId)||!R(e.nodeId)||n!==null&&!R(n)?r("flow action state scope is invalid"):u({kind:"flow-action",workspaceId:e.workspaceId,flowId:e.flowId,nodeId:e.nodeId,connectionId:n})}function R(e){return typeof e=="string"&&e.length>0}function N(e,t){return Object.keys(e).find(n=>!t.includes(n))}var g="/internal/flow-runs",ot="/:flowRunId/execution-context";function it(e){return`${g}/${encodeURIComponent(e)}/execution-context`}function F(e){return!i(e)||!B(e.fileMaxBytes)||!B(e.fileReadMaxBytes)||!B(e.inlineMultipartBytesMax)?r("file runtime limits must carry three positive integer bounds"):u({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function st(e){if(!i(e))return r("execution context must be a JSON object");let t=e.compiled;if(typeof e.flowRunId!="string"||typeof e.workspaceId!="string"||!i(e.input)||!i(t)||typeof t.irSchemaVersion!="string"||typeof t.interpreterContractVersion!="string"||typeof t.compiledArtifactId!="string"||!i(t.ir)||!Array.isArray(t.ir.nodes)||!ae(e.executionBindings))return r("execution context surface shape is invalid");let n=ue(e.fileRuntime);return n.ok?u({...e,fileRuntime:n.value}):r(n.reason)}function ue(e){if(e===null)return u(null);if(!i(e))return r("fileRuntime must be null or an object");let t=F(e.limits);return t.ok?u({limits:t.value}):r(t.reason)}function ae(e){return Array.isArray(e)?e.every(t=>{if(!i(t))return!1;let n=t.connection,o=k(t.stateScope);return typeof t.nodeId=="string"&&typeof t.toolRef=="string"&&i(t.toolDescriptor)&&i(t.integrationDescriptor)&&i(n)&&typeof n.installationId=="string"&&typeof n.connectionRef=="string"&&typeof n.connectionId=="string"&&typeof n.authProfileRef=="string"&&typeof n.authType=="string"&&o.ok}):!1}function B(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}import{parseAblehiErrorDigest as H}from"@ablehi/error-contract";var lt="/:flowRunId/steps/:nodeId/result",pt="/:flowRunId/result",ft="/:flowRunId/execution-events",gt="/:flowRunId/event-waits/:nodeId";function mt(e,t){return`${g}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function Rt(e){return`${g}/${encodeURIComponent(e)}/result`}function yt(e){return`${g}/${encodeURIComponent(e)}/execution-events`}function kt(e,t){return`${g}/${encodeURIComponent(e)}/event-waits/${encodeURIComponent(t)}`}function It(e){if(!i(e))return{ok:!1,kind:"validation",reason:"step record body must be a JSON object"};let t=m(e,["attempt","result","durationMs"]);if(t!==void 0)return{ok:!1,kind:"validation",reason:`step record does not accept the "${t}" field`};let n=e.attempt;if(typeof n!="number"||!Number.isInteger(n)||n<=0)return{ok:!1,kind:"validation",reason:"attempt must be a positive integer"};let o=ce(e.result);if(!o.ok)return o;let s={attempt:n,result:o.value};if(e.durationMs!==void 0){let c=e.durationMs;if(typeof c!="number"||!Number.isFinite(c)||c<0)return{ok:!1,kind:"validation",reason:"durationMs must be a non-negative number"};s.durationMs=c}return{ok:!0,value:s}}function ce(e){if(!i(e))return{ok:!1,kind:"step_result_invalid",reason:"result must be a JSON object"};let t=e.status;if(t==="succeeded"){let n=m(e,["status","output"]);return n!==void 0?{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`}:"output"in e?{ok:!0,value:{status:"succeeded",output:e.output}}:{ok:!1,kind:"step_result_invalid",reason:"a succeeded result must carry output"}}if(t==="failed"){let n=m(e,["status","error"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=H(e.error);return o.ok?{ok:!0,value:{status:"failed",error:o.value}}:{ok:!1,kind:"step_result_invalid",reason:`a failed result must carry an AblehiErrorDigest: ${o.reason}`}}if(t==="skipped"){let n=m(e,["status","reason"]);return n!==void 0?{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`}:e.reason!=="run_if_false"?{ok:!1,kind:"step_result_invalid",reason:'a skipped result reason must be "run_if_false"'}:{ok:!0,value:{status:"skipped",reason:"run_if_false"}}}if(t==="timed_out"){let n=m(e,["status","error"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=H(e.error);return o.ok?{ok:!0,value:{status:"timed_out",error:o.value}}:{ok:!1,kind:"step_result_invalid",reason:`a timed_out result must carry an AblehiErrorDigest: ${o.reason}`}}return{ok:!1,kind:"step_result_invalid",reason:'result status must be "succeeded", "failed", "skipped", or "timed_out"'}}function _t(e){return!i(e)||typeof e.flowRunId!="string"||typeof e.nodeId!="string"||!de(e.recorded)?r("step record data surface shape is invalid"):u({flowRunId:e.flowRunId,nodeId:e.nodeId,recorded:e.recorded})}function de(e){return e==="succeeded"||e==="failed"||e==="skipped"||e==="timed_out"}function ht(e){if(!i(e))return r("result body must be a JSON object");let t=m(e,["status","output","error","composition"]);if(t!==void 0)return r(`result does not accept the "${t}" field`);let n=e.status;if(n!=="succeeded"&&n!=="failed")return r('result status must be "succeeded" or "failed"');let o={status:n};if(e.output!==void 0){if(n!=="succeeded")return r("output is only allowed on a succeeded result");o.output=e.output}if(e.error!==void 0){if(n!=="failed")return r("error is only allowed on a failed result");let s=H(e.error);if(!s.ok)return r(`result error must be an AblehiErrorDigest: ${s.reason}`);o.error=s.value}if(n==="failed"&&o.error===void 0)return r("a failed result must carry an AblehiErrorDigest");if(e.composition!==void 0){if(n!=="succeeded")return r("composition is only allowed on a succeeded result");o.composition=e.composition}return u(o)}function Et(e){return i(e)?u(e):r("flow run result data must be a JSON object")}var le=["flow_run_started","step_started","step_retry_scheduled","wait_registered","wait_event_received","wait_event_timed_out","human_input_created","human_input_submitted","human_input_expired","flow_run_succeeded","flow_run_failed","flow_run_interrupted","flow_run_cancelled"];function xt(e){if(!i(e))return r("execution event data must be a JSON object");let t=m(e,["flowRunId","eventId","accepted"]);return t!==void 0?r(`execution event data does not accept the "${t}" field`):typeof e.flowRunId!="string"||e.flowRunId.length===0?r("flowRunId must be a non-empty string"):typeof e.eventId!="string"||e.eventId.length===0?r("eventId must be a non-empty string"):e.accepted!==!0?r("accepted must be true"):u({flowRunId:e.flowRunId,eventId:e.eventId,accepted:!0})}function wt(e){if(!i(e))return r("execution event body must be a JSON object");let t=m(e,["eventId","eventType","nodeId","stepRunId","attempt","durationMs","occurredAt","errorId","payloadRef","inputFact"]);if(t!==void 0)return r(`execution event does not accept the "${t}" field`);let n=e.eventId;if(typeof n!="string"||n.length===0)return r("eventId must be a non-empty string");let o=e.eventType;if(!pe(o))return r("eventType is not a known flow execution event type");let s=e.occurredAt;if(typeof s!="string"||s.length===0)return r("occurredAt must be a non-empty string");let c={eventId:n,eventType:o,occurredAt:s};for(let a of["nodeId","stepRunId","errorId","payloadRef"]){let d=e[a];if(d!==void 0){if(typeof d!="string"||d.length===0)return r(`${a} must be a non-empty string`);c[a]=d}}for(let a of["attempt","durationMs"]){let d=e[a];if(d!==void 0){if(typeof d!="number"||!Number.isFinite(d)||!Number.isInteger(d)||d<0)return r(`${a} must be a non-negative integer`);c[a]=d}}if(e.inputFact!==void 0){if(o!=="step_started")return r("inputFact is only allowed on step_started events");if(c.attempt===void 0)return r("inputFact requires attempt");let a=fe(e.inputFact);if(!a.ok)return a;c.inputFact=a.value}return u(c)}function pe(e){return typeof e=="string"&&le.includes(e)}function fe(e){if(!i(e))return r("inputFact must be a JSON object");let t=m(e,["digestAlgorithm","digest","domain"]);if(t!==void 0)return r(`inputFact does not accept the "${t}" field`);if(e.digestAlgorithm!=="sha256")return r('inputFact.digestAlgorithm must be "sha256"');let n=e.digest;if(typeof n!="string"||!/^[0-9a-f]{64}$/.test(n))return r("inputFact.digest must be a sha256 hex string");let o=e.domain;if(!i(o))return r("inputFact.domain must be a JSON object");let s=m(o,["irSchemaVersion","interpreterContractVersion","compiledArtifactId","nodeId","algorithmVersion"]);return s!==void 0?r(`inputFact.domain does not accept the "${s}" field`):typeof o.irSchemaVersion!="string"||o.irSchemaVersion.length===0||typeof o.interpreterContractVersion!="string"||o.interpreterContractVersion.length===0||typeof o.compiledArtifactId!="string"||o.compiledArtifactId.length===0||typeof o.nodeId!="string"||o.nodeId.length===0?r("inputFact.domain string fields must be non-empty strings"):o.algorithmVersion!=="flow_input_digest.v1"?r('inputFact.domain.algorithmVersion must be "flow_input_digest.v1"'):u({digestAlgorithm:"sha256",digest:n,domain:{irSchemaVersion:o.irSchemaVersion,interpreterContractVersion:o.interpreterContractVersion,compiledArtifactId:o.compiledArtifactId,nodeId:o.nodeId,algorithmVersion:"flow_input_digest.v1"}})}var ge=/^[A-Za-z0-9_-]{1,100}$/;function Tt(e){if(!i(e))return r("register body must be a JSON object");let t=m(e,["eventType","correlationKey"]);if(t!==void 0)return r(`register wait does not accept the "${t}" field`);let n=j(e.eventType);if(!n.ok)return r(n.reason);let o=e.correlationKey;return typeof o!="string"||o.length===0?r("correlationKey must be a non-empty string"):u({eventType:n.value,correlationKey:o})}function Pt(e){if(!i(e))return r("complete body must be a JSON object");let t=m(e,["eventType","correlationKey","outcome","eventId"]);if(t!==void 0)return r(`complete wait does not accept the "${t}" field`);let n=e.outcome;if(n!=="received"&&n!=="timed_out")return r('outcome must be "received" or "timed_out"');let o=j(e.eventType);if(!o.ok)return r(o.reason);let s=e.correlationKey;if(typeof s!="string"||s.length===0)return r("correlationKey must be a non-empty string");let c={eventType:o.value,correlationKey:s,outcome:n};if(e.eventId!==void 0){if(typeof e.eventId!="string"||e.eventId.length===0)return r("eventId must be a non-empty string");c.eventId=e.eventId}return u(c)}function vt(e){return!i(e)||e.registered!==!0?r("register wait data surface shape is invalid"):u({registered:!0})}function j(e){return typeof e!="string"||e.length===0?r("eventType must be a non-empty string"):ge.test(e)?u(e):r("eventType must match ^[A-Za-z0-9_-]{1,100}$")}function m(e,t){return Object.keys(e).find(n=>!t.includes(n))}var me="/internal/flow-versions",bt="/:flowVersionId/handler-bundles",G="/internal/installations",Ct="/:installationId/handler-bundles";function At(e,t){return`${me}/${encodeURIComponent(e)}/handler-bundles?compiledArtifactId=${encodeURIComponent(t)}`}function Nt(e){return`${G}/${encodeURIComponent(e.installationId)}/handler-bundles?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var Re=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function D(e){if(!_(e))return $("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!Re.has(t)?$("runtimeNetwork.networkModel is unknown"):!J(e.apiHosts)||!J(e.authHosts)||typeof e.httpsOnly!="boolean"?$("runtimeNetwork host/https fields are invalid"):{ok:!0,value:{networkModel:t,apiHosts:e.apiHosts,authHosts:e.authHosts,httpsOnly:e.httpsOnly}}}function Dt(e){if(!_(e)||typeof e.flowVersionId!="string"||typeof e.compiledArtifactId!="string"||!Array.isArray(e.bundles))return T("handler bundles data surface shape is invalid");let t=X(e.bundles);return t.ok?{ok:!0,value:{flowVersionId:e.flowVersionId,compiledArtifactId:e.compiledArtifactId,bundles:t.value}}:t}function Ot(e){if(!_(e)||typeof e.installationId!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.bundles))return T("tool handler bundles data surface shape is invalid");let t=X(e.bundles);return t.ok?{ok:!0,value:{installationId:e.installationId,artifactDigest:e.artifactDigest,bundles:t.value}}:t}function X(e){let t=[];for(let n of e){let o=ye(n);if(!o.ok)return o;t.push(o.value)}return{ok:!0,value:t}}function ye(e){if(!_(e)||typeof e.toolRef!="string"||e.kind!=="handler"&&e.kind!=="request")return T("handler bundle entry shape is invalid");if(e.kind==="request"){if(e.module!==void 0)return T("a request bundle must not carry a module");let o=D(e.runtimeNetwork);return o.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"request",runtimeNetwork:o.value}}:o}let t=e.module;if(!_(t)||typeof t.entry!="string"||t.entry.length===0||!ke(t.files))return T("a handler bundle must carry a { entry, files } module");let n=D(e.runtimeNetwork);return n.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"handler",module:{entry:t.entry,files:t.files},runtimeNetwork:n.value}}:n}function T(e){return{ok:!1,kind:"shape",reason:e}}function $(e){return{ok:!1,kind:"runtime_network",reason:e}}function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function J(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ke(e){return _(e)&&Object.values(e).every(t=>typeof t=="string")}var P="/internal/webhook-trigger-instances",Mt="/:triggerInstanceId/context",Kt="/:triggerInstanceId/handler-bundles",Lt="/:triggerInstanceId/deliveries/:deliveryId",qt="/:triggerInstanceId/events",Wt="/:triggerInstanceId/rearm",v=e=>`${P}/${encodeURIComponent(e)}`;function Vt(e,t){return`${v(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function jt(e,t){return`${v(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Jt(e,t){return`${v(e)}/deliveries/${encodeURIComponent(t)}`}function Xt(e){return`${v(e)}/events`}function Yt(e){return`${v(e)}/rearm`}var zt="/:installationId/webhook-protocol-adapter-bundle";function Qt(e){return`${G}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var Zt="modules/webhook/protocol-adapter.js";function en(e){return`modules/webhook/protocol-adapter-${e}.js`}function tn(e){let t=i(e)?k(e.stateScope):r("webhook watcher context state scope is invalid");return!i(e)||typeof e.artifactDigest!="string"||typeof e.triggerRef!="string"||typeof e.triggerName!="string"||typeof e.integrationRef!="string"||!i(e.inputs)||e.connection!==null&&!Ie(e.connection)||!_e(e.runtime)||!t.ok||t.value.kind!=="webhook-trigger"?r("webhook watcher context surface shape is invalid"):u(e)}function Ie(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authProfileRef=="string"&&typeof e.authType=="string"}function _e(e){if(!i(e)||e.type!=="webhook"||typeof e.trigger_ref!="string")return!1;let t=e.webhook;return i(t)&&typeof t.event_handler_module=="string"&&typeof t.enable_handler_module=="string"&&typeof t.disable_handler_module=="string"}function he(e){if(!i(e)||typeof e.deliveryId!="string"||typeof e.receivedAt!="string"||!i(e.request))return r("webhook delivery surface shape is invalid");let t=e.request;return t.method!=="POST"||!i(t.headers)||typeof t.rawBody!="string"?r("webhook delivery request shape is invalid"):u(e)}function M(e){if(!i(e)||typeof e.token!="string"||typeof e.expiresAt!="string")return r("trigger file runtime dispatch shape is invalid");let t=F(e.limits);return t.ok?u({token:e.token,expiresAt:e.expiresAt,limits:t.value}):r(t.reason)}function nn(e){if(!i(e))return r("webhook delivery dispatch data is invalid");let t=he(e.delivery);if(!t.ok)return r(t.reason);let n=e.fileRuntime;if(n===null)return u({delivery:t.value,fileRuntime:null});let o=M(n);return o.ok?u({delivery:t.value,fileRuntime:o.value}):r(o.reason)}function rn(e){if(!i(e)||typeof e.triggerRef!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.modules)||!e.modules.every(Ee))return{ok:!1,kind:"shape",reason:"trigger handler bundles data surface shape is invalid"};let t=D(e.runtimeNetwork);return t.ok?{ok:!0,value:{triggerRef:e.triggerRef,artifactDigest:e.artifactDigest,modules:e.modules,runtimeNetwork:t.value}}:t}function Ee(e){return i(e)&&typeof e.specifier=="string"&&e.specifier.length>0&&typeof e.source=="string"}function on(e){if(!i(e))return r("publish events body must be a JSON object");let t=K(e,["deliveryId","events"]);if(t!==void 0)return r(`publish events does not accept the "${t}" field`);let n=e.deliveryId;if(typeof n!="string"||n.length===0)return r("deliveryId must be a non-empty string");let o=e.events;if(!Array.isArray(o))return r("events must be an array");let s=[];for(let c of o){let a=xe(c);if(!a.ok)return a;s.push(a.value)}return u({deliveryId:n,events:s})}function xe(e){if(!i(e))return r("each event must be a JSON object");let t=K(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return r(`event does not accept the "${t}" field`);let n=e.eventId;if(typeof n!="string"||n.length===0)return r("eventId must be a non-empty string");let o=e.occurredAt;if(typeof o!="string"||o.length===0)return r("occurredAt must be a non-empty string");if(!i(e.payload))return r("event payload must be a JSON object");let s={eventId:n,occurredAt:o,payload:e.payload};if(e.dedupeKey!==void 0){if(typeof e.dedupeKey!="string"||e.dedupeKey.length===0)return r("dedupeKey must be a non-empty string");s.dedupeKey=e.dedupeKey}return u(s)}function sn(e){if(!i(e))return r("rearm body must be a JSON object");let t=K(e,["expectedWatcherInstanceId"]);if(t!==void 0)return r(`rearm does not accept the "${t}" field`);let n=e.expectedWatcherInstanceId;return typeof n!="string"||n.length===0?r("expectedWatcherInstanceId must be a non-empty string"):u({expectedWatcherInstanceId:n})}function K(e,t){return Object.keys(e).find(n=>!t.includes(n))}var S="/internal/polling-trigger-instances",ln="/:pollingInstanceId/context",pn="/:pollingInstanceId/handler-bundles",fn="/:pollingInstanceId/ticks/:tickId/events",L=e=>`${S}/${encodeURIComponent(e)}`;function gn(e,t,n){return`${L(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function mn(e,t){return`${L(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Rn(e,t){return`${L(e)}/ticks/${encodeURIComponent(t)}/events`}function we(e){let t=i(e)?k(e.stateScope):r("polling trigger context state scope is invalid");return!i(e)||typeof e.artifactDigest!="string"||typeof e.triggerRef!="string"||typeof e.triggerName!="string"||typeof e.integrationRef!="string"||!i(e.inputs)||e.connection!==null&&!Te(e.connection)||!Pe(e.runtime)||!t.ok||t.value.kind!=="polling-trigger"||!ve(e.tick)||!Se(e.limits)?r("polling trigger context surface shape is invalid"):u(e)}function yn(e){if(!i(e))return r("polling trigger dispatch data is invalid");let t=we(e.context);if(!t.ok)return r(t.reason);let n=e.fileRuntime;if(n===null)return u({context:t.value,fileRuntime:null});let o=M(n);return o.ok?u({context:t.value,fileRuntime:o.value}):r(o.reason)}function Te(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authProfileRef=="string"&&typeof e.authType=="string"}function Pe(e){if(!i(e)||e.type!=="polling"||typeof e.trigger_id!="string"||typeof e.trigger_ref!="string")return!1;let t=e.polling;if(!i(t)||typeof t.run_handler_module!="string")return!1;let n=t.schedule;if(!i(n)||n.type!=="interval"||typeof n.every_seconds!="number")return!1;let o=t.dedup;return i(o)&&(o.strategy==="cursor"||o.strategy==="hash"||o.strategy==="id_field")}function ve(e){return i(e)&&typeof e.tickId=="string"&&typeof e.scheduledAt=="string"&&typeof e.attempt=="number"}function Se(e){return i(e)&&typeof e.maxEventsPerTick=="number"}function kn(e){if(!i(e))return r("publish body must be a JSON object");let t=Y(e,["events","nextCursor"]);if(t!==void 0)return r(`publish does not accept the "${t}" field`);let n=e.events;if(!Array.isArray(n))return r("events must be an array");let o=[];for(let c of n){let a=be(c);if(!a.ok)return a;o.push(a.value)}let s={events:o};if("nextCursor"in e){let c=e.nextCursor;if(c!==null&&typeof c!="string")return r("nextCursor must be a string, null, or omitted");s.nextCursor=c}return u(s)}function be(e){if(!i(e))return r("each event must be a JSON object");let t=Y(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return r(`event does not accept the "${t}" field`);if(typeof e.eventId!="string"||e.eventId.length===0)return r("event eventId must be a non-empty string");if(!i(e.payload))return r("event payload must be a JSON object");let n={eventId:e.eventId,payload:e.payload};if(e.occurredAt!==void 0){if(typeof e.occurredAt!="string"||e.occurredAt.length===0)return r("event occurredAt must be a non-empty string");n.occurredAt=e.occurredAt}if(e.dedupeKey!==void 0){if(typeof e.dedupeKey!="string"||e.dedupeKey.length===0)return r("event dedupeKey must be a non-empty string");n.dedupeKey=e.dedupeKey}return u(n)}function In(e){return!i(e)||typeof e.tickId!="string"||typeof e.cursorUpdated!="boolean"||!Array.isArray(e.results)||!e.results.every(Ce)?r("publish polling tick events data surface shape is invalid"):u(e)}function Ce(e){return i(e)&&typeof e.eventId=="string"&&typeof e.dedupeKey=="string"&&typeof e.duplicate=="boolean"&&(e.flowRunId===null||typeof e.flowRunId=="string")}function Y(e,t){return Object.keys(e).find(n=>!t.includes(n))}var z="/internal/egress-grants",q="/internal/tool-invocations",W="/internal/discovery-invocations",Tn="/:flowRunId/egress-grant",Pn="/:invocationId/egress-grant",vn="/:discoveryInvocationId/egress-grant",Sn="/:pollingInstanceId/egress-grant",bn="/:triggerInstanceId/egress-grant",Cn="/:grantId/consume",An="/:grantId/audit",Nn=e=>`${g}/${encodeURIComponent(e)}/egress-grant`,Dn=e=>`${q}/${encodeURIComponent(e)}/egress-grant`,On=e=>`${W}/${encodeURIComponent(e)}/egress-grant`,Un=e=>`${S}/${encodeURIComponent(e)}/egress-grant`,Bn=e=>`${P}/${encodeURIComponent(e)}/egress-grant`,Fn=e=>`${z}/${encodeURIComponent(e)}/consume`,Hn=e=>`${z}/${encodeURIComponent(e)}/audit`,Ae=["flow_action","single_tool","discovery","polling_trigger","webhook_trigger"],Ne=/^[A-Za-z0-9][A-Za-z0-9:_+/=.-]{15,1023}$/;function h(e){return typeof e=="string"&&Ne.test(e)}function De(e){if(!i(e)||e.body_type!=="multipart")return!1;let t=e.body;if(!i(t))return!1;let n=t.parts;return Array.isArray(n)?n.some(o=>i(o)?o.kind==="file"&&typeof o.file_id=="string"&&o.file_id.length>0:!1):!1}function l(e){return{ok:!1,kind:"shape",reason:e}}function E(){return{ok:!1,kind:"request_digest",reason:"request digest is missing or malformed"}}function b(e,t){if(!i(e))return{ok:!1,reason:"grant request body must be a JSON object"};for(let n of Object.keys(e))if(!t.includes(n))return{ok:!1,reason:`grant request does not accept the "${n}" field`};return{ok:!0,record:e}}function C(e){if(!i(e))return"request must be a JSON object"}function $n(e){let t=b(e,["nodeId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.nodeId;if(typeof n!="string"||n.length===0)return l("nodeId is required");let o=C(t.record.request);if(o!==void 0)return l(o);let s=t.record.requestDigest;return h(s)?{ok:!0,value:{nodeId:n,requestDigest:s,requestHasMultipartFiles:De(t.record.request)}}:E()}function Gn(e){let t=b(e,["request","requestDigest"]);if(!t.ok)return l(t.reason);let n=C(t.record.request);if(n!==void 0)return l(n);let o=t.record.requestDigest;return h(o)?{ok:!0,value:{requestDigest:o}}:E()}function Mn(e){let t=b(e,["request","requestDigest"]);if(!t.ok)return l(t.reason);let n=C(t.record.request);if(n!==void 0)return l(n);let o=t.record.requestDigest;return h(o)?{ok:!0,value:{requestDigest:o}}:E()}function Kn(e){let t=b(e,["tickId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.tickId;if(typeof n!="string"||n.length===0)return l("tickId is required");let o=C(t.record.request);if(o!==void 0)return l(o);let s=t.record.requestDigest;return h(s)?{ok:!0,value:{tickId:n,requestDigest:s}}:E()}function Ln(e){let t=b(e,["phase","lifecycle","deliveryId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.phase;if(n!=="lifecycle"&&n!=="handler")return l('phase must be "lifecycle" or "handler"');let o=t.record.lifecycle,s;if(o!==void 0){if(o!=="enable"&&o!=="disable"&&o!=="renew")return l('lifecycle must be "enable", "disable", or "renew"');s=o}if(n==="lifecycle"&&s===void 0)return l("lifecycle is required for the lifecycle phase");let c=t.record.deliveryId,a;if(c!==void 0){if(typeof c!="string"||c.length===0)return l("deliveryId must be a non-empty string");a=c}if(n==="handler"&&a===void 0)return l("deliveryId is required for the handler phase");let d=C(t.record.request);if(d!==void 0)return l(d);let I=t.record.requestDigest;return h(I)?{ok:!0,value:{phase:n,...s!==void 0?{lifecycle:s}:{},...a!==void 0?{deliveryId:a}:{},requestDigest:I}}:E()}function Q(e){return Ae.includes(e)?e:void 0}var Oe=["scopeKind","scopeId","requestDigest"];function qn(e){if(!i(e))return l("consume body must be a JSON object");for(let s of Object.keys(e))if(!Oe.includes(s))return l(`consume does not accept the "${s}" field`);let t=Q(e.scopeKind);if(t===void 0)return l("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return l("scopeId is required");let o=e.requestDigest;return h(o)?{ok:!0,value:{scopeKind:t,scopeId:n,requestDigest:o}}:E()}var Ue=["scopeKind","scopeId","providerHost","status","durationMs","requestBytes","responseBytes","errorCode"];function O(e,t){return typeof e!="number"||!Number.isInteger(e)||e<0?{ok:!1,reason:`${t} must be a non-negative integer`}:{ok:!0,value:e}}function Wn(e){if(!i(e))return l("audit body must be a JSON object");for(let p of Object.keys(e))if(!Ue.includes(p))return l(`audit does not accept the "${p}" field`);let t=Q(e.scopeKind);if(t===void 0)return l("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return l("scopeId is required");let o=e.providerHost;if(typeof o!="string"||o.length===0)return l("providerHost is required");let s=O(e.durationMs,"durationMs");if(!s.ok)return l(s.reason);let c;if(e.status!==void 0){let p=O(e.status,"status");if(!p.ok)return l(p.reason);c=p.value}let a;if(e.requestBytes!==void 0){let p=O(e.requestBytes,"requestBytes");if(!p.ok)return l(p.reason);a=p.value}let d;if(e.responseBytes!==void 0){let p=O(e.responseBytes,"responseBytes");if(!p.ok)return l(p.reason);d=p.value}let I;if(e.errorCode!==void 0){let p=e.errorCode;if(typeof p!="string"||p.length===0)return l("errorCode must be a non-empty string");I=p}return{ok:!0,value:{scopeKind:t,scopeId:n,providerHost:o,...c!==void 0?{status:c}:{},durationMs:s.value,...a!==void 0?{requestBytes:a}:{},...d!==void 0?{responseBytes:d}:{},...I!==void 0?{errorCode:I}:{}}}}function Vn(e){return!i(e)||!i(e.grant)?r("egress grant envelope must carry a grant object"):u(e.grant)}function jn(e){return!i(e)||e.consumed!==!0?r("egress grant consume data must carry consumed:true"):u({consumed:!0})}var er="/:flowRunId/runtime-credential",tr="/:invocationId/runtime-credential",nr="/:discoveryInvocationId/runtime-credential",rr="/:pollingInstanceId/runtime-credential",or="/:triggerInstanceId/runtime-credential",ir=e=>`${g}/${encodeURIComponent(e)}/runtime-credential`,sr=e=>`${q}/${encodeURIComponent(e)}/runtime-credential`,ur=e=>`${W}/${encodeURIComponent(e)}/runtime-credential`,ar=e=>`${S}/${encodeURIComponent(e)}/runtime-credential`,cr=e=>`${P}/${encodeURIComponent(e)}/runtime-credential`,dr=["flow_action","tool_invoke","discovery","polling_trigger","webhook_trigger"];function A(e,t){if(!i(e))return{ok:!1,reason:"runtime credential request body must be a JSON object"};for(let n of Object.keys(e))if(!t.includes(n))return{ok:!1,reason:`runtime credential request does not accept the "${n}" field`};return{ok:!0,record:e}}function lr(e){let t=A(e,["nodeId"]);if(!t.ok)return r(t.reason);let n=t.record.nodeId;return typeof n!="string"||n.length===0?r("nodeId is required"):u({nodeId:n})}function pr(e){let t=A(e??{},[]);return t.ok?u(null):r(t.reason)}function fr(e){let t=A(e??{},[]);return t.ok?u(null):r(t.reason)}function gr(e){let t=A(e,["tickId"]);if(!t.ok)return r(t.reason);let n=t.record.tickId;return typeof n!="string"||n.length===0?r("tickId is required"):u({tickId:n})}function mr(e){let t=A(e,["executionKind","deliveryId","lifecycleOperation"]);if(!t.ok)return r(t.reason);let n=t.record.executionKind;if(n!=="event_handler"&&n!=="lifecycle")return r('executionKind must be "event_handler" or "lifecycle"');let o,s=t.record.deliveryId;if(s!==void 0){if(typeof s!="string"||s.length===0)return r("deliveryId must be a non-empty string");o=s}let c,a=t.record.lifecycleOperation;if(a!==void 0){if(a!=="enable"&&a!=="disable"&&a!=="renew")return r('lifecycleOperation must be "enable", "disable", or "renew"');c=a}return n==="lifecycle"&&c===void 0?r("lifecycleOperation is required for the lifecycle execution kind"):u({executionKind:n,...o!==void 0?{deliveryId:o}:{},...c!==void 0?{lifecycleOperation:c}:{}})}function Rr(e){return!i(e)||typeof e.sessionId!="string"||typeof e.connectionId!="string"||typeof e.authProfileRef!="string"||typeof e.authType!="string"||!i(e.credential)?r("runtime credential session must carry sessionId, connectionId, auth profile facts and a credential object"):u(e.credential)}function U(e){return!i(e)||typeof e.file_id!="string"||typeof e.name!="string"||typeof e.size_bytes!="number"||typeof e.created_at!="string"||typeof e.expires_at!="string"||e.mime_type!==void 0&&typeof e.mime_type!="string"||e.sha256!==void 0&&typeof e.sha256!="string"||e.source!==void 0&&typeof e.source!="string"?r("file ref data does not match the AIS file-ref shape"):u(e)}function V(e){return!i(e)||e.method!=="GET"&&e.method!=="PUT"||typeof e.url!="string"||typeof e.expires_at!="string"||!He(e.headers)?r("presigned file URL data is invalid"):u(e)}function Be(e){if(!i(e))return r("file upload session data is invalid");let t=U(e.file);if(!t.ok)return r(t.reason);let n=V(e.upload);return n.ok?u({file:t.value,upload:n.value}):r(n.reason)}function Fe(e){if(!i(e))return r("file metadata data is invalid");let t=U(e.file);return t.ok?u({file:t.value}):r(t.reason)}function He(e){return i(e)?Object.values(e).every(t=>typeof t=="string"):!1}var x="/internal/files",Er="/upload-session",xr="/:fileId/complete",wr="/:fileId/access",Tr="/:fileId/stat",Pr="/:fileId/content",vr=()=>x,Sr=()=>`${x}/upload-session`,br=e=>`${x}/${encodeURIComponent(e)}/complete`,Cr=(e,t)=>`${x}/${encodeURIComponent(e)}/access?intent=${encodeURIComponent(t)}`,Z=e=>`?scope_kind=${encodeURIComponent(e.scopeKind)}&scope_id=${encodeURIComponent(e.scopeId)}`,Ar=(e,t)=>`${x}/${encodeURIComponent(e)}/stat${Z(t)}`,Nr=(e,t)=>`${x}/${encodeURIComponent(e)}/content${Z(t)}`;function Dr(e){if(!i(e))return r("internal file access data is invalid");if(e.intent==="runtime_read"||e.intent==="provider_multipart"){let t=U(e.file);if(!t.ok)return r(t.reason);let n=V(e.access);return n.ok?u({file:t.value,access:n.value,intent:e.intent}):r(n.reason)}return r("internal file access intent is invalid")}var Fr="/:flowRunId/human-inputs",Hr="/:flowRunId/human-inputs/:requestId",$r="/:flowRunId/human-inputs/:requestId/expire",Gr="/:flowRunId/human-inputs/:requestId/acknowledge",$e=e=>`${g}/${encodeURIComponent(e)}/human-inputs`,ee=(e,t)=>`${$e(e)}/${encodeURIComponent(t)}`,Mr=(e,t)=>`${ee(e,t)}/expire`,Kr=(e,t)=>`${ee(e,t)}/acknowledge`,Ge="human_input_resolved";function Lr(e){return`${Ge}_${e}`}function f(e){return{ok:!1,reason:e}}function y(e,t){return i(e)?{ok:!0,value:e}:f(`${t} must be an object`)}function w(e,t){return typeof e!="string"||e.length===0?f(`${t} must be a non-empty string`):{ok:!0,value:e}}var Me=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function Ke(e,t){return typeof e!="string"||!Me.test(e)||Number.isNaN(Date.parse(e))?f(`${t} must be an ISO-8601 timestamp`):{ok:!0,value:e}}function Le(e){let t=y(e,"renderedPrompt");if(!t.ok)return t;let n=w(t.value.title,"renderedPrompt.title");if(!n.ok)return n;let o={title:n.value};if(t.value.body!==void 0){if(typeof t.value.body!="string")return f("renderedPrompt.body must be a string");o.body=t.value.body}if(t.value.format!==void 0){if(t.value.format!=="plain"&&t.value.format!=="markdown")return f("renderedPrompt.format is invalid");o.format=t.value.format}return{ok:!0,value:o}}function qe(e){let t=y(e,"input");if(!t.ok)return t;let n=t.value.kind;if(n==="choice"){if(!Array.isArray(t.value.choices))return f("input.choices must be an array")}else if(n!=="text")if(n==="form"){if(!Array.isArray(t.value.fields))return f("input.fields must be an array")}else return f("input.kind is invalid");return{ok:!0,value:t.value}}function We(e){if(e==null)return{ok:!0,value:void 0};let t=y(e,"partiallyRenderedDelivery");if(!t.ok)return t;let n=t.value.actions;if(n===void 0)return{ok:!0,value:{}};if(!Array.isArray(n))return f("partiallyRenderedDelivery.actions must be an array");let o=[];for(let s of n){let c=y(s,"delivery action");if(!c.ok)return c;let a=w(c.value.id,"delivery action id");if(!a.ok)return a;let d=te(c.value.inputs,`delivery action '${a.value}' inputs`);if(!d.ok)return d;o.push({id:a.value,inputs:d.value})}return{ok:!0,value:{actions:o}}}function te(e,t){let n=y(e,t);if(!n.ok)return n;let o={};for(let[s,c]of Object.entries(n.value)){let a=ne(c,`${t}.${s}`);if(!a.ok)return a;o[s]=a.value}return{ok:!0,value:o}}function ne(e,t){let n=y(e,t);if(!n.ok)return n;switch(n.value.kind){case"literal":return{ok:!0,value:{kind:"literal",value:n.value.value}};case"human_input_ref":{let s=w(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}case"array":{if(!Array.isArray(n.value.items))return f(`${t}.items must be an array`);let s=[];for(let[c,a]of n.value.items.entries()){let d=ne(a,`${t}[${c}]`);if(!d.ok)return d;s.push(d.value)}return{ok:!0,value:{kind:"array",items:s}}}case"object":{let s=te(n.value.entries,`${t}.entries`);return s.ok?{ok:!0,value:{kind:"object",entries:s.value}}:s}case"template":{if(!Array.isArray(n.value.parts))return f(`${t}.parts must be an array`);let s=[];for(let[c,a]of n.value.parts.entries()){let d=Ve(a,`${t}.parts[${c}]`);if(!d.ok)return d;s.push(d.value)}return{ok:!0,value:{kind:"template",parts:s}}}default:return f(`${t}.kind is invalid`)}}function Ve(e,t){let n=y(e,t);if(!n.ok)return n;let o=n.value.kind;if(o==="literal")return typeof n.value.value!="string"?f(`${t}.value must be a string`):{ok:!0,value:{kind:"literal",value:n.value.value}};if(o==="human_input_ref"){let s=w(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}return f(`${t}.kind is invalid`)}function qr(e){let t=y(e,"request body");if(!t.ok)return r(t.reason);let n=w(t.value.nodeId,"nodeId");if(!n.ok)return r(n.reason);let o=Le(t.value.renderedPrompt);if(!o.ok)return r(o.reason);let s=qe(t.value.input);if(!s.ok)return r(s.reason);let c=w(t.value.timeout,"timeout");if(!c.ok)return r(c.reason);let a=Ke(t.value.expiresAt,"expiresAt");if(!a.ok)return r(a.reason);let d=We(t.value.partiallyRenderedDelivery);return d.ok?u({nodeId:n.value,renderedPrompt:o.value,input:s.value,timeout:c.value,expiresAt:a.value,...d.value!==void 0?{partiallyRenderedDelivery:d.value}:{}}):r(d.reason)}function je(e){return!i(e)||typeof e.id!="string"||e.id.length===0||typeof e.nodeId!="string"||typeof e.status!="string"||!(e.output===null||i(e.output))?r("human input request view must carry id, nodeId, status and output"):u(e)}function Wr(e){if(!i(e)||typeof e.created!="boolean")return r("human input create data must carry created:boolean");let t=je(e.request);return t.ok?u({created:e.created,request:t.value}):t}function Vr(e){return!i(e)||e.acknowledged!==!0?r("human input acknowledge data must carry acknowledged:true"):u({acknowledged:!0})}var Jr="ablehi-wfp-user-runtime-manifest/v1",Xr="unknown";function Yr(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var Qr="/internal/deployment-handshake",Je=["start","terminate","send-event","start-webhook-watcher","run-polling-tick","invoke-tool","invoke-discovery","invoke-trigger-handler","invoke-webhook-protocol-adapter","deployment-handshake"],Zr=Je,eo="HANDSHAKE_REQUEST_INVALID",to="HANDSHAKE_SECRET_UNCONFIGURED",no="HANDSHAKE_SECRET_MISMATCH",ro="HANDSHAKE_CONTRACT_VERSION_MISMATCH",oo="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",io="HANDSHAKE_CAPABILITY_MISSING";function so(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function uo(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}export{Qe as CONTEXT_STATE_CLEANUP_ROUTE_PATH,Je as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,Zr as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,Qr as DEPLOYMENT_HANDSHAKE_ROUTE,vn as DISCOVERY_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,nr as DISCOVERY_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,An as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,Cn as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,Ae as EGRESS_GRANT_SCOPE_KINDS,gt as EVENT_WAIT_ROUTE_SUBPATH,ot as EXECUTION_CONTEXT_ROUTE_SUBPATH,wr as FILE_ACCESS_ROUTE_SUBPATH,xr as FILE_COMPLETE_ROUTE_SUBPATH,Pr as FILE_CONTENT_ROUTE_SUBPATH,Tr as FILE_STAT_ROUTE_SUBPATH,Er as FILE_UPLOAD_SESSION_ROUTE_SUBPATH,Tn as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,ft as FLOW_RUN_EXECUTION_EVENTS_ROUTE_SUBPATH,le as FLOW_RUN_EXECUTION_EVENT_TYPES,pt as FLOW_RUN_RESULT_ROUTE_SUBPATH,er as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,bt as HANDLER_BUNDLES_ROUTE_SUBPATH,io as HANDSHAKE_CAPABILITY_MISSING,ro as HANDSHAKE_CONTRACT_VERSION_MISMATCH,oo as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,eo as HANDSHAKE_REQUEST_INVALID,no as HANDSHAKE_SECRET_MISMATCH,to as HANDSHAKE_SECRET_UNCONFIGURED,Fr as HUMAN_INPUTS_ROUTE_SUBPATH,Gr as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,$r as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,Hr as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,Ge as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,W as INTERNAL_DISCOVERY_INVOCATIONS_ROUTE_PREFIX,z as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX,x as INTERNAL_FILES_ROUTE_PREFIX,g as INTERNAL_FLOW_RUNS_ROUTE_PREFIX,me as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX,G as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,S as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,q as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,P as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,ln as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,Sn as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,pn as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,rr as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,fn as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,dr as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,re as SERVER_EXECUTION_CONTRACT_VERSION,lt as STEP_RESULT_ROUTE_SUBPATH,Ct as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,Pn as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,tr as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,zt as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,Zt as WEBHOOK_PROTOCOL_ADAPTER_MODULE,Mt as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,Lt as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,bn as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,qt as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,Kt as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,Wt as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,or as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Jr as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,Xr as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,so as deploymentHandshakeProbePayload,uo as deploymentHandshakeResponseProofPayload,On as discoveryInvocationEgressGrantPath,ur as discoveryInvocationRuntimeCredentialPath,Hn as egressGrantAuditPath,Fn as egressGrantConsumePath,kt as eventWaitPath,it as executionContextPath,Nn as flowRunEgressGrantPath,yt as flowRunExecutionEventsPath,Rt as flowRunResultPath,ir as flowRunRuntimeCredentialPath,en as flowScriptProtocolAdapterModuleName,At as handlerBundlesPath,Kr as humanInputAcknowledgePath,Mr as humanInputExpirePath,ee as humanInputRequestPath,Lr as humanInputResolvedEventType,$e as humanInputsPath,Cr as internalFileAccessPath,br as internalFileCompletePath,Nr as internalFileContentPath,Ar as internalFileStatPath,Sr as internalFileUploadSessionPath,vr as internalFilesPath,h as isValidRequestDigest,Pt as parseCompleteFlowRunWaitBody,Ze as parseContextStateCleanupRequestBody,et as parseContextStateCleanupResponseData,k as parseContextStateScope,qr as parseCreateHumanInputBody,Mn as parseDiscoveryGrantBody,fr as parseDiscoveryRuntimeCredentialBody,Wn as parseEgressGrantAuditBody,qn as parseEgressGrantConsumeBody,jn as parseEgressGrantConsumeData,Vn as parseEgressGrantData,st as parseExecutionContextData,Fe as parseFileMetadataData,U as parseFileRefData,F as parseFileRuntimeLimits,Be as parseFileUploadSessionData,$n as parseFlowActionGrantBody,wt as parseFlowRunExecutionEventBody,xt as parseFlowRunExecutionEventData,ht as parseFlowRunResultBody,Et as parseFlowRunResultData,lr as parseFlowRuntimeCredentialBody,ye as parseHandlerBundle,Dt as parseHandlerBundlesData,Vr as parseHumanInputAcknowledgeData,Wr as parseHumanInputCreateData,je as parseHumanInputRequestViewData,Dr as parseInternalFileAccessData,kn as parsePollingPublishBody,gr as parsePollingRuntimeCredentialBody,we as parsePollingTriggerContext,yn as parsePollingTriggerDispatchData,Kn as parsePollingTriggerGrantBody,In as parsePublishPollingTickEventsData,Tt as parseRegisterFlowRunWaitBody,vt as parseRegisterFlowRunWaitData,Rr as parseRuntimeCredentialSessionCredential,D as parseRuntimeNetwork,Gn as parseSingleToolGrantBody,pr as parseSingleToolRuntimeCredentialBody,It as parseStepRecordBody,_t as parseStepRecordData,Ot as parseToolHandlerBundlesData,M as parseTriggerFileRuntimeDispatch,rn as parseTriggerHandlerBundlesData,he as parseWebhookDelivery,nn as parseWebhookDeliveryDispatchData,on as parseWebhookPublishEventsBody,sn as parseWebhookRearmBody,mr as parseWebhookRuntimeCredentialBody,Ln as parseWebhookTriggerGrantBody,tn as parseWebhookWatcherContext,gn as pollingTriggerContextPath,Un as pollingTriggerEgressGrantPath,mn as pollingTriggerHandlerBundlesPath,ar as pollingTriggerRuntimeCredentialPath,Rn as pollingTriggerTickEventsPath,De as requestHasMultipartFileParts,mt as stepResultPath,Nt as toolHandlerBundlesPath,Dn as toolInvocationEgressGrantPath,sr as toolInvocationRuntimeCredentialPath,Qt as webhookProtocolAdapterBundlePath,Vt as webhookTriggerContextPath,Jt as webhookTriggerDeliveryPath,Bn as webhookTriggerEgressGrantPath,Xt as webhookTriggerEventsPath,jt as webhookTriggerHandlerBundlesPath,Yt as webhookTriggerRearmPath,cr as webhookTriggerRuntimeCredentialPath,Yr as wfpUserRuntimeManifestPath};
|
package/dist/index.d.ts
CHANGED
|
@@ -467,19 +467,22 @@ declare function parsePublishPollingTickEventsData(data: unknown): ContractParse
|
|
|
467
467
|
|
|
468
468
|
declare const INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX = "/internal/egress-grants";
|
|
469
469
|
declare const INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX = "/internal/tool-invocations";
|
|
470
|
+
declare const INTERNAL_DISCOVERY_INVOCATIONS_ROUTE_PREFIX = "/internal/discovery-invocations";
|
|
470
471
|
declare const FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH = "/:flowRunId/egress-grant";
|
|
471
472
|
declare const TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH = "/:invocationId/egress-grant";
|
|
473
|
+
declare const DISCOVERY_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH = "/:discoveryInvocationId/egress-grant";
|
|
472
474
|
declare const POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH = "/:pollingInstanceId/egress-grant";
|
|
473
475
|
declare const WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH = "/:triggerInstanceId/egress-grant";
|
|
474
476
|
declare const EGRESS_GRANT_CONSUME_ROUTE_SUBPATH = "/:grantId/consume";
|
|
475
477
|
declare const EGRESS_GRANT_AUDIT_ROUTE_SUBPATH = "/:grantId/audit";
|
|
476
478
|
declare const flowRunEgressGrantPath: (flowRunId: string) => string;
|
|
477
479
|
declare const toolInvocationEgressGrantPath: (invocationId: string) => string;
|
|
480
|
+
declare const discoveryInvocationEgressGrantPath: (discoveryInvocationId: string) => string;
|
|
478
481
|
declare const pollingTriggerEgressGrantPath: (pollingInstanceId: string) => string;
|
|
479
482
|
declare const webhookTriggerEgressGrantPath: (triggerInstanceId: string) => string;
|
|
480
483
|
declare const egressGrantConsumePath: (grantId: string) => string;
|
|
481
484
|
declare const egressGrantAuditPath: (grantId: string) => string;
|
|
482
|
-
declare const EGRESS_GRANT_SCOPE_KINDS: readonly ["flow_action", "single_tool", "polling_trigger", "webhook_trigger"];
|
|
485
|
+
declare const EGRESS_GRANT_SCOPE_KINDS: readonly ["flow_action", "single_tool", "discovery", "polling_trigger", "webhook_trigger"];
|
|
483
486
|
type EgressGrantScopeKind = (typeof EGRESS_GRANT_SCOPE_KINDS)[number];
|
|
484
487
|
type EgressGrantFileRuntime = {
|
|
485
488
|
baseUrl: string;
|
|
@@ -538,6 +541,9 @@ type FlowActionGrantBody = {
|
|
|
538
541
|
type SingleToolGrantBody = {
|
|
539
542
|
requestDigest: string;
|
|
540
543
|
};
|
|
544
|
+
type DiscoveryGrantBody = {
|
|
545
|
+
requestDigest: string;
|
|
546
|
+
};
|
|
541
547
|
type PollingTriggerGrantBody = {
|
|
542
548
|
tickId: string;
|
|
543
549
|
requestDigest: string;
|
|
@@ -560,6 +566,7 @@ type EgressGrantBodyParseResult<T> = {
|
|
|
560
566
|
};
|
|
561
567
|
declare function parseFlowActionGrantBody(body: unknown): EgressGrantBodyParseResult<FlowActionGrantBody>;
|
|
562
568
|
declare function parseSingleToolGrantBody(body: unknown): EgressGrantBodyParseResult<SingleToolGrantBody>;
|
|
569
|
+
declare function parseDiscoveryGrantBody(body: unknown): EgressGrantBodyParseResult<DiscoveryGrantBody>;
|
|
563
570
|
declare function parsePollingTriggerGrantBody(body: unknown): EgressGrantBodyParseResult<PollingTriggerGrantBody>;
|
|
564
571
|
declare function parseWebhookTriggerGrantBody(body: unknown): EgressGrantBodyParseResult<WebhookTriggerGrantBody>;
|
|
565
572
|
declare function parseEgressGrantConsumeBody(body: unknown): EgressGrantBodyParseResult<EgressGrantConsumeBody>;
|
|
@@ -571,13 +578,15 @@ declare function parseEgressGrantConsumeData(data: unknown): ContractParseResult
|
|
|
571
578
|
|
|
572
579
|
declare const FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH = "/:flowRunId/runtime-credential";
|
|
573
580
|
declare const TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH = "/:invocationId/runtime-credential";
|
|
581
|
+
declare const DISCOVERY_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH = "/:discoveryInvocationId/runtime-credential";
|
|
574
582
|
declare const POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH = "/:pollingInstanceId/runtime-credential";
|
|
575
583
|
declare const WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH = "/:triggerInstanceId/runtime-credential";
|
|
576
584
|
declare const flowRunRuntimeCredentialPath: (flowRunId: string) => string;
|
|
577
585
|
declare const toolInvocationRuntimeCredentialPath: (invocationId: string) => string;
|
|
586
|
+
declare const discoveryInvocationRuntimeCredentialPath: (discoveryInvocationId: string) => string;
|
|
578
587
|
declare const pollingTriggerRuntimeCredentialPath: (pollingInstanceId: string) => string;
|
|
579
588
|
declare const webhookTriggerRuntimeCredentialPath: (triggerInstanceId: string) => string;
|
|
580
|
-
declare const RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS: readonly ["flow_action", "tool_invoke", "polling_trigger", "webhook_trigger"];
|
|
589
|
+
declare const RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS: readonly ["flow_action", "tool_invoke", "discovery", "polling_trigger", "webhook_trigger"];
|
|
581
590
|
type RuntimeCredentialSessionScopeKind = (typeof RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS)[number];
|
|
582
591
|
type RuntimeCredentialSessionNetwork = {
|
|
583
592
|
networkModel: "managed_plus_unmanaged_sdk";
|
|
@@ -614,10 +623,70 @@ type WebhookRuntimeCredentialBody = {
|
|
|
614
623
|
};
|
|
615
624
|
declare function parseFlowRuntimeCredentialBody(body: unknown): ContractParseResult<FlowRuntimeCredentialBody>;
|
|
616
625
|
declare function parseSingleToolRuntimeCredentialBody(body: unknown): ContractParseResult<null>;
|
|
626
|
+
declare function parseDiscoveryRuntimeCredentialBody(body: unknown): ContractParseResult<null>;
|
|
617
627
|
declare function parsePollingRuntimeCredentialBody(body: unknown): ContractParseResult<PollingRuntimeCredentialBody>;
|
|
618
628
|
declare function parseWebhookRuntimeCredentialBody(body: unknown): ContractParseResult<WebhookRuntimeCredentialBody>;
|
|
619
629
|
declare function parseRuntimeCredentialSessionCredential(data: unknown): ContractParseResult<Record<string, unknown>>;
|
|
620
630
|
|
|
631
|
+
type IntegrationDiscoverySubject = {
|
|
632
|
+
kind: "action";
|
|
633
|
+
name: string;
|
|
634
|
+
} | {
|
|
635
|
+
kind: "trigger";
|
|
636
|
+
name: string;
|
|
637
|
+
};
|
|
638
|
+
type DiscoveryInvokeRequest = {
|
|
639
|
+
subject: IntegrationDiscoverySubject;
|
|
640
|
+
input: string;
|
|
641
|
+
discoveryRef: string;
|
|
642
|
+
inputs: Record<string, unknown>;
|
|
643
|
+
query?: string;
|
|
644
|
+
cursor?: string;
|
|
645
|
+
limit?: number;
|
|
646
|
+
};
|
|
647
|
+
type PackageInputDiscoveryKind = "options" | "fields";
|
|
648
|
+
type PackageInputDiscoveryDescriptor = {
|
|
649
|
+
input: string;
|
|
650
|
+
ref: string;
|
|
651
|
+
kind: PackageInputDiscoveryKind;
|
|
652
|
+
handler_path: string;
|
|
653
|
+
depends_on: string[];
|
|
654
|
+
searchable: boolean;
|
|
655
|
+
paginated: boolean;
|
|
656
|
+
default_limit: number;
|
|
657
|
+
max_limit: number;
|
|
658
|
+
};
|
|
659
|
+
type DiscoveryExecutionBinding = {
|
|
660
|
+
subject: IntegrationDiscoverySubject;
|
|
661
|
+
input: string;
|
|
662
|
+
discoveryRef: string;
|
|
663
|
+
discoveryModuleRef: string;
|
|
664
|
+
descriptor: PackageInputDiscoveryDescriptor;
|
|
665
|
+
connection: ExecutionBindingConnection | null;
|
|
666
|
+
};
|
|
667
|
+
type DiscoveryEgressGrantBinding = {
|
|
668
|
+
token: string;
|
|
669
|
+
expiresAt: string;
|
|
670
|
+
};
|
|
671
|
+
type DiscoveryRuntimeCredentialBinding = {
|
|
672
|
+
token: string;
|
|
673
|
+
expiresAt: string;
|
|
674
|
+
};
|
|
675
|
+
type DiscoveryDispatchBody = {
|
|
676
|
+
discoveryInvocationId: string;
|
|
677
|
+
metadata: {
|
|
678
|
+
workspaceId: string;
|
|
679
|
+
installationId: string;
|
|
680
|
+
artifactDigest: string;
|
|
681
|
+
scriptName: string;
|
|
682
|
+
};
|
|
683
|
+
request: DiscoveryInvokeRequest;
|
|
684
|
+
executionBinding: DiscoveryExecutionBinding;
|
|
685
|
+
egressGrantBinding?: DiscoveryEgressGrantBinding;
|
|
686
|
+
runtimeCredentialBinding?: DiscoveryRuntimeCredentialBinding;
|
|
687
|
+
serverCallbackBaseUrl: string;
|
|
688
|
+
};
|
|
689
|
+
|
|
621
690
|
type FileRefData = {
|
|
622
691
|
file_id: string;
|
|
623
692
|
name: string;
|
|
@@ -829,8 +898,8 @@ type DeploymentHandshakeResponse = {
|
|
|
829
898
|
message: string;
|
|
830
899
|
};
|
|
831
900
|
};
|
|
832
|
-
declare const DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES: readonly ["start", "terminate", "send-event", "start-webhook-watcher", "run-polling-tick", "invoke-tool", "invoke-trigger-handler", "invoke-webhook-protocol-adapter", "deployment-handshake"];
|
|
833
|
-
declare const DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES: readonly ["start", "terminate", "send-event", "start-webhook-watcher", "run-polling-tick", "invoke-tool", "invoke-trigger-handler", "invoke-webhook-protocol-adapter", "deployment-handshake"];
|
|
901
|
+
declare const DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES: readonly ["start", "terminate", "send-event", "start-webhook-watcher", "run-polling-tick", "invoke-tool", "invoke-discovery", "invoke-trigger-handler", "invoke-webhook-protocol-adapter", "deployment-handshake"];
|
|
902
|
+
declare const DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES: readonly ["start", "terminate", "send-event", "start-webhook-watcher", "run-polling-tick", "invoke-tool", "invoke-discovery", "invoke-trigger-handler", "invoke-webhook-protocol-adapter", "deployment-handshake"];
|
|
834
903
|
declare const HANDSHAKE_REQUEST_INVALID = "HANDSHAKE_REQUEST_INVALID";
|
|
835
904
|
declare const HANDSHAKE_SECRET_UNCONFIGURED = "HANDSHAKE_SECRET_UNCONFIGURED";
|
|
836
905
|
declare const HANDSHAKE_SECRET_MISMATCH = "HANDSHAKE_SECRET_MISMATCH";
|
|
@@ -850,4 +919,4 @@ declare function deploymentHandshakeResponseProofPayload(input: {
|
|
|
850
919
|
capabilities: string[];
|
|
851
920
|
}): string;
|
|
852
921
|
|
|
853
|
-
export { CONTEXT_STATE_CLEANUP_ROUTE_PATH, type CompleteFlowRunWaitBody, type CompleteFlowRunWaitData, type ContextStateCleanupRequestBody, type ContextStateCleanupResponseData, type ContextStateScope, type CreateHumanInputRequestBody, DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES, DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES, DEPLOYMENT_HANDSHAKE_ROUTE, type DeploymentHandshakeData, type DeploymentHandshakeRequestBody, type DeploymentHandshakeResponse, EGRESS_GRANT_AUDIT_ROUTE_SUBPATH, EGRESS_GRANT_CONSUME_ROUTE_SUBPATH, EGRESS_GRANT_SCOPE_KINDS, EVENT_WAIT_ROUTE_SUBPATH, EXECUTION_CONTEXT_ROUTE_SUBPATH, type EgressGrant, type EgressGrantAuditBody, type EgressGrantBodyParseResult, type EgressGrantConsumeBody, type EgressGrantCredentialMaterial, type EgressGrantFileRuntime, type EgressGrantScopeKind, type ExecutionBinding, type ExecutionBindingConnection, type ExecutionContextCompiled, type ExecutionContextData, FILE_ACCESS_ROUTE_SUBPATH, FILE_COMPLETE_ROUTE_SUBPATH, FILE_CONTENT_ROUTE_SUBPATH, FILE_STAT_ROUTE_SUBPATH, FILE_UPLOAD_SESSION_ROUTE_SUBPATH, FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH, FLOW_RUN_EXECUTION_EVENTS_ROUTE_SUBPATH, FLOW_RUN_EXECUTION_EVENT_TYPES, FLOW_RUN_RESULT_ROUTE_SUBPATH, FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, type FileMetadataData, type FileRefData, type FileRuntimeLimits, type FileRuntimeScope, type FileRuntimeScopeKind, type FileUploadSessionData, type FlowActionGrantBody, type FlowExecutionContextFileRuntime, type FlowRunExecutionEventBody, type FlowRunExecutionEventData, type FlowRunExecutionEventType, type FlowRunInputFactBody, type FlowRunResultData, type FlowRunResultRequestBody, type FlowRuntimeCredentialBody, HANDLER_BUNDLES_ROUTE_SUBPATH, HANDSHAKE_CAPABILITY_MISSING, HANDSHAKE_CONTRACT_VERSION_MISMATCH, HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH, HANDSHAKE_REQUEST_INVALID, HANDSHAKE_SECRET_MISMATCH, HANDSHAKE_SECRET_UNCONFIGURED, HUMAN_INPUTS_ROUTE_SUBPATH, HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH, HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH, HUMAN_INPUT_REQUEST_ROUTE_SUBPATH, HUMAN_INPUT_RESOLVED_EVENT_PREFIX, type HandlerBundle, type HandlerBundleModule, type HandlerBundlesData, type HandlerBundlesParseResult, type HumanInputActor, type HumanInputOutput, type HumanInputRequestView, type HumanInputResolvedEvent, type HumanInputResponse, INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX, INTERNAL_FILES_ROUTE_PREFIX, INTERNAL_FLOW_RUNS_ROUTE_PREFIX, INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX, INTERNAL_INSTALLATIONS_ROUTE_PREFIX, INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX, INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX, INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX, type InternalFileAccessData, type InternalFileAccessIntent, POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH, POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH, type PackagePollingTriggerRuntimeDescriptor, type PackageWebhookTriggerRuntimeDescriptor, type ParsedFlowRunResultBody, type PartiallyRenderedHumanInputDelivery, type PartiallyRenderedMapping, type PartiallyRenderedTemplatePart, type PartiallyRenderedValue, type PollingPublishBody, type PollingPublishEvent, type PollingRuntimeCredentialBody, type PollingTriggerContext, type PollingTriggerDispatchData, type PollingTriggerGrantBody, type PresignedFileUrlData, type PublishPollingTickEventResult, type PublishPollingTickEventsData, RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS, type RegisterFlowRunWaitBody, type RegisterFlowRunWaitData, type RenderedFlowComposition, type RenderedHumanInputPrompt, type RuntimeCredentialSession, type RuntimeCredentialSessionNetwork, type RuntimeCredentialSessionScopeKind, type RuntimeNetwork, type RuntimeNetworkModel, SERVER_EXECUTION_CONTRACT_VERSION, STEP_RESULT_ROUTE_SUBPATH, type ServerExecutionContractVersion, type SingleToolGrantBody, type StepRecordBody, type StepRecordBodyParseResult, type StepRecordData, type StepRecordResult, TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH, TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH, TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, type ToolHandlerBundlesData, type TriggerConnectionInfo, type TriggerFileRuntimeDispatch, type TriggerHandlerBundlesData, type TriggerHandlerModule, WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH, WEBHOOK_PROTOCOL_ADAPTER_MODULE, WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH, WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH, WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH, WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH, WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION, WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION, type WebhookDelivery, type WebhookDeliveryDispatchData, type WebhookProtocolAdapterBundleData, type WebhookProtocolAdapterModule, type WebhookPublishEvent, type WebhookPublishEventsBody, type WebhookPublishEventsData, type WebhookRearmBody, type WebhookRearmData, type WebhookRuntimeCredentialBody, type WebhookTriggerGrantBody, type WebhookTriggerVerificationMethod, type WebhookWatcherContext, type WfpUserRuntimeManifest, deploymentHandshakeProbePayload, deploymentHandshakeResponseProofPayload, egressGrantAuditPath, egressGrantConsumePath, eventWaitPath, executionContextPath, flowRunEgressGrantPath, flowRunExecutionEventsPath, flowRunResultPath, flowRunRuntimeCredentialPath, flowScriptProtocolAdapterModuleName, handlerBundlesPath, humanInputAcknowledgePath, humanInputExpirePath, humanInputRequestPath, humanInputResolvedEventType, humanInputsPath, internalFileAccessPath, internalFileCompletePath, internalFileContentPath, internalFileStatPath, internalFileUploadSessionPath, internalFilesPath, isValidRequestDigest, parseCompleteFlowRunWaitBody, parseContextStateCleanupRequestBody, parseContextStateCleanupResponseData, parseContextStateScope, parseCreateHumanInputBody, parseEgressGrantAuditBody, parseEgressGrantConsumeBody, parseEgressGrantConsumeData, parseEgressGrantData, parseExecutionContextData, parseFileMetadataData, parseFileRefData, parseFileRuntimeLimits, parseFileUploadSessionData, parseFlowActionGrantBody, parseFlowRunExecutionEventBody, parseFlowRunExecutionEventData, parseFlowRunResultBody, parseFlowRunResultData, parseFlowRuntimeCredentialBody, parseHandlerBundle, parseHandlerBundlesData, parseHumanInputAcknowledgeData, parseHumanInputCreateData, parseHumanInputRequestViewData, parseInternalFileAccessData, parsePollingPublishBody, parsePollingRuntimeCredentialBody, parsePollingTriggerContext, parsePollingTriggerDispatchData, parsePollingTriggerGrantBody, parsePublishPollingTickEventsData, parseRegisterFlowRunWaitBody, parseRegisterFlowRunWaitData, parseRuntimeCredentialSessionCredential, parseRuntimeNetwork, parseSingleToolGrantBody, parseSingleToolRuntimeCredentialBody, parseStepRecordBody, parseStepRecordData, parseToolHandlerBundlesData, parseTriggerFileRuntimeDispatch, parseTriggerHandlerBundlesData, parseWebhookDelivery, parseWebhookDeliveryDispatchData, parseWebhookPublishEventsBody, parseWebhookRearmBody, parseWebhookRuntimeCredentialBody, parseWebhookTriggerGrantBody, parseWebhookWatcherContext, pollingTriggerContextPath, pollingTriggerEgressGrantPath, pollingTriggerHandlerBundlesPath, pollingTriggerRuntimeCredentialPath, pollingTriggerTickEventsPath, requestHasMultipartFileParts, stepResultPath, toolHandlerBundlesPath, toolInvocationEgressGrantPath, toolInvocationRuntimeCredentialPath, webhookProtocolAdapterBundlePath, webhookTriggerContextPath, webhookTriggerDeliveryPath, webhookTriggerEgressGrantPath, webhookTriggerEventsPath, webhookTriggerHandlerBundlesPath, webhookTriggerRearmPath, webhookTriggerRuntimeCredentialPath, wfpUserRuntimeManifestPath };
|
|
922
|
+
export { CONTEXT_STATE_CLEANUP_ROUTE_PATH, type CompleteFlowRunWaitBody, type CompleteFlowRunWaitData, type ContextStateCleanupRequestBody, type ContextStateCleanupResponseData, type ContextStateScope, type CreateHumanInputRequestBody, DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES, DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES, DEPLOYMENT_HANDSHAKE_ROUTE, DISCOVERY_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH, DISCOVERY_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, type DeploymentHandshakeData, type DeploymentHandshakeRequestBody, type DeploymentHandshakeResponse, type DiscoveryDispatchBody, type DiscoveryEgressGrantBinding, type DiscoveryExecutionBinding, type DiscoveryGrantBody, type DiscoveryInvokeRequest, type DiscoveryRuntimeCredentialBinding, EGRESS_GRANT_AUDIT_ROUTE_SUBPATH, EGRESS_GRANT_CONSUME_ROUTE_SUBPATH, EGRESS_GRANT_SCOPE_KINDS, EVENT_WAIT_ROUTE_SUBPATH, EXECUTION_CONTEXT_ROUTE_SUBPATH, type EgressGrant, type EgressGrantAuditBody, type EgressGrantBodyParseResult, type EgressGrantConsumeBody, type EgressGrantCredentialMaterial, type EgressGrantFileRuntime, type EgressGrantScopeKind, type ExecutionBinding, type ExecutionBindingConnection, type ExecutionContextCompiled, type ExecutionContextData, FILE_ACCESS_ROUTE_SUBPATH, FILE_COMPLETE_ROUTE_SUBPATH, FILE_CONTENT_ROUTE_SUBPATH, FILE_STAT_ROUTE_SUBPATH, FILE_UPLOAD_SESSION_ROUTE_SUBPATH, FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH, FLOW_RUN_EXECUTION_EVENTS_ROUTE_SUBPATH, FLOW_RUN_EXECUTION_EVENT_TYPES, FLOW_RUN_RESULT_ROUTE_SUBPATH, FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, type FileMetadataData, type FileRefData, type FileRuntimeLimits, type FileRuntimeScope, type FileRuntimeScopeKind, type FileUploadSessionData, type FlowActionGrantBody, type FlowExecutionContextFileRuntime, type FlowRunExecutionEventBody, type FlowRunExecutionEventData, type FlowRunExecutionEventType, type FlowRunInputFactBody, type FlowRunResultData, type FlowRunResultRequestBody, type FlowRuntimeCredentialBody, HANDLER_BUNDLES_ROUTE_SUBPATH, HANDSHAKE_CAPABILITY_MISSING, HANDSHAKE_CONTRACT_VERSION_MISMATCH, HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH, HANDSHAKE_REQUEST_INVALID, HANDSHAKE_SECRET_MISMATCH, HANDSHAKE_SECRET_UNCONFIGURED, HUMAN_INPUTS_ROUTE_SUBPATH, HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH, HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH, HUMAN_INPUT_REQUEST_ROUTE_SUBPATH, HUMAN_INPUT_RESOLVED_EVENT_PREFIX, type HandlerBundle, type HandlerBundleModule, type HandlerBundlesData, type HandlerBundlesParseResult, type HumanInputActor, type HumanInputOutput, type HumanInputRequestView, type HumanInputResolvedEvent, type HumanInputResponse, INTERNAL_DISCOVERY_INVOCATIONS_ROUTE_PREFIX, INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX, INTERNAL_FILES_ROUTE_PREFIX, INTERNAL_FLOW_RUNS_ROUTE_PREFIX, INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX, INTERNAL_INSTALLATIONS_ROUTE_PREFIX, INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX, INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX, INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX, type IntegrationDiscoverySubject, type InternalFileAccessData, type InternalFileAccessIntent, POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH, POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH, type PackageInputDiscoveryDescriptor, type PackageInputDiscoveryKind, type PackagePollingTriggerRuntimeDescriptor, type PackageWebhookTriggerRuntimeDescriptor, type ParsedFlowRunResultBody, type PartiallyRenderedHumanInputDelivery, type PartiallyRenderedMapping, type PartiallyRenderedTemplatePart, type PartiallyRenderedValue, type PollingPublishBody, type PollingPublishEvent, type PollingRuntimeCredentialBody, type PollingTriggerContext, type PollingTriggerDispatchData, type PollingTriggerGrantBody, type PresignedFileUrlData, type PublishPollingTickEventResult, type PublishPollingTickEventsData, RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS, type RegisterFlowRunWaitBody, type RegisterFlowRunWaitData, type RenderedFlowComposition, type RenderedHumanInputPrompt, type RuntimeCredentialSession, type RuntimeCredentialSessionNetwork, type RuntimeCredentialSessionScopeKind, type RuntimeNetwork, type RuntimeNetworkModel, SERVER_EXECUTION_CONTRACT_VERSION, STEP_RESULT_ROUTE_SUBPATH, type ServerExecutionContractVersion, type SingleToolGrantBody, type StepRecordBody, type StepRecordBodyParseResult, type StepRecordData, type StepRecordResult, TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH, TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH, TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, type ToolHandlerBundlesData, type TriggerConnectionInfo, type TriggerFileRuntimeDispatch, type TriggerHandlerBundlesData, type TriggerHandlerModule, WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH, WEBHOOK_PROTOCOL_ADAPTER_MODULE, WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH, WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH, WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH, WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH, WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION, WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION, type WebhookDelivery, type WebhookDeliveryDispatchData, type WebhookProtocolAdapterBundleData, type WebhookProtocolAdapterModule, type WebhookPublishEvent, type WebhookPublishEventsBody, type WebhookPublishEventsData, type WebhookRearmBody, type WebhookRearmData, type WebhookRuntimeCredentialBody, type WebhookTriggerGrantBody, type WebhookTriggerVerificationMethod, type WebhookWatcherContext, type WfpUserRuntimeManifest, deploymentHandshakeProbePayload, deploymentHandshakeResponseProofPayload, discoveryInvocationEgressGrantPath, discoveryInvocationRuntimeCredentialPath, egressGrantAuditPath, egressGrantConsumePath, eventWaitPath, executionContextPath, flowRunEgressGrantPath, flowRunExecutionEventsPath, flowRunResultPath, flowRunRuntimeCredentialPath, flowScriptProtocolAdapterModuleName, handlerBundlesPath, humanInputAcknowledgePath, humanInputExpirePath, humanInputRequestPath, humanInputResolvedEventType, humanInputsPath, internalFileAccessPath, internalFileCompletePath, internalFileContentPath, internalFileStatPath, internalFileUploadSessionPath, internalFilesPath, isValidRequestDigest, parseCompleteFlowRunWaitBody, parseContextStateCleanupRequestBody, parseContextStateCleanupResponseData, parseContextStateScope, parseCreateHumanInputBody, parseDiscoveryGrantBody, parseDiscoveryRuntimeCredentialBody, parseEgressGrantAuditBody, parseEgressGrantConsumeBody, parseEgressGrantConsumeData, parseEgressGrantData, parseExecutionContextData, parseFileMetadataData, parseFileRefData, parseFileRuntimeLimits, parseFileUploadSessionData, parseFlowActionGrantBody, parseFlowRunExecutionEventBody, parseFlowRunExecutionEventData, parseFlowRunResultBody, parseFlowRunResultData, parseFlowRuntimeCredentialBody, parseHandlerBundle, parseHandlerBundlesData, parseHumanInputAcknowledgeData, parseHumanInputCreateData, parseHumanInputRequestViewData, parseInternalFileAccessData, parsePollingPublishBody, parsePollingRuntimeCredentialBody, parsePollingTriggerContext, parsePollingTriggerDispatchData, parsePollingTriggerGrantBody, parsePublishPollingTickEventsData, parseRegisterFlowRunWaitBody, parseRegisterFlowRunWaitData, parseRuntimeCredentialSessionCredential, parseRuntimeNetwork, parseSingleToolGrantBody, parseSingleToolRuntimeCredentialBody, parseStepRecordBody, parseStepRecordData, parseToolHandlerBundlesData, parseTriggerFileRuntimeDispatch, parseTriggerHandlerBundlesData, parseWebhookDelivery, parseWebhookDeliveryDispatchData, parseWebhookPublishEventsBody, parseWebhookRearmBody, parseWebhookRuntimeCredentialBody, parseWebhookTriggerGrantBody, parseWebhookWatcherContext, pollingTriggerContextPath, pollingTriggerEgressGrantPath, pollingTriggerHandlerBundlesPath, pollingTriggerRuntimeCredentialPath, pollingTriggerTickEventsPath, requestHasMultipartFileParts, stepResultPath, toolHandlerBundlesPath, toolInvocationEgressGrantPath, toolInvocationRuntimeCredentialPath, webhookProtocolAdapterBundlePath, webhookTriggerContextPath, webhookTriggerDeliveryPath, webhookTriggerEgressGrantPath, webhookTriggerEventsPath, webhookTriggerHandlerBundlesPath, webhookTriggerRearmPath, webhookTriggerRuntimeCredentialPath, wfpUserRuntimeManifestPath };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ne="0.2.10";function u(e){return{ok:!0,value:e}}function r(e){return{ok:!1,reason:e}}function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ze="/cleanup-state-scopes";function k(e){if(!i(e)||typeof e.kind!="string")return r("context state scope surface shape is invalid");switch(e.kind){case"webhook-trigger":return re(e);case"polling-trigger":return oe(e);case"flow-action":return ie(e);default:return r("context state scope kind is invalid")}}function Qe(e){if(!i(e))return r("cleanup request body must be a JSON object");let t=b(e,["scopes"]);if(t!==void 0)return r(`cleanup request does not accept the "${t}" field`);if(!Array.isArray(e.scopes))return r("cleanup request scopes must be an array");let n=[];for(let o of e.scopes){let s=k(o);if(!s.ok)return s;n.push(s.value)}return u({scopes:n})}function Ze(e){return!i(e)||typeof e.deleted!="number"||!Number.isSafeInteger(e.deleted)||e.deleted<0?r("cleanup response data surface shape is invalid"):u({deleted:e.deleted})}function re(e){let t=b(e,["kind","workspaceId","triggerInstanceId"]);return t!==void 0?r(`webhook trigger scope does not accept "${t}"`):e.kind!=="webhook-trigger"||!R(e.workspaceId)||!R(e.triggerInstanceId)?r("webhook trigger state scope is invalid"):u({kind:"webhook-trigger",workspaceId:e.workspaceId,triggerInstanceId:e.triggerInstanceId})}function oe(e){let t=b(e,["kind","workspaceId","pollingInstanceId"]);return t!==void 0?r(`polling trigger scope does not accept "${t}"`):e.kind!=="polling-trigger"||!R(e.workspaceId)||!R(e.pollingInstanceId)?r("polling trigger state scope is invalid"):u({kind:"polling-trigger",workspaceId:e.workspaceId,pollingInstanceId:e.pollingInstanceId})}function ie(e){let t=b(e,["kind","workspaceId","flowId","nodeId","connectionId"]);if(t!==void 0)return r(`flow action scope does not accept "${t}"`);let n=e.connectionId;return e.kind!=="flow-action"||!R(e.workspaceId)||!R(e.flowId)||!R(e.nodeId)||n!==null&&!R(n)?r("flow action state scope is invalid"):u({kind:"flow-action",workspaceId:e.workspaceId,flowId:e.flowId,nodeId:e.nodeId,connectionId:n})}function R(e){return typeof e=="string"&&e.length>0}function b(e,t){return Object.keys(e).find(n=>!t.includes(n))}var g="/internal/flow-runs",rt="/:flowRunId/execution-context";function ot(e){return`${g}/${encodeURIComponent(e)}/execution-context`}function F(e){return!i(e)||!B(e.fileMaxBytes)||!B(e.fileReadMaxBytes)||!B(e.inlineMultipartBytesMax)?r("file runtime limits must carry three positive integer bounds"):u({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function it(e){if(!i(e))return r("execution context must be a JSON object");let t=e.compiled;if(typeof e.flowRunId!="string"||typeof e.workspaceId!="string"||!i(e.input)||!i(t)||typeof t.irSchemaVersion!="string"||typeof t.interpreterContractVersion!="string"||typeof t.compiledArtifactId!="string"||!i(t.ir)||!Array.isArray(t.ir.nodes)||!ue(e.executionBindings))return r("execution context surface shape is invalid");let n=se(e.fileRuntime);return n.ok?u({...e,fileRuntime:n.value}):r(n.reason)}function se(e){if(e===null)return u(null);if(!i(e))return r("fileRuntime must be null or an object");let t=F(e.limits);return t.ok?u({limits:t.value}):r(t.reason)}function ue(e){return Array.isArray(e)?e.every(t=>{if(!i(t))return!1;let n=t.connection,o=k(t.stateScope);return typeof t.nodeId=="string"&&typeof t.toolRef=="string"&&i(t.toolDescriptor)&&i(t.integrationDescriptor)&&i(n)&&typeof n.installationId=="string"&&typeof n.connectionRef=="string"&&typeof n.connectionId=="string"&&typeof n.authProfileRef=="string"&&typeof n.authType=="string"&&o.ok}):!1}function B(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}import{parseAblehiErrorDigest as H}from"@ablehi/error-contract";var ct="/:flowRunId/steps/:nodeId/result",lt="/:flowRunId/result",pt="/:flowRunId/execution-events",ft="/:flowRunId/event-waits/:nodeId";function gt(e,t){return`${g}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function mt(e){return`${g}/${encodeURIComponent(e)}/result`}function Rt(e){return`${g}/${encodeURIComponent(e)}/execution-events`}function yt(e,t){return`${g}/${encodeURIComponent(e)}/event-waits/${encodeURIComponent(t)}`}function kt(e){if(!i(e))return{ok:!1,kind:"validation",reason:"step record body must be a JSON object"};let t=m(e,["attempt","result","durationMs"]);if(t!==void 0)return{ok:!1,kind:"validation",reason:`step record does not accept the "${t}" field`};let n=e.attempt;if(typeof n!="number"||!Number.isInteger(n)||n<=0)return{ok:!1,kind:"validation",reason:"attempt must be a positive integer"};let o=ae(e.result);if(!o.ok)return o;let s={attempt:n,result:o.value};if(e.durationMs!==void 0){let d=e.durationMs;if(typeof d!="number"||!Number.isFinite(d)||d<0)return{ok:!1,kind:"validation",reason:"durationMs must be a non-negative number"};s.durationMs=d}return{ok:!0,value:s}}function ae(e){if(!i(e))return{ok:!1,kind:"step_result_invalid",reason:"result must be a JSON object"};let t=e.status;if(t==="succeeded"){let n=m(e,["status","output"]);return n!==void 0?{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`}:"output"in e?{ok:!0,value:{status:"succeeded",output:e.output}}:{ok:!1,kind:"step_result_invalid",reason:"a succeeded result must carry output"}}if(t==="failed"){let n=m(e,["status","error"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=H(e.error);return o.ok?{ok:!0,value:{status:"failed",error:o.value}}:{ok:!1,kind:"step_result_invalid",reason:`a failed result must carry an AblehiErrorDigest: ${o.reason}`}}if(t==="skipped"){let n=m(e,["status","reason"]);return n!==void 0?{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`}:e.reason!=="run_if_false"?{ok:!1,kind:"step_result_invalid",reason:'a skipped result reason must be "run_if_false"'}:{ok:!0,value:{status:"skipped",reason:"run_if_false"}}}if(t==="timed_out"){let n=m(e,["status","error"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=H(e.error);return o.ok?{ok:!0,value:{status:"timed_out",error:o.value}}:{ok:!1,kind:"step_result_invalid",reason:`a timed_out result must carry an AblehiErrorDigest: ${o.reason}`}}return{ok:!1,kind:"step_result_invalid",reason:'result status must be "succeeded", "failed", "skipped", or "timed_out"'}}function It(e){return!i(e)||typeof e.flowRunId!="string"||typeof e.nodeId!="string"||!de(e.recorded)?r("step record data surface shape is invalid"):u({flowRunId:e.flowRunId,nodeId:e.nodeId,recorded:e.recorded})}function de(e){return e==="succeeded"||e==="failed"||e==="skipped"||e==="timed_out"}function _t(e){if(!i(e))return r("result body must be a JSON object");let t=m(e,["status","output","error","composition"]);if(t!==void 0)return r(`result does not accept the "${t}" field`);let n=e.status;if(n!=="succeeded"&&n!=="failed")return r('result status must be "succeeded" or "failed"');let o={status:n};if(e.output!==void 0){if(n!=="succeeded")return r("output is only allowed on a succeeded result");o.output=e.output}if(e.error!==void 0){if(n!=="failed")return r("error is only allowed on a failed result");let s=H(e.error);if(!s.ok)return r(`result error must be an AblehiErrorDigest: ${s.reason}`);o.error=s.value}if(n==="failed"&&o.error===void 0)return r("a failed result must carry an AblehiErrorDigest");if(e.composition!==void 0){if(n!=="succeeded")return r("composition is only allowed on a succeeded result");o.composition=e.composition}return u(o)}function ht(e){return i(e)?u(e):r("flow run result data must be a JSON object")}var ce=["flow_run_started","step_started","step_retry_scheduled","wait_registered","wait_event_received","wait_event_timed_out","human_input_created","human_input_submitted","human_input_expired","flow_run_succeeded","flow_run_failed","flow_run_interrupted","flow_run_cancelled"];function wt(e){if(!i(e))return r("execution event data must be a JSON object");let t=m(e,["flowRunId","eventId","accepted"]);return t!==void 0?r(`execution event data does not accept the "${t}" field`):typeof e.flowRunId!="string"||e.flowRunId.length===0?r("flowRunId must be a non-empty string"):typeof e.eventId!="string"||e.eventId.length===0?r("eventId must be a non-empty string"):e.accepted!==!0?r("accepted must be true"):u({flowRunId:e.flowRunId,eventId:e.eventId,accepted:!0})}function Et(e){if(!i(e))return r("execution event body must be a JSON object");let t=m(e,["eventId","eventType","nodeId","stepRunId","attempt","durationMs","occurredAt","errorId","payloadRef","inputFact"]);if(t!==void 0)return r(`execution event does not accept the "${t}" field`);let n=e.eventId;if(typeof n!="string"||n.length===0)return r("eventId must be a non-empty string");let o=e.eventType;if(!le(o))return r("eventType is not a known flow execution event type");let s=e.occurredAt;if(typeof s!="string"||s.length===0)return r("occurredAt must be a non-empty string");let d={eventId:n,eventType:o,occurredAt:s};for(let a of["nodeId","stepRunId","errorId","payloadRef"]){let c=e[a];if(c!==void 0){if(typeof c!="string"||c.length===0)return r(`${a} must be a non-empty string`);d[a]=c}}for(let a of["attempt","durationMs"]){let c=e[a];if(c!==void 0){if(typeof c!="number"||!Number.isFinite(c)||!Number.isInteger(c)||c<0)return r(`${a} must be a non-negative integer`);d[a]=c}}if(e.inputFact!==void 0){if(o!=="step_started")return r("inputFact is only allowed on step_started events");if(d.attempt===void 0)return r("inputFact requires attempt");let a=pe(e.inputFact);if(!a.ok)return a;d.inputFact=a.value}return u(d)}function le(e){return typeof e=="string"&&ce.includes(e)}function pe(e){if(!i(e))return r("inputFact must be a JSON object");let t=m(e,["digestAlgorithm","digest","domain"]);if(t!==void 0)return r(`inputFact does not accept the "${t}" field`);if(e.digestAlgorithm!=="sha256")return r('inputFact.digestAlgorithm must be "sha256"');let n=e.digest;if(typeof n!="string"||!/^[0-9a-f]{64}$/.test(n))return r("inputFact.digest must be a sha256 hex string");let o=e.domain;if(!i(o))return r("inputFact.domain must be a JSON object");let s=m(o,["irSchemaVersion","interpreterContractVersion","compiledArtifactId","nodeId","algorithmVersion"]);return s!==void 0?r(`inputFact.domain does not accept the "${s}" field`):typeof o.irSchemaVersion!="string"||o.irSchemaVersion.length===0||typeof o.interpreterContractVersion!="string"||o.interpreterContractVersion.length===0||typeof o.compiledArtifactId!="string"||o.compiledArtifactId.length===0||typeof o.nodeId!="string"||o.nodeId.length===0?r("inputFact.domain string fields must be non-empty strings"):o.algorithmVersion!=="flow_input_digest.v1"?r('inputFact.domain.algorithmVersion must be "flow_input_digest.v1"'):u({digestAlgorithm:"sha256",digest:n,domain:{irSchemaVersion:o.irSchemaVersion,interpreterContractVersion:o.interpreterContractVersion,compiledArtifactId:o.compiledArtifactId,nodeId:o.nodeId,algorithmVersion:"flow_input_digest.v1"}})}var fe=/^[A-Za-z0-9_-]{1,100}$/;function xt(e){if(!i(e))return r("register body must be a JSON object");let t=m(e,["eventType","correlationKey"]);if(t!==void 0)return r(`register wait does not accept the "${t}" field`);let n=V(e.eventType);if(!n.ok)return r(n.reason);let o=e.correlationKey;return typeof o!="string"||o.length===0?r("correlationKey must be a non-empty string"):u({eventType:n.value,correlationKey:o})}function Tt(e){if(!i(e))return r("complete body must be a JSON object");let t=m(e,["eventType","correlationKey","outcome","eventId"]);if(t!==void 0)return r(`complete wait does not accept the "${t}" field`);let n=e.outcome;if(n!=="received"&&n!=="timed_out")return r('outcome must be "received" or "timed_out"');let o=V(e.eventType);if(!o.ok)return r(o.reason);let s=e.correlationKey;if(typeof s!="string"||s.length===0)return r("correlationKey must be a non-empty string");let d={eventType:o.value,correlationKey:s,outcome:n};if(e.eventId!==void 0){if(typeof e.eventId!="string"||e.eventId.length===0)return r("eventId must be a non-empty string");d.eventId=e.eventId}return u(d)}function Pt(e){return!i(e)||e.registered!==!0?r("register wait data surface shape is invalid"):u({registered:!0})}function V(e){return typeof e!="string"||e.length===0?r("eventType must be a non-empty string"):fe.test(e)?u(e):r("eventType must match ^[A-Za-z0-9_-]{1,100}$")}function m(e,t){return Object.keys(e).find(n=>!t.includes(n))}var ge="/internal/flow-versions",vt="/:flowVersionId/handler-bundles",M="/internal/installations",bt="/:installationId/handler-bundles";function Ct(e,t){return`${ge}/${encodeURIComponent(e)}/handler-bundles?compiledArtifactId=${encodeURIComponent(t)}`}function At(e){return`${M}/${encodeURIComponent(e.installationId)}/handler-bundles?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var me=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function C(e){if(!_(e))return $("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!me.has(t)?$("runtimeNetwork.networkModel is unknown"):!j(e.apiHosts)||!j(e.authHosts)||typeof e.httpsOnly!="boolean"?$("runtimeNetwork host/https fields are invalid"):{ok:!0,value:{networkModel:t,apiHosts:e.apiHosts,authHosts:e.authHosts,httpsOnly:e.httpsOnly}}}function Nt(e){if(!_(e)||typeof e.flowVersionId!="string"||typeof e.compiledArtifactId!="string"||!Array.isArray(e.bundles))return E("handler bundles data surface shape is invalid");let t=J(e.bundles);return t.ok?{ok:!0,value:{flowVersionId:e.flowVersionId,compiledArtifactId:e.compiledArtifactId,bundles:t.value}}:t}function Dt(e){if(!_(e)||typeof e.installationId!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.bundles))return E("tool handler bundles data surface shape is invalid");let t=J(e.bundles);return t.ok?{ok:!0,value:{installationId:e.installationId,artifactDigest:e.artifactDigest,bundles:t.value}}:t}function J(e){let t=[];for(let n of e){let o=Re(n);if(!o.ok)return o;t.push(o.value)}return{ok:!0,value:t}}function Re(e){if(!_(e)||typeof e.toolRef!="string"||e.kind!=="handler"&&e.kind!=="request")return E("handler bundle entry shape is invalid");if(e.kind==="request"){if(e.module!==void 0)return E("a request bundle must not carry a module");let o=C(e.runtimeNetwork);return o.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"request",runtimeNetwork:o.value}}:o}let t=e.module;if(!_(t)||typeof t.entry!="string"||t.entry.length===0||!ye(t.files))return E("a handler bundle must carry a { entry, files } module");let n=C(e.runtimeNetwork);return n.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"handler",module:{entry:t.entry,files:t.files},runtimeNetwork:n.value}}:n}function E(e){return{ok:!1,kind:"shape",reason:e}}function $(e){return{ok:!1,kind:"runtime_network",reason:e}}function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function j(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ye(e){return _(e)&&Object.values(e).every(t=>typeof t=="string")}var x="/internal/webhook-trigger-instances",Mt="/:triggerInstanceId/context",Gt="/:triggerInstanceId/handler-bundles",Kt="/:triggerInstanceId/deliveries/:deliveryId",Lt="/:triggerInstanceId/events",qt="/:triggerInstanceId/rearm",T=e=>`${x}/${encodeURIComponent(e)}`;function Wt(e,t){return`${T(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function Vt(e,t){return`${T(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function jt(e,t){return`${T(e)}/deliveries/${encodeURIComponent(t)}`}function Jt(e){return`${T(e)}/events`}function Xt(e){return`${T(e)}/rearm`}var Yt="/:installationId/webhook-protocol-adapter-bundle";function zt(e){return`${M}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var Qt="modules/webhook/protocol-adapter.js";function Zt(e){return`modules/webhook/protocol-adapter-${e}.js`}function en(e){let t=i(e)?k(e.stateScope):r("webhook watcher context state scope is invalid");return!i(e)||typeof e.artifactDigest!="string"||typeof e.triggerRef!="string"||typeof e.triggerName!="string"||typeof e.integrationRef!="string"||!i(e.inputs)||e.connection!==null&&!ke(e.connection)||!Ie(e.runtime)||!t.ok||t.value.kind!=="webhook-trigger"?r("webhook watcher context surface shape is invalid"):u(e)}function ke(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authProfileRef=="string"&&typeof e.authType=="string"}function Ie(e){if(!i(e)||e.type!=="webhook"||typeof e.trigger_ref!="string")return!1;let t=e.webhook;return i(t)&&typeof t.event_handler_module=="string"&&typeof t.enable_handler_module=="string"&&typeof t.disable_handler_module=="string"}function _e(e){if(!i(e)||typeof e.deliveryId!="string"||typeof e.receivedAt!="string"||!i(e.request))return r("webhook delivery surface shape is invalid");let t=e.request;return t.method!=="POST"||!i(t.headers)||typeof t.rawBody!="string"?r("webhook delivery request shape is invalid"):u(e)}function G(e){if(!i(e)||typeof e.token!="string"||typeof e.expiresAt!="string")return r("trigger file runtime dispatch shape is invalid");let t=F(e.limits);return t.ok?u({token:e.token,expiresAt:e.expiresAt,limits:t.value}):r(t.reason)}function tn(e){if(!i(e))return r("webhook delivery dispatch data is invalid");let t=_e(e.delivery);if(!t.ok)return r(t.reason);let n=e.fileRuntime;if(n===null)return u({delivery:t.value,fileRuntime:null});let o=G(n);return o.ok?u({delivery:t.value,fileRuntime:o.value}):r(o.reason)}function nn(e){if(!i(e)||typeof e.triggerRef!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.modules)||!e.modules.every(he))return{ok:!1,kind:"shape",reason:"trigger handler bundles data surface shape is invalid"};let t=C(e.runtimeNetwork);return t.ok?{ok:!0,value:{triggerRef:e.triggerRef,artifactDigest:e.artifactDigest,modules:e.modules,runtimeNetwork:t.value}}:t}function he(e){return i(e)&&typeof e.specifier=="string"&&e.specifier.length>0&&typeof e.source=="string"}function rn(e){if(!i(e))return r("publish events body must be a JSON object");let t=K(e,["deliveryId","events"]);if(t!==void 0)return r(`publish events does not accept the "${t}" field`);let n=e.deliveryId;if(typeof n!="string"||n.length===0)return r("deliveryId must be a non-empty string");let o=e.events;if(!Array.isArray(o))return r("events must be an array");let s=[];for(let d of o){let a=we(d);if(!a.ok)return a;s.push(a.value)}return u({deliveryId:n,events:s})}function we(e){if(!i(e))return r("each event must be a JSON object");let t=K(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return r(`event does not accept the "${t}" field`);let n=e.eventId;if(typeof n!="string"||n.length===0)return r("eventId must be a non-empty string");let o=e.occurredAt;if(typeof o!="string"||o.length===0)return r("occurredAt must be a non-empty string");if(!i(e.payload))return r("event payload must be a JSON object");let s={eventId:n,occurredAt:o,payload:e.payload};if(e.dedupeKey!==void 0){if(typeof e.dedupeKey!="string"||e.dedupeKey.length===0)return r("dedupeKey must be a non-empty string");s.dedupeKey=e.dedupeKey}return u(s)}function on(e){if(!i(e))return r("rearm body must be a JSON object");let t=K(e,["expectedWatcherInstanceId"]);if(t!==void 0)return r(`rearm does not accept the "${t}" field`);let n=e.expectedWatcherInstanceId;return typeof n!="string"||n.length===0?r("expectedWatcherInstanceId must be a non-empty string"):u({expectedWatcherInstanceId:n})}function K(e,t){return Object.keys(e).find(n=>!t.includes(n))}var P="/internal/polling-trigger-instances",cn="/:pollingInstanceId/context",ln="/:pollingInstanceId/handler-bundles",pn="/:pollingInstanceId/ticks/:tickId/events",L=e=>`${P}/${encodeURIComponent(e)}`;function fn(e,t,n){return`${L(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function gn(e,t){return`${L(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function mn(e,t){return`${L(e)}/ticks/${encodeURIComponent(t)}/events`}function Ee(e){let t=i(e)?k(e.stateScope):r("polling trigger context state scope is invalid");return!i(e)||typeof e.artifactDigest!="string"||typeof e.triggerRef!="string"||typeof e.triggerName!="string"||typeof e.integrationRef!="string"||!i(e.inputs)||e.connection!==null&&!xe(e.connection)||!Te(e.runtime)||!t.ok||t.value.kind!=="polling-trigger"||!Pe(e.tick)||!Se(e.limits)?r("polling trigger context surface shape is invalid"):u(e)}function Rn(e){if(!i(e))return r("polling trigger dispatch data is invalid");let t=Ee(e.context);if(!t.ok)return r(t.reason);let n=e.fileRuntime;if(n===null)return u({context:t.value,fileRuntime:null});let o=G(n);return o.ok?u({context:t.value,fileRuntime:o.value}):r(o.reason)}function xe(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authProfileRef=="string"&&typeof e.authType=="string"}function Te(e){if(!i(e)||e.type!=="polling"||typeof e.trigger_id!="string"||typeof e.trigger_ref!="string")return!1;let t=e.polling;if(!i(t)||typeof t.run_handler_module!="string")return!1;let n=t.schedule;if(!i(n)||n.type!=="interval"||typeof n.every_seconds!="number")return!1;let o=t.dedup;return i(o)&&(o.strategy==="cursor"||o.strategy==="hash"||o.strategy==="id_field")}function Pe(e){return i(e)&&typeof e.tickId=="string"&&typeof e.scheduledAt=="string"&&typeof e.attempt=="number"}function Se(e){return i(e)&&typeof e.maxEventsPerTick=="number"}function yn(e){if(!i(e))return r("publish body must be a JSON object");let t=X(e,["events","nextCursor"]);if(t!==void 0)return r(`publish does not accept the "${t}" field`);let n=e.events;if(!Array.isArray(n))return r("events must be an array");let o=[];for(let d of n){let a=ve(d);if(!a.ok)return a;o.push(a.value)}let s={events:o};if("nextCursor"in e){let d=e.nextCursor;if(d!==null&&typeof d!="string")return r("nextCursor must be a string, null, or omitted");s.nextCursor=d}return u(s)}function ve(e){if(!i(e))return r("each event must be a JSON object");let t=X(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return r(`event does not accept the "${t}" field`);if(typeof e.eventId!="string"||e.eventId.length===0)return r("event eventId must be a non-empty string");if(!i(e.payload))return r("event payload must be a JSON object");let n={eventId:e.eventId,payload:e.payload};if(e.occurredAt!==void 0){if(typeof e.occurredAt!="string"||e.occurredAt.length===0)return r("event occurredAt must be a non-empty string");n.occurredAt=e.occurredAt}if(e.dedupeKey!==void 0){if(typeof e.dedupeKey!="string"||e.dedupeKey.length===0)return r("event dedupeKey must be a non-empty string");n.dedupeKey=e.dedupeKey}return u(n)}function kn(e){return!i(e)||typeof e.tickId!="string"||typeof e.cursorUpdated!="boolean"||!Array.isArray(e.results)||!e.results.every(be)?r("publish polling tick events data surface shape is invalid"):u(e)}function be(e){return i(e)&&typeof e.eventId=="string"&&typeof e.dedupeKey=="string"&&typeof e.duplicate=="boolean"&&(e.flowRunId===null||typeof e.flowRunId=="string")}function X(e,t){return Object.keys(e).find(n=>!t.includes(n))}var Y="/internal/egress-grants",q="/internal/tool-invocations",xn="/:flowRunId/egress-grant",Tn="/:invocationId/egress-grant",Pn="/:pollingInstanceId/egress-grant",Sn="/:triggerInstanceId/egress-grant",vn="/:grantId/consume",bn="/:grantId/audit",Cn=e=>`${g}/${encodeURIComponent(e)}/egress-grant`,An=e=>`${q}/${encodeURIComponent(e)}/egress-grant`,Nn=e=>`${P}/${encodeURIComponent(e)}/egress-grant`,Dn=e=>`${x}/${encodeURIComponent(e)}/egress-grant`,On=e=>`${Y}/${encodeURIComponent(e)}/consume`,Un=e=>`${Y}/${encodeURIComponent(e)}/audit`,Ce=["flow_action","single_tool","polling_trigger","webhook_trigger"],Ae=/^[A-Za-z0-9][A-Za-z0-9:_+/=.-]{15,1023}$/;function S(e){return typeof e=="string"&&Ae.test(e)}function Ne(e){if(!i(e)||e.body_type!=="multipart")return!1;let t=e.body;if(!i(t))return!1;let n=t.parts;return Array.isArray(n)?n.some(o=>i(o)?o.kind==="file"&&typeof o.file_id=="string"&&o.file_id.length>0:!1):!1}function l(e){return{ok:!1,kind:"shape",reason:e}}function v(){return{ok:!1,kind:"request_digest",reason:"request digest is missing or malformed"}}function N(e,t){if(!i(e))return{ok:!1,reason:"grant request body must be a JSON object"};for(let n of Object.keys(e))if(!t.includes(n))return{ok:!1,reason:`grant request does not accept the "${n}" field`};return{ok:!0,record:e}}function D(e){if(!i(e))return"request must be a JSON object"}function Bn(e){let t=N(e,["nodeId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.nodeId;if(typeof n!="string"||n.length===0)return l("nodeId is required");let o=D(t.record.request);if(o!==void 0)return l(o);let s=t.record.requestDigest;return S(s)?{ok:!0,value:{nodeId:n,requestDigest:s,requestHasMultipartFiles:Ne(t.record.request)}}:v()}function Fn(e){let t=N(e,["request","requestDigest"]);if(!t.ok)return l(t.reason);let n=D(t.record.request);if(n!==void 0)return l(n);let o=t.record.requestDigest;return S(o)?{ok:!0,value:{requestDigest:o}}:v()}function Hn(e){let t=N(e,["tickId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.tickId;if(typeof n!="string"||n.length===0)return l("tickId is required");let o=D(t.record.request);if(o!==void 0)return l(o);let s=t.record.requestDigest;return S(s)?{ok:!0,value:{tickId:n,requestDigest:s}}:v()}function $n(e){let t=N(e,["phase","lifecycle","deliveryId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.phase;if(n!=="lifecycle"&&n!=="handler")return l('phase must be "lifecycle" or "handler"');let o=t.record.lifecycle,s;if(o!==void 0){if(o!=="enable"&&o!=="disable"&&o!=="renew")return l('lifecycle must be "enable", "disable", or "renew"');s=o}if(n==="lifecycle"&&s===void 0)return l("lifecycle is required for the lifecycle phase");let d=t.record.deliveryId,a;if(d!==void 0){if(typeof d!="string"||d.length===0)return l("deliveryId must be a non-empty string");a=d}if(n==="handler"&&a===void 0)return l("deliveryId is required for the handler phase");let c=D(t.record.request);if(c!==void 0)return l(c);let I=t.record.requestDigest;return S(I)?{ok:!0,value:{phase:n,...s!==void 0?{lifecycle:s}:{},...a!==void 0?{deliveryId:a}:{},requestDigest:I}}:v()}function z(e){return Ce.includes(e)?e:void 0}var De=["scopeKind","scopeId","requestDigest"];function Mn(e){if(!i(e))return l("consume body must be a JSON object");for(let s of Object.keys(e))if(!De.includes(s))return l(`consume does not accept the "${s}" field`);let t=z(e.scopeKind);if(t===void 0)return l("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return l("scopeId is required");let o=e.requestDigest;return S(o)?{ok:!0,value:{scopeKind:t,scopeId:n,requestDigest:o}}:v()}var Oe=["scopeKind","scopeId","providerHost","status","durationMs","requestBytes","responseBytes","errorCode"];function A(e,t){return typeof e!="number"||!Number.isInteger(e)||e<0?{ok:!1,reason:`${t} must be a non-negative integer`}:{ok:!0,value:e}}function Gn(e){if(!i(e))return l("audit body must be a JSON object");for(let p of Object.keys(e))if(!Oe.includes(p))return l(`audit does not accept the "${p}" field`);let t=z(e.scopeKind);if(t===void 0)return l("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return l("scopeId is required");let o=e.providerHost;if(typeof o!="string"||o.length===0)return l("providerHost is required");let s=A(e.durationMs,"durationMs");if(!s.ok)return l(s.reason);let d;if(e.status!==void 0){let p=A(e.status,"status");if(!p.ok)return l(p.reason);d=p.value}let a;if(e.requestBytes!==void 0){let p=A(e.requestBytes,"requestBytes");if(!p.ok)return l(p.reason);a=p.value}let c;if(e.responseBytes!==void 0){let p=A(e.responseBytes,"responseBytes");if(!p.ok)return l(p.reason);c=p.value}let I;if(e.errorCode!==void 0){let p=e.errorCode;if(typeof p!="string"||p.length===0)return l("errorCode must be a non-empty string");I=p}return{ok:!0,value:{scopeKind:t,scopeId:n,providerHost:o,...d!==void 0?{status:d}:{},durationMs:s.value,...a!==void 0?{requestBytes:a}:{},...c!==void 0?{responseBytes:c}:{},...I!==void 0?{errorCode:I}:{}}}}function Kn(e){return!i(e)||!i(e.grant)?r("egress grant envelope must carry a grant object"):u(e.grant)}function Ln(e){return!i(e)||e.consumed!==!0?r("egress grant consume data must carry consumed:true"):u({consumed:!0})}var Yn="/:flowRunId/runtime-credential",zn="/:invocationId/runtime-credential",Qn="/:pollingInstanceId/runtime-credential",Zn="/:triggerInstanceId/runtime-credential",er=e=>`${g}/${encodeURIComponent(e)}/runtime-credential`,tr=e=>`${q}/${encodeURIComponent(e)}/runtime-credential`,nr=e=>`${P}/${encodeURIComponent(e)}/runtime-credential`,rr=e=>`${x}/${encodeURIComponent(e)}/runtime-credential`,or=["flow_action","tool_invoke","polling_trigger","webhook_trigger"];function O(e,t){if(!i(e))return{ok:!1,reason:"runtime credential request body must be a JSON object"};for(let n of Object.keys(e))if(!t.includes(n))return{ok:!1,reason:`runtime credential request does not accept the "${n}" field`};return{ok:!0,record:e}}function ir(e){let t=O(e,["nodeId"]);if(!t.ok)return r(t.reason);let n=t.record.nodeId;return typeof n!="string"||n.length===0?r("nodeId is required"):u({nodeId:n})}function sr(e){let t=O(e??{},[]);return t.ok?u(null):r(t.reason)}function ur(e){let t=O(e,["tickId"]);if(!t.ok)return r(t.reason);let n=t.record.tickId;return typeof n!="string"||n.length===0?r("tickId is required"):u({tickId:n})}function ar(e){let t=O(e,["executionKind","deliveryId","lifecycleOperation"]);if(!t.ok)return r(t.reason);let n=t.record.executionKind;if(n!=="event_handler"&&n!=="lifecycle")return r('executionKind must be "event_handler" or "lifecycle"');let o,s=t.record.deliveryId;if(s!==void 0){if(typeof s!="string"||s.length===0)return r("deliveryId must be a non-empty string");o=s}let d,a=t.record.lifecycleOperation;if(a!==void 0){if(a!=="enable"&&a!=="disable"&&a!=="renew")return r('lifecycleOperation must be "enable", "disable", or "renew"');d=a}return n==="lifecycle"&&d===void 0?r("lifecycleOperation is required for the lifecycle execution kind"):u({executionKind:n,...o!==void 0?{deliveryId:o}:{},...d!==void 0?{lifecycleOperation:d}:{}})}function dr(e){return!i(e)||typeof e.sessionId!="string"||typeof e.connectionId!="string"||typeof e.authProfileRef!="string"||typeof e.authType!="string"||!i(e.credential)?r("runtime credential session must carry sessionId, connectionId, auth profile facts and a credential object"):u(e.credential)}function U(e){return!i(e)||typeof e.file_id!="string"||typeof e.name!="string"||typeof e.size_bytes!="number"||typeof e.created_at!="string"||typeof e.expires_at!="string"||e.mime_type!==void 0&&typeof e.mime_type!="string"||e.sha256!==void 0&&typeof e.sha256!="string"||e.source!==void 0&&typeof e.source!="string"?r("file ref data does not match the AIS file-ref shape"):u(e)}function W(e){return!i(e)||e.method!=="GET"&&e.method!=="PUT"||typeof e.url!="string"||typeof e.expires_at!="string"||!Fe(e.headers)?r("presigned file URL data is invalid"):u(e)}function Ue(e){if(!i(e))return r("file upload session data is invalid");let t=U(e.file);if(!t.ok)return r(t.reason);let n=W(e.upload);return n.ok?u({file:t.value,upload:n.value}):r(n.reason)}function Be(e){if(!i(e))return r("file metadata data is invalid");let t=U(e.file);return t.ok?u({file:t.value}):r(t.reason)}function Fe(e){return i(e)?Object.values(e).every(t=>typeof t=="string"):!1}var h="/internal/files",mr="/upload-session",Rr="/:fileId/complete",yr="/:fileId/access",kr="/:fileId/stat",Ir="/:fileId/content",_r=()=>h,hr=()=>`${h}/upload-session`,wr=e=>`${h}/${encodeURIComponent(e)}/complete`,Er=(e,t)=>`${h}/${encodeURIComponent(e)}/access?intent=${encodeURIComponent(t)}`,Q=e=>`?scope_kind=${encodeURIComponent(e.scopeKind)}&scope_id=${encodeURIComponent(e.scopeId)}`,xr=(e,t)=>`${h}/${encodeURIComponent(e)}/stat${Q(t)}`,Tr=(e,t)=>`${h}/${encodeURIComponent(e)}/content${Q(t)}`;function Pr(e){if(!i(e))return r("internal file access data is invalid");if(e.intent==="runtime_read"||e.intent==="provider_multipart"){let t=U(e.file);if(!t.ok)return r(t.reason);let n=W(e.access);return n.ok?u({file:t.value,access:n.value,intent:e.intent}):r(n.reason)}return r("internal file access intent is invalid")}var Cr="/:flowRunId/human-inputs",Ar="/:flowRunId/human-inputs/:requestId",Nr="/:flowRunId/human-inputs/:requestId/expire",Dr="/:flowRunId/human-inputs/:requestId/acknowledge",He=e=>`${g}/${encodeURIComponent(e)}/human-inputs`,Z=(e,t)=>`${He(e)}/${encodeURIComponent(t)}`,Or=(e,t)=>`${Z(e,t)}/expire`,Ur=(e,t)=>`${Z(e,t)}/acknowledge`,$e="human_input_resolved";function Br(e){return`${$e}_${e}`}function f(e){return{ok:!1,reason:e}}function y(e,t){return i(e)?{ok:!0,value:e}:f(`${t} must be an object`)}function w(e,t){return typeof e!="string"||e.length===0?f(`${t} must be a non-empty string`):{ok:!0,value:e}}var Me=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function Ge(e,t){return typeof e!="string"||!Me.test(e)||Number.isNaN(Date.parse(e))?f(`${t} must be an ISO-8601 timestamp`):{ok:!0,value:e}}function Ke(e){let t=y(e,"renderedPrompt");if(!t.ok)return t;let n=w(t.value.title,"renderedPrompt.title");if(!n.ok)return n;let o={title:n.value};if(t.value.body!==void 0){if(typeof t.value.body!="string")return f("renderedPrompt.body must be a string");o.body=t.value.body}if(t.value.format!==void 0){if(t.value.format!=="plain"&&t.value.format!=="markdown")return f("renderedPrompt.format is invalid");o.format=t.value.format}return{ok:!0,value:o}}function Le(e){let t=y(e,"input");if(!t.ok)return t;let n=t.value.kind;if(n==="choice"){if(!Array.isArray(t.value.choices))return f("input.choices must be an array")}else if(n!=="text")if(n==="form"){if(!Array.isArray(t.value.fields))return f("input.fields must be an array")}else return f("input.kind is invalid");return{ok:!0,value:t.value}}function qe(e){if(e==null)return{ok:!0,value:void 0};let t=y(e,"partiallyRenderedDelivery");if(!t.ok)return t;let n=t.value.actions;if(n===void 0)return{ok:!0,value:{}};if(!Array.isArray(n))return f("partiallyRenderedDelivery.actions must be an array");let o=[];for(let s of n){let d=y(s,"delivery action");if(!d.ok)return d;let a=w(d.value.id,"delivery action id");if(!a.ok)return a;let c=ee(d.value.inputs,`delivery action '${a.value}' inputs`);if(!c.ok)return c;o.push({id:a.value,inputs:c.value})}return{ok:!0,value:{actions:o}}}function ee(e,t){let n=y(e,t);if(!n.ok)return n;let o={};for(let[s,d]of Object.entries(n.value)){let a=te(d,`${t}.${s}`);if(!a.ok)return a;o[s]=a.value}return{ok:!0,value:o}}function te(e,t){let n=y(e,t);if(!n.ok)return n;switch(n.value.kind){case"literal":return{ok:!0,value:{kind:"literal",value:n.value.value}};case"human_input_ref":{let s=w(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}case"array":{if(!Array.isArray(n.value.items))return f(`${t}.items must be an array`);let s=[];for(let[d,a]of n.value.items.entries()){let c=te(a,`${t}[${d}]`);if(!c.ok)return c;s.push(c.value)}return{ok:!0,value:{kind:"array",items:s}}}case"object":{let s=ee(n.value.entries,`${t}.entries`);return s.ok?{ok:!0,value:{kind:"object",entries:s.value}}:s}case"template":{if(!Array.isArray(n.value.parts))return f(`${t}.parts must be an array`);let s=[];for(let[d,a]of n.value.parts.entries()){let c=We(a,`${t}.parts[${d}]`);if(!c.ok)return c;s.push(c.value)}return{ok:!0,value:{kind:"template",parts:s}}}default:return f(`${t}.kind is invalid`)}}function We(e,t){let n=y(e,t);if(!n.ok)return n;let o=n.value.kind;if(o==="literal")return typeof n.value.value!="string"?f(`${t}.value must be a string`):{ok:!0,value:{kind:"literal",value:n.value.value}};if(o==="human_input_ref"){let s=w(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}return f(`${t}.kind is invalid`)}function Fr(e){let t=y(e,"request body");if(!t.ok)return r(t.reason);let n=w(t.value.nodeId,"nodeId");if(!n.ok)return r(n.reason);let o=Ke(t.value.renderedPrompt);if(!o.ok)return r(o.reason);let s=Le(t.value.input);if(!s.ok)return r(s.reason);let d=w(t.value.timeout,"timeout");if(!d.ok)return r(d.reason);let a=Ge(t.value.expiresAt,"expiresAt");if(!a.ok)return r(a.reason);let c=qe(t.value.partiallyRenderedDelivery);return c.ok?u({nodeId:n.value,renderedPrompt:o.value,input:s.value,timeout:d.value,expiresAt:a.value,...c.value!==void 0?{partiallyRenderedDelivery:c.value}:{}}):r(c.reason)}function Ve(e){return!i(e)||typeof e.id!="string"||e.id.length===0||typeof e.nodeId!="string"||typeof e.status!="string"||!(e.output===null||i(e.output))?r("human input request view must carry id, nodeId, status and output"):u(e)}function Hr(e){if(!i(e)||typeof e.created!="boolean")return r("human input create data must carry created:boolean");let t=Ve(e.request);return t.ok?u({created:e.created,request:t.value}):t}function $r(e){return!i(e)||e.acknowledged!==!0?r("human input acknowledge data must carry acknowledged:true"):u({acknowledged:!0})}var Gr="ablehi-wfp-user-runtime-manifest/v1",Kr="unknown";function Lr(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var Wr="/internal/deployment-handshake",je=["start","terminate","send-event","start-webhook-watcher","run-polling-tick","invoke-tool","invoke-trigger-handler","invoke-webhook-protocol-adapter","deployment-handshake"],Vr=je,jr="HANDSHAKE_REQUEST_INVALID",Jr="HANDSHAKE_SECRET_UNCONFIGURED",Xr="HANDSHAKE_SECRET_MISMATCH",Yr="HANDSHAKE_CONTRACT_VERSION_MISMATCH",zr="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",Qr="HANDSHAKE_CAPABILITY_MISSING";function Zr(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function eo(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}export{ze as CONTEXT_STATE_CLEANUP_ROUTE_PATH,je as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,Vr as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,Wr as DEPLOYMENT_HANDSHAKE_ROUTE,bn as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,vn as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,Ce as EGRESS_GRANT_SCOPE_KINDS,ft as EVENT_WAIT_ROUTE_SUBPATH,rt as EXECUTION_CONTEXT_ROUTE_SUBPATH,yr as FILE_ACCESS_ROUTE_SUBPATH,Rr as FILE_COMPLETE_ROUTE_SUBPATH,Ir as FILE_CONTENT_ROUTE_SUBPATH,kr as FILE_STAT_ROUTE_SUBPATH,mr as FILE_UPLOAD_SESSION_ROUTE_SUBPATH,xn as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,pt as FLOW_RUN_EXECUTION_EVENTS_ROUTE_SUBPATH,ce as FLOW_RUN_EXECUTION_EVENT_TYPES,lt as FLOW_RUN_RESULT_ROUTE_SUBPATH,Yn as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,vt as HANDLER_BUNDLES_ROUTE_SUBPATH,Qr as HANDSHAKE_CAPABILITY_MISSING,Yr as HANDSHAKE_CONTRACT_VERSION_MISMATCH,zr as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,jr as HANDSHAKE_REQUEST_INVALID,Xr as HANDSHAKE_SECRET_MISMATCH,Jr as HANDSHAKE_SECRET_UNCONFIGURED,Cr as HUMAN_INPUTS_ROUTE_SUBPATH,Dr as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,Nr as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,Ar as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,$e as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,Y as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX,h as INTERNAL_FILES_ROUTE_PREFIX,g as INTERNAL_FLOW_RUNS_ROUTE_PREFIX,ge as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX,M as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,P as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,q as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,x as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,cn as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,Pn as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,ln as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,Qn as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,pn as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,or as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,ne as SERVER_EXECUTION_CONTRACT_VERSION,ct as STEP_RESULT_ROUTE_SUBPATH,bt as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,Tn as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,zn as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Yt as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,Qt as WEBHOOK_PROTOCOL_ADAPTER_MODULE,Mt as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,Kt as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,Sn as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,Lt as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,Gt as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,qt as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,Zn as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Gr as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,Kr as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,Zr as deploymentHandshakeProbePayload,eo as deploymentHandshakeResponseProofPayload,Un as egressGrantAuditPath,On as egressGrantConsumePath,yt as eventWaitPath,ot as executionContextPath,Cn as flowRunEgressGrantPath,Rt as flowRunExecutionEventsPath,mt as flowRunResultPath,er as flowRunRuntimeCredentialPath,Zt as flowScriptProtocolAdapterModuleName,Ct as handlerBundlesPath,Ur as humanInputAcknowledgePath,Or as humanInputExpirePath,Z as humanInputRequestPath,Br as humanInputResolvedEventType,He as humanInputsPath,Er as internalFileAccessPath,wr as internalFileCompletePath,Tr as internalFileContentPath,xr as internalFileStatPath,hr as internalFileUploadSessionPath,_r as internalFilesPath,S as isValidRequestDigest,Tt as parseCompleteFlowRunWaitBody,Qe as parseContextStateCleanupRequestBody,Ze as parseContextStateCleanupResponseData,k as parseContextStateScope,Fr as parseCreateHumanInputBody,Gn as parseEgressGrantAuditBody,Mn as parseEgressGrantConsumeBody,Ln as parseEgressGrantConsumeData,Kn as parseEgressGrantData,it as parseExecutionContextData,Be as parseFileMetadataData,U as parseFileRefData,F as parseFileRuntimeLimits,Ue as parseFileUploadSessionData,Bn as parseFlowActionGrantBody,Et as parseFlowRunExecutionEventBody,wt as parseFlowRunExecutionEventData,_t as parseFlowRunResultBody,ht as parseFlowRunResultData,ir as parseFlowRuntimeCredentialBody,Re as parseHandlerBundle,Nt as parseHandlerBundlesData,$r as parseHumanInputAcknowledgeData,Hr as parseHumanInputCreateData,Ve as parseHumanInputRequestViewData,Pr as parseInternalFileAccessData,yn as parsePollingPublishBody,ur as parsePollingRuntimeCredentialBody,Ee as parsePollingTriggerContext,Rn as parsePollingTriggerDispatchData,Hn as parsePollingTriggerGrantBody,kn as parsePublishPollingTickEventsData,xt as parseRegisterFlowRunWaitBody,Pt as parseRegisterFlowRunWaitData,dr as parseRuntimeCredentialSessionCredential,C as parseRuntimeNetwork,Fn as parseSingleToolGrantBody,sr as parseSingleToolRuntimeCredentialBody,kt as parseStepRecordBody,It as parseStepRecordData,Dt as parseToolHandlerBundlesData,G as parseTriggerFileRuntimeDispatch,nn as parseTriggerHandlerBundlesData,_e as parseWebhookDelivery,tn as parseWebhookDeliveryDispatchData,rn as parseWebhookPublishEventsBody,on as parseWebhookRearmBody,ar as parseWebhookRuntimeCredentialBody,$n as parseWebhookTriggerGrantBody,en as parseWebhookWatcherContext,fn as pollingTriggerContextPath,Nn as pollingTriggerEgressGrantPath,gn as pollingTriggerHandlerBundlesPath,nr as pollingTriggerRuntimeCredentialPath,mn as pollingTriggerTickEventsPath,Ne as requestHasMultipartFileParts,gt as stepResultPath,At as toolHandlerBundlesPath,An as toolInvocationEgressGrantPath,tr as toolInvocationRuntimeCredentialPath,zt as webhookProtocolAdapterBundlePath,Wt as webhookTriggerContextPath,jt as webhookTriggerDeliveryPath,Dn as webhookTriggerEgressGrantPath,Jt as webhookTriggerEventsPath,Vt as webhookTriggerHandlerBundlesPath,Xt as webhookTriggerRearmPath,rr as webhookTriggerRuntimeCredentialPath,Lr as wfpUserRuntimeManifestPath};
|
|
1
|
+
var re="0.2.10";function u(e){return{ok:!0,value:e}}function r(e){return{ok:!1,reason:e}}function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Qe="/cleanup-state-scopes";function k(e){if(!i(e)||typeof e.kind!="string")return r("context state scope surface shape is invalid");switch(e.kind){case"webhook-trigger":return oe(e);case"polling-trigger":return ie(e);case"flow-action":return se(e);default:return r("context state scope kind is invalid")}}function Ze(e){if(!i(e))return r("cleanup request body must be a JSON object");let t=N(e,["scopes"]);if(t!==void 0)return r(`cleanup request does not accept the "${t}" field`);if(!Array.isArray(e.scopes))return r("cleanup request scopes must be an array");let n=[];for(let o of e.scopes){let s=k(o);if(!s.ok)return s;n.push(s.value)}return u({scopes:n})}function et(e){return!i(e)||typeof e.deleted!="number"||!Number.isSafeInteger(e.deleted)||e.deleted<0?r("cleanup response data surface shape is invalid"):u({deleted:e.deleted})}function oe(e){let t=N(e,["kind","workspaceId","triggerInstanceId"]);return t!==void 0?r(`webhook trigger scope does not accept "${t}"`):e.kind!=="webhook-trigger"||!R(e.workspaceId)||!R(e.triggerInstanceId)?r("webhook trigger state scope is invalid"):u({kind:"webhook-trigger",workspaceId:e.workspaceId,triggerInstanceId:e.triggerInstanceId})}function ie(e){let t=N(e,["kind","workspaceId","pollingInstanceId"]);return t!==void 0?r(`polling trigger scope does not accept "${t}"`):e.kind!=="polling-trigger"||!R(e.workspaceId)||!R(e.pollingInstanceId)?r("polling trigger state scope is invalid"):u({kind:"polling-trigger",workspaceId:e.workspaceId,pollingInstanceId:e.pollingInstanceId})}function se(e){let t=N(e,["kind","workspaceId","flowId","nodeId","connectionId"]);if(t!==void 0)return r(`flow action scope does not accept "${t}"`);let n=e.connectionId;return e.kind!=="flow-action"||!R(e.workspaceId)||!R(e.flowId)||!R(e.nodeId)||n!==null&&!R(n)?r("flow action state scope is invalid"):u({kind:"flow-action",workspaceId:e.workspaceId,flowId:e.flowId,nodeId:e.nodeId,connectionId:n})}function R(e){return typeof e=="string"&&e.length>0}function N(e,t){return Object.keys(e).find(n=>!t.includes(n))}var g="/internal/flow-runs",ot="/:flowRunId/execution-context";function it(e){return`${g}/${encodeURIComponent(e)}/execution-context`}function F(e){return!i(e)||!B(e.fileMaxBytes)||!B(e.fileReadMaxBytes)||!B(e.inlineMultipartBytesMax)?r("file runtime limits must carry three positive integer bounds"):u({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function st(e){if(!i(e))return r("execution context must be a JSON object");let t=e.compiled;if(typeof e.flowRunId!="string"||typeof e.workspaceId!="string"||!i(e.input)||!i(t)||typeof t.irSchemaVersion!="string"||typeof t.interpreterContractVersion!="string"||typeof t.compiledArtifactId!="string"||!i(t.ir)||!Array.isArray(t.ir.nodes)||!ae(e.executionBindings))return r("execution context surface shape is invalid");let n=ue(e.fileRuntime);return n.ok?u({...e,fileRuntime:n.value}):r(n.reason)}function ue(e){if(e===null)return u(null);if(!i(e))return r("fileRuntime must be null or an object");let t=F(e.limits);return t.ok?u({limits:t.value}):r(t.reason)}function ae(e){return Array.isArray(e)?e.every(t=>{if(!i(t))return!1;let n=t.connection,o=k(t.stateScope);return typeof t.nodeId=="string"&&typeof t.toolRef=="string"&&i(t.toolDescriptor)&&i(t.integrationDescriptor)&&i(n)&&typeof n.installationId=="string"&&typeof n.connectionRef=="string"&&typeof n.connectionId=="string"&&typeof n.authProfileRef=="string"&&typeof n.authType=="string"&&o.ok}):!1}function B(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}import{parseAblehiErrorDigest as H}from"@ablehi/error-contract";var lt="/:flowRunId/steps/:nodeId/result",pt="/:flowRunId/result",ft="/:flowRunId/execution-events",gt="/:flowRunId/event-waits/:nodeId";function mt(e,t){return`${g}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function Rt(e){return`${g}/${encodeURIComponent(e)}/result`}function yt(e){return`${g}/${encodeURIComponent(e)}/execution-events`}function kt(e,t){return`${g}/${encodeURIComponent(e)}/event-waits/${encodeURIComponent(t)}`}function It(e){if(!i(e))return{ok:!1,kind:"validation",reason:"step record body must be a JSON object"};let t=m(e,["attempt","result","durationMs"]);if(t!==void 0)return{ok:!1,kind:"validation",reason:`step record does not accept the "${t}" field`};let n=e.attempt;if(typeof n!="number"||!Number.isInteger(n)||n<=0)return{ok:!1,kind:"validation",reason:"attempt must be a positive integer"};let o=ce(e.result);if(!o.ok)return o;let s={attempt:n,result:o.value};if(e.durationMs!==void 0){let c=e.durationMs;if(typeof c!="number"||!Number.isFinite(c)||c<0)return{ok:!1,kind:"validation",reason:"durationMs must be a non-negative number"};s.durationMs=c}return{ok:!0,value:s}}function ce(e){if(!i(e))return{ok:!1,kind:"step_result_invalid",reason:"result must be a JSON object"};let t=e.status;if(t==="succeeded"){let n=m(e,["status","output"]);return n!==void 0?{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`}:"output"in e?{ok:!0,value:{status:"succeeded",output:e.output}}:{ok:!1,kind:"step_result_invalid",reason:"a succeeded result must carry output"}}if(t==="failed"){let n=m(e,["status","error"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=H(e.error);return o.ok?{ok:!0,value:{status:"failed",error:o.value}}:{ok:!1,kind:"step_result_invalid",reason:`a failed result must carry an AblehiErrorDigest: ${o.reason}`}}if(t==="skipped"){let n=m(e,["status","reason"]);return n!==void 0?{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`}:e.reason!=="run_if_false"?{ok:!1,kind:"step_result_invalid",reason:'a skipped result reason must be "run_if_false"'}:{ok:!0,value:{status:"skipped",reason:"run_if_false"}}}if(t==="timed_out"){let n=m(e,["status","error"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=H(e.error);return o.ok?{ok:!0,value:{status:"timed_out",error:o.value}}:{ok:!1,kind:"step_result_invalid",reason:`a timed_out result must carry an AblehiErrorDigest: ${o.reason}`}}return{ok:!1,kind:"step_result_invalid",reason:'result status must be "succeeded", "failed", "skipped", or "timed_out"'}}function _t(e){return!i(e)||typeof e.flowRunId!="string"||typeof e.nodeId!="string"||!de(e.recorded)?r("step record data surface shape is invalid"):u({flowRunId:e.flowRunId,nodeId:e.nodeId,recorded:e.recorded})}function de(e){return e==="succeeded"||e==="failed"||e==="skipped"||e==="timed_out"}function ht(e){if(!i(e))return r("result body must be a JSON object");let t=m(e,["status","output","error","composition"]);if(t!==void 0)return r(`result does not accept the "${t}" field`);let n=e.status;if(n!=="succeeded"&&n!=="failed")return r('result status must be "succeeded" or "failed"');let o={status:n};if(e.output!==void 0){if(n!=="succeeded")return r("output is only allowed on a succeeded result");o.output=e.output}if(e.error!==void 0){if(n!=="failed")return r("error is only allowed on a failed result");let s=H(e.error);if(!s.ok)return r(`result error must be an AblehiErrorDigest: ${s.reason}`);o.error=s.value}if(n==="failed"&&o.error===void 0)return r("a failed result must carry an AblehiErrorDigest");if(e.composition!==void 0){if(n!=="succeeded")return r("composition is only allowed on a succeeded result");o.composition=e.composition}return u(o)}function Et(e){return i(e)?u(e):r("flow run result data must be a JSON object")}var le=["flow_run_started","step_started","step_retry_scheduled","wait_registered","wait_event_received","wait_event_timed_out","human_input_created","human_input_submitted","human_input_expired","flow_run_succeeded","flow_run_failed","flow_run_interrupted","flow_run_cancelled"];function wt(e){if(!i(e))return r("execution event data must be a JSON object");let t=m(e,["flowRunId","eventId","accepted"]);return t!==void 0?r(`execution event data does not accept the "${t}" field`):typeof e.flowRunId!="string"||e.flowRunId.length===0?r("flowRunId must be a non-empty string"):typeof e.eventId!="string"||e.eventId.length===0?r("eventId must be a non-empty string"):e.accepted!==!0?r("accepted must be true"):u({flowRunId:e.flowRunId,eventId:e.eventId,accepted:!0})}function xt(e){if(!i(e))return r("execution event body must be a JSON object");let t=m(e,["eventId","eventType","nodeId","stepRunId","attempt","durationMs","occurredAt","errorId","payloadRef","inputFact"]);if(t!==void 0)return r(`execution event does not accept the "${t}" field`);let n=e.eventId;if(typeof n!="string"||n.length===0)return r("eventId must be a non-empty string");let o=e.eventType;if(!pe(o))return r("eventType is not a known flow execution event type");let s=e.occurredAt;if(typeof s!="string"||s.length===0)return r("occurredAt must be a non-empty string");let c={eventId:n,eventType:o,occurredAt:s};for(let a of["nodeId","stepRunId","errorId","payloadRef"]){let d=e[a];if(d!==void 0){if(typeof d!="string"||d.length===0)return r(`${a} must be a non-empty string`);c[a]=d}}for(let a of["attempt","durationMs"]){let d=e[a];if(d!==void 0){if(typeof d!="number"||!Number.isFinite(d)||!Number.isInteger(d)||d<0)return r(`${a} must be a non-negative integer`);c[a]=d}}if(e.inputFact!==void 0){if(o!=="step_started")return r("inputFact is only allowed on step_started events");if(c.attempt===void 0)return r("inputFact requires attempt");let a=fe(e.inputFact);if(!a.ok)return a;c.inputFact=a.value}return u(c)}function pe(e){return typeof e=="string"&&le.includes(e)}function fe(e){if(!i(e))return r("inputFact must be a JSON object");let t=m(e,["digestAlgorithm","digest","domain"]);if(t!==void 0)return r(`inputFact does not accept the "${t}" field`);if(e.digestAlgorithm!=="sha256")return r('inputFact.digestAlgorithm must be "sha256"');let n=e.digest;if(typeof n!="string"||!/^[0-9a-f]{64}$/.test(n))return r("inputFact.digest must be a sha256 hex string");let o=e.domain;if(!i(o))return r("inputFact.domain must be a JSON object");let s=m(o,["irSchemaVersion","interpreterContractVersion","compiledArtifactId","nodeId","algorithmVersion"]);return s!==void 0?r(`inputFact.domain does not accept the "${s}" field`):typeof o.irSchemaVersion!="string"||o.irSchemaVersion.length===0||typeof o.interpreterContractVersion!="string"||o.interpreterContractVersion.length===0||typeof o.compiledArtifactId!="string"||o.compiledArtifactId.length===0||typeof o.nodeId!="string"||o.nodeId.length===0?r("inputFact.domain string fields must be non-empty strings"):o.algorithmVersion!=="flow_input_digest.v1"?r('inputFact.domain.algorithmVersion must be "flow_input_digest.v1"'):u({digestAlgorithm:"sha256",digest:n,domain:{irSchemaVersion:o.irSchemaVersion,interpreterContractVersion:o.interpreterContractVersion,compiledArtifactId:o.compiledArtifactId,nodeId:o.nodeId,algorithmVersion:"flow_input_digest.v1"}})}var ge=/^[A-Za-z0-9_-]{1,100}$/;function Tt(e){if(!i(e))return r("register body must be a JSON object");let t=m(e,["eventType","correlationKey"]);if(t!==void 0)return r(`register wait does not accept the "${t}" field`);let n=j(e.eventType);if(!n.ok)return r(n.reason);let o=e.correlationKey;return typeof o!="string"||o.length===0?r("correlationKey must be a non-empty string"):u({eventType:n.value,correlationKey:o})}function Pt(e){if(!i(e))return r("complete body must be a JSON object");let t=m(e,["eventType","correlationKey","outcome","eventId"]);if(t!==void 0)return r(`complete wait does not accept the "${t}" field`);let n=e.outcome;if(n!=="received"&&n!=="timed_out")return r('outcome must be "received" or "timed_out"');let o=j(e.eventType);if(!o.ok)return r(o.reason);let s=e.correlationKey;if(typeof s!="string"||s.length===0)return r("correlationKey must be a non-empty string");let c={eventType:o.value,correlationKey:s,outcome:n};if(e.eventId!==void 0){if(typeof e.eventId!="string"||e.eventId.length===0)return r("eventId must be a non-empty string");c.eventId=e.eventId}return u(c)}function vt(e){return!i(e)||e.registered!==!0?r("register wait data surface shape is invalid"):u({registered:!0})}function j(e){return typeof e!="string"||e.length===0?r("eventType must be a non-empty string"):ge.test(e)?u(e):r("eventType must match ^[A-Za-z0-9_-]{1,100}$")}function m(e,t){return Object.keys(e).find(n=>!t.includes(n))}var me="/internal/flow-versions",bt="/:flowVersionId/handler-bundles",G="/internal/installations",Ct="/:installationId/handler-bundles";function At(e,t){return`${me}/${encodeURIComponent(e)}/handler-bundles?compiledArtifactId=${encodeURIComponent(t)}`}function Nt(e){return`${G}/${encodeURIComponent(e.installationId)}/handler-bundles?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var Re=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function D(e){if(!_(e))return $("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!Re.has(t)?$("runtimeNetwork.networkModel is unknown"):!J(e.apiHosts)||!J(e.authHosts)||typeof e.httpsOnly!="boolean"?$("runtimeNetwork host/https fields are invalid"):{ok:!0,value:{networkModel:t,apiHosts:e.apiHosts,authHosts:e.authHosts,httpsOnly:e.httpsOnly}}}function Dt(e){if(!_(e)||typeof e.flowVersionId!="string"||typeof e.compiledArtifactId!="string"||!Array.isArray(e.bundles))return T("handler bundles data surface shape is invalid");let t=X(e.bundles);return t.ok?{ok:!0,value:{flowVersionId:e.flowVersionId,compiledArtifactId:e.compiledArtifactId,bundles:t.value}}:t}function Ot(e){if(!_(e)||typeof e.installationId!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.bundles))return T("tool handler bundles data surface shape is invalid");let t=X(e.bundles);return t.ok?{ok:!0,value:{installationId:e.installationId,artifactDigest:e.artifactDigest,bundles:t.value}}:t}function X(e){let t=[];for(let n of e){let o=ye(n);if(!o.ok)return o;t.push(o.value)}return{ok:!0,value:t}}function ye(e){if(!_(e)||typeof e.toolRef!="string"||e.kind!=="handler"&&e.kind!=="request")return T("handler bundle entry shape is invalid");if(e.kind==="request"){if(e.module!==void 0)return T("a request bundle must not carry a module");let o=D(e.runtimeNetwork);return o.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"request",runtimeNetwork:o.value}}:o}let t=e.module;if(!_(t)||typeof t.entry!="string"||t.entry.length===0||!ke(t.files))return T("a handler bundle must carry a { entry, files } module");let n=D(e.runtimeNetwork);return n.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"handler",module:{entry:t.entry,files:t.files},runtimeNetwork:n.value}}:n}function T(e){return{ok:!1,kind:"shape",reason:e}}function $(e){return{ok:!1,kind:"runtime_network",reason:e}}function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function J(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ke(e){return _(e)&&Object.values(e).every(t=>typeof t=="string")}var P="/internal/webhook-trigger-instances",Mt="/:triggerInstanceId/context",Kt="/:triggerInstanceId/handler-bundles",Lt="/:triggerInstanceId/deliveries/:deliveryId",qt="/:triggerInstanceId/events",Wt="/:triggerInstanceId/rearm",v=e=>`${P}/${encodeURIComponent(e)}`;function Vt(e,t){return`${v(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function jt(e,t){return`${v(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Jt(e,t){return`${v(e)}/deliveries/${encodeURIComponent(t)}`}function Xt(e){return`${v(e)}/events`}function Yt(e){return`${v(e)}/rearm`}var zt="/:installationId/webhook-protocol-adapter-bundle";function Qt(e){return`${G}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var Zt="modules/webhook/protocol-adapter.js";function en(e){return`modules/webhook/protocol-adapter-${e}.js`}function tn(e){let t=i(e)?k(e.stateScope):r("webhook watcher context state scope is invalid");return!i(e)||typeof e.artifactDigest!="string"||typeof e.triggerRef!="string"||typeof e.triggerName!="string"||typeof e.integrationRef!="string"||!i(e.inputs)||e.connection!==null&&!Ie(e.connection)||!_e(e.runtime)||!t.ok||t.value.kind!=="webhook-trigger"?r("webhook watcher context surface shape is invalid"):u(e)}function Ie(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authProfileRef=="string"&&typeof e.authType=="string"}function _e(e){if(!i(e)||e.type!=="webhook"||typeof e.trigger_ref!="string")return!1;let t=e.webhook;return i(t)&&typeof t.event_handler_module=="string"&&typeof t.enable_handler_module=="string"&&typeof t.disable_handler_module=="string"}function he(e){if(!i(e)||typeof e.deliveryId!="string"||typeof e.receivedAt!="string"||!i(e.request))return r("webhook delivery surface shape is invalid");let t=e.request;return t.method!=="POST"||!i(t.headers)||typeof t.rawBody!="string"?r("webhook delivery request shape is invalid"):u(e)}function M(e){if(!i(e)||typeof e.token!="string"||typeof e.expiresAt!="string")return r("trigger file runtime dispatch shape is invalid");let t=F(e.limits);return t.ok?u({token:e.token,expiresAt:e.expiresAt,limits:t.value}):r(t.reason)}function nn(e){if(!i(e))return r("webhook delivery dispatch data is invalid");let t=he(e.delivery);if(!t.ok)return r(t.reason);let n=e.fileRuntime;if(n===null)return u({delivery:t.value,fileRuntime:null});let o=M(n);return o.ok?u({delivery:t.value,fileRuntime:o.value}):r(o.reason)}function rn(e){if(!i(e)||typeof e.triggerRef!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.modules)||!e.modules.every(Ee))return{ok:!1,kind:"shape",reason:"trigger handler bundles data surface shape is invalid"};let t=D(e.runtimeNetwork);return t.ok?{ok:!0,value:{triggerRef:e.triggerRef,artifactDigest:e.artifactDigest,modules:e.modules,runtimeNetwork:t.value}}:t}function Ee(e){return i(e)&&typeof e.specifier=="string"&&e.specifier.length>0&&typeof e.source=="string"}function on(e){if(!i(e))return r("publish events body must be a JSON object");let t=K(e,["deliveryId","events"]);if(t!==void 0)return r(`publish events does not accept the "${t}" field`);let n=e.deliveryId;if(typeof n!="string"||n.length===0)return r("deliveryId must be a non-empty string");let o=e.events;if(!Array.isArray(o))return r("events must be an array");let s=[];for(let c of o){let a=we(c);if(!a.ok)return a;s.push(a.value)}return u({deliveryId:n,events:s})}function we(e){if(!i(e))return r("each event must be a JSON object");let t=K(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return r(`event does not accept the "${t}" field`);let n=e.eventId;if(typeof n!="string"||n.length===0)return r("eventId must be a non-empty string");let o=e.occurredAt;if(typeof o!="string"||o.length===0)return r("occurredAt must be a non-empty string");if(!i(e.payload))return r("event payload must be a JSON object");let s={eventId:n,occurredAt:o,payload:e.payload};if(e.dedupeKey!==void 0){if(typeof e.dedupeKey!="string"||e.dedupeKey.length===0)return r("dedupeKey must be a non-empty string");s.dedupeKey=e.dedupeKey}return u(s)}function sn(e){if(!i(e))return r("rearm body must be a JSON object");let t=K(e,["expectedWatcherInstanceId"]);if(t!==void 0)return r(`rearm does not accept the "${t}" field`);let n=e.expectedWatcherInstanceId;return typeof n!="string"||n.length===0?r("expectedWatcherInstanceId must be a non-empty string"):u({expectedWatcherInstanceId:n})}function K(e,t){return Object.keys(e).find(n=>!t.includes(n))}var S="/internal/polling-trigger-instances",ln="/:pollingInstanceId/context",pn="/:pollingInstanceId/handler-bundles",fn="/:pollingInstanceId/ticks/:tickId/events",L=e=>`${S}/${encodeURIComponent(e)}`;function gn(e,t,n){return`${L(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function mn(e,t){return`${L(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Rn(e,t){return`${L(e)}/ticks/${encodeURIComponent(t)}/events`}function xe(e){let t=i(e)?k(e.stateScope):r("polling trigger context state scope is invalid");return!i(e)||typeof e.artifactDigest!="string"||typeof e.triggerRef!="string"||typeof e.triggerName!="string"||typeof e.integrationRef!="string"||!i(e.inputs)||e.connection!==null&&!Te(e.connection)||!Pe(e.runtime)||!t.ok||t.value.kind!=="polling-trigger"||!ve(e.tick)||!Se(e.limits)?r("polling trigger context surface shape is invalid"):u(e)}function yn(e){if(!i(e))return r("polling trigger dispatch data is invalid");let t=xe(e.context);if(!t.ok)return r(t.reason);let n=e.fileRuntime;if(n===null)return u({context:t.value,fileRuntime:null});let o=M(n);return o.ok?u({context:t.value,fileRuntime:o.value}):r(o.reason)}function Te(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authProfileRef=="string"&&typeof e.authType=="string"}function Pe(e){if(!i(e)||e.type!=="polling"||typeof e.trigger_id!="string"||typeof e.trigger_ref!="string")return!1;let t=e.polling;if(!i(t)||typeof t.run_handler_module!="string")return!1;let n=t.schedule;if(!i(n)||n.type!=="interval"||typeof n.every_seconds!="number")return!1;let o=t.dedup;return i(o)&&(o.strategy==="cursor"||o.strategy==="hash"||o.strategy==="id_field")}function ve(e){return i(e)&&typeof e.tickId=="string"&&typeof e.scheduledAt=="string"&&typeof e.attempt=="number"}function Se(e){return i(e)&&typeof e.maxEventsPerTick=="number"}function kn(e){if(!i(e))return r("publish body must be a JSON object");let t=Y(e,["events","nextCursor"]);if(t!==void 0)return r(`publish does not accept the "${t}" field`);let n=e.events;if(!Array.isArray(n))return r("events must be an array");let o=[];for(let c of n){let a=be(c);if(!a.ok)return a;o.push(a.value)}let s={events:o};if("nextCursor"in e){let c=e.nextCursor;if(c!==null&&typeof c!="string")return r("nextCursor must be a string, null, or omitted");s.nextCursor=c}return u(s)}function be(e){if(!i(e))return r("each event must be a JSON object");let t=Y(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return r(`event does not accept the "${t}" field`);if(typeof e.eventId!="string"||e.eventId.length===0)return r("event eventId must be a non-empty string");if(!i(e.payload))return r("event payload must be a JSON object");let n={eventId:e.eventId,payload:e.payload};if(e.occurredAt!==void 0){if(typeof e.occurredAt!="string"||e.occurredAt.length===0)return r("event occurredAt must be a non-empty string");n.occurredAt=e.occurredAt}if(e.dedupeKey!==void 0){if(typeof e.dedupeKey!="string"||e.dedupeKey.length===0)return r("event dedupeKey must be a non-empty string");n.dedupeKey=e.dedupeKey}return u(n)}function In(e){return!i(e)||typeof e.tickId!="string"||typeof e.cursorUpdated!="boolean"||!Array.isArray(e.results)||!e.results.every(Ce)?r("publish polling tick events data surface shape is invalid"):u(e)}function Ce(e){return i(e)&&typeof e.eventId=="string"&&typeof e.dedupeKey=="string"&&typeof e.duplicate=="boolean"&&(e.flowRunId===null||typeof e.flowRunId=="string")}function Y(e,t){return Object.keys(e).find(n=>!t.includes(n))}var z="/internal/egress-grants",q="/internal/tool-invocations",W="/internal/discovery-invocations",Tn="/:flowRunId/egress-grant",Pn="/:invocationId/egress-grant",vn="/:discoveryInvocationId/egress-grant",Sn="/:pollingInstanceId/egress-grant",bn="/:triggerInstanceId/egress-grant",Cn="/:grantId/consume",An="/:grantId/audit",Nn=e=>`${g}/${encodeURIComponent(e)}/egress-grant`,Dn=e=>`${q}/${encodeURIComponent(e)}/egress-grant`,On=e=>`${W}/${encodeURIComponent(e)}/egress-grant`,Un=e=>`${S}/${encodeURIComponent(e)}/egress-grant`,Bn=e=>`${P}/${encodeURIComponent(e)}/egress-grant`,Fn=e=>`${z}/${encodeURIComponent(e)}/consume`,Hn=e=>`${z}/${encodeURIComponent(e)}/audit`,Ae=["flow_action","single_tool","discovery","polling_trigger","webhook_trigger"],Ne=/^[A-Za-z0-9][A-Za-z0-9:_+/=.-]{15,1023}$/;function h(e){return typeof e=="string"&&Ne.test(e)}function De(e){if(!i(e)||e.body_type!=="multipart")return!1;let t=e.body;if(!i(t))return!1;let n=t.parts;return Array.isArray(n)?n.some(o=>i(o)?o.kind==="file"&&typeof o.file_id=="string"&&o.file_id.length>0:!1):!1}function l(e){return{ok:!1,kind:"shape",reason:e}}function E(){return{ok:!1,kind:"request_digest",reason:"request digest is missing or malformed"}}function b(e,t){if(!i(e))return{ok:!1,reason:"grant request body must be a JSON object"};for(let n of Object.keys(e))if(!t.includes(n))return{ok:!1,reason:`grant request does not accept the "${n}" field`};return{ok:!0,record:e}}function C(e){if(!i(e))return"request must be a JSON object"}function $n(e){let t=b(e,["nodeId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.nodeId;if(typeof n!="string"||n.length===0)return l("nodeId is required");let o=C(t.record.request);if(o!==void 0)return l(o);let s=t.record.requestDigest;return h(s)?{ok:!0,value:{nodeId:n,requestDigest:s,requestHasMultipartFiles:De(t.record.request)}}:E()}function Gn(e){let t=b(e,["request","requestDigest"]);if(!t.ok)return l(t.reason);let n=C(t.record.request);if(n!==void 0)return l(n);let o=t.record.requestDigest;return h(o)?{ok:!0,value:{requestDigest:o}}:E()}function Mn(e){let t=b(e,["request","requestDigest"]);if(!t.ok)return l(t.reason);let n=C(t.record.request);if(n!==void 0)return l(n);let o=t.record.requestDigest;return h(o)?{ok:!0,value:{requestDigest:o}}:E()}function Kn(e){let t=b(e,["tickId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.tickId;if(typeof n!="string"||n.length===0)return l("tickId is required");let o=C(t.record.request);if(o!==void 0)return l(o);let s=t.record.requestDigest;return h(s)?{ok:!0,value:{tickId:n,requestDigest:s}}:E()}function Ln(e){let t=b(e,["phase","lifecycle","deliveryId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.phase;if(n!=="lifecycle"&&n!=="handler")return l('phase must be "lifecycle" or "handler"');let o=t.record.lifecycle,s;if(o!==void 0){if(o!=="enable"&&o!=="disable"&&o!=="renew")return l('lifecycle must be "enable", "disable", or "renew"');s=o}if(n==="lifecycle"&&s===void 0)return l("lifecycle is required for the lifecycle phase");let c=t.record.deliveryId,a;if(c!==void 0){if(typeof c!="string"||c.length===0)return l("deliveryId must be a non-empty string");a=c}if(n==="handler"&&a===void 0)return l("deliveryId is required for the handler phase");let d=C(t.record.request);if(d!==void 0)return l(d);let I=t.record.requestDigest;return h(I)?{ok:!0,value:{phase:n,...s!==void 0?{lifecycle:s}:{},...a!==void 0?{deliveryId:a}:{},requestDigest:I}}:E()}function Q(e){return Ae.includes(e)?e:void 0}var Oe=["scopeKind","scopeId","requestDigest"];function qn(e){if(!i(e))return l("consume body must be a JSON object");for(let s of Object.keys(e))if(!Oe.includes(s))return l(`consume does not accept the "${s}" field`);let t=Q(e.scopeKind);if(t===void 0)return l("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return l("scopeId is required");let o=e.requestDigest;return h(o)?{ok:!0,value:{scopeKind:t,scopeId:n,requestDigest:o}}:E()}var Ue=["scopeKind","scopeId","providerHost","status","durationMs","requestBytes","responseBytes","errorCode"];function O(e,t){return typeof e!="number"||!Number.isInteger(e)||e<0?{ok:!1,reason:`${t} must be a non-negative integer`}:{ok:!0,value:e}}function Wn(e){if(!i(e))return l("audit body must be a JSON object");for(let p of Object.keys(e))if(!Ue.includes(p))return l(`audit does not accept the "${p}" field`);let t=Q(e.scopeKind);if(t===void 0)return l("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return l("scopeId is required");let o=e.providerHost;if(typeof o!="string"||o.length===0)return l("providerHost is required");let s=O(e.durationMs,"durationMs");if(!s.ok)return l(s.reason);let c;if(e.status!==void 0){let p=O(e.status,"status");if(!p.ok)return l(p.reason);c=p.value}let a;if(e.requestBytes!==void 0){let p=O(e.requestBytes,"requestBytes");if(!p.ok)return l(p.reason);a=p.value}let d;if(e.responseBytes!==void 0){let p=O(e.responseBytes,"responseBytes");if(!p.ok)return l(p.reason);d=p.value}let I;if(e.errorCode!==void 0){let p=e.errorCode;if(typeof p!="string"||p.length===0)return l("errorCode must be a non-empty string");I=p}return{ok:!0,value:{scopeKind:t,scopeId:n,providerHost:o,...c!==void 0?{status:c}:{},durationMs:s.value,...a!==void 0?{requestBytes:a}:{},...d!==void 0?{responseBytes:d}:{},...I!==void 0?{errorCode:I}:{}}}}function Vn(e){return!i(e)||!i(e.grant)?r("egress grant envelope must carry a grant object"):u(e.grant)}function jn(e){return!i(e)||e.consumed!==!0?r("egress grant consume data must carry consumed:true"):u({consumed:!0})}var er="/:flowRunId/runtime-credential",tr="/:invocationId/runtime-credential",nr="/:discoveryInvocationId/runtime-credential",rr="/:pollingInstanceId/runtime-credential",or="/:triggerInstanceId/runtime-credential",ir=e=>`${g}/${encodeURIComponent(e)}/runtime-credential`,sr=e=>`${q}/${encodeURIComponent(e)}/runtime-credential`,ur=e=>`${W}/${encodeURIComponent(e)}/runtime-credential`,ar=e=>`${S}/${encodeURIComponent(e)}/runtime-credential`,cr=e=>`${P}/${encodeURIComponent(e)}/runtime-credential`,dr=["flow_action","tool_invoke","discovery","polling_trigger","webhook_trigger"];function A(e,t){if(!i(e))return{ok:!1,reason:"runtime credential request body must be a JSON object"};for(let n of Object.keys(e))if(!t.includes(n))return{ok:!1,reason:`runtime credential request does not accept the "${n}" field`};return{ok:!0,record:e}}function lr(e){let t=A(e,["nodeId"]);if(!t.ok)return r(t.reason);let n=t.record.nodeId;return typeof n!="string"||n.length===0?r("nodeId is required"):u({nodeId:n})}function pr(e){let t=A(e??{},[]);return t.ok?u(null):r(t.reason)}function fr(e){let t=A(e??{},[]);return t.ok?u(null):r(t.reason)}function gr(e){let t=A(e,["tickId"]);if(!t.ok)return r(t.reason);let n=t.record.tickId;return typeof n!="string"||n.length===0?r("tickId is required"):u({tickId:n})}function mr(e){let t=A(e,["executionKind","deliveryId","lifecycleOperation"]);if(!t.ok)return r(t.reason);let n=t.record.executionKind;if(n!=="event_handler"&&n!=="lifecycle")return r('executionKind must be "event_handler" or "lifecycle"');let o,s=t.record.deliveryId;if(s!==void 0){if(typeof s!="string"||s.length===0)return r("deliveryId must be a non-empty string");o=s}let c,a=t.record.lifecycleOperation;if(a!==void 0){if(a!=="enable"&&a!=="disable"&&a!=="renew")return r('lifecycleOperation must be "enable", "disable", or "renew"');c=a}return n==="lifecycle"&&c===void 0?r("lifecycleOperation is required for the lifecycle execution kind"):u({executionKind:n,...o!==void 0?{deliveryId:o}:{},...c!==void 0?{lifecycleOperation:c}:{}})}function Rr(e){return!i(e)||typeof e.sessionId!="string"||typeof e.connectionId!="string"||typeof e.authProfileRef!="string"||typeof e.authType!="string"||!i(e.credential)?r("runtime credential session must carry sessionId, connectionId, auth profile facts and a credential object"):u(e.credential)}function U(e){return!i(e)||typeof e.file_id!="string"||typeof e.name!="string"||typeof e.size_bytes!="number"||typeof e.created_at!="string"||typeof e.expires_at!="string"||e.mime_type!==void 0&&typeof e.mime_type!="string"||e.sha256!==void 0&&typeof e.sha256!="string"||e.source!==void 0&&typeof e.source!="string"?r("file ref data does not match the AIS file-ref shape"):u(e)}function V(e){return!i(e)||e.method!=="GET"&&e.method!=="PUT"||typeof e.url!="string"||typeof e.expires_at!="string"||!He(e.headers)?r("presigned file URL data is invalid"):u(e)}function Be(e){if(!i(e))return r("file upload session data is invalid");let t=U(e.file);if(!t.ok)return r(t.reason);let n=V(e.upload);return n.ok?u({file:t.value,upload:n.value}):r(n.reason)}function Fe(e){if(!i(e))return r("file metadata data is invalid");let t=U(e.file);return t.ok?u({file:t.value}):r(t.reason)}function He(e){return i(e)?Object.values(e).every(t=>typeof t=="string"):!1}var w="/internal/files",Er="/upload-session",wr="/:fileId/complete",xr="/:fileId/access",Tr="/:fileId/stat",Pr="/:fileId/content",vr=()=>w,Sr=()=>`${w}/upload-session`,br=e=>`${w}/${encodeURIComponent(e)}/complete`,Cr=(e,t)=>`${w}/${encodeURIComponent(e)}/access?intent=${encodeURIComponent(t)}`,Z=e=>`?scope_kind=${encodeURIComponent(e.scopeKind)}&scope_id=${encodeURIComponent(e.scopeId)}`,Ar=(e,t)=>`${w}/${encodeURIComponent(e)}/stat${Z(t)}`,Nr=(e,t)=>`${w}/${encodeURIComponent(e)}/content${Z(t)}`;function Dr(e){if(!i(e))return r("internal file access data is invalid");if(e.intent==="runtime_read"||e.intent==="provider_multipart"){let t=U(e.file);if(!t.ok)return r(t.reason);let n=V(e.access);return n.ok?u({file:t.value,access:n.value,intent:e.intent}):r(n.reason)}return r("internal file access intent is invalid")}var Fr="/:flowRunId/human-inputs",Hr="/:flowRunId/human-inputs/:requestId",$r="/:flowRunId/human-inputs/:requestId/expire",Gr="/:flowRunId/human-inputs/:requestId/acknowledge",$e=e=>`${g}/${encodeURIComponent(e)}/human-inputs`,ee=(e,t)=>`${$e(e)}/${encodeURIComponent(t)}`,Mr=(e,t)=>`${ee(e,t)}/expire`,Kr=(e,t)=>`${ee(e,t)}/acknowledge`,Ge="human_input_resolved";function Lr(e){return`${Ge}_${e}`}function f(e){return{ok:!1,reason:e}}function y(e,t){return i(e)?{ok:!0,value:e}:f(`${t} must be an object`)}function x(e,t){return typeof e!="string"||e.length===0?f(`${t} must be a non-empty string`):{ok:!0,value:e}}var Me=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function Ke(e,t){return typeof e!="string"||!Me.test(e)||Number.isNaN(Date.parse(e))?f(`${t} must be an ISO-8601 timestamp`):{ok:!0,value:e}}function Le(e){let t=y(e,"renderedPrompt");if(!t.ok)return t;let n=x(t.value.title,"renderedPrompt.title");if(!n.ok)return n;let o={title:n.value};if(t.value.body!==void 0){if(typeof t.value.body!="string")return f("renderedPrompt.body must be a string");o.body=t.value.body}if(t.value.format!==void 0){if(t.value.format!=="plain"&&t.value.format!=="markdown")return f("renderedPrompt.format is invalid");o.format=t.value.format}return{ok:!0,value:o}}function qe(e){let t=y(e,"input");if(!t.ok)return t;let n=t.value.kind;if(n==="choice"){if(!Array.isArray(t.value.choices))return f("input.choices must be an array")}else if(n!=="text")if(n==="form"){if(!Array.isArray(t.value.fields))return f("input.fields must be an array")}else return f("input.kind is invalid");return{ok:!0,value:t.value}}function We(e){if(e==null)return{ok:!0,value:void 0};let t=y(e,"partiallyRenderedDelivery");if(!t.ok)return t;let n=t.value.actions;if(n===void 0)return{ok:!0,value:{}};if(!Array.isArray(n))return f("partiallyRenderedDelivery.actions must be an array");let o=[];for(let s of n){let c=y(s,"delivery action");if(!c.ok)return c;let a=x(c.value.id,"delivery action id");if(!a.ok)return a;let d=te(c.value.inputs,`delivery action '${a.value}' inputs`);if(!d.ok)return d;o.push({id:a.value,inputs:d.value})}return{ok:!0,value:{actions:o}}}function te(e,t){let n=y(e,t);if(!n.ok)return n;let o={};for(let[s,c]of Object.entries(n.value)){let a=ne(c,`${t}.${s}`);if(!a.ok)return a;o[s]=a.value}return{ok:!0,value:o}}function ne(e,t){let n=y(e,t);if(!n.ok)return n;switch(n.value.kind){case"literal":return{ok:!0,value:{kind:"literal",value:n.value.value}};case"human_input_ref":{let s=x(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}case"array":{if(!Array.isArray(n.value.items))return f(`${t}.items must be an array`);let s=[];for(let[c,a]of n.value.items.entries()){let d=ne(a,`${t}[${c}]`);if(!d.ok)return d;s.push(d.value)}return{ok:!0,value:{kind:"array",items:s}}}case"object":{let s=te(n.value.entries,`${t}.entries`);return s.ok?{ok:!0,value:{kind:"object",entries:s.value}}:s}case"template":{if(!Array.isArray(n.value.parts))return f(`${t}.parts must be an array`);let s=[];for(let[c,a]of n.value.parts.entries()){let d=Ve(a,`${t}.parts[${c}]`);if(!d.ok)return d;s.push(d.value)}return{ok:!0,value:{kind:"template",parts:s}}}default:return f(`${t}.kind is invalid`)}}function Ve(e,t){let n=y(e,t);if(!n.ok)return n;let o=n.value.kind;if(o==="literal")return typeof n.value.value!="string"?f(`${t}.value must be a string`):{ok:!0,value:{kind:"literal",value:n.value.value}};if(o==="human_input_ref"){let s=x(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}return f(`${t}.kind is invalid`)}function qr(e){let t=y(e,"request body");if(!t.ok)return r(t.reason);let n=x(t.value.nodeId,"nodeId");if(!n.ok)return r(n.reason);let o=Le(t.value.renderedPrompt);if(!o.ok)return r(o.reason);let s=qe(t.value.input);if(!s.ok)return r(s.reason);let c=x(t.value.timeout,"timeout");if(!c.ok)return r(c.reason);let a=Ke(t.value.expiresAt,"expiresAt");if(!a.ok)return r(a.reason);let d=We(t.value.partiallyRenderedDelivery);return d.ok?u({nodeId:n.value,renderedPrompt:o.value,input:s.value,timeout:c.value,expiresAt:a.value,...d.value!==void 0?{partiallyRenderedDelivery:d.value}:{}}):r(d.reason)}function je(e){return!i(e)||typeof e.id!="string"||e.id.length===0||typeof e.nodeId!="string"||typeof e.status!="string"||!(e.output===null||i(e.output))?r("human input request view must carry id, nodeId, status and output"):u(e)}function Wr(e){if(!i(e)||typeof e.created!="boolean")return r("human input create data must carry created:boolean");let t=je(e.request);return t.ok?u({created:e.created,request:t.value}):t}function Vr(e){return!i(e)||e.acknowledged!==!0?r("human input acknowledge data must carry acknowledged:true"):u({acknowledged:!0})}var Jr="ablehi-wfp-user-runtime-manifest/v1",Xr="unknown";function Yr(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var Qr="/internal/deployment-handshake",Je=["start","terminate","send-event","start-webhook-watcher","run-polling-tick","invoke-tool","invoke-discovery","invoke-trigger-handler","invoke-webhook-protocol-adapter","deployment-handshake"],Zr=Je,eo="HANDSHAKE_REQUEST_INVALID",to="HANDSHAKE_SECRET_UNCONFIGURED",no="HANDSHAKE_SECRET_MISMATCH",ro="HANDSHAKE_CONTRACT_VERSION_MISMATCH",oo="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",io="HANDSHAKE_CAPABILITY_MISSING";function so(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function uo(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}export{Qe as CONTEXT_STATE_CLEANUP_ROUTE_PATH,Je as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,Zr as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,Qr as DEPLOYMENT_HANDSHAKE_ROUTE,vn as DISCOVERY_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,nr as DISCOVERY_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,An as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,Cn as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,Ae as EGRESS_GRANT_SCOPE_KINDS,gt as EVENT_WAIT_ROUTE_SUBPATH,ot as EXECUTION_CONTEXT_ROUTE_SUBPATH,xr as FILE_ACCESS_ROUTE_SUBPATH,wr as FILE_COMPLETE_ROUTE_SUBPATH,Pr as FILE_CONTENT_ROUTE_SUBPATH,Tr as FILE_STAT_ROUTE_SUBPATH,Er as FILE_UPLOAD_SESSION_ROUTE_SUBPATH,Tn as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,ft as FLOW_RUN_EXECUTION_EVENTS_ROUTE_SUBPATH,le as FLOW_RUN_EXECUTION_EVENT_TYPES,pt as FLOW_RUN_RESULT_ROUTE_SUBPATH,er as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,bt as HANDLER_BUNDLES_ROUTE_SUBPATH,io as HANDSHAKE_CAPABILITY_MISSING,ro as HANDSHAKE_CONTRACT_VERSION_MISMATCH,oo as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,eo as HANDSHAKE_REQUEST_INVALID,no as HANDSHAKE_SECRET_MISMATCH,to as HANDSHAKE_SECRET_UNCONFIGURED,Fr as HUMAN_INPUTS_ROUTE_SUBPATH,Gr as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,$r as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,Hr as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,Ge as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,W as INTERNAL_DISCOVERY_INVOCATIONS_ROUTE_PREFIX,z as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX,w as INTERNAL_FILES_ROUTE_PREFIX,g as INTERNAL_FLOW_RUNS_ROUTE_PREFIX,me as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX,G as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,S as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,q as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,P as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,ln as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,Sn as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,pn as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,rr as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,fn as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,dr as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,re as SERVER_EXECUTION_CONTRACT_VERSION,lt as STEP_RESULT_ROUTE_SUBPATH,Ct as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,Pn as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,tr as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,zt as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,Zt as WEBHOOK_PROTOCOL_ADAPTER_MODULE,Mt as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,Lt as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,bn as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,qt as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,Kt as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,Wt as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,or as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Jr as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,Xr as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,so as deploymentHandshakeProbePayload,uo as deploymentHandshakeResponseProofPayload,On as discoveryInvocationEgressGrantPath,ur as discoveryInvocationRuntimeCredentialPath,Hn as egressGrantAuditPath,Fn as egressGrantConsumePath,kt as eventWaitPath,it as executionContextPath,Nn as flowRunEgressGrantPath,yt as flowRunExecutionEventsPath,Rt as flowRunResultPath,ir as flowRunRuntimeCredentialPath,en as flowScriptProtocolAdapterModuleName,At as handlerBundlesPath,Kr as humanInputAcknowledgePath,Mr as humanInputExpirePath,ee as humanInputRequestPath,Lr as humanInputResolvedEventType,$e as humanInputsPath,Cr as internalFileAccessPath,br as internalFileCompletePath,Nr as internalFileContentPath,Ar as internalFileStatPath,Sr as internalFileUploadSessionPath,vr as internalFilesPath,h as isValidRequestDigest,Pt as parseCompleteFlowRunWaitBody,Ze as parseContextStateCleanupRequestBody,et as parseContextStateCleanupResponseData,k as parseContextStateScope,qr as parseCreateHumanInputBody,Mn as parseDiscoveryGrantBody,fr as parseDiscoveryRuntimeCredentialBody,Wn as parseEgressGrantAuditBody,qn as parseEgressGrantConsumeBody,jn as parseEgressGrantConsumeData,Vn as parseEgressGrantData,st as parseExecutionContextData,Fe as parseFileMetadataData,U as parseFileRefData,F as parseFileRuntimeLimits,Be as parseFileUploadSessionData,$n as parseFlowActionGrantBody,xt as parseFlowRunExecutionEventBody,wt as parseFlowRunExecutionEventData,ht as parseFlowRunResultBody,Et as parseFlowRunResultData,lr as parseFlowRuntimeCredentialBody,ye as parseHandlerBundle,Dt as parseHandlerBundlesData,Vr as parseHumanInputAcknowledgeData,Wr as parseHumanInputCreateData,je as parseHumanInputRequestViewData,Dr as parseInternalFileAccessData,kn as parsePollingPublishBody,gr as parsePollingRuntimeCredentialBody,xe as parsePollingTriggerContext,yn as parsePollingTriggerDispatchData,Kn as parsePollingTriggerGrantBody,In as parsePublishPollingTickEventsData,Tt as parseRegisterFlowRunWaitBody,vt as parseRegisterFlowRunWaitData,Rr as parseRuntimeCredentialSessionCredential,D as parseRuntimeNetwork,Gn as parseSingleToolGrantBody,pr as parseSingleToolRuntimeCredentialBody,It as parseStepRecordBody,_t as parseStepRecordData,Ot as parseToolHandlerBundlesData,M as parseTriggerFileRuntimeDispatch,rn as parseTriggerHandlerBundlesData,he as parseWebhookDelivery,nn as parseWebhookDeliveryDispatchData,on as parseWebhookPublishEventsBody,sn as parseWebhookRearmBody,mr as parseWebhookRuntimeCredentialBody,Ln as parseWebhookTriggerGrantBody,tn as parseWebhookWatcherContext,gn as pollingTriggerContextPath,Un as pollingTriggerEgressGrantPath,mn as pollingTriggerHandlerBundlesPath,ar as pollingTriggerRuntimeCredentialPath,Rn as pollingTriggerTickEventsPath,De as requestHasMultipartFileParts,mt as stepResultPath,Nt as toolHandlerBundlesPath,Dn as toolInvocationEgressGrantPath,sr as toolInvocationRuntimeCredentialPath,Qt as webhookProtocolAdapterBundlePath,Vt as webhookTriggerContextPath,Jt as webhookTriggerDeliveryPath,Bn as webhookTriggerEgressGrantPath,Xt as webhookTriggerEventsPath,jt as webhookTriggerHandlerBundlesPath,Yt as webhookTriggerRearmPath,cr as webhookTriggerRuntimeCredentialPath,Yr as wfpUserRuntimeManifestPath};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ablehi/server-execution-contract",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Ablehi server to Cloudflare execution contract.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"check": "pnpm build && pnpm typecheck && pnpm lint && pnpm test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ablehi/error-contract": "
|
|
35
|
-
"@ablehi/flow-contract": "
|
|
34
|
+
"@ablehi/error-contract": "workspace:*",
|
|
35
|
+
"@ablehi/flow-contract": "workspace:*"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@typescript-eslint/eslint-plugin": "^8.62.0",
|