experimental-ash 0.22.2 → 0.24.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.
Files changed (172) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/docs/internals/hooks.md +13 -16
  3. package/dist/docs/internals/message-runtime.md +1 -1
  4. package/dist/docs/public/auth-and-route-protection.md +3 -3
  5. package/dist/docs/public/faqs.md +67 -0
  6. package/dist/docs/public/meta.json +1 -0
  7. package/dist/docs/public/schedules.md +11 -0
  8. package/dist/docs/public/session-context.md +46 -89
  9. package/dist/docs/public/skills.md +13 -0
  10. package/dist/docs/public/subagents.md +12 -6
  11. package/dist/docs/public/tools.md +9 -13
  12. package/dist/docs/public/typescript-api.md +4 -4
  13. package/dist/src/channel/types.d.ts +10 -12
  14. package/dist/src/chunks/{client-CKsU8Li3.js → client-nshDsWNF.js} +1 -1
  15. package/dist/src/chunks/{dev-authored-source-watcher-BLzYWh05.js → dev-authored-source-watcher-B4PaZGUr.js} +1 -1
  16. package/dist/src/chunks/host-DsW72Q-w.js +65 -0
  17. package/dist/src/chunks/paths-OknjaYR8.js +89 -0
  18. package/dist/src/chunks/prewarm-B4YblQ5m.js +6 -0
  19. package/dist/src/cli/commands/info.js +1 -1
  20. package/dist/src/cli/dev/repl.js +2 -2
  21. package/dist/src/cli/run.js +1 -1
  22. package/dist/src/client/session.js +8 -0
  23. package/dist/src/client/types.d.ts +12 -1
  24. package/dist/src/compiled/.vendor-stamp.json +3 -3
  25. package/dist/src/compiled/@workflow/core/_ms.d.ts +4 -0
  26. package/dist/src/compiled/@workflow/core/_workflow-serde.d.ts +5 -0
  27. package/dist/src/compiled/@workflow/core/_workflow-utils.d.ts +8 -0
  28. package/dist/src/compiled/@workflow/core/_workflow-world.d.ts +59 -0
  29. package/dist/src/compiled/@workflow/core/capabilities.d.ts +45 -0
  30. package/dist/src/compiled/@workflow/core/capture-stack.d.ts +16 -0
  31. package/dist/src/compiled/@workflow/core/class-serialization.d.ts +31 -0
  32. package/dist/src/compiled/@workflow/core/classify-error.d.ts +20 -0
  33. package/dist/src/compiled/@workflow/core/context-errors.d.ts +27 -0
  34. package/dist/src/compiled/@workflow/core/context-violation-error.d.ts +97 -0
  35. package/dist/src/compiled/@workflow/core/create-hook.d.ts +179 -0
  36. package/dist/src/compiled/@workflow/core/define-hook.d.ts +68 -0
  37. package/dist/src/compiled/@workflow/core/describe-error.d.ts +70 -0
  38. package/dist/src/compiled/@workflow/core/encryption.d.ts +51 -0
  39. package/dist/src/compiled/@workflow/core/events-consumer.d.ts +64 -0
  40. package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +82 -0
  41. package/dist/src/compiled/@workflow/core/global.d.ts +48 -0
  42. package/dist/src/compiled/@workflow/core/index.d.ts +19 -38
  43. package/dist/src/compiled/@workflow/core/index.js +2 -2
  44. package/dist/src/compiled/@workflow/core/log-format.d.ts +25 -0
  45. package/dist/src/compiled/@workflow/core/logger.d.ts +29 -0
  46. package/dist/src/compiled/@workflow/core/package.json +1 -1
  47. package/dist/src/compiled/@workflow/core/private.d.ts +59 -10
  48. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +51 -0
  49. package/dist/src/compiled/@workflow/core/runtime/get-port-lazy.d.ts +10 -0
  50. package/dist/src/compiled/@workflow/core/runtime/get-world-lazy.d.ts +32 -0
  51. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +97 -0
  52. package/dist/src/compiled/@workflow/core/runtime/replay-budget.d.ts +98 -0
  53. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +77 -0
  54. package/dist/src/compiled/@workflow/core/runtime/run.d.ts +134 -0
  55. package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +50 -0
  56. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +59 -0
  57. package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +40 -0
  58. package/dist/src/compiled/@workflow/core/runtime/step-handler.d.ts +2 -0
  59. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +42 -0
  60. package/dist/src/compiled/@workflow/core/runtime/world-init.d.ts +75 -0
  61. package/dist/src/compiled/@workflow/core/runtime/world.d.ts +32 -0
  62. package/dist/src/compiled/@workflow/core/runtime.d.ts +22 -67
  63. package/dist/src/compiled/@workflow/core/runtime.js +27 -27
  64. package/dist/src/compiled/@workflow/core/schemas.d.ts +15 -0
  65. package/dist/src/compiled/@workflow/core/serialization/client.d.ts +17 -0
  66. package/dist/src/compiled/@workflow/core/serialization/codec-devalue.d.ts +14 -0
  67. package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +90 -0
  68. package/dist/src/compiled/@workflow/core/serialization/encryption.d.ts +32 -0
  69. package/dist/src/compiled/@workflow/core/serialization/errors.d.ts +21 -0
  70. package/dist/src/compiled/@workflow/core/serialization/format.d.ts +60 -0
  71. package/dist/src/compiled/@workflow/core/serialization/index.d.ts +18 -0
  72. package/dist/src/compiled/@workflow/core/serialization/reducers/class.d.ts +11 -0
  73. package/dist/src/compiled/@workflow/core/serialization/reducers/common.d.ts +16 -0
  74. package/dist/src/compiled/@workflow/core/serialization/reducers/step-function.d.ts +35 -0
  75. package/dist/src/compiled/@workflow/core/serialization/step.d.ts +17 -0
  76. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +215 -0
  77. package/dist/src/compiled/@workflow/core/serialization/workflow.d.ts +29 -0
  78. package/dist/src/compiled/@workflow/core/serialization-format.d.ts +171 -0
  79. package/dist/src/compiled/@workflow/core/serialization.d.ts +337 -0
  80. package/dist/src/compiled/@workflow/core/sleep.d.ts +33 -0
  81. package/dist/src/compiled/@workflow/core/source-map.d.ts +10 -0
  82. package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +13 -0
  83. package/dist/src/compiled/@workflow/core/step/get-closure-vars.d.ts +9 -0
  84. package/dist/src/compiled/@workflow/core/step/get-step-metadata.d.ts +42 -0
  85. package/dist/src/compiled/@workflow/core/step/get-workflow-metadata.d.ts +7 -0
  86. package/dist/src/compiled/@workflow/core/step/writable-stream.d.ts +22 -0
  87. package/dist/src/compiled/@workflow/core/step.d.ts +4 -0
  88. package/dist/src/compiled/@workflow/core/symbols.d.ts +36 -0
  89. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +283 -0
  90. package/dist/src/compiled/@workflow/core/telemetry.d.ts +53 -0
  91. package/dist/src/compiled/@workflow/core/types.d.ts +14 -0
  92. package/dist/src/compiled/@workflow/core/util.d.ts +40 -0
  93. package/dist/src/compiled/@workflow/core/version.d.ts +2 -0
  94. package/dist/src/compiled/@workflow/core/vm/index.d.ts +17 -0
  95. package/dist/src/compiled/@workflow/core/vm/uint8array-base64.d.ts +21 -0
  96. package/dist/src/compiled/@workflow/core/vm/uuid.d.ts +10 -0
  97. package/dist/src/compiled/@workflow/core/workflow/abort-controller.d.ts +65 -0
  98. package/dist/src/compiled/@workflow/core/workflow/create-hook.d.ts +7 -0
  99. package/dist/src/compiled/@workflow/core/workflow/define-hook.d.ts +10 -0
  100. package/dist/src/compiled/@workflow/core/workflow/get-workflow-metadata.d.ts +32 -0
  101. package/dist/src/compiled/@workflow/core/workflow/hook.d.ts +4 -0
  102. package/dist/src/compiled/@workflow/core/workflow/index.d.ts +11 -0
  103. package/dist/src/compiled/@workflow/core/workflow/sleep.d.ts +4 -0
  104. package/dist/src/compiled/@workflow/core/workflow/world-init-stub.d.ts +15 -0
  105. package/dist/src/compiled/@workflow/core/workflow/writable-stream.d.ts +3 -0
  106. package/dist/src/compiled/@workflow/core/workflow.d.ts +1 -38
  107. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  108. package/dist/src/compiled/@workflow/errors/error-codes.d.ts +5 -1
  109. package/dist/src/compiled/@workflow/errors/index.d.ts +15 -1
  110. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  111. package/dist/src/compiled/@workflow/errors/package.json +1 -1
  112. package/dist/src/compiled/_chunks/workflow/{context-errors-zbKocOyk.js → context-errors-Bbvvp-li.js} +2 -2
  113. package/dist/src/compiled/_chunks/workflow/{dist-0iNBqPYp.js → dist-C7wPwOI9.js} +2 -2
  114. package/dist/src/compiled/_chunks/workflow/{dist-D774SUM4.js → dist-C_oiE-l7.js} +1 -1
  115. package/dist/src/compiled/_chunks/workflow/resume-hook-C3VWUPii.js +12 -0
  116. package/dist/src/compiled/_chunks/workflow/sleep-QTkC1VFe.js +1 -0
  117. package/dist/src/compiled/_chunks/workflow/{symbols-D-4tVV8x.js → symbols-QezhMuLg.js} +1 -1
  118. package/dist/src/evals/cli/eval.js +1 -1
  119. package/dist/src/execution/await-authorization-orchestrator.d.ts +2 -1
  120. package/dist/src/execution/await-authorization-orchestrator.js +4 -0
  121. package/dist/src/execution/connection-auth-steps.d.ts +4 -0
  122. package/dist/src/execution/connection-auth-steps.js +9 -11
  123. package/dist/src/execution/node-step.d.ts +4 -5
  124. package/dist/src/execution/subagent-adapter.d.ts +0 -27
  125. package/dist/src/execution/subagent-adapter.js +2 -66
  126. package/dist/src/execution/subagent-hitl-proxy.d.ts +2 -2
  127. package/dist/src/execution/subagent-hitl-proxy.js +2 -2
  128. package/dist/src/execution/task-mode.d.ts +3 -3
  129. package/dist/src/execution/task-mode.js +3 -3
  130. package/dist/src/execution/turn-workflow.d.ts +41 -0
  131. package/dist/src/execution/turn-workflow.js +96 -0
  132. package/dist/src/execution/workflow-entry.js +77 -87
  133. package/dist/src/execution/workflow-errors.d.ts +14 -0
  134. package/dist/src/execution/workflow-errors.js +54 -0
  135. package/dist/src/execution/workflow-runtime.d.ts +34 -3
  136. package/dist/src/execution/workflow-runtime.js +52 -10
  137. package/dist/src/execution/workflow-steps.d.ts +27 -2
  138. package/dist/src/execution/workflow-steps.js +31 -26
  139. package/dist/src/harness/instrumentation-config.js +14 -7
  140. package/dist/src/harness/messages.d.ts +7 -7
  141. package/dist/src/harness/messages.js +4 -4
  142. package/dist/src/harness/runtime-actions.d.ts +4 -4
  143. package/dist/src/internal/application/package.js +1 -1
  144. package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +1 -1
  145. package/dist/src/internal/workflow-bundle/workflow-builders.js +20 -8
  146. package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +13 -0
  147. package/dist/src/internal/workflow-bundle/workflow-transformer.js +10 -4
  148. package/dist/src/protocol/message.d.ts +6 -1
  149. package/dist/src/public/channels/ash.js +50 -3
  150. package/dist/src/public/context/index.d.ts +4 -7
  151. package/dist/src/public/context/index.js +4 -5
  152. package/dist/src/public/definitions/state.d.ts +33 -0
  153. package/dist/src/public/definitions/state.js +34 -0
  154. package/dist/src/public/next/index.d.ts +7 -0
  155. package/dist/src/public/next/index.js +2 -0
  156. package/dist/src/public/next/vercel-json.d.ts +1 -0
  157. package/dist/src/public/next/vercel-json.js +1 -0
  158. package/dist/src/react/index.d.ts +1 -1
  159. package/dist/src/react/use-ash-agent.d.ts +8 -0
  160. package/dist/src/react/use-ash-agent.js +26 -4
  161. package/dist/src/services/dev-client.d.ts +4 -1
  162. package/dist/src/services/dev-client.js +1 -0
  163. package/package.json +4 -4
  164. package/dist/src/chunks/host-DREC8e8Z.js +0 -65
  165. package/dist/src/chunks/paths-C6sp4T2U.js +0 -88
  166. package/dist/src/chunks/prewarm-hz8p2jlZ.js +0 -6
  167. package/dist/src/compiled/_chunks/workflow/resume-hook-CL8Ed91K.js +0 -12
  168. package/dist/src/compiled/_chunks/workflow/sleep-Dn3i9nxI.js +0 -1
  169. package/dist/src/execution/continuous-entry.d.ts +0 -59
  170. package/dist/src/execution/continuous-entry.js +0 -487
  171. package/dist/src/execution/continuous-runtime.d.ts +0 -17
  172. package/dist/src/execution/continuous-runtime.js +0 -123
