@keystrokehq/keystroke 0.0.88 → 0.0.89

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 (69) hide show
  1. package/dist/action.cjs +1 -1
  2. package/dist/action.d.cts +2 -2
  3. package/dist/action.d.mts +2 -2
  4. package/dist/action.mjs +1 -1
  5. package/dist/agent.cjs +3 -3
  6. package/dist/agent.d.cts +3 -3
  7. package/dist/agent.d.mts +3 -3
  8. package/dist/agent.mjs +3 -3
  9. package/dist/config.d.cts +1 -1
  10. package/dist/config.d.cts.map +1 -1
  11. package/dist/config.d.mts +1 -1
  12. package/dist/config.d.mts.map +1 -1
  13. package/dist/credentials.cjs +1 -1
  14. package/dist/credentials.d.cts +1 -1
  15. package/dist/credentials.d.mts +1 -1
  16. package/dist/credentials.mjs +1 -1
  17. package/dist/{dist-DgIJtGrg.mjs → dist-BFyot0Xl.mjs} +27 -41
  18. package/dist/{dist-DgIJtGrg.mjs.map → dist-BFyot0Xl.mjs.map} +1 -1
  19. package/dist/{dist-B1Dy8DVb.cjs → dist-CIwENY01.cjs} +27 -41
  20. package/dist/{dist-B1Dy8DVb.cjs.map → dist-CIwENY01.cjs.map} +1 -1
  21. package/dist/{dist-DYbhRy-F.mjs → dist-CnS5tygi.mjs} +13 -1
  22. package/dist/dist-CnS5tygi.mjs.map +1 -0
  23. package/dist/{dist-BdtvGgfO.mjs → dist-DL6FMwfb.mjs} +200 -122
  24. package/dist/dist-DL6FMwfb.mjs.map +1 -0
  25. package/dist/{dist-BM_f7hFN.cjs → dist-DLFFj5pe.cjs} +13 -1
  26. package/dist/dist-DLFFj5pe.cjs.map +1 -0
  27. package/dist/{dist-CZZMGcuu.cjs → dist-iCJ9uxzf.cjs} +211 -127
  28. package/dist/dist-iCJ9uxzf.cjs.map +1 -0
  29. package/dist/{index-Bv6uZ8Xd.d.mts → index-C6_DVB_V.d.cts} +14 -17
  30. package/dist/index-C6_DVB_V.d.cts.map +1 -0
  31. package/dist/{index-avLUReqf.d.cts → index-CfK7yBQI.d.cts} +2 -2
  32. package/dist/{index-CvXJv3hY.d.mts.map → index-CfK7yBQI.d.cts.map} +1 -1
  33. package/dist/{index-BeEymXir.d.cts → index-CiuCYKLw.d.cts} +22 -2
  34. package/dist/index-CiuCYKLw.d.cts.map +1 -0
  35. package/dist/{index-BeEymXir.d.mts → index-CiuCYKLw.d.mts} +22 -2
  36. package/dist/index-CiuCYKLw.d.mts.map +1 -0
  37. package/dist/{index-CpJJgeJ2.d.cts → index-DwZkaYLS.d.mts} +14 -17
  38. package/dist/index-DwZkaYLS.d.mts.map +1 -0
  39. package/dist/{index-BwRlj7pv.d.cts → index-MfPRY7cK.d.cts} +2 -2
  40. package/dist/{index-BspW44XX.d.mts.map → index-MfPRY7cK.d.cts.map} +1 -1
  41. package/dist/{index-CvXJv3hY.d.mts → index-by6PXA-8.d.mts} +2 -2
  42. package/dist/{index-avLUReqf.d.cts.map → index-by6PXA-8.d.mts.map} +1 -1
  43. package/dist/{index-BspW44XX.d.mts → index-ptRM3z9H.d.mts} +2 -2
  44. package/dist/{index-BwRlj7pv.d.cts.map → index-ptRM3z9H.d.mts.map} +1 -1
  45. package/dist/{mistral-Deqt4GvJ.cjs → mistral-BPMTd7Oz.cjs} +2 -2
  46. package/dist/{mistral-Deqt4GvJ.cjs.map → mistral-BPMTd7Oz.cjs.map} +1 -1
  47. package/dist/{mistral-wT_K1dZn.mjs → mistral-DoHWkziU.mjs} +2 -2
  48. package/dist/{mistral-wT_K1dZn.mjs.map → mistral-DoHWkziU.mjs.map} +1 -1
  49. package/dist/{sse-D12n5Ckf.mjs → sse-CWAja0ZC.mjs} +2 -2
  50. package/dist/{sse-D12n5Ckf.mjs.map → sse-CWAja0ZC.mjs.map} +1 -1
  51. package/dist/{sse-DvOq9Ntd.cjs → sse-D-SrPUr3.cjs} +2 -2
  52. package/dist/{sse-DvOq9Ntd.cjs.map → sse-D-SrPUr3.cjs.map} +1 -1
  53. package/dist/trigger.cjs +1 -1
  54. package/dist/trigger.d.cts +2 -2
  55. package/dist/trigger.d.mts +2 -2
  56. package/dist/trigger.mjs +1 -1
  57. package/dist/workflow.cjs +3 -2
  58. package/dist/workflow.d.cts +2 -2
  59. package/dist/workflow.d.mts +2 -2
  60. package/dist/workflow.mjs +2 -2
  61. package/package.json +1 -1
  62. package/dist/dist-BM_f7hFN.cjs.map +0 -1
  63. package/dist/dist-BdtvGgfO.mjs.map +0 -1
  64. package/dist/dist-CZZMGcuu.cjs.map +0 -1
  65. package/dist/dist-DYbhRy-F.mjs.map +0 -1
  66. package/dist/index-BeEymXir.d.cts.map +0 -1
  67. package/dist/index-BeEymXir.d.mts.map +0 -1
  68. package/dist/index-Bv6uZ8Xd.d.mts.map +0 -1
  69. package/dist/index-CpJJgeJ2.d.cts.map +0 -1
@@ -1,6 +1,6 @@
1
1
  const require_dist = require("./dist-CLqJza2Y.cjs");
2
- const require_dist$1 = require("./dist-BM_f7hFN.cjs");
3
- const require_dist$2 = require("./dist-B1Dy8DVb.cjs");
2
+ const require_dist$1 = require("./dist-DLFFj5pe.cjs");
3
+ const require_dist$2 = require("./dist-CIwENY01.cjs");
4
4
  let zod = require("zod");
5
5
  let node_async_hooks = require("node:async_hooks");
6
6
  //#region ../workflow/dist/index.mjs
@@ -39,81 +39,39 @@ function formatIssues(issues) {
39
39
  return `${issue.path.length > 0 ? `${issue.path.join(".")}: ` : ""}${issue.message}`;
40
40
  }).join("; ");
41
41
  }
