eve 0.7.0 → 0.7.2

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 (113) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/docs/public/README.md +16 -11
  3. package/dist/docs/public/agent-config.md +9 -9
  4. package/dist/docs/public/channels/custom.mdx +4 -4
  5. package/dist/docs/public/channels/discord.mdx +1 -1
  6. package/dist/docs/public/channels/eve.mdx +9 -9
  7. package/dist/docs/public/channels/github.mdx +1 -1
  8. package/dist/docs/public/channels/overview.mdx +21 -15
  9. package/dist/docs/public/channels/slack.mdx +2 -2
  10. package/dist/docs/public/channels/teams.mdx +1 -1
  11. package/dist/docs/public/channels/telegram.mdx +1 -1
  12. package/dist/docs/public/channels/twilio.mdx +1 -1
  13. package/dist/docs/public/{advanced → concepts}/context-control.md +3 -3
  14. package/dist/docs/public/{advanced → concepts}/default-harness.md +3 -3
  15. package/dist/docs/public/{advanced → concepts}/execution-model-and-durability.md +3 -1
  16. package/dist/docs/public/concepts/meta.json +10 -0
  17. package/dist/docs/public/{advanced → concepts}/security-model.md +2 -2
  18. package/dist/docs/public/{advanced → concepts}/sessions-runs-and-streaming.md +7 -7
  19. package/dist/docs/public/connections.mdx +3 -3
  20. package/dist/docs/public/evals/cases.mdx +1 -1
  21. package/dist/docs/public/evals/overview.mdx +2 -2
  22. package/dist/docs/public/evals/running.mdx +1 -1
  23. package/dist/docs/public/evals/targets.mdx +1 -1
  24. package/dist/docs/public/getting-started.mdx +28 -35
  25. package/dist/docs/public/{advanced → guides}/auth-and-route-protection.md +2 -2
  26. package/dist/docs/public/{client → guides/client}/continuations.mdx +2 -2
  27. package/dist/docs/public/{client → guides/client}/messages.mdx +1 -1
  28. package/dist/docs/public/{client → guides/client}/meta.json +1 -1
  29. package/dist/docs/public/{client → guides/client}/output-schema.mdx +2 -2
  30. package/dist/docs/public/{client → guides/client}/overview.mdx +5 -5
  31. package/dist/docs/public/{client → guides/client}/streaming.mdx +1 -1
  32. package/dist/docs/public/{advanced → guides}/deployment.md +9 -1
  33. package/dist/docs/public/{advanced → guides}/dynamic-capabilities.md +1 -1
  34. package/dist/docs/public/{advanced → guides}/dynamic-workflows.md +1 -1
  35. package/dist/docs/public/{frontend → guides/frontend}/nextjs.mdx +3 -3
  36. package/dist/docs/public/{frontend → guides/frontend}/nuxt.mdx +3 -3
  37. package/dist/docs/public/{frontend → guides/frontend}/overview.mdx +6 -6
  38. package/dist/docs/public/{frontend → guides/frontend}/sveltekit.mdx +3 -3
  39. package/dist/docs/public/{frontend → guides/frontend}/use-eve-agent-svelte.mdx +2 -2
  40. package/dist/docs/public/{frontend → guides/frontend}/use-eve-agent-vue.mdx +2 -2
  41. package/dist/docs/public/{advanced → guides}/hooks.md +2 -2
  42. package/dist/docs/public/{advanced → guides}/instrumentation.md +2 -0
  43. package/dist/docs/public/{advanced → guides}/meta.json +8 -11
  44. package/dist/docs/public/{advanced → guides}/session-context.md +2 -2
  45. package/dist/docs/public/{advanced → guides}/state.md +1 -1
  46. package/dist/docs/public/instructions.mdx +2 -2
  47. package/dist/docs/public/introduction.md +5 -2
  48. package/dist/docs/public/meta.json +3 -3
  49. package/dist/docs/public/reference/cli.md +3 -3
  50. package/dist/docs/public/reference/meta.json +1 -1
  51. package/dist/docs/public/reference/project-layout.md +5 -1
  52. package/dist/docs/public/reference/typescript-api.md +23 -23
  53. package/dist/docs/public/sandbox.mdx +1 -1
  54. package/dist/docs/public/schedules.mdx +2 -2
  55. package/dist/docs/public/skills.mdx +3 -3
  56. package/dist/docs/public/subagents.mdx +3 -3
  57. package/dist/docs/public/tools.mdx +4 -4
  58. package/dist/docs/public/tutorial/connect-a-warehouse.mdx +2 -2
  59. package/dist/docs/public/tutorial/first-agent.mdx +1 -1
  60. package/dist/docs/public/tutorial/guard-the-spend.mdx +1 -1
  61. package/dist/docs/public/tutorial/how-it-runs.mdx +2 -2
  62. package/dist/docs/public/tutorial/meta.json +1 -1
  63. package/dist/docs/public/tutorial/query-sample-data.mdx +1 -1
  64. package/dist/docs/public/tutorial/remember-definitions.mdx +3 -3
  65. package/dist/docs/public/tutorial/run-analysis.mdx +1 -1
  66. package/dist/docs/public/tutorial/ship-it.mdx +4 -4
  67. package/dist/docs/public/tutorial/team-playbooks.mdx +3 -3
  68. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  69. package/dist/src/cli/dev/tui/runner.d.ts +2 -2
  70. package/dist/src/cli/dev/tui/runner.js +1 -1
  71. package/dist/src/cli/dev/tui/tui.js +1 -1
  72. package/dist/src/compiled/.vendor-stamp.json +2 -2
  73. package/dist/src/compiled/@workflow/core/capabilities.d.ts +19 -1
  74. package/dist/src/compiled/@workflow/core/class-serialization.d.ts +32 -0
  75. package/dist/src/compiled/@workflow/core/create-hook.d.ts +37 -0
  76. package/dist/src/compiled/@workflow/core/global.d.ts +11 -1
  77. package/dist/src/compiled/@workflow/core/index.js +2 -2
  78. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +6 -0
  79. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +15 -2
  80. package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +84 -0
  81. package/dist/src/compiled/@workflow/core/runtime.js +27 -27
  82. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +21 -0
  83. package/dist/src/compiled/@workflow/core/serialization.d.ts +72 -6
  84. package/dist/src/compiled/@workflow/core/symbols.d.ts +2 -0
  85. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  86. package/dist/src/compiled/@workflow/core/workflow/attribute-dispatcher.d.ts +6 -0
  87. package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +3 -4
  88. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  89. package/dist/src/compiled/@workflow/world/events.d.ts +48 -0
  90. package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
  91. package/dist/src/compiled/@workflow/world/queue.d.ts +3 -0
  92. package/dist/src/compiled/@workflow/world/runs.d.ts +2 -0
  93. package/dist/src/compiled/@workflow/world/spec-version.d.ts +2 -1
  94. package/dist/src/compiled/_chunks/workflow/attribute-changes-DGVGRGfw.js +59 -0
  95. package/dist/src/compiled/_chunks/workflow/resume-hook-DMSadN9o.js +1 -0
  96. package/dist/src/compiled/_chunks/workflow/run-BRdn7zy_.js +1 -0
  97. package/dist/src/compiled/_chunks/workflow/sleep-CpXfoXLF.js +1 -0
  98. package/dist/src/execution/sandbox/bindings/vercel.d.ts +2 -6
  99. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  100. package/dist/src/internal/application/package.js +1 -1
  101. package/dist/src/runtime/sandbox/keys.js +1 -1
  102. package/dist/src/setup/primitives/pm/pnpm.js +1 -1
  103. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  104. package/dist/src/setup/scaffold/create/project.js +2 -2
  105. package/dist/src/setup/scaffold/update/channels.js +1 -1
  106. package/package.json +6 -6
  107. package/dist/docs/public/reference/faqs.md +0 -48
  108. package/dist/src/compiled/_chunks/workflow/resume-hook-CEAS3opc.js +0 -12
  109. package/dist/src/compiled/_chunks/workflow/sleep-Cup6vPoA.js +0 -1
  110. package/dist/src/compiled/_chunks/workflow/symbols-BUTtwS7j.js +0 -48
  111. /package/dist/docs/public/{advanced → guides}/dev-tui.md +0 -0
  112. /package/dist/docs/public/{frontend → guides/frontend}/meta.json +0 -0
  113. /package/dist/docs/public/{advanced → guides}/remote-agents.md +0 -0
