@ablehi/server-contract 0.2.2 → 0.2.4
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-COdVAE2s.d.ts +987 -0
- package/dist/edge.d.ts +1 -934
- package/dist/edge.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +7 -7
package/dist/edge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var J="0.2.2";var Ce="flow.ir.v1";var X="flow.interp.v2";function a(e){return{ok:!0,value:e}}function o(e){return{ok:!1,reason:e}}function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var f="/internal/flow-runs",Fe="/:flowRunId/execution-context";function Ge(e){return`${f}/${encodeURIComponent(e)}/execution-context`}function Y(e){return!i(e)||!C(e.fileMaxBytes)||!C(e.fileReadMaxBytes)||!C(e.inlineMultipartBytesMax)?o("file runtime limits must carry three positive integer bounds"):a({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function Le(e){if(!i(e))return o("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)||!Q(e.executionBindings))return o("execution context surface shape is invalid");let n=z(e.fileRuntime);return n.ok?a({...e,fileRuntime:n.value}):o(n.reason)}function z(e){if(e===null)return a(null);if(!i(e))return o("fileRuntime must be null or an object");let t=Y(e.limits);return t.ok?a({limits:t.value}):o(t.reason)}function Q(e){return Array.isArray(e)?e.every(t=>{if(!i(t))return!1;let n=t.connection;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"}):!1}function C(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}var We="/:flowRunId/steps/:nodeId/result",Ve="/:flowRunId/result",qe="/:flowRunId/event-waits/:nodeId";function je(e,t){return`${f}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function Je(e){return`${f}/${encodeURIComponent(e)}/result`}function Xe(e,t){return`${f}/${encodeURIComponent(e)}/event-waits/${encodeURIComponent(t)}`}function Ye(e){if(!i(e))return{ok:!1,kind:"validation",reason:"step record body must be a JSON object"};let t=R(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 r=Z(e.result);if(!r.ok)return r;let s={attempt:n,result:r.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 Z(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=R(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=R(e,["status","errorCode","issues"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let r=e.errorCode;if(typeof r!="string"||r.length===0)return{ok:!1,kind:"step_result_invalid",reason:"a failed result must carry a non-empty errorCode"};let s={status:"failed",errorCode:r};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 ze(e){return!i(e)||typeof e.flowRunId!="string"||typeof e.nodeId!="string"||e.recorded!=="succeeded"&&e.recorded!=="failed"?o("step record data surface shape is invalid"):a({flowRunId:e.flowRunId,nodeId:e.nodeId,recorded:e.recorded})}function Qe(e){if(!i(e))return o("result body must be a JSON object");let t=R(e,["status","output","error","composition"]);if(t!==void 0)return o(`result does not accept the "${t}" field`);let n=e.status;if(n!=="succeeded"&&n!=="failed")return o('result status must be "succeeded" or "failed"');let r={status:n};if(e.output!==void 0&&(r.output=e.output),e.error!==void 0){let s=e.error;if(!i(s))return o("result error must be a JSON object");let u=R(s,["code","message"]);if(u!==void 0)return o(`result error does not accept the "${u}" field`);if(typeof s.code!="string"||typeof s.message!="string")return o("result error must carry string code and message");r.error={code:s.code,message:s.message}}if(e.composition!==void 0){if(n!=="succeeded")return o("composition is only allowed on a succeeded result");r.composition=e.composition}return a(r)}function Ze(e){return i(e)?a(e):o("flow run result data must be a JSON object")}var ee=/^[A-Za-z0-9_-]{1,100}$/;function et(e){if(!i(e))return o("register body must be a JSON object");let t=R(e,["eventType","correlationKey"]);if(t!==void 0)return o(`register wait does not accept the "${t}" field`);let n=F(e.eventType);if(!n.ok)return o(n.reason);let r=e.correlationKey;return typeof r!="string"||r.length===0?o("correlationKey must be a non-empty string"):a({eventType:n.value,correlationKey:r})}function tt(e){if(!i(e))return o("complete body must be a JSON object");let t=R(e,["eventType","correlationKey","outcome","eventId"]);if(t!==void 0)return o(`complete wait does not accept the "${t}" field`);let n=e.outcome;if(n!=="received"&&n!=="timed_out")return o('outcome must be "received" or "timed_out"');let r=F(e.eventType);if(!r.ok)return o(r.reason);let s=e.correlationKey;if(typeof s!="string"||s.length===0)return o("correlationKey must be a non-empty string");let u={eventType:r.value,correlationKey:s,outcome:n};if(e.eventId!==void 0){if(typeof e.eventId!="string"||e.eventId.length===0)return o("eventId must be a non-empty string");u.eventId=e.eventId}return a(u)}function nt(e){return!i(e)||e.registered!==!0?o("register wait data surface shape is invalid"):a({registered:!0})}function F(e){return typeof e!="string"||e.length===0?o("eventType must be a non-empty string"):ee.test(e)?a(e):o("eventType must match ^[A-Za-z0-9_-]{1,100}$")}function R(e,t){return Object.keys(e).find(n=>!t.includes(n))}var te="/internal/flow-versions",ot="/:flowVersionId/handler-bundles",B="/internal/installations",it="/:installationId/handler-bundles";function st(e,t){return`${te}/${encodeURIComponent(e)}/handler-bundles?compiledArtifactId=${encodeURIComponent(t)}`}function ut(e){return`${B}/${encodeURIComponent(e.installationId)}/handler-bundles?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var ne=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function w(e){if(!y(e))return D("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!ne.has(t)?D("runtimeNetwork.networkModel is unknown"):!G(e.apiHosts)||!G(e.authHosts)||typeof e.httpsOnly!="boolean"?D("runtimeNetwork host/https fields are invalid"):{ok:!0,value:{networkModel:t,apiHosts:e.apiHosts,authHosts:e.authHosts,httpsOnly:e.httpsOnly}}}function at(e){if(!y(e)||typeof e.flowVersionId!="string"||typeof e.compiledArtifactId!="string"||!Array.isArray(e.bundles))return _("handler bundles data surface shape is invalid");let t=L(e.bundles);return t.ok?{ok:!0,value:{flowVersionId:e.flowVersionId,compiledArtifactId:e.compiledArtifactId,bundles:t.value}}:t}function dt(e){if(!y(e)||typeof e.installationId!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.bundles))return _("tool handler bundles data surface shape is invalid");let t=L(e.bundles);return t.ok?{ok:!0,value:{installationId:e.installationId,artifactDigest:e.artifactDigest,bundles:t.value}}:t}function L(e){let t=[];for(let n of e){let r=re(n);if(!r.ok)return r;t.push(r.value)}return{ok:!0,value:t}}function re(e){if(!y(e)||typeof e.toolRef!="string"||e.kind!=="handler"&&e.kind!=="request")return _("handler bundle entry shape is invalid");if(e.kind==="request"){if(e.module!==void 0)return _("a request bundle must not carry a module");let r=w(e.runtimeNetwork);return r.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"request",runtimeNetwork:r.value}}:r}let t=e.module;if(!y(t)||typeof t.entry!="string"||t.entry.length===0||!oe(t.files))return _("a handler bundle must carry a { entry, files } module");let n=w(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){return{ok:!1,kind:"shape",reason:e}}function D(e){return{ok:!1,kind:"runtime_network",reason:e}}function y(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function G(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function oe(e){return y(e)&&Object.values(e).every(t=>typeof t=="string")}var E="/internal/webhook-trigger-instances",ft="/:triggerInstanceId/context",mt="/:triggerInstanceId/handler-bundles",Rt="/:triggerInstanceId/deliveries/:deliveryId",yt="/:triggerInstanceId/events",It="/:triggerInstanceId/rearm",kt="/:triggerInstanceId/store/:namespace/:key",I=e=>`${E}/${encodeURIComponent(e)}`;function _t(e,t){return`${I(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function Et(e,t){return`${I(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Tt(e,t){return`${I(e)}/deliveries/${encodeURIComponent(t)}`}function xt(e){return`${I(e)}/events`}function ht(e){return`${I(e)}/rearm`}function wt(e,t,n){return`${I(e)}/store/${encodeURIComponent(t)}/${encodeURIComponent(n)}`}var Pt="/:installationId/webhook-protocol-adapter-bundle";function Nt(e){return`${B}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var At="modules/webhook/protocol-adapter.js";function bt(e){return`modules/webhook/protocol-adapter-${e}.js`}function St(e){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)||!se(e.runtime)?o("webhook watcher 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 se(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 vt(e){if(!i(e)||typeof e.deliveryId!="string"||typeof e.receivedAt!="string"||!i(e.request))return o("webhook delivery surface shape is invalid");let t=e.request;return t.method!=="POST"||!i(t.headers)||typeof t.rawBody!="string"?o("webhook delivery request shape is invalid"):a(e)}function Ot(e){if(!i(e)||typeof e.triggerRef!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.modules)||!e.modules.every(ue))return{ok:!1,kind:"shape",reason:"trigger handler bundles data surface shape is invalid"};let t=w(e.runtimeNetwork);return t.ok?{ok:!0,value:{triggerRef:e.triggerRef,artifactDigest:e.artifactDigest,modules:e.modules,runtimeNetwork:t.value}}:t}function ue(e){return i(e)&&typeof e.specifier=="string"&&e.specifier.length>0&&typeof e.source=="string"}function ae(e){return!i(e)||!("value"in e)?o("webhook store get surface shape is invalid"):a(e.value)}function Ct(e){if(!i(e))return o("publish events body must be a JSON object");let t=P(e,["deliveryId","events"]);if(t!==void 0)return o(`publish events does not accept the "${t}" field`);let n=e.deliveryId;if(typeof n!="string"||n.length===0)return o("deliveryId must be a non-empty string");let r=e.events;if(!Array.isArray(r))return o("events must be an array");let s=[];for(let u of r){let d=de(u);if(!d.ok)return d;s.push(d.value)}return a({deliveryId:n,events:s})}function de(e){if(!i(e))return o("each event must be a JSON object");let t=P(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return o(`event does not accept the "${t}" field`);let n=e.eventId;if(typeof n!="string"||n.length===0)return o("eventId must be a non-empty string");let r=e.occurredAt;if(typeof r!="string"||r.length===0)return o("occurredAt must be a non-empty string");if(!i(e.payload))return o("event payload must be a JSON object");let s={eventId:n,occurredAt:r,payload:e.payload};if(e.dedupeKey!==void 0){if(typeof e.dedupeKey!="string"||e.dedupeKey.length===0)return o("dedupeKey must be a non-empty string");s.dedupeKey=e.dedupeKey}return a(s)}function Dt(e){if(!i(e))return o("rearm body must be a JSON object");let t=P(e,["expectedWatcherInstanceId"]);if(t!==void 0)return o(`rearm does not accept the "${t}" field`);let n=e.expectedWatcherInstanceId;return typeof n!="string"||n.length===0?o("expectedWatcherInstanceId must be a non-empty string"):a({expectedWatcherInstanceId:n})}function le(e){if(!i(e))return o("store body must be a JSON object");let t=P(e,["value"]);return t!==void 0?o(`store put does not accept the "${t}" field`):"value"in e?a({value:e.value}):o("store put requires a value field")}function P(e,t){return Object.keys(e).find(n=>!t.includes(n))}var T="/internal/polling-trigger-instances",Ut="/:pollingInstanceId/context",Ft="/:pollingInstanceId/handler-bundles",Gt="/:pollingInstanceId/ticks/:tickId/events",Lt="/:pollingInstanceId/store/:namespace/:key",N=e=>`${T}/${encodeURIComponent(e)}`;function Mt(e,t,n){return`${N(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function $t(e,t){return`${N(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Kt(e,t){return`${N(e)}/ticks/${encodeURIComponent(t)}/events`}function Wt(e,t,n){return`${N(e)}/store/${encodeURIComponent(t)}/${encodeURIComponent(n)}`}function Vt(e){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&&!pe(e.connection)||!ce(e.runtime)||!ge(e.tick)||!fe(e.limits)?o("polling trigger context surface shape is invalid"):a(e)}function pe(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function ce(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 r=t.dedup;return i(r)&&(r.strategy==="cursor"||r.strategy==="hash"||r.strategy==="id_field")}function ge(e){return i(e)&&typeof e.tickId=="string"&&typeof e.scheduledAt=="string"&&typeof e.attempt=="number"}function fe(e){return i(e)&&typeof e.maxEventsPerTick=="number"}function qt(e){if(!i(e))return o("publish body must be a JSON object");let t=M(e,["events","nextCursor"]);if(t!==void 0)return o(`publish does not accept the "${t}" field`);let n=e.events;if(!Array.isArray(n))return o("events must be an array");let r=[];for(let u of n){let d=me(u);if(!d.ok)return d;r.push(d.value)}let s={events:r};if("nextCursor"in e){let u=e.nextCursor;if(u!==null&&typeof u!="string")return o("nextCursor must be a string, null, or omitted");s.nextCursor=u}return a(s)}function me(e){if(!i(e))return o("each event must be a JSON object");let t=M(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return o(`event does not accept the "${t}" field`);if(typeof e.eventId!="string"||e.eventId.length===0)return o("event eventId must be a non-empty string");if(!i(e.payload))return o("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 o("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 o("event dedupeKey must be a non-empty string");n.dedupeKey=e.dedupeKey}return a(n)}function jt(e){return!i(e)||typeof e.tickId!="string"||typeof e.cursorUpdated!="boolean"||!Array.isArray(e.results)||!e.results.every(Re)?o("publish polling tick events data surface shape is invalid"):a(e)}function Re(e){return i(e)&&typeof e.eventId=="string"&&typeof e.dedupeKey=="string"&&typeof e.duplicate=="boolean"&&(e.flowRunId===null||typeof e.flowRunId=="string")}function M(e,t){return Object.keys(e).find(n=>!t.includes(n))}var $="/internal/egress-grants",H="/internal/tool-invocations",en="/:flowRunId/egress-grant",tn="/:invocationId/egress-grant",nn="/:pollingInstanceId/egress-grant",rn="/:triggerInstanceId/egress-grant",on="/:grantId/consume",sn="/:grantId/audit",un=e=>`${f}/${encodeURIComponent(e)}/egress-grant`,an=e=>`${H}/${encodeURIComponent(e)}/egress-grant`,dn=e=>`${T}/${encodeURIComponent(e)}/egress-grant`,ln=e=>`${E}/${encodeURIComponent(e)}/egress-grant`,pn=e=>`${$}/${encodeURIComponent(e)}/consume`,cn=e=>`${$}/${encodeURIComponent(e)}/audit`,ye=["flow_action","single_tool","polling_trigger","webhook_trigger"],Ie=/^[A-Za-z0-9][A-Za-z0-9:_+/=.-]{15,1023}$/;function x(e){return typeof e=="string"&&Ie.test(e)}function ke(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(r=>i(r)?r.kind==="file"&&typeof r.file_id=="string"&&r.file_id.length>0:!1):!1}function l(e){return{ok:!1,kind:"shape",reason:e}}function h(){return{ok:!1,kind:"request_digest",reason:"request digest is missing or malformed"}}function b(e,t){if(!i(e))return{ok:!1,reason:"grant request body must be a JSON object"};for(let n of Object.keys(e))if(!t.includes(n))return{ok:!1,reason:`grant request does not accept the "${n}" field`};return{ok:!0,record:e}}function S(e){if(!i(e))return"request must be a JSON object"}function gn(e){let t=b(e,["nodeId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.nodeId;if(typeof n!="string"||n.length===0)return l("nodeId is required");let r=S(t.record.request);if(r!==void 0)return l(r);let s=t.record.requestDigest;return x(s)?{ok:!0,value:{nodeId:n,requestDigest:s,requestHasMultipartFiles:ke(t.record.request)}}:h()}function fn(e){let t=b(e,["request","requestDigest"]);if(!t.ok)return l(t.reason);let n=S(t.record.request);if(n!==void 0)return l(n);let r=t.record.requestDigest;return x(r)?{ok:!0,value:{requestDigest:r}}:h()}function mn(e){let t=b(e,["tickId","request","requestDigest"]);if(!t.ok)return l(t.reason);let n=t.record.tickId;if(typeof n!="string"||n.length===0)return l("tickId is required");let r=S(t.record.request);if(r!==void 0)return l(r);let s=t.record.requestDigest;return x(s)?{ok:!0,value:{tickId:n,requestDigest:s}}:h()}function Rn(e){let t=b(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 r=t.record.lifecycle,s;if(r!==void 0){if(r!=="enable"&&r!=="disable"&&r!=="renew")return l('lifecycle must be "enable", "disable", or "renew"');s=r}if(n==="lifecycle"&&s===void 0)return l("lifecycle is required for the lifecycle phase");let u=S(t.record.request);if(u!==void 0)return l(u);let d=t.record.requestDigest;return x(d)?{ok:!0,value:{phase:n,...s!==void 0?{lifecycle:s}:{},requestDigest:d}}:h()}function K(e){return ye.includes(e)?e:void 0}var _e=["scopeKind","scopeId","requestDigest"];function yn(e){if(!i(e))return l("consume body must be a JSON object");for(let s of Object.keys(e))if(!_e.includes(s))return l(`consume does not accept the "${s}" field`);let t=K(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 r=e.requestDigest;return x(r)?{ok:!0,value:{scopeKind:t,scopeId:n,requestDigest:r}}:h()}var Ee=["scopeKind","scopeId","providerHost","status","durationMs","requestBytes","responseBytes","errorCode"];function A(e,t){return typeof e!="number"||!Number.isInteger(e)||e<0?{ok:!1,reason:`${t} must be a non-negative integer`}:{ok:!0,value:e}}function In(e){if(!i(e))return l("audit body must be a JSON object");for(let c of Object.keys(e))if(!Ee.includes(c))return l(`audit does not accept the "${c}" field`);let t=K(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 r=e.providerHost;if(typeof r!="string"||r.length===0)return l("providerHost is required");let s=A(e.durationMs,"durationMs");if(!s.ok)return l(s.reason);let u;if(e.status!==void 0){let c=A(e.status,"status");if(!c.ok)return l(c.reason);u=c.value}let d;if(e.requestBytes!==void 0){let c=A(e.requestBytes,"requestBytes");if(!c.ok)return l(c.reason);d=c.value}let p;if(e.responseBytes!==void 0){let c=A(e.responseBytes,"responseBytes");if(!c.ok)return l(c.reason);p=c.value}let O;if(e.errorCode!==void 0){let c=e.errorCode;if(typeof c!="string"||c.length===0)return l("errorCode must be a non-empty string");O=c}return{ok:!0,value:{scopeKind:t,scopeId:n,providerHost:r,...u!==void 0?{status:u}:{},durationMs:s.value,...d!==void 0?{requestBytes:d}:{},...p!==void 0?{responseBytes:p}:{},...O!==void 0?{errorCode:O}:{}}}}function kn(e){return!i(e)||!i(e.grant)?o("egress grant envelope must carry a grant object"):a(e.grant)}function _n(e){return!i(e)||e.consumed!==!0?o("egress grant consume data must carry consumed:true"):a({consumed:!0})}var Nn="/:flowRunId/runtime-credential",An="/:invocationId/runtime-credential",bn="/:pollingInstanceId/runtime-credential",Sn="/:triggerInstanceId/runtime-credential",vn=e=>`${f}/${encodeURIComponent(e)}/runtime-credential`,On=e=>`${H}/${encodeURIComponent(e)}/runtime-credential`,Cn=e=>`${T}/${encodeURIComponent(e)}/runtime-credential`,Dn=e=>`${E}/${encodeURIComponent(e)}/runtime-credential`,Bn=["flow_action","tool_invoke","polling_trigger","webhook_trigger"];function v(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 Hn(e){let t=v(e,["nodeId"]);if(!t.ok)return o(t.reason);let n=t.record.nodeId;return typeof n!="string"||n.length===0?o("nodeId is required"):a({nodeId:n})}function Un(e){let t=v(e??{},[]);return t.ok?a(null):o(t.reason)}function Fn(e){let t=v(e,["tickId"]);if(!t.ok)return o(t.reason);let n=t.record.tickId;return typeof n!="string"||n.length===0?o("tickId is required"):a({tickId:n})}function Gn(e){let t=v(e,["executionKind","deliveryId","lifecycleOperation"]);if(!t.ok)return o(t.reason);let n=t.record.executionKind;if(n!=="event_handler"&&n!=="lifecycle")return o('executionKind must be "event_handler" or "lifecycle"');let r,s=t.record.deliveryId;if(s!==void 0){if(typeof s!="string"||s.length===0)return o("deliveryId must be a non-empty string");r=s}let u,d=t.record.lifecycleOperation;if(d!==void 0){if(d!=="enable"&&d!=="disable"&&d!=="renew")return o('lifecycleOperation must be "enable", "disable", or "renew"');u=d}return n==="lifecycle"&&u===void 0?o("lifecycleOperation is required for the lifecycle execution kind"):a({executionKind:n,...r!==void 0?{deliveryId:r}:{},...u!==void 0?{lifecycleOperation:u}:{}})}function Ln(e){return!i(e)||typeof e.sessionId!="string"||typeof e.connectionId!="string"||!i(e.credential)?o("runtime credential session must carry sessionId, connectionId and a credential object"):a(e.credential)}var U="/internal/files",Kn="/:fileId/stat",Wn="/:fileId/content",Vn=()=>U,W=e=>`?scope_kind=${encodeURIComponent(e.scopeKind)}&scope_id=${encodeURIComponent(e.scopeId)}`,qn=(e,t)=>`${U}/${encodeURIComponent(e)}/stat${W(t)}`,jn=(e,t)=>`${U}/${encodeURIComponent(e)}/content${W(t)}`;function Jn(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"?o("file ref data does not match the AIS file-ref shape"):a(e)}var Qn="/:flowRunId/human-inputs",Zn="/:flowRunId/human-inputs/:requestId",er="/:flowRunId/human-inputs/:requestId/expire",tr="/:flowRunId/human-inputs/:requestId/acknowledge",Te=e=>`${f}/${encodeURIComponent(e)}/human-inputs`,V=(e,t)=>`${Te(e)}/${encodeURIComponent(t)}`,nr=(e,t)=>`${V(e,t)}/expire`,rr=(e,t)=>`${V(e,t)}/acknowledge`,xe="human_input_resolved";function or(e){return`${xe}_${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 k(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 we(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 Pe(e){let t=m(e,"renderedPrompt");if(!t.ok)return t;let n=k(t.value.title,"renderedPrompt.title");if(!n.ok)return n;let r={title:n.value};if(t.value.body!==void 0){if(typeof t.value.body!="string")return g("renderedPrompt.body must be a string");r.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");r.format=t.value.format}return{ok:!0,value:r}}function Ne(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 Ae(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 r=[];for(let s of n){let u=m(s,"delivery action");if(!u.ok)return u;let d=k(u.value.id,"delivery action id");if(!d.ok)return d;let p=q(u.value.inputs,`delivery action '${d.value}' inputs`);if(!p.ok)return p;r.push({id:d.value,inputs:p.value})}return{ok:!0,value:{actions:r}}}function q(e,t){let n=m(e,t);if(!n.ok)return n;let r={};for(let[s,u]of Object.entries(n.value)){let d=j(u,`${t}.${s}`);if(!d.ok)return d;r[s]=d.value}return{ok:!0,value:r}}function j(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=k(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 p=j(d,`${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,d]of n.value.parts.entries()){let p=be(d,`${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 be(e,t){let n=m(e,t);if(!n.ok)return n;let r=n.value.kind;if(r==="literal")return typeof n.value.value!="string"?g(`${t}.value must be a string`):{ok:!0,value:{kind:"literal",value:n.value.value}};if(r==="human_input_ref"){let s=k(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 ir(e){let t=m(e,"request body");if(!t.ok)return o(t.reason);let n=k(t.value.nodeId,"nodeId");if(!n.ok)return o(n.reason);let r=Pe(t.value.renderedPrompt);if(!r.ok)return o(r.reason);let s=Ne(t.value.input);if(!s.ok)return o(s.reason);let u=k(t.value.timeout,"timeout");if(!u.ok)return o(u.reason);let d=we(t.value.expiresAt,"expiresAt");if(!d.ok)return o(d.reason);let p=Ae(t.value.partiallyRenderedDelivery);return p.ok?a({nodeId:n.value,renderedPrompt:r.value,input:s.value,timeout:u.value,expiresAt:d.value,...p.value!==void 0?{partiallyRenderedDelivery:p.value}:{}}):o(p.reason)}function Se(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))?o("human input request view must carry id, nodeId, status and output"):a(e)}function sr(e){if(!i(e)||typeof e.created!="boolean")return o("human input create data must carry created:boolean");let t=Se(e.request);return t.ok?a({created:e.created,request:t.value}):t}function ur(e){return!i(e)||e.acknowledged!==!0?o("human input acknowledge data must carry acknowledged:true"):a({acknowledged:!0})}var dr="ablehi-wfp-user-runtime-manifest/v1",lr="unknown";function pr(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var gr="/internal/deployment-handshake",ve=["start","terminate","send-event","start-webhook-watcher","run-polling-tick","invoke-tool","invoke-trigger-handler","invoke-webhook-protocol-adapter","deployment-handshake"],fr=ve,mr="HANDSHAKE_REQUEST_INVALID",Rr="HANDSHAKE_SECRET_UNCONFIGURED",yr="HANDSHAKE_SECRET_MISMATCH",Ir="HANDSHAKE_CONTRACT_VERSION_MISMATCH",kr="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",_r="HANDSHAKE_CAPABILITY_MISSING";function Er(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function Tr(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}export{ve as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,fr as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,gr as DEPLOYMENT_HANDSHAKE_ROUTE,sn as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,on as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,ye as EGRESS_GRANT_SCOPE_KINDS,qe as EVENT_WAIT_ROUTE_SUBPATH,Fe as EXECUTION_CONTEXT_ROUTE_SUBPATH,Wn as FILE_CONTENT_ROUTE_SUBPATH,Kn as FILE_STAT_ROUTE_SUBPATH,X as FLOW_INTERPRETER_CONTRACT_VERSION,Ce as FLOW_IR_SCHEMA_VERSION,en as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,Ve as FLOW_RUN_RESULT_ROUTE_SUBPATH,Nn as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,ot as HANDLER_BUNDLES_ROUTE_SUBPATH,_r as HANDSHAKE_CAPABILITY_MISSING,Ir as HANDSHAKE_CONTRACT_VERSION_MISMATCH,kr as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,mr as HANDSHAKE_REQUEST_INVALID,yr as HANDSHAKE_SECRET_MISMATCH,Rr as HANDSHAKE_SECRET_UNCONFIGURED,Qn as HUMAN_INPUTS_ROUTE_SUBPATH,tr as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,er as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,Zn as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,xe as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,$ as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX,U as INTERNAL_FILES_ROUTE_PREFIX,f as INTERNAL_FLOW_RUNS_ROUTE_PREFIX,te as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX,B as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,T as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,H as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,E as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,Ut as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,nn as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,Ft as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,bn as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Lt as POLLING_TRIGGER_STORE_ROUTE_SUBPATH,Gt as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,Bn as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,J as SERVER_CONTRACT_VERSION,We as STEP_RESULT_ROUTE_SUBPATH,it as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,tn as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,An as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Pt as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,At as WEBHOOK_PROTOCOL_ADAPTER_MODULE,ft as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,Rt as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,rn as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,yt as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,mt as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,It as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,Sn as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,kt as WEBHOOK_TRIGGER_STORE_ROUTE_SUBPATH,dr as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,lr as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,o as contractParseFail,a as contractParseOk,Er as deploymentHandshakeProbePayload,Tr as deploymentHandshakeResponseProofPayload,cn as egressGrantAuditPath,pn as egressGrantConsumePath,Xe as eventWaitPath,Ge as executionContextPath,un as flowRunEgressGrantPath,Je as flowRunResultPath,vn as flowRunRuntimeCredentialPath,bt as flowScriptProtocolAdapterModuleName,st as handlerBundlesPath,rr as humanInputAcknowledgePath,nr as humanInputExpirePath,V as humanInputRequestPath,or as humanInputResolvedEventType,Te as humanInputsPath,jn as internalFileContentPath,qn as internalFileStatPath,Vn as internalFilesPath,i as isJsonRecord,x as isValidRequestDigest,tt as parseCompleteFlowRunWaitBody,ir as parseCreateHumanInputBody,In as parseEgressGrantAuditBody,yn as parseEgressGrantConsumeBody,_n as parseEgressGrantConsumeData,kn as parseEgressGrantData,Le as parseExecutionContextData,Jn as parseFileRefData,Y as parseFileRuntimeLimits,gn as parseFlowActionGrantBody,Qe as parseFlowRunResultBody,Ze as parseFlowRunResultData,Hn as parseFlowRuntimeCredentialBody,re as parseHandlerBundle,at as parseHandlerBundlesData,ur as parseHumanInputAcknowledgeData,sr as parseHumanInputCreateData,Se as parseHumanInputRequestViewData,qt as parsePollingPublishBody,Fn as parsePollingRuntimeCredentialBody,le as parsePollingStorePutBody,ae as parsePollingStoreValue,Vt as parsePollingTriggerContext,mn as parsePollingTriggerGrantBody,jt as parsePublishPollingTickEventsData,et as parseRegisterFlowRunWaitBody,nt as parseRegisterFlowRunWaitData,Ln as parseRuntimeCredentialSessionCredential,w as parseRuntimeNetwork,fn as parseSingleToolGrantBody,Un as parseSingleToolRuntimeCredentialBody,Ye as parseStepRecordBody,ze as parseStepRecordData,dt as parseToolHandlerBundlesData,Ot as parseTriggerHandlerBundlesData,vt as parseWebhookDelivery,Ct as parseWebhookPublishEventsBody,Dt as parseWebhookRearmBody,Gn as parseWebhookRuntimeCredentialBody,le as parseWebhookStorePutBody,ae as parseWebhookStoreValue,Rn as parseWebhookTriggerGrantBody,St as parseWebhookWatcherContext,Mt as pollingTriggerContextPath,dn as pollingTriggerEgressGrantPath,$t as pollingTriggerHandlerBundlesPath,Cn as pollingTriggerRuntimeCredentialPath,Wt as pollingTriggerStorePath,Kt as pollingTriggerTickEventsPath,ke as requestHasMultipartFileParts,je as stepResultPath,ut as toolHandlerBundlesPath,an as toolInvocationEgressGrantPath,On as toolInvocationRuntimeCredentialPath,Nt as webhookProtocolAdapterBundlePath,_t as webhookTriggerContextPath,Tt as webhookTriggerDeliveryPath,ln as webhookTriggerEgressGrantPath,xt as webhookTriggerEventsPath,Et as webhookTriggerHandlerBundlesPath,ht as webhookTriggerRearmPath,Dn as webhookTriggerRuntimeCredentialPath,wt as webhookTriggerStorePath,pr as wfpUserRuntimeManifestPath};
|
|
1
|
+
var ee="0.2.4";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 { JsonValue, FlowNode, FlowIrValidationResult, JsonObject, FlowCompositionSpec, Mapping, TriggerBinding } from './edge.js';
|
|
2
|
-
export { AblehiEnvelope, AblehiFailure, AblehiSuccess, ActionNode, BooleanExpression, Collection, CompleteFlowRunWaitBody, CompleteFlowRunWaitData, ContractParseResult, CreateHumanInputRequestBody, DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES, DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES, DEPLOYMENT_HANDSHAKE_ROUTE, DeploymentHandshakeData, DeploymentHandshakeRequestBody, DeploymentHandshakeResponse, EGRESS_GRANT_AUDIT_ROUTE_SUBPATH, EGRESS_GRANT_CONSUME_ROUTE_SUBPATH, EGRESS_GRANT_SCOPE_KINDS, EVENT_WAIT_ROUTE_SUBPATH, EXECUTION_CONTEXT_ROUTE_SUBPATH, EgressGrant, EgressGrantAuditBody, EgressGrantBodyParseResult, EgressGrantConsumeBody, EgressGrantFileRuntime, EgressGrantScopeKind, ExecutionBinding, ExecutionBindingConnection, ExecutionContextCompiled, ExecutionContextData, FILE_CONTENT_ROUTE_SUBPATH, FILE_STAT_ROUTE_SUBPATH, FLOW_INTERPRETER_CONTRACT_VERSION, FLOW_IR_SCHEMA_VERSION, FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH, FLOW_RUN_RESULT_ROUTE_SUBPATH, FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, FileRefData, FileRuntimeLimits, FileRuntimeScope, FileRuntimeScopeKind, FlowActionGrantBody, FlowDefinition, FlowExecutionContextFileRuntime, FlowInterpreterContractVersion, FlowIrValidationCode, FlowIrValidationIssue, FlowRunResultData, FlowRunResultRequestBody, FlowRuntimeCredentialBody, HANDLER_BUNDLES_ROUTE_SUBPATH, HANDSHAKE_CAPABILITY_MISSING, HANDSHAKE_CONTRACT_VERSION_MISMATCH, HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH, HANDSHAKE_REQUEST_INVALID, HANDSHAKE_SECRET_MISMATCH, HANDSHAKE_SECRET_UNCONFIGURED, HUMAN_INPUTS_ROUTE_SUBPATH, HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH, HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH, HUMAN_INPUT_REQUEST_ROUTE_SUBPATH, HUMAN_INPUT_RESOLVED_EVENT_PREFIX, HandlerBundle, HandlerBundleModule, HandlerBundlesData, HandlerBundlesParseResult, HumanChoiceInput, HumanFormField, HumanFormInput, HumanInputActor, HumanInputChoice, HumanInputDelivery, HumanInputDeliveryAction, HumanInputNode, HumanInputOutput, HumanInputPrompt, HumanInputRequestView, HumanInputResolvedEvent, HumanInputResponse, HumanInputSpec, HumanTextInput, INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX, INTERNAL_FILES_ROUTE_PREFIX, INTERNAL_FLOW_RUNS_ROUTE_PREFIX, INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX, INTERNAL_INSTALLATIONS_ROUTE_PREFIX, INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX, INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX, INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX, IntegrationTriggerBinding, JsonArray, ManualTriggerBinding, NodeCommon, Operand, POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH, POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,
|
|
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-COdVAE2s.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 FileRefData, a1 as FileRuntimeLimits, a2 as FileRuntimeScope, a3 as FileRuntimeScopeKind, a4 as FileUploadSessionData, a5 as FlowActionGrantBody, a6 as FlowDefinition, a7 as FlowExecutionContextFileRuntime, a8 as FlowInterpreterContractVersion, a9 as FlowIrValidationCode, aa as FlowIrValidationIssue, ab as FlowRunResultData, ac as FlowRunResultRequestBody, ad as FlowRuntimeCredentialBody, ae as HANDLER_BUNDLES_ROUTE_SUBPATH, af as HANDSHAKE_CAPABILITY_MISSING, ag as HANDSHAKE_CONTRACT_VERSION_MISMATCH, ah as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH, ai as HANDSHAKE_REQUEST_INVALID, aj as HANDSHAKE_SECRET_MISMATCH, ak as HANDSHAKE_SECRET_UNCONFIGURED, al as HUMAN_INPUTS_ROUTE_SUBPATH, am as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH, an as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH, ao as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH, ap as HUMAN_INPUT_RESOLVED_EVENT_PREFIX, aq as HandlerBundle, ar as HandlerBundleModule, as as HandlerBundlesData, at as HandlerBundlesParseResult, au as HumanChoiceInput, av as HumanFormField, aw as HumanFormInput, ax as HumanInputActor, ay as HumanInputChoice, az as HumanInputDelivery, aA as HumanInputDeliveryAction, aB as HumanInputNode, aC as HumanInputOutput, aD as HumanInputPrompt, aE as HumanInputRequestView, aF as HumanInputResolvedEvent, aG as HumanInputResponse, aH as HumanInputSpec, aI as HumanTextInput, aJ as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX, aK as INTERNAL_FILES_ROUTE_PREFIX, aL as INTERNAL_FLOW_RUNS_ROUTE_PREFIX, aM as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX, aN as INTERNAL_INSTALLATIONS_ROUTE_PREFIX, aO as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX, aP as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX, aQ as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX, aR as IntegrationTriggerBinding, aS as InternalFileAccessData, aT as InternalFileAccessIntent, aU as JsonArray, aV as ManualTriggerBinding, aW as NodeCommon, aX as Operand, aY as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH, aZ as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, a_ as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, a$ as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, b0 as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH, b1 as PackagePollingTriggerRuntimeDescriptor, b2 as PackageWebhookTriggerRuntimeDescriptor, b3 as ParsedFlowRunResultBody, b4 as PartiallyRenderedHumanInputDelivery, b5 as PartiallyRenderedMapping, b6 as PartiallyRenderedTemplatePart, b7 as PartiallyRenderedValue, b8 as PollingPublishBody, b9 as PollingPublishEvent, ba as PollingRuntimeCredentialBody, bb as PollingTriggerContext, bc as PollingTriggerGrantBody, bd as PresignedFileUrlData, be as PublishPollingTickEventResult, bf as PublishPollingTickEventsData, bg as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS, bh as RegisterFlowRunWaitBody, bi as RegisterFlowRunWaitData, bj as RenderedFlowComposition, bk as RenderedHumanInputPrompt, bl as RuntimeCredentialSession, bm as RuntimeCredentialSessionNetwork, bn as RuntimeCredentialSessionScopeKind, bo as RuntimeNetwork, bp as RuntimeNetworkModel, bq as SERVER_CONTRACT_VERSION, br as STEP_RESULT_ROUTE_SUBPATH, bs as ScheduleTriggerBinding, bt as ServerContractVersion, bu as SingleToolGrantBody, bv as SleepNode, bw as StepRecordBody, bx as StepRecordBodyParseResult, by as StepRecordData, bz as StepRecordResult, bA as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH, bB as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH, bC as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, bD as TextExpression, bE as ToolHandlerBundlesData, bF as TriggerConnectionInfo, bG as TriggerHandlerBundlesData, bH as TriggerHandlerModule, bI as ValueExpression, bJ as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH, bK as WEBHOOK_PROTOCOL_ADAPTER_MODULE, bL as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH, bM as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH, bN as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH, bO as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH, bP as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH, bQ as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH, bR as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH, bS as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION, bT as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION, bU as WORKSPACE_FILES_ROUTE_PREFIX, bV as WaitEventNode, bW as WebhookDelivery, bX as WebhookProtocolAdapterBundleData, bY as WebhookProtocolAdapterModule, bZ as WebhookPublishEvent, b_ as WebhookPublishEventsBody, b$ as WebhookPublishEventsData, c0 as WebhookRearmBody, c1 as WebhookRearmData, c2 as WebhookRuntimeCredentialBody, c3 as WebhookTriggerGrantBody, c4 as WebhookTriggerVerificationMethod, c5 as WebhookWatcherContext, c6 as WfpUserRuntimeManifest, c7 as contractParseFail, c8 as contractParseOk, c9 as deploymentHandshakeProbePayload, ca as deploymentHandshakeResponseProofPayload, cb as egressGrantAuditPath, cc as egressGrantConsumePath, cd as eventWaitPath, ce as executionContextPath, cf as flowRunEgressGrantPath, cg as flowRunResultPath, ch as flowRunRuntimeCredentialPath, ci as flowScriptProtocolAdapterModuleName, cj as handlerBundlesPath, ck as humanInputAcknowledgePath, cl as humanInputExpirePath, cm as humanInputRequestPath, cn as humanInputResolvedEventType, co as humanInputsPath, cp as internalFileAccessPath, cq as internalFileCompletePath, cr as internalFileContentPath, cs as internalFileStatPath, ct as internalFileUploadSessionPath, cu as internalFilesPath, cv as isJsonRecord, cw as isValidRequestDigest, cx as parseCompleteFlowRunWaitBody, cy as parseContextStateCleanupRequestBody, cz as parseContextStateCleanupResponseData, cA as parseContextStateScope, cB as parseCreateHumanInputBody, cC as parseEgressGrantAuditBody, cD as parseEgressGrantConsumeBody, cE as parseEgressGrantConsumeData, cF as parseEgressGrantData, cG as parseExecutionContextData, cH as parseFileAccessData, cI as parseFileRefData, cJ as parseFileRuntimeLimits, cK as parseFileUploadSessionData, cL as parseFlowActionGrantBody, cM as parseFlowRunResultBody, cN as parseFlowRunResultData, cO as parseFlowRuntimeCredentialBody, cP as parseHandlerBundle, cQ as parseHandlerBundlesData, cR as parseHumanInputAcknowledgeData, cS as parseHumanInputCreateData, cT as parseHumanInputRequestViewData, cU as parseInternalFileAccessData, cV as parsePollingPublishBody, cW as parsePollingRuntimeCredentialBody, cX as parsePollingTriggerContext, cY as parsePollingTriggerGrantBody, cZ as parsePublishPollingTickEventsData, c_ as parseRegisterFlowRunWaitBody, c$ as parseRegisterFlowRunWaitData, d0 as parseRuntimeCredentialSessionCredential, d1 as parseRuntimeNetwork, d2 as parseSingleToolGrantBody, d3 as parseSingleToolRuntimeCredentialBody, d4 as parseStepRecordBody, d5 as parseStepRecordData, d6 as parseToolHandlerBundlesData, d7 as parseTriggerHandlerBundlesData, d8 as parseWebhookDelivery, d9 as parseWebhookPublishEventsBody, da as parseWebhookRearmBody, db as parseWebhookRuntimeCredentialBody, dc as parseWebhookTriggerGrantBody, dd as parseWebhookWatcherContext, de as pollingTriggerContextPath, df as pollingTriggerEgressGrantPath, dg as pollingTriggerHandlerBundlesPath, dh as pollingTriggerRuntimeCredentialPath, di as pollingTriggerTickEventsPath, dj as requestHasMultipartFileParts, dk as stepResultPath, dl as toolHandlerBundlesPath, dm as toolInvocationEgressGrantPath, dn as toolInvocationRuntimeCredentialPath, dp as webhookProtocolAdapterBundlePath, dq as webhookTriggerContextPath, dr as webhookTriggerDeliveryPath, ds as webhookTriggerEgressGrantPath, dt as webhookTriggerEventsPath, du as webhookTriggerHandlerBundlesPath, dv as webhookTriggerRearmPath, dw as webhookTriggerRuntimeCredentialPath, dx as wfpUserRuntimeManifestPath, dy as workspaceFileAccessPath, dz as workspaceFileCompletePath, dA as workspaceFileMetadataPath, dB as workspaceFileUploadSessionPath } from './edge-COdVAE2s.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 se="0.2.2";var at="flow.ir.v1";var ae="flow.interp.v2";function p(e){return{ok:!0,value:e}}function o(e){return{ok:!1,reason:e}}function i(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var f="/internal/flow-runs",ct="/:flowRunId/execution-context";function gt(e){return`${f}/${encodeURIComponent(e)}/execution-context`}function pe(e){return!i(e)||!B(e.fileMaxBytes)||!B(e.fileReadMaxBytes)||!B(e.inlineMultipartBytesMax)?o("file runtime limits must carry three positive integer bounds"):p({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function ft(e){if(!i(e))return o("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)||!le(e.executionBindings))return o("execution context surface shape is invalid");let n=ue(e.fileRuntime);return n.ok?p({...e,fileRuntime:n.value}):o(n.reason)}function ue(e){if(e===null)return p(null);if(!i(e))return o("fileRuntime must be null or an object");let t=pe(e.limits);return t.ok?p({limits:t.value}):o(t.reason)}function le(e){return Array.isArray(e)?e.every(t=>{if(!i(t))return!1;let n=t.connection;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"}):!1}function B(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}var yt="/:flowRunId/steps/:nodeId/result",It="/:flowRunId/result",Tt="/:flowRunId/event-waits/:nodeId";function xt(e,t){return`${f}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function Et(e){return`${f}/${encodeURIComponent(e)}/result`}function At(e,t){return`${f}/${encodeURIComponent(e)}/event-waits/${encodeURIComponent(t)}`}function wt(e){if(!i(e))return{ok:!1,kind:"validation",reason:"step record body must be a JSON object"};let t=_(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 r=de(e.result);if(!r.ok)return r;let s={attempt:n,result:r.value};if(e.durationMs!==void 0){let a=e.durationMs;if(typeof a!="number"||!Number.isFinite(a)||a<0)return{ok:!1,kind:"validation",reason:"durationMs must be a non-negative number"};s.durationMs=a}return{ok:!0,value:s}}function de(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=_(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=_(e,["status","errorCode","issues"]);if(n!==void 0)return{ok:!1,kind:"validation",reason:`step record result does not accept the "${n}" field`};let r=e.errorCode;if(typeof r!="string"||r.length===0)return{ok:!1,kind:"step_result_invalid",reason:"a failed result must carry a non-empty errorCode"};let s={status:"failed",errorCode:r};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 kt(e){return!i(e)||typeof e.flowRunId!="string"||typeof e.nodeId!="string"||e.recorded!=="succeeded"&&e.recorded!=="failed"?o("step record data surface shape is invalid"):p({flowRunId:e.flowRunId,nodeId:e.nodeId,recorded:e.recorded})}function St(e){if(!i(e))return o("result body must be a JSON object");let t=_(e,["status","output","error","composition"]);if(t!==void 0)return o(`result does not accept the "${t}" field`);let n=e.status;if(n!=="succeeded"&&n!=="failed")return o('result status must be "succeeded" or "failed"');let r={status:n};if(e.output!==void 0&&(r.output=e.output),e.error!==void 0){let s=e.error;if(!i(s))return o("result error must be a JSON object");let a=_(s,["code","message"]);if(a!==void 0)return o(`result error does not accept the "${a}" field`);if(typeof s.code!="string"||typeof s.message!="string")return o("result error must carry string code and message");r.error={code:s.code,message:s.message}}if(e.composition!==void 0){if(n!=="succeeded")return o("composition is only allowed on a succeeded result");r.composition=e.composition}return p(r)}function ht(e){return i(e)?p(e):o("flow run result data must be a JSON object")}var ce=/^[A-Za-z0-9_-]{1,100}$/;function Ot(e){if(!i(e))return o("register body must be a JSON object");let t=_(e,["eventType","correlationKey"]);if(t!==void 0)return o(`register wait does not accept the "${t}" field`);let n=q(e.eventType);if(!n.ok)return o(n.reason);let r=e.correlationKey;return typeof r!="string"||r.length===0?o("correlationKey must be a non-empty string"):p({eventType:n.value,correlationKey:r})}function Pt(e){if(!i(e))return o("complete body must be a JSON object");let t=_(e,["eventType","correlationKey","outcome","eventId"]);if(t!==void 0)return o(`complete wait does not accept the "${t}" field`);let n=e.outcome;if(n!=="received"&&n!=="timed_out")return o('outcome must be "received" or "timed_out"');let r=q(e.eventType);if(!r.ok)return o(r.reason);let s=e.correlationKey;if(typeof s!="string"||s.length===0)return o("correlationKey must be a non-empty string");let a={eventType:r.value,correlationKey:s,outcome:n};if(e.eventId!==void 0){if(typeof e.eventId!="string"||e.eventId.length===0)return o("eventId must be a non-empty string");a.eventId=e.eventId}return p(a)}function Nt(e){return!i(e)||e.registered!==!0?o("register wait data surface shape is invalid"):p({registered:!0})}function q(e){return typeof e!="string"||e.length===0?o("eventType must be a non-empty string"):ce.test(e)?p(e):o("eventType must match ^[A-Za-z0-9_-]{1,100}$")}function _(e,t){return Object.keys(e).find(n=>!t.includes(n))}var ge="/internal/flow-versions",Dt="/:flowVersionId/handler-bundles",H="/internal/installations",Ct="/:installationId/handler-bundles";function vt(e,t){return`${ge}/${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 fe=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function O(e){if(!R(e))return G("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!fe.has(t)?G("runtimeNetwork.networkModel is unknown"):!j(e.apiHosts)||!j(e.authHosts)||typeof e.httpsOnly!="boolean"?G("runtimeNetwork host/https fields are invalid"):{ok:!0,value:{networkModel:t,apiHosts:e.apiHosts,authHosts:e.authHosts,httpsOnly:e.httpsOnly}}}function Ut(e){if(!R(e)||typeof e.flowVersionId!="string"||typeof e.compiledArtifactId!="string"||!Array.isArray(e.bundles))return A("handler bundles data surface shape is invalid");let t=J(e.bundles);return t.ok?{ok:!0,value:{flowVersionId:e.flowVersionId,compiledArtifactId:e.compiledArtifactId,bundles:t.value}}:t}function Lt(e){if(!R(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=J(e.bundles);return t.ok?{ok:!0,value:{installationId:e.installationId,artifactDigest:e.artifactDigest,bundles:t.value}}:t}function J(e){let t=[];for(let n of e){let r=me(n);if(!r.ok)return r;t.push(r.value)}return{ok:!0,value:t}}function me(e){if(!R(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 r=O(e.runtimeNetwork);return r.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"request",runtimeNetwork:r.value}}:r}let t=e.module;if(!R(t)||typeof t.entry!="string"||t.entry.length===0||!_e(t.files))return A("a handler bundle must carry a { entry, files } module");let n=O(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 G(e){return{ok:!1,kind:"runtime_network",reason:e}}function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function j(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function _e(e){return R(e)&&Object.values(e).every(t=>typeof t=="string")}var w="/internal/webhook-trigger-instances",$t="/:triggerInstanceId/context",Kt="/:triggerInstanceId/handler-bundles",Wt="/:triggerInstanceId/deliveries/:deliveryId",Vt="/:triggerInstanceId/events",qt="/:triggerInstanceId/rearm",jt="/:triggerInstanceId/store/:namespace/:key",y=e=>`${w}/${encodeURIComponent(e)}`;function Jt(e,t){return`${y(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function Xt(e,t){return`${y(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Yt(e,t){return`${y(e)}/deliveries/${encodeURIComponent(t)}`}function zt(e){return`${y(e)}/events`}function Qt(e){return`${y(e)}/rearm`}function Zt(e,t,n){return`${y(e)}/store/${encodeURIComponent(t)}/${encodeURIComponent(n)}`}var en="/:installationId/webhook-protocol-adapter-bundle";function tn(e){return`${H}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var nn="modules/webhook/protocol-adapter.js";function rn(e){return`modules/webhook/protocol-adapter-${e}.js`}function on(e){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&&!Re(e.connection)||!ye(e.runtime)?o("webhook watcher context surface shape is invalid"):p(e)}function Re(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function ye(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 sn(e){if(!i(e)||typeof e.deliveryId!="string"||typeof e.receivedAt!="string"||!i(e.request))return o("webhook delivery surface shape is invalid");let t=e.request;return t.method!=="POST"||!i(t.headers)||typeof t.rawBody!="string"?o("webhook delivery request shape is invalid"):p(e)}function an(e){if(!i(e)||typeof e.triggerRef!="string"||typeof e.artifactDigest!="string"||!Array.isArray(e.modules)||!e.modules.every(Ie))return{ok:!1,kind:"shape",reason:"trigger handler bundles data surface shape is invalid"};let t=O(e.runtimeNetwork);return t.ok?{ok:!0,value:{triggerRef:e.triggerRef,artifactDigest:e.artifactDigest,modules:e.modules,runtimeNetwork:t.value}}:t}function Ie(e){return i(e)&&typeof e.specifier=="string"&&e.specifier.length>0&&typeof e.source=="string"}function Te(e){return!i(e)||!("value"in e)?o("webhook store get surface shape is invalid"):p(e.value)}function pn(e){if(!i(e))return o("publish events body must be a JSON object");let t=P(e,["deliveryId","events"]);if(t!==void 0)return o(`publish events does not accept the "${t}" field`);let n=e.deliveryId;if(typeof n!="string"||n.length===0)return o("deliveryId must be a non-empty string");let r=e.events;if(!Array.isArray(r))return o("events must be an array");let s=[];for(let a of r){let u=xe(a);if(!u.ok)return u;s.push(u.value)}return p({deliveryId:n,events:s})}function xe(e){if(!i(e))return o("each event must be a JSON object");let t=P(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return o(`event does not accept the "${t}" field`);let n=e.eventId;if(typeof n!="string"||n.length===0)return o("eventId must be a non-empty string");let r=e.occurredAt;if(typeof r!="string"||r.length===0)return o("occurredAt must be a non-empty string");if(!i(e.payload))return o("event payload must be a JSON object");let s={eventId:n,occurredAt:r,payload:e.payload};if(e.dedupeKey!==void 0){if(typeof e.dedupeKey!="string"||e.dedupeKey.length===0)return o("dedupeKey must be a non-empty string");s.dedupeKey=e.dedupeKey}return p(s)}function un(e){if(!i(e))return o("rearm body must be a JSON object");let t=P(e,["expectedWatcherInstanceId"]);if(t!==void 0)return o(`rearm does not accept the "${t}" field`);let n=e.expectedWatcherInstanceId;return typeof n!="string"||n.length===0?o("expectedWatcherInstanceId must be a non-empty string"):p({expectedWatcherInstanceId:n})}function Ee(e){if(!i(e))return o("store body must be a JSON object");let t=P(e,["value"]);return t!==void 0?o(`store put does not accept the "${t}" field`):"value"in e?p({value:e.value}):o("store put requires a value field")}function P(e,t){return Object.keys(e).find(n=>!t.includes(n))}var k="/internal/polling-trigger-instances",cn="/:pollingInstanceId/context",gn="/:pollingInstanceId/handler-bundles",fn="/:pollingInstanceId/ticks/:tickId/events",mn="/:pollingInstanceId/store/:namespace/:key",N=e=>`${k}/${encodeURIComponent(e)}`;function _n(e,t,n){return`${N(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function Rn(e,t){return`${N(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function yn(e,t){return`${N(e)}/ticks/${encodeURIComponent(t)}/events`}function In(e,t,n){return`${N(e)}/store/${encodeURIComponent(t)}/${encodeURIComponent(n)}`}function Tn(e){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&&!Ae(e.connection)||!we(e.runtime)||!ke(e.tick)||!Se(e.limits)?o("polling trigger context surface shape is invalid"):p(e)}function Ae(e){return i(e)&&typeof e.connectionId=="string"&&typeof e.connectionRef=="string"&&typeof e.integrationRef=="string"&&typeof e.authType=="string"}function we(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 r=t.dedup;return i(r)&&(r.strategy==="cursor"||r.strategy==="hash"||r.strategy==="id_field")}function ke(e){return i(e)&&typeof e.tickId=="string"&&typeof e.scheduledAt=="string"&&typeof e.attempt=="number"}function Se(e){return i(e)&&typeof e.maxEventsPerTick=="number"}function xn(e){if(!i(e))return o("publish body must be a JSON object");let t=X(e,["events","nextCursor"]);if(t!==void 0)return o(`publish does not accept the "${t}" field`);let n=e.events;if(!Array.isArray(n))return o("events must be an array");let r=[];for(let a of n){let u=he(a);if(!u.ok)return u;r.push(u.value)}let s={events:r};if("nextCursor"in e){let a=e.nextCursor;if(a!==null&&typeof a!="string")return o("nextCursor must be a string, null, or omitted");s.nextCursor=a}return p(s)}function he(e){if(!i(e))return o("each event must be a JSON object");let t=X(e,["eventId","occurredAt","dedupeKey","payload"]);if(t!==void 0)return o(`event does not accept the "${t}" field`);if(typeof e.eventId!="string"||e.eventId.length===0)return o("event eventId must be a non-empty string");if(!i(e.payload))return o("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 o("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 o("event dedupeKey must be a non-empty string");n.dedupeKey=e.dedupeKey}return p(n)}function En(e){return!i(e)||typeof e.tickId!="string"||typeof e.cursorUpdated!="boolean"||!Array.isArray(e.results)||!e.results.every(Oe)?o("publish polling tick events data surface shape is invalid"):p(e)}function Oe(e){return i(e)&&typeof e.eventId=="string"&&typeof e.dedupeKey=="string"&&typeof e.duplicate=="boolean"&&(e.flowRunId===null||typeof e.flowRunId=="string")}function X(e,t){return Object.keys(e).find(n=>!t.includes(n))}var Y="/internal/egress-grants",M="/internal/tool-invocations",Pn="/:flowRunId/egress-grant",Nn="/:invocationId/egress-grant",bn="/:pollingInstanceId/egress-grant",Dn="/:triggerInstanceId/egress-grant",Cn="/:grantId/consume",vn="/:grantId/audit",Fn=e=>`${f}/${encodeURIComponent(e)}/egress-grant`,Un=e=>`${M}/${encodeURIComponent(e)}/egress-grant`,Ln=e=>`${k}/${encodeURIComponent(e)}/egress-grant`,Bn=e=>`${w}/${encodeURIComponent(e)}/egress-grant`,Gn=e=>`${Y}/${encodeURIComponent(e)}/consume`,Hn=e=>`${Y}/${encodeURIComponent(e)}/audit`,Pe=["flow_action","single_tool","polling_trigger","webhook_trigger"],Ne=/^[A-Za-z0-9][A-Za-z0-9:_+/=.-]{15,1023}$/;function S(e){return typeof e=="string"&&Ne.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(r=>i(r)?r.kind==="file"&&typeof r.file_id=="string"&&r.file_id.length>0:!1):!1}function l(e){return{ok:!1,kind:"shape",reason:e}}function h(){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 C(e){if(!i(e))return"request must be a JSON object"}function Mn(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 r=C(t.record.request);if(r!==void 0)return l(r);let s=t.record.requestDigest;return S(s)?{ok:!0,value:{nodeId:n,requestDigest:s,requestHasMultipartFiles:be(t.record.request)}}:h()}function $n(e){let t=D(e,["request","requestDigest"]);if(!t.ok)return l(t.reason);let n=C(t.record.request);if(n!==void 0)return l(n);let r=t.record.requestDigest;return S(r)?{ok:!0,value:{requestDigest:r}}:h()}function Kn(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 r=C(t.record.request);if(r!==void 0)return l(r);let s=t.record.requestDigest;return S(s)?{ok:!0,value:{tickId:n,requestDigest:s}}:h()}function Wn(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 r=t.record.lifecycle,s;if(r!==void 0){if(r!=="enable"&&r!=="disable"&&r!=="renew")return l('lifecycle must be "enable", "disable", or "renew"');s=r}if(n==="lifecycle"&&s===void 0)return l("lifecycle is required for the lifecycle phase");let a=C(t.record.request);if(a!==void 0)return l(a);let u=t.record.requestDigest;return S(u)?{ok:!0,value:{phase:n,...s!==void 0?{lifecycle:s}:{},requestDigest:u}}:h()}function z(e){return Pe.includes(e)?e:void 0}var De=["scopeKind","scopeId","requestDigest"];function Vn(e){if(!i(e))return l("consume body must be a JSON object");for(let s of Object.keys(e))if(!De.includes(s))return l(`consume does not accept the "${s}" field`);let t=z(e.scopeKind);if(t===void 0)return l("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return l("scopeId is required");let r=e.requestDigest;return S(r)?{ok:!0,value:{scopeKind:t,scopeId:n,requestDigest:r}}:h()}var Ce=["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 qn(e){if(!i(e))return l("audit body must be a JSON object");for(let c of Object.keys(e))if(!Ce.includes(c))return l(`audit does not accept the "${c}" field`);let t=z(e.scopeKind);if(t===void 0)return l("scopeKind is invalid");let n=e.scopeId;if(typeof n!="string"||n.length===0)return l("scopeId is required");let r=e.providerHost;if(typeof r!="string"||r.length===0)return l("providerHost is required");let s=b(e.durationMs,"durationMs");if(!s.ok)return l(s.reason);let a;if(e.status!==void 0){let c=b(e.status,"status");if(!c.ok)return l(c.reason);a=c.value}let u;if(e.requestBytes!==void 0){let c=b(e.requestBytes,"requestBytes");if(!c.ok)return l(c.reason);u=c.value}let d;if(e.responseBytes!==void 0){let c=b(e.responseBytes,"responseBytes");if(!c.ok)return l(c.reason);d=c.value}let L;if(e.errorCode!==void 0){let c=e.errorCode;if(typeof c!="string"||c.length===0)return l("errorCode must be a non-empty string");L=c}return{ok:!0,value:{scopeKind:t,scopeId:n,providerHost:r,...a!==void 0?{status:a}:{},durationMs:s.value,...u!==void 0?{requestBytes:u}:{},...d!==void 0?{responseBytes:d}:{},...L!==void 0?{errorCode:L}:{}}}}function jn(e){return!i(e)||!i(e.grant)?o("egress grant envelope must carry a grant object"):p(e.grant)}function Jn(e){return!i(e)||e.consumed!==!0?o("egress grant consume data must carry consumed:true"):p({consumed:!0})}var tr="/:flowRunId/runtime-credential",nr="/:invocationId/runtime-credential",rr="/:pollingInstanceId/runtime-credential",or="/:triggerInstanceId/runtime-credential",ir=e=>`${f}/${encodeURIComponent(e)}/runtime-credential`,sr=e=>`${M}/${encodeURIComponent(e)}/runtime-credential`,ar=e=>`${k}/${encodeURIComponent(e)}/runtime-credential`,pr=e=>`${w}/${encodeURIComponent(e)}/runtime-credential`,ur=["flow_action","tool_invoke","polling_trigger","webhook_trigger"];function v(e,t){if(!i(e))return{ok:!1,reason:"runtime credential request body must be a JSON object"};for(let n of Object.keys(e))if(!t.includes(n))return{ok:!1,reason:`runtime credential request does not accept the "${n}" field`};return{ok:!0,record:e}}function lr(e){let t=v(e,["nodeId"]);if(!t.ok)return o(t.reason);let n=t.record.nodeId;return typeof n!="string"||n.length===0?o("nodeId is required"):p({nodeId:n})}function dr(e){let t=v(e??{},[]);return t.ok?p(null):o(t.reason)}function cr(e){let t=v(e,["tickId"]);if(!t.ok)return o(t.reason);let n=t.record.tickId;return typeof n!="string"||n.length===0?o("tickId is required"):p({tickId:n})}function gr(e){let t=v(e,["executionKind","deliveryId","lifecycleOperation"]);if(!t.ok)return o(t.reason);let n=t.record.executionKind;if(n!=="event_handler"&&n!=="lifecycle")return o('executionKind must be "event_handler" or "lifecycle"');let r,s=t.record.deliveryId;if(s!==void 0){if(typeof s!="string"||s.length===0)return o("deliveryId must be a non-empty string");r=s}let a,u=t.record.lifecycleOperation;if(u!==void 0){if(u!=="enable"&&u!=="disable"&&u!=="renew")return o('lifecycleOperation must be "enable", "disable", or "renew"');a=u}return n==="lifecycle"&&a===void 0?o("lifecycleOperation is required for the lifecycle execution kind"):p({executionKind:n,...r!==void 0?{deliveryId:r}:{},...a!==void 0?{lifecycleOperation:a}:{}})}function fr(e){return!i(e)||typeof e.sessionId!="string"||typeof e.connectionId!="string"||!i(e.credential)?o("runtime credential session must carry sessionId, connectionId and a credential object"):p(e.credential)}var $="/internal/files",Rr="/:fileId/stat",yr="/:fileId/content",Ir=()=>$,Q=e=>`?scope_kind=${encodeURIComponent(e.scopeKind)}&scope_id=${encodeURIComponent(e.scopeId)}`,Tr=(e,t)=>`${$}/${encodeURIComponent(e)}/stat${Q(t)}`,xr=(e,t)=>`${$}/${encodeURIComponent(e)}/content${Q(t)}`;function Er(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"?o("file ref data does not match the AIS file-ref shape"):p(e)}var Sr="/:flowRunId/human-inputs",hr="/:flowRunId/human-inputs/:requestId",Or="/:flowRunId/human-inputs/:requestId/expire",Pr="/:flowRunId/human-inputs/:requestId/acknowledge",ve=e=>`${f}/${encodeURIComponent(e)}/human-inputs`,Z=(e,t)=>`${ve(e)}/${encodeURIComponent(t)}`,Nr=(e,t)=>`${Z(e,t)}/expire`,br=(e,t)=>`${Z(e,t)}/acknowledge`,Fe="human_input_resolved";function Dr(e){return`${Fe}_${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 I(e,t){return typeof e!="string"||e.length===0?g(`${t} must be a non-empty string`):{ok:!0,value:e}}var Ue=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function Le(e,t){return typeof e!="string"||!Ue.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=I(t.value.title,"renderedPrompt.title");if(!n.ok)return n;let r={title:n.value};if(t.value.body!==void 0){if(typeof t.value.body!="string")return g("renderedPrompt.body must be a string");r.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");r.format=t.value.format}return{ok:!0,value:r}}function Ge(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 He(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 r=[];for(let s of n){let a=m(s,"delivery action");if(!a.ok)return a;let u=I(a.value.id,"delivery action id");if(!u.ok)return u;let d=ee(a.value.inputs,`delivery action '${u.value}' inputs`);if(!d.ok)return d;r.push({id:u.value,inputs:d.value})}return{ok:!0,value:{actions:r}}}function ee(e,t){let n=m(e,t);if(!n.ok)return n;let r={};for(let[s,a]of Object.entries(n.value)){let u=te(a,`${t}.${s}`);if(!u.ok)return u;r[s]=u.value}return{ok:!0,value:r}}function te(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=I(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[a,u]of n.value.items.entries()){let d=te(u,`${t}[${a}]`);if(!d.ok)return d;s.push(d.value)}return{ok:!0,value:{kind:"array",items:s}}}case"object":{let s=ee(n.value.entries,`${t}.entries`);return s.ok?{ok:!0,value:{kind:"object",entries:s.value}}:s}case"template":{if(!Array.isArray(n.value.parts))return g(`${t}.parts must be an array`);let s=[];for(let[a,u]of n.value.parts.entries()){let d=Me(u,`${t}.parts[${a}]`);if(!d.ok)return d;s.push(d.value)}return{ok:!0,value:{kind:"template",parts:s}}}default:return g(`${t}.kind is invalid`)}}function Me(e,t){let n=m(e,t);if(!n.ok)return n;let r=n.value.kind;if(r==="literal")return typeof n.value.value!="string"?g(`${t}.value must be a string`):{ok:!0,value:{kind:"literal",value:n.value.value}};if(r==="human_input_ref"){let s=I(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 Cr(e){let t=m(e,"request body");if(!t.ok)return o(t.reason);let n=I(t.value.nodeId,"nodeId");if(!n.ok)return o(n.reason);let r=Be(t.value.renderedPrompt);if(!r.ok)return o(r.reason);let s=Ge(t.value.input);if(!s.ok)return o(s.reason);let a=I(t.value.timeout,"timeout");if(!a.ok)return o(a.reason);let u=Le(t.value.expiresAt,"expiresAt");if(!u.ok)return o(u.reason);let d=He(t.value.partiallyRenderedDelivery);return d.ok?p({nodeId:n.value,renderedPrompt:r.value,input:s.value,timeout:a.value,expiresAt:u.value,...d.value!==void 0?{partiallyRenderedDelivery:d.value}:{}}):o(d.reason)}function $e(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))?o("human input request view must carry id, nodeId, status and output"):p(e)}function vr(e){if(!i(e)||typeof e.created!="boolean")return o("human input create data must carry created:boolean");let t=$e(e.request);return t.ok?p({created:e.created,request:t.value}):t}function Fr(e){return!i(e)||e.acknowledged!==!0?o("human input acknowledge data must carry acknowledged:true"):p({acknowledged:!0})}var Lr="ablehi-wfp-user-runtime-manifest/v1",Br="unknown";function Gr(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var Mr="/internal/deployment-handshake",Ke=["start","terminate","send-event","start-webhook-watcher","run-polling-tick","invoke-tool","invoke-trigger-handler","invoke-webhook-protocol-adapter","deployment-handshake"],$r=Ke,Kr="HANDSHAKE_REQUEST_INVALID",Wr="HANDSHAKE_SECRET_UNCONFIGURED",Vr="HANDSHAKE_SECRET_MISMATCH",qr="HANDSHAKE_CONTRACT_VERSION_MISMATCH",jr="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",Jr="HANDSHAKE_CAPABILITY_MISSING";function Xr(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function Yr(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}var Qr="platform.access",Zr="platform.api_key.manage";var to="/me",no=()=>"/me";var We="/app/bootstrap",oo=()=>We;var ne="/workspaces",so="/",ao="/:workspaceId",Ve="/me/default-workspace",po=e=>`${ne}/${encodeURIComponent(e)}`,uo=()=>ne,lo=()=>Ve;var K="/api-keys",qe="/grant-options",go="/:apiKeyId",fo="ahi_key_",mo="workspace.full_access",_o=()=>K,Ro=()=>`${K}${qe}`,yo=e=>`${K}/${encodeURIComponent(e)}`;var W="/catalog",To="/integrations",xo="/integrations/:slug",Eo="/versions",Ao="/integrations/:slug/default-provider-app-config",wo=e=>{let t=`${W}/integrations`;return e?.category!==void 0&&e.category!==""?`${t}?category=${encodeURIComponent(e.category)}`:t},je=e=>`${W}/integrations/${encodeURIComponent(e)}`,ko=()=>`${W}/versions`,So=e=>`${je(e)}/default-provider-app-config`;var Oo="/workspaces/:workspaceId/integrations",Po="/:installationId",No="/:installationId/tools",Je=e=>`/workspaces/${encodeURIComponent(e)}/integrations`,Xe=(e,t)=>`${Je(e)}/${encodeURIComponent(t)}`,bo=(e,t)=>`${Xe(e,t)}/tools`;var Co="/workspaces/:workspaceId",vo="/connections",Fo="/integrations/:installationId/connect/start",Uo="/integrations/:installationId/connect/options",Lo="/connect-sessions/:sessionId/submit",Bo="/connect-sessions/:sessionId/complete",Go="/integrations/:installationId/connections/:connectionRef",Ho="/callbacks/redirect",T=e=>`/workspaces/${encodeURIComponent(e)}`,Mo=e=>`${T(e)}/connections`,$o=(e,t)=>`${T(e)}/integrations/${encodeURIComponent(t)}/connect/start`,Ko=(e,t)=>`${T(e)}/integrations/${encodeURIComponent(t)}/connect/options`,Wo=(e,t)=>`${T(e)}/connect-sessions/${encodeURIComponent(t)}/submit`,Vo=(e,t)=>`${T(e)}/connect-sessions/${encodeURIComponent(t)}/complete`,qo=(e,t,n)=>`${T(e)}/integrations/${encodeURIComponent(t)}/connections/${encodeURIComponent(n)}`;var Jo="/workspaces/:workspaceId/flows",Xo="/validate",Yo="/:flowId",zo="/:flowId/enable",Qo="/:flowId/disable",Zo="/:flowId/draft",ei="/:flowId/versions",ti="/:flowId/versions/:version",re=e=>`/workspaces/${encodeURIComponent(e)}/flows`,ni=e=>`${re(e)}/validate`,F=(e,t)=>`${re(e)}/${encodeURIComponent(t)}`,ri=(e,t)=>`${F(e,t)}/enable`,oi=(e,t)=>`${F(e,t)}/disable`,ii=(e,t)=>`${F(e,t)}/draft`,Ye=(e,t)=>`${F(e,t)}/versions`,si=(e,t,n)=>`${Ye(e,t)}/${n}`;var pi="/workspaces/:workspaceId/agent",ui="/chat",li="/flow-context",di="/sessions",ci="/sessions/:sessionId",gi=e=>`/workspaces/${encodeURIComponent(e)}/agent/chat`,fi=e=>`/workspaces/${encodeURIComponent(e)}/agent/sessions`,mi=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/sessions/${encodeURIComponent(t)}`,_i=20,Ri=50,yi=100,Ii="flow_authoring",Ti=["flow","flow_run","inbox_entry","integration"],xi=256,Ei=10,Ai=256,wi=["getFlowContext","getWorkingFlowIr","setFlowMeta","addNode","updateNode","removeNode","setTrigger","removeTrigger","setOutputs","setComposition","validateFlow","proposePublish","requestConnect"],ki=["setFlowMeta","addNode","updateNode","removeNode","setTrigger","removeTrigger","setOutputs","setComposition"];function Si(e){return JSON.stringify(e)}var U={type:"object",properties:{},additionalProperties:!1},x={type:"object",additionalProperties:!0},ze=[{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:U},{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:U},{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:{...x,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:{...x,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:{...x,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:{...x,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:{...x,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:{...x,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:U},{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:U},{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 hi(e){return ze.find(t=>t.name===e)}var Oi="AGENT_RUNTIME_UNCONFIGURED",Pi="AGENT_RUNTIME_FAILED",Ni="AGENT_SESSION_NOT_FOUND",bi="AGENT_MESSAGE_DELTA_INVALID",Di="AGENT_PAGE_CONTEXT_INVALID",V="/agent/assets",Ci="/prompts",vi="/prompts/:targetKey/:revision",Fi="/prompts/:targetKey/:revision/validate",Ui="/prompts/:targetKey/:revision/activate",Li="/model-input-targets",Bi="/model-input-targets/:targetKey/render-preview",Gi="/model-input-snapshots",Hi="/flow-scenes",Mi="/flow-scenes/:sceneKey/:revision",$i="/flow-scenes/:sceneKey/:revision/validate",Ki="/flow-scenes/:sceneKey/:revision/activate",Wi="/flow-scenes/:sceneKey/:revision/reindex",Vi="/flow-templates",qi="/flow-templates/:templateKey/:revision",ji="/flow-templates/:templateKey/:revision/validate",Ji="/flow-templates/:templateKey/:revision/activate",Xi="/flow-templates/:templateKey/:revision/reindex",Yi="/flow-working-drafts/open",zi="/flow-working-drafts/:draftId",Qi="/flow-working-drafts/:draftId/commands",Zi="/flow-working-drafts/:draftId/edit-turn/acquire",es="/flow-working-drafts/:draftId/edit-turn/release",ts="/flow-working-drafts/:draftId/publish",ns="/flow-working-drafts/:draftId/readiness/check",rs="/flow-working-drafts/:draftId/readiness/requirements/:requirementId/resolve",os="/flow-creation-tasks/:flowCreationTaskId",is="/flow-creation-decisions/:decisionRecordId",ss=()=>`${V}/prompts`,as=()=>`${V}/flow-scenes`,ps=()=>`${V}/flow-templates`,us=e=>`/workspaces/${encodeURIComponent(e)}/agent/flow-working-drafts/open`,E=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-working-drafts/${encodeURIComponent(t)}`,ls=(e,t)=>`${E(e,t)}/commands`,ds=(e,t)=>`${E(e,t)}/edit-turn/acquire`,cs=(e,t)=>`${E(e,t)}/edit-turn/release`,gs=(e,t)=>`${E(e,t)}/publish`,fs=(e,t)=>`${E(e,t)}/readiness/check`,ms=(e,t,n)=>`${E(e,t)}/readiness/requirements/${encodeURIComponent(n)}/resolve`,_s=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-creation-tasks/${encodeURIComponent(t)}`,Rs=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-creation-decisions/${encodeURIComponent(t)}`,ys="agent.asset.manage",Is=/^[A-Za-z0-9_-]{1,64}$/,Ts="flow_create_authoring_task",Qe="oneoff_getActionContext",Ze="oneoff_executeAction",xs=[Qe,Ze],Es=["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"],As="AGENT_ASSET_NOT_FOUND",ws="AGENT_ASSET_VALIDATION_FAILED",ks="AGENT_PROMPT_TARGET_NOT_FOUND",Ss="AGENT_PROMPT_ACTIVE_REVISION_MISSING",hs="AGENT_PROMPT_REVISION_NOT_FOUND",Os="AGENT_PROMPT_REVISION_NOT_DRAFT",Ps="AGENT_PROMPT_VALIDATION_FAILED",Ns="AGENT_MODEL_INPUT_TARGET_PROTECTED",bs="AGENT_MODEL_INPUT_PREVIEW_UNAVAILABLE",Ds="AGENT_FLOW_GOAL_INVALID",Cs="AGENT_FLOW_CREATION_TASK_NOT_FOUND",vs="AGENT_FLOW_CREATION_TASK_CONFLICT",Fs="AGENT_FLOW_AUTHORING_WORKFLOW_FAILED",Us="FLOW_WORKING_DRAFT_NOT_FOUND",Ls="FLOW_DRAFT_REVISION_CONFLICT",Bs="FLOW_DRAFT_COMMAND_INVALID",Gs="FLOW_DRAFT_EDIT_LOCKED",Hs="FLOW_EDIT_TURN_NOT_HELD",Ms="FLOW_DRAFT_NOT_PUBLISHABLE",$s="FLOW_PUBLISH_CONFIRMATION_REQUIRED",Ks="FLOW_READINESS_REQUIREMENT_NOT_FOUND",Ws="FLOW_READINESS_REQUIREMENT_CONFLICT",Vs="AGENT_ASSET_INDEX_FAILED";var js="/workspaces/:workspaceId/runs",Js="/workspaces/:workspaceId/flows/:flowId/runs",Xs="/:runId",Ys="/:runId/cancel",zs="/:runId/events",et=e=>`/workspaces/${encodeURIComponent(e)}/runs`,oe=(e,t)=>`${et(e)}/${encodeURIComponent(t)}`,Qs=(e,t)=>`${oe(e,t)}/cancel`,Zs=(e,t)=>`${oe(e,t)}/events`,ea=(e,t)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/runs`,ta=["queued","running","succeeded","failed","interrupted","cancelled"],na=["succeeded","skipped","timed_out","failed"];var oa="/workspaces/:workspaceId/inbox/items",ia="/workspaces/:workspaceId/inbox/entries",ie="/inbox/entries",sa="/:itemId",aa="/:entryId",pa="/:entryId/human-input/submit",tt=e=>`/workspaces/${encodeURIComponent(e)}/inbox/items`,ua=(e,t)=>`${tt(e)}/${encodeURIComponent(t)}`,nt=e=>`/workspaces/${encodeURIComponent(e)}/inbox/entries`,rt=(e,t)=>`${nt(e)}/${encodeURIComponent(t)}`,la=(e,t)=>`${rt(e,t)}/human-input/submit`,da=()=>ie,ot=e=>`${ie}/${encodeURIComponent(e)}`,ca=e=>`${ot(e)}/human-input/submit`;var fa="/human-input/tokens",ma="/:token",_a="/:token/submit",it=e=>`/human-input/tokens/${encodeURIComponent(e)}`,Ra=e=>`${it(e)}/submit`;var Ia="/:flowId/trigger-instances",Ta="/:flowId/triggers/:triggerBindingId/simulate",xa=(e,t)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/trigger-instances`,Ea=(e,t,n)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/triggers/${encodeURIComponent(n)}/simulate`;export{V as AGENT_ASSETS_ROUTE_PREFIX,Hi as AGENT_ASSET_FLOW_SCENES_SUBPATH,Ki as AGENT_ASSET_FLOW_SCENE_ACTIVATE_SUBPATH,Mi as AGENT_ASSET_FLOW_SCENE_ITEM_SUBPATH,Wi as AGENT_ASSET_FLOW_SCENE_REINDEX_SUBPATH,$i as AGENT_ASSET_FLOW_SCENE_VALIDATE_SUBPATH,Vi as AGENT_ASSET_FLOW_TEMPLATES_SUBPATH,Ji as AGENT_ASSET_FLOW_TEMPLATE_ACTIVATE_SUBPATH,qi as AGENT_ASSET_FLOW_TEMPLATE_ITEM_SUBPATH,Xi as AGENT_ASSET_FLOW_TEMPLATE_REINDEX_SUBPATH,ji as AGENT_ASSET_FLOW_TEMPLATE_VALIDATE_SUBPATH,Vs as AGENT_ASSET_INDEX_FAILED_ERROR_CODE,ys as AGENT_ASSET_MANAGE_PERMISSION,Gi as AGENT_ASSET_MODEL_INPUT_SNAPSHOTS_SUBPATH,Li as AGENT_ASSET_MODEL_INPUT_TARGETS_SUBPATH,Bi as AGENT_ASSET_MODEL_INPUT_TARGET_PREVIEW_SUBPATH,As as AGENT_ASSET_NOT_FOUND_ERROR_CODE,Ci as AGENT_ASSET_PROMPTS_SUBPATH,Ui as AGENT_ASSET_PROMPT_ACTIVATE_SUBPATH,vi as AGENT_ASSET_PROMPT_ITEM_SUBPATH,Fi as AGENT_ASSET_PROMPT_VALIDATE_SUBPATH,ws as AGENT_ASSET_VALIDATION_FAILED_ERROR_CODE,Ii as AGENT_CAPABILITY_FLOW_AUTHORING,ui as AGENT_CHAT_ROUTE_SUBPATH,Ts as AGENT_CREATE_FLOW_AUTHORING_TASK_TOOL_NAME,Fs as AGENT_FLOW_AUTHORING_WORKFLOW_FAILED_ERROR_CODE,li as AGENT_FLOW_CONTEXT_ROUTE_SUBPATH,is as AGENT_FLOW_CREATION_DECISION_ITEM_SUBPATH,vs as AGENT_FLOW_CREATION_TASK_CONFLICT_ERROR_CODE,os as AGENT_FLOW_CREATION_TASK_ITEM_SUBPATH,Cs as AGENT_FLOW_CREATION_TASK_NOT_FOUND_ERROR_CODE,Ds as AGENT_FLOW_GOAL_INVALID_ERROR_CODE,rs as AGENT_FLOW_READINESS_REQUIREMENT_RESOLVE_SUBPATH,Qi as AGENT_FLOW_WORKING_DRAFT_COMMANDS_SUBPATH,Zi as AGENT_FLOW_WORKING_DRAFT_EDIT_TURN_ACQUIRE_SUBPATH,es as AGENT_FLOW_WORKING_DRAFT_EDIT_TURN_RELEASE_SUBPATH,zi as AGENT_FLOW_WORKING_DRAFT_ITEM_SUBPATH,Yi as AGENT_FLOW_WORKING_DRAFT_OPEN_SUBPATH,ts as AGENT_FLOW_WORKING_DRAFT_PUBLISH_SUBPATH,ns 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,Es as AGENT_MODEL_INPUT_TARGET_KEYS,Ns as AGENT_MODEL_INPUT_TARGET_PROTECTED_ERROR_CODE,Di as AGENT_PAGE_CONTEXT_INVALID_ERROR_CODE,Ei as AGENT_PAGE_CONTEXT_MAX_RESOURCES,Ai as AGENT_PAGE_CONTEXT_RESOURCE_ID_MAX_LENGTH,xi as AGENT_PAGE_CONTEXT_ROUTE_ID_MAX_LENGTH,Ti as AGENT_PAGE_RESOURCE_TYPES,Ss as AGENT_PROMPT_ACTIVE_REVISION_MISSING_ERROR_CODE,Os as AGENT_PROMPT_REVISION_NOT_DRAFT_ERROR_CODE,hs as AGENT_PROMPT_REVISION_NOT_FOUND_ERROR_CODE,ks as AGENT_PROMPT_TARGET_NOT_FOUND_ERROR_CODE,Ps as AGENT_PROMPT_VALIDATION_FAILED_ERROR_CODE,pi as AGENT_ROUTE_PREFIX,Pi as AGENT_RUNTIME_FAILED_ERROR_CODE,Is as AGENT_RUNTIME_TOOL_NAME_PATTERN,Oi as AGENT_RUNTIME_UNCONFIGURED_ERROR_CODE,di as AGENT_SESSIONS_ROUTE_SUBPATH,yi as AGENT_SESSION_DETAIL_MESSAGE_LIMIT,ci as AGENT_SESSION_ITEM_ROUTE_SUBPATH,_i as AGENT_SESSION_LIST_DEFAULT_LIMIT,Ri as AGENT_SESSION_LIST_MAX_LIMIT,Ni as AGENT_SESSION_NOT_FOUND_ERROR_CODE,K as API_KEYS_ROUTE_PREFIX,qe as API_KEY_GRANT_OPTIONS_ROUTE_SUBPATH,go as API_KEY_ITEM_ROUTE_SUBPATH,fo as API_KEY_TOKEN_PREFIX,mo as API_KEY_WORKSPACE_FULL_ACCESS_SCOPE,We as APP_BOOTSTRAP_ROUTE_PATH,Ao as CATALOG_DEFAULT_PROVIDER_APP_CONFIG_ROUTE_SUBPATH,To as CATALOG_INTEGRATIONS_ROUTE_SUBPATH,xo as CATALOG_INTEGRATION_DETAIL_ROUTE_SUBPATH,W as CATALOG_ROUTE_PREFIX,Eo as CATALOG_VERSIONS_ROUTE_SUBPATH,vo as CONNECTIONS_ROUTE_SUBPATH,Go as CONNECTION_DISCONNECT_ROUTE_SUBPATH,Bo as CONNECT_COMPLETE_ROUTE_SUBPATH,Uo as CONNECT_OPTIONS_ROUTE_SUBPATH,Fo as CONNECT_START_ROUTE_SUBPATH,Lo as CONNECT_SUBMIT_ROUTE_SUBPATH,to as CURRENT_USER_ROUTE_PATH,Ve as DEFAULT_WORKSPACE_ROUTE_PATH,Ke as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,$r as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,Mr as DEPLOYMENT_HANDSHAKE_ROUTE,vn as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,Cn as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,Pe as EGRESS_GRANT_SCOPE_KINDS,Tt as EVENT_WAIT_ROUTE_SUBPATH,ct as EXECUTION_CONTEXT_ROUTE_SUBPATH,yr as FILE_CONTENT_ROUTE_SUBPATH,Rr as FILE_STAT_ROUTE_SUBPATH,ki as FLOW_AUTHORING_EDIT_TOOL_NAMES,ze as FLOW_AUTHORING_TOOL_DESCRIPTORS,wi as FLOW_AUTHORING_TOOL_NAMES,Qo as FLOW_DISABLE_ROUTE_SUBPATH,Bs as FLOW_DRAFT_COMMAND_INVALID_ERROR_CODE,Gs as FLOW_DRAFT_EDIT_LOCKED_ERROR_CODE,Ms as FLOW_DRAFT_NOT_PUBLISHABLE_ERROR_CODE,Ls as FLOW_DRAFT_REVISION_CONFLICT_ERROR_CODE,Zo as FLOW_DRAFT_ROUTE_SUBPATH,Hs as FLOW_EDIT_TURN_NOT_HELD_ERROR_CODE,zo as FLOW_ENABLE_ROUTE_SUBPATH,ae as FLOW_INTERPRETER_CONTRACT_VERSION,at as FLOW_IR_SCHEMA_VERSION,Yo as FLOW_ITEM_ROUTE_SUBPATH,$s as FLOW_PUBLISH_CONFIRMATION_REQUIRED_ERROR_CODE,Ws as FLOW_READINESS_REQUIREMENT_CONFLICT_ERROR_CODE,Ks as FLOW_READINESS_REQUIREMENT_NOT_FOUND_ERROR_CODE,Pn as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,It as FLOW_RUN_RESULT_ROUTE_SUBPATH,tr as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,ta as FLOW_RUN_STATUSES,Xo as FLOW_VALIDATE_ROUTE_SUBPATH,ei as FLOW_VERSIONS_ROUTE_SUBPATH,ti as FLOW_VERSION_ITEM_ROUTE_SUBPATH,Us as FLOW_WORKING_DRAFT_NOT_FOUND_ERROR_CODE,ie as GLOBAL_INBOX_ENTRIES_ROUTE_PREFIX,Dt as HANDLER_BUNDLES_ROUTE_SUBPATH,Jr as HANDSHAKE_CAPABILITY_MISSING,qr as HANDSHAKE_CONTRACT_VERSION_MISMATCH,jr as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,Kr as HANDSHAKE_REQUEST_INVALID,Vr as HANDSHAKE_SECRET_MISMATCH,Wr as HANDSHAKE_SECRET_UNCONFIGURED,Sr as HUMAN_INPUTS_ROUTE_SUBPATH,Pr as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,Or as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,hr as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,Fe as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,fa as HUMAN_INPUT_TOKENS_ROUTE_PREFIX,ma as HUMAN_INPUT_TOKEN_ROUTE_SUBPATH,_a as HUMAN_INPUT_TOKEN_SUBMIT_ROUTE_SUBPATH,pa as INBOX_ENTRY_HUMAN_INPUT_SUBMIT_ROUTE_SUBPATH,aa as INBOX_ENTRY_ROUTE_SUBPATH,sa as INBOX_ITEM_ROUTE_SUBPATH,Po as INTEGRATION_ITEM_ROUTE_SUBPATH,No as INTEGRATION_TOOLS_ROUTE_SUBPATH,Y as INTERNAL_EGRESS_GRANTS_ROUTE_PREFIX,$ as INTERNAL_FILES_ROUTE_PREFIX,f as INTERNAL_FLOW_RUNS_ROUTE_PREFIX,ge as INTERNAL_FLOW_VERSIONS_ROUTE_PREFIX,H as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,k as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,M as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,w as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,Ze as ONE_OFF_EXECUTE_ACTION_TOOL_NAME,Qe as ONE_OFF_GET_ACTION_CONTEXT_TOOL_NAME,xs as ONE_OFF_TOOL_NAMES,Qr as PLATFORM_ACCESS_PERMISSION,Zr as PLATFORM_API_KEY_MANAGE_PERMISSION,cn as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,bn as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,gn as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,rr as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,mn as POLLING_TRIGGER_STORE_ROUTE_SUBPATH,fn as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,Ho as PROVIDER_CALLBACK_REDIRECT_ROUTE_PATH,ur as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,Ys as RUN_CANCEL_ROUTE_SUBPATH,zs as RUN_EVENTS_ROUTE_SUBPATH,Xs as RUN_ITEM_ROUTE_SUBPATH,se as SERVER_CONTRACT_VERSION,yt as STEP_RESULT_ROUTE_SUBPATH,na as STEP_RUN_STATUSES,Ct as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,Nn as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,nr as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Ia as TRIGGER_INSTANCES_ROUTE_SUBPATH,Ta as TRIGGER_SIMULATE_ROUTE_SUBPATH,en as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,nn as WEBHOOK_PROTOCOL_ADAPTER_MODULE,$t as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,Wt as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,Dn as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,Vt as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,Kt as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,qt as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,or as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,jt as WEBHOOK_TRIGGER_STORE_ROUTE_SUBPATH,Lr as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,Br as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,ne as WORKSPACES_ROUTE_PREFIX,ao as WORKSPACE_ACCESS_ROUTE_SUBPATH,Co as WORKSPACE_CONNECTION_MOUNT_PREFIX,Jo as WORKSPACE_FLOWS_ROUTE_PREFIX,Js as WORKSPACE_FLOW_RUNS_ROUTE_PREFIX,ia as WORKSPACE_INBOX_ENTRIES_ROUTE_PREFIX,oa as WORKSPACE_INBOX_ITEMS_ROUTE_PREFIX,Oo as WORKSPACE_INTEGRATIONS_ROUTE_PREFIX,so as WORKSPACE_LIST_ROUTE_SUBPATH,js as WORKSPACE_RUNS_ROUTE_PREFIX,as as agentAssetFlowScenesPath,ps as agentAssetFlowTemplatesPath,ss as agentAssetPromptsPath,gi as agentChatPath,Rs as agentFlowCreationDecisionPath,_s as agentFlowCreationTaskPath,ms as agentFlowReadinessRequirementResolvePath,ls as agentFlowWorkingDraftCommandsPath,ds as agentFlowWorkingDraftEditTurnAcquirePath,cs as agentFlowWorkingDraftEditTurnReleasePath,us as agentFlowWorkingDraftOpenPath,E as agentFlowWorkingDraftPath,gs as agentFlowWorkingDraftPublishPath,fs as agentFlowWorkingDraftReadinessCheckPath,mi as agentSessionPath,fi as agentSessionsPath,Ro as apiKeyGrantOptionsPath,yo as apiKeyPath,_o as apiKeysPath,oo as appBootstrapPath,So as catalogDefaultProviderAppConfigPath,je as catalogIntegrationPath,wo as catalogIntegrationsPath,ko as catalogVersionsPath,Vo as connectCompletePath,Ko as connectOptionsPath,$o as connectStartPath,Wo as connectSubmitPath,qo as connectionDisconnectPath,o as contractParseFail,p as contractParseOk,no as currentUserPath,lo as defaultWorkspacePath,Xr as deploymentHandshakeProbePayload,Yr as deploymentHandshakeResponseProofPayload,Hn as egressGrantAuditPath,Gn as egressGrantConsumePath,At as eventWaitPath,gt as executionContextPath,hi as findFlowAuthoringToolDescriptor,oi as flowDisablePath,ii as flowDraftPath,ri as flowEnablePath,F as flowPath,Fn as flowRunEgressGrantPath,Et as flowRunResultPath,ir as flowRunRuntimeCredentialPath,ea as flowRunsPath,rn as flowScriptProtocolAdapterModuleName,ni as flowValidatePath,si as flowVersionPath,Ye as flowVersionsPath,Si as formatFlowToolError,da as globalInboxEntriesPath,ca as globalInboxEntryHumanInputSubmitPath,ot as globalInboxEntryPath,vt as handlerBundlesPath,br as humanInputAcknowledgePath,Nr as humanInputExpirePath,Z as humanInputRequestPath,Dr as humanInputResolvedEventType,it as humanInputTokenPath,Ra as humanInputTokenSubmitPath,ve as humanInputsPath,la as inboxEntryHumanInputSubmitPath,rt as inboxEntryPath,ua as inboxItemPath,bo as installationToolsPath,xr as internalFileContentPath,Tr as internalFileStatPath,Ir as internalFilesPath,i as isJsonRecord,S as isValidRequestDigest,Pt as parseCompleteFlowRunWaitBody,Cr as parseCreateHumanInputBody,qn as parseEgressGrantAuditBody,Vn as parseEgressGrantConsumeBody,Jn as parseEgressGrantConsumeData,jn as parseEgressGrantData,ft as parseExecutionContextData,Er as parseFileRefData,pe as parseFileRuntimeLimits,Mn as parseFlowActionGrantBody,St as parseFlowRunResultBody,ht as parseFlowRunResultData,lr as parseFlowRuntimeCredentialBody,me as parseHandlerBundle,Ut as parseHandlerBundlesData,Fr as parseHumanInputAcknowledgeData,vr as parseHumanInputCreateData,$e as parseHumanInputRequestViewData,xn as parsePollingPublishBody,cr as parsePollingRuntimeCredentialBody,Ee as parsePollingStorePutBody,Te as parsePollingStoreValue,Tn as parsePollingTriggerContext,Kn as parsePollingTriggerGrantBody,En as parsePublishPollingTickEventsData,Ot as parseRegisterFlowRunWaitBody,Nt as parseRegisterFlowRunWaitData,fr as parseRuntimeCredentialSessionCredential,O as parseRuntimeNetwork,$n as parseSingleToolGrantBody,dr as parseSingleToolRuntimeCredentialBody,wt as parseStepRecordBody,kt as parseStepRecordData,Lt as parseToolHandlerBundlesData,an as parseTriggerHandlerBundlesData,sn as parseWebhookDelivery,pn as parseWebhookPublishEventsBody,un as parseWebhookRearmBody,gr as parseWebhookRuntimeCredentialBody,Ee as parseWebhookStorePutBody,Te as parseWebhookStoreValue,Wn as parseWebhookTriggerGrantBody,on as parseWebhookWatcherContext,_n as pollingTriggerContextPath,Ln as pollingTriggerEgressGrantPath,Rn as pollingTriggerHandlerBundlesPath,ar as pollingTriggerRuntimeCredentialPath,In as pollingTriggerStorePath,yn as pollingTriggerTickEventsPath,be as requestHasMultipartFileParts,Qs as runCancelPath,Zs as runEventsPath,oe as runPath,xt as stepResultPath,Ft as toolHandlerBundlesPath,Un as toolInvocationEgressGrantPath,sr as toolInvocationRuntimeCredentialPath,xa as triggerInstancesPath,Ea as triggerSimulatePath,tn as webhookProtocolAdapterBundlePath,Jt as webhookTriggerContextPath,Yt as webhookTriggerDeliveryPath,Bn as webhookTriggerEgressGrantPath,zt as webhookTriggerEventsPath,Xt as webhookTriggerHandlerBundlesPath,Qt as webhookTriggerRearmPath,pr as webhookTriggerRuntimeCredentialPath,Zt as webhookTriggerStorePath,Gr as wfpUserRuntimeManifestPath,Mo as workspaceConnectionsPath,re as workspaceFlowsPath,nt as workspaceInboxEntriesPath,tt as workspaceInboxItemsPath,Xe as workspaceIntegrationPath,Je as workspaceIntegrationsPath,po as workspacePath,et as workspaceRunsPath,uo as workspacesPath};
|
|
1
|
+
var de="0.2.4";var Et="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 ht="/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 Pt(e){if(!i(e))return r("cleanup request body must be a JSON object");let t=C(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 Ot(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=C(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=C(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=C(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 C(e,t){return Object.keys(e).find(n=>!t.includes(n))}var f="/internal/flow-runs",bt="/:flowRunId/execution-context";function Ft(e){return`${f}/${encodeURIComponent(e)}/execution-context`}function _e(e){return!i(e)||!H(e.fileMaxBytes)||!H(e.fileReadMaxBytes)||!H(e.inlineMultipartBytesMax)?r("file runtime limits must carry three positive integer bounds"):a({fileMaxBytes:e.fileMaxBytes,fileReadMaxBytes:e.fileReadMaxBytes,inlineMultipartBytesMax:e.inlineMultipartBytesMax})}function vt(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 H(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}var Gt="/:flowRunId/steps/:nodeId/result",Ht="/:flowRunId/result",Mt="/:flowRunId/event-waits/:nodeId";function $t(e,t){return`${f}/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/result`}function Kt(e){return`${f}/${encodeURIComponent(e)}/result`}function Wt(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=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 qt(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 Jt(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 Xt(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 Yt(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 zt(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",Zt="/:flowVersionId/handler-bundles",$="/internal/installations",en="/:installationId/handler-bundles";function tn(e,t){return`${Ee}/${encodeURIComponent(e)}/handler-bundles?compiledArtifactId=${encodeURIComponent(t)}`}function nn(e){return`${$}/${encodeURIComponent(e.installationId)}/handler-bundles?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var we=new Set(["managed_only","managed_plus_unmanaged_sdk"]);function D(e){if(!y(e))return M("runtimeNetwork must be a JSON object");let t=e.networkModel;return typeof t!="string"||!we.has(t)?M("runtimeNetwork.networkModel is unknown"):!Q(e.apiHosts)||!Q(e.authHosts)||typeof e.httpsOnly!="boolean"?M("runtimeNetwork host/https fields are invalid"):{ok:!0,value:{networkModel:t,apiHosts:e.apiHosts,authHosts:e.authHosts,httpsOnly:e.httpsOnly}}}function rn(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 on(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=D(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=D(e.runtimeNetwork);return n.ok?{ok:!0,value:{toolRef:e.toolRef,kind:"handler",module:{entry:t.entry,files:t.files},runtimeNetwork:n.value}}:n}function k(e){return{ok:!1,kind:"shape",reason:e}}function M(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",cn="/:triggerInstanceId/context",dn="/:triggerInstanceId/handler-bundles",gn="/:triggerInstanceId/deliveries/:deliveryId",fn="/:triggerInstanceId/events",mn="/:triggerInstanceId/rearm",h=e=>`${S}/${encodeURIComponent(e)}`;function Rn(e,t){return`${h(e)}/context?artifactDigest=${encodeURIComponent(t)}`}function _n(e,t){return`${h(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function In(e,t){return`${h(e)}/deliveries/${encodeURIComponent(t)}`}function yn(e){return`${h(e)}/events`}function Tn(e){return`${h(e)}/rearm`}var xn="/:installationId/webhook-protocol-adapter-bundle";function En(e){return`${$}/${encodeURIComponent(e.installationId)}/webhook-protocol-adapter-bundle?workspaceId=${encodeURIComponent(e.workspaceId)}&artifactDigest=${encodeURIComponent(e.artifactDigest)}`}var wn="modules/webhook/protocol-adapter.js";function An(e){return`modules/webhook/protocol-adapter-${e}.js`}function kn(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 Sn(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 hn(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=D(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 Pn(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=Oe(p);if(!u.ok)return u;s.push(u.value)}return a({deliveryId:n,events:s})}function Oe(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 On(e){if(!i(e))return r("rearm body must be a JSON object");let t=K(e,["expectedWatcherInstanceId"]);if(t!==void 0)return r(`rearm does not accept the "${t}" field`);let n=e.expectedWatcherInstanceId;return typeof n!="string"||n.length===0?r("expectedWatcherInstanceId must be a non-empty string"):a({expectedWatcherInstanceId:n})}function K(e,t){return Object.keys(e).find(n=>!t.includes(n))}var P="/internal/polling-trigger-instances",bn="/:pollingInstanceId/context",Fn="/:pollingInstanceId/handler-bundles",vn="/:pollingInstanceId/ticks/:tickId/events",W=e=>`${P}/${encodeURIComponent(e)}`;function Un(e,t,n){return`${W(e)}/context?artifactDigest=${encodeURIComponent(t)}&tickId=${encodeURIComponent(n)}`}function Ln(e,t){return`${W(e)}/handler-bundles?artifactDigest=${encodeURIComponent(t)}`}function Bn(e,t){return`${W(e)}/ticks/${encodeURIComponent(t)}/events`}function Gn(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)||!Ce(e.runtime)||!t.ok||t.value.kind!=="polling-trigger"||!De(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 Ce(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 De(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 Hn(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 u=Fe(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 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 Mn(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",V="/internal/tool-invocations",jn="/:flowRunId/egress-grant",Jn="/:invocationId/egress-grant",Xn="/:pollingInstanceId/egress-grant",Yn="/:triggerInstanceId/egress-grant",zn="/:grantId/consume",Qn="/:grantId/audit",Zn=e=>`${f}/${encodeURIComponent(e)}/egress-grant`,er=e=>`${V}/${encodeURIComponent(e)}/egress-grant`,tr=e=>`${P}/${encodeURIComponent(e)}/egress-grant`,nr=e=>`${S}/${encodeURIComponent(e)}/egress-grant`,rr=e=>`${te}/${encodeURIComponent(e)}/consume`,or=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 l(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 ir(e){let t=F(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:Be(t.record.request)}}:N()}function sr(e){let t=F(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}}:N()}function ar(e){let t=F(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}}:N()}function pr(e){let t=F(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}}:N()}function ne(e){return Ue.includes(e)?e:void 0}var Ge=["scopeKind","scopeId","requestDigest"];function ur(e){if(!i(e))return l("consume body must be a JSON object");for(let s of Object.keys(e))if(!Ge.includes(s))return l(`consume does not accept the "${s}" field`);let t=ne(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}}: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 lr(e){if(!i(e))return l("audit body must be a JSON object");for(let d of Object.keys(e))if(!He.includes(d))return l(`audit does not accept the "${d}" field`);let t=ne(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=b(e.durationMs,"durationMs");if(!s.ok)return l(s.reason);let p;if(e.status!==void 0){let d=b(e.status,"status");if(!d.ok)return l(d.reason);p=d.value}let u;if(e.requestBytes!==void 0){let d=b(e.requestBytes,"requestBytes");if(!d.ok)return l(d.reason);u=d.value}let c;if(e.responseBytes!==void 0){let d=b(e.responseBytes,"responseBytes");if(!d.ok)return l(d.reason);c=d.value}let G;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");G=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}:{},...G!==void 0?{errorCode:G}:{}}}}function cr(e){return!i(e)||!i(e.grant)?r("egress grant envelope must carry a grant object"):a(e.grant)}function dr(e){return!i(e)||e.consumed!==!0?r("egress grant consume data must carry consumed:true"):a({consumed:!0})}var yr="/:flowRunId/runtime-credential",Tr="/:invocationId/runtime-credential",xr="/:pollingInstanceId/runtime-credential",Er="/:triggerInstanceId/runtime-credential",wr=e=>`${f}/${encodeURIComponent(e)}/runtime-credential`,Ar=e=>`${V}/${encodeURIComponent(e)}/runtime-credential`,kr=e=>`${P}/${encodeURIComponent(e)}/runtime-credential`,Sr=e=>`${S}/${encodeURIComponent(e)}/runtime-credential`,hr=["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 Pr(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 Or(e){let t=U(e??{},[]);return t.ok?a(null):r(t.reason)}function Nr(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,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 Dr(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 q(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"||!Je(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=q(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 j(e){if(!i(e)||!je(e.intent))return r("file access data is invalid");let t=q(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 Je(e){return i(e)?Object.values(e).every(t=>typeof t=="string"):!1}var T="/internal/files",Br="/upload-session",Gr="/:fileId/complete",Hr="/:fileId/access",Mr="/:fileId/stat",$r="/:fileId/content",Kr=()=>T,Wr=()=>`${T}/upload-session`,Vr=e=>`${T}/${encodeURIComponent(e)}/complete`,qr=(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)}`,Jr=(e,t)=>`${T}/${encodeURIComponent(e)}/content${oe(t)}`;function Xr(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 Zr="/:flowRunId/human-inputs",eo="/:flowRunId/human-inputs/:requestId",to="/:flowRunId/human-inputs/:requestId/expire",no="/:flowRunId/human-inputs/:requestId/acknowledge",Xe=e=>`${f}/${encodeURIComponent(e)}/human-inputs`,ie=(e,t)=>`${Xe(e)}/${encodeURIComponent(t)}`,ro=(e,t)=>`${ie(e,t)}/expire`,oo=(e,t)=>`${ie(e,t)}/acknowledge`,Ye="human_input_resolved";function io(e){return`${Ye}_${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 ze=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;function Qe(e,t){return typeof e!="string"||!ze.test(e)||Number.isNaN(Date.parse(e))?g(`${t} must be an ISO-8601 timestamp`):{ok:!0,value:e}}function Ze(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 et(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 tt(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 u=x(p.value.id,"delivery action id");if(!u.ok)return u;let c=se(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 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 u=ae(p,`${t}.${s}`);if(!u.ok)return u;o[s]=u.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,u]of n.value.items.entries()){let c=ae(u,`${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,u]of n.value.parts.entries()){let c=nt(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 nt(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 so(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=Ze(t.value.renderedPrompt);if(!o.ok)return r(o.reason);let s=et(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 u=Qe(t.value.expiresAt,"expiresAt");if(!u.ok)return r(u.reason);let c=tt(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 rt(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 ao(e){if(!i(e)||typeof e.created!="boolean")return r("human input create data must carry created:boolean");let t=rt(e.request);return t.ok?a({created:e.created,request:t.value}):t}function po(e){return!i(e)||e.acknowledged!==!0?r("human input acknowledge data must carry acknowledged:true"):a({acknowledged:!0})}var lo="ablehi-wfp-user-runtime-manifest/v1",co="unknown";function go(e){return e.endsWith(".js")?`${e.slice(0,-3)}.manifest.json`:`${e}.manifest.json`}var mo="/internal/deployment-handshake",ot=["start","terminate","send-event","start-webhook-watcher","run-polling-tick","invoke-tool","invoke-trigger-handler","invoke-webhook-protocol-adapter","deployment-handshake"],Ro=ot,_o="HANDSHAKE_REQUEST_INVALID",Io="HANDSHAKE_SECRET_UNCONFIGURED",yo="HANDSHAKE_SECRET_MISMATCH",To="HANDSHAKE_CONTRACT_VERSION_MISMATCH",xo="HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH",Eo="HANDSHAKE_CAPABILITY_MISSING";function wo(e){return[e.nonce,e.timestamp,e.contractVersion,e.dispatchNamespace].map(n=>`${n.length}:${n}`).join(".")}function Ao(e){return["response",e.nonce,e.contractVersion,e.dispatchNamespace,...e.capabilities].map(n=>`${n.length}:${n}`).join(".")}var So="platform.access",ho="platform.api_key.manage";var Oo="/me",No=()=>"/me";var it="/app/bootstrap",Do=()=>it;var pe="/workspaces",Fo="/",vo="/:workspaceId",st="/me/default-workspace",Uo=e=>`${pe}/${encodeURIComponent(e)}`,Lo=()=>pe,Bo=()=>st;var J="/api-keys",at="/grant-options",Ho="/:apiKeyId",Mo="ahi_key_",$o="workspace.full_access",Ko=()=>J,Wo=()=>`${J}${at}`,Vo=e=>`${J}/${encodeURIComponent(e)}`;var X="/catalog",jo="/integrations",Jo="/integrations/:slug",Xo="/versions",Yo="/integrations/:slug/default-provider-app-config",zo=e=>{let t=`${X}/integrations`;return e?.category!==void 0&&e.category!==""?`${t}?category=${encodeURIComponent(e.category)}`:t},pt=e=>`${X}/integrations/${encodeURIComponent(e)}`,Qo=()=>`${X}/versions`,Zo=e=>`${pt(e)}/default-provider-app-config`;var ti="/workspaces/:workspaceId/integrations",ni="/:installationId",ri="/:installationId/tools",ut=e=>`/workspaces/${encodeURIComponent(e)}/integrations`,lt=(e,t)=>`${ut(e)}/${encodeURIComponent(t)}`,oi=(e,t)=>`${lt(e,t)}/tools`;var si="/workspaces/:workspaceId",ai="/connections",pi="/integrations/:installationId/connect/start",ui="/integrations/:installationId/connect/options",li="/connect-sessions/:sessionId/submit",ci="/connect-sessions/:sessionId/complete",di="/integrations/:installationId/connections/:connectionRef",gi="/callbacks/redirect",E=e=>`/workspaces/${encodeURIComponent(e)}`,fi=e=>`${E(e)}/connections`,mi=(e,t)=>`${E(e)}/integrations/${encodeURIComponent(t)}/connect/start`,Ri=(e,t)=>`${E(e)}/integrations/${encodeURIComponent(t)}/connect/options`,_i=(e,t)=>`${E(e)}/connect-sessions/${encodeURIComponent(t)}/submit`,Ii=(e,t)=>`${E(e)}/connect-sessions/${encodeURIComponent(t)}/complete`,yi=(e,t,n)=>`${E(e)}/integrations/${encodeURIComponent(t)}/connections/${encodeURIComponent(n)}`;var xi="/workspaces/:workspaceId/flows",Ei="/validate",wi="/:flowId",Ai="/:flowId/enable",ki="/:flowId/disable",Si="/:flowId/draft",hi="/:flowId/versions",Pi="/:flowId/versions/:version",ue=e=>`/workspaces/${encodeURIComponent(e)}/flows`,Oi=e=>`${ue(e)}/validate`,L=(e,t)=>`${ue(e)}/${encodeURIComponent(t)}`,Ni=(e,t)=>`${L(e,t)}/enable`,Ci=(e,t)=>`${L(e,t)}/disable`,Di=(e,t)=>`${L(e,t)}/draft`,ct=(e,t)=>`${L(e,t)}/versions`,bi=(e,t,n)=>`${ct(e,t)}/${n}`;var vi="/workspaces/:workspaceId/agent",Ui="/chat",Li="/flow-context",Bi="/sessions",Gi="/sessions/:sessionId",Hi=e=>`/workspaces/${encodeURIComponent(e)}/agent/chat`,Mi=e=>`/workspaces/${encodeURIComponent(e)}/agent/sessions`,$i=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/sessions/${encodeURIComponent(t)}`,Ki=20,Wi=50,Vi=100,qi="flow_authoring",ji=["flow","flow_run","inbox_entry","integration"],Ji=256,Xi=10,Yi=256,zi=["getFlowContext","getWorkingFlowIr","setFlowMeta","addNode","updateNode","removeNode","setTrigger","removeTrigger","setOutputs","setComposition","validateFlow","proposePublish","requestConnect"],Qi=["setFlowMeta","addNode","updateNode","removeNode","setTrigger","removeTrigger","setOutputs","setComposition"];function Zi(e){return JSON.stringify(e)}var B={type:"object",properties:{},additionalProperties:!1},w={type:"object",additionalProperties:!0},dt=[{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:B},{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:B},{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:B},{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:B},{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 es(e){return dt.find(t=>t.name===e)}var ts="AGENT_RUNTIME_UNCONFIGURED",ns="AGENT_RUNTIME_FAILED",rs="AGENT_SESSION_NOT_FOUND",os="AGENT_MESSAGE_DELTA_INVALID",is="AGENT_PAGE_CONTEXT_INVALID",Y="/agent/assets",ss="/prompts",as="/prompts/:targetKey/:revision",ps="/prompts/:targetKey/:revision/validate",us="/prompts/:targetKey/:revision/activate",ls="/model-input-targets",cs="/model-input-targets/:targetKey/render-preview",ds="/model-input-snapshots",gs="/flow-scenes",fs="/flow-scenes/:sceneKey/:revision",ms="/flow-scenes/:sceneKey/:revision/validate",Rs="/flow-scenes/:sceneKey/:revision/activate",_s="/flow-scenes/:sceneKey/:revision/reindex",Is="/flow-templates",ys="/flow-templates/:templateKey/:revision",Ts="/flow-templates/:templateKey/:revision/validate",xs="/flow-templates/:templateKey/:revision/activate",Es="/flow-templates/:templateKey/:revision/reindex",ws="/flow-working-drafts/open",As="/flow-working-drafts/:draftId",ks="/flow-working-drafts/:draftId/commands",Ss="/flow-working-drafts/:draftId/edit-turn/acquire",hs="/flow-working-drafts/:draftId/edit-turn/release",Ps="/flow-working-drafts/:draftId/publish",Os="/flow-working-drafts/:draftId/readiness/check",Ns="/flow-working-drafts/:draftId/readiness/requirements/:requirementId/resolve",Cs="/flow-creation-tasks/:flowCreationTaskId",Ds="/flow-creation-decisions/:decisionRecordId",bs=()=>`${Y}/prompts`,Fs=()=>`${Y}/flow-scenes`,vs=()=>`${Y}/flow-templates`,Us=e=>`/workspaces/${encodeURIComponent(e)}/agent/flow-working-drafts/open`,A=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-working-drafts/${encodeURIComponent(t)}`,Ls=(e,t)=>`${A(e,t)}/commands`,Bs=(e,t)=>`${A(e,t)}/edit-turn/acquire`,Gs=(e,t)=>`${A(e,t)}/edit-turn/release`,Hs=(e,t)=>`${A(e,t)}/publish`,Ms=(e,t)=>`${A(e,t)}/readiness/check`,$s=(e,t,n)=>`${A(e,t)}/readiness/requirements/${encodeURIComponent(n)}/resolve`,Ks=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-creation-tasks/${encodeURIComponent(t)}`,Ws=(e,t)=>`/workspaces/${encodeURIComponent(e)}/agent/flow-creation-decisions/${encodeURIComponent(t)}`,Vs="agent.asset.manage",qs=/^[A-Za-z0-9_-]{1,64}$/,js="flow_create_authoring_task",gt="oneoff_getActionContext",ft="oneoff_executeAction",Js=[gt,ft],Xs=["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"],Ys="AGENT_ASSET_NOT_FOUND",zs="AGENT_ASSET_VALIDATION_FAILED",Qs="AGENT_PROMPT_TARGET_NOT_FOUND",Zs="AGENT_PROMPT_ACTIVE_REVISION_MISSING",ea="AGENT_PROMPT_REVISION_NOT_FOUND",ta="AGENT_PROMPT_REVISION_NOT_DRAFT",na="AGENT_PROMPT_VALIDATION_FAILED",ra="AGENT_MODEL_INPUT_TARGET_PROTECTED",oa="AGENT_MODEL_INPUT_PREVIEW_UNAVAILABLE",ia="AGENT_FLOW_GOAL_INVALID",sa="AGENT_FLOW_CREATION_TASK_NOT_FOUND",aa="AGENT_FLOW_CREATION_TASK_CONFLICT",pa="AGENT_FLOW_AUTHORING_WORKFLOW_FAILED",ua="FLOW_WORKING_DRAFT_NOT_FOUND",la="FLOW_DRAFT_REVISION_CONFLICT",ca="FLOW_DRAFT_COMMAND_INVALID",da="FLOW_DRAFT_EDIT_LOCKED",ga="FLOW_EDIT_TURN_NOT_HELD",fa="FLOW_DRAFT_NOT_PUBLISHABLE",ma="FLOW_PUBLISH_CONFIRMATION_REQUIRED",Ra="FLOW_READINESS_REQUIREMENT_NOT_FOUND",_a="FLOW_READINESS_REQUIREMENT_CONFLICT",Ia="AGENT_ASSET_INDEX_FAILED";var Ta="/workspaces/:workspaceId/runs",xa="/workspaces/:workspaceId/flows/:flowId/runs",Ea="/:runId",wa="/:runId/cancel",Aa="/:runId/events",mt=e=>`/workspaces/${encodeURIComponent(e)}/runs`,le=(e,t)=>`${mt(e)}/${encodeURIComponent(t)}`,ka=(e,t)=>`${le(e,t)}/cancel`,Sa=(e,t)=>`${le(e,t)}/events`,ha=(e,t)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/runs`,Pa=["queued","running","succeeded","failed","interrupted","cancelled"],Oa=["succeeded","skipped","timed_out","failed"];var Ca="/workspaces/:workspaceId/inbox/items",Da="/workspaces/:workspaceId/inbox/entries",ce="/inbox/entries",ba="/:itemId",Fa="/:entryId",va="/:entryId/human-input/submit",Rt=e=>`/workspaces/${encodeURIComponent(e)}/inbox/items`,Ua=(e,t)=>`${Rt(e)}/${encodeURIComponent(t)}`,_t=e=>`/workspaces/${encodeURIComponent(e)}/inbox/entries`,It=(e,t)=>`${_t(e)}/${encodeURIComponent(t)}`,La=(e,t)=>`${It(e,t)}/human-input/submit`,Ba=()=>ce,yt=e=>`${ce}/${encodeURIComponent(e)}`,Ga=e=>`${yt(e)}/human-input/submit`;var Ma="/human-input/tokens",$a="/:token",Ka="/:token/submit",Tt=e=>`/human-input/tokens/${encodeURIComponent(e)}`,Wa=e=>`${Tt(e)}/submit`;var qa="/:flowId/trigger-instances",ja="/:flowId/triggers/:triggerBindingId/simulate",Ja=(e,t)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/trigger-instances`,Xa=(e,t,n)=>`/workspaces/${encodeURIComponent(e)}/flows/${encodeURIComponent(t)}/triggers/${encodeURIComponent(n)}/simulate`;export{Y as AGENT_ASSETS_ROUTE_PREFIX,gs as AGENT_ASSET_FLOW_SCENES_SUBPATH,Rs as AGENT_ASSET_FLOW_SCENE_ACTIVATE_SUBPATH,fs as AGENT_ASSET_FLOW_SCENE_ITEM_SUBPATH,_s as AGENT_ASSET_FLOW_SCENE_REINDEX_SUBPATH,ms as AGENT_ASSET_FLOW_SCENE_VALIDATE_SUBPATH,Is as AGENT_ASSET_FLOW_TEMPLATES_SUBPATH,xs as AGENT_ASSET_FLOW_TEMPLATE_ACTIVATE_SUBPATH,ys as AGENT_ASSET_FLOW_TEMPLATE_ITEM_SUBPATH,Es as AGENT_ASSET_FLOW_TEMPLATE_REINDEX_SUBPATH,Ts as AGENT_ASSET_FLOW_TEMPLATE_VALIDATE_SUBPATH,Ia as AGENT_ASSET_INDEX_FAILED_ERROR_CODE,Vs as AGENT_ASSET_MANAGE_PERMISSION,ds as AGENT_ASSET_MODEL_INPUT_SNAPSHOTS_SUBPATH,ls as AGENT_ASSET_MODEL_INPUT_TARGETS_SUBPATH,cs as AGENT_ASSET_MODEL_INPUT_TARGET_PREVIEW_SUBPATH,Ys as AGENT_ASSET_NOT_FOUND_ERROR_CODE,ss as AGENT_ASSET_PROMPTS_SUBPATH,us as AGENT_ASSET_PROMPT_ACTIVATE_SUBPATH,as as AGENT_ASSET_PROMPT_ITEM_SUBPATH,ps as AGENT_ASSET_PROMPT_VALIDATE_SUBPATH,zs as AGENT_ASSET_VALIDATION_FAILED_ERROR_CODE,qi as AGENT_CAPABILITY_FLOW_AUTHORING,Ui as AGENT_CHAT_ROUTE_SUBPATH,js as AGENT_CREATE_FLOW_AUTHORING_TASK_TOOL_NAME,pa as AGENT_FLOW_AUTHORING_WORKFLOW_FAILED_ERROR_CODE,Li as AGENT_FLOW_CONTEXT_ROUTE_SUBPATH,Ds as AGENT_FLOW_CREATION_DECISION_ITEM_SUBPATH,aa as AGENT_FLOW_CREATION_TASK_CONFLICT_ERROR_CODE,Cs as AGENT_FLOW_CREATION_TASK_ITEM_SUBPATH,sa as AGENT_FLOW_CREATION_TASK_NOT_FOUND_ERROR_CODE,ia as AGENT_FLOW_GOAL_INVALID_ERROR_CODE,Ns as AGENT_FLOW_READINESS_REQUIREMENT_RESOLVE_SUBPATH,ks as AGENT_FLOW_WORKING_DRAFT_COMMANDS_SUBPATH,Ss as AGENT_FLOW_WORKING_DRAFT_EDIT_TURN_ACQUIRE_SUBPATH,hs as AGENT_FLOW_WORKING_DRAFT_EDIT_TURN_RELEASE_SUBPATH,As as AGENT_FLOW_WORKING_DRAFT_ITEM_SUBPATH,ws as AGENT_FLOW_WORKING_DRAFT_OPEN_SUBPATH,Ps as AGENT_FLOW_WORKING_DRAFT_PUBLISH_SUBPATH,Os as AGENT_FLOW_WORKING_DRAFT_READINESS_CHECK_SUBPATH,os as AGENT_MESSAGE_DELTA_INVALID_ERROR_CODE,oa as AGENT_MODEL_INPUT_PREVIEW_UNAVAILABLE_ERROR_CODE,Xs as AGENT_MODEL_INPUT_TARGET_KEYS,ra as AGENT_MODEL_INPUT_TARGET_PROTECTED_ERROR_CODE,is as AGENT_PAGE_CONTEXT_INVALID_ERROR_CODE,Xi as AGENT_PAGE_CONTEXT_MAX_RESOURCES,Yi as AGENT_PAGE_CONTEXT_RESOURCE_ID_MAX_LENGTH,Ji as AGENT_PAGE_CONTEXT_ROUTE_ID_MAX_LENGTH,ji as AGENT_PAGE_RESOURCE_TYPES,Zs as AGENT_PROMPT_ACTIVE_REVISION_MISSING_ERROR_CODE,ta as AGENT_PROMPT_REVISION_NOT_DRAFT_ERROR_CODE,ea as AGENT_PROMPT_REVISION_NOT_FOUND_ERROR_CODE,Qs as AGENT_PROMPT_TARGET_NOT_FOUND_ERROR_CODE,na as AGENT_PROMPT_VALIDATION_FAILED_ERROR_CODE,vi as AGENT_ROUTE_PREFIX,ns as AGENT_RUNTIME_FAILED_ERROR_CODE,qs as AGENT_RUNTIME_TOOL_NAME_PATTERN,ts as AGENT_RUNTIME_UNCONFIGURED_ERROR_CODE,Bi as AGENT_SESSIONS_ROUTE_SUBPATH,Vi as AGENT_SESSION_DETAIL_MESSAGE_LIMIT,Gi as AGENT_SESSION_ITEM_ROUTE_SUBPATH,Ki as AGENT_SESSION_LIST_DEFAULT_LIMIT,Wi as AGENT_SESSION_LIST_MAX_LIMIT,rs as AGENT_SESSION_NOT_FOUND_ERROR_CODE,J as API_KEYS_ROUTE_PREFIX,at as API_KEY_GRANT_OPTIONS_ROUTE_SUBPATH,Ho as API_KEY_ITEM_ROUTE_SUBPATH,Mo as API_KEY_TOKEN_PREFIX,$o as API_KEY_WORKSPACE_FULL_ACCESS_SCOPE,it as APP_BOOTSTRAP_ROUTE_PATH,Yo as CATALOG_DEFAULT_PROVIDER_APP_CONFIG_ROUTE_SUBPATH,jo as CATALOG_INTEGRATIONS_ROUTE_SUBPATH,Jo as CATALOG_INTEGRATION_DETAIL_ROUTE_SUBPATH,X as CATALOG_ROUTE_PREFIX,Xo as CATALOG_VERSIONS_ROUTE_SUBPATH,ai as CONNECTIONS_ROUTE_SUBPATH,di as CONNECTION_DISCONNECT_ROUTE_SUBPATH,ci as CONNECT_COMPLETE_ROUTE_SUBPATH,ui as CONNECT_OPTIONS_ROUTE_SUBPATH,pi as CONNECT_START_ROUTE_SUBPATH,li as CONNECT_SUBMIT_ROUTE_SUBPATH,ht as CONTEXT_STATE_CLEANUP_ROUTE_PATH,Oo as CURRENT_USER_ROUTE_PATH,st as DEFAULT_WORKSPACE_ROUTE_PATH,ot as DEPLOYMENT_HANDSHAKE_DISPATCHER_CAPABILITIES,Ro as DEPLOYMENT_HANDSHAKE_REQUIRED_CAPABILITIES,mo as DEPLOYMENT_HANDSHAKE_ROUTE,Qn as EGRESS_GRANT_AUDIT_ROUTE_SUBPATH,zn as EGRESS_GRANT_CONSUME_ROUTE_SUBPATH,Ue as EGRESS_GRANT_SCOPE_KINDS,Mt as EVENT_WAIT_ROUTE_SUBPATH,bt as EXECUTION_CONTEXT_ROUTE_SUBPATH,Hr as FILE_ACCESS_ROUTE_SUBPATH,Gr as FILE_COMPLETE_ROUTE_SUBPATH,$r as FILE_CONTENT_ROUTE_SUBPATH,Mr as FILE_STAT_ROUTE_SUBPATH,Br as FILE_UPLOAD_SESSION_ROUTE_SUBPATH,Qi as FLOW_AUTHORING_EDIT_TOOL_NAMES,dt as FLOW_AUTHORING_TOOL_DESCRIPTORS,zi as FLOW_AUTHORING_TOOL_NAMES,ki as FLOW_DISABLE_ROUTE_SUBPATH,ca as FLOW_DRAFT_COMMAND_INVALID_ERROR_CODE,da as FLOW_DRAFT_EDIT_LOCKED_ERROR_CODE,fa as FLOW_DRAFT_NOT_PUBLISHABLE_ERROR_CODE,la as FLOW_DRAFT_REVISION_CONFLICT_ERROR_CODE,Si as FLOW_DRAFT_ROUTE_SUBPATH,ga as FLOW_EDIT_TURN_NOT_HELD_ERROR_CODE,Ai as FLOW_ENABLE_ROUTE_SUBPATH,ge as FLOW_INTERPRETER_CONTRACT_VERSION,Et as FLOW_IR_SCHEMA_VERSION,wi as FLOW_ITEM_ROUTE_SUBPATH,ma as FLOW_PUBLISH_CONFIRMATION_REQUIRED_ERROR_CODE,_a as FLOW_READINESS_REQUIREMENT_CONFLICT_ERROR_CODE,Ra as FLOW_READINESS_REQUIREMENT_NOT_FOUND_ERROR_CODE,jn as FLOW_RUN_EGRESS_GRANT_ROUTE_SUBPATH,Ht as FLOW_RUN_RESULT_ROUTE_SUBPATH,yr as FLOW_RUN_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,Pa as FLOW_RUN_STATUSES,Ei as FLOW_VALIDATE_ROUTE_SUBPATH,hi as FLOW_VERSIONS_ROUTE_SUBPATH,Pi as FLOW_VERSION_ITEM_ROUTE_SUBPATH,ua as FLOW_WORKING_DRAFT_NOT_FOUND_ERROR_CODE,ce as GLOBAL_INBOX_ENTRIES_ROUTE_PREFIX,Zt as HANDLER_BUNDLES_ROUTE_SUBPATH,Eo as HANDSHAKE_CAPABILITY_MISSING,To as HANDSHAKE_CONTRACT_VERSION_MISMATCH,xo as HANDSHAKE_DISPATCH_NAMESPACE_MISMATCH,_o as HANDSHAKE_REQUEST_INVALID,yo as HANDSHAKE_SECRET_MISMATCH,Io as HANDSHAKE_SECRET_UNCONFIGURED,Zr as HUMAN_INPUTS_ROUTE_SUBPATH,no as HUMAN_INPUT_ACKNOWLEDGE_ROUTE_SUBPATH,to as HUMAN_INPUT_EXPIRE_ROUTE_SUBPATH,eo as HUMAN_INPUT_REQUEST_ROUTE_SUBPATH,Ye as HUMAN_INPUT_RESOLVED_EVENT_PREFIX,Ma as HUMAN_INPUT_TOKENS_ROUTE_PREFIX,$a as HUMAN_INPUT_TOKEN_ROUTE_SUBPATH,Ka as HUMAN_INPUT_TOKEN_SUBMIT_ROUTE_SUBPATH,va as INBOX_ENTRY_HUMAN_INPUT_SUBMIT_ROUTE_SUBPATH,Fa as INBOX_ENTRY_ROUTE_SUBPATH,ba as INBOX_ITEM_ROUTE_SUBPATH,ni as INTEGRATION_ITEM_ROUTE_SUBPATH,ri 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,$ as INTERNAL_INSTALLATIONS_ROUTE_PREFIX,P as INTERNAL_POLLING_TRIGGER_INSTANCES_ROUTE_PREFIX,V as INTERNAL_TOOL_INVOCATIONS_ROUTE_PREFIX,S as INTERNAL_WEBHOOK_TRIGGER_INSTANCES_ROUTE_PREFIX,ft as ONE_OFF_EXECUTE_ACTION_TOOL_NAME,gt as ONE_OFF_GET_ACTION_CONTEXT_TOOL_NAME,Js as ONE_OFF_TOOL_NAMES,So as PLATFORM_ACCESS_PERMISSION,ho as PLATFORM_API_KEY_MANAGE_PERMISSION,bn as POLLING_TRIGGER_CONTEXT_ROUTE_SUBPATH,Xn as POLLING_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,Fn as POLLING_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,xr as POLLING_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,vn as POLLING_TRIGGER_TICK_EVENTS_ROUTE_SUBPATH,gi as PROVIDER_CALLBACK_REDIRECT_ROUTE_PATH,hr as RUNTIME_CREDENTIAL_SESSION_SCOPE_KINDS,wa as RUN_CANCEL_ROUTE_SUBPATH,Aa as RUN_EVENTS_ROUTE_SUBPATH,Ea as RUN_ITEM_ROUTE_SUBPATH,de as SERVER_CONTRACT_VERSION,Gt as STEP_RESULT_ROUTE_SUBPATH,Oa as STEP_RUN_STATUSES,en as TOOL_HANDLER_BUNDLES_ROUTE_SUBPATH,Jn as TOOL_INVOCATION_EGRESS_GRANT_ROUTE_SUBPATH,Tr as TOOL_INVOCATION_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,qa as TRIGGER_INSTANCES_ROUTE_SUBPATH,ja as TRIGGER_SIMULATE_ROUTE_SUBPATH,xn as WEBHOOK_PROTOCOL_ADAPTER_BUNDLE_ROUTE_SUBPATH,wn as WEBHOOK_PROTOCOL_ADAPTER_MODULE,cn as WEBHOOK_TRIGGER_CONTEXT_ROUTE_SUBPATH,gn as WEBHOOK_TRIGGER_DELIVERY_ROUTE_SUBPATH,Yn as WEBHOOK_TRIGGER_EGRESS_GRANT_ROUTE_SUBPATH,fn as WEBHOOK_TRIGGER_EVENTS_ROUTE_SUBPATH,dn as WEBHOOK_TRIGGER_HANDLER_BUNDLES_ROUTE_SUBPATH,mn as WEBHOOK_TRIGGER_REARM_ROUTE_SUBPATH,Er as WEBHOOK_TRIGGER_RUNTIME_CREDENTIAL_ROUTE_SUBPATH,lo as WFP_USER_RUNTIME_MANIFEST_FORMAT_VERSION,co as WFP_USER_RUNTIME_UNKNOWN_SOURCE_REVISION,pe as WORKSPACES_ROUTE_PREFIX,vo as WORKSPACE_ACCESS_ROUTE_SUBPATH,si as WORKSPACE_CONNECTION_MOUNT_PREFIX,Me as WORKSPACE_FILES_ROUTE_PREFIX,xi as WORKSPACE_FLOWS_ROUTE_PREFIX,xa as WORKSPACE_FLOW_RUNS_ROUTE_PREFIX,Da as WORKSPACE_INBOX_ENTRIES_ROUTE_PREFIX,Ca as WORKSPACE_INBOX_ITEMS_ROUTE_PREFIX,ti as WORKSPACE_INTEGRATIONS_ROUTE_PREFIX,Fo as WORKSPACE_LIST_ROUTE_SUBPATH,Ta as WORKSPACE_RUNS_ROUTE_PREFIX,Fs as agentAssetFlowScenesPath,vs as agentAssetFlowTemplatesPath,bs as agentAssetPromptsPath,Hi as agentChatPath,Ws as agentFlowCreationDecisionPath,Ks as agentFlowCreationTaskPath,$s as agentFlowReadinessRequirementResolvePath,Ls as agentFlowWorkingDraftCommandsPath,Bs as agentFlowWorkingDraftEditTurnAcquirePath,Gs as agentFlowWorkingDraftEditTurnReleasePath,Us as agentFlowWorkingDraftOpenPath,A as agentFlowWorkingDraftPath,Hs as agentFlowWorkingDraftPublishPath,Ms as agentFlowWorkingDraftReadinessCheckPath,$i as agentSessionPath,Mi as agentSessionsPath,Wo as apiKeyGrantOptionsPath,Vo as apiKeyPath,Ko as apiKeysPath,Do as appBootstrapPath,Zo as catalogDefaultProviderAppConfigPath,pt as catalogIntegrationPath,zo as catalogIntegrationsPath,Qo as catalogVersionsPath,Ii as connectCompletePath,Ri as connectOptionsPath,mi as connectStartPath,_i as connectSubmitPath,yi as connectionDisconnectPath,r as contractParseFail,a as contractParseOk,No as currentUserPath,Bo as defaultWorkspacePath,wo as deploymentHandshakeProbePayload,Ao as deploymentHandshakeResponseProofPayload,or as egressGrantAuditPath,rr as egressGrantConsumePath,Wt as eventWaitPath,Ft as executionContextPath,es as findFlowAuthoringToolDescriptor,Ci as flowDisablePath,Di as flowDraftPath,Ni as flowEnablePath,L as flowPath,Zn as flowRunEgressGrantPath,Kt as flowRunResultPath,wr as flowRunRuntimeCredentialPath,ha as flowRunsPath,An as flowScriptProtocolAdapterModuleName,Oi as flowValidatePath,bi as flowVersionPath,ct as flowVersionsPath,Zi as formatFlowToolError,Ba as globalInboxEntriesPath,Ga as globalInboxEntryHumanInputSubmitPath,yt as globalInboxEntryPath,tn as handlerBundlesPath,oo as humanInputAcknowledgePath,ro as humanInputExpirePath,ie as humanInputRequestPath,io as humanInputResolvedEventType,Tt as humanInputTokenPath,Wa as humanInputTokenSubmitPath,Xe as humanInputsPath,La as inboxEntryHumanInputSubmitPath,It as inboxEntryPath,Ua as inboxItemPath,oi as installationToolsPath,qr as internalFileAccessPath,Vr as internalFileCompletePath,Jr as internalFileContentPath,jr as internalFileStatPath,Wr as internalFileUploadSessionPath,Kr as internalFilesPath,i as isJsonRecord,O as isValidRequestDigest,Yt as parseCompleteFlowRunWaitBody,Pt as parseContextStateCleanupRequestBody,Ot as parseContextStateCleanupResponseData,_ as parseContextStateScope,so as parseCreateHumanInputBody,lr as parseEgressGrantAuditBody,ur as parseEgressGrantConsumeBody,dr as parseEgressGrantConsumeData,cr as parseEgressGrantData,vt as parseExecutionContextData,j as parseFileAccessData,q as parseFileRefData,_e as parseFileRuntimeLimits,qe as parseFileUploadSessionData,ir as parseFlowActionGrantBody,jt as parseFlowRunResultBody,Jt as parseFlowRunResultData,Pr as parseFlowRuntimeCredentialBody,Ae as parseHandlerBundle,rn as parseHandlerBundlesData,po as parseHumanInputAcknowledgeData,ao as parseHumanInputCreateData,rt as parseHumanInputRequestViewData,Xr as parseInternalFileAccessData,Hn as parsePollingPublishBody,Nr as parsePollingRuntimeCredentialBody,Gn as parsePollingTriggerContext,ar as parsePollingTriggerGrantBody,Mn as parsePublishPollingTickEventsData,Xt as parseRegisterFlowRunWaitBody,zt as parseRegisterFlowRunWaitData,Dr as parseRuntimeCredentialSessionCredential,D as parseRuntimeNetwork,sr as parseSingleToolGrantBody,Or as parseSingleToolRuntimeCredentialBody,Vt as parseStepRecordBody,qt as parseStepRecordData,on as parseToolHandlerBundlesData,hn as parseTriggerHandlerBundlesData,Sn as parseWebhookDelivery,Pn as parseWebhookPublishEventsBody,On as parseWebhookRearmBody,Cr as parseWebhookRuntimeCredentialBody,pr as parseWebhookTriggerGrantBody,kn as parseWebhookWatcherContext,Un as pollingTriggerContextPath,tr as pollingTriggerEgressGrantPath,Ln as pollingTriggerHandlerBundlesPath,kr as pollingTriggerRuntimeCredentialPath,Bn as pollingTriggerTickEventsPath,Be as requestHasMultipartFileParts,ka as runCancelPath,Sa as runEventsPath,le as runPath,$t as stepResultPath,nn as toolHandlerBundlesPath,er as toolInvocationEgressGrantPath,Ar as toolInvocationRuntimeCredentialPath,Ja as triggerInstancesPath,Xa as triggerSimulatePath,En as webhookProtocolAdapterBundlePath,Rn as webhookTriggerContextPath,In as webhookTriggerDeliveryPath,nr as webhookTriggerEgressGrantPath,yn as webhookTriggerEventsPath,_n as webhookTriggerHandlerBundlesPath,Tn as webhookTriggerRearmPath,Sr as webhookTriggerRuntimeCredentialPath,go as wfpUserRuntimeManifestPath,fi as workspaceConnectionsPath,Ve as workspaceFileAccessPath,Ke as workspaceFileCompletePath,We as workspaceFileMetadataPath,$e as workspaceFileUploadSessionPath,ue as workspaceFlowsPath,_t as workspaceInboxEntriesPath,Rt as workspaceInboxItemsPath,lt as workspaceIntegrationPath,ut as workspaceIntegrationsPath,Uo as workspacePath,mt as workspaceRunsPath,Lo as workspacesPath};
|