42
- function withCredentialChainOverride(requirements, chain) {
43
- if (!requirements || !chain) return requirements;
44
- return require_dist$1.normalizeCredentialList(requirements).map((requirement) => ({
45
- ...requirement,
46
- chain
47
- }));
48
- }
49
- function createActionRunner(store, runId, options = {}) {
50
- return async (action, input, runOptions) => {
51
- const actionKey = runOptions?.id ?? action.key;
52
- const cached = await store.get(runId, actionKey);
53
- if (cached !== void 0) {
54
- await require_dist$2.withSpan({
55
- kind: "action",
56
- name: actionKey,
57
- refId: `${runId}:${actionKey}`,
58
- metadata: {
59
- runId,
60
- actionKey,
61
- replayed: true
62
- }
63
- }, async () => {
64
- await require_dist$2.logSystem("info", "action replayed from checkpoint", {
65
- runId,
66
- actionKey
67
- });
68
- });
69
- return action.output.parse(cached);
70
- }
71
- return require_dist$2.withSpan({
72
- kind: "action",
73
- name: actionKey,
74
- refId: `${runId}:${actionKey}`,
75
- metadata: {
76
- runId,
77
- actionKey
78
- }
79
- }, async () => require_dist$2.captureConsole(async () => {
80
- const requirements = withCredentialChainOverride(require_dist$1.getActionCredentialRequirements(action), runOptions?.credentialChain);
81
- const contextOverride = runOptions?.credentialSelection ? { selection: runOptions.credentialSelection } : void 0;
82
- const validatedOutput = await require_dist$1.executeAction(action, input, requirements?.length ? await require_dist$2.resolveActionCredentials(requirements, {
83
- resolveCredentials: options.resolveCredentials,
84
- context: options.credentialContext,
85
- oauthAdapter: options.oauthAdapter,
86
- consumer: {
87
- kind: "action",
88
- name: action.key
89
- },
90
- contextOverride
91
- }) : {});
92
- await store.set(runId, actionKey, validatedOutput);
93
- return validatedOutput;
94
- }));
42
+ function serializeWorkflowError(error) {
43
+ if (error instanceof Error) return {
44
+ name: error.name,
45
+ message: error.message
95
46
  };
47
+ return { message: String(error) };
96
48
  }
97
- var MemoryActionStore = class {
98
- records = /* @__PURE__ */ new Map();
99
- key(runId, actionKey) {
100
- return `${runId}:${actionKey}`;
101
- }
102
- async get(runId, actionKey) {
103
- return this.records.get(this.key(runId, actionKey));
104
- }
105
- async set(runId, actionKey, output) {
106
- this.records.set(this.key(runId, actionKey), output);
107
- }
49
+ /** Rebuild an Error from a recorded error so replay re-raises the same failure. */
50
+ function deserializeWorkflowError(data) {
51
+ const serialized = data;
52
+ const error = new Error(serialized?.message ?? "Workflow step failed");
53
+ if (serialized?.name) error.name = serialized.name;
54
+ return error;
55
+ }
56
+ const UNIT_MS = {
57
+ ms: 1,
58
+ s: 1e3,
59
+ m: 6e4,
60
+ h: 36e5,
61
+ d: 864e5
108
62
  };
109
- const storage = new node_async_hooks.AsyncLocalStorage();
110
- require_dist$1.registerWorkflowRunGetter(() => {
111
- const store = storage.getStore();
112
- if (!store) return;
113
- return { actionRunner: store.actionRunner };
114
- });
115
- function runWithWorkflowContext(store, fn) {
116
- return storage.run(store, fn);
63
+ /** Resolve a sleep duration to an absolute resume time. */
64
+ function resolveResumeAt(duration, now = /* @__PURE__ */ new Date()) {
65
+ if (duration instanceof Date) return duration;
66
+ if (typeof duration === "number") return new Date(now.getTime() + Math.max(0, duration));
67
+ return new Date(now.getTime() + parseDurationToMs(duration));
68
+ }
69
+ function parseDurationToMs(value) {
70
+ const match = /^(\d+(?:\.\d+)?)\s*(ms|s|m|h|d)$/.exec(value.trim());
71
+ if (!match) throw new Error(`Invalid sleep duration "${value}". Use a number of ms, a Date, or a string like "5s", "10m", "1h".`);
72
+ const amount = Number(match[1]);
73
+ const unit = match[2];
74
+ return Math.round(amount * UNIT_MS[unit]);
117
75
  }
118
76
  /** Indexes replay events by correlationId for O(1) cache-hit checks during replay. */
119
77
  var EventsConsumer = class {
@@ -132,6 +90,27 @@ var EventsConsumer = class {
132
90
  hasEventType(correlationId, type) {
133
91
  return this.events(correlationId).some((event) => event.type === type);
134
92
  }
93
+ /**
94
+ * Cache lookup for a step. Returns the recorded output on a `step_completed`,
95
+ * re-raises the recorded error on a terminal `step_failed` (so a permanently
96
+ * failed step is not re-executed), and otherwise reports a miss — including
97
+ * when only `step_retrying` events exist (the step re-runs on the next pass).
98
+ */
99
+ getStepResult(correlationId) {
100
+ const events = this.events(correlationId);
101
+ const failed = events.find((event) => event.type === "step_failed");
102
+ if (failed) throw deserializeWorkflowError(failed.data);
103
+ const completed = events.find((event) => event.type === "step_completed");
104
+ if (completed) return {
105
+ completed: true,
106
+ result: completed.data
107
+ };
108
+ return { completed: false };
109
+ }
110
+ /** Number of prior `step_retrying` events recorded for a step (= failed attempts so far). */
111
+ countRetrying(correlationId) {
112
+ return this.events(correlationId).filter((event) => event.type === "step_retrying").length;
113
+ }
135
114
  isSleepCompleted(correlationId) {
136
115
  return this.hasEventType(correlationId, "sleep_completed");
137
116
  }
@@ -154,48 +133,6 @@ var EventsConsumer = class {
154
133
  };
155
134
  }
156
135
  };
157
- /** In-memory durable log for inline execution and tests. */
158
- var MemoryEventLog = class {
159
- events = [];
160
- ids = /* @__PURE__ */ new Set();
161
- async append(event) {
162
- const id = event.id ?? crypto.randomUUID();
163
- if (this.ids.has(id)) return false;
164
- this.ids.add(id);
165
- this.events.push({
166
- id,
167
- runId: event.runId,
168
- seq: this.events.length,
169
- type: event.type,
170
- correlationId: event.correlationId ?? null,
171
- data: event.data ?? null
172
- });
173
- return true;
174
- }
175
- async listReplay(runId) {
176
- return this.events.filter((event) => event.runId === runId).map((event) => ({ ...event }));
177
- }
178
- };
179
- const UNIT_MS = {
180
- ms: 1,
181
- s: 1e3,
182
- m: 6e4,
183
- h: 36e5,
184
- d: 864e5
185
- };
186
- /** Resolve a sleep duration to an absolute resume time. */
187
- function resolveResumeAt(duration, now = /* @__PURE__ */ new Date()) {
188
- if (duration instanceof Date) return duration;
189
- if (typeof duration === "number") return new Date(now.getTime() + Math.max(0, duration));
190
- return new Date(now.getTime() + parseDurationToMs(duration));
191
- }
192
- function parseDurationToMs(value) {
193
- const match = /^(\d+(?:\.\d+)?)\s*(ms|s|m|h|d)$/.exec(value.trim());
194
- if (!match) throw new Error(`Invalid sleep duration "${value}". Use a number of ms, a Date, or a string like "5s", "10m", "1h".`);
195
- const amount = Number(match[1]);
196
- const unit = match[2];
197
- return Math.round(amount * UNIT_MS[unit]);
198
- }
199
136
  /** A promise that never settles — returned by a suspending primitive so the body parks. */
200
137
  function createPendingPromise() {
201
138
  return new Promise(() => {});
@@ -232,13 +169,36 @@ function createReplayState(params) {
232
169
  runId: params.runId,
233
170
  consumer: params.consumer,
234
171
  coordinator: params.coordinator,
172
+ eventLog: params.eventLog,
235
173
  newEvents: [],
236
174
  now: params.now ?? /* @__PURE__ */ new Date(),
237
175
  hookBaseUrl: params.hookBaseUrl,
238
176
  sleepCounter: 0,
239
- hookCounter: 0
177
+ hookCounter: 0,
178
+ stepOccurrences: /* @__PURE__ */ new Map(),
179
+ stepCorrelationIds: /* @__PURE__ */ new Set()
240
180
  };
241
181
  }
182
+ /**
183
+ * Allocate the correlation id for a step. An explicit `.stepId(x)` maps to
184
+ * `step:x` (and must be unique within a run); otherwise the key is
185
+ * `step:<actionKey>#<occurrence>` so that two calls to the same action get
186
+ * distinct, replay-stable ids and inserting an unrelated call never shifts the
187
+ * ids of later calls (unlike a single global ordinal).
188
+ */
189
+ function nextStepCorrelationId(state, actionKey, explicitId) {
190
+ if (explicitId !== void 0) {
191
+ const correlationId = `step:${explicitId}`;
192
+ if (state.stepCorrelationIds.has(correlationId)) throw new Error(`Duplicate step id "${explicitId}" in workflow run ${state.runId}`);
193
+ state.stepCorrelationIds.add(correlationId);
194
+ return correlationId;
195
+ }
196
+ const occurrence = state.stepOccurrences.get(actionKey) ?? 0;
197
+ state.stepOccurrences.set(actionKey, occurrence + 1);
198
+ const correlationId = `step:${actionKey}#${occurrence}`;
199
+ state.stepCorrelationIds.add(correlationId);
200
+ return correlationId;
201
+ }
242
202
  function createSleep(state) {
243
203
  return function sleep(duration) {
244
204
  const correlationId = `sleep#${state.sleepCounter++}`;
@@ -299,6 +259,123 @@ function createHook(state) {
299
259
  };
300
260
  };
301
261
  }
262
+ function withCredentialChainOverride(requirements, chain) {
263
+ if (!requirements || !chain) return requirements;
264
+ return require_dist$1.normalizeCredentialList(requirements).map((requirement) => ({
265
+ ...requirement,
266
+ chain
267
+ }));
268
+ }
269
+ /**
270
+ * Builds the per-run action runner. Each action call resolves a stable
271
+ * `correlation_id`, short-circuits from the durable event log on a cache hit,
272
+ * and otherwise executes and appends `step_completed` immediately (preserving
273
+ * per-step crash durability). A thrown step appends `step_retrying` (non-fatal,
274
+ * re-run on the next attempt) and rethrows; the terminal `step_failed` is
275
+ * written by the job handler once the queue exhausts retries.
276
+ */
277
+ function createActionRunner(state, options = {}) {
278
+ const { runId, consumer, eventLog } = state;
279
+ return async (action, input, runOptions) => {
280
+ const correlationId = nextStepCorrelationId(state, action.key, runOptions?.id);
281
+ const cached = consumer.getStepResult(correlationId);
282
+ if (cached.completed) {
283
+ await require_dist$2.withSpan({
284
+ kind: "action",
285
+ name: action.key,
286
+ refId: `${runId}:${correlationId}`,
287
+ metadata: {
288
+ runId,
289
+ actionKey: action.key,
290
+ correlationId,
291
+ replayed: true
292
+ }
293
+ }, async () => {
294
+ await require_dist$2.logSystem("info", "action replayed from checkpoint", {
295
+ runId,
296
+ actionKey: action.key,
297
+ correlationId
298
+ });
299
+ });
300
+ return action.output.parse(cached.result);
301
+ }
302
+ return require_dist$2.withSpan({
303
+ kind: "action",
304
+ name: action.key,
305
+ refId: `${runId}:${correlationId}`,
306
+ metadata: {
307
+ runId,
308
+ actionKey: action.key,
309
+ correlationId
310
+ }
311
+ }, async () => require_dist$2.captureConsole(async () => {
312
+ try {
313
+ const requirements = withCredentialChainOverride(require_dist$1.getActionCredentialRequirements(action), runOptions?.credentialChain);
314
+ const contextOverride = runOptions?.credentialSelection ? { selection: runOptions.credentialSelection } : void 0;
315
+ const validatedOutput = await require_dist$1.executeAction(action, input, requirements?.length ? await require_dist$2.resolveActionCredentials(requirements, {
316
+ resolveCredentials: options.resolveCredentials,
317
+ context: options.credentialContext,
318
+ oauthAdapter: options.oauthAdapter,
319
+ consumer: {
320
+ kind: "action",
321
+ name: action.key
322
+ },
323
+ contextOverride
324
+ }) : {});
325
+ await eventLog.append({
326
+ id: `step_completed:${runId}:${correlationId}`,
327
+ runId,
328
+ type: "step_completed",
329
+ correlationId,
330
+ data: validatedOutput
331
+ });
332
+ return validatedOutput;
333
+ } catch (error) {
334
+ const attempt = consumer.countRetrying(correlationId);
335
+ await eventLog.append({
336
+ id: `step_retrying:${runId}:${correlationId}:${attempt}`,
337
+ runId,
338
+ type: "step_retrying",
339
+ correlationId,
340
+ data: serializeWorkflowError(error)
341
+ });
342
+ state.failedCorrelationId = correlationId;
343
+ throw error;
344
+ }
345
+ }));
346
+ };
347
+ }
348
+ const storage = new node_async_hooks.AsyncLocalStorage();
349
+ require_dist$1.registerWorkflowRunGetter(() => {
350
+ const store = storage.getStore();
351
+ if (!store) return;
352
+ return { actionRunner: store.actionRunner };
353
+ });
354
+ function runWithWorkflowContext(store, fn) {
355
+ return storage.run(store, fn);
356
+ }
357
+ /** In-memory durable log for inline execution and tests. */
358
+ var MemoryEventLog = class {
359
+ events = [];
360
+ ids = /* @__PURE__ */ new Set();
361
+ async append(event) {
362
+ const id = event.id ?? crypto.randomUUID();
363
+ if (this.ids.has(id)) return false;
364
+ this.ids.add(id);
365
+ this.events.push({
366
+ id,
367
+ runId: event.runId,
368
+ seq: this.events.length,
369
+ type: event.type,
370
+ correlationId: event.correlationId ?? null,
371
+ data: event.data ?? null
372
+ });
373
+ return true;
374
+ }
375
+ async listReplay(runId) {
376
+ return this.events.filter((event) => event.runId === runId).map((event) => ({ ...event }));
377
+ }
378
+ };
302
379
  /**
303
380
  * The single way to run a workflow: replay its event log from the top, execute
304
381
  * un-cached primitives, and either complete/fail or suspend at the first
@@ -312,17 +389,17 @@ function createHook(state) {
312
389
  async function executeWorkflow(workflow, input, options = {}) {
313
390
  const runId = options.runId ?? crypto.randomUUID();
314
391
  const eventLog = options.eventLog ?? new MemoryEventLog();
315
- const actionStore = options.actionStore ?? new MemoryActionStore();
316
392
  const consumer = new EventsConsumer(await eventLog.listReplay(runId));
317
393
  const coordinator = new SuspensionCoordinator();
318
394
  const state = createReplayState({
319
395
  runId,
320
396
  consumer,
321
397
  coordinator,
398
+ eventLog,
322
399
  hookBaseUrl: options.hookBaseUrl,
323
400
  now: options.now
324
401
  });
325
- const actionRunner = createActionRunner(actionStore, runId, {
402
+ const actionRunner = createActionRunner(state, {
326
403
  resolveCredentials: options.resolveCredentials,
327
404
  credentialContext: options.credentialContext,
328
405
  oauthAdapter: options.oauthAdapter
@@ -369,18 +446,13 @@ async function executeWorkflow(workflow, input, options = {}) {
369
446
  };
370
447
  } else result = {
371
448
  status: "failed",
372
- error: outcome.error
449
+ error: outcome.error,
450
+ failedCorrelationId: state.failedCorrelationId
373
451
  };
374
452
  for (const event of state.newEvents) await eventLog.append(event);
375
453
  return result;
376
454
  }
377
455
  //#endregion
378
- Object.defineProperty(exports, "MemoryActionStore", {
379
- enumerable: true,
380
- get: function() {
381
- return MemoryActionStore;
382
- }
383
- });
384
456
  Object.defineProperty(exports, "MemoryEventLog", {
385
457
  enumerable: true,
386
458
  get: function() {
@@ -393,6 +465,12 @@ Object.defineProperty(exports, "defineWorkflow", {
393
465
  return defineWorkflow;
394
466
  }
395
467
  });
468
+ Object.defineProperty(exports, "deserializeWorkflowError", {
469
+ enumerable: true,
470
+ get: function() {
471
+ return deserializeWorkflowError;
472
+ }
473
+ });
396
474
  Object.defineProperty(exports, "executeWorkflow", {
397
475
  enumerable: true,
398
476
  get: function() {
@@ -405,5 +483,11 @@ Object.defineProperty(exports, "isWorkflow", {
405
483
  return isWorkflow;
406
484
  }
407
485
  });
486
+ Object.defineProperty(exports, "serializeWorkflowError", {
487
+ enumerable: true,
488
+ get: function() {
489
+ return serializeWorkflowError;
490
+ }
491
+ });
408
492
 
409
- //# sourceMappingURL=dist-CZZMGcuu.cjs.map
493
+ //# sourceMappingURL=dist-iCJ9uxzf.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-iCJ9uxzf.cjs","names":["z","SandboxDefinitionSchema","normalizeCredentialList","withSpan","logSystem","captureConsole","getActionCredentialRequirements","executeAction","resolveActionCredentials","AsyncLocalStorage","registerWorkflowRunGetter"],"sources":["../../workflow/dist/index.mjs"],"sourcesContent":["import { z } from \"zod\";\nimport { SandboxDefinitionSchema } from \"@keystrokehq/sandbox\";\nimport { captureConsole, logSystem, withSpan } from \"@keystrokehq/tracing\";\nimport { executeAction, getActionCredentialRequirements, normalizeCredentialList, registerWorkflowRunGetter } from \"@keystrokehq/action\";\nimport { resolveActionCredentials } from \"@keystrokehq/credentials\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n//#region src/workflow-definition.ts\nconst zodSchema = z.custom((v) => v instanceof z.ZodType, \"must be a Zod schema\");\n/** Runtime validation for an unbranded workflow definition. */\nconst workflowCoreSchema = z.object({\n\tkey: z.string().trim().min(1),\n\tname: z.string().optional(),\n\tdescription: z.string().optional(),\n\tsubscription: z.object({ mode: z.enum([\"system\", \"subscribable\"]).optional() }).optional(),\n\tsandbox: SandboxDefinitionSchema.optional(),\n\tinput: zodSchema,\n\toutput: zodSchema,\n\trun: z.function()\n});\nconst WORKFLOW = Symbol.for(\"keystroke.workflow\");\n/**\n* Validates brand + shape via `workflowCoreSchema` so discovery and guards\n* reject malformed definitions.\n*/\nfunction isWorkflow(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(WORKFLOW in value) || value[WORKFLOW] !== true) return false;\n\treturn workflowCoreSchema.safeParse(value).success;\n}\n//#endregion\n//#region src/define-workflow.ts\nfunction defineWorkflow(def) {\n\tconst result = workflowCoreSchema.safeParse(def);\n\tif (!result.success) throw new Error(`Invalid workflow definition: ${formatIssues(result.error.issues)}`);\n\treturn {\n\t\t...result.data,\n\t\t[WORKFLOW]: true\n\t};\n}\nfunction formatIssues(issues) {\n\treturn issues.map((issue) => {\n\t\treturn `${issue.path.length > 0 ? `${issue.path.join(\".\")}: ` : \"\"}${issue.message}`;\n\t}).join(\"; \");\n}\n//#endregion\n//#region src/replay/error.ts\nfunction serializeWorkflowError(error) {\n\tif (error instanceof Error) return {\n\t\tname: error.name,\n\t\tmessage: error.message\n\t};\n\treturn { message: String(error) };\n}\n/** Rebuild an Error from a recorded error so replay re-raises the same failure. */\nfunction deserializeWorkflowError(data) {\n\tconst serialized = data;\n\tconst error = new Error(serialized?.message ?? \"Workflow step failed\");\n\tif (serialized?.name) error.name = serialized.name;\n\treturn error;\n}\n//#endregion\n//#region src/replay/duration.ts\nconst UNIT_MS = {\n\tms: 1,\n\ts: 1e3,\n\tm: 6e4,\n\th: 36e5,\n\td: 864e5\n};\n/** Resolve a sleep duration to an absolute resume time. */\nfunction resolveResumeAt(duration, now = /* @__PURE__ */ new Date()) {\n\tif (duration instanceof Date) return duration;\n\tif (typeof duration === \"number\") return new Date(now.getTime() + Math.max(0, duration));\n\treturn new Date(now.getTime() + parseDurationToMs(duration));\n}\nfunction parseDurationToMs(value) {\n\tconst match = /^(\\d+(?:\\.\\d+)?)\\s*(ms|s|m|h|d)$/.exec(value.trim());\n\tif (!match) throw new Error(`Invalid sleep duration \"${value}\". Use a number of ms, a Date, or a string like \"5s\", \"10m\", \"1h\".`);\n\tconst amount = Number(match[1]);\n\tconst unit = match[2];\n\treturn Math.round(amount * UNIT_MS[unit]);\n}\n//#endregion\n//#region src/replay/events-consumer.ts\n/** Indexes replay events by correlationId for O(1) cache-hit checks during replay. */\nvar EventsConsumer = class {\n\tbyCorrelationId = /* @__PURE__ */ new Map();\n\tconstructor(events) {\n\t\tfor (const event of events) {\n\t\t\tif (!event.correlationId) continue;\n\t\t\tconst list = this.byCorrelationId.get(event.correlationId);\n\t\t\tif (list) list.push(event);\n\t\t\telse this.byCorrelationId.set(event.correlationId, [event]);\n\t\t}\n\t}\n\tevents(correlationId) {\n\t\treturn this.byCorrelationId.get(correlationId) ?? [];\n\t}\n\thasEventType(correlationId, type) {\n\t\treturn this.events(correlationId).some((event) => event.type === type);\n\t}\n\t/**\n\t* Cache lookup for a step. Returns the recorded output on a `step_completed`,\n\t* re-raises the recorded error on a terminal `step_failed` (so a permanently\n\t* failed step is not re-executed), and otherwise reports a miss — including\n\t* when only `step_retrying` events exist (the step re-runs on the next pass).\n\t*/\n\tgetStepResult(correlationId) {\n\t\tconst events = this.events(correlationId);\n\t\tconst failed = events.find((event) => event.type === \"step_failed\");\n\t\tif (failed) throw deserializeWorkflowError(failed.data);\n\t\tconst completed = events.find((event) => event.type === \"step_completed\");\n\t\tif (completed) return {\n\t\t\tcompleted: true,\n\t\t\tresult: completed.data\n\t\t};\n\t\treturn { completed: false };\n\t}\n\t/** Number of prior `step_retrying` events recorded for a step (= failed attempts so far). */\n\tcountRetrying(correlationId) {\n\t\treturn this.events(correlationId).filter((event) => event.type === \"step_retrying\").length;\n\t}\n\tisSleepCompleted(correlationId) {\n\t\treturn this.hasEventType(correlationId, \"sleep_completed\");\n\t}\n\t/** Returns the persisted resumeAt for a scheduled-but-not-completed sleep, if any. */\n\tgetSleepResumeAt(correlationId) {\n\t\tconst scheduled = this.events(correlationId).find((event) => event.type === \"sleep_scheduled\");\n\t\tif (!scheduled) return;\n\t\tconst data = scheduled.data;\n\t\treturn data?.resumeAt ? new Date(data.resumeAt) : void 0;\n\t}\n\tgetHookToken(correlationId) {\n\t\treturn (this.events(correlationId).find((event) => event.type === \"hook_created\")?.data)?.token;\n\t}\n\tgetHookResult(correlationId) {\n\t\tconst resumed = this.events(correlationId).find((event) => event.type === \"hook_resumed\");\n\t\tif (!resumed) return { resolved: false };\n\t\treturn {\n\t\t\tresolved: true,\n\t\t\tpayload: resumed.data?.payload\n\t\t};\n\t}\n};\n//#endregion\n//#region src/replay/suspension.ts\n/** A promise that never settles — returned by a suspending primitive so the body parks. */\nfunction createPendingPromise() {\n\treturn new Promise(() => {});\n}\n/**\n* Collects pending items requested within a single tick and resolves once, so\n* parallel suspensions (e.g. Promise.all of two sleeps) batch into one suspension.\n*/\nvar SuspensionCoordinator = class {\n\titems = /* @__PURE__ */ new Map();\n\tscheduled = false;\n\tresolve;\n\tpromise;\n\tconstructor() {\n\t\tthis.promise = new Promise((resolve) => {\n\t\t\tthis.resolve = resolve;\n\t\t});\n\t}\n\trequest(item) {\n\t\tthis.items.set(item.correlationId, item);\n\t\tif (!this.scheduled) {\n\t\t\tthis.scheduled = true;\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tthis.resolve([...this.items.values()]);\n\t\t\t});\n\t\t}\n\t}\n\twaitForSuspension() {\n\t\treturn this.promise;\n\t}\n};\n//#endregion\n//#region src/replay/replay-context.ts\nfunction createReplayState(params) {\n\treturn {\n\t\trunId: params.runId,\n\t\tconsumer: params.consumer,\n\t\tcoordinator: params.coordinator,\n\t\teventLog: params.eventLog,\n\t\tnewEvents: [],\n\t\tnow: params.now ?? /* @__PURE__ */ new Date(),\n\t\thookBaseUrl: params.hookBaseUrl,\n\t\tsleepCounter: 0,\n\t\thookCounter: 0,\n\t\tstepOccurrences: /* @__PURE__ */ new Map(),\n\t\tstepCorrelationIds: /* @__PURE__ */ new Set()\n\t};\n}\n/**\n* Allocate the correlation id for a step. An explicit `.stepId(x)` maps to\n* `step:x` (and must be unique within a run); otherwise the key is\n* `step:<actionKey>#<occurrence>` so that two calls to the same action get\n* distinct, replay-stable ids and inserting an unrelated call never shifts the\n* ids of later calls (unlike a single global ordinal).\n*/\nfunction nextStepCorrelationId(state, actionKey, explicitId) {\n\tif (explicitId !== void 0) {\n\t\tconst correlationId = `step:${explicitId}`;\n\t\tif (state.stepCorrelationIds.has(correlationId)) throw new Error(`Duplicate step id \"${explicitId}\" in workflow run ${state.runId}`);\n\t\tstate.stepCorrelationIds.add(correlationId);\n\t\treturn correlationId;\n\t}\n\tconst occurrence = state.stepOccurrences.get(actionKey) ?? 0;\n\tstate.stepOccurrences.set(actionKey, occurrence + 1);\n\tconst correlationId = `step:${actionKey}#${occurrence}`;\n\tstate.stepCorrelationIds.add(correlationId);\n\treturn correlationId;\n}\nfunction createSleep(state) {\n\treturn function sleep(duration) {\n\t\tconst correlationId = `sleep#${state.sleepCounter++}`;\n\t\tif (state.consumer.isSleepCompleted(correlationId)) return Promise.resolve();\n\t\tconst scheduledResumeAt = state.consumer.getSleepResumeAt(correlationId);\n\t\tconst resumeAt = scheduledResumeAt ?? resolveResumeAt(duration, state.now);\n\t\tif (scheduledResumeAt && resumeAt.getTime() <= state.now.getTime()) {\n\t\t\tstate.newEvents.push({\n\t\t\t\tid: `sleep_completed:${state.runId}:${correlationId}`,\n\t\t\t\trunId: state.runId,\n\t\t\t\ttype: \"sleep_completed\",\n\t\t\t\tcorrelationId\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tif (!scheduledResumeAt) state.newEvents.push({\n\t\t\tid: `sleep_scheduled:${state.runId}:${correlationId}`,\n\t\t\trunId: state.runId,\n\t\t\ttype: \"sleep_scheduled\",\n\t\t\tcorrelationId,\n\t\t\tdata: { resumeAt: resumeAt.toISOString() }\n\t\t});\n\t\tstate.coordinator.request({\n\t\t\tkind: \"sleep\",\n\t\t\tcorrelationId,\n\t\t\tresumeAt\n\t\t});\n\t\treturn createPendingPromise();\n\t};\n}\nfunction createHook(state) {\n\treturn function hook(options) {\n\t\tconst correlationId = `hook#${state.hookCounter++}`;\n\t\tconst token = options?.token ?? state.consumer.getHookToken(correlationId) ?? `hook_${crypto.randomUUID()}`;\n\t\treturn {\n\t\t\ttoken,\n\t\t\tresumeUrl: state.hookBaseUrl ? `${state.hookBaseUrl}/hooks/${token}/resume` : `/hooks/${token}/resume`,\n\t\t\tthen(onFulfilled, onRejected) {\n\t\t\t\tconst result = state.consumer.getHookResult(correlationId);\n\t\t\t\tif (result.resolved) {\n\t\t\t\t\tconst payload = options?.schema ? options.schema.parse(result.payload) : result.payload;\n\t\t\t\t\treturn Promise.resolve(payload).then(onFulfilled, onRejected);\n\t\t\t\t}\n\t\t\t\tif (!state.consumer.hasEventType(correlationId, \"hook_created\")) state.newEvents.push({\n\t\t\t\t\tid: `hook_created:${state.runId}:${correlationId}`,\n\t\t\t\t\trunId: state.runId,\n\t\t\t\t\ttype: \"hook_created\",\n\t\t\t\t\tcorrelationId,\n\t\t\t\t\tdata: { token }\n\t\t\t\t});\n\t\t\t\tstate.coordinator.request({\n\t\t\t\t\tkind: \"hook\",\n\t\t\t\t\tcorrelationId,\n\t\t\t\t\ttoken\n\t\t\t\t});\n\t\t\t\treturn createPendingPromise().then(onFulfilled, onRejected);\n\t\t\t}\n\t\t};\n\t};\n}\n//#endregion\n//#region src/create-action-runner.ts\nfunction withCredentialChainOverride(requirements, chain) {\n\tif (!requirements || !chain) return requirements;\n\treturn normalizeCredentialList(requirements).map((requirement) => ({\n\t\t...requirement,\n\t\tchain\n\t}));\n}\n/**\n* Builds the per-run action runner. Each action call resolves a stable\n* `correlation_id`, short-circuits from the durable event log on a cache hit,\n* and otherwise executes and appends `step_completed` immediately (preserving\n* per-step crash durability). A thrown step appends `step_retrying` (non-fatal,\n* re-run on the next attempt) and rethrows; the terminal `step_failed` is\n* written by the job handler once the queue exhausts retries.\n*/\nfunction createActionRunner(state, options = {}) {\n\tconst { runId, consumer, eventLog } = state;\n\treturn async (action, input, runOptions) => {\n\t\tconst correlationId = nextStepCorrelationId(state, action.key, runOptions?.id);\n\t\tconst cached = consumer.getStepResult(correlationId);\n\t\tif (cached.completed) {\n\t\t\tawait withSpan({\n\t\t\t\tkind: \"action\",\n\t\t\t\tname: action.key,\n\t\t\t\trefId: `${runId}:${correlationId}`,\n\t\t\t\tmetadata: {\n\t\t\t\t\trunId,\n\t\t\t\t\tactionKey: action.key,\n\t\t\t\t\tcorrelationId,\n\t\t\t\t\treplayed: true\n\t\t\t\t}\n\t\t\t}, async () => {\n\t\t\t\tawait logSystem(\"info\", \"action replayed from checkpoint\", {\n\t\t\t\t\trunId,\n\t\t\t\t\tactionKey: action.key,\n\t\t\t\t\tcorrelationId\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn action.output.parse(cached.result);\n\t\t}\n\t\treturn withSpan({\n\t\t\tkind: \"action\",\n\t\t\tname: action.key,\n\t\t\trefId: `${runId}:${correlationId}`,\n\t\t\tmetadata: {\n\t\t\t\trunId,\n\t\t\t\tactionKey: action.key,\n\t\t\t\tcorrelationId\n\t\t\t}\n\t\t}, async () => captureConsole(async () => {\n\t\t\ttry {\n\t\t\t\tconst requirements = withCredentialChainOverride(getActionCredentialRequirements(action), runOptions?.credentialChain);\n\t\t\t\tconst contextOverride = runOptions?.credentialSelection ? { selection: runOptions.credentialSelection } : void 0;\n\t\t\t\tconst validatedOutput = await executeAction(action, input, requirements?.length ? await resolveActionCredentials(requirements, {\n\t\t\t\t\tresolveCredentials: options.resolveCredentials,\n\t\t\t\t\tcontext: options.credentialContext,\n\t\t\t\t\toauthAdapter: options.oauthAdapter,\n\t\t\t\t\tconsumer: {\n\t\t\t\t\t\tkind: \"action\",\n\t\t\t\t\t\tname: action.key\n\t\t\t\t\t},\n\t\t\t\t\tcontextOverride\n\t\t\t\t}) : {});\n\t\t\t\tawait eventLog.append({\n\t\t\t\t\tid: `step_completed:${runId}:${correlationId}`,\n\t\t\t\t\trunId,\n\t\t\t\t\ttype: \"step_completed\",\n\t\t\t\t\tcorrelationId,\n\t\t\t\t\tdata: validatedOutput\n\t\t\t\t});\n\t\t\t\treturn validatedOutput;\n\t\t\t} catch (error) {\n\t\t\t\tconst attempt = consumer.countRetrying(correlationId);\n\t\t\t\tawait eventLog.append({\n\t\t\t\t\tid: `step_retrying:${runId}:${correlationId}:${attempt}`,\n\t\t\t\t\trunId,\n\t\t\t\t\ttype: \"step_retrying\",\n\t\t\t\t\tcorrelationId,\n\t\t\t\t\tdata: serializeWorkflowError(error)\n\t\t\t\t});\n\t\t\t\tstate.failedCorrelationId = correlationId;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}));\n\t};\n}\n//#endregion\n//#region src/run-context.ts\nconst storage = new AsyncLocalStorage();\nregisterWorkflowRunGetter(() => {\n\tconst store = storage.getStore();\n\tif (!store) return;\n\treturn { actionRunner: store.actionRunner };\n});\nfunction runWithWorkflowContext(store, fn) {\n\treturn storage.run(store, fn);\n}\n//#endregion\n//#region src/replay/memory-event-log.ts\n/** In-memory durable log for inline execution and tests. */\nvar MemoryEventLog = class {\n\tevents = [];\n\tids = /* @__PURE__ */ new Set();\n\tasync append(event) {\n\t\tconst id = event.id ?? crypto.randomUUID();\n\t\tif (this.ids.has(id)) return false;\n\t\tthis.ids.add(id);\n\t\tthis.events.push({\n\t\t\tid,\n\t\t\trunId: event.runId,\n\t\t\tseq: this.events.length,\n\t\t\ttype: event.type,\n\t\t\tcorrelationId: event.correlationId ?? null,\n\t\t\tdata: event.data ?? null\n\t\t});\n\t\treturn true;\n\t}\n\tasync listReplay(runId) {\n\t\treturn this.events.filter((event) => event.runId === runId).map((event) => ({ ...event }));\n\t}\n};\n//#endregion\n//#region src/execute-workflow.ts\n/**\n* The single way to run a workflow: replay its event log from the top, execute\n* un-cached primitives, and either complete/fail or suspend at the first\n* un-satisfied sleep/hook. New events (sleep_scheduled/sleep_completed/\n* hook_created/run_completed/run_failed) are flushed before returning.\n*\n* Durability comes entirely from the log — a suspended run resumes by calling\n* this again with the same `runId` and event log once the sleep is due or the\n* hook is resumed.\n*/\nasync function executeWorkflow(workflow, input, options = {}) {\n\tconst runId = options.runId ?? crypto.randomUUID();\n\tconst eventLog = options.eventLog ?? new MemoryEventLog();\n\tconst consumer = new EventsConsumer(await eventLog.listReplay(runId));\n\tconst coordinator = new SuspensionCoordinator();\n\tconst state = createReplayState({\n\t\trunId,\n\t\tconsumer,\n\t\tcoordinator,\n\t\teventLog,\n\t\thookBaseUrl: options.hookBaseUrl,\n\t\tnow: options.now\n\t});\n\tconst actionRunner = createActionRunner(state, {\n\t\tresolveCredentials: options.resolveCredentials,\n\t\tcredentialContext: options.credentialContext,\n\t\toauthAdapter: options.oauthAdapter\n\t});\n\tconst ctx = {\n\t\trunId,\n\t\tsleep: createSleep(state),\n\t\thook: createHook(state),\n\t\t...options.context\n\t};\n\tconst validatedInput = workflow.input.parse(input);\n\tconst bodyPromise = runWithWorkflowContext({\n\t\tactionRunner,\n\t\trunId\n\t}, () => captureConsole(async () => workflow.run(validatedInput, ctx)));\n\tconst outcome = await Promise.race([bodyPromise.then((output) => ({\n\t\ttype: \"done\",\n\t\toutput\n\t}), (error) => ({\n\t\ttype: \"error\",\n\t\terror\n\t})), coordinator.waitForSuspension().then((items) => ({\n\t\ttype: \"suspended\",\n\t\titems\n\t}))]);\n\tlet result;\n\tif (outcome.type === \"suspended\") {\n\t\tbodyPromise.catch(() => {});\n\t\tresult = {\n\t\t\tstatus: \"suspended\",\n\t\t\titems: outcome.items\n\t\t};\n\t} else if (outcome.type === \"done\") {\n\t\tconst output = workflow.output.parse(outcome.output);\n\t\tstate.newEvents.push({\n\t\t\tid: `run_completed:${runId}`,\n\t\t\trunId,\n\t\t\ttype: \"run_completed\",\n\t\t\tdata: { output }\n\t\t});\n\t\tresult = {\n\t\t\tstatus: \"completed\",\n\t\t\toutput\n\t\t};\n\t} else result = {\n\t\tstatus: \"failed\",\n\t\terror: outcome.error,\n\t\tfailedCorrelationId: state.failedCorrelationId\n\t};\n\tfor (const event of state.newEvents) await eventLog.append(event);\n\treturn result;\n}\n//#endregion\nexport { MemoryEventLog, defineWorkflow, deserializeWorkflowError, executeWorkflow, isWorkflow, serializeWorkflowError };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;AAOA,MAAM,YAAYA,IAAAA,EAAE,QAAQ,MAAM,aAAaA,IAAAA,EAAE,SAAS,sBAAsB;;AAEhF,MAAM,qBAAqBA,IAAAA,EAAE,OAAO;CACnC,KAAKA,IAAAA,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;CAC5B,MAAMA,IAAAA,EAAE,OAAO,EAAE,SAAS;CAC1B,aAAaA,IAAAA,EAAE,OAAO,EAAE,SAAS;CACjC,cAAcA,IAAAA,EAAE,OAAO,EAAE,MAAMA,IAAAA,EAAE,KAAK,CAAC,UAAU,cAAc,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS;CACzF,SAASC,aAAAA,wBAAwB,SAAS;CAC1C,OAAO;CACP,QAAQ;CACR,KAAKD,IAAAA,EAAE,SAAS;AACjB,CAAC;AACD,MAAM,WAAW,OAAO,IAAI,oBAAoB;;;;;AAKhD,SAAS,WAAW,OAAO;CAC1B,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,IAAI,EAAE,YAAY,UAAU,MAAM,cAAc,MAAM,OAAO;CAC7D,OAAO,mBAAmB,UAAU,KA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AAW;EACf,MAAM;EACN;CACD,EAAE,GAAG,YAAY,kBAAkB,EAAE,MAAM,WAAW;EACrD,MAAM;EACN;CACD,EAAE,CAAC,CAAC;CACJ,IAAI;CACJ,IAAI,QAAQ,SAAS,aAAa;EACjC,YAAY,YAAY,CAAC,CAAC;EAC1B,SAAS;GACR,QAAQ;GACR,OAAO,QAAQ;EAChB;CACD,OAAO,IAAI,QAAQ,SAAS,QAAQ;EACnC,MAAM,SAAS,SAAS,OAAO,MAAM,QAAQ,MAAM;EACnD,MAAM,UAAU,KAAK;GACpB,IAAI,iBAAiB;GACrB;GACA,MAAM;GACN,MAAM,EAAE,OAAO;EAChB,CAAC;EACD,SAAS;GACR,QAAQ;GACR;EACD;CACD,OAAO,SAAS;EACf,QAAQ;EACR,OAAO,QAAQ;EACf,qBAAqB,MAAM;CAC5B;CACA,KAAK,MAAM,SAAS,MAAM,WAAW,MAAM,SAAS,OAAO,KAAK;CAChE,OAAO;AACR"}
@@ -1,4 +1,4 @@
1
- import { _ as ResolvedCredentials, c as CredentialRunContext, h as OAuthTokenAdapter, i as CredentialConsumer, o as CredentialList } from "./index-BeEymXir.mjs";
1
+ import { _ as ResolvedCredentials, c as CredentialRunContext, h as OAuthTokenAdapter, i as CredentialConsumer, o as CredentialList, v as WorkflowEventType } from "./index-CiuCYKLw.cjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region ../workflow/dist/index.d.mts
@@ -8,10 +8,6 @@ type ActionRunnerOptions = {
8
8
  credentialContext?: CredentialRunContext;
9
9
  oauthAdapter?: OAuthTokenAdapter;
10
10
  };
11
- interface ActionStore {
12
- get(runId: string, actionKey: string): Promise<unknown | undefined>;
13
- set(runId: string, actionKey: string, output: unknown): Promise<void>;
14
- }
15
11
  type SleepDuration = number | string | Date;
16
12
  type WorkflowSleep = (duration: SleepDuration) => Promise<void>;
17
13
  type HookOptions<T> = {
@@ -90,7 +86,6 @@ declare function isWorkflow(value: unknown): value is WorkflowDefinition; //#end
90
86
  //#region src/define-workflow.d.ts
91
87
  declare function defineWorkflow<TInputSchema extends z.ZodType, TOutputSchema extends z.ZodType>(def: WorkflowDefinitionInput<TInputSchema, TOutputSchema>): WorkflowDefinition<z.infer<TInputSchema>, z.infer<TOutputSchema>>; //#endregion
92
88
  //#region src/replay/types.d.ts
93
- type WorkflowEventType = "run_started" | "step_completed" | "step_failed" | "sleep_scheduled" | "sleep_completed" | "hook_created" | "hook_resumed" | "run_completed" | "run_failed";
94
89
  /** Structural shape of a persisted event row (matches @keystrokehq/database). */
95
90
  type ReplayEvent = {
96
91
  id: string;
@@ -129,6 +124,7 @@ type ReplayResult = {
129
124
  } | {
130
125
  status: "failed";
131
126
  error: unknown;
127
+ failedCorrelationId?: string;
132
128
  } | {
133
129
  status: "suspended";
134
130
  items: PendingItem[];
@@ -136,8 +132,7 @@ type ReplayResult = {
136
132
  //#region src/execute-workflow.d.ts
137
133
  type ExecuteWorkflowOptions = {
138
134
  runId?: string; /** Durable event log. Defaults to an in-memory log (single, non-resumable pass). */
139
- eventLog?: DurableEventLog; /** Action checkpoint store. Defaults to in-memory. */
140
- actionStore?: ActionStore;
135
+ eventLog?: DurableEventLog;
141
136
  resolveCredentials?: ActionRunnerOptions["resolveCredentials"];
142
137
  credentialContext?: ActionRunnerOptions["credentialContext"];
143
138
  oauthAdapter?: ActionRunnerOptions["oauthAdapter"]; /** Public base URL used to build hook resume URLs. */
@@ -156,13 +151,6 @@ type ExecuteWorkflowOptions = {
156
151
  * hook is resumed.
157
152
  */
158
153
  declare function executeWorkflow<TInput, TOutput>(workflow: WorkflowDefinition<TInput, TOutput>, input: unknown, options?: ExecuteWorkflowOptions): Promise<ReplayResult>; //#endregion
159
- //#region src/memory-action-store.d.ts
160
- declare class MemoryActionStore implements ActionStore {
161
- private readonly records;
162
- private key;
163
- get(runId: string, actionKey: string): Promise<unknown | undefined>;
164
- set(runId: string, actionKey: string, output: unknown): Promise<void>;
165
- } //#endregion
166
154
  //#region src/replay/memory-event-log.d.ts
167
155
  /** In-memory durable log for inline execution and tests. */
168
156
  declare class MemoryEventLog implements DurableEventLog {
@@ -171,6 +159,15 @@ declare class MemoryEventLog implements DurableEventLog {
171
159
  append(event: AppendEventInput): Promise<boolean>;
172
160
  listReplay(runId: string): Promise<ReplayEvent[]>;
173
161
  } //#endregion
162
+ //#region src/replay/error.d.ts
163
+ /** Serializable shape for a recorded step/run error (stored in event data). */
164
+ type SerializedWorkflowError = {
165
+ name?: string;
166
+ message: string;
167
+ };
168
+ declare function serializeWorkflowError(error: unknown): SerializedWorkflowError;
169
+ /** Rebuild an Error from a recorded error so replay re-raises the same failure. */
170
+ declare function deserializeWorkflowError(data: unknown): Error; //#endregion
174
171
  //#endregion
175
- export { isWorkflow as S, WorkflowHook as _, HookHandle as a, defineWorkflow as b, MemoryActionStore as c, ReplayEvent as d, ReplayResult as f, WorkflowEventType as g, WorkflowDefinition as h, ExecuteWorkflowOptions as i, MemoryEventLog as l, SleepPendingItem as m, AppendEventInput as n, HookOptions as o, SleepDuration as p, DurableEventLog as r, HookPendingItem as s, ActionStore as t, PendingItem as u, WorkflowRunContext as v, executeWorkflow as x, WorkflowSleep as y };
176
- //# sourceMappingURL=index-Bv6uZ8Xd.d.mts.map
172
+ export { serializeWorkflowError as S, WorkflowSleep as _, HookOptions as a, executeWorkflow as b, PendingItem as c, SerializedWorkflowError as d, SleepDuration as f, WorkflowRunContext as g, WorkflowHook as h, HookHandle as i, ReplayEvent as l, WorkflowDefinition as m, DurableEventLog as n, HookPendingItem as o, SleepPendingItem as p, ExecuteWorkflowOptions as r, MemoryEventLog as s, AppendEventInput as t, ReplayResult as u, defineWorkflow as v, isWorkflow as x, deserializeWorkflowError as y };
173
+ //# sourceMappingURL=index-C6_DVB_V.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-C6_DVB_V.d.cts","names":["z","CredentialList","ResolvedCredentials","CredentialConsumer","CredentialRunContext","OAuthTokenAdapter","WorkflowEventType","ActionRunnerOptions","T","Partial","Promise","resolveCredentials","requirements","consumer","contextOverride","credentialContext","oauthAdapter","SleepDuration","Date","WorkflowSleep","duration","HookOptions","ZodType","token","schema","HookHandle","PromiseLike","resumeUrl","WorkflowHook","options","WorkflowRunContext","runId","workspacesRoot","sandbox","root","trigger","triggeredAt","sleep","hook","workflowCoreSchema","ZodString","ZodOptional","ZodEnum","core","$strip","ZodObject","ZodArray","$ZodTypeInternals","ZodCustom","$ZodFunctionArgs","$ZodFunctionOut","ZodFunction","key","name","description","subscription","mode","system","subscribable","files","path","file","dir","input","output","run","WorkflowMeta","infer","Omit","WorkflowIO","TInputSchema","TOutputSchema","ctx","WORKFLOW","WorkflowDefinition","TInput","TOutput","WorkflowDefinitionInput","isWorkflow","value","defineWorkflow","def","ReplayEvent","id","seq","type","correlationId","data","AppendEventInput","DurableEventLog","append","event","listReplay","SleepPendingItem","kind","resumeAt","HookPendingItem","PendingItem","ReplayResult","status","error","failedCorrelationId","items","ExecuteWorkflowOptions","eventLog","hookBaseUrl","now","context","executeWorkflow","workflow","MemoryEventLog","events","ids","SerializedWorkflowError","message","serializeWorkflowError","deserializeWorkflowError","Error"],"sources":["../../workflow/dist/index.d.mts"],"mappings":";;;;;KAKKO,mBAAAA;EACHI,kBAAAA,cAAgCV,cAAAA,EAAgBW,YAAAA,EAAcJ,CAAAA,EAAGK,QAAAA,EAAUV,kBAAAA,EAAoBW,eAAAA,GAAkBL,OAAAA,CAAQL,oBAAAA,MAA0BM,OAAAA,CAAQR,mBAAAA,CAAoBM,CAAAA;EAC/KO,iBAAAA,GAAoBX,oBAAAA;EACpBY,YAAAA,GAAeX,iBAAAA;AAAAA;AAAAA,KAEZY,aAAAA,qBAAkCC,IAAI;AAAA,KACtCC,aAAAA,IAAiBC,QAAAA,EAAUH,aAAAA,KAAkBP,OAAO;AAAA,KACpDW,WAAAA;EAN4Kb,sDAOzHe,KAAAA,WAPyHf;EAQ/KgB,MAAAA,GAASxB,CAAAA,CAAEsB,OAAO,CAACd,CAAAA;AAA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,IAAAA;EACA6D,OAAO;AAAA;AAAA,iBAEQC,sBAAAA,CAAuBf,KAAAA,YAAiBa,uBAAuB;;iBAE/DG,wBAAAA,CAAyB7B,IAAAA,YAAgB8B,KAAK"}
@@ -1,4 +1,4 @@
1
- import { _ as ResolvedCredentials, a as CredentialInput, l as CredentialScopeLevel, o as CredentialList } from "./index-BeEymXir.cjs";
1
+ import { _ as ResolvedCredentials, a as CredentialInput, l as CredentialScopeLevel, o as CredentialList } from "./index-CiuCYKLw.cjs";
2
2
  import { o as AgentTool } from "./index-BcMCpDKh.cjs";
3
3
  import { z } from "zod";
4
4
 
@@ -111,4 +111,4 @@ declare function registerWorkflowRunGetter(fn: () => WorkflowRunHandle | undefin
111
111
  declare function getWorkflowRunHandle(): WorkflowRunHandle | undefined; //#endregion
112
112
  //#endregion
113
113
  export { resolveActionTool as _, ResolveActionToolOptions as a, actionCoreSchema as c, executeAction as d, getActionCredentialRequirements as f, registerWorkflowRunGetter as g, isStepInvocation as h, ResolveActionCredentialsFn as i, createStepInvocation as l, isAction as m, ActionDefinition as n, StepInvocation as o, getWorkflowRunHandle as p, ActionDefinitionInput as r, WorkflowActionDefinition as s, ActionCredentialConsumer as t, defineAction as u, runOutsideActionExecution as v, runWithinActionExecution as y };
114
- //# sourceMappingURL=index-avLUReqf.d.cts.map
114
+ //# sourceMappingURL=index-CfK7yBQI.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-CvXJv3hY.d.mts","names":["z","CREDENTIAL_SCOPE_LEVELS","Credential","CredentialAuthKind","CredentialInput","CredentialList","CredentialRequirement","CredentialScopeLevel","DEFAULT_CREDENTIAL_RESOLUTION_CHAIN","DefineCredentialInput","DefineOAuthCredentialInput","DefineStaticCredentialInput","NormalizeCredential","ResolvedCredentials","credential","credentialInputSchema","defineCredential","isCredentialInput","normalizeCredentialList","toCredentialRequirement","AgentTool","actionCoreSchema","ZodString","ZodOptional","core","$ZodTypeInternals","ZodType","ZodCustom","_$_keystrokehq_shared0","ZodArray","$ZodFunctionArgs","$ZodFunctionOut","ZodFunction","$strip","ZodObject","key","name","description","input","output","credentials","run","ActionMeta","infer","Omit","ActionIO","TInputSchema","TOutputSchema","TCredentials","Promise","ACTION","ActionDefinition","TInput","TOutput","Record","ActionDefinitionInput","isAction","value","getActionCredentialRequirements","Pick","action","StepInvocationState","chain","selection","id","StepInvocation","TResult1","TResult2","PromiseLike","scope","select","instanceIdOrMap","stepId","then","onfulfilled","reason","onrejected","isStepInvocation","createStepInvocation","state","WorkflowActionDefinition","TRequirements","defineAction","def","executeAction","ActionCredentialConsumer","kind","ResolveActionCredentialsFn","T","Partial","requirements","consumer","contextOverride","ResolveActionToolOptions","resolveCredentials","resolveActionTool","options","runWithinActionExecution","actionKey","runOutsideActionExecution","fn","WorkflowRunHandle","actionRunner","credentialChain","credentialSelection","registerWorkflowRunGetter","getWorkflowRunHandle"],"sources":["../../action/dist/index.d.mts"],"mappings":";;;;;;AAE0D;AAAA,cAI5CqB,gBAAAA,EAAkBrB,CAAAA,CAAEkC,SAAAA;EAChCC,GAAAA,EAAKnC,CAAAA,CAAEsB,SAAAA;EACPc,IAAAA,EAAMpC,CAAAA,CAAEsB,SAAAA;EACRe,WAAAA,EAAarC,CAAAA,CAAEuB,WAAAA,CAAYvB,CAAAA,CAAEsB,SAAAA;EAC7BgB,KAAAA,EAAOtC,CAAAA,CAAE2B,SAAAA,CAAU3B,CAAAA,CAAE0B,OAAAA,mBAA0B1B,CAAAA,CAAEwB,IAAAA,CAAKC,iBAAAA,qBAAsCzB,CAAAA,CAAE0B,OAAAA,mBAA0B1B,CAAAA,CAAEwB,IAAAA,CAAKC,iBAAAA;EAC/Hc,MAAAA,EAAQvC,CAAAA,CAAE2B,SAAAA,CAAU3B,CAAAA,CAAE0B,OAAAA,mBAA0B1B,CAAAA,CAAEwB,IAAAA,CAAKC,iBAAAA,qBAAsCzB,CAAAA,CAAE0B,OAAAA,mBAA0B1B,CAAAA,CAAEwB,IAAAA,CAAKC,iB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C,IAAAA;EACAlD,IAAI;AAAA;AAAA,KAEDmD,0BAAAA,cAAwClF,cAAAA,EAAgBqF,YAAAA,EAAcF,CAAAA,EAAGG,QAAAA,EAAUN,wBAAAA,EAA0BO,eAAAA,GAAkBH,OAAAA,CAAQnC,MAAAA,uBAA6BL,OAAAA,CAAQpC,mBAAAA,CAAoB2E,CAAAA;AAAAA,KAChMK,wBAAAA;EACHC,kBAAAA,EAAoBP,0BAAAA;EACpBI,QAAAA,EAAUN,wBAAAA;EACVO,eAAAA,GAAkBH,OAAAA,CAAQnC,MAAAA;AAAAA;AAAAA,iBAEXyC,iBAAAA,CAAkBnC,MAAAA,EAAQD,IAAAA,CAAKR,gBAAAA,2GAA2H6C,OAAAA,GAAUH,wBAAAA,GAA2BzE,SAAAA;AAAAA;;AA7EhM;AAAA;;iBAoFC6E,wBAAAA,GAAAA,CAA4BC,SAAAA,UAAmBzD,GAAAA,QAAWQ,OAAAA,CAAQuC,CAAAA,IAAKvC,OAAAA,CAAQuC,CAAAA;;;;;;iBAM/EW,yBAAAA,GAAAA,CAA6BC,EAAAA,QAAUnD,OAAAA,CAAQuC,CAAAA,IAAKvC,OAAAA,CAAQuC,CAAAA;AAAAA;AAAAA,KAGxEa,iBAAAA;EACHC,YAAAA,GAAe1C,MAAAA,WAAiBtB,KAAAA,WAAgB0D,OAAAA;IAC9ChC,EAAAA;IACAuC,eAAAA;IACAC,mBAAAA,GAAsBlD,MAAAA;EAAAA,MAClBL,OAAO;AAAA;AAAA,iBAEEwD,yBAAAA,CAA0BL,EAAuC,QAA7BC,iBAAiB;AAAA,iBACrDK,oBAAAA,CAAAA,GAAwBL,iBAAiB"}
1
+ {"version":3,"file":"index-CfK7yBQI.d.cts","names":["z","CREDENTIAL_SCOPE_LEVELS","Credential","CredentialAuthKind","CredentialInput","CredentialList","CredentialRequirement","CredentialScopeLevel","DEFAULT_CREDENTIAL_RESOLUTION_CHAIN","DefineCredentialInput","DefineOAuthCredentialInput","DefineStaticCredentialInput","NormalizeCredential","ResolvedCredentials","credential","credentialInputSchema","defineCredential","isCredentialInput","normalizeCredentialList","toCredentialRequirement","AgentTool","actionCoreSchema","ZodString","ZodOptional","core","$ZodTypeInternals","ZodType","ZodCustom","_$_keystrokehq_shared0","ZodArray","$ZodFunctionArgs","$ZodFunctionOut","ZodFunction","$strip","ZodObject","key","name","description","input","output","credentials","run","ActionMeta","infer","Omit","ActionIO","TInputSchema","TOutputSchema","TCredentials","Promise","ACTION","ActionDefinition","TInput","TOutput","Record","ActionDefinitionInput","isAction","value","getActionCredentialRequirements","Pick","action","StepInvocationState","chain","selection","id","StepInvocation","TResult1","TResult2","PromiseLike","scope","select","instanceIdOrMap","stepId","then","onfulfilled","reason","onrejected","isStepInvocation","createStepInvocation","state","WorkflowActionDefinition","TRequirements","defineAction","def","executeAction","ActionCredentialConsumer","kind","ResolveActionCredentialsFn","T","Partial","requirements","consumer","contextOverride","ResolveActionToolOptions","resolveCredentials","resolveActionTool","options","runWithinActionExecution","actionKey","runOutsideActionExecution","fn","WorkflowRunHandle","actionRunner","credentialChain","credentialSelection","registerWorkflowRunGetter","getWorkflowRunHandle"],"sources":["../../action/dist/index.d.mts"],"mappings":";;;;;;AAE0D;AAAA,cAI5CqB,gBAAAA,EAAkBrB,CAAAA,CAAEkC,SAAAA;EAChCC,GAAAA,EAAKnC,CAAAA,CAAEsB,SAAAA;EACPc,IAAAA,EAAMpC,CAAAA,CAAEsB,SAAAA;EACRe,WAAAA,EAAarC,CAAAA,CAAEuB,WAAAA,CAAYvB,CAAAA,CAAEsB,SAAAA;EAC7BgB,KAAAA,EAAOtC,CAAAA,CAAE2B,SAAAA,CAAU3B,CAAAA,CAAE0B,OAAAA,mBAA0B1B,CAAAA,CAAEwB,IAAAA,CAAKC,iBAAAA,qBAAsCzB,CAAAA,CAAE0B,OAAAA,mBAA0B1B,CAAAA,CAAEwB,IAAAA,CAAKC,iBAAAA;EAC/Hc,MAAAA,EAAQvC,CAAAA,CAAE2B,SAAAA,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