@@ -1,2 +1,2 @@
1
- import{c as e,i as t}from"../../_chunks/workflow/dist-6a3viBXZ.js";import{at as n,c as r,it as i,l as a,ot as o,s}from"../../_chunks/workflow/symbols-BUTtwS7j.js";import{Bt as c,C as l,Ht as u,R as d,T as f,Vt as p,g as m,n as h,z as g,zt as _}from"../../_chunks/workflow/resume-hook-CEAS3opc.js";import{n as v,t as y}from"../../_chunks/workflow/sleep-Cup6vPoA.js";function b(e){n(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,b)}function x(e){n(`createWebhook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-webhook`,x)}function S({schema:e}={}){function t(e){n(`defineHook().create()`,`https://workflow-sdk.dev/docs/api-reference/workflow/define-hook`,t)}return{create:t,async resume(t,n){if(!e?.[`~standard`])return await h(t,n);let r=e[`~standard`].validate(n);if(r instanceof Promise&&(r=await r),r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>String(typeof e==`object`&&e?e.key:e)).join(`.`);return t?` at "${t}": ${e.message}`:` ${e.message}`});throw Error(`Hook payload did not match the defined schema:\n${e.join(`
2
- `)}`)}return await h(t,r.value)}}}const C=Symbol.for(`@workflow/setAttributes//unsupportedWorldWarned`);async function w(e,n={}){let r=g.getStore()?.workflowMetadata?.workflowRunId;if(!r)throw new t(`experimental_setAttributes() must be called from a 'use workflow' or 'use step' function. Calling it from plain host code is not supported.`);let i=v(e,n);if(i.length===0)return;let a=await _();if(typeof a.runs.experimentalSetAttributes!=`function`){let e=globalThis;if(!e[C]){e[C]=!0;let t=`name`in a&&typeof a.name==`string`?a.name:``,n=t?` (${t})`:``;console.warn(`[workflow] setAttributes: the current world implementation${n} does not implement experimentalSetAttributes; this call (and any subsequent setAttributes calls in this process) is a no-op. Attributes will become available once the world adapter adds support.`)}return}await a.runs.experimentalSetAttributes(r,i,n.allowReservedAttributes===!0?{allowReservedAttributes:!0}:{})}function T(){let e=g.getStore();return e||i(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,T),e.stepMetadata}function E(){let e=g.getStore();return e||o(`getWorkflowMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-workflow-metadata`,E),e.workflowMetadata}function D(e={}){let t=g.getStore();t||o(`getWritable()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-writable`,D);let{namespace:n}=e,i=t.workflowMetadata.workflowRunId,h=d(i,n),_=t.writables??=new Map,v=_.get(h);if(v)return v.writable;let y=f(l(globalThis,t.ops,i,t.encryptionKey),t.encryptionKey),b=new m(i,h),x=c();return t.ops.push(x.promise),p(y.readable,b,x).catch(()=>{}),u(y.writable,x),Object.defineProperty(y.writable,s,{value:h,writable:!1}),Object.defineProperty(y.writable,a,{value:i,writable:!1}),t.workflowDeploymentId&&Object.defineProperty(y.writable,r,{value:t.workflowDeploymentId,writable:!1}),_.set(h,{writable:y.writable,state:x}),y.writable}export{t as FatalError,e as RetryableError,b as createHook,x as createWebhook,S as defineHook,w as experimental_setAttributes,T as getStepMetadata,E as getWorkflowMetadata,D as getWritable,y as sleep};
1
+ import{c as e,i as t}from"../../_chunks/workflow/dist-6a3viBXZ.js";import{Jn as n,Jt as r,Kt as i,L as a,R as o,S as s,Xn as c,Yn as l,an as u,h as d,in as f,on as p,qt as m,rn as h,t as g,w as _}from"../../_chunks/workflow/attribute-changes-DGVGRGfw.js";import{n as v}from"../../_chunks/workflow/resume-hook-DMSadN9o.js";import{t as y}from"../../_chunks/workflow/sleep-CpXfoXLF.js";function b(e){l(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,b)}function x(e){l(`createWebhook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-webhook`,x)}function S({schema:e}={}){function t(e){l(`defineHook().create()`,`https://workflow-sdk.dev/docs/api-reference/workflow/define-hook`,t)}return{create:t,async resume(t,n){if(!e?.[`~standard`])return await v(t,n);let r=e[`~standard`].validate(n);if(r instanceof Promise&&(r=await r),r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>String(typeof e==`object`&&e?e.key:e)).join(`.`);return t?` at "${t}": ${e.message}`:` ${e.message}`});throw Error(`Hook payload did not match the defined schema:\n${e.join(`
2
+ `)}`)}return await v(t,r.value)}}}async function C(e,n={}){let r=o.getStore(),i=r?.workflowMetadata?.workflowRunId;if(!i)throw new t(`experimental_setAttributes() must be called from a 'use workflow' or 'use step' function. Calling it from plain host code is not supported.`);let a=g(e,n);a.length!==0&&await(await h()).events.create(i,{eventType:`attr_set`,specVersion:4,eventData:{changes:a,writer:{type:`step`,stepId:r.stepMetadata.stepId,attempt:r.stepMetadata.attempt},...n.allowReservedAttributes===!0?{allowReservedAttributes:!0}:{}}})}function w(){let e=o.getStore();return e||n(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,w),e.stepMetadata}function T(){let e=o.getStore();return e||c(`getWorkflowMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-workflow-metadata`,T),e.workflowMetadata}function E(e={}){let t=o.getStore();t||c(`getWritable()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-writable`,E);let{namespace:n}=e,l=t.workflowMetadata.workflowRunId,h=a(l,n),g=t.writables??=new Map,v=g.get(h);if(v)return v.writable;let y=_(s(globalThis,t.ops,l,t.encryptionKey,!0),t.encryptionKey),b=new d(l,h),x=f();return t.ops.push(x.promise),u(y.readable,b,x).catch(()=>{}),p(y.writable,x),Object.defineProperty(y.writable,i,{value:h,writable:!1}),Object.defineProperty(y.writable,r,{value:l,writable:!1}),t.workflowDeploymentId&&Object.defineProperty(y.writable,m,{value:t.workflowDeploymentId,writable:!1}),g.set(h,{writable:y.writable,state:x}),y.writable}export{t as FatalError,e as RetryableError,b as createHook,x as createWebhook,S as defineHook,C as experimental_setAttributes,w as getStepMetadata,T as getWorkflowMetadata,E as getWritable,y as sleep};
@@ -10,6 +10,12 @@ export interface StartOptionsBase {
10
10
  * The spec version to use for the workflow run. Defaults to the latest version.
11
11
  */
12
12
  specVersion?: number;
13
+ /**
14
+ * Plaintext attributes to seed on the run as it is created.
15
+ *
16
+ * Available for native-attributes runs (spec version 4 and later).
17
+ */
18
+ attributes?: Record<string, string>;
13
19
  }
