eve 0.27.11 → 0.27.13

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.
Files changed (122) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/src/chunks/{use-eve-agent-CTJrwXM2.js → use-eve-agent-CWYe-vqE.js} +29 -18
  3. package/dist/src/chunks/{use-eve-agent-DaWxEtnE.js → use-eve-agent-CsSQOKnp.js} +29 -18
  4. package/dist/src/cli/commands/channels.js +1 -1
  5. package/dist/src/cli/commands/integration-setup.js +1 -1
  6. package/dist/src/cli/commands/register-registry-commands.js +1 -1
  7. package/dist/src/cli/commands/registry-setup-command.d.ts +5 -3
  8. package/dist/src/cli/commands/registry-setup-command.js +1 -1
  9. package/dist/src/cli/commands/registry.d.ts +9 -3
  10. package/dist/src/cli/commands/registry.js +1 -1
  11. package/dist/src/cli/dev/tui/remote-connection-probe.js +1 -1
  12. package/dist/src/cli/dev/tui/runner.js +1 -1
  13. package/dist/src/cli/dev/tui/target.d.ts +3 -15
  14. package/dist/src/cli/dev/tui/tui.js +1 -1
  15. package/dist/src/cli/invoke/command.d.ts +32 -0
  16. package/dist/src/cli/invoke/command.js +1 -0
  17. package/dist/src/cli/invoke/invoke.d.ts +27 -0
  18. package/dist/src/cli/invoke/invoke.js +1 -0
  19. package/dist/src/cli/invoke/result.d.ts +313 -0
  20. package/dist/src/cli/invoke/result.js +1 -0
  21. package/dist/src/cli/run.d.ts +2 -0
  22. package/dist/src/cli/run.js +3 -3
  23. package/dist/src/client/client.js +1 -1
  24. package/dist/src/client/message-response.js +1 -1
  25. package/dist/src/client/session-utils.d.ts +21 -15
  26. package/dist/src/client/session-utils.js +1 -1
  27. package/dist/src/client/session.js +1 -1
  28. package/dist/src/compiled/.vendor-stamp.json +5 -5
  29. package/dist/src/compiled/@workflow/core/capabilities.d.ts +6 -0
  30. package/dist/src/compiled/@workflow/core/encryption.d.ts +15 -2
  31. package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +26 -0
  32. package/dist/src/compiled/@workflow/core/index.d.ts +1 -1
  33. package/dist/src/compiled/@workflow/core/index.js +2 -2
  34. package/dist/src/compiled/@workflow/core/private.d.ts +76 -33
  35. package/dist/src/compiled/@workflow/core/private.js +1 -1
  36. package/dist/src/compiled/@workflow/core/replay-payload-cache.d.ts +3 -2
  37. package/dist/src/compiled/@workflow/core/runtime/count-step-started-events.d.ts +52 -0
  38. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +41 -12
  39. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +2 -2
  40. package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +9 -8
  41. package/dist/src/compiled/@workflow/core/runtime/world.d.ts +2 -7
  42. package/dist/src/compiled/@workflow/core/runtime.d.ts +1 -1
  43. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  44. package/dist/src/compiled/@workflow/core/sealed-box.d.ts +167 -0
  45. package/dist/src/compiled/@workflow/core/serialization/client.d.ts +3 -3
  46. package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +6 -4
  47. package/dist/src/compiled/@workflow/core/serialization/encryption.d.ts +118 -17
  48. package/dist/src/compiled/@workflow/core/serialization/step.d.ts +4 -4
  49. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +20 -0
  50. package/dist/src/compiled/@workflow/core/serialization-format.d.ts +44 -4
  51. package/dist/src/compiled/@workflow/core/serialization.d.ts +21 -21
  52. package/dist/src/compiled/@workflow/core/set-attributes.d.ts +2 -7
  53. package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +2 -2
  54. package/dist/src/compiled/@workflow/core/symbols.d.ts +23 -10
  55. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +4 -4
  56. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  57. package/dist/src/compiled/@workflow/core/workflow/abort-controller.d.ts +1 -1
  58. package/dist/src/compiled/@workflow/core/workflow/index.d.ts +1 -1
  59. package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +0 -9
  60. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  61. package/dist/src/compiled/@workflow/errors/index.d.ts +1 -1
  62. package/dist/src/compiled/@workflow/world/events.d.ts +5 -0
  63. package/dist/src/compiled/@workflow/world/hooks.d.ts +27 -0
  64. package/dist/src/compiled/@workflow/world/index.d.ts +2 -2
  65. package/dist/src/compiled/@workflow/world/interfaces.d.ts +8 -6
  66. package/dist/src/compiled/@workflow/world/queue.d.ts +30 -26
  67. package/dist/src/compiled/@workflow/world/runs.d.ts +5 -0
  68. package/dist/src/compiled/@workflow/world/spec-version.d.ts +3 -4
  69. package/dist/src/compiled/@workflow/world-local/index.js +4 -4
  70. package/dist/src/compiled/@workflow/world-vercel/index.js +5 -5
  71. package/dist/src/compiled/_chunks/workflow/{attribute-changes-B6ltn-ph.js → attribute-changes-DeZc2RZz.js} +2 -2
  72. package/dist/src/compiled/_chunks/workflow/{dist-D7ANgxe0.js → dist-WjtNsOyf.js} +1 -1
  73. package/dist/src/compiled/_chunks/workflow/private-Cre8uYkA.js +1 -0
  74. package/dist/src/compiled/_chunks/workflow/resume-hook-ip1hbn1b.js +1 -0
  75. package/dist/src/compiled/_chunks/workflow/run-CWytxfIp.js +1 -0
  76. package/dist/src/compiled/_chunks/workflow/sleep-BjrUxUcs.js +1 -0
  77. package/dist/src/compiled/_chunks/workflow/wait-until-De9yESQN.js +15 -0
  78. package/dist/src/compiled/_chunks/workflow/{workflow-routes-Pd-WKcx_.js → workflow-routes-CwqB063q.js} +1 -1
  79. package/dist/src/evals/cli/eval-client.js +1 -1
  80. package/dist/src/evals/session.js +1 -1
  81. package/dist/src/execution/web-fetch/request.js +1 -1
  82. package/dist/src/internal/application/compiled-artifacts.js +1 -1
  83. package/dist/src/internal/application/package.js +1 -1
  84. package/dist/src/internal/node-esm-compat-banner.js +1 -1
  85. package/dist/src/internal/workflow/builtins.d.ts +2 -2
  86. package/dist/src/internal/workflow/development-world-protocol.js +1 -1
  87. package/dist/src/internal/workflow-bundle/workflow-core-shim.d.ts +5 -5
  88. package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
  89. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/world-target.js +1 -0
  90. package/dist/src/public/channels/linear/defaults.js +4 -2
  91. package/dist/src/runtime/attributes/emit.js +1 -1
  92. package/dist/src/services/dev-client/client-options.d.ts +2 -0
  93. package/dist/src/services/dev-client/client-options.js +1 -1
  94. package/dist/src/services/dev-client/target.d.ts +17 -0
  95. package/dist/src/services/dev-client/target.js +1 -0
  96. package/dist/src/setup/scaffold/create/project.js +1 -1
  97. package/dist/src/setup/verified-remote-client.d.ts +5 -1
  98. package/dist/src/setup/verified-remote-client.js +1 -1
  99. package/dist/src/svelte/index.js +1 -1
  100. package/dist/src/svelte/use-eve-agent.js +1 -1
  101. package/dist/src/vue/index.js +1 -1
  102. package/dist/src/vue/use-eve-agent.js +1 -1
  103. package/docs/channels/linear.mdx +4 -0
  104. package/docs/extensions.md +3 -1
  105. package/docs/install-integrations.mdx +76 -1
  106. package/docs/reference/cli.md +28 -1
  107. package/package.json +8 -8
  108. package/dist/src/compiled/@workflow/core/runtime/step-handler.d.ts +0 -2
  109. package/dist/src/compiled/_chunks/workflow/private-DolBHKOQ.js +0 -1
  110. package/dist/src/compiled/_chunks/workflow/resume-hook-D2AqAGjq.js +0 -1
  111. package/dist/src/compiled/_chunks/workflow/run-BMRZ6pA-.js +0 -1
  112. package/dist/src/compiled/_chunks/workflow/sleep-CrgsokmG.js +0 -1
  113. package/dist/src/compiled/_chunks/workflow/wait-until-B-1TiJji.js +0 -15
  114. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/world-target.js +0 -1
  115. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/index.js +0 -0
  116. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/parse-name.js +0 -0
  117. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/pluralize.js +0 -0
  118. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/promise.js +0 -0
  119. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/time.js +0 -0
  120. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/workflow-routes.js +0 -0
  121. /package/dist/src/{cli/dev/tui → services/dev-client}/agent-info-probe.d.ts +0 -0
  122. /package/dist/src/{cli/dev/tui → services/dev-client}/agent-info-probe.js +0 -0