@@ -0,0 +1,32 @@
1
+ import type { World } from '../_workflow-world.js';
2
+ /**
3
+ * Create a new world instance based on environment variables.
4
+ * WORKFLOW_TARGET_WORLD is used to determine the target world.
5
+ *
6
+ * Note: WORKFLOW_VERCEL_* env vars (PROJECT, TEAM, AUTH_TOKEN, etc.) are
7
+ * intentionally NOT read here. Those are for CLI/observability tooling only
8
+ * and should not affect runtime behavior. The Vercel runtime provides
9
+ * authentication via OIDC tokens and project context via system env vars
10
+ * (VERCEL_DEPLOYMENT_ID, VERCEL_PROJECT_ID). Tooling that needs these env
11
+ * vars should call createVercelWorld() directly with an explicit config and
12
+ * use setWorld() to inject the instance.
13
+ */
14
+ export declare const createWorld: () => Promise<World>;
15
+ export type WorldHandlers = Pick<World, 'createQueueHandler' | 'specVersion'>;
16
+ /**
17
+ * Some functions from the world are needed at build time, but we do NOT want
18
+ * to cache the world in those instances for general use, since we don't have
19
+ * the correct environment variables set yet. This is a safe function to
20
+ * call at build time, that only gives access to non-environment-bound world
21
+ * functions. The only binding value should be the target world.
22
+ * Once we migrate to a file-based configuration (workflow.config.ts), we should
23
+ * be able to re-combine getWorld and getWorldHandlers into one singleton.
24
+ */
25
+ export declare const getWorldHandlers: () => Promise<WorldHandlers>;
26
+ export declare const getWorld: () => Promise<World>;
27
+ /**
28
+ * Reset the cached world instance. This should be called when environment
29
+ * variables change and you need to reinitialize the world with new config.
30
+ */
31
+ export declare const setWorld: (world: World | undefined) => void;
32
+ //# sourceMappingURL=world.d.ts.map
@@ -1,67 +1,22 @@
1
- export type Event = any;
2
- export type WorkflowRun = any;
3
- export type WorkflowReadableStream<T = unknown> = ReadableStream<T>;
4
- export interface WorkflowReadableStreamOptions {
5
- [key: string]: unknown;
6
- }
7
- export interface WorkflowWritableStreamOptions {
8
- namespace?: string | undefined;
9
- }
10
- export type HealthCheckEndpoint = any;
11
- export type HealthCheckOptions = any;
12
- export type HealthCheckResult = any;
13
- export type ReadStreamOptions = any;
14
- export type RecreateRunOptions = any;
15
- export type StartOptions = any;
16
- export type StartOptionsBase = any;
17
- export type StartOptionsWithDeploymentId = any;
18
- export type StartOptionsWithoutDeploymentId = any;
19
- export type StopSleepOptions = any;
20
- export type StopSleepResult = any;
21
- export interface WorkflowWorldCollection {
22
- get(id: string, options?: Record<string, any>): Promise<any>;
23
- get(params?: Record<string, any>, options?: Record<string, any>): Promise<any>;
24
- list(
25
- params?: Record<string, any>,
26
- ): Promise<{ cursor?: string | null; data: any[]; hasMore?: boolean }>;
27
- }
28
- export interface WorkflowWorld {
29
- readonly events: WorkflowWorldCollection;
30
- readonly hooks: WorkflowWorldCollection;
31
- readonly runs: WorkflowWorldCollection;
32
- readonly steps: WorkflowWorldCollection;
33
- }
34
- export declare class Run<T = any> {
35
- readonly runId: string;
36
- readonly readable: ReadableStream<Uint8Array>;
37
- readonly returnValue: Promise<T>;
38
- readonly status: Promise<string>;
39
- cancel(): Promise<void>;
40
- getReadable(options?: WorkflowReadableStreamOptions): ReadableStream<Uint8Array>;
41
- }
42
- export declare class WorkflowSuspension extends Error {}
43
- export declare function cancelRun(...args: unknown[]): Promise<unknown>;
44
- export declare function createWorld(...args: unknown[]): Promise<unknown>;
45
- export declare function getHookByToken(...args: unknown[]): Promise<unknown>;
46
- export declare function getRun<T = unknown>(runId: string): Run<T>;
47
- export declare function getWorld(): Promise<WorkflowWorld>;
48
- export declare function getWorldHandlers(): Promise<any>;
49
- export declare function healthCheck(...args: unknown[]): Promise<HealthCheckResult>;
50
- export declare function listStreams(...args: unknown[]): Promise<unknown>;
51
- export declare function readStream<T = unknown>(
52
- ...args: unknown[]
53
- ): Promise<WorkflowReadableStream<T>>;
54
- export declare function recreateRunFromExisting(...args: unknown[]): Promise<unknown>;
55
- export declare function reenqueueRun(...args: unknown[]): Promise<unknown>;
56
- export declare function resumeHook<T = unknown>(token: string, value?: T): Promise<void>;
57
- export declare function resumeWebhook<T = unknown>(token: string, value?: T): Promise<Response>;
58
- export declare function setWorld(world: unknown): void;
59
- export declare function start<T = any>(
60
- workflow: unknown,
61
- args?: unknown[],
62
- options?: StartOptions,
63
- ): Promise<Run<T>>;
64
- export declare function wakeUpRun(...args: unknown[]): Promise<unknown>;
65
- export declare function workflowEntrypoint(
66
- workflowCode: string,
67
- ): (req: Request) => Promise<Response>;
1
+ import { type Event, type WorkflowRun } from './_workflow-world.js';
2
+ export type { Event, WorkflowRun };
3
+ export { WorkflowSuspension } from './global.js';
4
+ export { type HealthCheckEndpoint, type HealthCheckOptions, type HealthCheckResult, healthCheck, } from './runtime/helpers.js';
5
+ export { getHookByToken, resumeHook, resumeWebhook, } from './runtime/resume-hook.js';
6
+ export { getRun, Run, type WorkflowReadableStream, type WorkflowReadableStreamOptions, } from './runtime/run.js';
7
+ export { cancelRun, listStreams, type ReadStreamOptions, type RecreateRunOptions, readStream, recreateRunFromExisting, reenqueueRun, type StopSleepOptions, type StopSleepResult, wakeUpRun, } from './runtime/runs.js';
8
+ export { type StartOptions, type StartOptionsBase, type StartOptionsWithDeploymentId, type StartOptionsWithoutDeploymentId, start, } from './runtime/start.js';
9
+ export { createWorld, getWorld, getWorldHandlers, setWorld, } from './runtime/world.js';
10
+ /**
11
+ * Creates a single route which handles workflow execution requests,
12
+ * executing steps inline when possible to reduce function invocations
13
+ * and queue overhead.
14
+ *
15
+ * The handler loops: replay workflow → execute step inline → replay → ...
16
+ * until the workflow completes, times out, or encounters non-step suspensions.
17
+ *
18
+ * @param workflowCode - The workflow bundle code containing all workflow functions
19
+ * @returns A function that can be used as a Vercel API route
20
+ */
21
+ export declare function workflowEntrypoint(workflowCode: string): (req: Request) => Promise<Response>;
22
+ //# sourceMappingURL=runtime.d.ts.map