14
20
  export interface StartOptionsWithDeploymentId extends StartOptionsBase {
15
21
  /**
@@ -24,10 +24,23 @@ export interface SuspensionHandlerResult {
24
24
  * into the same batch boundary.
25
25
  */
26
26
  createdStepCorrelationIds: Set<string>;
27
- /** Timeout from waits, if any */
28
- timeoutSeconds?: number;
27
+ /**
28
+ * The soonest pending wait, if any: seconds until it elapses and the
29
+ * correlationId of the wait that produced that timeout. The
30
+ * correlationId seeds the idempotency key for the wait-continuation
31
+ * queue message so that repeated suspension passes over the same
32
+ * pending wait collapse into a single delayed continuation.
33
+ */
34
+ waitTimeout?: {
35
+ seconds: number;
36
+ correlationId: string;
37
+ };
29
38
  /** Whether a hook conflict was detected (should re-invoke immediately) */
30
39
  hasHookConflict: boolean;
40
+ /** Whether a `hook.getConflict()` awaiter needs the workflow to continue immediately */
41
+ hasAwaitedHookCreation: boolean;
42
+ /** Whether native workflow attribute events were written for replay. */
43
+ hasAttributeEvents: boolean;
31
44
  }
32
45
  /**
33
46
  * Handles a workflow suspension by processing all pending operations (hooks, steps, waits).
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Wait-continuation dispatch: delay + idempotency-key selection.
3
+ *
4
+ * When V2 suspension processing observes a pending wait, it enqueues a
5
+ * delayed "continuation" message that fires once the wait elapses and
6
+ * drives the next replay (which completes the wait via the "complete
7
+ * elapsed waits" pass). This module decides the message's `delaySeconds`
8
+ * and `idempotencyKey`.
9
+ *
10
+ * The continuation is keyed on the wait's correlationId: while a wait is
11
+ * pending, every replay pass over the run re-observes it (e.g., once per
12
+ * step completion in `Promise.all([steps..., sleep()])`), and without
13
+ * dedupe each pass would enqueue another delayed continuation — each one
14
+ * a spurious full replay when the wait elapses, and each a fresh message
15
+ * that resets the delivery-attempt runaway guard. A key is attached in
16
+ * all cases: some worlds (e.g. world-postgres) serialize key-less
17
+ * workflow messages per run, which would park the continuation behind
18
+ * the handler's own inline step execution and defeat the race semantics
19
+ * the continuation exists to provide.
20
+ *
21
+ * The bare correlationId cannot be the key in every case, though: world
22
+ * dedupe windows outlive the first delivery (VQS keeps idempotency
23
+ * records until message-retention TTL; world-postgres keeps a
24
+ * completed-keys cache), so once a key has been used, a later enqueue
25
+ * under the same key is silently dropped. Any situation where a
26
+ * continuation is delivered while its wait is still pending therefore
27
+ * needs a fresh key for the re-enqueue, or the wait's timer is lost and
28
+ * the run stalls until unrelated traffic happens to wake it. Two such
29
+ * situations exist, each with its own key variation:
30
+ *
31
+ * - Waits longer than the maximum queue delay are chained: the delay is
32
+ * clamped to `WAIT_CONTINUATION_MAX_DELAY_SECONDS` (23h — VQS messages
33
+ * have a 24h retention limit, and one hour of buffer matches
34
+ * world-vercel's own clamp for delayed re-enqueues), so the
35
+ * continuation intentionally fires early, re-observes the wait, and
36
+ * must enqueue the next hop. The key is suffixed with the hop index
37
+ * (`ceil(timeoutSeconds / maxDelay)`): stable for every re-observation
38
+ * within the same hop window (so passes dedupe), decremented at each
39
+ * hop delivery (so the chain always advances). Worlds without a delay
40
+ * limit (world-postgres, world-local) simply take the same ≤23h hops.
41
+ *
42
+ * - Near-elapsed waits (≤2s remaining) get a second-bucketed suffix. A
43
+ * continuation delivered marginally early (clock skew between the
44
+ * enqueuing and handling hosts; the ceil() on the delay can leave a ~0
45
+ * margin) re-observes the wait as pending with ~1s remaining and must
46
+ * be able to enqueue a fresh short-delay retry. The bucket suffix
47
+ * keeps that retry enqueueable (its ≥1s delay guarantees a later
48
+ * bucket) while still collapsing same-instant duplicates.
49
+ *
50
+ * Mid-range waits (more than the near-elapsed threshold, at most one
51
+ * hop) use the bare correlationId: every re-observation targets the same
52
+ * deadline, so deduping to the first message is semantically lossless.
53
+ * Host clock skew beyond the near-elapsed threshold could in principle
54
+ * deliver such a continuation early enough to re-observe its wait and
55
+ * lose the re-enqueue to the burnt key; the threshold is the skew
56
+ * tolerance we accept for the benefit of exactly-one continuation per
57
+ * wait.
58
+ */
59
+ /**
60
+ * Maximum `delaySeconds` for a single wait-continuation message. Waits
61
+ * longer than this are chained across multiple hops. 23 hours: VQS
62
+ * messages have a 24h retention limit; the 1h buffer mirrors
63
+ * world-vercel's `MAX_DELAY_SECONDS`.
64
+ */
65
+ export declare const WAIT_CONTINUATION_MAX_DELAY_SECONDS = 82800;
66
+ /**
67
+ * Waits with at most this many seconds remaining use a second-bucketed
68
+ * idempotency key so an early-delivered continuation can re-enqueue its
69
+ * short-delay retry. This is also the host clock-skew tolerance for
70
+ * mid-range waits keyed on the bare correlationId.
71
+ */
72
+ export declare const NEAR_ELAPSED_WAIT_THRESHOLD_SECONDS = 2;
73
+ export interface WaitContinuationDispatch {
74
+ delaySeconds: number;
75
+ idempotencyKey: string;
76
+ }
77
+ /**
78
+ * Computes the queue delay and idempotency key for a wait-continuation
79
+ * message. `timeoutSeconds` is the time until the wait's `resumeAt`
80
+ * (floored at 1s by the suspension handler); `waitCorrelationId`
81
+ * identifies the wait so repeated suspension passes dedupe.
82
+ */
83
+ export declare function getWaitContinuationDispatch(timeoutSeconds: number, waitCorrelationId: string, now?: number): WaitContinuationDispatch;
84
+ //# sourceMappingURL=wait-continuation.d.ts.map