@@ -1,4 +1,4 @@
1
- import{pinnedNodeEngineMajor}from"../../node-engine.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_AI_PACKAGE_VERSION=`^7.0.38`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.4.2`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.27.11`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e){return{"agent/agent.ts":BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function renderTemplate(e,t){return e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(t.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(t.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(t.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,t.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,t.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,t.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,t.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,t.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,t.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
1
+ import{pinnedNodeEngineMajor}from"../../node-engine.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_AI_PACKAGE_VERSION=`^7.0.38`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.4.2`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.27.13`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e){return{"agent/agent.ts":BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function renderTemplate(e,t){return e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(t.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(t.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(t.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,t.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,t.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,t.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,t.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,t.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,t.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
2
2
 
3
3
  export default defineAgent({
4
4
  model: "__EVE_INIT_MODEL__",
@@ -1,6 +1,6 @@
1
1
  import type { ClientOptions } from "#client/index.js";
2
2
  import { type DevelopmentOidcTokenFailure, resolveDevelopmentOidcToken } from "#services/dev-client/request-headers.js";
3
- import { resolveVercelDeployment } from "./vercel-deployment.js";
3
+ import { resolveVercelDeployment, type VercelDeploymentResolution } from "./vercel-deployment.js";
4
4
  /** Dependencies for verifying one remote client (injectable for tests). */
5
5
  export interface VerifiedRemoteDevelopmentClientDeps {
6
6
  readonly resolveVercelDeployment: typeof resolveVercelDeployment;
@@ -8,6 +8,7 @@ export interface VerifiedRemoteDevelopmentClientDeps {
8
8
  }
9
9
  /** A verified remote client's options plus a reader for its latest OIDC failure. */
10
10
  export interface VerifiedRemoteDevelopmentClient {
11
+ readonly deploymentResolution?: VercelDeploymentResolution;
11
12
  readonly options: ClientOptions;
12
13
  /** OIDC failure from the most recent request, or `undefined` while healthy. */
13
14
  readonly lastOidcTokenFailure: () => DevelopmentOidcTokenFailure | undefined;
@@ -17,7 +18,10 @@ export interface VerifiedRemoteDevelopmentClient {
17
18
  * exact origin proof, plus a reader for the latest OIDC token failure.
18
19
  */
19
20
  export declare function resolveVerifiedRemoteDevelopmentClient(input: {
21
+ readonly headers?: Readonly<Record<string, string>>;
20
22
  readonly serverUrl: string;
23
+ readonly signal?: AbortSignal;
24
+ readonly vercelScope?: string;
21
25
  readonly workspaceRoot: string;
22
26
  readonly deps?: Partial<VerifiedRemoteDevelopmentClientDeps>;
23
27
  }): Promise<VerifiedRemoteDevelopmentClient>;
@@ -1 +1 @@
1
- import{resolveVercelDeployment}from"./vercel-deployment.js";import{resolveDevelopmentOidcToken}from"#services/dev-client/request-headers.js";import{resolveRemoteDevelopmentClientOptions}from"#services/dev-client/client-options.js";import{createDevelopmentCredentialGate}from"#services/dev-client/credential-gate.js";const defaultDeps={resolveVercelDeployment,resolveDevelopmentOidcToken};async function resolveVerifiedRemoteDevelopmentClient(e){let t={...defaultDeps,...e.deps},r=createDevelopmentCredentialGate(e.serverUrl),i=await t.resolveVercelDeployment({workspaceRoot:e.workspaceRoot,host:new URL(e.serverUrl).host});if(i.kind===`resolved`){let{ownerId:e,projectId:n}=i.target.deployment;r.authorize({target:i.target,resolveToken:()=>t.resolveDevelopmentOidcToken({ownerId:e,projectId:n})})}return{options:resolveRemoteDevelopmentClientOptions({serverUrl:e.serverUrl,credentials:r}),lastOidcTokenFailure:r.lastTokenFailure}}export{resolveVerifiedRemoteDevelopmentClient};
1
+ import{resolveVercelDeployment}from"./vercel-deployment.js";import{resolveDevelopmentOidcToken}from"#services/dev-client/request-headers.js";import{hasDevelopmentAuthorizationHeader,resolveRemoteDevelopmentClientOptions}from"#services/dev-client/client-options.js";import{createDevelopmentCredentialGate}from"#services/dev-client/credential-gate.js";const defaultDeps={resolveVercelDeployment,resolveDevelopmentOidcToken};async function resolveVerifiedRemoteDevelopmentClient(e){let t={...defaultDeps,...e.deps},r=createDevelopmentCredentialGate(e.serverUrl),i;if(!hasDevelopmentAuthorizationHeader(e.headers)&&(i=await t.resolveVercelDeployment({workspaceRoot:e.workspaceRoot,host:new URL(e.serverUrl).host,scope:e.vercelScope,signal:e.signal}),i.kind===`resolved`)){let{ownerId:e,projectId:n}=i.target.deployment;r.authorize({target:i.target,resolveToken:()=>t.resolveDevelopmentOidcToken({ownerId:e,projectId:n})})}return{deploymentResolution:i,options:resolveRemoteDevelopmentClientOptions({credentials:r,headers:e.headers,serverUrl:e.serverUrl}),lastOidcTokenFailure:r.lastTokenFailure}}export{resolveVerifiedRemoteDevelopmentClient};
@@ -1,3 +1,3 @@
1
- import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-DaWxEtnE.js";
1
+ import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-CsSQOKnp.js";
2
2
 
3
3
  export { defaultMessageReducer, useEveAgent };
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-DaWxEtnE.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-CsSQOKnp.js";
2
2
 
3
3
  export { useEveAgent };
@@ -1,3 +1,3 @@
1
- import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-CTJrwXM2.js";
1
+ import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-CWYe-vqE.js";
2
2
 
3
3
  export { defaultMessageReducer, useEveAgent };
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-CTJrwXM2.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-CWYe-vqE.js";
2
2
 
3
3
  export { useEveAgent };
@@ -82,6 +82,10 @@ Turn start posts an ephemeral `thought`, tool calls post ephemeral `action` acti
82
82
 
83
83
  Human-in-the-loop (HITL) input requests render as Linear `elicitation` activities. When the user replies to the Agent Session, the channel resolves that prompt back to the pending eve input request and resumes with `inputResponses`.
84
84
 
85
+ ### Connection authorization
86
+
87
+ When a user-scoped connection needs authorization, the default channel posts Linear's native `auth` elicitation with the provider's sign-in URL, targeted to the Linear user who started the session. URL-less device flows render their instructions and user code as a plain elicitation. After authorization finishes, the channel posts a thought with the outcome; successful authorization indicates that the parked turn is resuming.
88
+
85
89
  ### Proactive sessions
86
90
 
87
91
  Start a session without an inbound webhook with `receive(linear, { target })`. See [Proactive sessions](#proactive-sessions) below for the target shape and examples.
@@ -3,7 +3,9 @@ title: "Extensions"
3
3
  description: "Package reusable eve capabilities and mount them from npm or a monorepo workspace."
4
4
  ---
5
5
 
6
- Extensions package eve tools, connections, skills, instruction fragments, and hooks. An author builds an extension package; each agent that uses it declares the package as a dependency and mounts it. The package can be published to a registry or kept private inside a monorepo workspace.
6
+ Extensions package eve tools, connections, skills, instruction fragments, and hooks. An author builds an extension package; each agent that uses it declares the package as a dependency and mounts it. The package can be published to a package registry or kept private inside a monorepo workspace.
7
+
8
+ Ready-made extensions can also be distributed through an eve integration registry. See [Install Integrations](./install-integrations) to discover and add one with `eve add`; this page explains how extension packages are authored, mounted, configured, and overridden.
7
9
 
8
10
  This enables sharing many different capability sets. A browser extension might include several tools for navigating a site. A memory extension could use hooks to capture context and tools to recall it. A self-improving extension could pair hooks with dynamic instructions.
9
11
 
@@ -18,6 +18,8 @@ eve add instrumentation/braintrust
18
18
 
19
19
  Extensions may create a mount under `agent/extensions/`. Connections write their initial definition under `agent/connections/` and install `@vercel/connect` when required. Instrumentation providers write `agent/instrumentation.ts`; because an agent has one instrumentation file, compose multiple exporters there by hand. Configure generated files and required environment variables before running your agent.
20
20
 
21
+ When an official item has an interactive setup flow, eve asks whether to run it after installation. Run the printed `eve add <item> --skip-install` command to resume a skipped or cancelled setup later.
22
+
21
23
  ## Find an integration
22
24
 
23
25
  Browse the [Integrations directory](/integrations) to see the official integrations available from the eve registry.
@@ -44,7 +46,7 @@ eve registry view extension/agent-browser
44
46
 
45
47
  ## Add a third-party source
46
48
 
47
- Give a registry a namespace and an integration URL template:
49
+ Use the integration URL template provided by the registry publisher and give the source a namespace:
48
50
 
49
51
  ```bash
50
52
  eve registry add @acme=https://registry.acme.com/r/{name}.json
@@ -71,6 +73,79 @@ Install a known integration URL directly when you do not need a namespace:
71
73
  eve add https://registry.acme.com/r/analytics.json
72
74
  ```
73
75
 
76
+ ## Contribute an official integration
77
+
78
+ Community contributions to the official registry are welcome. Open an issue and get maintainer agreement before submitting a pull request, then follow the [registry contribution guide](https://github.com/vercel/eve/blob/main/CONTRIBUTING.md#adding-an-integration-to-the-registry) for the required source files, metadata, validation, and extension requirements.
79
+
80
+ ## Host your own registry
81
+
82
+ Hosting your own registry is the publishing side of the [third-party source workflow](#add-a-third-party-source). Once it is deployed, other eve projects can give it a namespace and pull integrations from it.
83
+
84
+ An eve registry is a standard [shadcn registry](https://ui.shadcn.com/docs/registry), so it can be hosted by any service that serves JSON over HTTP. It needs two kinds of endpoint:
85
+
86
+ - A catalog such as `https://registry.acme.com/r/registry.json` for `eve registry list` and `eve registry search`
87
+ - One JSON document per integration, such as `https://registry.acme.com/r/analytics.json`, for `eve registry view` and `eve add`
88
+
89
+ Start with a source file for the integration and a `registry.json` that describes where to install it:
90
+
91
+ ```text
92
+ registry.json
93
+ registry/
94
+ └── analytics.ts
95
+ ```
96
+
97
+ ```json title="registry.json"
98
+ {
99
+ "$schema": "https://ui.shadcn.com/schema/registry.json",
100
+ "name": "acme",
101
+ "homepage": "https://registry.acme.com",
102
+ "items": [
103
+ {
104
+ "name": "analytics",
105
+ "type": "registry:item",
106
+ "title": "Acme Analytics",
107
+ "description": "Add Acme analytics tools to an eve agent.",
108
+ "dependencies": ["@acme/eve-analytics"],
109
+ "envVars": {
110
+ "ACME_API_KEY": ""
111
+ },
112
+ "files": [
113
+ {
114
+ "path": "registry/analytics.ts",
115
+ "type": "registry:file",
116
+ "target": "agent/extensions/analytics.ts"
117
+ }
118
+ ]
119
+ }
120
+ ]
121
+ }
122
+ ```
123
+
124
+ `files[].path` is relative to `registry.json`. `files[].target` is relative to the root of the eve project that installs the item. Use `registry:item` with explicit `registry:file` targets for eve integrations so installation does not depend on a UI framework or shadcn project aliases.
125
+
126
+ Validate the source registry, then build its static JSON:
127
+
128
+ ```bash
129
+ pnpm dlx shadcn@latest registry validate
130
+ pnpm dlx shadcn@latest build
131
+ ```
132
+
133
+ By default, the build writes the catalog to `public/r/registry.json` and each item to `public/r/<name>.json`. Deploy the `public` directory to a static host, or use the shadcn registry APIs to serve the same payloads from dynamic routes.
134
+
135
+ Before sharing the registry, test its deployed catalog and item endpoints from an eve project:
136
+
137
+ ```bash
138
+ eve registry list --registry https://registry.acme.com/r/registry.json
139
+ eve registry view https://registry.acme.com/r/analytics.json
140
+ ```
141
+
142
+ Share the item URL template with consumers. From another eve project, they can add the hosted registry as a third-party source and pull the integration through its namespace:
143
+
144
+ ```bash
145
+ eve registry add @acme=https://registry.acme.com/r/{name}.json
146
+ eve add @acme/analytics
147
+ ```
148
+
74
149
  ## Configure generated files
75
150
 
76
151
  Integrations add project files. Read the generated mount before you run the agent, then add the configuration the extension requires.
@@ -87,6 +87,7 @@ Commands for installing and discovering [shadcn registry](https://ui.shadcn.com/
87
87
 
88
88
  ```bash
89
89
  eve add extension/agent-browser
90
+ eve add channel/slack --skip-install
90
91
  eve add https://example.com/r/my-extension.json --overwrite
91
92
  eve registry add @acme=https://example.com/r/{name}.json
92
93
  eve registry search browser
@@ -95,6 +96,8 @@ eve registry view @acme/my-extension
95
96
  eve add @acme/my-extension
96
97
  ```
97
98
 
99
+ `eve add` asks before running setup declared by an official item and prints the matching `eve add <item> --skip-install` command when setup is skipped or cancelled. `--skip-install` reruns setup without reinstalling the item.
100
+
98
101
  `eve registry add` records configured sources in `package.json#registries`. `eve registry list` and `search` aggregate the official catalog and all configured sources by default, or browse one supplied URL or namespace. Official and other universal items with explicit file targets do not require shadcn project configuration.
99
102
 
100
103
  ## `eve info`
@@ -183,7 +186,7 @@ Pass a bare URL and the UI connects to that server instead of booting a local on
183
186
 
184
187
  A fresh `eve init` passes `--input /model`. That bare local input starts onboarding: the TUI installs the Vercel CLI if needed, asks you to log in if needed, then opens `/model`. Other input stays editable in the prompt.
185
188
 
186
- For a URL target protected by HTTP Basic auth, put the credentials in the URL. Eve sends them as a Basic `Authorization` header and strips them from the server URL before connecting:
189
+ For a URL target protected by HTTP Basic auth, put the credentials in the URL. eve sends them as a Basic `Authorization` header and strips them from the server URL before connecting:
187
190
 
188
191
  ```bash
189
192
  eve dev https://user:pass@your-app.example.com
@@ -191,6 +194,30 @@ eve dev https://user:pass@your-app.example.com
191
194
 
192
195
  For bearer tokens or custom schemes, pass explicit headers with `-H`.
193
196
 
197
+ ### `eve invoke`
198
+
199
+ | Option | Type | Default | Description |
200
+ | ----------------------- | ------ | ------- | ----------------------------------------------- |
201
+ | `[prompt]` | string | none | Prompt, follow-up, or answer to a pending input |
202
+ | `-u, --url <url>` | string | local | Invoke an existing server |
203
+ | `-H, --header <header>` | string | none | Request header for a URL target; repeatable |
204
+ | `--resume` | flag | off | Read a previous resumable result from stdin |
205
+ | `--scope <team>` | string | current | Vercel team that owns the URL target |
206
+ | `--json-schema` | flag | off | Print the result JSON Schema and exit |
207
+
208
+ Use `eve invoke` to submit a turn without opening the TUI. It emits JSON after the invocation completes or reaches a blocking input or authorization event.
209
+
210
+ ```bash
211
+ eve invoke "Summarize station telemetry"
212
+ result=$(eve invoke "Deploy the application")
213
+ printf '%s' "$result" | eve invoke --resume "approve"
214
+ eve invoke --json-schema
215
+ ```
216
+
217
+ `--resume` reads a complete previous result from stdin. Supply text for a `ready` follow-up or pending input; the agent harness resolves input text against all pending requests. A `ready` result includes the previous turn's completed or failed `outcome`. An `authorization-required` result lists every unresolved challenge in `authorizations`; complete them, then resume without text. Pass explicit headers again for protected remote servers. If the URL belongs to another Vercel team, pass its slug with `--scope`; this does not relink the current directory. Pass the scope again when resuming. Paused invocations exit `3`; failures exit `1`.
218
+
219
+ Local callback-based connection authorization requires a persistent server. Run `eve dev`, then use `eve invoke --url <dev-url>` instead. If a waiting invocation receives `SIGINT` or `SIGTERM` after acceptance, it emits a final resumable `running` result before exiting.
220
+
194
221
  Local dev records the last ready URL per resolved app root in `.eve/dev-server-state.v1.json`. A second interactive `eve dev` reconnects only when that URL is loopback and healthy; each terminal UI creates a fresh client session while sharing the server process. A stale or malformed record is replaced when eve starts a new server. Passing `--host`, `--port`, or a `PORT` environment value skips reconnection and reports a healthy recorded server instead.
195
222
 
196
223
  Local dev keeps immutable runtime source snapshots under `.eve/dev-runtime/snapshots/` so in-flight turns hold a consistent code revision while new turns pick up rebuilds. The terminal REPL keeps its logical session across successful rebuilds, so the next turn continues the conversation on the latest generation; `/new` terminally retires that session before clearing the transcript, and the next prompt starts a fresh session with a new session-scoped sandbox on first sandbox use. After a generation is superseded, `eve dev` retains it for at least 30 minutes and also retains the five most recently superseded generations, regardless of the configured Workflow World. The active generation is never pruned. Old runtime snapshots and local sandbox templates are pruned in the background. For manual cleanup, stop `eve dev` before deleting `.eve/dev-runtime/snapshots/` or `.eve/sandbox-cache/local/templates/`. A turn that remains unfinished beyond the automatic retention window can no longer resume after its generation is pruned.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eve",
3
- "version": "0.27.11",
3
+ "version": "0.27.13",
4
4
  "private": false,
5
5
  "description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
6
6
  "keywords": [
@@ -280,7 +280,7 @@
280
280
  },
281
281
  "dependencies": {
282
282
  "nitro": "3.0.260610-beta",
283
- "undici": "7.28.0"
283
+ "undici": "8.9.0"
284
284
  },
285
285
  "devDependencies": {
286
286
  "@ai-sdk/anthropic": "^4.0.18",
@@ -307,13 +307,13 @@
307
307
  "@vercel/otel": "2.1.3",
308
308
  "@vercel/sandbox": "2.8.0",
309
309
  "@vercel/sdk": "1.28.8",
310
- "@workflow/core": "5.0.0-beta.36",
311
- "@workflow/errors": "5.0.0-beta.12",
310
+ "@workflow/core": "5.0.0-beta.37",
311
+ "@workflow/errors": "5.0.0-beta.13",
312
312
  "@workflow/serde": "5.0.0-beta.2",
313
- "@workflow/utils": "5.0.0-beta.6",
314
- "@workflow/world": "5.0.0-beta.22",
315
- "@workflow/world-local": "5.0.0-beta.30",
316
- "@workflow/world-vercel": "5.0.0-beta.32",
313
+ "@workflow/utils": "5.0.0-beta.7",
314
+ "@workflow/world": "5.0.0-beta.23",
315
+ "@workflow/world-local": "5.0.0-beta.31",
316
+ "@workflow/world-vercel": "5.0.0-beta.33",
317
317
  "ai": "^7.0.38",
318
318
  "autoevals": "0.0.132",
319
319
  "chat": "4.34.0",
@@ -1,2 +0,0 @@
1
- export declare const stepEntrypoint: (req: Request) => Promise<Response>;
2
- //# sourceMappingURL=step-handler.d.ts.map
@@ -1 +0,0 @@
1
- import"./dist-B-vbuNqP.js";function e(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function t(e){let t={get value(){let n=e();return Object.defineProperty(t,"value",{value:n}),n}};return t}const n=Symbol.for(`@workflow/core//registeredSteps`),r=globalThis,i=r[n]??=new Map,a=new Set([`__builtin_response_array_buffer`,`__builtin_response_json`,`__builtin_response_text`]);function o(e){let t=e.split(`//`);if(t.length!==3||t[0]!==`step`)return[];let n=t[1],r=t[2],i=new Set,a=e=>{e!==n&&i.add(e)};if(n.startsWith(`./workflows/`)){let e=n.slice(2);a(`./example/${e}`),a(`./src/${e}`)}else if(n.startsWith(`./example/workflows/`)){let e=n.slice(10);a(`./${e}`),a(`./src/${e}`)}else if(n.startsWith(`./src/workflows/`)){let e=n.slice(6);a(`./${e}`),a(`./example/${e}`)}return Array.from(i,e=>`step//${e}//${r}`)}function s(e){if(a.has(e)){for(let[t,n]of i.entries())if(t.endsWith(`//${e}`))return n}}function c(e,t){i.set(e,t),t.stepId=e}function l(e){let t=i.get(e);if(t)return t;for(let t of o(e)){let e=i.get(t);if(e)return e}let n=s(e);if(n)return n}async function u(e,t,n){if(t===void 0||!e.pendingDeliveryBarriers||e.pendingDeliveryBarriers.size===0)return;let r=[];for(let[i,a]of e.pendingDeliveryBarriers)i<t&&n.includes(a.kind)&&r.push(a.delivered);r.length>0&&await Promise.all(r)}function d(t,n,r){let i=t.pendingDeliveryBarriers;if(!i||n===void 0)return{markDelivered:()=>{}};let a=!1,{promise:o,resolve:s}=e(),c={kind:r,delivered:o};i.set(n,c);let l=()=>{a||(a=!0,i.get(n)===c&&i.delete(n),s())};return f(t,l),{markDelivered:l}}function f(e,t){let n=()=>{e.pendingDeliveries>0?e.promiseQueue.then(()=>{setTimeout(n,0)}):t()};setTimeout(n,0)}export{f as a,c as i,l as n,t as o,d as r,e as s,u as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$ as t,Dn as n,Kt as r,Nn as i,S as a,U as o,Z as s,_n as c,ct as l,dn as u,g as d,i as f,k as p,n as m,ot as h,st as g,t as _,tn as v}from"./wait-until-B-1TiJji.js";import{E as y,n as b,o as x}from"./dist-BeQ_csYA.js";import{A as S}from"./dist-D7ANgxe0.js";import{t as C}from"./spec-version-C0hBsfu-.js";var w=e({getHookByToken:()=>D,resumeHook:()=>O,resumeWebhook:()=>k});async function T(e){let t=await c(),n=await t.hooks.getByToken(e);return{hook:n,run:await t.runs.get(n.runId)}}async function E(e){let{hook:t,run:n}=await T(e),r=await(await c()).getEncryptionKeyForRun?.(n),a=r?await i(r):void 0;return t.metadata!==void 0&&(t.metadata=await p(t.metadata,t.runId,a)),{hook:t,encryptionKey:a}}async function D(e){let{hook:t}=await E(e);return t}async function O(e,n,p){return await m(()=>t(`hook.resume`,async t=>{let m=await c();try{let c,h;if(typeof e==`string`){let t=await T(e);c=t.hook,h=t.run}else c=e,h=await m.runs.get(c.runId);if(t?.setAttributes({...l(c.token),...g(c.hookId),...v(c.runId)}),S(h.status))throw new x(c.token);let y=p;if(!y){let e=await m.getEncryptionKeyForRun?.(h);y=e?await i(e):void 0}let b=h.executionContext?.workflowCoreVersion,w=d(typeof b==`string`?b:void 0);w.supportedFormats.has(u.ENCRYPTED)||(y=void 0);let E=(h.specVersion??0)>=5&&w.supportedFormats.has(u.GZIP),D=[],O=C(c.specVersion),k=await a(n,c.runId,y,D,globalThis,O,w.framedByteStreams,E);_(Promise.all(D),e=>{e!==void 0&&o.warn(`Background flush of hook payload ops failed`,{workflowRunId:c.runId,hookId:c.hookId,error:e instanceof Error?e.message:String(e)})}),await m.events.create(c.runId,{eventType:`hook_received`,specVersion:5,correlationId:c.hookId,eventData:{...O?{}:{token:c.token},payload:k}},{v1Compat:O}),t?.setAttributes({...r(h.workflowName)});let A=await s(h.executionContext?.traceCarrier);return A&&t?.addLink?.(A),await m.queue(f(h.workflowName),{runId:c.runId,traceCarrier:h.executionContext?.traceCarrier??void 0},{deploymentId:h.deploymentId,specVersion:h.specVersion??1}),c}catch(n){throw t?.setAttributes({...l(typeof e==`string`?e:e.token),...h(!1)}),n}}))}async function k(e,t){let{hook:r,encryptionKey:i}=await E(e);if(r.isWebhook===!1)throw new x(e);let a,o;if(r.metadata&&typeof r.metadata==`object`&&`respondWith`in r.metadata)if(r.metadata.respondWith===`manual`){let{readable:e,writable:r}=new TransformStream;o=e,t[n]=r}else if(r.metadata.respondWith instanceof Response)a=r.metadata.respondWith;else throw new y(`Invalid \`respondWith\` value: ${r.metadata.respondWith}`,{slug:b.WEBHOOK_INVALID_RESPOND_WITH_VALUE});else a=new Response(null,{status:202});if(await O(r,t,i),o){let e=o.getReader(),t=await e.read();t.value&&(a=t.value),e.cancel()}if(!a)throw new y(`Workflow run did not send a response`,{slug:b.WEBHOOK_RESPONSE_NOT_SENT});return a}export{w as i,O as n,k as r,D as t};
@@ -1 +0,0 @@
1
- import{$ as e,C as t,E as n,H as r,Kt as i,M as a,N as o,Nn as s,O as c,Q as l,U as u,V as d,Vn as f,_n as p,dn as m,g as h,gn as g,h as _,hn as v,i as y,n as b,nn as x,nt as S,o as ee,qt as C,t as te,tn as w,vn as T,zt as ne}from"./wait-until-B-1TiJji.js";import{C as E,D,E as O,O as k,S as A,T as j,g as M,h as N,l as P,p as F,r as I,s as L,t as R,w as z,x as B}from"./dist-BeQ_csYA.js";import{t as V}from"./attribute-changes-B6ltn-ph.js";import{G as H,W as U,i as W,o as G}from"./dist-D7ANgxe0.js";import{t as K}from"./spec-version-C0hBsfu-.js";const q=new Set([`PARSE_ERROR`,`SCHEMA_VALIDATION`,k.WORLD_CONTRACT_ERROR]),re=new Set([`TRANSPORT`,`TIMEOUT`]),ie=[O.is,N.is,B.is,F.is];function J(e){if(!D.is(e)||e.status!==void 0)return!1;let t=`cause`in e?e.cause:void 0;return e.code!==void 0&&q.has(e.code)||e.message.startsWith(`Failed to parse response body for `)||e.message.startsWith(`Schema validation failed for `)||typeof t==`object`&&!!t&&`name`in t&&t.name===`ZodError`}function Y(e){return M.is(e)?!0:D.is(e)?e.status!==void 0&&e.status>=500||e.code!==void 0&&re.has(e.code):!1}function ae(e){if(P.is(e))return k.REPLAY_DIVERGENCE;if(R.is(e))return k.CORRUPTED_EVENT_LOG;if(L.is(e))return k.MAX_EVENTS_EXCEEDED;if(J(e)||Y(e))return k.WORLD_CONTRACT_ERROR;for(let t of ie)if(t(e))return k.RUNTIME_ERROR;return k.USER_ERROR}const oe=G();function se(){let e=r.getStore(),t=e?.workflowMetadata?.workflowRunId;if(t)return{[H]:e.rootRunId??t,[U]:t}}let X=!1;async function Z(n,r,a){"use step";return await b(()=>{let o=n?.workflowId;if(!o)throw new O(`'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 e(`workflow.start ${f(o)}`,async e=>{e?.setAttributes({...i(o),...C(`start`)});let n=[],c=a??{};Array.isArray(r)?n=r:typeof r==`object`&&(c=r),e?.setAttributes({...ne(n.length)});let d=c.world??await p();T(d);let f=await d.getDeploymentId(),g=c.deploymentId??f;g===`latest`&&(d.resolveLatestDeploymentId?g=await d.resolveLatestDeploymentId():(X||(X=!0,u.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:f})),g=f));let v,b;if(g===f)v=!0,b=!0;else if(typeof d.streams?.get!=`function`)v=!1,b=!1;else{let e=h((await ee(d,`workflow`,{deploymentId:g,timeout:2e3,namespace:c.namespace}).catch(()=>void 0))?.workflowCoreVersion);v=e.framedByteStreams,b=e.supportedFormats.has(m.GZIP)}let E=[],D=`wrun_${d.createRunId?d.createRunId(c):oe()}`,k=await l(),A=c.specVersion??d.specVersion,j=K(A),M=c.allowReservedAttributes===!0,N;if(c.attributes&&Object.keys(c.attributes).length>0){if(A<4)throw new O(`Initial workflow attributes require a World that supports spec version 4 or later.`);for(let[e,t]of Object.entries(c.attributes))if(typeof t!=`string`)throw new O(`Initial workflow attribute ${JSON.stringify(e)} must be a string value.`);let e=V(c.attributes,{allowReservedAttributes:M});N=Object.fromEntries(e.map(({key:e,value:t})=>[e,t]))}let P=A>=4?se():void 0,F=P?{...P,...N}:N,L=F?{attributes:F,...M||P!=null?{allowReservedAttributes:!0}:{}}:{};if(c.replayedFromRunId!==void 0&&!W.safeParse(c.replayedFromRunId).success)throw new O(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(c.replayedFromRunId).slice(0,64))}.`);let R=await d.getEncryptionKeyForRun?.(D,{...c,deploymentId:g}),z=R?await s(R):void 0,B=await t(n,D,z,E,globalThis,j,v,b&&A>=5),H={traceCarrier:k,workflowCoreVersion:_,features:{encryption:!!z},...c.replayedFromRunId?{replayedFromRunId:c.replayedFromRunId}:{}},[U,G]=await Promise.allSettled([d.events.create(D,{eventType:`run_created`,specVersion:A,eventData:{deploymentId:g,workflowName:o,input:B,executionContext:H,...L}},{v1Compat:j}),d.queue(y(o,c.namespace),{runId:D,traceCarrier:k,...A>=3?{runInput:{input:B,deploymentId:g,workflowName:o,specVersion:A,executionContext:H,...L}}:{}},{deploymentId:g,specVersion:A,...c.region===void 0?{}:{region:c.region}})]);if(G.status===`rejected`)throw G.reason;let q=!1;if(U.status===`rejected`){let e=U.reason;if(!I.is(e))if(Y(e))q=!0,u.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:D,error:e.message});else throw e}else{let e=U.value;if(!e.run)throw new O(`Missing 'run' in server response for 'run_created' event`);if(!j&&e.run.runId!==D)throw new O(`Server returned different runId than requested: expected ${D}, got ${e.run.runId}`)}return te(Promise.all(E),e=>{u.warn(`Background flush of workflow argument streams failed`,{workflowRunId:D,error:e instanceof Error?e.message:String(e)})}),e?.setAttributes({...w(D),...S(g),...U.status===`fulfilled`&&U.value.run?x(U.value.run.status):{}}),new $(D,{resilientStart:q})})})}const ce=e=>Array.isArray(e)?e:[e];async function le(e,t,n={}){try{let r=await e.runs.get(t,{resolveData:`all`}),i=await e.getEncryptionKeyForRun?.(r),o=i?await s(i):void 0,c=ce(await a(r.input,t,o,globalThis)),l=n.specVersion??r.specVersion??1,u=n.deploymentId??r.deploymentId;return(await Z({workflowId:r.workflowName},c,{deploymentId:u,world:e,specVersion:l,replayedFromRunId:t,namespace:n.namespace})).runId}catch(e){throw Error(`Failed to recreate run from ${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}async function ue(e,t,n){try{let r=(await e.runs.get(t,{resolveData:`none`})).specVersion??1,i=K(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 de(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`});await e.queue(y(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 Q(e,t,n){try{let r=await e.runs.get(t,{resolveData:`none`}),i=K(r.specVersion),a=[],o=null;do{let n=await e.events.list({runId:t,pagination:{limit:1e3,...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){I.is(e)?d++:u.push(e instanceof Error?e:Error(String(e)))}}if(d>0&&await e.queue(y(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 fe(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 pe(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})}}var $=class e{static[g](e){return{runId:e.runId,resilientStart:e.#r}}static[v](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 s(n):void 0})(),this.#n}#a(){return()=>this.#i()}async wakeUp(e){"use step";return Q(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(j.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:r=globalThis,startIndex:i,namespace:a}=e,o=d(this.runId,a),s=this.#a(),c=n(r,t,this.runId,s).ReadableStream({name:o,startIndex:i}),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,r=[1e3,3e3,6e3];for(;;)try{let t=await e.runs.get(this.runId);if(t.status===`completed`){let e=await this.#i();return await o(t.output,this.runId,e)}if(t.status===`cancelled`)throw new A(this.runId);if(t.status===`failed`){let e=await this.#i(),n;try{n=await c(t.error,this.runId,e)}catch{n=Error(`Failed to hydrate workflow run error`)}throw new E(this.runId,n,{errorCode:t.errorCode})}throw new z(this.runId,t.status)}catch(e){if(z.is(e)){await new Promise(e=>setTimeout(e,1e3));continue}if(j.is(e)&&t<n){let e=r[t];t++,await new Promise(t=>setTimeout(t,e));continue}throw e}}};function me(e){return new $(e)}export{fe as a,Q as c,Y as d,J as f,pe as i,Z as l,me as n,le as o,ue as r,de as s,$ as t,ae as u};
@@ -1 +0,0 @@
1
- import{jn as e}from"./wait-until-B-1TiJji.js";import{i as t}from"./attribute-changes-B6ltn-ph.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};