eve 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +3 -3
- package/dist/src/chunks/{use-eve-agent-BNdcle_M.js → use-eve-agent-COmP-H8R.js} +6 -3
- package/dist/src/chunks/{use-eve-agent-FJkEMXYk.js → use-eve-agent-CnppTEFk.js} +6 -3
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/commands/trace-detail.d.ts +3 -2
- package/dist/src/cli/commands/trace-detail.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +4 -6
- package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -2
- package/dist/src/client/agent-info-schema.d.ts +12 -4
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/index.d.ts +1 -1
- package/dist/src/compiled/.vendor-stamp.json +3 -3
- package/dist/src/compiled/@chat-adapter/slack/index.js +1 -1
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/env-config.d.ts +1 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +92 -35
- package/dist/src/compiled/@workflow/world/index.d.ts +3 -2
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +25 -23
- package/dist/src/compiled/@workflow/world/queue.d.ts +4 -0
- package/dist/src/compiled/@workflow/world/runs.d.ts +4 -0
- package/dist/src/compiled/@workflow/world/slot-identity.d.ts +53 -0
- package/dist/src/compiled/@workflow/world/spec-version.d.ts +36 -1
- package/dist/src/compiled/@workflow/world/steps.d.ts +4 -0
- package/dist/src/compiled/@workflow/world/ulid.d.ts +6 -0
- package/dist/src/compiled/@workflow/world-local/index.js +4 -4
- package/dist/src/compiled/@workflow/world-vercel/index.js +13 -17
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-6OqdYdi4.js → attribute-changes-BoH7JsWp.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/dist-DlFv0aHY.js +40 -0
- package/dist/src/compiled/_chunks/workflow/env-config-DxamfI7T.js +1 -0
- package/dist/src/compiled/_chunks/workflow/frames-CTpeJYEQ.js +3 -0
- package/dist/src/compiled/_chunks/workflow/{functions-CXb61C6h.js → functions-CeeNvKsq.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-BPQHjeY5.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-DQ5dOyjm.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-id-BdE0MZz9.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-CzdoBiqy.js +1 -0
- package/dist/src/compiled/_chunks/workflow/spec-version-DBUVfF_R.js +1 -0
- package/dist/src/compiled/_chunks/workflow/undici-CUIybhQ2.js +95 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-DK2lnH6U.js +15 -0
- package/dist/src/compiled/_chunks/workflow/{wrapper-CDq65xJV.js → wrapper-CMGju7QA.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/ws-transport-Csi6Cydc.js +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +10 -10
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +8 -8
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-extension.d.ts +3 -3
- package/dist/src/compiler/normalize-extension.js +1 -1
- package/dist/src/compiler/normalize-instructions.d.ts +1 -1
- package/dist/src/compiler/normalize-instructions.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -3
- package/dist/src/context/dynamic-instruction-lifecycle.d.ts +5 -1
- package/dist/src/context/dynamic-instruction-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +6 -2
- package/dist/src/context/keys.js +1 -1
- package/dist/src/discover/manifest.d.ts +1 -1
- package/dist/src/discover/manifest.js +1 -1
- package/dist/src/evals/context.js +1 -1
- package/dist/src/evals/index.d.ts +2 -2
- package/dist/src/evals/reporters/index.d.ts +1 -1
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/runner/execute-eval.d.ts +5 -0
- package/dist/src/evals/runner/execute-eval.js +1 -1
- package/dist/src/evals/runner/execute-task.d.ts +3 -0
- package/dist/src/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/runner/reporters/braintrust.js +1 -1
- package/dist/src/evals/runner/reporters/types.d.ts +28 -2
- package/dist/src/evals/runner/run-evals.js +1 -1
- package/dist/src/evals/session.d.ts +12 -2
- package/dist/src/evals/session.js +1 -1
- package/dist/src/evals/target.js +1 -1
- package/dist/src/evals/types.d.ts +12 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/session.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/execution/workflow-trace-context.d.ts +11 -0
- package/dist/src/execution/workflow-trace-context.js +1 -0
- package/dist/src/harness/ai-sdk-hook-bridge.d.ts +1 -1
- package/dist/src/harness/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/harness/approval-delivery-coordinator.js +1 -1
- package/dist/src/harness/channel-delivery-instrumentation.d.ts +1 -1
- package/dist/src/harness/channel-delivery-instrumentation.js +1 -1
- package/dist/src/harness/emission.d.ts +2 -2
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/instrumentation/config.js +1 -0
- package/dist/src/harness/{instrumentation-content.d.ts → instrumentation/content.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-dispatch.d.ts → instrumentation/dispatch.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-dispatch.js → instrumentation/dispatch.js} +1 -1
- package/dist/src/harness/{instrumentation-lifecycle.d.ts → instrumentation/lifecycle.d.ts} +3 -6
- package/dist/src/harness/{instrumentation-lifecycle.js → instrumentation/lifecycle.js} +1 -1
- package/dist/src/harness/{instrumentation-native-events.d.ts → instrumentation/native-events.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-native-events.js → instrumentation/native-events.js} +1 -1
- package/dist/src/harness/{instrumentation-providers.d.ts → instrumentation/providers.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-providers.js → instrumentation/providers.js} +1 -1
- package/dist/src/harness/{instrumentation-runtime.d.ts → instrumentation/runtime.d.ts} +4 -2
- package/dist/src/harness/{instrumentation-state.d.ts → instrumentation/state.d.ts} +1 -1
- package/dist/src/harness/parent-lineage.d.ts +1 -1
- package/dist/src/harness/prepare-trace-context.d.ts +16 -0
- package/dist/src/harness/prepare-trace-context.js +1 -0
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/types.d.ts +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +2 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/core.d.ts +3 -3
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/helpers/markdown.js +1 -1
- package/dist/src/internal/instrumentation.d.ts +1 -1
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +4 -3
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
- package/dist/src/internal/vercel/project-link.d.ts +1 -1
- package/dist/src/internal/vercel/project-link.js +1 -1
- package/dist/src/internal/vercel-agent-summary.d.ts +10 -9
- package/dist/src/internal/vercel-agent-summary.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/protocol/message.d.ts +15 -1
- package/dist/src/protocol/message.js +1 -1
- package/dist/src/public/channels/github/auth.d.ts +30 -0
- package/dist/src/public/channels/github/auth.js +2 -2
- package/dist/src/public/channels/github/defaults.d.ts +4 -4
- package/dist/src/public/channels/github/defaults.js +1 -1
- package/dist/src/public/channels/github/dispatch.d.ts +3 -2
- package/dist/src/public/channels/github/dispatch.js +1 -1
- package/dist/src/public/channels/github/githubChannel.d.ts +7 -2
- package/dist/src/public/channels/github/githubChannel.js +1 -1
- package/dist/src/public/channels/github/index.d.ts +1 -1
- package/dist/src/public/definitions/instructions.d.ts +14 -4
- package/dist/src/public/definitions/instructions.js +1 -1
- package/dist/src/public/definitions/tool.d.ts +5 -8
- package/dist/src/public/instructions/index.d.ts +1 -2
- package/dist/src/public/instructions/index.js +1 -1
- package/dist/src/public/instrumentation/index.d.ts +4 -3
- package/dist/src/public/instrumentation/otel.d.ts +5 -4
- package/dist/src/public/instrumentation/provider.d.ts +2 -2
- package/dist/src/public/nuxt/module.js +1 -1
- package/dist/src/public/sveltekit/index.d.ts +6 -20
- package/dist/src/public/sveltekit/index.js +1 -1
- package/dist/src/public/sveltekit/routing.d.ts +0 -24
- package/dist/src/public/sveltekit/routing.js +1 -1
- package/dist/src/runtime/agent/bootstrap.d.ts +2 -0
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/prompt/compose.d.ts +1 -1
- package/dist/src/runtime/prompt/compose.js +3 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/types.d.ts +4 -3
- package/dist/src/setup/boxes/select-model.d.ts +6 -6
- package/dist/src/setup/boxes/select-model.js +1 -1
- package/dist/src/setup/project-resolution.d.ts +3 -3
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/slack-connect-lifecycle.d.ts +0 -9
- package/dist/src/setup/slack-connect-lifecycle.js +1 -1
- package/dist/src/setup/slackbot.d.ts +2 -1
- package/dist/src/setup/slackbot.js +1 -1
- package/dist/src/shared/default-agent-model.d.ts +1 -1
- package/dist/src/shared/default-agent-model.js +1 -1
- package/dist/src/shared/dynamic-tool-definition.d.ts +3 -4
- package/dist/src/shared/instructions-definition.d.ts +15 -11
- package/dist/src/{public/nuxt → shared}/vercel-services.d.ts +18 -19
- package/dist/src/shared/vercel-services.js +1 -0
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tracing/agent-action-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-action-instrumentation.js +1 -1
- package/dist/src/tracing/agent-approval-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-channel-delivery-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -1
- package/dist/src/tracing/agent-otel-provider.d.ts +4 -2
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-session-context.d.ts +17 -0
- package/dist/src/tracing/agent-otel-session-context.js +1 -0
- package/dist/src/tracing/agent-otel-usage.d.ts +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
- package/dist/src/tracing/agent-trace-state.d.ts +1 -1
- package/dist/src/tracing/install-instrumentation-runtime.d.ts +2 -2
- package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/local-instrumentation-runtime.d.ts +1 -1
- package/dist/src/tracing/local-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/local-traces.d.ts +3 -3
- package/dist/src/tracing/local-traces.js +1 -1
- package/dist/src/tracing/otel-declaration.d.ts +2 -2
- package/dist/src/tracing/otel-declaration.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/README.md +18 -20
- package/docs/agent-config.md +9 -6
- package/docs/channels/custom.mdx +1 -1
- package/docs/channels/eve.mdx +10 -56
- package/docs/channels/github.mdx +1 -1
- package/docs/channels/meta.json +1 -0
- package/docs/concepts/context-control.md +32 -56
- package/docs/concepts/default-harness.md +2 -2
- package/docs/concepts/execution-model-and-durability.mdx +4 -4
- package/docs/concepts/meta.json +3 -1
- package/docs/concepts/sessions-runs-and-streaming.md +23 -11
- package/docs/{guides → concepts}/state.md +3 -3
- package/docs/connections/mcp.mdx +6 -89
- package/docs/connections/meta.json +1 -0
- package/docs/connections/openapi.mdx +5 -69
- package/docs/connections/overview.mdx +29 -3
- package/docs/evals/meta.json +1 -0
- package/docs/evals/reporters.mdx +14 -4
- package/docs/extensions.md +1 -1
- package/docs/getting-started.mdx +175 -13
- package/docs/guides/auth-and-route-protection.md +3 -18
- package/docs/guides/client/messages.mdx +3 -1
- package/docs/guides/client/meta.json +2 -1
- package/docs/guides/client/output-schema.mdx +2 -2
- package/docs/guides/client/overview.mdx +1 -1
- package/docs/guides/deployment/meta.json +1 -0
- package/docs/guides/deployment/overview.md +1 -1
- package/docs/guides/deployment/self-hosting.md +3 -3
- package/docs/guides/deployment/vercel.mdx +1 -1
- package/docs/guides/dev-tui.md +3 -13
- package/docs/guides/dynamic-capabilities.md +64 -4
- package/docs/guides/frontend/meta.json +2 -1
- package/docs/guides/frontend/nextjs.mdx +1 -10
- package/docs/guides/frontend/nuxt.mdx +1 -10
- package/docs/guides/frontend/overview.mdx +12 -3
- package/docs/guides/frontend/sveltekit.mdx +23 -11
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +39 -126
- package/docs/guides/frontend/use-eve-agent-vue.mdx +40 -139
- package/docs/guides/instrumentation.md +15 -15
- package/docs/guides/meta.json +1 -5
- package/docs/guides/remote-agents.md +9 -9
- package/docs/guides/session-context.md +34 -103
- package/docs/install-integrations.mdx +1 -1
- package/docs/instructions.mdx +45 -12
- package/docs/meta.json +24 -13
- package/docs/patterns/dynamic-scheduling.md +1 -1
- package/docs/patterns/meta.json +1 -0
- package/docs/patterns/multi-tenant-approvals.md +1 -1
- package/docs/patterns/multi-tenant-auth.md +1 -1
- package/docs/patterns/multi-tenant-memory.md +4 -3
- package/docs/{guides → protocols}/acp.md +1 -1
- package/docs/protocols/meta.json +5 -0
- package/docs/reference/cli.md +39 -39
- package/docs/reference/meta.json +1 -1
- package/docs/reference/typescript-api.md +4 -2
- package/docs/sandbox.mdx +8 -0
- package/docs/{subagents.mdx → subagents/index.mdx} +2 -2
- package/docs/subagents/meta.json +5 -0
- package/docs/{guides/dynamic-workflows.md → subagents/workflow-tool.md} +6 -6
- package/docs/tools/human-in-the-loop.md +1 -1
- package/docs/tools/meta.json +1 -0
- package/docs/tools/overview.mdx +1 -1
- package/docs/tutorial/connect-a-warehouse.mdx +1 -1
- package/docs/tutorial/meta.json +1 -0
- package/docs/tutorial/remember-definitions.mdx +2 -2
- package/docs/tutorial/ship-it.mdx +2 -2
- package/package.json +4 -4
- package/dist/src/compiled/_chunks/workflow/dist-C8PhDW9B.js +0 -1
- package/dist/src/compiled/_chunks/workflow/functions-xMPAeWFr.js +0 -1
- package/dist/src/compiled/_chunks/workflow/node-Smb57EnG.js +0 -40
- package/dist/src/compiled/_chunks/workflow/resume-hook-BrduAuFX.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-CX7_sJnW.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-tsb2HjWK.js +0 -1
- package/dist/src/compiled/_chunks/workflow/undici-BNc_0O4m.js +0 -95
- package/dist/src/compiled/_chunks/workflow/wait-until-BYKVqrwc.js +0 -15
- package/dist/src/harness/instrumentation-config.js +0 -1
- package/dist/src/public/nuxt/vercel-services.js +0 -1
- package/dist/src/public/sveltekit/vercel-json.d.ts +0 -17
- package/dist/src/public/sveltekit/vercel-json.js +0 -1
- package/docs/installation.mdx +0 -66
- package/docs/project-structure.mdx +0 -53
- package/docs/reference/project-layout.md +0 -123
- /package/dist/src/harness/{instrumentation-config.d.ts → instrumentation/config.d.ts} +0 -0
- /package/dist/src/harness/{instrumentation-content.js → instrumentation/content.js} +0 -0
- /package/dist/src/harness/{instrumentation-runtime-context.d.ts → instrumentation/runtime-context.d.ts} +0 -0
- /package/dist/src/harness/{instrumentation-runtime-context.js → instrumentation/runtime-context.js} +0 -0
- /package/dist/src/harness/{instrumentation-runtime.js → instrumentation/runtime.js} +0 -0
- /package/dist/src/harness/{instrumentation-setup-context.d.ts → instrumentation/setup-context.d.ts} +0 -0
- /package/dist/src/harness/{instrumentation-setup-context.js → instrumentation/setup-context.js} +0 -0
- /package/dist/src/harness/{instrumentation-state.js → instrumentation/state.js} +0 -0
- /package/docs/{guides → protocols}/ucp.mdx +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-DaDcL9Zw.js";import{A as t,Hn as n,L as r,Nn as i,Pn as a,S as o,Wn as s,Z as c,_t as l,a as u,bn as ee,cn as d,ct as f,gt as p,jn as m,n as h,ot as g,sr as _,t as v,tr as y,vt as b,w as x,xt as S}from"./wait-until-DK2lnH6U.js";import{D as C,d as w,n as T,o as E,r as D}from"./dist-CRTn4Sg8.js";import{I as O,o as k}from"./dist-DlFv0aHY.js";import{t as A}from"./spec-version-DBUVfF_R.js";var j=e({getHookByToken:()=>R,resumeHook:()=>z,resumeWebhook:()=>V});const M=k();async function N(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e of n)r+=e.toString(16).padStart(2,`0`);return r}function P(e){let t=e.executionContext?.workflowCoreVersion,n=e.executionContext?.traceCarrier,r=e.executionContext?.hookResumeInputVersion;return{deploymentId:e.deploymentId,workflowName:e.workflowName,runSpecVersion:e.specVersion,workflowCoreVersion:typeof t==`string`?t:void 0,traceCarrier:n&&typeof n==`object`?n:void 0,encryptionPublicKey:e.encryptionPublicKey,hookResumeInputVersion:typeof r==`number`?r:void 0}}async function F(e){if(e.resumeContext)return{resumeContext:e.resumeContext,source:`hook`};let t=await(await s()).runs.get(e.runId);return{resumeContext:P(t),source:`run_fallback`,run:t}}async function I(e,t){let n=await s(),r=t.run?await n.getEncryptionKeyForRun?.(t.run):await n.getEncryptionKeyForRun?.(e.runId,{deploymentId:t.resumeContext.deploymentId});return r?await _(r):void 0}async function L(e){let t=await s(),n=await t.hooks.getByToken(e),i;if(n.metadata!==void 0){let e=await F(n),a=e.run?await t.getEncryptionKeyForRun?.(e.run):await t.getEncryptionKeyForRun?.(n.runId,{deploymentId:e.resumeContext.deploymentId});i=a?await m(a):void 0,n.metadata=await r(n.metadata,n.runId,i)}return{hook:n,encryptionKey:i}}async function R(e){let{hook:t}=await L(e);return t}async function z(e,t,n){return B(e,t,n,!1)}async function B(e,r,m,_){return await h(()=>f(`hook.resume`,async f=>{let h=await s();try{let s=typeof e==`string`,p=s?await h.hooks.getByToken(e):e,y=s||_,C=await F(p),{resumeContext:T}=C;if(f?.setAttributes({...S(p.token),...l(p.hookId),...ee(p.runId),"workflow.hook.resume_context_source":C.source}),C.run&&O(C.run.status))throw new E(p.token);let k=x(T.workflowCoreVersion),j,P=m?void 0:n(T.encryptionPublicKey);if(P)j=i(P);else{let e=m??await I(p,C);k.supportedFormats.has(a.ENCRYPTED)||(e=void 0),j=e}let L=(T.runSpecVersion??0)>=5&&k.supportedFormats.has(a.GZIP),R=[],z=A(p.specVersion),B=await t(r,p.runId,j,R,globalThis,z,k.framedByteStreams,L);v(Promise.all(R),e=>{e!==void 0&&c.warn(`Background flush of hook payload ops failed`,{workflowRunId:p.runId,hookId:p.hookId,error:e instanceof Error?e.message:String(e)})}),f?.setAttributes({...d(T.workflowName)});let V=await g(T.traceCarrier);V&&f?.addLink?.(V);let H={...z?{}:{token:p.token},payload:B},U=u(T.workflowName),W={deploymentId:T.deploymentId,specVersion:T.runSpecVersion??1},G=process.env.WORKFLOW_DISABLE_LAZY_HOOK_RESUME===`1`,K=(y?p.resumeCapabilities?.hookResumeDedupVersion??0:0)>=1||h.capabilities?.hookResumeDedup===!0,q=G?`disabled`:K?(T.hookResumeInputVersion??0)<1?`consumer_unsupported`:z?`legacy`:(T.runSpecVersion??0)<3?`non_cbor_transport`:B instanceof Uint8Array?B.byteLength>131072?`oversized`:null:`non_bytes`:`backend_unsupported`,J=q===null;f?.setAttributes({"workflow.hook.resume_strategy":J?`parallel`:`sequential`,...q?{"workflow.hook.resume_fallback_reason":q}:{}});let te=e=>E.is(e)||D.is(e)||w.is(e);if(!J){try{await h.events.create(p.runId,{eventType:`hook_received`,specVersion:5,correlationId:p.hookId,eventData:H},{v1Compat:z})}catch(e){throw te(e)?new E(p.token):e}return await h.queue(U,{runId:p.runId,traceCarrier:T.traceCarrier??void 0},W),p}let Y=M(),X=await N(B);f?.setAttributes({"workflow.hook.resume_id":Y});let[Z,Q]=await Promise.allSettled([h.events.create(p.runId,{eventType:`hook_received`,specVersion:5,correlationId:p.hookId,eventData:H},{v1Compat:z,resumeId:Y,resumePayloadDigest:X}),h.queue(U,{runId:p.runId,traceCarrier:T.traceCarrier??void 0,hookInput:{resumeId:Y,hookId:p.hookId,token:p.token,payload:B,payloadDigest:X,deploymentId:T.deploymentId}},W)]);if(Q.status===`rejected`)throw Q.reason;let $=!1;if(Z.status===`rejected`){let e=Z.reason;if(E.is(e)||w.is(e))throw new E(p.token);if(D.is(e)||o(e))$=!0,f?.setAttributes({...b(!0),"workflow.hook.resume_event_write_recovered":!0,"workflow.hook.resume_event_write_error":e instanceof Error?e.name:`unknown`}),c.warn(`Hook resume event write failed, but the run was re-triggered via the queue. The hook_received event will be ensured by the queue consumer.`,{workflowRunId:p.runId,hookId:p.hookId,resumeId:Y,error:e instanceof Error?e.message:String(e)});else throw e}return $?{...p,resilientResume:!0}:p}catch(t){throw f?.setAttributes({...S(typeof e==`string`?e:e.token),...p(!1)}),t}}))}async function V(e,t){let{hook:n,encryptionKey:r}=await L(e);if(n.isWebhook===!1)throw new E(e);let i,a;if(n.metadata&&typeof n.metadata==`object`&&`respondWith`in n.metadata)if(n.metadata.respondWith===`manual`){let{readable:e,writable:n}=new TransformStream;a=e,t[y]=n}else if(n.metadata.respondWith instanceof Response)i=n.metadata.respondWith;else throw new C(`Invalid \`respondWith\` value: ${n.metadata.respondWith}`,{slug:T.WEBHOOK_INVALID_RESPOND_WITH_VALUE});else i=new Response(null,{status:202});if(await B(n,t,r,!0),a){let e=a.getReader(),t=await e.read();t.value&&(i=t.value),e.cancel()}if(!i)throw new C(`Workflow run did not send a response`,{slug:T.WEBHOOK_RESPONSE_NOT_SENT});return i}export{j as i,z as n,V as r,R as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as e,Gn as t,Hn as n,I as r,Nn as i,P as a,Pn as o,Qt as s,Rn as c,S as l,Sn as u,Un as d,V as f,Vn as ee,Wn as p,X as m,Y as h,Z as g,a as _,b as te,bn as ne,cn as re,ct as v,dt as ie,j as y,jn as b,ln as ae,mr as x,n as S,s as C,sr as oe,st as se,t as ce,w as le,zn as w}from"./wait-until-DK2lnH6U.js";import{C as T,D as E,E as D,T as O,r as k,w as A}from"./dist-CRTn4Sg8.js";import{t as j}from"./attribute-changes-BoH7JsWp.js";import{J as M,Y as N,i as ue,o as P}from"./dist-DlFv0aHY.js";import{t as F}from"./env-config-DxamfI7T.js";import{t as I}from"./spec-version-DBUVfF_R.js";const L=[`node`,`quickjs`];function R(e=process.env){let t=e.WORKFLOW_VM;if(!(t===void 0||t===``)){if(L.includes(t))return t;throw new E(`Invalid WORKFLOW_VM value: "${t}". Expected one of: ${L.join(`, `)}.`)}}function z(e){let t=e.executionContext?.workflowVm;if(t!==void 0){if(!L.includes(t))throw new E(`Invalid executionContext.workflowVm value: "${t}". Expected one of: ${L.join(`, `)}.`);return t===`quickjs`}return R()===`quickjs`}const de=P();function B(){let e=m.getStore(),t=e?.workflowMetadata?.workflowRunId;if(t)return{[N]:e.rootRunId??t,[M]:t}}let V=!1;async function H(e,r,a){"use step";return await S(()=>{let c=e?.workflowId;if(!c)throw new E(`'start' received an invalid workflow function. Ensure the Workflow SDK is configured correctly and the function includes a 'use workflow' directive.`,{slug:`start-invalid-workflow-function`});return v(`workflow.start ${x(c)}`,async e=>{e?.setAttributes({...re(c),...ae(`start`)});let f=[],m=a??{};Array.isArray(r)?f=r:typeof r==`object`&&(m=r),e?.setAttributes({...s(f.length)});let h=m.world??await p();t(h);let v=await h.getDeploymentId(),b=m.deploymentId??v;b===`latest`&&(h.resolveLatestDeploymentId?b=await h.resolveLatestDeploymentId():(V||(V=!0,g.warn(`deploymentId: 'latest' has no effect in this world and was ignored. It is only supported by worlds with atomic deployments, such as Vercel. The run will target the current deployment.`,{currentDeploymentId:v})),b=v));let x=`wrun_${h.createRunId?h.createRunId(m):de()}`,S,w,T,D;if(b===v)S=!0,w=!0,T=1;else if(typeof h.streams?.get!=`function`)S=!1,w=!1,T=void 0;else{let e=await C(h,{deploymentId:b,runId:x,timeout:2e3,namespace:m.namespace}).catch(()=>void 0);D=e?.encryptionPublicKey;let t=le(e?.workflowCoreVersion);S=t.framedByteStreams,w=t.supportedFormats.has(o.GZIP),T=e?.hookResumeInputVersion}let O=[],A=await se(),M=m.specVersion??h.specVersion,N=I(M),P=m.allowReservedAttributes===!0,F;if(m.attributes&&Object.keys(m.attributes).length>0){if(M<4)throw new E(`Initial workflow attributes require a World that supports spec version 4 or later.`);for(let[e,t]of Object.entries(m.attributes))if(typeof t!=`string`)throw new E(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=j(m.attributes,{allowReservedAttributes:P});F=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let L=M>=4?B():void 0,z=L?{...L,...F}:F,H=z?{attributes:z,...P||L!=null?{allowReservedAttributes:!0}:{}}:{};if(m.replayedFromRunId!==void 0&&!ue.safeParse(m.replayedFromRunId).success)throw new E(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(m.replayedFromRunId).slice(0,64))}.`);let U=n(D),W,G;if(U)W=i(U),G=D;else{let e=await h.getEncryptionKeyForRun?.(x,{...m,deploymentId:b});W=e?await oe(e):void 0,G=e?ee((await d(e)).publicKey):void 0}let K=await y(f,x,W,O,globalThis,N,S,w&&M>=5),q=h.getEnvironment?.(),J=R(),Y={traceCarrier:A,workflowCoreVersion:te,features:{encryption:!!W},...T===void 0?{}:{hookResumeInputVersion:T},...J?{workflowVm:J}:{},...m.replayedFromRunId?{replayedFromRunId:m.replayedFromRunId}:{}},[X,Z]=await Promise.allSettled([h.events.create(x,{eventType:`run_created`,specVersion:M,eventData:{deploymentId:b,workflowName:c,input:K,executionContext:Y,...G?{encryptionPublicKey:G}:{},...H}},{v1Compat:N}),h.queue(_(c,m.namespace),{runId:x,traceCarrier:A,...M>=3?{runInput:{input:K,deploymentId:b,workflowName:c,specVersion:M,executionContext:Y,...G?{encryptionPublicKey:G}:{},...q===void 0?{}:{environment:q},...H}}:{}},{deploymentId:b,specVersion:M,...m.region===void 0?{}:{region:m.region}})]);if(Z.status===`rejected`)throw Z.reason;let $=!1;if(X.status===`rejected`){let e=X.reason;if(!k.is(e))if(l(e))$=!0,g.warn(`Run creation event failed, but the run was accepted via the queue. The run_created event will be re-tried async by the runtime.`,{workflowRunId:x,error:e.message});else throw e}else{let e=X.value;if(!N&&e.run.runId!==x)throw new E(`Server returned different runId than requested: expected ${x}, got ${e.run.runId}`)}return ce(Promise.all(O),e=>{g.warn(`Background flush of workflow argument streams failed`,{workflowRunId:x,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...ne(x),...ie(b),...X.status===`fulfilled`?u(X.value.run.status):{}}),new Q(x,{resilientStart:$})})})}const U=e=>Array.isArray(e)?e:[e];async function W(t,n,r={}){try{let i=await t.runs.get(n,{resolveData:`all`}),a=await t.getEncryptionKeyForRun?.(i),o=a?await b(a):void 0,s=U(await e(i.input,n,o,globalThis)),c=r.specVersion??i.specVersion??1,l=r.deploymentId??i.deploymentId;return(await H({workflowId:i.workflowName},s,{deploymentId:l,world:t,specVersion:c,replayedFromRunId:n,namespace:r.namespace})).runId}catch(e){throw Error(`Failed to recreate run from ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function G(e,t,n){try{let r=(await e.runs.get(t,{resolveData:`none`})).specVersion??1,i=I(r),a={eventType:`run_cancelled`,specVersion:r,...n?.cancelReason===void 0?{}:{eventData:{cancelReason:n.cancelReason}}};await e.events.create(t,a,{v1Compat:i})}catch(e){throw Error(`Failed to cancel run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function K(e,t,n){if(t.length===0)throw Error(`cancelRuns requires at least one run ID.`);if(t.length>500)throw Error(`cancelRuns accepts at most 500 run IDs (received ${t.length}).`);if(new Set(t).size!==t.length)throw Error(`cancelRuns requires unique run IDs (duplicates found).`);if(e.runs.cancelMany)return e.runs.cancelMany({runIds:t,...n?.cancelReason===void 0?{}:{cancelReason:n.cancelReason}});let r=Array(t.length),i=0,a=async()=>{for(;;){let a=i++;if(a>=t.length)return;let o=t[a];try{await G(e,o,n),r[a]={runId:o,outcome:`cancelled`}}catch{r[a]={runId:o,outcome:`failed`,code:`internal_error`,retryable:!0}}}},o=Math.min(20,t.length);await Promise.all(Array.from({length:o},()=>a()));let s={requested:t.length,cancelled:0,alreadyCancelled:0,notCancellable:0,notFound:0,failed:0};for(let e of r)switch(e.outcome){case`cancelled`:s.cancelled++;break;case`already_cancelled`:s.alreadyCancelled++;break;case`not_cancellable`:s.notCancellable++;break;case`not_found`:s.notFound++;break;case`failed`:s.failed++;break}return{summary:s,results:r}}async function q(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(_(r.workflowName,n?.namespace),{runId:t},{deploymentId:r.deploymentId,specVersion:r.specVersion??1})}catch(e){throw Error(`Failed to re-enqueue run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function J(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`}),i=I(r.specVersion),a=[],o=null;do{let n=await e.events.list({runId:t,pagination:{sortOrder:`asc`,...o?{cursor:o}:{}},resolveData:`none`});a.push(...n.data),o=n.hasMore?n.cursor:null}while(o);let s=a.filter(e=>e.eventType===`wait_created`),c=new Set(a.filter(e=>e.eventType===`wait_completed`).map(e=>e.correlationId)),l=s.filter(e=>!c.has(e.correlationId));if(n?.correlationIds&&n.correlationIds.length>0){let e=new Set(n.correlationIds);l=l.filter(t=>t.correlationId&&e.has(t.correlationId))}let u=[],d=0;for(let n of l){if(!n.correlationId)continue;let a=i?{eventType:`wait_completed`,correlationId:n.correlationId}:{eventType:`wait_completed`,correlationId:n.correlationId,specVersion:r.specVersion,eventData:{resumeAt:n.eventData.resumeAt}};try{await e.events.create(t,a,{v1Compat:i}),d++}catch(e){k.is(e)?d++:u.push(e instanceof Error?e:Error(String(e)))}}if(d>0&&await e.queue(_(r.workflowName,n?.namespace),{runId:t},{deploymentId:r.deploymentId,specVersion:r.specVersion??1}),u.length>0)throw AggregateError(u,`Failed to complete ${u.length}/${l.length} pending wait(s) for run ${t}`);return{stoppedCount:d}}catch(e){throw e instanceof AggregateError?e:Error(`Failed to wake up run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function Y(e,t,n,r){try{return await e.streams.get(t,n,r?.startIndex)}catch(e){throw Error(`Failed to read stream ${n}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function X(e,t){try{return await e.streams.list(t)}catch(e){throw Error(`Failed to list streams for run ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}function Z(){return F(`WORKFLOW_RETURN_VALUE_POLL_INTERVAL_MS`,1e3,{integer:!0,min:1})}var Q=class e{static[w](e){return{runId:e.runId,resilientStart:e.#r}}static[c](t){return new e(t.runId,{resilientStart:t.resilientStart})}runId;#e;get#t(){return this.#e||=p(),this.#e}#n=null;#r=!1;constructor(e,t){this.runId=e,this.#r=t?.resilientStart??!1}#i(){return this.#n||=(async()=>{let e=await this.#t,t=await e.runs.get(this.runId),n=await e.getEncryptionKeyForRun?.(t);return n?await b(n):void 0})(),this.#n}#a(){return()=>this.#i()}async wakeUp(e){"use step";return J(await this.#t,this.runId,e)}async cancel(e){"use step";await(await this.#t).events.create(this.runId,{eventType:`run_cancelled`,specVersion:5,...e?.cancelReason===void 0?{}:{eventData:{cancelReason:e.cancelReason}}})}get exists(){"use step";return this.#t.then(e=>e.runs.get(this.runId,{resolveData:`none`}).then(()=>!0).catch(e=>{if(D.is(e))return!1;throw e}))}get status(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.status))}get returnValue(){"use step";return this.#o()}get workflowName(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.workflowName))}get createdAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.createdAt))}get startedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.startedAt))}get completedAt(){"use step";return this.#t.then(e=>e.runs.get(this.runId).then(e=>e.completedAt))}get readable(){return this.getReadable()}getReadable(e={}){"use step";let{ops:t=[],global:n=globalThis,startIndex:r,namespace:i}=e,o=h(this.runId,i),s=this.#a(),c=a(n,t,this.runId,s).ReadableStream({name:o,startIndex:r}),l=this.#t,u=this.runId;return Object.assign(c,{getTailIndex:async()=>(await(await l).streams.getInfo(u,o)).tailIndex})}async#o(){let e=await this.#t,t=0,n=this.#r?3:0,i=[1e3,3e3,6e3];for(;;)try{let t=await e.runs.get(this.runId);if(t.status===`completed`){let e=await this.#i();return await f(t.output,this.runId,e)}if(t.status===`cancelled`)throw new T(this.runId);if(t.status===`failed`){let e=await this.#i(),n;try{n=await r(t.error,this.runId,e)}catch{n=Error(`Failed to hydrate workflow run error`)}throw new A(this.runId,n,{errorCode:t.errorCode})}throw new O(this.runId,t.status)}catch(e){if(O.is(e)){await new Promise(e=>setTimeout(e,Z()));continue}if(D.is(e)&&t<n){let e=i[t];t++,await new Promise(t=>setTimeout(t,e));continue}throw e}}};function $(e){return new Q(e)}export{X as a,q as c,z as d,K as i,J as l,$ as n,Y as o,G as r,W as s,Q as t,H as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`,t=(()=>{let t=new Int8Array(128).fill(-1);for(let n=0;n<32;n++)t[e.charCodeAt(n)]=n;for(let n=0;n<32;n++){let r=e[n].toLowerCase();r!==e[n]&&(t[r.charCodeAt(0)]=n)}return t})();function n(e){if(typeof e!=`string`)throw TypeError(`Expected ULID string, got ${typeof e}`);if(e.length!==26)throw Error(`Invalid ULID length: expected 26, got ${e.length}`);let n=new Uint8Array(26);for(let r=0;r<26;r++){let i=e.charCodeAt(r),a=i<128?t[i]:-1;if(a<0)throw Error(`Invalid Crockford-Base32 character at index ${r}: ${JSON.stringify(e[r])}`);n[r]=a}if(n[0]&24)throw Error(`Invalid ULID: top 2 bits must be zero (first char > '7'): ${JSON.stringify(e[0])}`);let r=new Uint8Array(16),i=n[0]&7,a=3,o=0;for(let e=1;e<26;e++)for(i=i<<5|n[e],a+=5;a>=8;)a-=8,r[o++]=i>>a&255;if(o!==16||a!==0)throw Error(`Internal error: ULID bit packing did not consume cleanly`);return r}function r(t){if(t.length!==16)throw Error(`Invalid byte length: expected 16, got ${t.length}`);let n=0,r=0;n=0,r=2;let i=``;for(let a=0;a<16;a++)for(n=n<<8|t[a],r+=8;r>=5;)r-=5,i+=e[n>>r&31];if(i.length!==26||r!==0)throw Error(`Internal error: ULID bit packing did not flush cleanly`);return i}const i={unknown:0,iad1:1,sfo1:2,pdx1:3,cle1:4,yul1:5,gru1:6,dub1:7,lhr1:8,cdg1:9,fra1:10,bru1:11,arn1:12,hel1:13,zrh1:14,cpt1:15,dxb1:16,bom1:17,sin1:18,hkg1:19,hnd1:20,icn1:21,kix1:22,syd1:23},a=`iad1`,o=new Map(Object.entries(i).filter(e=>e[0]!==`unknown`).map(([e,t])=>[t,e]));function s(e){return o.get(e)??null}function c(e){return e!==void 0&&e!==`unknown`&&Object.hasOwn(i,e)}function l(e){return typeof e==`string`&&e!==`unknown`&&Object.hasOwn(i,e)}function u(e,t,a={}){let o;if(typeof t==`number`){if(!Number.isInteger(t)||t<0||t>63)throw RangeError(`regionId must be an integer in [0, 63]; got ${t}`);o=t}else if(l(t))o=i[t];else throw Error(`Unknown region: ${String(t)}`);let s=a.version??1;if(!Number.isInteger(s)||s<0||s>31)throw RangeError(`version must be an integer in [0, 31]; got ${s}`);let c=n(e);c[0]|=128;let u=(o&63)<<2,d=s>>3&3,f=(s&7)<<5;return c[6]=c[6]&-256|u|d,c[7]=c[7]&-225|f,r(c)}function d(e){let t=n(e),i=(t[0]&128)!=0;t[0]&=-129;let a=r(t);if(!i)return{tagged:!1,ulid:a,version:null,regionId:null,region:null};let o=(t[6]&252)>>2;return{tagged:!0,ulid:a,version:(t[6]&3)<<3|(t[7]&224)>>5,regionId:o,region:s(o)}}export{c as a,i,u as n,r as o,a as r,n as s,d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ar as e}from"./wait-until-DK2lnH6U.js";import{i as t}from"./attribute-changes-BoH7JsWp.js";async function n(r){let i=globalThis[e];return i||t(`sleep()`,`https://workflow-sdk.dev/docs/api-reference/workflow/sleep`,n),i(r)}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e==null||e<=1}function t(e){return e!=null&&e>6}export{t as n,e as t};
|