@ablehi/server-contract 0.2.3 → 0.2.5
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-BTl-jgfc.d.ts → edge-CLcEbZfb.d.ts} +53 -11
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const SERVER_CONTRACT_VERSION = "0.2.
|
|
1
|
+
declare const SERVER_CONTRACT_VERSION = "0.2.5";
|
|
2
2
|
type ServerContractVersion = typeof SERVER_CONTRACT_VERSION;
|
|
3
3
|
|
|
4
4
|
declare const FLOW_IR_SCHEMA_VERSION = "flow.ir.v1";
|
|
@@ -744,14 +744,8 @@ declare function parsePollingRuntimeCredentialBody(body: unknown): ContractParse
|
|
|
744
744
|
declare function parseWebhookRuntimeCredentialBody(body: unknown): ContractParseResult<WebhookRuntimeCredentialBody>;
|
|
745
745
|
declare function parseRuntimeCredentialSessionCredential(data: unknown): ContractParseResult<Record<string, unknown>>;
|
|
746
746
|
|
|
747
|
-
declare const
|
|
748
|
-
|
|
749
|
-
declare const FILE_CONTENT_ROUTE_SUBPATH = "/:fileId/content";
|
|
750
|
-
type FileRuntimeScopeKind = "flow_run" | "tool_invocation";
|
|
751
|
-
type FileRuntimeScope = {
|
|
752
|
-
scopeKind: FileRuntimeScopeKind;
|
|
753
|
-
scopeId: string;
|
|
754
|
-
};
|
|
747
|
+
declare const WORKSPACE_FILES_ROUTE_PREFIX = "/workspaces/:workspaceId/files";
|
|
748
|
+
type FileAccessIntent = "preview" | "download" | "text";
|
|
755
749
|
type FileRefData = {
|
|
756
750
|
file_id: string;
|
|
757
751
|
name: string;
|
|
@@ -762,10 +756,58 @@ type FileRefData = {
|
|
|
762
756
|
sha256?: string;
|
|
763
757
|
source?: string;
|
|
764
758
|
};
|
|
759
|
+
type PresignedFileUrlData = {
|
|
760
|
+
method: "GET" | "PUT";
|
|
761
|
+
url: string;
|
|
762
|
+
headers: Record<string, string>;
|
|
763
|
+
expires_at: string;
|
|
764
|
+
};
|
|
765
|
+
type FileUploadSessionData = {
|
|
766
|
+
file: FileRefData;
|
|
767
|
+
upload: PresignedFileUrlData;
|
|
768
|
+
};
|
|
769
|
+
type FileMetadataData = {
|
|
770
|
+
file: FileRefData;
|
|
771
|
+
};
|
|
772
|
+
type FileAccessData = {
|
|
773
|
+
file: FileRefData;
|
|
774
|
+
access: PresignedFileUrlData;
|
|
775
|
+
intent: FileAccessIntent;
|
|
776
|
+
};
|
|
777
|
+
declare const workspaceFileUploadSessionPath: (workspaceId: string) => string;
|
|
778
|
+
declare const workspaceFileCompletePath: (workspaceId: string, fileId: string) => string;
|
|
779
|
+
declare const workspaceFileMetadataPath: (workspaceId: string, fileId: string) => string;
|
|
780
|
+
declare const workspaceFileAccessPath: (workspaceId: string, fileId: string, intent: FileAccessIntent) => string;
|
|
781
|
+
declare function parseFileRefData(data: unknown): ContractParseResult<FileRefData>;
|
|
782
|
+
declare function parseFileUploadSessionData(data: unknown): ContractParseResult<FileUploadSessionData>;
|
|
783
|
+
declare function parseFileMetadataData(data: unknown): ContractParseResult<FileMetadataData>;
|
|
784
|
+
declare function parseFileAccessData(data: unknown): ContractParseResult<FileAccessData>;
|
|
785
|
+
|
|
786
|
+
declare const INTERNAL_FILES_ROUTE_PREFIX = "/internal/files";
|
|
787
|
+
declare const FILE_UPLOAD_SESSION_ROUTE_SUBPATH = "/upload-session";
|
|
788
|
+
declare const FILE_COMPLETE_ROUTE_SUBPATH = "/:fileId/complete";
|
|
789
|
+
declare const FILE_ACCESS_ROUTE_SUBPATH = "/:fileId/access";
|
|
790
|
+
declare const FILE_STAT_ROUTE_SUBPATH = "/:fileId/stat";
|
|
791
|
+
declare const FILE_CONTENT_ROUTE_SUBPATH = "/:fileId/content";
|
|
792
|
+
type FileRuntimeScopeKind = "flow_run" | "tool_invocation";
|
|
793
|
+
type FileRuntimeScope = {
|
|
794
|
+
scopeKind: FileRuntimeScopeKind;
|
|
795
|
+
scopeId: string;
|
|
796
|
+
};
|
|
797
|
+
type InternalFileAccessIntent = "runtime_read" | "provider_multipart";
|
|
798
|
+
type InternalFileAccessData = {
|
|
799
|
+
file: FileRefData;
|
|
800
|
+
access: PresignedFileUrlData;
|
|
801
|
+
intent: InternalFileAccessIntent;
|
|
802
|
+
};
|
|
765
803
|
declare const internalFilesPath: () => string;
|
|
804
|
+
declare const internalFileUploadSessionPath: () => string;
|
|
805
|
+
declare const internalFileCompletePath: (fileId: string) => string;
|
|
806
|
+
declare const internalFileAccessPath: (fileId: string, intent: InternalFileAccessIntent) => string;
|
|
766
807
|
declare const internalFileStatPath: (fileId: string, scope: FileRuntimeScope) => string;
|
|
767
808
|
declare const internalFileContentPath: (fileId: string, scope: FileRuntimeScope) => string;
|
|
768
|
-
|
|
809
|
+
|
|
810
|
+
declare function parseInternalFileAccessData(data: unknown): ContractParseResult<InternalFileAccessData>;
|
|
769
811
|
|
|
770
812
|
declare const HUMAN_INPUTS_ROUTE_SUBPATH = "/:flowRunId/human-inputs";
|
|
771
813
|
declare const HUMAN_INPUT_REQUEST_ROUTE_SUBPATH = "/:flowRunId/human-inputs/:requestId";
|
|
@@ -946,4 +988,4 @@ declare function deploymentHandshakeResponseProofPayload(input: {
|
|
|
946
988
|
capabilities: string[];
|
|
947
989
|
}): string;
|
|
948
990
|
|
|
949
|
-
export { type
|
|
991
|
+
export { type FileAccessIntent as $, type AblehiEnvelope as A, type BooleanExpression as B, CONTEXT_STATE_CLEANUP_ROUTE_PATH as C, DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES as D, EGRESS_GRANT_AUDIT_ROUTE_SUBPATH as E, type FlowNode as F, type EgressGrantConsumeBody as G, type EgressGrantFileRuntime as H, type EgressGrantScopeKind as I, type JsonValue as J, type ExecutionBinding as K, type ExecutionBindingConnection as L, type Mapping as M, type ExecutionContextCompiled as N, type ExecutionContextData as O, FILE_ACCESS_ROUTE_SUBPATH as P, FILE_COMPLETE_ROUTE_SUBPATH as Q, FILE_CONTENT_ROUTE_SUBPATH as R, FILE_STAT_ROUTE_SUBPATH as S, type TriggerBinding as T, FILE_UPLOAD_SESSION_ROUTE_SUBPATH as U, FLOW_INTERPRETER_CONTRACT_VERSION as V, FLOW_IR_SCHEMA_VERSION as W, FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH as X, FLOW_RUN_RESULT_ROUTE_SUBPATH as Y, FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH as Z, type FileAccessData as _, type FlowIrValidationResult as a, POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH as a$, type FileMetadataData as a0, type FileRefData as a1, type FileRuntimeLimits as a2, type FileRuntimeScope as a3, type FileRuntimeScopeKind as a4, type FileUploadSessionData as a5, type FlowActionGrantBody as a6, type FlowDefinition as a7, type FlowExecutionContextFileRuntime as a8, type FlowInterpreterContractVersion as a9, type HumanInputDelivery as aA, type HumanInputDeliveryAction as aB, type HumanInputNode as aC, type HumanInputOutput as aD, type HumanInputPrompt as aE, type HumanInputRequestView as aF, type HumanInputResolvedEvent as aG, type HumanInputResponse as aH, type HumanInputSpec as aI, type HumanTextInput as aJ, INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX as aK, INTERNAL_FILES_ROUTE_PREFIX as aL, INTERNAL_FLOW_RUNS_ROUTE_PREFIX as aM, INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX as aN, INTERNAL_INSTALLATIONS_ROUTE_PREFIX as aO, INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX as aP, INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX as aQ, INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX as aR, type IntegrationTriggerBinding as aS, type InternalFileAccessData as aT, type InternalFileAccessIntent as aU, type JsonArray as aV, type ManualTriggerBinding as aW, type NodeCommon as aX, type Operand as aY, POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH as aZ, POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH as a_, type FlowIrValidationCode as aa, type FlowIrValidationIssue as ab, type FlowRunResultData as ac, type FlowRunResultRequestBody as ad, type FlowRuntimeCredentialBody as ae, HANDLER_BUNDLES_ROUTE_SUBPATH as af, HANDSHAKE_CAPABILITY_MISSING as ag, HANDSHAKE_CONTRACT_VERSION_MISMATCH as ah, HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH as ai, HANDSHAKE_REQUEST_INVALID as aj, HANDSHAKE_SECRET_MISMATCH as ak, HANDSHAKE_SECRET_UNCONFIGURED as al, HUMAN_INPUTS_ROUTE_SUBPATH as am, HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH as an, HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH as ao, HUMAN_INPUT_REQUEST_ROUTE_SUBPATH as ap, HUMAN_INPUT_RESOLVED_EVENT_PREFIX as aq, type HandlerBundle as ar, type HandlerBundleModule as as, type HandlerBundlesData as at, type HandlerBundlesParseResult as au, type HumanChoiceInput as av, type HumanFormField as aw, type HumanFormInput as ax, type HumanInputActor as ay, type HumanInputChoice as az, type JsonObject as b, type WebhookPublishEventsBody as b$, POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH as b0, POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH as b1, type PackagePollingTriggerRuntimeDescriptor as b2, type PackageWebhookTriggerRuntimeDescriptor as b3, type ParsedFlowRunResultBody as b4, type PartiallyRenderedHumanInputDelivery as b5, type PartiallyRenderedMapping as b6, type PartiallyRenderedTemplatePart as b7, type PartiallyRenderedValue as b8, type PollingPublishBody as b9, type StepRecordResult as bA, TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH as bB, TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH as bC, TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH as bD, type TextExpression as bE, type ToolHandlerBundlesData as bF, type TriggerConnectionInfo as bG, type TriggerHandlerBundlesData as bH, type TriggerHandlerModule as bI, type ValueExpression as bJ, WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH as bK, WEBHOOK_PROTOCOL_ADAPTER_MODULE as bL, WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH as bM, WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH as bN, WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH as bO, WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH as bP, WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH as bQ, WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH as bR, WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH as bS, WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION as bT, WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION as bU, WORKSPACE_FILES_ROUTE_PREFIX as bV, type WaitEventNode as bW, type WebhookDelivery as bX, type WebhookProtocolAdapterBundleData as bY, type WebhookProtocolAdapterModule as bZ, type WebhookPublishEvent as b_, type PollingPublishEvent as ba, type PollingRuntimeCredentialBody as bb, type PollingTriggerContext as bc, type PollingTriggerGrantBody as bd, type PresignedFileUrlData as be, type PublishPollingTickEventResult as bf, type PublishPollingTickEventsData as bg, RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS as bh, type RegisterFlowRunWaitBody as bi, type RegisterFlowRunWaitData as bj, type RenderedFlowComposition as bk, type RenderedHumanInputPrompt as bl, type RuntimeCredentialSession as bm, type RuntimeCredentialSessionNetwork as bn, type RuntimeCredentialSessionScopeKind as bo, type RuntimeNetwork as bp, type RuntimeNetworkModel as bq, SERVER_CONTRACT_VERSION as br, STEP_RESULT_ROUTE_SUBPATH as bs, type ScheduleTriggerBinding as bt, type ServerContractVersion as bu, type SingleToolGrantBody as bv, type SleepNode as bw, type StepRecordBody as bx, type StepRecordBodyParseResult as by, type StepRecordData as bz, type FlowCompositionSpec as c, parsePublishPollingTickEventsData as c$, type WebhookPublishEventsData as c0, type WebhookRearmBody as c1, type WebhookRearmData as c2, type WebhookRuntimeCredentialBody as c3, type WebhookTriggerGrantBody as c4, type WebhookTriggerVerificationMethod as c5, type WebhookWatcherContext as c6, type WfpUserRuntimeManifest as c7, contractParseFail as c8, contractParseOk as c9, parseContextStateCleanupResponseData as cA, parseContextStateScope as cB, parseCreateHumanInputBody as cC, parseEgressGrantAuditBody as cD, parseEgressGrantConsumeBody as cE, parseEgressGrantConsumeData as cF, parseEgressGrantData as cG, parseExecutionContextData as cH, parseFileAccessData as cI, parseFileMetadataData as cJ, parseFileRefData as cK, parseFileRuntimeLimits as cL, parseFileUploadSessionData as cM, parseFlowActionGrantBody as cN, parseFlowRunResultBody as cO, parseFlowRunResultData as cP, parseFlowRuntimeCredentialBody as cQ, parseHandlerBundle as cR, parseHandlerBundlesData as cS, parseHumanInputAcknowledgeData as cT, parseHumanInputCreateData as cU, parseHumanInputRequestViewData as cV, parseInternalFileAccessData as cW, parsePollingPublishBody as cX, parsePollingRuntimeCredentialBody as cY, parsePollingTriggerContext as cZ, parsePollingTriggerGrantBody as c_, deploymentHandshakeProbePayload as ca, deploymentHandshakeResponseProofPayload as cb, egressGrantAuditPath as cc, egressGrantConsumePath as cd, eventWaitPath as ce, executionContextPath as cf, flowRunEgressGrantPath as cg, flowRunResultPath as ch, flowRunRuntimeCredentialPath as ci, flowScriptProtocolAdapterModuleName as cj, handlerBundlesPath as ck, humanInputAcknowledgePath as cl, humanInputExpirePath as cm, humanInputRequestPath as cn, humanInputResolvedEventType as co, humanInputsPath as cp, internalFileAccessPath as cq, internalFileCompletePath as cr, internalFileContentPath as cs, internalFileStatPath as ct, internalFileUploadSessionPath as cu, internalFilesPath as cv, isJsonRecord as cw, isValidRequestDigest as cx, parseCompleteFlowRunWaitBody as cy, parseContextStateCleanupRequestBody as cz, type AblehiFailure as d, parseRegisterFlowRunWaitBody as d0, parseRegisterFlowRunWaitData as d1, parseRuntimeCredentialSessionCredential as d2, parseRuntimeNetwork as d3, parseSingleToolGrantBody as d4, parseSingleToolRuntimeCredentialBody as d5, parseStepRecordBody as d6, parseStepRecordData as d7, parseToolHandlerBundlesData as d8, parseTriggerHandlerBundlesData as d9, workspaceFileAccessPath as dA, workspaceFileCompletePath as dB, workspaceFileMetadataPath as dC, workspaceFileUploadSessionPath as dD, parseWebhookDelivery as da, parseWebhookPublishEventsBody as db, parseWebhookRearmBody as dc, parseWebhookRuntimeCredentialBody as dd, parseWebhookTriggerGrantBody as de, parseWebhookWatcherContext as df, pollingTriggerContextPath as dg, pollingTriggerEgressGrantPath as dh, pollingTriggerHandlerBundlesPath as di, pollingTriggerRuntimeCredentialPath as dj, pollingTriggerTickEventsPath as dk, requestHasMultipartFileParts as dl, stepResultPath as dm, toolHandlerBundlesPath as dn, toolInvocationEgressGrantPath as dp, toolInvocationRuntimeCredentialPath as dq, webhookProtocolAdapterBundlePath as dr, webhookTriggerContextPath as ds, webhookTriggerDeliveryPath as dt, webhookTriggerEgressGrantPath as du, webhookTriggerEventsPath as dv, webhookTriggerHandlerBundlesPath as dw, webhookTriggerRearmPath as dx, webhookTriggerRuntimeCredentialPath as dy, wfpUserRuntimeManifestPath as dz, type AblehiSuccess as e, type ActionNode as f, type Collection as g, type CompleteFlowRunWaitBody as h, type CompleteFlowRunWaitData as i, type ContextStateCleanupRequestBody as j, type ContextStateCleanupResponseData as k, type ContextStateScope as l, type ContractParseResult as m, type CreateHumanInputRequestBody as n, DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES as o, DEPLOYMENT_HANDSHAKE_ROUTE as p, type DeploymentHandshakeData as q, type DeploymentHandshakeRequestBody as r, type DeploymentHandshakeResponse as s, EGRESS_GRANT_CONSUME_ROUTE_SUBPATH as t, EGRESS_GRANT_SCOPE_KINDS as u, EVENT_WAIT_ROUTE_SUBPATH as v, EXECUTION_CONTEXT_ROUTE_SUBPATH as w, type EgressGrant as x, type EgressGrantAuditBody as y, type EgressGrantBodyParseResult as z };
|
package/dist/edge.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AblehiEnvelope, d as AblehiFailure, e as AblehiSuccess, f as ActionNode, B as BooleanExpression, g as Collection, h as CompleteFlowRunWaitBody, i as CompleteFlowRunWaitData, m as ContractParseResult, n as CreateHumanInputRequestBody, D as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES, o as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES, p as DEPLOYMENT_HANDSHAKE_ROUTE, q as DeploymentHandshakeData, r as DeploymentHandshakeRequestBody, s as DeploymentHandshakeResponse, E as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH, t as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH, u as EGRESS_GRANT_SCOPE_KINDS, v as EVENT_WAIT_ROUTE_SUBPATH, w as EXECUTION_CONTEXT_ROUTE_SUBPATH, x as EgressGrant, y as EgressGrantAuditBody, z as EgressGrantBodyParseResult, G as EgressGrantConsumeBody, H as EgressGrantFileRuntime, I as EgressGrantScopeKind, K as ExecutionBinding, L as ExecutionBindingConnection, N as ExecutionContextCompiled, O as ExecutionContextData, P as
|
|
1
|
+
export { A as AblehiEnvelope, d as AblehiFailure, e as AblehiSuccess, f as ActionNode, B as BooleanExpression, g as Collection, h as CompleteFlowRunWaitBody, i as CompleteFlowRunWaitData, m as ContractParseResult, n as CreateHumanInputRequestBody, D as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES, o as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES, p as DEPLOYMENT_HANDSHAKE_ROUTE, q as DeploymentHandshakeData, r as DeploymentHandshakeRequestBody, s as DeploymentHandshakeResponse, E as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH, t as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH, u as EGRESS_GRANT_SCOPE_KINDS, v as EVENT_WAIT_ROUTE_SUBPATH, w as EXECUTION_CONTEXT_ROUTE_SUBPATH, x as EgressGrant, y as EgressGrantAuditBody, z as EgressGrantBodyParseResult, G as EgressGrantConsumeBody, H as EgressGrantFileRuntime, I as EgressGrantScopeKind, K as ExecutionBinding, L as ExecutionBindingConnection, N as ExecutionContextCompiled, O as ExecutionContextData, P as FILE_ACCESS_ROUTE_SUBPATH, Q as FILE_COMPLETE_ROUTE_SUBPATH, R as FILE_CONTENT_ROUTE_SUBPATH, S as FILE_STAT_ROUTE_SUBPATH, U as FILE_UPLOAD_SESSION_ROUTE_SUBPATH, V as FLOW_INTERPRETER_CONTRACT_VERSION, W as FLOW_IR_SCHEMA_VERSION, X as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH, Y as FLOW_RUN_RESULT_ROUTE_SUBPATH, Z as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, a1 as FileRefData, a2 as FileRuntimeLimits, a3 as FileRuntimeScope, a4 as FileRuntimeScopeKind, a5 as FileUploadSessionData, a6 as FlowActionGrantBody, c as FlowCompositionSpec, a7 as FlowDefinition, a8 as FlowExecutionContextFileRuntime, a9 as FlowInterpreterContractVersion, aa as FlowIrValidationCode, ab as FlowIrValidationIssue, a as FlowIrValidationResult, F as FlowNode, ac as FlowRunResultData, ad as FlowRunResultRequestBody, ae as FlowRuntimeCredentialBody, af as HANDLER_BUNDLES_ROUTE_SUBPATH, ag as HANDSHAKE_CAPABILITY_MISSING, ah as HANDSHAKE_CONTRACT_VERSION_MISMATCH, ai as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH, aj as HANDSHAKE_REQUEST_INVALID, ak as HANDSHAKE_SECRET_MISMATCH, al as HANDSHAKE_SECRET_UNCONFIGURED, am as HUMAN_INPUTS_ROUTE_SUBPATH, an as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH, ao as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH, ap as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH, aq as HUMAN_INPUT_RESOLVED_EVENT_PREFIX, ar as HandlerBundle, as as HandlerBundleModule, at as HandlerBundlesData, au as HandlerBundlesParseResult, av as HumanChoiceInput, aw as HumanFormField, ax as HumanFormInput, ay as HumanInputActor, az as HumanInputChoice, aA as HumanInputDelivery, aB as HumanInputDeliveryAction, aC as HumanInputNode, aD as HumanInputOutput, aE as HumanInputPrompt, aF as HumanInputRequestView, aG as HumanInputResolvedEvent, aH as HumanInputResponse, aI as HumanInputSpec, aJ as HumanTextInput, aK as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX, aL as INTERNAL_FILES_ROUTE_PREFIX, aM as INTERNAL_FLOW_RUNS_ROUTE_PREFIX, aN as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX, aO as INTERNAL_INSTALLATIONS_ROUTE_PREFIX, aP as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX, aQ as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX, aR as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX, aS as IntegrationTriggerBinding, aT as InternalFileAccessData, aU as InternalFileAccessIntent, aV as JsonArray, b as JsonObject, J as JsonValue, aW as ManualTriggerBinding, M as Mapping, aX as NodeCommon, aY as Operand, aZ as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH, a_ as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, a$ as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, b0 as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, b1 as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH, b2 as PackagePollingTriggerRuntimeDescriptor, b3 as PackageWebhookTriggerRuntimeDescriptor, b4 as ParsedFlowRunResultBody, b5 as PartiallyRenderedHumanInputDelivery, b6 as PartiallyRenderedMapping, b7 as PartiallyRenderedTemplatePart, b8 as PartiallyRenderedValue, b9 as PollingPublishBody, ba as PollingPublishEvent, bb as PollingRuntimeCredentialBody, bc as PollingTriggerContext, bd as PollingTriggerGrantBody, be as PresignedFileUrlData, bf as PublishPollingTickEventResult, bg as PublishPollingTickEventsData, bh as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS, bi as RegisterFlowRunWaitBody, bj as RegisterFlowRunWaitData, bk as RenderedFlowComposition, bl as RenderedHumanInputPrompt, bm as RuntimeCredentialSession, bn as RuntimeCredentialSessionNetwork, bo as RuntimeCredentialSessionScopeKind, bp as RuntimeNetwork, bq as RuntimeNetworkModel, br as SERVER_CONTRACT_VERSION, bs as STEP_RESULT_ROUTE_SUBPATH, bt as ScheduleTriggerBinding, bu as ServerContractVersion, bv as SingleToolGrantBody, bw as SleepNode, bx as StepRecordBody, by as StepRecordBodyParseResult, bz as StepRecordData, bA as StepRecordResult, bB as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH, bC as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH, bD as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, bE as TextExpression, bF as ToolHandlerBundlesData, T as TriggerBinding, bG as TriggerConnectionInfo, bH as TriggerHandlerBundlesData, bI as TriggerHandlerModule, bJ as ValueExpression, bK as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH, bL as WEBHOOK_PROTOCOL_ADAPTER_MODULE, bM as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH, bN as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH, bO as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, bP as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH, bQ as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, bR as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH, bS as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, bT as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION, bU as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION, bW as WaitEventNode, bX as WebhookDelivery, bY as WebhookProtocolAdapterBundleData, bZ as WebhookProtocolAdapterModule, b_ as WebhookPublishEvent, b$ as WebhookPublishEventsBody, c0 as WebhookPublishEventsData, c1 as WebhookRearmBody, c2 as WebhookRearmData, c3 as WebhookRuntimeCredentialBody, c4 as WebhookTriggerGrantBody, c5 as WebhookTriggerVerificationMethod, c6 as WebhookWatcherContext, c7 as WfpUserRuntimeManifest, c8 as contractParseFail, c9 as contractParseOk, ca as deploymentHandshakeProbePayload, cb as deploymentHandshakeResponseProofPayload, cc as egressGrantAuditPath, cd as egressGrantConsumePath, ce as eventWaitPath, cf as executionContextPath, cg as flowRunEgressGrantPath, ch as flowRunResultPath, ci as flowRunRuntimeCredentialPath, cj as flowScriptProtocolAdapterModuleName, ck as handlerBundlesPath, cl as humanInputAcknowledgePath, cm as humanInputExpirePath, cn as humanInputRequestPath, co as humanInputResolvedEventType, cp as humanInputsPath, cq as internalFileAccessPath, cr as internalFileCompletePath, cs as internalFileContentPath, ct as internalFileStatPath, cu as internalFileUploadSessionPath, cv as internalFilesPath, cw as isJsonRecord, cx as isValidRequestDigest, cy as parseCompleteFlowRunWaitBody, cC as parseCreateHumanInputBody, cD as parseEgressGrantAuditBody, cE as parseEgressGrantConsumeBody, cF as parseEgressGrantConsumeData, cG as parseEgressGrantData, cH as parseExecutionContextData, cK as parseFileRefData, cL as parseFileRuntimeLimits, cM as parseFileUploadSessionData, cN as parseFlowActionGrantBody, cO as parseFlowRunResultBody, cP as parseFlowRunResultData, cQ as parseFlowRuntimeCredentialBody, cR as parseHandlerBundle, cS as parseHandlerBundlesData, cT as parseHumanInputAcknowledgeData, cU as parseHumanInputCreateData, cV as parseHumanInputRequestViewData, cW as parseInternalFileAccessData, cX as parsePollingPublishBody, cY as parsePollingRuntimeCredentialBody, cZ as parsePollingTriggerContext, c_ as parsePollingTriggerGrantBody, c$ as parsePublishPollingTickEventsData, d0 as parseRegisterFlowRunWaitBody, d1 as parseRegisterFlowRunWaitData, d2 as parseRuntimeCredentialSessionCredential, d3 as parseRuntimeNetwork, d4 as parseSingleToolGrantBody, d5 as parseSingleToolRuntimeCredentialBody, d6 as parseStepRecordBody, d7 as parseStepRecordData, d8 as parseToolHandlerBundlesData, d9 as parseTriggerHandlerBundlesData, da as parseWebhookDelivery, db as parseWebhookPublishEventsBody, dc as parseWebhookRearmBody, dd as parseWebhookRuntimeCredentialBody, de as parseWebhookTriggerGrantBody, df as parseWebhookWatcherContext, dg as pollingTriggerContextPath, dh as pollingTriggerEgressGrantPath, di as pollingTriggerHandlerBundlesPath, dj as pollingTriggerRuntimeCredentialPath, dk as pollingTriggerTickEventsPath, dl as requestHasMultipartFileParts, dm as stepResultPath, dn as toolHandlerBundlesPath, dp as toolInvocationEgressGrantPath, dq as toolInvocationRuntimeCredentialPath, dr as webhookProtocolAdapterBundlePath, ds as webhookTriggerContextPath, dt as webhookTriggerDeliveryPath, du as webhookTriggerEgressGrantPath, dv as webhookTriggerEventsPath, dw as webhookTriggerHandlerBundlesPath, dx as webhookTriggerRearmPath, dy as webhookTriggerRuntimeCredentialPath, dz as wfpUserRuntimeManifestPath } from './edge-CLcEbZfb.js';
|
package/dist/edge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var z="0.2.3";var Ue="flow.ir.v1";var Q="flow.interp.v2";function a(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)}function I(e){if(!i(e)||typeof e.kind!="string")return r("context state scope surface shape is invalid");switch(e.kind){case"webhook-trigger":return Z(e);case"polling-trigger":return ee(e);case"flow-action":return te(e);default:return r("context state scope kind is invalid")}}function Z(e){let t=v(e,["kind","workspaceId","triggerInstanceId"]);return t!==void 0?r(`webhook trigger scope does not accept "${t}"`):e.kind!=="webhook-trigger"||!m(e.workspaceId)||!m(e.triggerInstanceId)?r("webhook trigger state scope is invalid"):a({kind:"webhook-trigger",workspaceId:e.workspaceId,triggerInstanceId:e.triggerInstanceId})}function ee(e){let t=v(e,["kind","workspaceId","pollingInstanceId"]);return t!==void 0?r(`polling trigger scope does not accept "${t}"`):e.kind!=="polling-trigger"||!m(e.workspaceId)||!m(e.pollingInstanceId)?r("polling trigger state scope is invalid"):a({kind:"polling-trigger",workspaceId:e.workspaceId,pollingInstanceId:e.pollingInstanceId})}function te(e){let t=v(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"||!m(e.workspaceId)||!m(e.flowId)||!m(e.nodeId)||n!==null&&!m(n)?r("flow action state scope is invalid"):a({kind:"flow-action",workspaceId:e.workspaceId,flowId:e.flowId,nodeId:e.nodeId,connectionId:n})}function m(e){return typeof e=="string"&&e.length>0}function v(e,t){return Object.keys(e).find(n=>!t.includes(n))}var f="/internal/flow-runs",We="/:flowRunId/execution-context";function Ve(e){return`${f}/${encodeURIComponent(e)}/execution-context`}function ne(e){return!i(e)||!D(e.fileMaxBytes)||!D(e.fileReadMaxBytes)||!D(e.inlineMultipartBytesMax)?r("file runtime limits must carry three positive integer bounds"):a({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function je(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)||!oe(e.executionBindings))return r("execution context surface shape is invalid");let n=re(e.fileRuntime);return n.ok?a({...e,fileRuntime:n.value}):r(n.reason)}function re(e){if(e===null)return a(null);if(!i(e))return r("fileRuntime must be null or an object");let t=ne(e.limits);return t.ok?a({limits:t.value}):r(t.reason)}function oe(e){return Array.isArray(e)?e.every(t=>{if(!i(t))return!1;let n=t.connection,o=I(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.authType=="string"&&o.ok}):!1}function D(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}var ze="/:flowRunId/steps/:nodeId/result",Qe="/:flowRunId/result",Ze="/:flowRunId/event-waits/:nodeId";function et(e,t){return`${f}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function tt(e){return`${f}/${encodeURIComponent(e)}/result`}function nt(e,t){return`${f}/${encodeURIComponent(e)}/event-waits/${encodeURIComponent(t)}`}function rt(e){if(!i(e))return{ok:!1,kind:"validation",reason:"step record body must be a JSON object"};let t=y(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=ie(e.result);if(!o.ok)return o;let s={attempt:n,result:o.value};if(e.durationMs!==void 0){let u=e.durationMs;if(typeof u!="number"||!Number.isFinite(u)||u<0)return{ok:!1,kind:"validation",reason:"durationMs must be a non-negative number"};s.durationMs=u}return{ok:!0,value:s}}function ie(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=y(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=y(e,["status","errorCode","issues"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=e.errorCode;if(typeof o!="string"||o.length===0)return{ok:!1,kind:"step_result_invalid",reason:"a failed result must carry a non-empty errorCode"};let s={status:"failed",errorCode:o};return e.issues!==void 0&&(s.issues=e.issues),{ok:!0,value:s}}return{ok:!1,kind:"step_result_invalid",reason:'result status must be "succeeded" or "failed"'}}function ot(e){return!i(e)||typeof e.flowRunId!="string"||typeof e.nodeId!="string"||e.recorded!=="succeeded"&&e.recorded!=="failed"?r("step record data surface shape is invalid"):a({flowRunId:e.flowRunId,nodeId:e.nodeId,recorded:e.recorded})}function it(e){if(!i(e))return r("result body must be a JSON object");let t=y(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&&(o.output=e.output),e.error!==void 0){let s=e.error;if(!i(s))return r("result error must be a JSON object");let u=y(s,["code","message"]);if(u!==void 0)return r(`result error does not accept the "${u}" field`);if(typeof s.code!="string"||typeof s.message!="string")return r("result error must carry string code and message");o.error={code:s.code,message:s.message}}if(e.composition!==void 0){if(n!=="succeeded")return r("composition is only allowed on a succeeded result");o.composition=e.composition}return a(o)}function st(e){return i(e)?a(e):r("flow run result data must be a JSON object")}var se=/^[A-Za-z0-9_-]{1,100}$/;function ut(e){if(!i(e))return r("register body must be a JSON object");let t=y(e,["eventType","correlationKey"]);if(t!==void 0)return r(`register wait does not accept the "${t}" field`);let n=L(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"):a({eventType:n.value,correlationKey:o})}function at(e){if(!i(e))return r("complete body must be a JSON object");let t=y(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=L(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 u={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");u.eventId=e.eventId}return a(u)}function dt(e){return!i(e)||e.registered!==!0?r("register wait data surface shape is invalid"):a({registered:!0})}function L(e){return typeof e!="string"||e.length===0?r("eventType must be a non-empty string"):se.test(e)?a(e):r("eventType must match ^[A-Za-z0-9_-]{1,100}$")}function y(e,t){return Object.keys(e).find(n=>!t.includes(n))}var ue="/internal/flow-versions",ct="/:flowVersionId/handler-bundles",H="/internal/installations",lt="/:installationId/handler-bundles";function gt(e,t){return`${ue}/${encodeURIComponent(e)}/handler-bundles?compiledArtifactId=${encodeURIComponent(t)}`}function ft(e){return`${H}/${encodeURIComponent(e.installationId)}/handler-bundles?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var ae=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function S(e){if(!k(e))return B("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!ae.has(t)?B("runtimeNetwork.networkModel is unknown"):!$(e.apiHosts)||!$(e.authHosts)||typeof e.httpsOnly!="boolean"?B("runtimeNetwork host/https fields are invalid"):{ok:!0,value:{networkModel:t,apiHosts:e.apiHosts,authHosts:e.authHosts,httpsOnly:e.httpsOnly}}}function mt(e){if(!k(e)||typeof e.flowVersionId!="string"||typeof e.compiledArtifactId!="string"||!Array.isArray(e.bundles))return E("handler bundles data surface shape is invalid");let t=K(e.bundles);return t.ok?{ok:!0,value:{flowVersionId:e.flowVersionId,compiledArtifactId:e.compiledArtifactId,bundles:t.value}}:t}function Rt(e){if(!k(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=K(e.bundles);return t.ok?{ok:!0,value:{installationId:e.installationId,artifactDigest:e.artifactDigest,bundles:t.value}}:t}function K(e){let t=[];for(let n of e){let o=de(n);if(!o.ok)return o;t.push(o.value)}return{ok:!0,value:t}}function de(e){if(!k(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=S(e.runtimeNetwork);return o.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"request",runtimeNetwork:o.value}}:o}let t=e.module;if(!k(t)||typeof t.entry!="string"||t.entry.length===0||!pe(t.files))return E("a handler bundle must carry a { entry, files } module");let n=S(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 B(e){return{ok:!1,kind:"runtime_network",reason:e}}function k(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function pe(e){return k(e)&&Object.values(e).every(t=>typeof t=="string")}var x="/internal/webhook-trigger-instances",xt="/:triggerInstanceId/context",Tt="/:triggerInstanceId/handler-bundles",wt="/:triggerInstanceId/deliveries/:deliveryId",ht="/:triggerInstanceId/events",Pt="/:triggerInstanceId/rearm",T=e=>`${x}/${encodeURIComponent(e)}`;function St(e,t){return`${T(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function Nt(e,t){return`${T(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function At(e,t){return`${T(e)}/deliveries/${encodeURIComponent(t)}`}function Ct(e){return`${T(e)}/events`}function bt(e){return`${T(e)}/rearm`}var Ot="/:installationId/webhook-protocol-adapter-bundle";function vt(e){return`${H}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var Dt="modules/webhook/protocol-adapter.js";function Bt(e){return`modules/webhook/protocol-adapter-${e}.js`}function Ht(e){let t=i(e)?I(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&&!ce(e.connection)||!le(e.runtime)||!t.ok||t.value.kind!=="webhook-trigger"?r("webhook watcher context surface shape is invalid"):a(e)}function ce(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function le(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 Ut(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"):a(e)}function Ft(e){if(!i(e)||typeof e.triggerRef!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.modules)||!e.modules.every(ge))return{ok:!1,kind:"shape",reason:"trigger handler bundles data surface shape is invalid"};let t=S(e.runtimeNetwork);return t.ok?{ok:!0,value:{triggerRef:e.triggerRef,artifactDigest:e.artifactDigest,modules:e.modules,runtimeNetwork:t.value}}:t}function ge(e){return i(e)&&typeof e.specifier=="string"&&e.specifier.length>0&&typeof e.source=="string"}function Mt(e){if(!i(e))return r("publish events body must be a JSON object");let t=U(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 u of o){let d=fe(u);if(!d.ok)return d;s.push(d.value)}return a({deliveryId:n,events:s})}function fe(e){if(!i(e))return r("each event must be a JSON object");let t=U(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 a(s)}function Gt(e){if(!i(e))return r("rearm body must be a JSON object");let t=U(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"):a({expectedWatcherInstanceId:n})}function U(e,t){return Object.keys(e).find(n=>!t.includes(n))}var w="/internal/polling-trigger-instances",qt="/:pollingInstanceId/context",Wt="/:pollingInstanceId/handler-bundles",Vt="/:pollingInstanceId/ticks/:tickId/events",F=e=>`${w}/${encodeURIComponent(e)}`;function jt(e,t,n){return`${F(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function Jt(e,t){return`${F(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Xt(e,t){return`${F(e)}/ticks/${encodeURIComponent(t)}/events`}function Yt(e){let t=i(e)?I(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&&!me(e.connection)||!Re(e.runtime)||!t.ok||t.value.kind!=="polling-trigger"||!ye(e.tick)||!Ie(e.limits)?r("polling trigger context surface shape is invalid"):a(e)}function me(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function Re(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 ye(e){return i(e)&&typeof e.tickId=="string"&&typeof e.scheduledAt=="string"&&typeof e.attempt=="number"}function Ie(e){return i(e)&&typeof e.maxEventsPerTick=="number"}function zt(e){if(!i(e))return r("publish body must be a JSON object");let t=q(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 u of n){let d=ke(u);if(!d.ok)return d;o.push(d.value)}let s={events:o};if("nextCursor"in e){let u=e.nextCursor;if(u!==null&&typeof u!="string")return r("nextCursor must be a string, null, or omitted");s.nextCursor=u}return a(s)}function ke(e){if(!i(e))return r("each event must be a JSON object");let t=q(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 a(n)}function Qt(e){return!i(e)||typeof e.tickId!="string"||typeof e.cursorUpdated!="boolean"||!Array.isArray(e.results)||!e.results.every(_e)?r("publish polling tick events data surface shape is invalid"):a(e)}function _e(e){return i(e)&&typeof e.eventId=="string"&&typeof e.dedupeKey=="string"&&typeof e.duplicate=="boolean"&&(e.flowRunId===null||typeof e.flowRunId=="string")}function q(e,t){return Object.keys(e).find(n=>!t.includes(n))}var W="/internal/egress-grants",M="/internal/tool-invocations",on="/:flowRunId/egress-grant",sn="/:invocationId/egress-grant",un="/:pollingInstanceId/egress-grant",an="/:triggerInstanceId/egress-grant",dn="/:grantId/consume",pn="/:grantId/audit",cn=e=>`${f}/${encodeURIComponent(e)}/egress-grant`,ln=e=>`${M}/${encodeURIComponent(e)}/egress-grant`,gn=e=>`${w}/${encodeURIComponent(e)}/egress-grant`,fn=e=>`${x}/${encodeURIComponent(e)}/egress-grant`,mn=e=>`${W}/${encodeURIComponent(e)}/consume`,Rn=e=>`${W}/${encodeURIComponent(e)}/audit`,Ee=["flow_action","single_tool","polling_trigger","webhook_trigger"],xe=/^[A-Za-z0-9][A-Za-z0-9:_+/=.-]{15,1023}$/;function h(e){return typeof e=="string"&&xe.test(e)}function Te(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 p(e){return{ok:!1,kind:"shape",reason:e}}function P(){return{ok:!1,kind:"request_digest",reason:"request digest is missing or malformed"}}function A(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 yn(e){let t=A(e,["nodeId","request","requestDigest"]);if(!t.ok)return p(t.reason);let n=t.record.nodeId;if(typeof n!="string"||n.length===0)return p("nodeId is required");let o=C(t.record.request);if(o!==void 0)return p(o);let s=t.record.requestDigest;return h(s)?{ok:!0,value:{nodeId:n,requestDigest:s,requestHasMultipartFiles:Te(t.record.request)}}:P()}function In(e){let t=A(e,["request","requestDigest"]);if(!t.ok)return p(t.reason);let n=C(t.record.request);if(n!==void 0)return p(n);let o=t.record.requestDigest;return h(o)?{ok:!0,value:{requestDigest:o}}:P()}function kn(e){let t=A(e,["tickId","request","requestDigest"]);if(!t.ok)return p(t.reason);let n=t.record.tickId;if(typeof n!="string"||n.length===0)return p("tickId is required");let o=C(t.record.request);if(o!==void 0)return p(o);let s=t.record.requestDigest;return h(s)?{ok:!0,value:{tickId:n,requestDigest:s}}:P()}function _n(e){let t=A(e,["phase","lifecycle","request","requestDigest"]);if(!t.ok)return p(t.reason);let n=t.record.phase;if(n!=="lifecycle"&&n!=="handler")return p('phase must be "lifecycle" or "handler"');let o=t.record.lifecycle,s;if(o!==void 0){if(o!=="enable"&&o!=="disable"&&o!=="renew")return p('lifecycle must be "enable", "disable", or "renew"');s=o}if(n==="lifecycle"&&s===void 0)return p("lifecycle is required for the lifecycle phase");let u=C(t.record.request);if(u!==void 0)return p(u);let d=t.record.requestDigest;return h(d)?{ok:!0,value:{phase:n,...s!==void 0?{lifecycle:s}:{},requestDigest:d}}:P()}function V(e){return Ee.includes(e)?e:void 0}var we=["scopeKind","scopeId","requestDigest"];function En(e){if(!i(e))return p("consume body must be a JSON object");for(let s of Object.keys(e))if(!we.includes(s))return p(`consume does not accept the "${s}" field`);let t=V(e.scopeKind);if(t===void 0)return p("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return p("scopeId is required");let o=e.requestDigest;return h(o)?{ok:!0,value:{scopeKind:t,scopeId:n,requestDigest:o}}:P()}var he=["scopeKind","scopeId","providerHost","status","durationMs","requestBytes","responseBytes","errorCode"];function N(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 xn(e){if(!i(e))return p("audit body must be a JSON object");for(let l of Object.keys(e))if(!he.includes(l))return p(`audit does not accept the "${l}" field`);let t=V(e.scopeKind);if(t===void 0)return p("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return p("scopeId is required");let o=e.providerHost;if(typeof o!="string"||o.length===0)return p("providerHost is required");let s=N(e.durationMs,"durationMs");if(!s.ok)return p(s.reason);let u;if(e.status!==void 0){let l=N(e.status,"status");if(!l.ok)return p(l.reason);u=l.value}let d;if(e.requestBytes!==void 0){let l=N(e.requestBytes,"requestBytes");if(!l.ok)return p(l.reason);d=l.value}let c;if(e.responseBytes!==void 0){let l=N(e.responseBytes,"responseBytes");if(!l.ok)return p(l.reason);c=l.value}let O;if(e.errorCode!==void 0){let l=e.errorCode;if(typeof l!="string"||l.length===0)return p("errorCode must be a non-empty string");O=l}return{ok:!0,value:{scopeKind:t,scopeId:n,providerHost:o,...u!==void 0?{status:u}:{},durationMs:s.value,...d!==void 0?{requestBytes:d}:{},...c!==void 0?{responseBytes:c}:{},...O!==void 0?{errorCode:O}:{}}}}function Tn(e){return!i(e)||!i(e.grant)?r("egress grant envelope must carry a grant object"):a(e.grant)}function wn(e){return!i(e)||e.consumed!==!0?r("egress grant consume data must carry consumed:true"):a({consumed:!0})}var bn="/:flowRunId/runtime-credential",On="/:invocationId/runtime-credential",vn="/:pollingInstanceId/runtime-credential",Dn="/:triggerInstanceId/runtime-credential",Bn=e=>`${f}/${encodeURIComponent(e)}/runtime-credential`,Hn=e=>`${M}/${encodeURIComponent(e)}/runtime-credential`,Un=e=>`${w}/${encodeURIComponent(e)}/runtime-credential`,Fn=e=>`${x}/${encodeURIComponent(e)}/runtime-credential`,Mn=["flow_action","tool_invoke","polling_trigger","webhook_trigger"];function b(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 Gn(e){let t=b(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"):a({nodeId:n})}function Ln(e){let t=b(e??{},[]);return t.ok?a(null):r(t.reason)}function $n(e){let t=b(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"):a({tickId:n})}function Kn(e){let t=b(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 u,d=t.record.lifecycleOperation;if(d!==void 0){if(d!=="enable"&&d!=="disable"&&d!=="renew")return r('lifecycleOperation must be "enable", "disable", or "renew"');u=d}return n==="lifecycle"&&u===void 0?r("lifecycleOperation is required for the lifecycle execution kind"):a({executionKind:n,...o!==void 0?{deliveryId:o}:{},...u!==void 0?{lifecycleOperation:u}:{}})}function qn(e){return!i(e)||typeof e.sessionId!="string"||typeof e.connectionId!="string"||!i(e.credential)?r("runtime credential session must carry sessionId, connectionId and a credential object"):a(e.credential)}var G="/internal/files",jn="/:fileId/stat",Jn="/:fileId/content",Xn=()=>G,j=e=>`?scope_kind=${encodeURIComponent(e.scopeKind)}&scope_id=${encodeURIComponent(e.scopeId)}`,Yn=(e,t)=>`${G}/${encodeURIComponent(e)}/stat${j(t)}`,zn=(e,t)=>`${G}/${encodeURIComponent(e)}/content${j(t)}`;function Qn(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"):a(e)}var nr="/:flowRunId/human-inputs",rr="/:flowRunId/human-inputs/:requestId",or="/:flowRunId/human-inputs/:requestId/expire",ir="/:flowRunId/human-inputs/:requestId/acknowledge",Pe=e=>`${f}/${encodeURIComponent(e)}/human-inputs`,J=(e,t)=>`${Pe(e)}/${encodeURIComponent(t)}`,sr=(e,t)=>`${J(e,t)}/expire`,ur=(e,t)=>`${J(e,t)}/acknowledge`,Se="human_input_resolved";function ar(e){return`${Se}_${e}`}function g(e){return{ok:!1,reason:e}}function R(e,t){return i(e)?{ok:!0,value:e}:g(`${t} must be an object`)}function _(e,t){return typeof e!="string"||e.length===0?g(`${t} must be a non-empty string`):{ok:!0,value:e}}var Ne=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function Ae(e,t){return typeof e!="string"||!Ne.test(e)||Number.isNaN(Date.parse(e))?g(`${t} must be an ISO-8601 timestamp`):{ok:!0,value:e}}function Ce(e){let t=R(e,"renderedPrompt");if(!t.ok)return t;let n=_(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 g("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 g("renderedPrompt.format is invalid");o.format=t.value.format}return{ok:!0,value:o}}function be(e){let t=R(e,"input");if(!t.ok)return t;let n=t.value.kind;if(n==="choice"){if(!Array.isArray(t.value.choices))return g("input.choices must be an array")}else if(n!=="text")if(n==="form"){if(!Array.isArray(t.value.fields))return g("input.fields must be an array")}else return g("input.kind is invalid");return{ok:!0,value:t.value}}function Oe(e){if(e==null)return{ok:!0,value:void 0};let t=R(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 g("partiallyRenderedDelivery.actions must be an array");let o=[];for(let s of n){let u=R(s,"delivery action");if(!u.ok)return u;let d=_(u.value.id,"delivery action id");if(!d.ok)return d;let c=X(u.value.inputs,`delivery action '${d.value}' inputs`);if(!c.ok)return c;o.push({id:d.value,inputs:c.value})}return{ok:!0,value:{actions:o}}}function X(e,t){let n=R(e,t);if(!n.ok)return n;let o={};for(let[s,u]of Object.entries(n.value)){let d=Y(u,`${t}.${s}`);if(!d.ok)return d;o[s]=d.value}return{ok:!0,value:o}}function Y(e,t){let n=R(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=_(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 g(`${t}.items must be an array`);let s=[];for(let[u,d]of n.value.items.entries()){let c=Y(d,`${t}[${u}]`);if(!c.ok)return c;s.push(c.value)}return{ok:!0,value:{kind:"array",items:s}}}case"object":{let s=X(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 g(`${t}.parts must be an array`);let s=[];for(let[u,d]of n.value.parts.entries()){let c=ve(d,`${t}.parts[${u}]`);if(!c.ok)return c;s.push(c.value)}return{ok:!0,value:{kind:"template",parts:s}}}default:return g(`${t}.kind is invalid`)}}function ve(e,t){let n=R(e,t);if(!n.ok)return n;let o=n.value.kind;if(o==="literal")return typeof n.value.value!="string"?g(`${t}.value must be a string`):{ok:!0,value:{kind:"literal",value:n.value.value}};if(o==="human_input_ref"){let s=_(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}return g(`${t}.kind is invalid`)}function dr(e){let t=R(e,"request body");if(!t.ok)return r(t.reason);let n=_(t.value.nodeId,"nodeId");if(!n.ok)return r(n.reason);let o=Ce(t.value.renderedPrompt);if(!o.ok)return r(o.reason);let s=be(t.value.input);if(!s.ok)return r(s.reason);let u=_(t.value.timeout,"timeout");if(!u.ok)return r(u.reason);let d=Ae(t.value.expiresAt,"expiresAt");if(!d.ok)return r(d.reason);let c=Oe(t.value.partiallyRenderedDelivery);return c.ok?a({nodeId:n.value,renderedPrompt:o.value,input:s.value,timeout:u.value,expiresAt:d.value,...c.value!==void 0?{partiallyRenderedDelivery:c.value}:{}}):r(c.reason)}function De(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"):a(e)}function pr(e){if(!i(e)||typeof e.created!="boolean")return r("human input create data must carry created:boolean");let t=De(e.request);return t.ok?a({created:e.created,request:t.value}):t}function cr(e){return!i(e)||e.acknowledged!==!0?r("human input acknowledge data must carry acknowledged:true"):a({acknowledged:!0})}var gr="ablehi-wfp-user-runtime-manifest/v1",fr="unknown";function mr(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var yr="/internal/deployment-handshake",Be=["start","terminate","send-event","start-webhook-watcher","run-polling-tick","invoke-tool","invoke-trigger-handler","invoke-webhook-protocol-adapter","deployment-handshake"],Ir=Be,kr="HANDSHAKE_REQUEST_INVALID",_r="HANDSHAKE_SECRET_UNCONFIGURED",Er="HANDSHAKE_SECRET_MISMATCH",xr="HANDSHAKE_CONTRACT_VERSION_MISMATCH",Tr="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",wr="HANDSHAKE_CAPABILITY_MISSING";function hr(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function Pr(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}export{Be as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,Ir as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,yr as DEPLOYMENT_HANDSHAKE_ROUTE,pn as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,dn as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,Ee as EGRESS_GRANT_SCOPE_KINDS,Ze as EVENT_WAIT_ROUTE_SUBPATH,We as EXECUTION_CONTEXT_ROUTE_SUBPATH,Jn as FILE_CONTENT_ROUTE_SUBPATH,jn as FILE_STAT_ROUTE_SUBPATH,Q as FLOW_INTERPRETER_CONTRACT_VERSION,Ue as FLOW_IR_SCHEMA_VERSION,on as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,Qe as FLOW_RUN_RESULT_ROUTE_SUBPATH,bn as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,ct as HANDLER_BUNDLES_ROUTE_SUBPATH,wr as HANDSHAKE_CAPABILITY_MISSING,xr as HANDSHAKE_CONTRACT_VERSION_MISMATCH,Tr as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,kr as HANDSHAKE_REQUEST_INVALID,Er as HANDSHAKE_SECRET_MISMATCH,_r as HANDSHAKE_SECRET_UNCONFIGURED,nr as HUMAN_INPUTS_ROUTE_SUBPATH,ir as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,or as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,rr as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,Se as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,W as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX,G as INTERNAL_FILES_ROUTE_PREFIX,f as INTERNAL_FLOW_RUNS_ROUTE_PREFIX,ue as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX,H as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,w as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,M as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,x as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,qt as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,un as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,Wt as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,vn as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Vt as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,Mn as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,z as SERVER_CONTRACT_VERSION,ze as STEP_RESULT_ROUTE_SUBPATH,lt as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,sn as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,On as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Ot as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,Dt as WEBHOOK_PROTOCOL_ADAPTER_MODULE,xt as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,wt as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,an as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,ht as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,Tt as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,Pt as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,Dn as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,gr as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,fr as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,r as contractParseFail,a as contractParseOk,hr as deploymentHandshakeProbePayload,Pr as deploymentHandshakeResponseProofPayload,Rn as egressGrantAuditPath,mn as egressGrantConsumePath,nt as eventWaitPath,Ve as executionContextPath,cn as flowRunEgressGrantPath,tt as flowRunResultPath,Bn as flowRunRuntimeCredentialPath,Bt as flowScriptProtocolAdapterModuleName,gt as handlerBundlesPath,ur as humanInputAcknowledgePath,sr as humanInputExpirePath,J as humanInputRequestPath,ar as humanInputResolvedEventType,Pe as humanInputsPath,zn as internalFileContentPath,Yn as internalFileStatPath,Xn as internalFilesPath,i as isJsonRecord,h as isValidRequestDigest,at as parseCompleteFlowRunWaitBody,dr as parseCreateHumanInputBody,xn as parseEgressGrantAuditBody,En as parseEgressGrantConsumeBody,wn as parseEgressGrantConsumeData,Tn as parseEgressGrantData,je as parseExecutionContextData,Qn as parseFileRefData,ne as parseFileRuntimeLimits,yn as parseFlowActionGrantBody,it as parseFlowRunResultBody,st as parseFlowRunResultData,Gn as parseFlowRuntimeCredentialBody,de as parseHandlerBundle,mt as parseHandlerBundlesData,cr as parseHumanInputAcknowledgeData,pr as parseHumanInputCreateData,De as parseHumanInputRequestViewData,zt as parsePollingPublishBody,$n as parsePollingRuntimeCredentialBody,Yt as parsePollingTriggerContext,kn as parsePollingTriggerGrantBody,Qt as parsePublishPollingTickEventsData,ut as parseRegisterFlowRunWaitBody,dt as parseRegisterFlowRunWaitData,qn as parseRuntimeCredentialSessionCredential,S as parseRuntimeNetwork,In as parseSingleToolGrantBody,Ln as parseSingleToolRuntimeCredentialBody,rt as parseStepRecordBody,ot as parseStepRecordData,Rt as parseToolHandlerBundlesData,Ft as parseTriggerHandlerBundlesData,Ut as parseWebhookDelivery,Mt as parseWebhookPublishEventsBody,Gt as parseWebhookRearmBody,Kn as parseWebhookRuntimeCredentialBody,_n as parseWebhookTriggerGrantBody,Ht as parseWebhookWatcherContext,jt as pollingTriggerContextPath,gn as pollingTriggerEgressGrantPath,Jt as pollingTriggerHandlerBundlesPath,Un as pollingTriggerRuntimeCredentialPath,Xt as pollingTriggerTickEventsPath,Te as requestHasMultipartFileParts,et as stepResultPath,ft as toolHandlerBundlesPath,ln as toolInvocationEgressGrantPath,Hn as toolInvocationRuntimeCredentialPath,vt as webhookProtocolAdapterBundlePath,St as webhookTriggerContextPath,At as webhookTriggerDeliveryPath,fn as webhookTriggerEgressGrantPath,Ct as webhookTriggerEventsPath,Nt as webhookTriggerHandlerBundlesPath,bt as webhookTriggerRearmPath,Fn as webhookTriggerRuntimeCredentialPath,mr as wfpUserRuntimeManifestPath};
|
|
1
|
+
var ee="0.2.5";var Ke="flow.ir.v1";var te="flow.interp.v2";function a(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)}function I(e){if(!i(e)||typeof e.kind!="string")return r("context state scope surface shape is invalid");switch(e.kind){case"webhook-trigger":return ne(e);case"polling-trigger":return re(e);case"flow-action":return oe(e);default:return r("context state scope kind is invalid")}}function ne(e){let t=D(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"):a({kind:"webhook-trigger",workspaceId:e.workspaceId,triggerInstanceId:e.triggerInstanceId})}function re(e){let t=D(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"):a({kind:"polling-trigger",workspaceId:e.workspaceId,pollingInstanceId:e.pollingInstanceId})}function oe(e){let t=D(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"):a({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 D(e,t){return Object.keys(e).find(n=>!t.includes(n))}var f="/internal/flow-runs",ze="/:flowRunId/execution-context";function Qe(e){return`${f}/${encodeURIComponent(e)}/execution-context`}function ie(e){return!i(e)||!U(e.fileMaxBytes)||!U(e.fileReadMaxBytes)||!U(e.inlineMultipartBytesMax)?r("file runtime limits must carry three positive integer bounds"):a({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function Ze(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=se(e.fileRuntime);return n.ok?a({...e,fileRuntime:n.value}):r(n.reason)}function se(e){if(e===null)return a(null);if(!i(e))return r("fileRuntime must be null or an object");let t=ie(e.limits);return t.ok?a({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=I(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.authType=="string"&&o.ok}):!1}function U(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}var rt="/:flowRunId/steps/:nodeId/result",ot="/:flowRunId/result",it="/:flowRunId/event-waits/:nodeId";function st(e,t){return`${f}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function at(e){return`${f}/${encodeURIComponent(e)}/result`}function ut(e,t){return`${f}/${encodeURIComponent(e)}/event-waits/${encodeURIComponent(t)}`}function ct(e){if(!i(e))return{ok:!1,kind:"validation",reason:"step record body must be a JSON object"};let t=y(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=ue(e.result);if(!o.ok)return o;let s={attempt:n,result:o.value};if(e.durationMs!==void 0){let u=e.durationMs;if(typeof u!="number"||!Number.isFinite(u)||u<0)return{ok:!1,kind:"validation",reason:"durationMs must be a non-negative number"};s.durationMs=u}return{ok:!0,value:s}}function ue(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=y(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=y(e,["status","errorCode","issues"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=e.errorCode;if(typeof o!="string"||o.length===0)return{ok:!1,kind:"step_result_invalid",reason:"a failed result must carry a non-empty errorCode"};let s={status:"failed",errorCode:o};return e.issues!==void 0&&(s.issues=e.issues),{ok:!0,value:s}}return{ok:!1,kind:"step_result_invalid",reason:'result status must be "succeeded" or "failed"'}}function dt(e){return!i(e)||typeof e.flowRunId!="string"||typeof e.nodeId!="string"||e.recorded!=="succeeded"&&e.recorded!=="failed"?r("step record data surface shape is invalid"):a({flowRunId:e.flowRunId,nodeId:e.nodeId,recorded:e.recorded})}function pt(e){if(!i(e))return r("result body must be a JSON object");let t=y(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&&(o.output=e.output),e.error!==void 0){let s=e.error;if(!i(s))return r("result error must be a JSON object");let u=y(s,["code","message"]);if(u!==void 0)return r(`result error does not accept the "${u}" field`);if(typeof s.code!="string"||typeof s.message!="string")return r("result error must carry string code and message");o.error={code:s.code,message:s.message}}if(e.composition!==void 0){if(n!=="succeeded")return r("composition is only allowed on a succeeded result");o.composition=e.composition}return a(o)}function lt(e){return i(e)?a(e):r("flow run result data must be a JSON object")}var ce=/^[A-Za-z0-9_-]{1,100}$/;function gt(e){if(!i(e))return r("register body must be a JSON object");let t=y(e,["eventType","correlationKey"]);if(t!==void 0)return r(`register wait does not accept the "${t}" field`);let n=G(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"):a({eventType:n.value,correlationKey:o})}function ft(e){if(!i(e))return r("complete body must be a JSON object");let t=y(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=G(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 u={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");u.eventId=e.eventId}return a(u)}function Rt(e){return!i(e)||e.registered!==!0?r("register wait data surface shape is invalid"):a({registered:!0})}function G(e){return typeof e!="string"||e.length===0?r("eventType must be a non-empty string"):ce.test(e)?a(e):r("eventType must match ^[A-Za-z0-9_-]{1,100}$")}function y(e,t){return Object.keys(e).find(n=>!t.includes(n))}var de="/internal/flow-versions",yt="/:flowVersionId/handler-bundles",H="/internal/installations",It="/:installationId/handler-bundles";function kt(e,t){return`${de}/${encodeURIComponent(e)}/handler-bundles?compiledArtifactId=${encodeURIComponent(t)}`}function _t(e){return`${H}/${encodeURIComponent(e.installationId)}/handler-bundles?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var pe=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function A(e){if(!k(e))return B("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!pe.has(t)?B("runtimeNetwork.networkModel is unknown"):!K(e.apiHosts)||!K(e.authHosts)||typeof e.httpsOnly!="boolean"?B("runtimeNetwork host/https fields are invalid"):{ok:!0,value:{networkModel:t,apiHosts:e.apiHosts,authHosts:e.authHosts,httpsOnly:e.httpsOnly}}}function Et(e){if(!k(e)||typeof e.flowVersionId!="string"||typeof e.compiledArtifactId!="string"||!Array.isArray(e.bundles))return x("handler bundles data surface shape is invalid");let t=q(e.bundles);return t.ok?{ok:!0,value:{flowVersionId:e.flowVersionId,compiledArtifactId:e.compiledArtifactId,bundles:t.value}}:t}function xt(e){if(!k(e)||typeof e.installationId!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.bundles))return x("tool handler bundles data surface shape is invalid");let t=q(e.bundles);return t.ok?{ok:!0,value:{installationId:e.installationId,artifactDigest:e.artifactDigest,bundles:t.value}}:t}function q(e){let t=[];for(let n of e){let o=le(n);if(!o.ok)return o;t.push(o.value)}return{ok:!0,value:t}}function le(e){if(!k(e)||typeof e.toolRef!="string"||e.kind!=="handler"&&e.kind!=="request")return x("handler bundle entry shape is invalid");if(e.kind==="request"){if(e.module!==void 0)return x("a request bundle must not carry a module");let o=A(e.runtimeNetwork);return o.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"request",runtimeNetwork:o.value}}:o}let t=e.module;if(!k(t)||typeof t.entry!="string"||t.entry.length===0||!ge(t.files))return x("a handler bundle must carry a { entry, files } module");let n=A(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 x(e){return{ok:!1,kind:"shape",reason:e}}function B(e){return{ok:!1,kind:"runtime_network",reason:e}}function k(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function K(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ge(e){return k(e)&&Object.values(e).every(t=>typeof t=="string")}var T="/internal/webhook-trigger-instances",At="/:triggerInstanceId/context",Ct="/:triggerInstanceId/handler-bundles",Nt="/:triggerInstanceId/deliveries/:deliveryId",bt="/:triggerInstanceId/events",Ot="/:triggerInstanceId/rearm",w=e=>`${T}/${encodeURIComponent(e)}`;function vt(e,t){return`${w(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function Dt(e,t){return`${w(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Ut(e,t){return`${w(e)}/deliveries/${encodeURIComponent(t)}`}function Bt(e){return`${w(e)}/events`}function Ht(e){return`${w(e)}/rearm`}var Ft="/:installationId/webhook-protocol-adapter-bundle";function $t(e){return`${H}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var Lt="modules/webhook/protocol-adapter.js";function Mt(e){return`modules/webhook/protocol-adapter-${e}.js`}function Gt(e){let t=i(e)?I(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&&!fe(e.connection)||!Re(e.runtime)||!t.ok||t.value.kind!=="webhook-trigger"?r("webhook watcher context surface shape is invalid"):a(e)}function fe(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function Re(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 Kt(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"):a(e)}function qt(e){if(!i(e)||typeof e.triggerRef!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.modules)||!e.modules.every(me))return{ok:!1,kind:"shape",reason:"trigger handler bundles data surface shape is invalid"};let t=A(e.runtimeNetwork);return t.ok?{ok:!0,value:{triggerRef:e.triggerRef,artifactDigest:e.artifactDigest,modules:e.modules,runtimeNetwork:t.value}}:t}function me(e){return i(e)&&typeof e.specifier=="string"&&e.specifier.length>0&&typeof e.source=="string"}function Wt(e){if(!i(e))return r("publish events body must be a JSON object");let t=F(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 u of o){let c=ye(u);if(!c.ok)return c;s.push(c.value)}return a({deliveryId:n,events:s})}function ye(e){if(!i(e))return r("each event must be a JSON object");let t=F(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 a(s)}function Vt(e){if(!i(e))return r("rearm body must be a JSON object");let t=F(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"):a({expectedWatcherInstanceId:n})}function F(e,t){return Object.keys(e).find(n=>!t.includes(n))}var h="/internal/polling-trigger-instances",Yt="/:pollingInstanceId/context",zt="/:pollingInstanceId/handler-bundles",Qt="/:pollingInstanceId/ticks/:tickId/events",$=e=>`${h}/${encodeURIComponent(e)}`;function Zt(e,t,n){return`${$(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function en(e,t){return`${$(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function tn(e,t){return`${$(e)}/ticks/${encodeURIComponent(t)}/events`}function nn(e){let t=i(e)?I(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&&!Ie(e.connection)||!ke(e.runtime)||!t.ok||t.value.kind!=="polling-trigger"||!_e(e.tick)||!Ee(e.limits)?r("polling trigger context surface shape is invalid"):a(e)}function Ie(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function ke(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 _e(e){return i(e)&&typeof e.tickId=="string"&&typeof e.scheduledAt=="string"&&typeof e.attempt=="number"}function Ee(e){return i(e)&&typeof e.maxEventsPerTick=="number"}function rn(e){if(!i(e))return r("publish body must be a JSON object");let t=W(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 u of n){let c=xe(u);if(!c.ok)return c;o.push(c.value)}let s={events:o};if("nextCursor"in e){let u=e.nextCursor;if(u!==null&&typeof u!="string")return r("nextCursor must be a string, null, or omitted");s.nextCursor=u}return a(s)}function xe(e){if(!i(e))return r("each event must be a JSON object");let t=W(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 a(n)}function on(e){return!i(e)||typeof e.tickId!="string"||typeof e.cursorUpdated!="boolean"||!Array.isArray(e.results)||!e.results.every(Te)?r("publish polling tick events data surface shape is invalid"):a(e)}function Te(e){return i(e)&&typeof e.eventId=="string"&&typeof e.dedupeKey=="string"&&typeof e.duplicate=="boolean"&&(e.flowRunId===null||typeof e.flowRunId=="string")}function W(e,t){return Object.keys(e).find(n=>!t.includes(n))}var V="/internal/egress-grants",L="/internal/tool-invocations",pn="/:flowRunId/egress-grant",ln="/:invocationId/egress-grant",gn="/:pollingInstanceId/egress-grant",fn="/:triggerInstanceId/egress-grant",Rn="/:grantId/consume",mn="/:grantId/audit",yn=e=>`${f}/${encodeURIComponent(e)}/egress-grant`,In=e=>`${L}/${encodeURIComponent(e)}/egress-grant`,kn=e=>`${h}/${encodeURIComponent(e)}/egress-grant`,_n=e=>`${T}/${encodeURIComponent(e)}/egress-grant`,En=e=>`${V}/${encodeURIComponent(e)}/consume`,xn=e=>`${V}/${encodeURIComponent(e)}/audit`,we=["flow_action","single_tool","polling_trigger","webhook_trigger"],he=/^[A-Za-z0-9][A-Za-z0-9:_+/=.-]{15,1023}$/;function P(e){return typeof e=="string"&&he.test(e)}function Pe(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 d(e){return{ok:!1,kind:"shape",reason:e}}function S(){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 b(e){if(!i(e))return"request must be a JSON object"}function Tn(e){let t=N(e,["nodeId","request","requestDigest"]);if(!t.ok)return d(t.reason);let n=t.record.nodeId;if(typeof n!="string"||n.length===0)return d("nodeId is required");let o=b(t.record.request);if(o!==void 0)return d(o);let s=t.record.requestDigest;return P(s)?{ok:!0,value:{nodeId:n,requestDigest:s,requestHasMultipartFiles:Pe(t.record.request)}}:S()}function wn(e){let t=N(e,["request","requestDigest"]);if(!t.ok)return d(t.reason);let n=b(t.record.request);if(n!==void 0)return d(n);let o=t.record.requestDigest;return P(o)?{ok:!0,value:{requestDigest:o}}:S()}function hn(e){let t=N(e,["tickId","request","requestDigest"]);if(!t.ok)return d(t.reason);let n=t.record.tickId;if(typeof n!="string"||n.length===0)return d("tickId is required");let o=b(t.record.request);if(o!==void 0)return d(o);let s=t.record.requestDigest;return P(s)?{ok:!0,value:{tickId:n,requestDigest:s}}:S()}function Pn(e){let t=N(e,["phase","lifecycle","request","requestDigest"]);if(!t.ok)return d(t.reason);let n=t.record.phase;if(n!=="lifecycle"&&n!=="handler")return d('phase must be "lifecycle" or "handler"');let o=t.record.lifecycle,s;if(o!==void 0){if(o!=="enable"&&o!=="disable"&&o!=="renew")return d('lifecycle must be "enable", "disable", or "renew"');s=o}if(n==="lifecycle"&&s===void 0)return d("lifecycle is required for the lifecycle phase");let u=b(t.record.request);if(u!==void 0)return d(u);let c=t.record.requestDigest;return P(c)?{ok:!0,value:{phase:n,...s!==void 0?{lifecycle:s}:{},requestDigest:c}}:S()}function j(e){return we.includes(e)?e:void 0}var Se=["scopeKind","scopeId","requestDigest"];function Sn(e){if(!i(e))return d("consume body must be a JSON object");for(let s of Object.keys(e))if(!Se.includes(s))return d(`consume does not accept the "${s}" field`);let t=j(e.scopeKind);if(t===void 0)return d("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return d("scopeId is required");let o=e.requestDigest;return P(o)?{ok:!0,value:{scopeKind:t,scopeId:n,requestDigest:o}}:S()}var Ae=["scopeKind","scopeId","providerHost","status","durationMs","requestBytes","responseBytes","errorCode"];function C(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 An(e){if(!i(e))return d("audit body must be a JSON object");for(let l of Object.keys(e))if(!Ae.includes(l))return d(`audit does not accept the "${l}" field`);let t=j(e.scopeKind);if(t===void 0)return d("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return d("scopeId is required");let o=e.providerHost;if(typeof o!="string"||o.length===0)return d("providerHost is required");let s=C(e.durationMs,"durationMs");if(!s.ok)return d(s.reason);let u;if(e.status!==void 0){let l=C(e.status,"status");if(!l.ok)return d(l.reason);u=l.value}let c;if(e.requestBytes!==void 0){let l=C(e.requestBytes,"requestBytes");if(!l.ok)return d(l.reason);c=l.value}let p;if(e.responseBytes!==void 0){let l=C(e.responseBytes,"responseBytes");if(!l.ok)return d(l.reason);p=l.value}let v;if(e.errorCode!==void 0){let l=e.errorCode;if(typeof l!="string"||l.length===0)return d("errorCode must be a non-empty string");v=l}return{ok:!0,value:{scopeKind:t,scopeId:n,providerHost:o,...u!==void 0?{status:u}:{},durationMs:s.value,...c!==void 0?{requestBytes:c}:{},...p!==void 0?{responseBytes:p}:{},...v!==void 0?{errorCode:v}:{}}}}function Cn(e){return!i(e)||!i(e.grant)?r("egress grant envelope must carry a grant object"):a(e.grant)}function Nn(e){return!i(e)||e.consumed!==!0?r("egress grant consume data must carry consumed:true"):a({consumed:!0})}var Hn="/:flowRunId/runtime-credential",Fn="/:invocationId/runtime-credential",$n="/:pollingInstanceId/runtime-credential",Ln="/:triggerInstanceId/runtime-credential",Mn=e=>`${f}/${encodeURIComponent(e)}/runtime-credential`,Gn=e=>`${L}/${encodeURIComponent(e)}/runtime-credential`,Kn=e=>`${h}/${encodeURIComponent(e)}/runtime-credential`,qn=e=>`${T}/${encodeURIComponent(e)}/runtime-credential`,Wn=["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 Vn(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"):a({nodeId:n})}function jn(e){let t=O(e??{},[]);return t.ok?a(null):r(t.reason)}function Jn(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"):a({tickId:n})}function Xn(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 u,c=t.record.lifecycleOperation;if(c!==void 0){if(c!=="enable"&&c!=="disable"&&c!=="renew")return r('lifecycleOperation must be "enable", "disable", or "renew"');u=c}return n==="lifecycle"&&u===void 0?r("lifecycleOperation is required for the lifecycle execution kind"):a({executionKind:n,...o!==void 0?{deliveryId:o}:{},...u!==void 0?{lifecycleOperation:u}:{}})}function Yn(e){return!i(e)||typeof e.sessionId!="string"||typeof e.connectionId!="string"||!i(e.credential)?r("runtime credential session must carry sessionId, connectionId and a credential object"):a(e.credential)}function M(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"):a(e)}function J(e){return!i(e)||e.method!=="GET"&&e.method!=="PUT"||typeof e.url!="string"||typeof e.expires_at!="string"||!be(e.headers)?r("presigned file URL data is invalid"):a(e)}function Ce(e){if(!i(e))return r("file upload session data is invalid");let t=M(e.file);if(!t.ok)return r(t.reason);let n=J(e.upload);return n.ok?a({file:t.value,upload:n.value}):r(n.reason)}function X(e){if(!i(e)||!Ne(e.intent))return r("file access data is invalid");let t=M(e.file);if(!t.ok)return r(t.reason);let n=J(e.access);return n.ok?a({file:t.value,access:n.value,intent:e.intent}):r(n.reason)}function Ne(e){return e==="preview"||e==="download"||e==="text"}function be(e){return i(e)?Object.values(e).every(t=>typeof t=="string"):!1}var _="/internal/files",nr="/upload-session",rr="/:fileId/complete",or="/:fileId/access",ir="/:fileId/stat",sr="/:fileId/content",ar=()=>_,ur=()=>`${_}/upload-session`,cr=e=>`${_}/${encodeURIComponent(e)}/complete`,dr=(e,t)=>`${_}/${encodeURIComponent(e)}/access?intent=${encodeURIComponent(t)}`,Y=e=>`?scope_kind=${encodeURIComponent(e.scopeKind)}&scope_id=${encodeURIComponent(e.scopeId)}`,pr=(e,t)=>`${_}/${encodeURIComponent(e)}/stat${Y(t)}`,lr=(e,t)=>`${_}/${encodeURIComponent(e)}/content${Y(t)}`;function gr(e){if(!i(e))return r("internal file access data is invalid");if(e.intent==="runtime_read"||e.intent==="provider_multipart"){let t=X({...e,intent:"preview"});return t.ok?a({file:t.value.file,access:t.value.access,intent:e.intent}):r(t.reason)}return r("internal file access intent is invalid")}var yr="/:flowRunId/human-inputs",Ir="/:flowRunId/human-inputs/:requestId",kr="/:flowRunId/human-inputs/:requestId/expire",_r="/:flowRunId/human-inputs/:requestId/acknowledge",Oe=e=>`${f}/${encodeURIComponent(e)}/human-inputs`,z=(e,t)=>`${Oe(e)}/${encodeURIComponent(t)}`,Er=(e,t)=>`${z(e,t)}/expire`,xr=(e,t)=>`${z(e,t)}/acknowledge`,ve="human_input_resolved";function Tr(e){return`${ve}_${e}`}function g(e){return{ok:!1,reason:e}}function m(e,t){return i(e)?{ok:!0,value:e}:g(`${t} must be an object`)}function E(e,t){return typeof e!="string"||e.length===0?g(`${t} must be a non-empty string`):{ok:!0,value:e}}var De=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function Ue(e,t){return typeof e!="string"||!De.test(e)||Number.isNaN(Date.parse(e))?g(`${t} must be an ISO-8601 timestamp`):{ok:!0,value:e}}function Be(e){let t=m(e,"renderedPrompt");if(!t.ok)return t;let n=E(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 g("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 g("renderedPrompt.format is invalid");o.format=t.value.format}return{ok:!0,value:o}}function He(e){let t=m(e,"input");if(!t.ok)return t;let n=t.value.kind;if(n==="choice"){if(!Array.isArray(t.value.choices))return g("input.choices must be an array")}else if(n!=="text")if(n==="form"){if(!Array.isArray(t.value.fields))return g("input.fields must be an array")}else return g("input.kind is invalid");return{ok:!0,value:t.value}}function Fe(e){if(e==null)return{ok:!0,value:void 0};let t=m(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 g("partiallyRenderedDelivery.actions must be an array");let o=[];for(let s of n){let u=m(s,"delivery action");if(!u.ok)return u;let c=E(u.value.id,"delivery action id");if(!c.ok)return c;let p=Q(u.value.inputs,`delivery action '${c.value}' inputs`);if(!p.ok)return p;o.push({id:c.value,inputs:p.value})}return{ok:!0,value:{actions:o}}}function Q(e,t){let n=m(e,t);if(!n.ok)return n;let o={};for(let[s,u]of Object.entries(n.value)){let c=Z(u,`${t}.${s}`);if(!c.ok)return c;o[s]=c.value}return{ok:!0,value:o}}function Z(e,t){let n=m(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=E(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 g(`${t}.items must be an array`);let s=[];for(let[u,c]of n.value.items.entries()){let p=Z(c,`${t}[${u}]`);if(!p.ok)return p;s.push(p.value)}return{ok:!0,value:{kind:"array",items:s}}}case"object":{let s=Q(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 g(`${t}.parts must be an array`);let s=[];for(let[u,c]of n.value.parts.entries()){let p=$e(c,`${t}.parts[${u}]`);if(!p.ok)return p;s.push(p.value)}return{ok:!0,value:{kind:"template",parts:s}}}default:return g(`${t}.kind is invalid`)}}function $e(e,t){let n=m(e,t);if(!n.ok)return n;let o=n.value.kind;if(o==="literal")return typeof n.value.value!="string"?g(`${t}.value must be a string`):{ok:!0,value:{kind:"literal",value:n.value.value}};if(o==="human_input_ref"){let s=E(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}return g(`${t}.kind is invalid`)}function wr(e){let t=m(e,"request body");if(!t.ok)return r(t.reason);let n=E(t.value.nodeId,"nodeId");if(!n.ok)return r(n.reason);let o=Be(t.value.renderedPrompt);if(!o.ok)return r(o.reason);let s=He(t.value.input);if(!s.ok)return r(s.reason);let u=E(t.value.timeout,"timeout");if(!u.ok)return r(u.reason);let c=Ue(t.value.expiresAt,"expiresAt");if(!c.ok)return r(c.reason);let p=Fe(t.value.partiallyRenderedDelivery);return p.ok?a({nodeId:n.value,renderedPrompt:o.value,input:s.value,timeout:u.value,expiresAt:c.value,...p.value!==void 0?{partiallyRenderedDelivery:p.value}:{}}):r(p.reason)}function Le(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"):a(e)}function hr(e){if(!i(e)||typeof e.created!="boolean")return r("human input create data must carry created:boolean");let t=Le(e.request);return t.ok?a({created:e.created,request:t.value}):t}function Pr(e){return!i(e)||e.acknowledged!==!0?r("human input acknowledge data must carry acknowledged:true"):a({acknowledged:!0})}var Ar="ablehi-wfp-user-runtime-manifest/v1",Cr="unknown";function Nr(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var Or="/internal/deployment-handshake",Me=["start","terminate","send-event","start-webhook-watcher","run-polling-tick","invoke-tool","invoke-trigger-handler","invoke-webhook-protocol-adapter","deployment-handshake"],vr=Me,Dr="HANDSHAKE_REQUEST_INVALID",Ur="HANDSHAKE_SECRET_UNCONFIGURED",Br="HANDSHAKE_SECRET_MISMATCH",Hr="HANDSHAKE_CONTRACT_VERSION_MISMATCH",Fr="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",$r="HANDSHAKE_CAPABILITY_MISSING";function Lr(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function Mr(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}export{Me as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,vr as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,Or as DEPLOYMENT_HANDSHAKE_ROUTE,mn as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,Rn as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,we as EGRESS_GRANT_SCOPE_KINDS,it as EVENT_WAIT_ROUTE_SUBPATH,ze as EXECUTION_CONTEXT_ROUTE_SUBPATH,or as FILE_ACCESS_ROUTE_SUBPATH,rr as FILE_COMPLETE_ROUTE_SUBPATH,sr as FILE_CONTENT_ROUTE_SUBPATH,ir as FILE_STAT_ROUTE_SUBPATH,nr as FILE_UPLOAD_SESSION_ROUTE_SUBPATH,te as FLOW_INTERPRETER_CONTRACT_VERSION,Ke as FLOW_IR_SCHEMA_VERSION,pn as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,ot as FLOW_RUN_RESULT_ROUTE_SUBPATH,Hn as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,yt as HANDLER_BUNDLES_ROUTE_SUBPATH,$r as HANDSHAKE_CAPABILITY_MISSING,Hr as HANDSHAKE_CONTRACT_VERSION_MISMATCH,Fr as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,Dr as HANDSHAKE_REQUEST_INVALID,Br as HANDSHAKE_SECRET_MISMATCH,Ur as HANDSHAKE_SECRET_UNCONFIGURED,yr as HUMAN_INPUTS_ROUTE_SUBPATH,_r as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,kr as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,Ir as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,ve as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,V as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX,_ as INTERNAL_FILES_ROUTE_PREFIX,f as INTERNAL_FLOW_RUNS_ROUTE_PREFIX,de as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX,H as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,h as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,L as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,T as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,Yt as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,gn as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,zt as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,$n as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Qt as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,Wn as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,ee as SERVER_CONTRACT_VERSION,rt as STEP_RESULT_ROUTE_SUBPATH,It as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,ln as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,Fn as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Ft as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,Lt as WEBHOOK_PROTOCOL_ADAPTER_MODULE,At as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,Nt as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,fn as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,bt as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,Ct as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,Ot as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,Ln as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Ar as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,Cr as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,r as contractParseFail,a as contractParseOk,Lr as deploymentHandshakeProbePayload,Mr as deploymentHandshakeResponseProofPayload,xn as egressGrantAuditPath,En as egressGrantConsumePath,ut as eventWaitPath,Qe as executionContextPath,yn as flowRunEgressGrantPath,at as flowRunResultPath,Mn as flowRunRuntimeCredentialPath,Mt as flowScriptProtocolAdapterModuleName,kt as handlerBundlesPath,xr as humanInputAcknowledgePath,Er as humanInputExpirePath,z as humanInputRequestPath,Tr as humanInputResolvedEventType,Oe as humanInputsPath,dr as internalFileAccessPath,cr as internalFileCompletePath,lr as internalFileContentPath,pr as internalFileStatPath,ur as internalFileUploadSessionPath,ar as internalFilesPath,i as isJsonRecord,P as isValidRequestDigest,ft as parseCompleteFlowRunWaitBody,wr as parseCreateHumanInputBody,An as parseEgressGrantAuditBody,Sn as parseEgressGrantConsumeBody,Nn as parseEgressGrantConsumeData,Cn as parseEgressGrantData,Ze as parseExecutionContextData,M as parseFileRefData,ie as parseFileRuntimeLimits,Ce as parseFileUploadSessionData,Tn as parseFlowActionGrantBody,pt as parseFlowRunResultBody,lt as parseFlowRunResultData,Vn as parseFlowRuntimeCredentialBody,le as parseHandlerBundle,Et as parseHandlerBundlesData,Pr as parseHumanInputAcknowledgeData,hr as parseHumanInputCreateData,Le as parseHumanInputRequestViewData,gr as parseInternalFileAccessData,rn as parsePollingPublishBody,Jn as parsePollingRuntimeCredentialBody,nn as parsePollingTriggerContext,hn as parsePollingTriggerGrantBody,on as parsePublishPollingTickEventsData,gt as parseRegisterFlowRunWaitBody,Rt as parseRegisterFlowRunWaitData,Yn as parseRuntimeCredentialSessionCredential,A as parseRuntimeNetwork,wn as parseSingleToolGrantBody,jn as parseSingleToolRuntimeCredentialBody,ct as parseStepRecordBody,dt as parseStepRecordData,xt as parseToolHandlerBundlesData,qt as parseTriggerHandlerBundlesData,Kt as parseWebhookDelivery,Wt as parseWebhookPublishEventsBody,Vt as parseWebhookRearmBody,Xn as parseWebhookRuntimeCredentialBody,Pn as parseWebhookTriggerGrantBody,Gt as parseWebhookWatcherContext,Zt as pollingTriggerContextPath,kn as pollingTriggerEgressGrantPath,en as pollingTriggerHandlerBundlesPath,Kn as pollingTriggerRuntimeCredentialPath,tn as pollingTriggerTickEventsPath,Pe as requestHasMultipartFileParts,st as stepResultPath,_t as toolHandlerBundlesPath,In as toolInvocationEgressGrantPath,Gn as toolInvocationRuntimeCredentialPath,$t as webhookProtocolAdapterBundlePath,vt as webhookTriggerContextPath,Ut as webhookTriggerDeliveryPath,_n as webhookTriggerEgressGrantPath,Bt as webhookTriggerEventsPath,Dt as webhookTriggerHandlerBundlesPath,Ht as webhookTriggerRearmPath,qn as webhookTriggerRuntimeCredentialPath,Nr as wfpUserRuntimeManifestPath};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as JsonValue, F as FlowNode, a as FlowIrValidationResult, b as JsonObject, c as FlowCompositionSpec, M as Mapping, T as TriggerBinding } from './edge-
|
|
2
|
-
export { A as AblehiEnvelope, d as AblehiFailure, e as AblehiSuccess, f as ActionNode, B as BooleanExpression, C as CONTEXT_STATE_CLEANUP_ROUTE_PATH, g as Collection, h as CompleteFlowRunWaitBody, i as CompleteFlowRunWaitData, j as ContextStateCleanupRequestBody, k as ContextStateCleanupResponseData, l as ContextStateScope, m as ContractParseResult, n as CreateHumanInputRequestBody, D as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES, o as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES, p as DEPLOYMENT_HANDSHAKE_ROUTE, q as DeploymentHandshakeData, r as DeploymentHandshakeRequestBody, s as DeploymentHandshakeResponse, E as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH, t as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH, u as EGRESS_GRANT_SCOPE_KINDS, v as EVENT_WAIT_ROUTE_SUBPATH, w as EXECUTION_CONTEXT_ROUTE_SUBPATH, x as EgressGrant, y as EgressGrantAuditBody, z as EgressGrantBodyParseResult, G as EgressGrantConsumeBody, H as EgressGrantFileRuntime, I as EgressGrantScopeKind, K as ExecutionBinding, L as ExecutionBindingConnection, N as ExecutionContextCompiled, O as ExecutionContextData, P as
|
|
1
|
+
import { J as JsonValue, F as FlowNode, a as FlowIrValidationResult, b as JsonObject, c as FlowCompositionSpec, M as Mapping, T as TriggerBinding } from './edge-CLcEbZfb.js';
|
|
2
|
+
export { A as AblehiEnvelope, d as AblehiFailure, e as AblehiSuccess, f as ActionNode, B as BooleanExpression, C as CONTEXT_STATE_CLEANUP_ROUTE_PATH, g as Collection, h as CompleteFlowRunWaitBody, i as CompleteFlowRunWaitData, j as ContextStateCleanupRequestBody, k as ContextStateCleanupResponseData, l as ContextStateScope, m as ContractParseResult, n as CreateHumanInputRequestBody, D as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES, o as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES, p as DEPLOYMENT_HANDSHAKE_ROUTE, q as DeploymentHandshakeData, r as DeploymentHandshakeRequestBody, s as DeploymentHandshakeResponse, E as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH, t as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH, u as EGRESS_GRANT_SCOPE_KINDS, v as EVENT_WAIT_ROUTE_SUBPATH, w as EXECUTION_CONTEXT_ROUTE_SUBPATH, x as EgressGrant, y as EgressGrantAuditBody, z as EgressGrantBodyParseResult, G as EgressGrantConsumeBody, H as EgressGrantFileRuntime, I as EgressGrantScopeKind, K as ExecutionBinding, L as ExecutionBindingConnection, N as ExecutionContextCompiled, O as ExecutionContextData, P as FILE_ACCESS_ROUTE_SUBPATH, Q as FILE_COMPLETE_ROUTE_SUBPATH, R as FILE_CONTENT_ROUTE_SUBPATH, S as FILE_STAT_ROUTE_SUBPATH, U as FILE_UPLOAD_SESSION_ROUTE_SUBPATH, V as FLOW_INTERPRETER_CONTRACT_VERSION, W as FLOW_IR_SCHEMA_VERSION, X as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH, Y as FLOW_RUN_RESULT_ROUTE_SUBPATH, Z as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, _ as FileAccessData, $ as FileAccessIntent, a0 as FileMetadataData, a1 as FileRefData, a2 as FileRuntimeLimits, a3 as FileRuntimeScope, a4 as FileRuntimeScopeKind, a5 as FileUploadSessionData, a6 as FlowActionGrantBody, a7 as FlowDefinition, a8 as FlowExecutionContextFileRuntime, a9 as FlowInterpreterContractVersion, aa as FlowIrValidationCode, ab as FlowIrValidationIssue, ac as FlowRunResultData, ad as FlowRunResultRequestBody, ae as FlowRuntimeCredentialBody, af as HANDLER_BUNDLES_ROUTE_SUBPATH, ag as HANDSHAKE_CAPABILITY_MISSING, ah as HANDSHAKE_CONTRACT_VERSION_MISMATCH, ai as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH, aj as HANDSHAKE_REQUEST_INVALID, ak as HANDSHAKE_SECRET_MISMATCH, al as HANDSHAKE_SECRET_UNCONFIGURED, am as HUMAN_INPUTS_ROUTE_SUBPATH, an as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH, ao as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH, ap as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH, aq as HUMAN_INPUT_RESOLVED_EVENT_PREFIX, ar as HandlerBundle, as as HandlerBundleModule, at as HandlerBundlesData, au as HandlerBundlesParseResult, av as HumanChoiceInput, aw as HumanFormField, ax as HumanFormInput, ay as HumanInputActor, az as HumanInputChoice, aA as HumanInputDelivery, aB as HumanInputDeliveryAction, aC as HumanInputNode, aD as HumanInputOutput, aE as HumanInputPrompt, aF as HumanInputRequestView, aG as HumanInputResolvedEvent, aH as HumanInputResponse, aI as HumanInputSpec, aJ as HumanTextInput, aK as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX, aL as INTERNAL_FILES_ROUTE_PREFIX, aM as INTERNAL_FLOW_RUNS_ROUTE_PREFIX, aN as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX, aO as INTERNAL_INSTALLATIONS_ROUTE_PREFIX, aP as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX, aQ as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX, aR as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX, aS as IntegrationTriggerBinding, aT as InternalFileAccessData, aU as InternalFileAccessIntent, aV as JsonArray, aW as ManualTriggerBinding, aX as NodeCommon, aY as Operand, aZ as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH, a_ as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, a$ as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, b0 as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, b1 as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH, b2 as PackagePollingTriggerRuntimeDescriptor, b3 as PackageWebhookTriggerRuntimeDescriptor, b4 as ParsedFlowRunResultBody, b5 as PartiallyRenderedHumanInputDelivery, b6 as PartiallyRenderedMapping, b7 as PartiallyRenderedTemplatePart, b8 as PartiallyRenderedValue, b9 as PollingPublishBody, ba as PollingPublishEvent, bb as PollingRuntimeCredentialBody, bc as PollingTriggerContext, bd as PollingTriggerGrantBody, be as PresignedFileUrlData, bf as PublishPollingTickEventResult, bg as PublishPollingTickEventsData, bh as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS, bi as RegisterFlowRunWaitBody, bj as RegisterFlowRunWaitData, bk as RenderedFlowComposition, bl as RenderedHumanInputPrompt, bm as RuntimeCredentialSession, bn as RuntimeCredentialSessionNetwork, bo as RuntimeCredentialSessionScopeKind, bp as RuntimeNetwork, bq as RuntimeNetworkModel, br as SERVER_CONTRACT_VERSION, bs as STEP_RESULT_ROUTE_SUBPATH, bt as ScheduleTriggerBinding, bu as ServerContractVersion, bv as SingleToolGrantBody, bw as SleepNode, bx as StepRecordBody, by as StepRecordBodyParseResult, bz as StepRecordData, bA as StepRecordResult, bB as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH, bC as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH, bD as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, bE as TextExpression, bF as ToolHandlerBundlesData, bG as TriggerConnectionInfo, bH as TriggerHandlerBundlesData, bI as TriggerHandlerModule, bJ as ValueExpression, bK as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH, bL as WEBHOOK_PROTOCOL_ADAPTER_MODULE, bM as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH, bN as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH, bO as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, bP as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH, bQ as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, bR as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH, bS as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, bT as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION, bU as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION, bV as WORKSPACE_FILES_ROUTE_PREFIX, bW as WaitEventNode, bX as WebhookDelivery, bY as WebhookProtocolAdapterBundleData, bZ as WebhookProtocolAdapterModule, b_ as WebhookPublishEvent, b$ as WebhookPublishEventsBody, c0 as WebhookPublishEventsData, c1 as WebhookRearmBody, c2 as WebhookRearmData, c3 as WebhookRuntimeCredentialBody, c4 as WebhookTriggerGrantBody, c5 as WebhookTriggerVerificationMethod, c6 as WebhookWatcherContext, c7 as WfpUserRuntimeManifest, c8 as contractParseFail, c9 as contractParseOk, ca as deploymentHandshakeProbePayload, cb as deploymentHandshakeResponseProofPayload, cc as egressGrantAuditPath, cd as egressGrantConsumePath, ce as eventWaitPath, cf as executionContextPath, cg as flowRunEgressGrantPath, ch as flowRunResultPath, ci as flowRunRuntimeCredentialPath, cj as flowScriptProtocolAdapterModuleName, ck as handlerBundlesPath, cl as humanInputAcknowledgePath, cm as humanInputExpirePath, cn as humanInputRequestPath, co as humanInputResolvedEventType, cp as humanInputsPath, cq as internalFileAccessPath, cr as internalFileCompletePath, cs as internalFileContentPath, ct as internalFileStatPath, cu as internalFileUploadSessionPath, cv as internalFilesPath, cw as isJsonRecord, cx as isValidRequestDigest, cy as parseCompleteFlowRunWaitBody, cz as parseContextStateCleanupRequestBody, cA as parseContextStateCleanupResponseData, cB as parseContextStateScope, cC as parseCreateHumanInputBody, cD as parseEgressGrantAuditBody, cE as parseEgressGrantConsumeBody, cF as parseEgressGrantConsumeData, cG as parseEgressGrantData, cH as parseExecutionContextData, cI as parseFileAccessData, cJ as parseFileMetadataData, cK as parseFileRefData, cL as parseFileRuntimeLimits, cM as parseFileUploadSessionData, cN as parseFlowActionGrantBody, cO as parseFlowRunResultBody, cP as parseFlowRunResultData, cQ as parseFlowRuntimeCredentialBody, cR as parseHandlerBundle, cS as parseHandlerBundlesData, cT as parseHumanInputAcknowledgeData, cU as parseHumanInputCreateData, cV as parseHumanInputRequestViewData, cW as parseInternalFileAccessData, cX as parsePollingPublishBody, cY as parsePollingRuntimeCredentialBody, cZ as parsePollingTriggerContext, c_ as parsePollingTriggerGrantBody, c$ as parsePublishPollingTickEventsData, d0 as parseRegisterFlowRunWaitBody, d1 as parseRegisterFlowRunWaitData, d2 as parseRuntimeCredentialSessionCredential, d3 as parseRuntimeNetwork, d4 as parseSingleToolGrantBody, d5 as parseSingleToolRuntimeCredentialBody, d6 as parseStepRecordBody, d7 as parseStepRecordData, d8 as parseToolHandlerBundlesData, d9 as parseTriggerHandlerBundlesData, da as parseWebhookDelivery, db as parseWebhookPublishEventsBody, dc as parseWebhookRearmBody, dd as parseWebhookRuntimeCredentialBody, de as parseWebhookTriggerGrantBody, df as parseWebhookWatcherContext, dg as pollingTriggerContextPath, dh as pollingTriggerEgressGrantPath, di as pollingTriggerHandlerBundlesPath, dj as pollingTriggerRuntimeCredentialPath, dk as pollingTriggerTickEventsPath, dl as requestHasMultipartFileParts, dm as stepResultPath, dn as toolHandlerBundlesPath, dp as toolInvocationEgressGrantPath, dq as toolInvocationRuntimeCredentialPath, dr as webhookProtocolAdapterBundlePath, ds as webhookTriggerContextPath, dt as webhookTriggerDeliveryPath, du as webhookTriggerEgressGrantPath, dv as webhookTriggerEventsPath, dw as webhookTriggerHandlerBundlesPath, dx as webhookTriggerRearmPath, dy as webhookTriggerRuntimeCredentialPath, dz as wfpUserRuntimeManifestPath, dA as workspaceFileAccessPath, dB as workspaceFileCompletePath, dC as workspaceFileMetadataPath, dD as workspaceFileUploadSessionPath } from './edge-CLcEbZfb.js';
|
|
3
3
|
|
|
4
4
|
declare const PLATFORM_ACCESS_PERMISSION = "platform.access";
|
|
5
5
|
declare const PLATFORM_API_KEY_MANAGE_PERMISSION = "platform.api_key.manage";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ue="0.2.3";var ct="flow.ir.v1";var le="flow.interp.v2";function a(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 _t="/cleanup-state-scopes";function R(e){if(!i(e)||typeof e.kind!="string")return r("context state scope surface shape is invalid");switch(e.kind){case"webhook-trigger":return ce(e);case"polling-trigger":return de(e);case"flow-action":return ge(e);default:return r("context state scope kind is invalid")}}function Rt(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=R(o);if(!s.ok)return s;n.push(s.value)}return a({scopes:n})}function yt(e){return!i(e)||typeof e.deleted!="number"||!Number.isSafeInteger(e.deleted)||e.deleted<0?r("cleanup response data surface shape is invalid"):a({deleted:e.deleted})}function ce(e){let t=N(e,["kind","workspaceId","triggerInstanceId"]);return t!==void 0?r(`webhook trigger scope does not accept "${t}"`):e.kind!=="webhook-trigger"||!m(e.workspaceId)||!m(e.triggerInstanceId)?r("webhook trigger state scope is invalid"):a({kind:"webhook-trigger",workspaceId:e.workspaceId,triggerInstanceId:e.triggerInstanceId})}function de(e){let t=N(e,["kind","workspaceId","pollingInstanceId"]);return t!==void 0?r(`polling trigger scope does not accept "${t}"`):e.kind!=="polling-trigger"||!m(e.workspaceId)||!m(e.pollingInstanceId)?r("polling trigger state scope is invalid"):a({kind:"polling-trigger",workspaceId:e.workspaceId,pollingInstanceId:e.pollingInstanceId})}function ge(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"||!m(e.workspaceId)||!m(e.flowId)||!m(e.nodeId)||n!==null&&!m(n)?r("flow action state scope is invalid"):a({kind:"flow-action",workspaceId:e.workspaceId,flowId:e.flowId,nodeId:e.nodeId,connectionId:n})}function m(e){return typeof e=="string"&&e.length>0}function N(e,t){return Object.keys(e).find(n=>!t.includes(n))}var f="/internal/flow-runs",Et="/:flowRunId/execution-context";function wt(e){return`${f}/${encodeURIComponent(e)}/execution-context`}function fe(e){return!i(e)||!G(e.fileMaxBytes)||!G(e.fileReadMaxBytes)||!G(e.inlineMultipartBytesMax)?r("file runtime limits must carry three positive integer bounds"):a({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function At(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)||!_e(e.executionBindings))return r("execution context surface shape is invalid");let n=me(e.fileRuntime);return n.ok?a({...e,fileRuntime:n.value}):r(n.reason)}function me(e){if(e===null)return a(null);if(!i(e))return r("fileRuntime must be null or an object");let t=fe(e.limits);return t.ok?a({limits:t.value}):r(t.reason)}function _e(e){return Array.isArray(e)?e.every(t=>{if(!i(t))return!1;let n=t.connection,o=R(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.authType=="string"&&o.ok}):!1}function G(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}var Ot="/:flowRunId/steps/:nodeId/result",Pt="/:flowRunId/result",Nt="/:flowRunId/event-waits/:nodeId";function bt(e,t){return`${f}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function Ct(e){return`${f}/${encodeURIComponent(e)}/result`}function Dt(e,t){return`${f}/${encodeURIComponent(e)}/event-waits/${encodeURIComponent(t)}`}function vt(e){if(!i(e))return{ok:!1,kind:"validation",reason:"step record body must be a JSON object"};let t=y(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=Re(e.result);if(!o.ok)return o;let s={attempt:n,result:o.value};if(e.durationMs!==void 0){let p=e.durationMs;if(typeof p!="number"||!Number.isFinite(p)||p<0)return{ok:!1,kind:"validation",reason:"durationMs must be a non-negative number"};s.durationMs=p}return{ok:!0,value:s}}function Re(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=y(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=y(e,["status","errorCode","issues"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=e.errorCode;if(typeof o!="string"||o.length===0)return{ok:!1,kind:"step_result_invalid",reason:"a failed result must carry a non-empty errorCode"};let s={status:"failed",errorCode:o};return e.issues!==void 0&&(s.issues=e.issues),{ok:!0,value:s}}return{ok:!1,kind:"step_result_invalid",reason:'result status must be "succeeded" or "failed"'}}function Ft(e){return!i(e)||typeof e.flowRunId!="string"||typeof e.nodeId!="string"||e.recorded!=="succeeded"&&e.recorded!=="failed"?r("step record data surface shape is invalid"):a({flowRunId:e.flowRunId,nodeId:e.nodeId,recorded:e.recorded})}function Ut(e){if(!i(e))return r("result body must be a JSON object");let t=y(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&&(o.output=e.output),e.error!==void 0){let s=e.error;if(!i(s))return r("result error must be a JSON object");let p=y(s,["code","message"]);if(p!==void 0)return r(`result error does not accept the "${p}" field`);if(typeof s.code!="string"||typeof s.message!="string")return r("result error must carry string code and message");o.error={code:s.code,message:s.message}}if(e.composition!==void 0){if(n!=="succeeded")return r("composition is only allowed on a succeeded result");o.composition=e.composition}return a(o)}function Lt(e){return i(e)?a(e):r("flow run result data must be a JSON object")}var ye=/^[A-Za-z0-9_-]{1,100}$/;function Bt(e){if(!i(e))return r("register body must be a JSON object");let t=y(e,["eventType","correlationKey"]);if(t!==void 0)return r(`register wait does not accept the "${t}" field`);let n=X(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"):a({eventType:n.value,correlationKey:o})}function Gt(e){if(!i(e))return r("complete body must be a JSON object");let t=y(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=X(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 p={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");p.eventId=e.eventId}return a(p)}function Ht(e){return!i(e)||e.registered!==!0?r("register wait data surface shape is invalid"):a({registered:!0})}function X(e){return typeof e!="string"||e.length===0?r("eventType must be a non-empty string"):ye.test(e)?a(e):r("eventType must match ^[A-Za-z0-9_-]{1,100}$")}function y(e,t){return Object.keys(e).find(n=>!t.includes(n))}var Ie="/internal/flow-versions",Kt="/:flowVersionId/handler-bundles",M="/internal/installations",$t="/:installationId/handler-bundles";function Wt(e,t){return`${Ie}/${encodeURIComponent(e)}/handler-bundles?compiledArtifactId=${encodeURIComponent(t)}`}function Vt(e){return`${M}/${encodeURIComponent(e.installationId)}/handler-bundles?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var Te=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function b(e){if(!I(e))return H("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!Te.has(t)?H("runtimeNetwork.networkModel is unknown"):!Y(e.apiHosts)||!Y(e.authHosts)||typeof e.httpsOnly!="boolean"?H("runtimeNetwork host/https fields are invalid"):{ok:!0,value:{networkModel:t,apiHosts:e.apiHosts,authHosts:e.authHosts,httpsOnly:e.httpsOnly}}}function qt(e){if(!I(e)||typeof e.flowVersionId!="string"||typeof e.compiledArtifactId!="string"||!Array.isArray(e.bundles))return A("handler bundles data surface shape is invalid");let t=z(e.bundles);return t.ok?{ok:!0,value:{flowVersionId:e.flowVersionId,compiledArtifactId:e.compiledArtifactId,bundles:t.value}}:t}function jt(e){if(!I(e)||typeof e.installationId!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.bundles))return A("tool handler bundles data surface shape is invalid");let t=z(e.bundles);return t.ok?{ok:!0,value:{installationId:e.installationId,artifactDigest:e.artifactDigest,bundles:t.value}}:t}function z(e){let t=[];for(let n of e){let o=xe(n);if(!o.ok)return o;t.push(o.value)}return{ok:!0,value:t}}function xe(e){if(!I(e)||typeof e.toolRef!="string"||e.kind!=="handler"&&e.kind!=="request")return A("handler bundle entry shape is invalid");if(e.kind==="request"){if(e.module!==void 0)return A("a request bundle must not carry a module");let o=b(e.runtimeNetwork);return o.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"request",runtimeNetwork:o.value}}:o}let t=e.module;if(!I(t)||typeof t.entry!="string"||t.entry.length===0||!Ee(t.files))return A("a handler bundle must carry a { entry, files } module");let n=b(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 A(e){return{ok:!1,kind:"shape",reason:e}}function H(e){return{ok:!1,kind:"runtime_network",reason:e}}function I(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Y(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Ee(e){return I(e)&&Object.values(e).every(t=>typeof t=="string")}var k="/internal/webhook-trigger-instances",Zt="/:triggerInstanceId/context",en="/:triggerInstanceId/handler-bundles",tn="/:triggerInstanceId/deliveries/:deliveryId",nn="/:triggerInstanceId/events",rn="/:triggerInstanceId/rearm",S=e=>`${k}/${encodeURIComponent(e)}`;function on(e,t){return`${S(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function sn(e,t){return`${S(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function an(e,t){return`${S(e)}/deliveries/${encodeURIComponent(t)}`}function pn(e){return`${S(e)}/events`}function un(e){return`${S(e)}/rearm`}var ln="/:installationId/webhook-protocol-adapter-bundle";function cn(e){return`${M}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var dn="modules/webhook/protocol-adapter.js";function gn(e){return`modules/webhook/protocol-adapter-${e}.js`}function fn(e){let t=i(e)?R(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&&!we(e.connection)||!Ae(e.runtime)||!t.ok||t.value.kind!=="webhook-trigger"?r("webhook watcher context surface shape is invalid"):a(e)}function we(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function Ae(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 mn(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"):a(e)}function _n(e){if(!i(e)||typeof e.triggerRef!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.modules)||!e.modules.every(ke))return{ok:!1,kind:"shape",reason:"trigger handler bundles data surface shape is invalid"};let t=b(e.runtimeNetwork);return t.ok?{ok:!0,value:{triggerRef:e.triggerRef,artifactDigest:e.artifactDigest,modules:e.modules,runtimeNetwork:t.value}}:t}function ke(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 p of o){let u=Se(p);if(!u.ok)return u;s.push(u.value)}return a({deliveryId:n,events:s})}function Se(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 a(s)}function yn(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"):a({expectedWatcherInstanceId:n})}function K(e,t){return Object.keys(e).find(n=>!t.includes(n))}var h="/internal/polling-trigger-instances",En="/:pollingInstanceId/context",wn="/:pollingInstanceId/handler-bundles",An="/:pollingInstanceId/ticks/:tickId/events",$=e=>`${h}/${encodeURIComponent(e)}`;function kn(e,t,n){return`${$(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function Sn(e,t){return`${$(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function hn(e,t){return`${$(e)}/ticks/${encodeURIComponent(t)}/events`}function On(e){let t=i(e)?R(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&&!he(e.connection)||!Oe(e.runtime)||!t.ok||t.value.kind!=="polling-trigger"||!Pe(e.tick)||!Ne(e.limits)?r("polling trigger context surface shape is invalid"):a(e)}function he(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function Oe(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 Ne(e){return i(e)&&typeof e.maxEventsPerTick=="number"}function Pn(e){if(!i(e))return r("publish body must be a JSON object");let t=Q(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 p of n){let u=be(p);if(!u.ok)return u;o.push(u.value)}let s={events:o};if("nextCursor"in e){let p=e.nextCursor;if(p!==null&&typeof p!="string")return r("nextCursor must be a string, null, or omitted");s.nextCursor=p}return a(s)}function be(e){if(!i(e))return r("each event must be a JSON object");let t=Q(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 a(n)}function Nn(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"):a(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 Q(e,t){return Object.keys(e).find(n=>!t.includes(n))}var Z="/internal/egress-grants",W="/internal/tool-invocations",Un="/:flowRunId/egress-grant",Ln="/:invocationId/egress-grant",Bn="/:pollingInstanceId/egress-grant",Gn="/:triggerInstanceId/egress-grant",Hn="/:grantId/consume",Mn="/:grantId/audit",Kn=e=>`${f}/${encodeURIComponent(e)}/egress-grant`,$n=e=>`${W}/${encodeURIComponent(e)}/egress-grant`,Wn=e=>`${h}/${encodeURIComponent(e)}/egress-grant`,Vn=e=>`${k}/${encodeURIComponent(e)}/egress-grant`,qn=e=>`${Z}/${encodeURIComponent(e)}/consume`,jn=e=>`${Z}/${encodeURIComponent(e)}/audit`,De=["flow_action","single_tool","polling_trigger","webhook_trigger"],ve=/^[A-Za-z0-9][A-Za-z0-9:_+/=.-]{15,1023}$/;function O(e){return typeof e=="string"&&ve.test(e)}function Fe(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 P(){return{ok:!1,kind:"request_digest",reason:"request digest is missing or malformed"}}function D(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 v(e){if(!i(e))return"request must be a JSON object"}function Jn(e){let t=D(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=v(t.record.request);if(o!==void 0)return l(o);let s=t.record.requestDigest;return O(s)?{ok:!0,value:{nodeId:n,requestDigest:s,requestHasMultipartFiles:Fe(t.record.request)}}:P()}function Xn(e){let t=D(e,["request","requestDigest"]);if(!t.ok)return l(t.reason);let n=v(t.record.request);if(n!==void 0)return l(n);let o=t.record.requestDigest;return O(o)?{ok:!0,value:{requestDigest:o}}:P()}function Yn(e){let t=D(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=v(t.record.request);if(o!==void 0)return l(o);let s=t.record.requestDigest;return O(s)?{ok:!0,value:{tickId:n,requestDigest:s}}:P()}function zn(e){let t=D(e,["phase","lifecycle","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 p=v(t.record.request);if(p!==void 0)return l(p);let u=t.record.requestDigest;return O(u)?{ok:!0,value:{phase:n,...s!==void 0?{lifecycle:s}:{},requestDigest:u}}:P()}function ee(e){return De.includes(e)?e:void 0}var Ue=["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(!Ue.includes(s))return l(`consume does not accept the "${s}" field`);let t=ee(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 O(o)?{ok:!0,value:{scopeKind:t,scopeId:n,requestDigest:o}}:P()}var Le=["scopeKind","scopeId","providerHost","status","durationMs","requestBytes","responseBytes","errorCode"];function C(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 Zn(e){if(!i(e))return l("audit body must be a JSON object");for(let d of Object.keys(e))if(!Le.includes(d))return l(`audit does not accept the "${d}" field`);let t=ee(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=C(e.durationMs,"durationMs");if(!s.ok)return l(s.reason);let p;if(e.status!==void 0){let d=C(e.status,"status");if(!d.ok)return l(d.reason);p=d.value}let u;if(e.requestBytes!==void 0){let d=C(e.requestBytes,"requestBytes");if(!d.ok)return l(d.reason);u=d.value}let c;if(e.responseBytes!==void 0){let d=C(e.responseBytes,"responseBytes");if(!d.ok)return l(d.reason);c=d.value}let B;if(e.errorCode!==void 0){let d=e.errorCode;if(typeof d!="string"||d.length===0)return l("errorCode must be a non-empty string");B=d}return{ok:!0,value:{scopeKind:t,scopeId:n,providerHost:o,...p!==void 0?{status:p}:{},durationMs:s.value,...u!==void 0?{requestBytes:u}:{},...c!==void 0?{responseBytes:c}:{},...B!==void 0?{errorCode:B}:{}}}}function er(e){return!i(e)||!i(e.grant)?r("egress grant envelope must carry a grant object"):a(e.grant)}function tr(e){return!i(e)||e.consumed!==!0?r("egress grant consume data must carry consumed:true"):a({consumed:!0})}var pr="/:flowRunId/runtime-credential",ur="/:invocationId/runtime-credential",lr="/:pollingInstanceId/runtime-credential",cr="/:triggerInstanceId/runtime-credential",dr=e=>`${f}/${encodeURIComponent(e)}/runtime-credential`,gr=e=>`${W}/${encodeURIComponent(e)}/runtime-credential`,fr=e=>`${h}/${encodeURIComponent(e)}/runtime-credential`,mr=e=>`${k}/${encodeURIComponent(e)}/runtime-credential`,_r=["flow_action","tool_invoke","polling_trigger","webhook_trigger"];function F(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 Rr(e){let t=F(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"):a({nodeId:n})}function yr(e){let t=F(e??{},[]);return t.ok?a(null):r(t.reason)}function Ir(e){let t=F(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"):a({tickId:n})}function Tr(e){let t=F(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 p,u=t.record.lifecycleOperation;if(u!==void 0){if(u!=="enable"&&u!=="disable"&&u!=="renew")return r('lifecycleOperation must be "enable", "disable", or "renew"');p=u}return n==="lifecycle"&&p===void 0?r("lifecycleOperation is required for the lifecycle execution kind"):a({executionKind:n,...o!==void 0?{deliveryId:o}:{},...p!==void 0?{lifecycleOperation:p}:{}})}function xr(e){return!i(e)||typeof e.sessionId!="string"||typeof e.connectionId!="string"||!i(e.credential)?r("runtime credential session must carry sessionId, connectionId and a credential object"):a(e.credential)}var V="/internal/files",Ar="/:fileId/stat",kr="/:fileId/content",Sr=()=>V,te=e=>`?scope_kind=${encodeURIComponent(e.scopeKind)}&scope_id=${encodeURIComponent(e.scopeId)}`,hr=(e,t)=>`${V}/${encodeURIComponent(e)}/stat${te(t)}`,Or=(e,t)=>`${V}/${encodeURIComponent(e)}/content${te(t)}`;function Pr(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"):a(e)}var Dr="/:flowRunId/human-inputs",vr="/:flowRunId/human-inputs/:requestId",Fr="/:flowRunId/human-inputs/:requestId/expire",Ur="/:flowRunId/human-inputs/:requestId/acknowledge",Be=e=>`${f}/${encodeURIComponent(e)}/human-inputs`,ne=(e,t)=>`${Be(e)}/${encodeURIComponent(t)}`,Lr=(e,t)=>`${ne(e,t)}/expire`,Br=(e,t)=>`${ne(e,t)}/acknowledge`,Ge="human_input_resolved";function Gr(e){return`${Ge}_${e}`}function g(e){return{ok:!1,reason:e}}function _(e,t){return i(e)?{ok:!0,value:e}:g(`${t} must be an object`)}function T(e,t){return typeof e!="string"||e.length===0?g(`${t} must be a non-empty string`):{ok:!0,value:e}}var He=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function Me(e,t){return typeof e!="string"||!He.test(e)||Number.isNaN(Date.parse(e))?g(`${t} must be an ISO-8601 timestamp`):{ok:!0,value:e}}function Ke(e){let t=_(e,"renderedPrompt");if(!t.ok)return t;let n=T(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 g("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 g("renderedPrompt.format is invalid");o.format=t.value.format}return{ok:!0,value:o}}function $e(e){let t=_(e,"input");if(!t.ok)return t;let n=t.value.kind;if(n==="choice"){if(!Array.isArray(t.value.choices))return g("input.choices must be an array")}else if(n!=="text")if(n==="form"){if(!Array.isArray(t.value.fields))return g("input.fields must be an array")}else return g("input.kind is invalid");return{ok:!0,value:t.value}}function We(e){if(e==null)return{ok:!0,value:void 0};let t=_(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 g("partiallyRenderedDelivery.actions must be an array");let o=[];for(let s of n){let p=_(s,"delivery action");if(!p.ok)return p;let u=T(p.value.id,"delivery action id");if(!u.ok)return u;let c=re(p.value.inputs,`delivery action '${u.value}' inputs`);if(!c.ok)return c;o.push({id:u.value,inputs:c.value})}return{ok:!0,value:{actions:o}}}function re(e,t){let n=_(e,t);if(!n.ok)return n;let o={};for(let[s,p]of Object.entries(n.value)){let u=oe(p,`${t}.${s}`);if(!u.ok)return u;o[s]=u.value}return{ok:!0,value:o}}function oe(e,t){let n=_(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=T(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 g(`${t}.items must be an array`);let s=[];for(let[p,u]of n.value.items.entries()){let c=oe(u,`${t}[${p}]`);if(!c.ok)return c;s.push(c.value)}return{ok:!0,value:{kind:"array",items:s}}}case"object":{let s=re(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 g(`${t}.parts must be an array`);let s=[];for(let[p,u]of n.value.parts.entries()){let c=Ve(u,`${t}.parts[${p}]`);if(!c.ok)return c;s.push(c.value)}return{ok:!0,value:{kind:"template",parts:s}}}default:return g(`${t}.kind is invalid`)}}function Ve(e,t){let n=_(e,t);if(!n.ok)return n;let o=n.value.kind;if(o==="literal")return typeof n.value.value!="string"?g(`${t}.value must be a string`):{ok:!0,value:{kind:"literal",value:n.value.value}};if(o==="human_input_ref"){let s=T(n.value.path,`${t}.path`);return s.ok?{ok:!0,value:{kind:"human_input_ref",path:s.value}}:s}return g(`${t}.kind is invalid`)}function Hr(e){let t=_(e,"request body");if(!t.ok)return r(t.reason);let n=T(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=$e(t.value.input);if(!s.ok)return r(s.reason);let p=T(t.value.timeout,"timeout");if(!p.ok)return r(p.reason);let u=Me(t.value.expiresAt,"expiresAt");if(!u.ok)return r(u.reason);let c=We(t.value.partiallyRenderedDelivery);return c.ok?a({nodeId:n.value,renderedPrompt:o.value,input:s.value,timeout:p.value,expiresAt:u.value,...c.value!==void 0?{partiallyRenderedDelivery:c.value}:{}}):r(c.reason)}function qe(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"):a(e)}function Mr(e){if(!i(e)||typeof e.created!="boolean")return r("human input create data must carry created:boolean");let t=qe(e.request);return t.ok?a({created:e.created,request:t.value}):t}function Kr(e){return!i(e)||e.acknowledged!==!0?r("human input acknowledge data must carry acknowledged:true"):a({acknowledged:!0})}var Wr="ablehi-wfp-user-runtime-manifest/v1",Vr="unknown";function qr(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var Jr="/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"],Xr=je,Yr="HANDSHAKE_REQUEST_INVALID",zr="HANDSHAKE_SECRET_UNCONFIGURED",Qr="HANDSHAKE_SECRET_MISMATCH",Zr="HANDSHAKE_CONTRACT_VERSION_MISMATCH",eo="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",to="HANDSHAKE_CAPABILITY_MISSING";function no(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function ro(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}var io="platform.access",so="platform.api_key.manage";var po="/me",uo=()=>"/me";var Je="/app/bootstrap",co=()=>Je;var ie="/workspaces",fo="/",mo="/:workspaceId",Xe="/me/default-workspace",_o=e=>`${ie}/${encodeURIComponent(e)}`,Ro=()=>ie,yo=()=>Xe;var q="/api-keys",Ye="/grant-options",To="/:apiKeyId",xo="ahi_key_",Eo="workspace.full_access",wo=()=>q,Ao=()=>`${q}${Ye}`,ko=e=>`${q}/${encodeURIComponent(e)}`;var j="/catalog",ho="/integrations",Oo="/integrations/:slug",Po="/versions",No="/integrations/:slug/default-provider-app-config",bo=e=>{let t=`${j}/integrations`;return e?.category!==void 0&&e.category!==""?`${t}?category=${encodeURIComponent(e.category)}`:t},ze=e=>`${j}/integrations/${encodeURIComponent(e)}`,Co=()=>`${j}/versions`,Do=e=>`${ze(e)}/default-provider-app-config`;var Fo="/workspaces/:workspaceId/integrations",Uo="/:installationId",Lo="/:installationId/tools",Qe=e=>`/workspaces/${encodeURIComponent(e)}/integrations`,Ze=(e,t)=>`${Qe(e)}/${encodeURIComponent(t)}`,Bo=(e,t)=>`${Ze(e,t)}/tools`;var Ho="/workspaces/:workspaceId",Mo="/connections",Ko="/integrations/:installationId/connect/start",$o="/integrations/:installationId/connect/options",Wo="/connect-sessions/:sessionId/submit",Vo="/connect-sessions/:sessionId/complete",qo="/integrations/:installationId/connections/:connectionRef",jo="/callbacks/redirect",x=e=>`/workspaces/${encodeURIComponent(e)}`,Jo=e=>`${x(e)}/connections`,Xo=(e,t)=>`${x(e)}/integrations/${encodeURIComponent(t)}/connect/start`,Yo=(e,t)=>`${x(e)}/integrations/${encodeURIComponent(t)}/connect/options`,zo=(e,t)=>`${x(e)}/connect-sessions/${encodeURIComponent(t)}/submit`,Qo=(e,t)=>`${x(e)}/connect-sessions/${encodeURIComponent(t)}/complete`,Zo=(e,t,n)=>`${x(e)}/integrations/${encodeURIComponent(t)}/connections/${encodeURIComponent(n)}`;var ti="/workspaces/:workspaceId/flows",ni="/validate",ri="/:flowId",oi="/:flowId/enable",ii="/:flowId/disable",si="/:flowId/draft",ai="/:flowId/versions",pi="/:flowId/versions/:version",se=e=>`/workspaces/${encodeURIComponent(e)}/flows`,ui=e=>`${se(e)}/validate`,U=(e,t)=>`${se(e)}/${encodeURIComponent(t)}`,li=(e,t)=>`${U(e,t)}/enable`,ci=(e,t)=>`${U(e,t)}/disable`,di=(e,t)=>`${U(e,t)}/draft`,et=(e,t)=>`${U(e,t)}/versions`,gi=(e,t,n)=>`${et(e,t)}/${n}`;var mi="/workspaces/:workspaceId/agent",_i="/chat",Ri="/flow-context",yi="/sessions",Ii="/sessions/:sessionId",Ti=e=>`/workspaces/${encodeURIComponent(e)}/agent/chat`,xi=e=>`/workspaces/${encodeURIComponent(e)}/agent/sessions`,Ei=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/sessions/${encodeURIComponent(t)}`,wi=20,Ai=50,ki=100,Si="flow_authoring",hi=["flow","flow_run","inbox_entry","integration"],Oi=256,Pi=10,Ni=256,bi=["getFlowContext","getWorkingFlowIr","setFlowMeta","addNode","updateNode","removeNode","setTrigger","removeTrigger","setOutputs","setComposition","validateFlow","proposePublish","requestConnect"],Ci=["setFlowMeta","addNode","updateNode","removeNode","setTrigger","removeTrigger","setOutputs","setComposition"];function Di(e){return JSON.stringify(e)}var L={type:"object",properties:{},additionalProperties:!1},E={type:"object",additionalProperties:!0},tt=[{name:"getFlowContext",execution:"server",description:"Read the current workspace environment snapshot (installed integrations, their control-plane tools and triggers with stable refs, and active connections). Call this first to learn which toolRef / triggerRef / connectionRef values are available before editing the flow.",inputSchema:L},{name:"getWorkingFlowIr",execution:"server",description:"Read the current Server-owned working flow IR (flow.ir.v1), including existing triggers, nodes, outputs, and composition. Call this before editing an existing or non-empty flow, or whenever you need to inspect the current flow state.",inputSchema:L},{name:"setFlowMeta",execution:"server",description:"Set the working flow metadata: the flow logical name and/or its inputSchema (the $input contract).",inputSchema:{type:"object",properties:{flow:{type:"string",description:"Flow logical name."},inputSchema:{...E,description:"JSON object describing $input."}},additionalProperties:!1}},{name:"addNode",execution:"server",description:"Add one node to the working flow IR. node.kind is action | wait_event | sleep | human_input. action needs { id, kind:'action', toolRef, connectionRef, inputs }. wait_event needs { id, kind:'wait_event', eventType, correlation, timeout, onTimeout }. sleep needs { id, kind:'sleep', duration }. human_input needs { id, kind:'human_input', prompt:{ title, body?, format?:'plain'|'markdown' }, input, timeout, delivery? } \u2014 use it whenever the flow must WAIT for a person to review/approve/choose/answer before continuing; never use a normal action node or a provider approval tool as the wait point. human_input.input is { kind:'choice', choices:[{ id, label, style? }], allowComment? } | { kind:'text', multiline?, placeholder?, required? } | { kind:'form', fields:[{ id, label, type:'text'|'textarea'|'number'|'boolean'|'select', required?, options? }] }. Approve/reject is input.kind:'choice' with choices approve and reject (reject is just a choice with NO automatic side effect; wire any reject behavior yourself). Three or more options is the same choice kind with more choices. Free text is input.kind:'text'; structured answers are input.kind:'form'. Downstream nodes read $nodes.<human_input_id>.output, whose runtime shape is { status:'submitted', response, actor, submissionSource, submittedAt } | { status:'expired', actor, expiredAt } \u2014 the submitted value is nested under output.response ({ kind:'choice', choiceId, comment? } | { kind:'text', text } | { kind:'form', values }), NEVER directly on output. Examples: choice branch runIf { eq:[ $nodes.review.output.response.choiceId, 'approve' ] }; text value ${$nodes.ask.output.response.text}; form field ${$nodes.details.output.response.values.priority}; timeout branch runIf { eq:[ $nodes.review.output.status, 'expired' ] } (an expired human_input is a normal output, not a failure). Optional external notifications go under delivery.actions[] as { id, toolRef, connectionRef, inputs } using the SAME action triad as an action node (concrete string toolRef + concrete user-chosen string connectionRef + inputs); Inbox is always the default surface and is never itself a delivery action; you may add zero or more delivery actions. Only delivery.actions[].inputs may reference $humanInput, and the standard payload field uses the whole-object single reference form $humanInput.actions.<deliveryActionId>.payload (never string-interpolated). Do not invent provider shorthand fields; use the action's own input names. If a native feedback action declares fixed choice ids, the human_input.input.choices[].id MUST match those ids exactly (labels may differ, e.g. Yes/No) \u2014 never auto-map yes/no to approve/reject. Use dependsOn and $nodes.<id>.output.* references to wire data between nodes. node inputs MUST NOT reference $trigger (trigger output is bound only in the trigger's inputMapping / dedupeKey); read trigger-derived values via $input.* instead. In text templates reference fields with ${$input.*} / ${$nodes.*}; mixed text MUST NOT contain a bare reference (write 'Issue: ${$input.title}', never 'Issue: $input.title'), and a literal dollar sign is written as $$ (e.g. 'Pay $$5'). duration / timeout strings MUST be '<positive integer> <unit>' where unit is second|minute|hour|day (plural allowed), e.g. '1 hour', '10 minutes', '5 days' \u2014 compact forms like '1h' / '10m' are rejected by the server.",inputSchema:{type:"object",properties:{node:{...E,description:"A FlowNode object."}},required:["node"],additionalProperties:!1}},{name:"updateNode",execution:"server",description:"Patch an existing node by id. patch is a partial node object whose fields are shallow-merged into the node.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Target node id."},patch:{...E,description:"Partial node fields to merge."}},required:["id","patch"],additionalProperties:!1}},{name:"removeNode",execution:"server",description:"Remove a node from the working flow IR by id.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Node id to remove."}},required:["id"],additionalProperties:!1}},{name:"setTrigger",execution:"server",description:"Upsert a trigger by id (replaces a trigger with the same id). trigger.kind is schedule | integration | manual. schedule needs { id, kind:'schedule', cron, timezone }. integration needs { id, kind:'integration', triggerRef, connectionRef, config, inputMapping?, dedupeKey? }. manual needs { id, kind:'manual' }. For an integration trigger, fill config from the trigger inputSchema in getFlowContext and NEVER omit a requiredInputs field (e.g. linear/new_issue requires config.team_id). $trigger.output.* may ONLY be referenced inside the trigger's own inputMapping / dedupeKey; node inputs MUST NOT reference $trigger. In any text template, reference fields with ${$input.*} / ${$nodes.*}; mixed text MUST NOT contain a bare reference (write 'Issue: ${$input.title}', never 'Issue: $input.title'), and a literal dollar sign is written as $$ (e.g. 'Pay $$5'). Always run validateFlow before proposing publish.",inputSchema:{type:"object",properties:{trigger:{...E,description:"A TriggerBinding object."}},required:["trigger"],additionalProperties:!1}},{name:"removeTrigger",execution:"server",description:"Remove a trigger from the working flow IR by id.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Trigger id to remove."}},required:["id"],additionalProperties:!1}},{name:"setOutputs",execution:"server",description:"Set the working flow outputs mapping: the MACHINE response / API response of the flow (structured data for programs and webhooks), NOT the user-facing result. The user-readable Inbox result is composition (use setComposition for that); never describe outputs to the user as their result, and never derive composition from outputs. Only reference fields that exist in a tool or trigger output schema. Use $nodes.<id>.output.<arrayField>.length to project an array count. In text templates reference fields with ${$input.*} / ${$nodes.*}; mixed text MUST NOT contain a bare reference (write 'Total: ${$nodes.sum.output.value}', never 'Total: $nodes.sum.output.value'), and a literal dollar sign is written as $$ (e.g. 'Pay $$5'). Do not invent output fields from node inputs; for example, if a search tool output only declares results, use a literal or $input value for the original query instead of $nodes.<id>.output.query.",inputSchema:{type:"object",properties:{outputs:{...E,description:"Outputs mapping object."}},required:["outputs"],additionalProperties:!1}},{name:"setComposition",execution:"server",description:"Set the flow composition: the USER-READABLE result work that a successful run saves as one Inbox result for a person to read (NOT the machine response \u2014 that is outputs). composition.title is a short headline. composition.detail.format MUST be 'markdown' and composition.detail.body is the markdown a human reads. Optionally composition.detail.data is a structured mapping kept for reference (never shown by default). Add composition.report ONLY when the flow already has a node that produces a human report (e.g. an AI analysis/report node): set its report.format='markdown' and report.body from that node output; never invent a report when no report-producing node exists. Reference run data with ${$input.*} / ${$nodes.*} only (composition MUST NOT reference $trigger or $outputs); mixed text MUST NOT contain a bare reference (write 'Result: ${$nodes.sum.output.value}', never 'Result: $nodes.sum.output.value'), and a literal dollar sign is written as $$ (e.g. 'Pay $$5'). Creating a flow MUST create a composition; editing nodes or input semantics MUST keep composition consistent. The whole composition object replaces the previous one.",inputSchema:{type:"object",properties:{composition:{...E,description:"A FlowCompositionSpec: { title, detail:{ format:'markdown', body, data? }, report?:{ title?, format:'markdown', body, data? } }."}},required:["composition"],additionalProperties:!1}},{name:"validateFlow",execution:"server",description:"Validate the current Server-owned working flow IR against the Ablehi Server (authoritative). A valid result automatically persists the flow draft and runs readiness; the server is the only source of flow validity.",inputSchema:L},{name:"proposePublish",execution:"server",description:"When the latest Server-owned draft is publishable, return a structured publish suggestion for the human. This tool never publishes and never creates an approval; publishing is only POST /publish with human confirm:true.",inputSchema:L},{name:"requestConnect",execution:"client",description:"Ask the user to connect an integration so a connectionRef becomes available. Opens the connection UI. The user supplies any credential directly to the Ablehi Server; you only receive { status, connectionRef? } and never the secret.",inputSchema:{type:"object",properties:{installationId:{type:"string",description:"Installation to connect."},connectionName:{type:"string",description:"Optional connection display name."}},required:["installationId"],additionalProperties:!1}}];function vi(e){return tt.find(t=>t.name===e)}var Fi="AGENT_RUNTIME_UNCONFIGURED",Ui="AGENT_RUNTIME_FAILED",Li="AGENT_SESSION_NOT_FOUND",Bi="AGENT_MESSAGE_DELTA_INVALID",Gi="AGENT_PAGE_CONTEXT_INVALID",J="/agent/assets",Hi="/prompts",Mi="/prompts/:targetKey/:revision",Ki="/prompts/:targetKey/:revision/validate",$i="/prompts/:targetKey/:revision/activate",Wi="/model-input-targets",Vi="/model-input-targets/:targetKey/render-preview",qi="/model-input-snapshots",ji="/flow-scenes",Ji="/flow-scenes/:sceneKey/:revision",Xi="/flow-scenes/:sceneKey/:revision/validate",Yi="/flow-scenes/:sceneKey/:revision/activate",zi="/flow-scenes/:sceneKey/:revision/reindex",Qi="/flow-templates",Zi="/flow-templates/:templateKey/:revision",es="/flow-templates/:templateKey/:revision/validate",ts="/flow-templates/:templateKey/:revision/activate",ns="/flow-templates/:templateKey/:revision/reindex",rs="/flow-working-drafts/open",os="/flow-working-drafts/:draftId",is="/flow-working-drafts/:draftId/commands",ss="/flow-working-drafts/:draftId/edit-turn/acquire",as="/flow-working-drafts/:draftId/edit-turn/release",ps="/flow-working-drafts/:draftId/publish",us="/flow-working-drafts/:draftId/readiness/check",ls="/flow-working-drafts/:draftId/readiness/requirements/:requirementId/resolve",cs="/flow-creation-tasks/:flowCreationTaskId",ds="/flow-creation-decisions/:decisionRecordId",gs=()=>`${J}/prompts`,fs=()=>`${J}/flow-scenes`,ms=()=>`${J}/flow-templates`,_s=e=>`/workspaces/${encodeURIComponent(e)}/agent/flow-working-drafts/open`,w=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-working-drafts/${encodeURIComponent(t)}`,Rs=(e,t)=>`${w(e,t)}/commands`,ys=(e,t)=>`${w(e,t)}/edit-turn/acquire`,Is=(e,t)=>`${w(e,t)}/edit-turn/release`,Ts=(e,t)=>`${w(e,t)}/publish`,xs=(e,t)=>`${w(e,t)}/readiness/check`,Es=(e,t,n)=>`${w(e,t)}/readiness/requirements/${encodeURIComponent(n)}/resolve`,ws=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-creation-tasks/${encodeURIComponent(t)}`,As=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-creation-decisions/${encodeURIComponent(t)}`,ks="agent.asset.manage",Ss=/^[A-Za-z0-9_-]{1,64}$/,hs="flow_create_authoring_task",nt="oneoff_getActionContext",rt="oneoff_executeAction",Os=[nt,rt],Ps=["agent.general.turn","agent.intent.flow_goal","agent.one_off.turn","flow_authoring.edit_turn","flow_authoring.create_from_brief_turn","flow_authoring.server_loop_command","workflow.flow_authoring.scene_fit_judge","workflow.flow_authoring.template_fit_judge","workflow.flow_authoring.brief_generation","workflow.flow_authoring.fallback_plan"],Ns="AGENT_ASSET_NOT_FOUND",bs="AGENT_ASSET_VALIDATION_FAILED",Cs="AGENT_PROMPT_TARGET_NOT_FOUND",Ds="AGENT_PROMPT_ACTIVE_REVISION_MISSING",vs="AGENT_PROMPT_REVISION_NOT_FOUND",Fs="AGENT_PROMPT_REVISION_NOT_DRAFT",Us="AGENT_PROMPT_VALIDATION_FAILED",Ls="AGENT_MODEL_INPUT_TARGET_PROTECTED",Bs="AGENT_MODEL_INPUT_PREVIEW_UNAVAILABLE",Gs="AGENT_FLOW_GOAL_INVALID",Hs="AGENT_FLOW_CREATION_TASK_NOT_FOUND",Ms="AGENT_FLOW_CREATION_TASK_CONFLICT",Ks="AGENT_FLOW_AUTHORING_WORKFLOW_FAILED",$s="FLOW_WORKING_DRAFT_NOT_FOUND",Ws="FLOW_DRAFT_REVISION_CONFLICT",Vs="FLOW_DRAFT_COMMAND_INVALID",qs="FLOW_DRAFT_EDIT_LOCKED",js="FLOW_EDIT_TURN_NOT_HELD",Js="FLOW_DRAFT_NOT_PUBLISHABLE",Xs="FLOW_PUBLISH_CONFIRMATION_REQUIRED",Ys="FLOW_READINESS_REQUIREMENT_NOT_FOUND",zs="FLOW_READINESS_REQUIREMENT_CONFLICT",Qs="AGENT_ASSET_INDEX_FAILED";var ea="/workspaces/:workspaceId/runs",ta="/workspaces/:workspaceId/flows/:flowId/runs",na="/:runId",ra="/:runId/cancel",oa="/:runId/events",ot=e=>`/workspaces/${encodeURIComponent(e)}/runs`,ae=(e,t)=>`${ot(e)}/${encodeURIComponent(t)}`,ia=(e,t)=>`${ae(e,t)}/cancel`,sa=(e,t)=>`${ae(e,t)}/events`,aa=(e,t)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/runs`,pa=["queued","running","succeeded","failed","interrupted","cancelled"],ua=["succeeded","skipped","timed_out","failed"];var ca="/workspaces/:workspaceId/inbox/items",da="/workspaces/:workspaceId/inbox/entries",pe="/inbox/entries",ga="/:itemId",fa="/:entryId",ma="/:entryId/human-input/submit",it=e=>`/workspaces/${encodeURIComponent(e)}/inbox/items`,_a=(e,t)=>`${it(e)}/${encodeURIComponent(t)}`,st=e=>`/workspaces/${encodeURIComponent(e)}/inbox/entries`,at=(e,t)=>`${st(e)}/${encodeURIComponent(t)}`,Ra=(e,t)=>`${at(e,t)}/human-input/submit`,ya=()=>pe,pt=e=>`${pe}/${encodeURIComponent(e)}`,Ia=e=>`${pt(e)}/human-input/submit`;var xa="/human-input/tokens",Ea="/:token",wa="/:token/submit",ut=e=>`/human-input/tokens/${encodeURIComponent(e)}`,Aa=e=>`${ut(e)}/submit`;var Sa="/:flowId/trigger-instances",ha="/:flowId/triggers/:triggerBindingId/simulate",Oa=(e,t)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/trigger-instances`,Pa=(e,t,n)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/triggers/${encodeURIComponent(n)}/simulate`;export{J as AGENT_ASSETS_ROUTE_PREFIX,ji as AGENT_ASSET_FLOW_SCENES_SUBPATH,Yi as AGENT_ASSET_FLOW_SCENE_ACTIVATE_SUBPATH,Ji as AGENT_ASSET_FLOW_SCENE_ITEM_SUBPATH,zi as AGENT_ASSET_FLOW_SCENE_REINDEX_SUBPATH,Xi as AGENT_ASSET_FLOW_SCENE_VALIDATE_SUBPATH,Qi as AGENT_ASSET_FLOW_TEMPLATES_SUBPATH,ts as AGENT_ASSET_FLOW_TEMPLATE_ACTIVATE_SUBPATH,Zi as AGENT_ASSET_FLOW_TEMPLATE_ITEM_SUBPATH,ns as AGENT_ASSET_FLOW_TEMPLATE_REINDEX_SUBPATH,es as AGENT_ASSET_FLOW_TEMPLATE_VALIDATE_SUBPATH,Qs as AGENT_ASSET_INDEX_FAILED_ERROR_CODE,ks as AGENT_ASSET_MANAGE_PERMISSION,qi as AGENT_ASSET_MODEL_INPUT_SNAPSHOTS_SUBPATH,Wi as AGENT_ASSET_MODEL_INPUT_TARGETS_SUBPATH,Vi as AGENT_ASSET_MODEL_INPUT_TARGET_PREVIEW_SUBPATH,Ns as AGENT_ASSET_NOT_FOUND_ERROR_CODE,Hi as AGENT_ASSET_PROMPTS_SUBPATH,$i as AGENT_ASSET_PROMPT_ACTIVATE_SUBPATH,Mi as AGENT_ASSET_PROMPT_ITEM_SUBPATH,Ki as AGENT_ASSET_PROMPT_VALIDATE_SUBPATH,bs as AGENT_ASSET_VALIDATION_FAILED_ERROR_CODE,Si as AGENT_CAPABILITY_FLOW_AUTHORING,_i as AGENT_CHAT_ROUTE_SUBPATH,hs as AGENT_CREATE_FLOW_AUTHORING_TASK_TOOL_NAME,Ks as AGENT_FLOW_AUTHORING_WORKFLOW_FAILED_ERROR_CODE,Ri as AGENT_FLOW_CONTEXT_ROUTE_SUBPATH,ds as AGENT_FLOW_CREATION_DECISION_ITEM_SUBPATH,Ms as AGENT_FLOW_CREATION_TASK_CONFLICT_ERROR_CODE,cs as AGENT_FLOW_CREATION_TASK_ITEM_SUBPATH,Hs as AGENT_FLOW_CREATION_TASK_NOT_FOUND_ERROR_CODE,Gs as AGENT_FLOW_GOAL_INVALID_ERROR_CODE,ls as AGENT_FLOW_READINESS_REQUIREMENT_RESOLVE_SUBPATH,is as AGENT_FLOW_WORKING_DRAFT_COMMANDS_SUBPATH,ss as AGENT_FLOW_WORKING_DRAFT_EDIT_TURN_ACQUIRE_SUBPATH,as as AGENT_FLOW_WORKING_DRAFT_EDIT_TURN_RELEASE_SUBPATH,os as AGENT_FLOW_WORKING_DRAFT_ITEM_SUBPATH,rs as AGENT_FLOW_WORKING_DRAFT_OPEN_SUBPATH,ps as AGENT_FLOW_WORKING_DRAFT_PUBLISH_SUBPATH,us as AGENT_FLOW_WORKING_DRAFT_READINESS_CHECK_SUBPATH,Bi as AGENT_MESSAGE_DELTA_INVALID_ERROR_CODE,Bs as AGENT_MODEL_INPUT_PREVIEW_UNAVAILABLE_ERROR_CODE,Ps as AGENT_MODEL_INPUT_TARGET_KEYS,Ls as AGENT_MODEL_INPUT_TARGET_PROTECTED_ERROR_CODE,Gi as AGENT_PAGE_CONTEXT_INVALID_ERROR_CODE,Pi as AGENT_PAGE_CONTEXT_MAX_RESOURCES,Ni as AGENT_PAGE_CONTEXT_RESOURCE_ID_MAX_LENGTH,Oi as AGENT_PAGE_CONTEXT_ROUTE_ID_MAX_LENGTH,hi as AGENT_PAGE_RESOURCE_TYPES,Ds as AGENT_PROMPT_ACTIVE_REVISION_MISSING_ERROR_CODE,Fs as AGENT_PROMPT_REVISION_NOT_DRAFT_ERROR_CODE,vs as AGENT_PROMPT_REVISION_NOT_FOUND_ERROR_CODE,Cs as AGENT_PROMPT_TARGET_NOT_FOUND_ERROR_CODE,Us as AGENT_PROMPT_VALIDATION_FAILED_ERROR_CODE,mi as AGENT_ROUTE_PREFIX,Ui as AGENT_RUNTIME_FAILED_ERROR_CODE,Ss as AGENT_RUNTIME_TOOL_NAME_PATTERN,Fi as AGENT_RUNTIME_UNCONFIGURED_ERROR_CODE,yi as AGENT_SESSIONS_ROUTE_SUBPATH,ki as AGENT_SESSION_DETAIL_MESSAGE_LIMIT,Ii as AGENT_SESSION_ITEM_ROUTE_SUBPATH,wi as AGENT_SESSION_LIST_DEFAULT_LIMIT,Ai as AGENT_SESSION_LIST_MAX_LIMIT,Li as AGENT_SESSION_NOT_FOUND_ERROR_CODE,q as API_KEYS_ROUTE_PREFIX,Ye as API_KEY_GRANT_OPTIONS_ROUTE_SUBPATH,To as API_KEY_ITEM_ROUTE_SUBPATH,xo as API_KEY_TOKEN_PREFIX,Eo as API_KEY_WORKSPACE_FULL_ACCESS_SCOPE,Je as APP_BOOTSTRAP_ROUTE_PATH,No as CATALOG_DEFAULT_PROVIDER_APP_CONFIG_ROUTE_SUBPATH,ho as CATALOG_INTEGRATIONS_ROUTE_SUBPATH,Oo as CATALOG_INTEGRATION_DETAIL_ROUTE_SUBPATH,j as CATALOG_ROUTE_PREFIX,Po as CATALOG_VERSIONS_ROUTE_SUBPATH,Mo as CONNECTIONS_ROUTE_SUBPATH,qo as CONNECTION_DISCONNECT_ROUTE_SUBPATH,Vo as CONNECT_COMPLETE_ROUTE_SUBPATH,$o as CONNECT_OPTIONS_ROUTE_SUBPATH,Ko as CONNECT_START_ROUTE_SUBPATH,Wo as CONNECT_SUBMIT_ROUTE_SUBPATH,_t as CONTEXT_STATE_CLEANUP_ROUTE_PATH,po as CURRENT_USER_ROUTE_PATH,Xe as DEFAULT_WORKSPACE_ROUTE_PATH,je as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,Xr as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,Jr as DEPLOYMENT_HANDSHAKE_ROUTE,Mn as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,Hn as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,De as EGRESS_GRANT_SCOPE_KINDS,Nt as EVENT_WAIT_ROUTE_SUBPATH,Et as EXECUTION_CONTEXT_ROUTE_SUBPATH,kr as FILE_CONTENT_ROUTE_SUBPATH,Ar as FILE_STAT_ROUTE_SUBPATH,Ci as FLOW_AUTHORING_EDIT_TOOL_NAMES,tt as FLOW_AUTHORING_TOOL_DESCRIPTORS,bi as FLOW_AUTHORING_TOOL_NAMES,ii as FLOW_DISABLE_ROUTE_SUBPATH,Vs as FLOW_DRAFT_COMMAND_INVALID_ERROR_CODE,qs as FLOW_DRAFT_EDIT_LOCKED_ERROR_CODE,Js as FLOW_DRAFT_NOT_PUBLISHABLE_ERROR_CODE,Ws as FLOW_DRAFT_REVISION_CONFLICT_ERROR_CODE,si as FLOW_DRAFT_ROUTE_SUBPATH,js as FLOW_EDIT_TURN_NOT_HELD_ERROR_CODE,oi as FLOW_ENABLE_ROUTE_SUBPATH,le as FLOW_INTERPRETER_CONTRACT_VERSION,ct as FLOW_IR_SCHEMA_VERSION,ri as FLOW_ITEM_ROUTE_SUBPATH,Xs as FLOW_PUBLISH_CONFIRMATION_REQUIRED_ERROR_CODE,zs as FLOW_READINESS_REQUIREMENT_CONFLICT_ERROR_CODE,Ys as FLOW_READINESS_REQUIREMENT_NOT_FOUND_ERROR_CODE,Un as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,Pt as FLOW_RUN_RESULT_ROUTE_SUBPATH,pr as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,pa as FLOW_RUN_STATUSES,ni as FLOW_VALIDATE_ROUTE_SUBPATH,ai as FLOW_VERSIONS_ROUTE_SUBPATH,pi as FLOW_VERSION_ITEM_ROUTE_SUBPATH,$s as FLOW_WORKING_DRAFT_NOT_FOUND_ERROR_CODE,pe as GLOBAL_INBOX_ENTRIES_ROUTE_PREFIX,Kt as HANDLER_BUNDLES_ROUTE_SUBPATH,to as HANDSHAKE_CAPABILITY_MISSING,Zr as HANDSHAKE_CONTRACT_VERSION_MISMATCH,eo as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,Yr as HANDSHAKE_REQUEST_INVALID,Qr as HANDSHAKE_SECRET_MISMATCH,zr as HANDSHAKE_SECRET_UNCONFIGURED,Dr as HUMAN_INPUTS_ROUTE_SUBPATH,Ur as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,Fr as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,vr as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,Ge as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,xa as HUMAN_INPUT_TOKENS_ROUTE_PREFIX,Ea as HUMAN_INPUT_TOKEN_ROUTE_SUBPATH,wa as HUMAN_INPUT_TOKEN_SUBMIT_ROUTE_SUBPATH,ma as INBOX_ENTRY_HUMAN_INPUT_SUBMIT_ROUTE_SUBPATH,fa as INBOX_ENTRY_ROUTE_SUBPATH,ga as INBOX_ITEM_ROUTE_SUBPATH,Uo as INTEGRATION_ITEM_ROUTE_SUBPATH,Lo as INTEGRATION_TOOLS_ROUTE_SUBPATH,Z as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX,V as INTERNAL_FILES_ROUTE_PREFIX,f as INTERNAL_FLOW_RUNS_ROUTE_PREFIX,Ie as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX,M as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,h as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,W as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,k as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,rt as ONE_OFF_EXECUTE_ACTION_TOOL_NAME,nt as ONE_OFF_GET_ACTION_CONTEXT_TOOL_NAME,Os as ONE_OFF_TOOL_NAMES,io as PLATFORM_ACCESS_PERMISSION,so as PLATFORM_API_KEY_MANAGE_PERMISSION,En as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,Bn as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,wn as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,lr as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,An as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,jo as PROVIDER_CALLBACK_REDIRECT_ROUTE_PATH,_r as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,ra as RUN_CANCEL_ROUTE_SUBPATH,oa as RUN_EVENTS_ROUTE_SUBPATH,na as RUN_ITEM_ROUTE_SUBPATH,ue as SERVER_CONTRACT_VERSION,Ot as STEP_RESULT_ROUTE_SUBPATH,ua as STEP_RUN_STATUSES,$t as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,Ln as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,ur as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Sa as TRIGGER_INSTANCES_ROUTE_SUBPATH,ha as TRIGGER_SIMULATE_ROUTE_SUBPATH,ln as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,dn as WEBHOOK_PROTOCOL_ADAPTER_MODULE,Zt as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,tn as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,Gn as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,nn as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,en as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,rn as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,cr as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Wr as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,Vr as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,ie as WORKSPACES_ROUTE_PREFIX,mo as WORKSPACE_ACCESS_ROUTE_SUBPATH,Ho as WORKSPACE_CONNECTION_MOUNT_PREFIX,ti as WORKSPACE_FLOWS_ROUTE_PREFIX,ta as WORKSPACE_FLOW_RUNS_ROUTE_PREFIX,da as WORKSPACE_INBOX_ENTRIES_ROUTE_PREFIX,ca as WORKSPACE_INBOX_ITEMS_ROUTE_PREFIX,Fo as WORKSPACE_INTEGRATIONS_ROUTE_PREFIX,fo as WORKSPACE_LIST_ROUTE_SUBPATH,ea as WORKSPACE_RUNS_ROUTE_PREFIX,fs as agentAssetFlowScenesPath,ms as agentAssetFlowTemplatesPath,gs as agentAssetPromptsPath,Ti as agentChatPath,As as agentFlowCreationDecisionPath,ws as agentFlowCreationTaskPath,Es as agentFlowReadinessRequirementResolvePath,Rs as agentFlowWorkingDraftCommandsPath,ys as agentFlowWorkingDraftEditTurnAcquirePath,Is as agentFlowWorkingDraftEditTurnReleasePath,_s as agentFlowWorkingDraftOpenPath,w as agentFlowWorkingDraftPath,Ts as agentFlowWorkingDraftPublishPath,xs as agentFlowWorkingDraftReadinessCheckPath,Ei as agentSessionPath,xi as agentSessionsPath,Ao as apiKeyGrantOptionsPath,ko as apiKeyPath,wo as apiKeysPath,co as appBootstrapPath,Do as catalogDefaultProviderAppConfigPath,ze as catalogIntegrationPath,bo as catalogIntegrationsPath,Co as catalogVersionsPath,Qo as connectCompletePath,Yo as connectOptionsPath,Xo as connectStartPath,zo as connectSubmitPath,Zo as connectionDisconnectPath,r as contractParseFail,a as contractParseOk,uo as currentUserPath,yo as defaultWorkspacePath,no as deploymentHandshakeProbePayload,ro as deploymentHandshakeResponseProofPayload,jn as egressGrantAuditPath,qn as egressGrantConsumePath,Dt as eventWaitPath,wt as executionContextPath,vi as findFlowAuthoringToolDescriptor,ci as flowDisablePath,di as flowDraftPath,li as flowEnablePath,U as flowPath,Kn as flowRunEgressGrantPath,Ct as flowRunResultPath,dr as flowRunRuntimeCredentialPath,aa as flowRunsPath,gn as flowScriptProtocolAdapterModuleName,ui as flowValidatePath,gi as flowVersionPath,et as flowVersionsPath,Di as formatFlowToolError,ya as globalInboxEntriesPath,Ia as globalInboxEntryHumanInputSubmitPath,pt as globalInboxEntryPath,Wt as handlerBundlesPath,Br as humanInputAcknowledgePath,Lr as humanInputExpirePath,ne as humanInputRequestPath,Gr as humanInputResolvedEventType,ut as humanInputTokenPath,Aa as humanInputTokenSubmitPath,Be as humanInputsPath,Ra as inboxEntryHumanInputSubmitPath,at as inboxEntryPath,_a as inboxItemPath,Bo as installationToolsPath,Or as internalFileContentPath,hr as internalFileStatPath,Sr as internalFilesPath,i as isJsonRecord,O as isValidRequestDigest,Gt as parseCompleteFlowRunWaitBody,Rt as parseContextStateCleanupRequestBody,yt as parseContextStateCleanupResponseData,R as parseContextStateScope,Hr as parseCreateHumanInputBody,Zn as parseEgressGrantAuditBody,Qn as parseEgressGrantConsumeBody,tr as parseEgressGrantConsumeData,er as parseEgressGrantData,At as parseExecutionContextData,Pr as parseFileRefData,fe as parseFileRuntimeLimits,Jn as parseFlowActionGrantBody,Ut as parseFlowRunResultBody,Lt as parseFlowRunResultData,Rr as parseFlowRuntimeCredentialBody,xe as parseHandlerBundle,qt as parseHandlerBundlesData,Kr as parseHumanInputAcknowledgeData,Mr as parseHumanInputCreateData,qe as parseHumanInputRequestViewData,Pn as parsePollingPublishBody,Ir as parsePollingRuntimeCredentialBody,On as parsePollingTriggerContext,Yn as parsePollingTriggerGrantBody,Nn as parsePublishPollingTickEventsData,Bt as parseRegisterFlowRunWaitBody,Ht as parseRegisterFlowRunWaitData,xr as parseRuntimeCredentialSessionCredential,b as parseRuntimeNetwork,Xn as parseSingleToolGrantBody,yr as parseSingleToolRuntimeCredentialBody,vt as parseStepRecordBody,Ft as parseStepRecordData,jt as parseToolHandlerBundlesData,_n as parseTriggerHandlerBundlesData,mn as parseWebhookDelivery,Rn as parseWebhookPublishEventsBody,yn as parseWebhookRearmBody,Tr as parseWebhookRuntimeCredentialBody,zn as parseWebhookTriggerGrantBody,fn as parseWebhookWatcherContext,kn as pollingTriggerContextPath,Wn as pollingTriggerEgressGrantPath,Sn as pollingTriggerHandlerBundlesPath,fr as pollingTriggerRuntimeCredentialPath,hn as pollingTriggerTickEventsPath,Fe as requestHasMultipartFileParts,ia as runCancelPath,sa as runEventsPath,ae as runPath,bt as stepResultPath,Vt as toolHandlerBundlesPath,$n as toolInvocationEgressGrantPath,gr as toolInvocationRuntimeCredentialPath,Oa as triggerInstancesPath,Pa as triggerSimulatePath,cn as webhookProtocolAdapterBundlePath,on as webhookTriggerContextPath,an as webhookTriggerDeliveryPath,Vn as webhookTriggerEgressGrantPath,pn as webhookTriggerEventsPath,sn as webhookTriggerHandlerBundlesPath,un as webhookTriggerRearmPath,mr as webhookTriggerRuntimeCredentialPath,qr as wfpUserRuntimeManifestPath,Jo as workspaceConnectionsPath,se as workspaceFlowsPath,st as workspaceInboxEntriesPath,it as workspaceInboxItemsPath,Ze as workspaceIntegrationPath,Qe as workspaceIntegrationsPath,_o as workspacePath,ot as workspaceRunsPath,Ro as workspacesPath};
|
|
1
|
+
var de="0.2.5";var wt="flow.ir.v1";var ge="flow.interp.v2";function a(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 Pt="/cleanup-state-scopes";function _(e){if(!i(e)||typeof e.kind!="string")return r("context state scope surface shape is invalid");switch(e.kind){case"webhook-trigger":return fe(e);case"polling-trigger":return me(e);case"flow-action":return Re(e);default:return r("context state scope kind is invalid")}}function Ot(e){if(!i(e))return r("cleanup request body must be a JSON object");let t=D(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=_(o);if(!s.ok)return s;n.push(s.value)}return a({scopes:n})}function Nt(e){return!i(e)||typeof e.deleted!="number"||!Number.isSafeInteger(e.deleted)||e.deleted<0?r("cleanup response data surface shape is invalid"):a({deleted:e.deleted})}function fe(e){let t=D(e,["kind","workspaceId","triggerInstanceId"]);return t!==void 0?r(`webhook trigger scope does not accept "${t}"`):e.kind!=="webhook-trigger"||!m(e.workspaceId)||!m(e.triggerInstanceId)?r("webhook trigger state scope is invalid"):a({kind:"webhook-trigger",workspaceId:e.workspaceId,triggerInstanceId:e.triggerInstanceId})}function me(e){let t=D(e,["kind","workspaceId","pollingInstanceId"]);return t!==void 0?r(`polling trigger scope does not accept "${t}"`):e.kind!=="polling-trigger"||!m(e.workspaceId)||!m(e.pollingInstanceId)?r("polling trigger state scope is invalid"):a({kind:"polling-trigger",workspaceId:e.workspaceId,pollingInstanceId:e.pollingInstanceId})}function Re(e){let t=D(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"||!m(e.workspaceId)||!m(e.flowId)||!m(e.nodeId)||n!==null&&!m(n)?r("flow action state scope is invalid"):a({kind:"flow-action",workspaceId:e.workspaceId,flowId:e.flowId,nodeId:e.nodeId,connectionId:n})}function m(e){return typeof e=="string"&&e.length>0}function D(e,t){return Object.keys(e).find(n=>!t.includes(n))}var f="/internal/flow-runs",Ft="/:flowRunId/execution-context";function vt(e){return`${f}/${encodeURIComponent(e)}/execution-context`}function _e(e){return!i(e)||!M(e.fileMaxBytes)||!M(e.fileReadMaxBytes)||!M(e.inlineMultipartBytesMax)?r("file runtime limits must carry three positive integer bounds"):a({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function Ut(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)||!ye(e.executionBindings))return r("execution context surface shape is invalid");let n=Ie(e.fileRuntime);return n.ok?a({...e,fileRuntime:n.value}):r(n.reason)}function Ie(e){if(e===null)return a(null);if(!i(e))return r("fileRuntime must be null or an object");let t=_e(e.limits);return t.ok?a({limits:t.value}):r(t.reason)}function ye(e){return Array.isArray(e)?e.every(t=>{if(!i(t))return!1;let n=t.connection,o=_(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.authType=="string"&&o.ok}):!1}function M(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}var Ht="/:flowRunId/steps/:nodeId/result",Mt="/:flowRunId/result",$t="/:flowRunId/event-waits/:nodeId";function Kt(e,t){return`${f}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function Wt(e){return`${f}/${encodeURIComponent(e)}/result`}function Vt(e,t){return`${f}/${encodeURIComponent(e)}/event-waits/${encodeURIComponent(t)}`}function qt(e){if(!i(e))return{ok:!1,kind:"validation",reason:"step record body must be a JSON object"};let t=I(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=Te(e.result);if(!o.ok)return o;let s={attempt:n,result:o.value};if(e.durationMs!==void 0){let p=e.durationMs;if(typeof p!="number"||!Number.isFinite(p)||p<0)return{ok:!1,kind:"validation",reason:"durationMs must be a non-negative number"};s.durationMs=p}return{ok:!0,value:s}}function Te(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=I(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=I(e,["status","errorCode","issues"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let o=e.errorCode;if(typeof o!="string"||o.length===0)return{ok:!1,kind:"step_result_invalid",reason:"a failed result must carry a non-empty errorCode"};let s={status:"failed",errorCode:o};return e.issues!==void 0&&(s.issues=e.issues),{ok:!0,value:s}}return{ok:!1,kind:"step_result_invalid",reason:'result status must be "succeeded" or "failed"'}}function jt(e){return!i(e)||typeof e.flowRunId!="string"||typeof e.nodeId!="string"||e.recorded!=="succeeded"&&e.recorded!=="failed"?r("step record data surface shape is invalid"):a({flowRunId:e.flowRunId,nodeId:e.nodeId,recorded:e.recorded})}function Jt(e){if(!i(e))return r("result body must be a JSON object");let t=I(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&&(o.output=e.output),e.error!==void 0){let s=e.error;if(!i(s))return r("result error must be a JSON object");let p=I(s,["code","message"]);if(p!==void 0)return r(`result error does not accept the "${p}" field`);if(typeof s.code!="string"||typeof s.message!="string")return r("result error must carry string code and message");o.error={code:s.code,message:s.message}}if(e.composition!==void 0){if(n!=="succeeded")return r("composition is only allowed on a succeeded result");o.composition=e.composition}return a(o)}function Xt(e){return i(e)?a(e):r("flow run result data must be a JSON object")}var xe=/^[A-Za-z0-9_-]{1,100}$/;function Yt(e){if(!i(e))return r("register body must be a JSON object");let t=I(e,["eventType","correlationKey"]);if(t!==void 0)return r(`register wait does not accept the "${t}" field`);let n=z(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"):a({eventType:n.value,correlationKey:o})}function zt(e){if(!i(e))return r("complete body must be a JSON object");let t=I(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=z(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 p={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");p.eventId=e.eventId}return a(p)}function Qt(e){return!i(e)||e.registered!==!0?r("register wait data surface shape is invalid"):a({registered:!0})}function z(e){return typeof e!="string"||e.length===0?r("eventType must be a non-empty string"):xe.test(e)?a(e):r("eventType must match ^[A-Za-z0-9_-]{1,100}$")}function I(e,t){return Object.keys(e).find(n=>!t.includes(n))}var Ee="/internal/flow-versions",en="/:flowVersionId/handler-bundles",K="/internal/installations",tn="/:installationId/handler-bundles";function nn(e,t){return`${Ee}/${encodeURIComponent(e)}/handler-bundles?compiledArtifactId=${encodeURIComponent(t)}`}function rn(e){return`${K}/${encodeURIComponent(e.installationId)}/handler-bundles?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var we=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function C(e){if(!y(e))return $("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!we.has(t)?$("runtimeNetwork.networkModel is unknown"):!Q(e.apiHosts)||!Q(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 on(e){if(!y(e)||typeof e.flowVersionId!="string"||typeof e.compiledArtifactId!="string"||!Array.isArray(e.bundles))return k("handler bundles data surface shape is invalid");let t=Z(e.bundles);return t.ok?{ok:!0,value:{flowVersionId:e.flowVersionId,compiledArtifactId:e.compiledArtifactId,bundles:t.value}}:t}function sn(e){if(!y(e)||typeof e.installationId!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.bundles))return k("tool handler bundles data surface shape is invalid");let t=Z(e.bundles);return t.ok?{ok:!0,value:{installationId:e.installationId,artifactDigest:e.artifactDigest,bundles:t.value}}:t}function Z(e){let t=[];for(let n of e){let o=Ae(n);if(!o.ok)return o;t.push(o.value)}return{ok:!0,value:t}}function Ae(e){if(!y(e)||typeof e.toolRef!="string"||e.kind!=="handler"&&e.kind!=="request")return k("handler bundle entry shape is invalid");if(e.kind==="request"){if(e.module!==void 0)return k("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(!y(t)||typeof t.entry!="string"||t.entry.length===0||!ke(t.files))return k("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 k(e){return{ok:!1,kind:"shape",reason:e}}function $(e){return{ok:!1,kind:"runtime_network",reason:e}}function y(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Q(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ke(e){return y(e)&&Object.values(e).every(t=>typeof t=="string")}var S="/internal/webhook-trigger-instances",dn="/:triggerInstanceId/context",gn="/:triggerInstanceId/handler-bundles",fn="/:triggerInstanceId/deliveries/:deliveryId",mn="/:triggerInstanceId/events",Rn="/:triggerInstanceId/rearm",h=e=>`${S}/${encodeURIComponent(e)}`;function _n(e,t){return`${h(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function In(e,t){return`${h(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function yn(e,t){return`${h(e)}/deliveries/${encodeURIComponent(t)}`}function Tn(e){return`${h(e)}/events`}function xn(e){return`${h(e)}/rearm`}var En="/:installationId/webhook-protocol-adapter-bundle";function wn(e){return`${K}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var An="modules/webhook/protocol-adapter.js";function kn(e){return`modules/webhook/protocol-adapter-${e}.js`}function Sn(e){let t=i(e)?_(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&&!Se(e.connection)||!he(e.runtime)||!t.ok||t.value.kind!=="webhook-trigger"?r("webhook watcher context surface shape is invalid"):a(e)}function Se(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function he(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 hn(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"):a(e)}function Pn(e){if(!i(e)||typeof e.triggerRef!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.modules)||!e.modules.every(Pe))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 Pe(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=W(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 p of o){let l=Oe(p);if(!l.ok)return l;s.push(l.value)}return a({deliveryId:n,events:s})}function Oe(e){if(!i(e))return r("each event must be a JSON object");let t=W(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 a(s)}function Nn(e){if(!i(e))return r("rearm body must be a JSON object");let t=W(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"):a({expectedWatcherInstanceId:n})}function W(e,t){return Object.keys(e).find(n=>!t.includes(n))}var P="/internal/polling-trigger-instances",Fn="/:pollingInstanceId/context",vn="/:pollingInstanceId/handler-bundles",Un="/:pollingInstanceId/ticks/:tickId/events",V=e=>`${P}/${encodeURIComponent(e)}`;function Ln(e,t,n){return`${V(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function Bn(e,t){return`${V(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Gn(e,t){return`${V(e)}/ticks/${encodeURIComponent(t)}/events`}function Hn(e){let t=i(e)?_(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&&!Ne(e.connection)||!De(e.runtime)||!t.ok||t.value.kind!=="polling-trigger"||!Ce(e.tick)||!be(e.limits)?r("polling trigger context surface shape is invalid"):a(e)}function Ne(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function De(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 Ce(e){return i(e)&&typeof e.tickId=="string"&&typeof e.scheduledAt=="string"&&typeof e.attempt=="number"}function be(e){return i(e)&&typeof e.maxEventsPerTick=="number"}function Mn(e){if(!i(e))return r("publish body must be a JSON object");let t=ee(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 p of n){let l=Fe(p);if(!l.ok)return l;o.push(l.value)}let s={events:o};if("nextCursor"in e){let p=e.nextCursor;if(p!==null&&typeof p!="string")return r("nextCursor must be a string, null, or omitted");s.nextCursor=p}return a(s)}function Fe(e){if(!i(e))return r("each event must be a JSON object");let t=ee(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 a(n)}function $n(e){return!i(e)||typeof e.tickId!="string"||typeof e.cursorUpdated!="boolean"||!Array.isArray(e.results)||!e.results.every(ve)?r("publish polling tick events data surface shape is invalid"):a(e)}function ve(e){return i(e)&&typeof e.eventId=="string"&&typeof e.dedupeKey=="string"&&typeof e.duplicate=="boolean"&&(e.flowRunId===null||typeof e.flowRunId=="string")}function ee(e,t){return Object.keys(e).find(n=>!t.includes(n))}var te="/internal/egress-grants",q="/internal/tool-invocations",Jn="/:flowRunId/egress-grant",Xn="/:invocationId/egress-grant",Yn="/:pollingInstanceId/egress-grant",zn="/:triggerInstanceId/egress-grant",Qn="/:grantId/consume",Zn="/:grantId/audit",er=e=>`${f}/${encodeURIComponent(e)}/egress-grant`,tr=e=>`${q}/${encodeURIComponent(e)}/egress-grant`,nr=e=>`${P}/${encodeURIComponent(e)}/egress-grant`,rr=e=>`${S}/${encodeURIComponent(e)}/egress-grant`,or=e=>`${te}/${encodeURIComponent(e)}/consume`,ir=e=>`${te}/${encodeURIComponent(e)}/audit`,Ue=["flow_action","single_tool","polling_trigger","webhook_trigger"],Le=/^[A-Za-z0-9][A-Za-z0-9:_+/=.-]{15,1023}$/;function O(e){return typeof e=="string"&&Le.test(e)}function Be(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 u(e){return{ok:!1,kind:"shape",reason:e}}function N(){return{ok:!1,kind:"request_digest",reason:"request digest is missing or malformed"}}function F(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 v(e){if(!i(e))return"request must be a JSON object"}function sr(e){let t=F(e,["nodeId","request","requestDigest"]);if(!t.ok)return u(t.reason);let n=t.record.nodeId;if(typeof n!="string"||n.length===0)return u("nodeId is required");let o=v(t.record.request);if(o!==void 0)return u(o);let s=t.record.requestDigest;return O(s)?{ok:!0,value:{nodeId:n,requestDigest:s,requestHasMultipartFiles:Be(t.record.request)}}:N()}function ar(e){let t=F(e,["request","requestDigest"]);if(!t.ok)return u(t.reason);let n=v(t.record.request);if(n!==void 0)return u(n);let o=t.record.requestDigest;return O(o)?{ok:!0,value:{requestDigest:o}}:N()}function pr(e){let t=F(e,["tickId","request","requestDigest"]);if(!t.ok)return u(t.reason);let n=t.record.tickId;if(typeof n!="string"||n.length===0)return u("tickId is required");let o=v(t.record.request);if(o!==void 0)return u(o);let s=t.record.requestDigest;return O(s)?{ok:!0,value:{tickId:n,requestDigest:s}}:N()}function lr(e){let t=F(e,["phase","lifecycle","request","requestDigest"]);if(!t.ok)return u(t.reason);let n=t.record.phase;if(n!=="lifecycle"&&n!=="handler")return u('phase must be "lifecycle" or "handler"');let o=t.record.lifecycle,s;if(o!==void 0){if(o!=="enable"&&o!=="disable"&&o!=="renew")return u('lifecycle must be "enable", "disable", or "renew"');s=o}if(n==="lifecycle"&&s===void 0)return u("lifecycle is required for the lifecycle phase");let p=v(t.record.request);if(p!==void 0)return u(p);let l=t.record.requestDigest;return O(l)?{ok:!0,value:{phase:n,...s!==void 0?{lifecycle:s}:{},requestDigest:l}}:N()}function ne(e){return Ue.includes(e)?e:void 0}var Ge=["scopeKind","scopeId","requestDigest"];function ur(e){if(!i(e))return u("consume body must be a JSON object");for(let s of Object.keys(e))if(!Ge.includes(s))return u(`consume does not accept the "${s}" field`);let t=ne(e.scopeKind);if(t===void 0)return u("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return u("scopeId is required");let o=e.requestDigest;return O(o)?{ok:!0,value:{scopeKind:t,scopeId:n,requestDigest:o}}:N()}var He=["scopeKind","scopeId","providerHost","status","durationMs","requestBytes","responseBytes","errorCode"];function b(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 cr(e){if(!i(e))return u("audit body must be a JSON object");for(let d of Object.keys(e))if(!He.includes(d))return u(`audit does not accept the "${d}" field`);let t=ne(e.scopeKind);if(t===void 0)return u("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return u("scopeId is required");let o=e.providerHost;if(typeof o!="string"||o.length===0)return u("providerHost is required");let s=b(e.durationMs,"durationMs");if(!s.ok)return u(s.reason);let p;if(e.status!==void 0){let d=b(e.status,"status");if(!d.ok)return u(d.reason);p=d.value}let l;if(e.requestBytes!==void 0){let d=b(e.requestBytes,"requestBytes");if(!d.ok)return u(d.reason);l=d.value}let c;if(e.responseBytes!==void 0){let d=b(e.responseBytes,"responseBytes");if(!d.ok)return u(d.reason);c=d.value}let H;if(e.errorCode!==void 0){let d=e.errorCode;if(typeof d!="string"||d.length===0)return u("errorCode must be a non-empty string");H=d}return{ok:!0,value:{scopeKind:t,scopeId:n,providerHost:o,...p!==void 0?{status:p}:{},durationMs:s.value,...l!==void 0?{requestBytes:l}:{},...c!==void 0?{responseBytes:c}:{},...H!==void 0?{errorCode:H}:{}}}}function dr(e){return!i(e)||!i(e.grant)?r("egress grant envelope must carry a grant object"):a(e.grant)}function gr(e){return!i(e)||e.consumed!==!0?r("egress grant consume data must carry consumed:true"):a({consumed:!0})}var Tr="/:flowRunId/runtime-credential",xr="/:invocationId/runtime-credential",Er="/:pollingInstanceId/runtime-credential",wr="/:triggerInstanceId/runtime-credential",Ar=e=>`${f}/${encodeURIComponent(e)}/runtime-credential`,kr=e=>`${q}/${encodeURIComponent(e)}/runtime-credential`,Sr=e=>`${P}/${encodeURIComponent(e)}/runtime-credential`,hr=e=>`${S}/${encodeURIComponent(e)}/runtime-credential`,Pr=["flow_action","tool_invoke","polling_trigger","webhook_trigger"];function U(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 Or(e){let t=U(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"):a({nodeId:n})}function Nr(e){let t=U(e??{},[]);return t.ok?a(null):r(t.reason)}function Dr(e){let t=U(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"):a({tickId:n})}function Cr(e){let t=U(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 p,l=t.record.lifecycleOperation;if(l!==void 0){if(l!=="enable"&&l!=="disable"&&l!=="renew")return r('lifecycleOperation must be "enable", "disable", or "renew"');p=l}return n==="lifecycle"&&p===void 0?r("lifecycleOperation is required for the lifecycle execution kind"):a({executionKind:n,...o!==void 0?{deliveryId:o}:{},...p!==void 0?{lifecycleOperation:p}:{}})}function br(e){return!i(e)||typeof e.sessionId!="string"||typeof e.connectionId!="string"||!i(e.credential)?r("runtime credential session must carry sessionId, connectionId and a credential object"):a(e.credential)}var Me="/workspaces/:workspaceId/files",$e=e=>`/workspaces/${encodeURIComponent(e)}/files/upload-session`,Ke=(e,t)=>`/workspaces/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}/complete`,We=(e,t)=>`/workspaces/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`,Ve=(e,t,n)=>`/workspaces/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}/access?intent=${encodeURIComponent(n)}`;function L(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"):a(e)}function re(e){return!i(e)||e.method!=="GET"&&e.method!=="PUT"||typeof e.url!="string"||typeof e.expires_at!="string"||!Xe(e.headers)?r("presigned file URL data is invalid"):a(e)}function qe(e){if(!i(e))return r("file upload session data is invalid");let t=L(e.file);if(!t.ok)return r(t.reason);let n=re(e.upload);return n.ok?a({file:t.value,upload:n.value}):r(n.reason)}function je(e){if(!i(e))return r("file metadata data is invalid");let t=L(e.file);return t.ok?a({file:t.value}):r(t.reason)}function j(e){if(!i(e)||!Je(e.intent))return r("file access data is invalid");let t=L(e.file);if(!t.ok)return r(t.reason);let n=re(e.access);return n.ok?a({file:t.value,access:n.value,intent:e.intent}):r(n.reason)}function Je(e){return e==="preview"||e==="download"||e==="text"}function Xe(e){return i(e)?Object.values(e).every(t=>typeof t=="string"):!1}var T="/internal/files",Gr="/upload-session",Hr="/:fileId/complete",Mr="/:fileId/access",$r="/:fileId/stat",Kr="/:fileId/content",Wr=()=>T,Vr=()=>`${T}/upload-session`,qr=e=>`${T}/${encodeURIComponent(e)}/complete`,jr=(e,t)=>`${T}/${encodeURIComponent(e)}/access?intent=${encodeURIComponent(t)}`,oe=e=>`?scope_kind=${encodeURIComponent(e.scopeKind)}&scope_id=${encodeURIComponent(e.scopeId)}`,Jr=(e,t)=>`${T}/${encodeURIComponent(e)}/stat${oe(t)}`,Xr=(e,t)=>`${T}/${encodeURIComponent(e)}/content${oe(t)}`;function Yr(e){if(!i(e))return r("internal file access data is invalid");if(e.intent==="runtime_read"||e.intent==="provider_multipart"){let t=j({...e,intent:"preview"});return t.ok?a({file:t.value.file,access:t.value.access,intent:e.intent}):r(t.reason)}return r("internal file access intent is invalid")}var eo="/:flowRunId/human-inputs",to="/:flowRunId/human-inputs/:requestId",no="/:flowRunId/human-inputs/:requestId/expire",ro="/:flowRunId/human-inputs/:requestId/acknowledge",Ye=e=>`${f}/${encodeURIComponent(e)}/human-inputs`,ie=(e,t)=>`${Ye(e)}/${encodeURIComponent(t)}`,oo=(e,t)=>`${ie(e,t)}/expire`,io=(e,t)=>`${ie(e,t)}/acknowledge`,ze="human_input_resolved";function so(e){return`${ze}_${e}`}function g(e){return{ok:!1,reason:e}}function R(e,t){return i(e)?{ok:!0,value:e}:g(`${t} must be an object`)}function x(e,t){return typeof e!="string"||e.length===0?g(`${t} must be a non-empty string`):{ok:!0,value:e}}var Qe=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function Ze(e,t){return typeof e!="string"||!Qe.test(e)||Number.isNaN(Date.parse(e))?g(`${t} must be an ISO-8601 timestamp`):{ok:!0,value:e}}function et(e){let t=R(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 g("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 g("renderedPrompt.format is invalid");o.format=t.value.format}return{ok:!0,value:o}}function tt(e){let t=R(e,"input");if(!t.ok)return t;let n=t.value.kind;if(n==="choice"){if(!Array.isArray(t.value.choices))return g("input.choices must be an array")}else if(n!=="text")if(n==="form"){if(!Array.isArray(t.value.fields))return g("input.fields must be an array")}else return g("input.kind is invalid");return{ok:!0,value:t.value}}function nt(e){if(e==null)return{ok:!0,value:void 0};let t=R(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 g("partiallyRenderedDelivery.actions must be an array");let o=[];for(let s of n){let p=R(s,"delivery action");if(!p.ok)return p;let l=x(p.value.id,"delivery action id");if(!l.ok)return l;let c=se(p.value.inputs,`delivery action '${l.value}' inputs`);if(!c.ok)return c;o.push({id:l.value,inputs:c.value})}return{ok:!0,value:{actions:o}}}function se(e,t){let n=R(e,t);if(!n.ok)return n;let o={};for(let[s,p]of Object.entries(n.value)){let l=ae(p,`${t}.${s}`);if(!l.ok)return l;o[s]=l.value}return{ok:!0,value:o}}function ae(e,t){let n=R(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 g(`${t}.items must be an array`);let s=[];for(let[p,l]of n.value.items.entries()){let c=ae(l,`${t}[${p}]`);if(!c.ok)return c;s.push(c.value)}return{ok:!0,value:{kind:"array",items:s}}}case"object":{let s=se(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 g(`${t}.parts must be an array`);let s=[];for(let[p,l]of n.value.parts.entries()){let c=rt(l,`${t}.parts[${p}]`);if(!c.ok)return c;s.push(c.value)}return{ok:!0,value:{kind:"template",parts:s}}}default:return g(`${t}.kind is invalid`)}}function rt(e,t){let n=R(e,t);if(!n.ok)return n;let o=n.value.kind;if(o==="literal")return typeof n.value.value!="string"?g(`${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 g(`${t}.kind is invalid`)}function ao(e){let t=R(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=et(t.value.renderedPrompt);if(!o.ok)return r(o.reason);let s=tt(t.value.input);if(!s.ok)return r(s.reason);let p=x(t.value.timeout,"timeout");if(!p.ok)return r(p.reason);let l=Ze(t.value.expiresAt,"expiresAt");if(!l.ok)return r(l.reason);let c=nt(t.value.partiallyRenderedDelivery);return c.ok?a({nodeId:n.value,renderedPrompt:o.value,input:s.value,timeout:p.value,expiresAt:l.value,...c.value!==void 0?{partiallyRenderedDelivery:c.value}:{}}):r(c.reason)}function ot(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"):a(e)}function po(e){if(!i(e)||typeof e.created!="boolean")return r("human input create data must carry created:boolean");let t=ot(e.request);return t.ok?a({created:e.created,request:t.value}):t}function lo(e){return!i(e)||e.acknowledged!==!0?r("human input acknowledge data must carry acknowledged:true"):a({acknowledged:!0})}var co="ablehi-wfp-user-runtime-manifest/v1",go="unknown";function fo(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var Ro="/internal/deployment-handshake",it=["start","terminate","send-event","start-webhook-watcher","run-polling-tick","invoke-tool","invoke-trigger-handler","invoke-webhook-protocol-adapter","deployment-handshake"],_o=it,Io="HANDSHAKE_REQUEST_INVALID",yo="HANDSHAKE_SECRET_UNCONFIGURED",To="HANDSHAKE_SECRET_MISMATCH",xo="HANDSHAKE_CONTRACT_VERSION_MISMATCH",Eo="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",wo="HANDSHAKE_CAPABILITY_MISSING";function Ao(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function ko(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}var ho="platform.access",Po="platform.api_key.manage";var No="/me",Do=()=>"/me";var st="/app/bootstrap",bo=()=>st;var pe="/workspaces",vo="/",Uo="/:workspaceId",at="/me/default-workspace",Lo=e=>`${pe}/${encodeURIComponent(e)}`,Bo=()=>pe,Go=()=>at;var J="/api-keys",pt="/grant-options",Mo="/:apiKeyId",$o="ahi_key_",Ko="workspace.full_access",Wo=()=>J,Vo=()=>`${J}${pt}`,qo=e=>`${J}/${encodeURIComponent(e)}`;var X="/catalog",Jo="/integrations",Xo="/integrations/:slug",Yo="/versions",zo="/integrations/:slug/default-provider-app-config",Qo=e=>{let t=`${X}/integrations`;return e?.category!==void 0&&e.category!==""?`${t}?category=${encodeURIComponent(e.category)}`:t},lt=e=>`${X}/integrations/${encodeURIComponent(e)}`,Zo=()=>`${X}/versions`,ei=e=>`${lt(e)}/default-provider-app-config`;var ni="/workspaces/:workspaceId/integrations",ri="/:installationId",oi="/:installationId/tools",ut=e=>`/workspaces/${encodeURIComponent(e)}/integrations`,ct=(e,t)=>`${ut(e)}/${encodeURIComponent(t)}`,ii=(e,t)=>`${ct(e,t)}/tools`;var ai="/workspaces/:workspaceId",pi="/connections",li="/integrations/:installationId/connect/start",ui="/integrations/:installationId/connect/options",ci="/connect-sessions/:sessionId/submit",di="/connect-sessions/:sessionId/complete",gi="/integrations/:installationId/connections/:connectionRef",fi="/callbacks/redirect",E=e=>`/workspaces/${encodeURIComponent(e)}`,mi=e=>`${E(e)}/connections`,Ri=(e,t)=>`${E(e)}/integrations/${encodeURIComponent(t)}/connect/start`,_i=(e,t)=>`${E(e)}/integrations/${encodeURIComponent(t)}/connect/options`,Ii=(e,t)=>`${E(e)}/connect-sessions/${encodeURIComponent(t)}/submit`,yi=(e,t)=>`${E(e)}/connect-sessions/${encodeURIComponent(t)}/complete`,Ti=(e,t,n)=>`${E(e)}/integrations/${encodeURIComponent(t)}/connections/${encodeURIComponent(n)}`;var Ei="/workspaces/:workspaceId/flows",wi="/validate",Ai="/:flowId",ki="/:flowId/enable",Si="/:flowId/disable",hi="/:flowId/draft",Pi="/:flowId/versions",Oi="/:flowId/versions/:version",le=e=>`/workspaces/${encodeURIComponent(e)}/flows`,Ni=e=>`${le(e)}/validate`,B=(e,t)=>`${le(e)}/${encodeURIComponent(t)}`,Di=(e,t)=>`${B(e,t)}/enable`,Ci=(e,t)=>`${B(e,t)}/disable`,bi=(e,t)=>`${B(e,t)}/draft`,dt=(e,t)=>`${B(e,t)}/versions`,Fi=(e,t,n)=>`${dt(e,t)}/${n}`;var Ui="/workspaces/:workspaceId/agent",Li="/chat",Bi="/flow-context",Gi="/sessions",Hi="/sessions/:sessionId",Mi=e=>`/workspaces/${encodeURIComponent(e)}/agent/chat`,$i=e=>`/workspaces/${encodeURIComponent(e)}/agent/sessions`,Ki=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/sessions/${encodeURIComponent(t)}`,Wi=20,Vi=50,qi=100,ji="flow_authoring",Ji=["flow","flow_run","inbox_entry","integration"],Xi=256,Yi=10,zi=256,Qi=["getFlowContext","getWorkingFlowIr","setFlowMeta","addNode","updateNode","removeNode","setTrigger","removeTrigger","setOutputs","setComposition","validateFlow","proposePublish","requestConnect"],Zi=["setFlowMeta","addNode","updateNode","removeNode","setTrigger","removeTrigger","setOutputs","setComposition"];function es(e){return JSON.stringify(e)}var G={type:"object",properties:{},additionalProperties:!1},w={type:"object",additionalProperties:!0},gt=[{name:"getFlowContext",execution:"server",description:"Read the current workspace environment snapshot (installed integrations, their control-plane tools and triggers with stable refs, and active connections). Call this first to learn which toolRef / triggerRef / connectionRef values are available before editing the flow.",inputSchema:G},{name:"getWorkingFlowIr",execution:"server",description:"Read the current Server-owned working flow IR (flow.ir.v1), including existing triggers, nodes, outputs, and composition. Call this before editing an existing or non-empty flow, or whenever you need to inspect the current flow state.",inputSchema:G},{name:"setFlowMeta",execution:"server",description:"Set the working flow metadata: the flow logical name and/or its inputSchema (the $input contract).",inputSchema:{type:"object",properties:{flow:{type:"string",description:"Flow logical name."},inputSchema:{...w,description:"JSON object describing $input."}},additionalProperties:!1}},{name:"addNode",execution:"server",description:"Add one node to the working flow IR. node.kind is action | wait_event | sleep | human_input. action needs { id, kind:'action', toolRef, connectionRef, inputs }. wait_event needs { id, kind:'wait_event', eventType, correlation, timeout, onTimeout }. sleep needs { id, kind:'sleep', duration }. human_input needs { id, kind:'human_input', prompt:{ title, body?, format?:'plain'|'markdown' }, input, timeout, delivery? } \u2014 use it whenever the flow must WAIT for a person to review/approve/choose/answer before continuing; never use a normal action node or a provider approval tool as the wait point. human_input.input is { kind:'choice', choices:[{ id, label, style? }], allowComment? } | { kind:'text', multiline?, placeholder?, required? } | { kind:'form', fields:[{ id, label, type:'text'|'textarea'|'number'|'boolean'|'select', required?, options? }] }. Approve/reject is input.kind:'choice' with choices approve and reject (reject is just a choice with NO automatic side effect; wire any reject behavior yourself). Three or more options is the same choice kind with more choices. Free text is input.kind:'text'; structured answers are input.kind:'form'. Downstream nodes read $nodes.<human_input_id>.output, whose runtime shape is { status:'submitted', response, actor, submissionSource, submittedAt } | { status:'expired', actor, expiredAt } \u2014 the submitted value is nested under output.response ({ kind:'choice', choiceId, comment? } | { kind:'text', text } | { kind:'form', values }), NEVER directly on output. Examples: choice branch runIf { eq:[ $nodes.review.output.response.choiceId, 'approve' ] }; text value ${$nodes.ask.output.response.text}; form field ${$nodes.details.output.response.values.priority}; timeout branch runIf { eq:[ $nodes.review.output.status, 'expired' ] } (an expired human_input is a normal output, not a failure). Optional external notifications go under delivery.actions[] as { id, toolRef, connectionRef, inputs } using the SAME action triad as an action node (concrete string toolRef + concrete user-chosen string connectionRef + inputs); Inbox is always the default surface and is never itself a delivery action; you may add zero or more delivery actions. Only delivery.actions[].inputs may reference $humanInput, and the standard payload field uses the whole-object single reference form $humanInput.actions.<deliveryActionId>.payload (never string-interpolated). Do not invent provider shorthand fields; use the action's own input names. If a native feedback action declares fixed choice ids, the human_input.input.choices[].id MUST match those ids exactly (labels may differ, e.g. Yes/No) \u2014 never auto-map yes/no to approve/reject. Use dependsOn and $nodes.<id>.output.* references to wire data between nodes. node inputs MUST NOT reference $trigger (trigger output is bound only in the trigger's inputMapping / dedupeKey); read trigger-derived values via $input.* instead. In text templates reference fields with ${$input.*} / ${$nodes.*}; mixed text MUST NOT contain a bare reference (write 'Issue: ${$input.title}', never 'Issue: $input.title'), and a literal dollar sign is written as $$ (e.g. 'Pay $$5'). duration / timeout strings MUST be '<positive integer> <unit>' where unit is second|minute|hour|day (plural allowed), e.g. '1 hour', '10 minutes', '5 days' \u2014 compact forms like '1h' / '10m' are rejected by the server.",inputSchema:{type:"object",properties:{node:{...w,description:"A FlowNode object."}},required:["node"],additionalProperties:!1}},{name:"updateNode",execution:"server",description:"Patch an existing node by id. patch is a partial node object whose fields are shallow-merged into the node.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Target node id."},patch:{...w,description:"Partial node fields to merge."}},required:["id","patch"],additionalProperties:!1}},{name:"removeNode",execution:"server",description:"Remove a node from the working flow IR by id.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Node id to remove."}},required:["id"],additionalProperties:!1}},{name:"setTrigger",execution:"server",description:"Upsert a trigger by id (replaces a trigger with the same id). trigger.kind is schedule | integration | manual. schedule needs { id, kind:'schedule', cron, timezone }. integration needs { id, kind:'integration', triggerRef, connectionRef, config, inputMapping?, dedupeKey? }. manual needs { id, kind:'manual' }. For an integration trigger, fill config from the trigger inputSchema in getFlowContext and NEVER omit a requiredInputs field (e.g. linear/new_issue requires config.team_id). $trigger.output.* may ONLY be referenced inside the trigger's own inputMapping / dedupeKey; node inputs MUST NOT reference $trigger. In any text template, reference fields with ${$input.*} / ${$nodes.*}; mixed text MUST NOT contain a bare reference (write 'Issue: ${$input.title}', never 'Issue: $input.title'), and a literal dollar sign is written as $$ (e.g. 'Pay $$5'). Always run validateFlow before proposing publish.",inputSchema:{type:"object",properties:{trigger:{...w,description:"A TriggerBinding object."}},required:["trigger"],additionalProperties:!1}},{name:"removeTrigger",execution:"server",description:"Remove a trigger from the working flow IR by id.",inputSchema:{type:"object",properties:{id:{type:"string",description:"Trigger id to remove."}},required:["id"],additionalProperties:!1}},{name:"setOutputs",execution:"server",description:"Set the working flow outputs mapping: the MACHINE response / API response of the flow (structured data for programs and webhooks), NOT the user-facing result. The user-readable Inbox result is composition (use setComposition for that); never describe outputs to the user as their result, and never derive composition from outputs. Only reference fields that exist in a tool or trigger output schema. Use $nodes.<id>.output.<arrayField>.length to project an array count. In text templates reference fields with ${$input.*} / ${$nodes.*}; mixed text MUST NOT contain a bare reference (write 'Total: ${$nodes.sum.output.value}', never 'Total: $nodes.sum.output.value'), and a literal dollar sign is written as $$ (e.g. 'Pay $$5'). Do not invent output fields from node inputs; for example, if a search tool output only declares results, use a literal or $input value for the original query instead of $nodes.<id>.output.query.",inputSchema:{type:"object",properties:{outputs:{...w,description:"Outputs mapping object."}},required:["outputs"],additionalProperties:!1}},{name:"setComposition",execution:"server",description:"Set the flow composition: the USER-READABLE result work that a successful run saves as one Inbox result for a person to read (NOT the machine response \u2014 that is outputs). composition.title is a short headline. composition.detail.format MUST be 'markdown' and composition.detail.body is the markdown a human reads. Optionally composition.detail.data is a structured mapping kept for reference (never shown by default). Add composition.report ONLY when the flow already has a node that produces a human report (e.g. an AI analysis/report node): set its report.format='markdown' and report.body from that node output; never invent a report when no report-producing node exists. Reference run data with ${$input.*} / ${$nodes.*} only (composition MUST NOT reference $trigger or $outputs); mixed text MUST NOT contain a bare reference (write 'Result: ${$nodes.sum.output.value}', never 'Result: $nodes.sum.output.value'), and a literal dollar sign is written as $$ (e.g. 'Pay $$5'). Creating a flow MUST create a composition; editing nodes or input semantics MUST keep composition consistent. The whole composition object replaces the previous one.",inputSchema:{type:"object",properties:{composition:{...w,description:"A FlowCompositionSpec: { title, detail:{ format:'markdown', body, data? }, report?:{ title?, format:'markdown', body, data? } }."}},required:["composition"],additionalProperties:!1}},{name:"validateFlow",execution:"server",description:"Validate the current Server-owned working flow IR against the Ablehi Server (authoritative). A valid result automatically persists the flow draft and runs readiness; the server is the only source of flow validity.",inputSchema:G},{name:"proposePublish",execution:"server",description:"When the latest Server-owned draft is publishable, return a structured publish suggestion for the human. This tool never publishes and never creates an approval; publishing is only POST /publish with human confirm:true.",inputSchema:G},{name:"requestConnect",execution:"client",description:"Ask the user to connect an integration so a connectionRef becomes available. Opens the connection UI. The user supplies any credential directly to the Ablehi Server; you only receive { status, connectionRef? } and never the secret.",inputSchema:{type:"object",properties:{installationId:{type:"string",description:"Installation to connect."},connectionName:{type:"string",description:"Optional connection display name."}},required:["installationId"],additionalProperties:!1}}];function ts(e){return gt.find(t=>t.name===e)}var ns="AGENT_RUNTIME_UNCONFIGURED",rs="AGENT_RUNTIME_FAILED",os="AGENT_SESSION_NOT_FOUND",is="AGENT_MESSAGE_DELTA_INVALID",ss="AGENT_PAGE_CONTEXT_INVALID",Y="/agent/assets",as="/prompts",ps="/prompts/:targetKey/:revision",ls="/prompts/:targetKey/:revision/validate",us="/prompts/:targetKey/:revision/activate",cs="/model-input-targets",ds="/model-input-targets/:targetKey/render-preview",gs="/model-input-snapshots",fs="/flow-scenes",ms="/flow-scenes/:sceneKey/:revision",Rs="/flow-scenes/:sceneKey/:revision/validate",_s="/flow-scenes/:sceneKey/:revision/activate",Is="/flow-scenes/:sceneKey/:revision/reindex",ys="/flow-templates",Ts="/flow-templates/:templateKey/:revision",xs="/flow-templates/:templateKey/:revision/validate",Es="/flow-templates/:templateKey/:revision/activate",ws="/flow-templates/:templateKey/:revision/reindex",As="/flow-working-drafts/open",ks="/flow-working-drafts/:draftId",Ss="/flow-working-drafts/:draftId/commands",hs="/flow-working-drafts/:draftId/edit-turn/acquire",Ps="/flow-working-drafts/:draftId/edit-turn/release",Os="/flow-working-drafts/:draftId/publish",Ns="/flow-working-drafts/:draftId/readiness/check",Ds="/flow-working-drafts/:draftId/readiness/requirements/:requirementId/resolve",Cs="/flow-creation-tasks/:flowCreationTaskId",bs="/flow-creation-decisions/:decisionRecordId",Fs=()=>`${Y}/prompts`,vs=()=>`${Y}/flow-scenes`,Us=()=>`${Y}/flow-templates`,Ls=e=>`/workspaces/${encodeURIComponent(e)}/agent/flow-working-drafts/open`,A=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-working-drafts/${encodeURIComponent(t)}`,Bs=(e,t)=>`${A(e,t)}/commands`,Gs=(e,t)=>`${A(e,t)}/edit-turn/acquire`,Hs=(e,t)=>`${A(e,t)}/edit-turn/release`,Ms=(e,t)=>`${A(e,t)}/publish`,$s=(e,t)=>`${A(e,t)}/readiness/check`,Ks=(e,t,n)=>`${A(e,t)}/readiness/requirements/${encodeURIComponent(n)}/resolve`,Ws=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-creation-tasks/${encodeURIComponent(t)}`,Vs=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-creation-decisions/${encodeURIComponent(t)}`,qs="agent.asset.manage",js=/^[A-Za-z0-9_-]{1,64}$/,Js="flow_create_authoring_task",ft="oneoff_getActionContext",mt="oneoff_executeAction",Xs=[ft,mt],Ys=["agent.general.turn","agent.intent.flow_goal","agent.one_off.turn","flow_authoring.edit_turn","flow_authoring.create_from_brief_turn","flow_authoring.server_loop_command","workflow.flow_authoring.scene_fit_judge","workflow.flow_authoring.template_fit_judge","workflow.flow_authoring.brief_generation","workflow.flow_authoring.fallback_plan"],zs="AGENT_ASSET_NOT_FOUND",Qs="AGENT_ASSET_VALIDATION_FAILED",Zs="AGENT_PROMPT_TARGET_NOT_FOUND",ea="AGENT_PROMPT_ACTIVE_REVISION_MISSING",ta="AGENT_PROMPT_REVISION_NOT_FOUND",na="AGENT_PROMPT_REVISION_NOT_DRAFT",ra="AGENT_PROMPT_VALIDATION_FAILED",oa="AGENT_MODEL_INPUT_TARGET_PROTECTED",ia="AGENT_MODEL_INPUT_PREVIEW_UNAVAILABLE",sa="AGENT_FLOW_GOAL_INVALID",aa="AGENT_FLOW_CREATION_TASK_NOT_FOUND",pa="AGENT_FLOW_CREATION_TASK_CONFLICT",la="AGENT_FLOW_AUTHORING_WORKFLOW_FAILED",ua="FLOW_WORKING_DRAFT_NOT_FOUND",ca="FLOW_DRAFT_REVISION_CONFLICT",da="FLOW_DRAFT_COMMAND_INVALID",ga="FLOW_DRAFT_EDIT_LOCKED",fa="FLOW_EDIT_TURN_NOT_HELD",ma="FLOW_DRAFT_NOT_PUBLISHABLE",Ra="FLOW_PUBLISH_CONFIRMATION_REQUIRED",_a="FLOW_READINESS_REQUIREMENT_NOT_FOUND",Ia="FLOW_READINESS_REQUIREMENT_CONFLICT",ya="AGENT_ASSET_INDEX_FAILED";var xa="/workspaces/:workspaceId/runs",Ea="/workspaces/:workspaceId/flows/:flowId/runs",wa="/:runId",Aa="/:runId/cancel",ka="/:runId/events",Rt=e=>`/workspaces/${encodeURIComponent(e)}/runs`,ue=(e,t)=>`${Rt(e)}/${encodeURIComponent(t)}`,Sa=(e,t)=>`${ue(e,t)}/cancel`,ha=(e,t)=>`${ue(e,t)}/events`,Pa=(e,t)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/runs`,Oa=["queued","running","succeeded","failed","interrupted","cancelled"],Na=["succeeded","skipped","timed_out","failed"];var Ca="/workspaces/:workspaceId/inbox/items",ba="/workspaces/:workspaceId/inbox/entries",ce="/inbox/entries",Fa="/:itemId",va="/:entryId",Ua="/:entryId/human-input/submit",_t=e=>`/workspaces/${encodeURIComponent(e)}/inbox/items`,La=(e,t)=>`${_t(e)}/${encodeURIComponent(t)}`,It=e=>`/workspaces/${encodeURIComponent(e)}/inbox/entries`,yt=(e,t)=>`${It(e)}/${encodeURIComponent(t)}`,Ba=(e,t)=>`${yt(e,t)}/human-input/submit`,Ga=()=>ce,Tt=e=>`${ce}/${encodeURIComponent(e)}`,Ha=e=>`${Tt(e)}/human-input/submit`;var $a="/human-input/tokens",Ka="/:token",Wa="/:token/submit",xt=e=>`/human-input/tokens/${encodeURIComponent(e)}`,Va=e=>`${xt(e)}/submit`;var ja="/:flowId/trigger-instances",Ja="/:flowId/triggers/:triggerBindingId/simulate",Xa=(e,t)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/trigger-instances`,Ya=(e,t,n)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/triggers/${encodeURIComponent(n)}/simulate`;export{Y as AGENT_ASSETS_ROUTE_PREFIX,fs as AGENT_ASSET_FLOW_SCENES_SUBPATH,_s as AGENT_ASSET_FLOW_SCENE_ACTIVATE_SUBPATH,ms as AGENT_ASSET_FLOW_SCENE_ITEM_SUBPATH,Is as AGENT_ASSET_FLOW_SCENE_REINDEX_SUBPATH,Rs as AGENT_ASSET_FLOW_SCENE_VALIDATE_SUBPATH,ys as AGENT_ASSET_FLOW_TEMPLATES_SUBPATH,Es as AGENT_ASSET_FLOW_TEMPLATE_ACTIVATE_SUBPATH,Ts as AGENT_ASSET_FLOW_TEMPLATE_ITEM_SUBPATH,ws as AGENT_ASSET_FLOW_TEMPLATE_REINDEX_SUBPATH,xs as AGENT_ASSET_FLOW_TEMPLATE_VALIDATE_SUBPATH,ya as AGENT_ASSET_INDEX_FAILED_ERROR_CODE,qs as AGENT_ASSET_MANAGE_PERMISSION,gs as AGENT_ASSET_MODEL_INPUT_SNAPSHOTS_SUBPATH,cs as AGENT_ASSET_MODEL_INPUT_TARGETS_SUBPATH,ds as AGENT_ASSET_MODEL_INPUT_TARGET_PREVIEW_SUBPATH,zs as AGENT_ASSET_NOT_FOUND_ERROR_CODE,as as AGENT_ASSET_PROMPTS_SUBPATH,us as AGENT_ASSET_PROMPT_ACTIVATE_SUBPATH,ps as AGENT_ASSET_PROMPT_ITEM_SUBPATH,ls as AGENT_ASSET_PROMPT_VALIDATE_SUBPATH,Qs as AGENT_ASSET_VALIDATION_FAILED_ERROR_CODE,ji as AGENT_CAPABILITY_FLOW_AUTHORING,Li as AGENT_CHAT_ROUTE_SUBPATH,Js as AGENT_CREATE_FLOW_AUTHORING_TASK_TOOL_NAME,la as AGENT_FLOW_AUTHORING_WORKFLOW_FAILED_ERROR_CODE,Bi as AGENT_FLOW_CONTEXT_ROUTE_SUBPATH,bs as AGENT_FLOW_CREATION_DECISION_ITEM_SUBPATH,pa as AGENT_FLOW_CREATION_TASK_CONFLICT_ERROR_CODE,Cs as AGENT_FLOW_CREATION_TASK_ITEM_SUBPATH,aa as AGENT_FLOW_CREATION_TASK_NOT_FOUND_ERROR_CODE,sa as AGENT_FLOW_GOAL_INVALID_ERROR_CODE,Ds as AGENT_FLOW_READINESS_REQUIREMENT_RESOLVE_SUBPATH,Ss as AGENT_FLOW_WORKING_DRAFT_COMMANDS_SUBPATH,hs as AGENT_FLOW_WORKING_DRAFT_EDIT_TURN_ACQUIRE_SUBPATH,Ps as AGENT_FLOW_WORKING_DRAFT_EDIT_TURN_RELEASE_SUBPATH,ks as AGENT_FLOW_WORKING_DRAFT_ITEM_SUBPATH,As as AGENT_FLOW_WORKING_DRAFT_OPEN_SUBPATH,Os as AGENT_FLOW_WORKING_DRAFT_PUBLISH_SUBPATH,Ns as AGENT_FLOW_WORKING_DRAFT_READINESS_CHECK_SUBPATH,is as AGENT_MESSAGE_DELTA_INVALID_ERROR_CODE,ia as AGENT_MODEL_INPUT_PREVIEW_UNAVAILABLE_ERROR_CODE,Ys as AGENT_MODEL_INPUT_TARGET_KEYS,oa as AGENT_MODEL_INPUT_TARGET_PROTECTED_ERROR_CODE,ss as AGENT_PAGE_CONTEXT_INVALID_ERROR_CODE,Yi as AGENT_PAGE_CONTEXT_MAX_RESOURCES,zi as AGENT_PAGE_CONTEXT_RESOURCE_ID_MAX_LENGTH,Xi as AGENT_PAGE_CONTEXT_ROUTE_ID_MAX_LENGTH,Ji as AGENT_PAGE_RESOURCE_TYPES,ea as AGENT_PROMPT_ACTIVE_REVISION_MISSING_ERROR_CODE,na as AGENT_PROMPT_REVISION_NOT_DRAFT_ERROR_CODE,ta as AGENT_PROMPT_REVISION_NOT_FOUND_ERROR_CODE,Zs as AGENT_PROMPT_TARGET_NOT_FOUND_ERROR_CODE,ra as AGENT_PROMPT_VALIDATION_FAILED_ERROR_CODE,Ui as AGENT_ROUTE_PREFIX,rs as AGENT_RUNTIME_FAILED_ERROR_CODE,js as AGENT_RUNTIME_TOOL_NAME_PATTERN,ns as AGENT_RUNTIME_UNCONFIGURED_ERROR_CODE,Gi as AGENT_SESSIONS_ROUTE_SUBPATH,qi as AGENT_SESSION_DETAIL_MESSAGE_LIMIT,Hi as AGENT_SESSION_ITEM_ROUTE_SUBPATH,Wi as AGENT_SESSION_LIST_DEFAULT_LIMIT,Vi as AGENT_SESSION_LIST_MAX_LIMIT,os as AGENT_SESSION_NOT_FOUND_ERROR_CODE,J as API_KEYS_ROUTE_PREFIX,pt as API_KEY_GRANT_OPTIONS_ROUTE_SUBPATH,Mo as API_KEY_ITEM_ROUTE_SUBPATH,$o as API_KEY_TOKEN_PREFIX,Ko as API_KEY_WORKSPACE_FULL_ACCESS_SCOPE,st as APP_BOOTSTRAP_ROUTE_PATH,zo as CATALOG_DEFAULT_PROVIDER_APP_CONFIG_ROUTE_SUBPATH,Jo as CATALOG_INTEGRATIONS_ROUTE_SUBPATH,Xo as CATALOG_INTEGRATION_DETAIL_ROUTE_SUBPATH,X as CATALOG_ROUTE_PREFIX,Yo as CATALOG_VERSIONS_ROUTE_SUBPATH,pi as CONNECTIONS_ROUTE_SUBPATH,gi as CONNECTION_DISCONNECT_ROUTE_SUBPATH,di as CONNECT_COMPLETE_ROUTE_SUBPATH,ui as CONNECT_OPTIONS_ROUTE_SUBPATH,li as CONNECT_START_ROUTE_SUBPATH,ci as CONNECT_SUBMIT_ROUTE_SUBPATH,Pt as CONTEXT_STATE_CLEANUP_ROUTE_PATH,No as CURRENT_USER_ROUTE_PATH,at as DEFAULT_WORKSPACE_ROUTE_PATH,it as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,_o as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,Ro as DEPLOYMENT_HANDSHAKE_ROUTE,Zn as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,Qn as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,Ue as EGRESS_GRANT_SCOPE_KINDS,$t as EVENT_WAIT_ROUTE_SUBPATH,Ft as EXECUTION_CONTEXT_ROUTE_SUBPATH,Mr as FILE_ACCESS_ROUTE_SUBPATH,Hr as FILE_COMPLETE_ROUTE_SUBPATH,Kr as FILE_CONTENT_ROUTE_SUBPATH,$r as FILE_STAT_ROUTE_SUBPATH,Gr as FILE_UPLOAD_SESSION_ROUTE_SUBPATH,Zi as FLOW_AUTHORING_EDIT_TOOL_NAMES,gt as FLOW_AUTHORING_TOOL_DESCRIPTORS,Qi as FLOW_AUTHORING_TOOL_NAMES,Si as FLOW_DISABLE_ROUTE_SUBPATH,da as FLOW_DRAFT_COMMAND_INVALID_ERROR_CODE,ga as FLOW_DRAFT_EDIT_LOCKED_ERROR_CODE,ma as FLOW_DRAFT_NOT_PUBLISHABLE_ERROR_CODE,ca as FLOW_DRAFT_REVISION_CONFLICT_ERROR_CODE,hi as FLOW_DRAFT_ROUTE_SUBPATH,fa as FLOW_EDIT_TURN_NOT_HELD_ERROR_CODE,ki as FLOW_ENABLE_ROUTE_SUBPATH,ge as FLOW_INTERPRETER_CONTRACT_VERSION,wt as FLOW_IR_SCHEMA_VERSION,Ai as FLOW_ITEM_ROUTE_SUBPATH,Ra as FLOW_PUBLISH_CONFIRMATION_REQUIRED_ERROR_CODE,Ia as FLOW_READINESS_REQUIREMENT_CONFLICT_ERROR_CODE,_a as FLOW_READINESS_REQUIREMENT_NOT_FOUND_ERROR_CODE,Jn as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,Mt as FLOW_RUN_RESULT_ROUTE_SUBPATH,Tr as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Oa as FLOW_RUN_STATUSES,wi as FLOW_VALIDATE_ROUTE_SUBPATH,Pi as FLOW_VERSIONS_ROUTE_SUBPATH,Oi as FLOW_VERSION_ITEM_ROUTE_SUBPATH,ua as FLOW_WORKING_DRAFT_NOT_FOUND_ERROR_CODE,ce as GLOBAL_INBOX_ENTRIES_ROUTE_PREFIX,en as HANDLER_BUNDLES_ROUTE_SUBPATH,wo as HANDSHAKE_CAPABILITY_MISSING,xo as HANDSHAKE_CONTRACT_VERSION_MISMATCH,Eo as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,Io as HANDSHAKE_REQUEST_INVALID,To as HANDSHAKE_SECRET_MISMATCH,yo as HANDSHAKE_SECRET_UNCONFIGURED,eo as HUMAN_INPUTS_ROUTE_SUBPATH,ro as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,no as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,to as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,ze as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,$a as HUMAN_INPUT_TOKENS_ROUTE_PREFIX,Ka as HUMAN_INPUT_TOKEN_ROUTE_SUBPATH,Wa as HUMAN_INPUT_TOKEN_SUBMIT_ROUTE_SUBPATH,Ua as INBOX_ENTRY_HUMAN_INPUT_SUBMIT_ROUTE_SUBPATH,va as INBOX_ENTRY_ROUTE_SUBPATH,Fa as INBOX_ITEM_ROUTE_SUBPATH,ri as INTEGRATION_ITEM_ROUTE_SUBPATH,oi as INTEGRATION_TOOLS_ROUTE_SUBPATH,te as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX,T as INTERNAL_FILES_ROUTE_PREFIX,f as INTERNAL_FLOW_RUNS_ROUTE_PREFIX,Ee as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX,K as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,P as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,q as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,S as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,mt as ONE_OFF_EXECUTE_ACTION_TOOL_NAME,ft as ONE_OFF_GET_ACTION_CONTEXT_TOOL_NAME,Xs as ONE_OFF_TOOL_NAMES,ho as PLATFORM_ACCESS_PERMISSION,Po as PLATFORM_API_KEY_MANAGE_PERMISSION,Fn as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,Yn as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,vn as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,Er as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Un as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,fi as PROVIDER_CALLBACK_REDIRECT_ROUTE_PATH,Pr as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,Aa as RUN_CANCEL_ROUTE_SUBPATH,ka as RUN_EVENTS_ROUTE_SUBPATH,wa as RUN_ITEM_ROUTE_SUBPATH,de as SERVER_CONTRACT_VERSION,Ht as STEP_RESULT_ROUTE_SUBPATH,Na as STEP_RUN_STATUSES,tn as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,Xn as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,xr as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,ja as TRIGGER_INSTANCES_ROUTE_SUBPATH,Ja as TRIGGER_SIMULATE_ROUTE_SUBPATH,En as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,An as WEBHOOK_PROTOCOL_ADAPTER_MODULE,dn as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,fn as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,zn as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,mn as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,gn as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,Rn as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,wr as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,co as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,go as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,pe as WORKSPACES_ROUTE_PREFIX,Uo as WORKSPACE_ACCESS_ROUTE_SUBPATH,ai as WORKSPACE_CONNECTION_MOUNT_PREFIX,Me as WORKSPACE_FILES_ROUTE_PREFIX,Ei as WORKSPACE_FLOWS_ROUTE_PREFIX,Ea as WORKSPACE_FLOW_RUNS_ROUTE_PREFIX,ba as WORKSPACE_INBOX_ENTRIES_ROUTE_PREFIX,Ca as WORKSPACE_INBOX_ITEMS_ROUTE_PREFIX,ni as WORKSPACE_INTEGRATIONS_ROUTE_PREFIX,vo as WORKSPACE_LIST_ROUTE_SUBPATH,xa as WORKSPACE_RUNS_ROUTE_PREFIX,vs as agentAssetFlowScenesPath,Us as agentAssetFlowTemplatesPath,Fs as agentAssetPromptsPath,Mi as agentChatPath,Vs as agentFlowCreationDecisionPath,Ws as agentFlowCreationTaskPath,Ks as agentFlowReadinessRequirementResolvePath,Bs as agentFlowWorkingDraftCommandsPath,Gs as agentFlowWorkingDraftEditTurnAcquirePath,Hs as agentFlowWorkingDraftEditTurnReleasePath,Ls as agentFlowWorkingDraftOpenPath,A as agentFlowWorkingDraftPath,Ms as agentFlowWorkingDraftPublishPath,$s as agentFlowWorkingDraftReadinessCheckPath,Ki as agentSessionPath,$i as agentSessionsPath,Vo as apiKeyGrantOptionsPath,qo as apiKeyPath,Wo as apiKeysPath,bo as appBootstrapPath,ei as catalogDefaultProviderAppConfigPath,lt as catalogIntegrationPath,Qo as catalogIntegrationsPath,Zo as catalogVersionsPath,yi as connectCompletePath,_i as connectOptionsPath,Ri as connectStartPath,Ii as connectSubmitPath,Ti as connectionDisconnectPath,r as contractParseFail,a as contractParseOk,Do as currentUserPath,Go as defaultWorkspacePath,Ao as deploymentHandshakeProbePayload,ko as deploymentHandshakeResponseProofPayload,ir as egressGrantAuditPath,or as egressGrantConsumePath,Vt as eventWaitPath,vt as executionContextPath,ts as findFlowAuthoringToolDescriptor,Ci as flowDisablePath,bi as flowDraftPath,Di as flowEnablePath,B as flowPath,er as flowRunEgressGrantPath,Wt as flowRunResultPath,Ar as flowRunRuntimeCredentialPath,Pa as flowRunsPath,kn as flowScriptProtocolAdapterModuleName,Ni as flowValidatePath,Fi as flowVersionPath,dt as flowVersionsPath,es as formatFlowToolError,Ga as globalInboxEntriesPath,Ha as globalInboxEntryHumanInputSubmitPath,Tt as globalInboxEntryPath,nn as handlerBundlesPath,io as humanInputAcknowledgePath,oo as humanInputExpirePath,ie as humanInputRequestPath,so as humanInputResolvedEventType,xt as humanInputTokenPath,Va as humanInputTokenSubmitPath,Ye as humanInputsPath,Ba as inboxEntryHumanInputSubmitPath,yt as inboxEntryPath,La as inboxItemPath,ii as installationToolsPath,jr as internalFileAccessPath,qr as internalFileCompletePath,Xr as internalFileContentPath,Jr as internalFileStatPath,Vr as internalFileUploadSessionPath,Wr as internalFilesPath,i as isJsonRecord,O as isValidRequestDigest,zt as parseCompleteFlowRunWaitBody,Ot as parseContextStateCleanupRequestBody,Nt as parseContextStateCleanupResponseData,_ as parseContextStateScope,ao as parseCreateHumanInputBody,cr as parseEgressGrantAuditBody,ur as parseEgressGrantConsumeBody,gr as parseEgressGrantConsumeData,dr as parseEgressGrantData,Ut as parseExecutionContextData,j as parseFileAccessData,je as parseFileMetadataData,L as parseFileRefData,_e as parseFileRuntimeLimits,qe as parseFileUploadSessionData,sr as parseFlowActionGrantBody,Jt as parseFlowRunResultBody,Xt as parseFlowRunResultData,Or as parseFlowRuntimeCredentialBody,Ae as parseHandlerBundle,on as parseHandlerBundlesData,lo as parseHumanInputAcknowledgeData,po as parseHumanInputCreateData,ot as parseHumanInputRequestViewData,Yr as parseInternalFileAccessData,Mn as parsePollingPublishBody,Dr as parsePollingRuntimeCredentialBody,Hn as parsePollingTriggerContext,pr as parsePollingTriggerGrantBody,$n as parsePublishPollingTickEventsData,Yt as parseRegisterFlowRunWaitBody,Qt as parseRegisterFlowRunWaitData,br as parseRuntimeCredentialSessionCredential,C as parseRuntimeNetwork,ar as parseSingleToolGrantBody,Nr as parseSingleToolRuntimeCredentialBody,qt as parseStepRecordBody,jt as parseStepRecordData,sn as parseToolHandlerBundlesData,Pn as parseTriggerHandlerBundlesData,hn as parseWebhookDelivery,On as parseWebhookPublishEventsBody,Nn as parseWebhookRearmBody,Cr as parseWebhookRuntimeCredentialBody,lr as parseWebhookTriggerGrantBody,Sn as parseWebhookWatcherContext,Ln as pollingTriggerContextPath,nr as pollingTriggerEgressGrantPath,Bn as pollingTriggerHandlerBundlesPath,Sr as pollingTriggerRuntimeCredentialPath,Gn as pollingTriggerTickEventsPath,Be as requestHasMultipartFileParts,Sa as runCancelPath,ha as runEventsPath,ue as runPath,Kt as stepResultPath,rn as toolHandlerBundlesPath,tr as toolInvocationEgressGrantPath,kr as toolInvocationRuntimeCredentialPath,Xa as triggerInstancesPath,Ya as triggerSimulatePath,wn as webhookProtocolAdapterBundlePath,_n as webhookTriggerContextPath,yn as webhookTriggerDeliveryPath,rr as webhookTriggerEgressGrantPath,Tn as webhookTriggerEventsPath,In as webhookTriggerHandlerBundlesPath,xn as webhookTriggerRearmPath,hr as webhookTriggerRuntimeCredentialPath,fo as wfpUserRuntimeManifestPath,mi as workspaceConnectionsPath,Ve as workspaceFileAccessPath,Ke as workspaceFileCompletePath,We as workspaceFileMetadataPath,$e as workspaceFileUploadSessionPath,le as workspaceFlowsPath,It as workspaceInboxEntriesPath,_t as workspaceInboxItemsPath,ct as workspaceIntegrationPath,ut as workspaceIntegrationsPath,Lo as workspacePath,Rt as workspaceRunsPath,Bo as workspacesPath};
|