@nathanstephenson/flow 0.1.9 → 0.1.10-beta.10

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 (174) hide show
  1. package/README.md +60 -21
  2. package/build/backend-worker-chunks/chunk-3KDHJA5P.mjs +162 -0
  3. package/build/backend-worker-chunks/{chunk-UQDH2COY.mjs → chunk-K774KOGL.mjs} +2 -7
  4. package/build/backend-worker-chunks/chunk-LAEUXDNH.mjs +130 -0
  5. package/build/backend-worker-chunks/{chunk-MLOUI3ZM.mjs → chunk-NZZME2I3.mjs} +6 -1
  6. package/build/backend-worker-chunks/claude-JG2FXYBQ.mjs +35859 -0
  7. package/build/backend-worker-chunks/{pi-M4OA2FGL.mjs → pi-KJSP23AO.mjs} +2138 -93
  8. package/build/backend-worker.mjs +77 -123
  9. package/build/workflow-runtime.cjs +12 -12
  10. package/dist/backend/claude/background-calls.js +7 -3
  11. package/dist/backend/claude/import.js +415 -0
  12. package/dist/backend/claude/index.js +201 -21
  13. package/dist/backend/claude/session-tools.js +14 -0
  14. package/dist/backend/claude/subagents.js +41 -9
  15. package/dist/backend/claude/todo-list.js +114 -0
  16. package/dist/backend/claude/workflow-parent.js +1 -1
  17. package/dist/backend/diff-excerpt-instructions.js +8 -0
  18. package/dist/backend/fake/index.js +54 -6
  19. package/dist/backend/mcp.js +4 -1
  20. package/dist/backend/pi/agent-permissions.js +1 -1
  21. package/dist/backend/pi/cache-warming.js +8 -0
  22. package/dist/backend/pi/canonical-json.js +120 -0
  23. package/dist/backend/pi/compaction-model.js +3 -2
  24. package/dist/backend/pi/host-auth.js +258 -0
  25. package/dist/backend/pi/import.js +269 -0
  26. package/dist/backend/pi/index.js +125 -21
  27. package/dist/backend/pi/model-auth.js +159 -0
  28. package/dist/backend/pi/model-catalog.js +120 -0
  29. package/dist/backend/pi/model-config.js +5 -0
  30. package/dist/backend/pi/model-selection.js +32 -0
  31. package/dist/backend/pi/plan-limits.js +41 -0
  32. package/dist/backend/pi/session-tools.js +21 -0
  33. package/dist/backend/pi/state.js +19 -1
  34. package/dist/backend/pi/subagents.js +7 -3
  35. package/dist/backend/pi/todo-list.js +23 -0
  36. package/dist/backend/pi/work.js +9 -1
  37. package/dist/backend/pi/workflow-parent.js +1 -1
  38. package/dist/backend/pi/workflow-subagent.js +4 -3
  39. package/dist/backend/plan-limits.js +17 -0
  40. package/dist/backend/session-tools.js +27 -0
  41. package/dist/backend/worker/claude-state.js +48 -0
  42. package/dist/backend/worker/entry.js +49 -8
  43. package/dist/backend/worker/index.js +155 -17
  44. package/dist/backend/worker/launcher.js +11 -4
  45. package/dist/backend/worker/protocol.js +2 -1
  46. package/dist/backend/worker/rpc.js +13 -0
  47. package/dist/backend/worker/sandbox-mcp.js +18 -7
  48. package/dist/backend/workflow-tools.js +9 -6
  49. package/dist/build-id +1 -1
  50. package/dist/cli/application.js +48 -42
  51. package/dist/cli/bootstrap.js +2 -2
  52. package/dist/cli/host-control.js +1 -1
  53. package/dist/cli/install-guard.js +2 -2
  54. package/dist/cli/main.js +4 -4
  55. package/dist/cli/systemd-update.js +3 -3
  56. package/dist/cli/update.js +6 -6
  57. package/dist/cli/web-update.js +6 -6
  58. package/dist/client/connection.js +46 -0
  59. package/dist/client/context-usage.js +3 -4
  60. package/dist/client/diff.js +40 -0
  61. package/dist/client/enquiry.js +0 -6
  62. package/dist/client/markdown.js +3 -2
  63. package/dist/client/model-choices.js +1 -1
  64. package/dist/client/permission.js +1 -2
  65. package/dist/client/project-name.js +3 -1
  66. package/dist/client/reduce.js +77 -3
  67. package/dist/client/relative-time.js +1 -1
  68. package/dist/client/scope-kind.js +6 -3
  69. package/dist/client/search.js +1 -1
  70. package/dist/client/status.js +1 -1
  71. package/dist/client/subagent-tree.js +49 -0
  72. package/dist/client/tool-chains.js +1 -1
  73. package/dist/client/tool-summary.js +28 -18
  74. package/dist/daemon/changes.js +128 -0
  75. package/dist/daemon/commit.js +84 -0
  76. package/dist/daemon/config-store.js +8 -3
  77. package/dist/daemon/config.js +105 -4
  78. package/dist/daemon/diff-excerpts.js +52 -0
  79. package/dist/daemon/git-state.js +197 -0
  80. package/dist/daemon/git.js +53 -10
  81. package/dist/daemon/github-image.js +18 -0
  82. package/dist/daemon/github.js +54 -0
  83. package/dist/daemon/host-control-routes.js +1 -1
  84. package/dist/daemon/host.js +1010 -116
  85. package/dist/daemon/http.js +4 -1
  86. package/dist/daemon/log.js +3 -0
  87. package/dist/daemon/mcp-auth.js +1 -1
  88. package/dist/daemon/models.js +2 -2
  89. package/dist/daemon/pi-model-cache.js +44 -0
  90. package/dist/daemon/pull-request.js +223 -138
  91. package/dist/daemon/push.js +43 -0
  92. package/dist/daemon/repository.js +123 -0
  93. package/dist/daemon/runtime.js +103 -22
  94. package/dist/daemon/secret-store.js +1 -1
  95. package/dist/daemon/server.js +111 -14
  96. package/dist/daemon/session-tool-views.js +22 -0
  97. package/dist/daemon/skills.js +24 -0
  98. package/dist/daemon/spend-ledger.js +118 -0
  99. package/dist/daemon/stack-metadata.js +12 -5
  100. package/dist/daemon/stack.js +162 -657
  101. package/dist/daemon/store.js +2 -0
  102. package/dist/daemon/summariser.js +30 -12
  103. package/dist/daemon/tour.js +56 -0
  104. package/dist/daemon/whisper.js +144 -0
  105. package/dist/daemon/workflow-authoring-scope-checks.js +1 -1
  106. package/dist/daemon/workflow-authoring-scope.js +1 -1
  107. package/dist/daemon/workflow-builder-files.js +2 -2
  108. package/dist/daemon/workflow-builder-guidance.js +1 -1
  109. package/dist/daemon/workflow-builder-routes.js +2 -2
  110. package/dist/daemon/workflow-builder.js +44 -17
  111. package/dist/daemon/workflow-environment.js +193 -0
  112. package/dist/daemon/workflow-execution-launch.js +77 -0
  113. package/dist/daemon/workflow-execution-resources.js +76 -0
  114. package/dist/daemon/workflow-execution-routes.js +17 -8
  115. package/dist/daemon/workflow-execution-values.js +128 -0
  116. package/dist/daemon/workflow-executions.js +434 -305
  117. package/dist/daemon/workflow-mcp-authoring-routes.js +2 -2
  118. package/dist/daemon/workflow-mcp-authoring.js +4 -4
  119. package/dist/daemon/workflow-mcp.js +1 -1
  120. package/dist/daemon/workflow-routes.js +60 -2
  121. package/dist/daemon/workflow-schedule-driver.js +251 -0
  122. package/dist/daemon/workflow-schedule-routes.js +137 -0
  123. package/dist/daemon/workflow-schedules.js +342 -0
  124. package/dist/isolation/filesystem.js +6 -2
  125. package/dist/isolation/sandbox.js +61 -18
  126. package/dist/isolation/shared-sandbox.js +3 -3
  127. package/dist/isolation/toolchain-assets.js +1 -1
  128. package/dist/protocol/events.js +3 -0
  129. package/dist/protocol/plan-limits.js +1 -0
  130. package/dist/protocol/settings.js +1 -0
  131. package/dist/protocol/spend.js +2 -0
  132. package/dist/protocol/stack.js +12 -39
  133. package/dist/protocol/workflow-schedules.js +1 -0
  134. package/dist/workflows/calls.js +53 -0
  135. package/dist/workflows/errors.js +2 -0
  136. package/dist/workflows/executors.js +6 -5
  137. package/dist/workflows/graph.js +83 -9
  138. package/dist/workflows/invocations.js +23 -0
  139. package/dist/workflows/mcp.js +1 -1
  140. package/dist/workflows/owner.js +45 -0
  141. package/dist/workflows/records.js +150 -10
  142. package/dist/workflows/recovery.js +87 -2
  143. package/dist/workflows/runtime-settings.js +16 -16
  144. package/dist/workflows/runtime.js +2 -2
  145. package/dist/workflows/schedule-errors.js +2 -0
  146. package/dist/workflows/schedule-store.js +385 -0
  147. package/dist/workflows/scheduler.js +389 -98
  148. package/dist/workflows/schedules.js +130 -0
  149. package/dist/workflows/schema.js +3 -1
  150. package/dist/workflows/store.js +126 -13
  151. package/package.json +10 -6
  152. package/web/dist/assets/index-C76t-z4w.css +2 -0
  153. package/web/dist/assets/{index-DRfeO6GJ.js → index-WPfbYVQ4.js} +39 -23
  154. package/web/dist/assets/{switch-DIogWclb.js → select-C5Ly2OpB.js} +1 -1
  155. package/web/dist/assets/{settings-mcp-Clp_jMWW.js → settings-mcp-BF-yqpeQ.js} +1 -1
  156. package/web/dist/assets/{settings-secrets-BIO_hXZ1.js → settings-secrets-WLarr2QP.js} +1 -1
  157. package/web/dist/assets/settings-workflows-DdcdRWFD.js +23 -0
  158. package/web/dist/assets/workflow-api-GjAmHc22.js +6 -0
  159. package/web/dist/assets/workflows-BhY3Uibo.js +149 -0
  160. package/web/dist/assets/workflows-pane-DElCcEpN.js +1 -0
  161. package/web/dist/index.html +6 -5
  162. package/build/backend-worker-chunks/chunk-J2DBNTL7.mjs +0 -94
  163. package/build/backend-worker-chunks/claude-GTW5KHY5.mjs +0 -30778
  164. package/dist/daemon/publish.js +0 -289
  165. package/dist/tui/app.js +0 -612
  166. package/dist/tui/keys.js +0 -90
  167. package/dist/tui/render.js +0 -411
  168. package/web/dist/assets/index-DgQFpKbn.css +0 -2
  169. package/web/dist/assets/settings-workflows-H-6eCff3.js +0 -23
  170. package/web/dist/assets/workflow-api-BfExddae.js +0 -6
  171. package/web/dist/assets/workflow-editors-CsbVx4WJ.js +0 -139
  172. package/web/dist/assets/workflows-Bv0sj7d0.js +0 -7
  173. package/web/dist/assets/workflows-pane-DHm44w7P.js +0 -1
  174. /package/dist/protocol/{publish.js → imports.js} +0 -0
@@ -1,9 +1,9 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { existsSync, mkdtempSync, realpathSync, rmSync, statSync } from 'node:fs';
3
3
  import { isAbsolute, join, resolve } from 'node:path';
4
- import { parseValue, toTypeScript } from "./schema.js";
5
- import { prepareFilesystemIsolation, validateFilesystemScope } from "../isolation/filesystem.js";
6
- import { sandboxUnavailable } from "../isolation/sandbox.js";
4
+ import { parseValue, toTypeScript } from './schema.js';
5
+ import { prepareFilesystemIsolation, validateFilesystemScope } from '../isolation/filesystem.js';
6
+ import { sandboxUnavailable } from '../isolation/sandbox.js';
7
7
  const environment = { PATH: '/usr/local/bin:/usr/bin:/bin', LANG: 'C.UTF-8' };
8
8
  function probe(command, args, stdioFds = [], env = environment) {
9
9
  if (!isAbsolute(command))
@@ -99,7 +99,7 @@ export async function createCodeExecutors(options) {
99
99
  const stateRoot = options.stateRoot ? { stateRoot: options.stateRoot } : {};
100
100
  const scope = canonicalScope(context.scope);
101
101
  const runtimePath = realpathSync(options.runtimePath);
102
- const sandbox = isolationMode === 'sandbox' ? await options.sandbox(context.sessionId) : undefined;
102
+ const sandbox = isolationMode === 'sandbox' ? await options.sandbox(context.ownerId ?? context.sessionId) : undefined;
103
103
  const nodePath = sandbox ? sandbox.nodePath : realpathSync(options.nodePath);
104
104
  const args = ['--noprofile', '--norc', '-c', 'ulimit -c 0; exec "$@"', 'flow-workflow', nodePath, '--max-old-space-size=128', runtimePath];
105
105
  const timeout = Math.min(context.step.timeoutMs ?? 60_000, 2_147_000_000);
@@ -113,7 +113,8 @@ export async function createCodeExecutors(options) {
113
113
  CLAUDE_CONFIG_DIR: process.env.CLAUDE_CONFIG_DIR };
114
114
  const launch = sandbox?.command(scope, ['/bin/bash', ...args], environment);
115
115
  const isolation = isolationEnabled && !sandbox ? await prepareFilesystemIsolation({ scope, expectedScope: resolve(context.scope),
116
- ...stateRoot, command: '/bin/bash', args, env, readablePaths: [nodePath, runtimePath], credentials: 'none' }) : undefined;
116
+ ...stateRoot, command: '/bin/bash', args, env, readablePaths: [nodePath, runtimePath], credentials: 'none',
117
+ scopeReadOnly: context.sessionId !== undefined && !!options.readOnly?.(context.sessionId) }) : undefined;
117
118
  const release = sandbox?.hold();
118
119
  try {
119
120
  context.signal.throwIfAborted();
@@ -1,10 +1,10 @@
1
- import { validateMcpSchemas } from "./mcp.js";
2
- import { leadingSkillInvocation } from "../protocol/skills.js";
1
+ import { validateMcpSchemas } from './mcp.js';
2
+ import { leadingSkillInvocation } from '../protocol/skills.js';
3
3
  import { z } from 'zod';
4
- import { validSecretName } from "../protocol/secrets.js";
5
- import { Decisions } from "./decisions.js";
6
- import { analyzeLoops } from "./loops.js";
7
- import { dictionaryKey, dictionaryRecord, declaredOutputSchema, partialSchema, schemaAssignable, schemaAt, unionSchema, validateSchema, valueAt, visualSchemaValidator } from "./schema.js";
4
+ import { validSecretName } from '../protocol/secrets.js';
5
+ import { Decisions } from './decisions.js';
6
+ import { analyzeLoops } from './loops.js';
7
+ import { dictionaryKey, dictionaryRecord, declaredOutputSchema, parseValue, partialSchema, schemaAssignable, schemaAt, unionSchema, validateSchema, valueAt, visualSchemaValidator } from './schema.js';
8
8
  const reference = z.discriminatedUnion('source', [
9
9
  z.object({ source: z.literal('input'), path: z.array(z.string()) }).strict(),
10
10
  z.object({ source: z.literal('step'), stepId: z.string(), path: z.array(z.string()) }).strict(),
@@ -37,12 +37,19 @@ export const workflowDefinitionValidator = z.object({
37
37
  z.object({ ...base, kind: z.literal('typescript'), code: z.string(), outputSchema: visualSchemaValidator }).strict(),
38
38
  z.object({ ...base, kind: z.literal('branch'), condition }).strict(),
39
39
  z.object({ ...base, kind: z.literal('join') }).strict(),
40
+ z.object({ ...base, kind: z.literal('workflow'), workflowId: z.string().regex(/^[a-zA-Z0-9_-]{1,128}$/), contract: z.object({ inputSchema: visualSchemaValidator.refine(schema => schema.type === 'object'), outputSchema: visualSchemaValidator }).strict() }).strict(),
40
41
  z.object({ ...base, kind: z.literal('mcp'), tool: z.object({ connectionId: z.string().min(1), connectionName: z.string(), identity: z.string().regex(/^[a-f0-9]{64}$/), serverIdentity: z.string().regex(/^[a-f0-9]{64}$/), toolName: z.string().min(1), inputSchema: originalSchema, outputSchema: originalSchema.optional() }).strict() }).strict(),
41
42
  ])).min(1),
42
43
  loopSettings: dictionaryRecord(z.object({ maxTries: z.number().int().min(1).max(100) }).strict()).optional(),
43
44
  edges: z.array(z.object({ id: z.string().min(1), from: z.string(), to: z.string(), outcome: z.enum(['success', 'failure', 'timeout', 'true', 'false']) }).strict()),
44
45
  }).strict();
45
46
  export function validateDefinition(value) {
47
+ return buildGraph(value);
48
+ }
49
+ export function mappingSourceGraph(value) {
50
+ return buildGraph(value, true);
51
+ }
52
+ function buildGraph(value, mappingSources = false) {
46
53
  const definition = workflowDefinitionValidator.parse(value);
47
54
  const skillStep = definition.steps.find(step => step.kind === 'agent' && leadingSkillInvocation(step.instructions));
48
55
  if (skillStep && !definition.projectId) {
@@ -167,7 +174,31 @@ export function validateDefinition(value) {
167
174
  node.items.forEach(inspect);
168
175
  };
169
176
  inspect(mapping.template);
170
- input = { type: 'json' };
177
+ const infer = (node) => {
178
+ if (node.kind === 'reference')
179
+ return referenceSchema(node.reference).schema;
180
+ if (node.kind === 'object')
181
+ return { type: 'object', fields: Object.fromEntries(Object.entries(node.fields).map(([key, value]) => [key, { schema: infer(value), required: true }])) };
182
+ if (node.kind === 'array')
183
+ return { type: 'array', items: node.items.length ? unionSchema(node.items.map(infer)) : { type: 'json' } };
184
+ const literal = (value) => {
185
+ if (value === null)
186
+ return { type: 'null' };
187
+ if (typeof value === 'string')
188
+ return { type: 'enum', values: [value] };
189
+ if (typeof value === 'number')
190
+ return { type: 'number', integer: Number.isInteger(value) };
191
+ if (typeof value === 'boolean')
192
+ return { type: 'boolean' };
193
+ if (Array.isArray(value))
194
+ return { type: 'array', items: value.length ? unionSchema(value.map(literal)) : { type: 'json' } };
195
+ return { type: 'object', fields: Object.fromEntries(Object.entries(value).map(([key, value]) => [key, { schema: literal(value), required: true }])) };
196
+ };
197
+ return literal(node.value);
198
+ };
199
+ input = step.kind === 'workflow' ? infer(mapping.template) : { type: 'json' };
200
+ if (step.kind === 'workflow' && !mappingSources && mapping.template.kind === 'literal')
201
+ parseValue(step.contract.inputSchema, mapping.template.value);
171
202
  }
172
203
  else if (mapping?.kind === 'reference') {
173
204
  const field = referenceSchema(mapping.reference);
@@ -198,9 +229,16 @@ export function validateDefinition(value) {
198
229
  }
199
230
  if (step.inputSchema) {
200
231
  validateSchema(step.inputSchema);
201
- if (!schemaAssignable(input, step.inputSchema))
232
+ if (!(mappingSources && step.kind === 'workflow') && !schemaAssignable(input, step.inputSchema))
202
233
  throw new Error('Input does not match the declared input schema');
203
234
  }
235
+ if (step.kind === 'workflow') {
236
+ validateSchema(step.contract.inputSchema);
237
+ validateSchema(step.contract.outputSchema);
238
+ if (!mappingSources && (!schemaAssignable(input, step.contract.inputSchema) || (step.inputSchema && !schemaAssignable(step.inputSchema, step.contract.inputSchema))))
239
+ throw new Error('Input does not match the Workflow call input contract');
240
+ return step.contract.inputSchema;
241
+ }
204
242
  return step.inputSchema ?? input;
205
243
  };
206
244
  const inputFor = (id) => {
@@ -235,7 +273,43 @@ export function validateDefinition(value) {
235
273
  }
236
274
  outputFor(step.id);
237
275
  }
238
- return graph;
276
+ const terminalConditions = order.map(step => decisions.and(completed.get(step.id), decisions.not(any(outgoing.get(step.id).map(edge => selectedEdges.get(edge.id))))));
277
+ let finished = 1;
278
+ for (const step of order) {
279
+ const handled = any(outgoing.get(step.id).filter(edge => edge.outcome === 'failure' || edge.outcome === 'timeout').map(edge => selectedEdges.get(edge.id)));
280
+ finished = decisions.and(finished, decisions.or(decisions.not(reaches.get(step.id)), decisions.or(completed.get(step.id), handled)));
281
+ if (loops.length)
282
+ finished = decisions.and(finished, decisions.not(any(outgoing.get(step.id).filter(edge => backIds.has(edge.id)).map(edge => selectedEdges.get(edge.id)))));
283
+ }
284
+ const candidates = order.map((step, index) => ({ step, condition: terminalConditions[index] })).filter(({ condition }) => decisions.and(finished, condition) !== 0);
285
+ const variants = [];
286
+ let none = 1;
287
+ let one = 0;
288
+ let many = 0;
289
+ for (const { condition } of candidates) {
290
+ many = decisions.or(many, decisions.and(one, condition));
291
+ one = decisions.or(decisions.and(one, decisions.not(condition)), decisions.and(none, condition));
292
+ none = decisions.and(none, decisions.not(condition));
293
+ }
294
+ if (loops.length || definition.edges.some(edge => edge.outcome === 'failure' || edge.outcome === 'timeout')) {
295
+ const possible = order.filter(step => step.kind === 'branch'
296
+ ? ['true', 'false'].some(outcome => !outgoing.get(step.id).some(edge => edge.outcome === outcome))
297
+ : !outgoing.get(step.id).some(edge => edge.outcome === 'success'));
298
+ variants.push(...possible.map(step => outputFor(step.id)));
299
+ if (possible.length > 1)
300
+ variants.push({ type: 'object', fields: Object.fromEntries(possible.map(step => [step.name, { schema: outputFor(step.id) }])) });
301
+ }
302
+ else {
303
+ for (const { step, condition } of candidates)
304
+ if (decisions.and(finished, decisions.and(one, condition)) !== 0)
305
+ variants.push(outputFor(step.id));
306
+ const multiple = decisions.and(finished, many);
307
+ if (multiple !== 0)
308
+ variants.push({ type: 'object', fields: Object.fromEntries(candidates.filter(({ condition }) => decisions.and(multiple, condition) !== 0).map(({ step, condition }) => [step.name, { schema: outputFor(step.id), required: decisions.implies(multiple, condition) }])) });
309
+ if (decisions.and(finished, none) !== 0)
310
+ variants.push({ type: 'object', fields: {} });
311
+ }
312
+ return { ...graph, resultSchema: variants.length ? unionSchema(variants) : { type: 'json' } };
239
313
  }
240
314
  export function recoverySchema(input, output) {
241
315
  return { type: 'object', fields: {
@@ -0,0 +1,23 @@
1
+ import { executionIdentity } from './owner.js';
2
+ export class WorkflowInvocationNotFound extends Error {
3
+ }
4
+ export function invocationExecution(root, invocationId) {
5
+ if (!root.invocations || !Object.hasOwn(root.invocations, invocationId))
6
+ throw new WorkflowInvocationNotFound('Unknown workflow invocation');
7
+ const invocation = root.invocations[invocationId];
8
+ const retained = root.retainedDefinitions?.[invocation.definitionId];
9
+ if (!retained)
10
+ throw new Error('Missing retained Workflow Definition');
11
+ const definition = structuredClone(retained);
12
+ for (const correction of invocation.definitionUpdates ?? []) {
13
+ const index = definition.steps.findIndex(step => step.id === correction.stepId);
14
+ if (index < 0)
15
+ throw new Error('Invalid invocation correction');
16
+ definition.steps[index] = structuredClone(correction.nextStep);
17
+ }
18
+ return { ...structuredClone(invocation), ...executionIdentity(root), scope: root.scope, definition };
19
+ }
20
+ export function invocationCheckpoint(record, ownership) {
21
+ const { version: _, occurrenceId: _occurrence, runtime: _runtime, sessionId: __, scope: ___, definition: ____, ...state } = record;
22
+ return { ...state, ...ownership };
23
+ }
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { compileJsonSchema, validateJsonSchema } from "./json-schema.js";
2
+ import { compileJsonSchema, validateJsonSchema } from './json-schema.js';
3
3
  /** Keep tool and schema context at discovery, save and execution boundaries. */
4
4
  export function validateMcpSchemas(tool) {
5
5
  for (const field of ['inputSchema', 'outputSchema']) {
@@ -0,0 +1,45 @@
1
+ import { join } from 'node:path';
2
+ function storageId(value) {
3
+ if (!/^[a-zA-Z0-9_-]+$/.test(value))
4
+ throw new Error('Invalid storage ID');
5
+ return value;
6
+ }
7
+ export function executionOwnerOf(value) {
8
+ if (value.version === 1 && (value.occurrenceId !== undefined || !value.sessionId))
9
+ throw new Error('Invalid execution owner');
10
+ if (value.version === 2 && !value.occurrenceId)
11
+ throw new Error('Invalid execution owner');
12
+ if (value.occurrenceId !== undefined)
13
+ return { kind: 'occurrence', occurrenceId: storageId(value.occurrenceId) };
14
+ if (value.sessionId)
15
+ return { kind: 'session', sessionId: storageId(value.sessionId) };
16
+ throw new Error('Missing execution owner');
17
+ }
18
+ export function executionOwnerKey(owner) {
19
+ return owner.kind === 'occurrence' ? `occurrence-${storageId(owner.occurrenceId)}` : storageId(owner.sessionId);
20
+ }
21
+ export function parseExecutionOwnerKey(key) {
22
+ storageId(key);
23
+ return key.startsWith('occurrence-') ? { kind: 'occurrence', occurrenceId: storageId(key.slice(11)) } : { kind: 'session', sessionId: key };
24
+ }
25
+ export function executionOwnerPath(stateRoot, owner) {
26
+ return owner.kind === 'occurrence'
27
+ ? join(stateRoot, 'workflow-schedules', 'executions', storageId(owner.occurrenceId))
28
+ : join(stateRoot, 'sessions', storageId(owner.sessionId));
29
+ }
30
+ export function executionIdentity(value) {
31
+ const owner = executionOwnerOf(value);
32
+ return owner.kind === 'session'
33
+ ? { version: 1, sessionId: owner.sessionId }
34
+ : { version: 2, occurrenceId: owner.occurrenceId, ...(value.sessionId === undefined ? {} : { sessionId: storageId(value.sessionId) }) };
35
+ }
36
+ export function executionAssociation(value) {
37
+ return executionOwnerOf(value).kind === 'occurrence' ? value.sessionId : undefined;
38
+ }
39
+ export function executionAccessibleBy(value, owner) {
40
+ const requested = typeof owner === 'string' ? parseExecutionOwnerKey(owner) : owner;
41
+ const actual = executionOwnerOf(value);
42
+ if (requested.kind === 'occurrence')
43
+ return actual.kind === 'occurrence' && actual.occurrenceId === requested.occurrenceId;
44
+ return actual.kind === 'session' ? actual.sessionId === requested.sessionId : executionAssociation(value) === requested.sessionId;
45
+ }
@@ -1,7 +1,11 @@
1
- import { boundedMcpValue, validateMcpOutput } from "./mcp.js";
1
+ import { boundedMcpValue, validateMcpOutput } from './mcp.js';
2
2
  import { z } from 'zod';
3
3
  import { isDeepStrictEqual } from 'node:util';
4
- import { validateDefinition, workflowDefinitionValidator } from "./graph.js";
4
+ import { resolveWorkflowCalls } from './calls.js';
5
+ import { dictionaryRecord } from './schema.js';
6
+ import { validateDefinition, workflowDefinitionValidator } from './graph.js';
7
+ import { validateCompatibleDefinition } from './recovery.js';
8
+ import { executionIdentity, executionOwnerKey, executionOwnerOf } from './owner.js';
5
9
  const errorValidator = z.object({ message: z.string(), kind: z.enum(['failure', 'timeout', 'interrupted']) }).strict();
6
10
  const identityValidator = z.object({ headerId: z.string().min(1), activation: z.number().int().positive(), try: z.number().int().positive() }).strict();
7
11
  const loopValidator = z.object({
@@ -11,24 +15,56 @@ const loopValidator = z.object({
11
15
  }).strict();
12
16
  const attemptValidator = z.object({
13
17
  loops: z.array(identityValidator).optional(),
14
- number: z.number().int().positive(), action: z.enum(['execute', 'retry', 'supply']), startedAt: z.number().nonnegative(), finishedAt: z.number().nonnegative().optional(),
18
+ number: z.number().int().positive(), action: z.enum(['execute', 'retry', 'supply']), startedAt: z.number().nonnegative(), deadlineAt: z.number().nonnegative().optional(), finishedAt: z.number().nonnegative().optional(),
15
19
  input: z.json(), output: z.json().optional(), partialOutput: z.json().optional(), error: errorValidator.optional(),
16
20
  }).strict();
17
- export const workflowExecutionValidator = z.object({
18
- version: z.literal(1), id: z.string().min(1), sessionId: z.string().min(1), scope: z.string(), definition: workflowDefinitionValidator,
19
- input: z.json(), launchId: z.string().min(1).optional(), naming: z.enum(['pending', 'requested']).optional(), testStepId: z.string().optional(), status: z.enum(['running', 'recovery-required', 'completed', 'completed-with-recovery', 'cancelled']),
21
+ const checkpointFields = {
22
+ definitionUpdates: z.array(z.object({
23
+ stepId: z.string().min(1), previousStep: workflowDefinitionValidator.shape.steps.element, nextStep: workflowDefinitionValidator.shape.steps.element,
24
+ appliedAt: z.number().nonnegative(), attempt: z.number().int().min(2),
25
+ }).strict()).optional(),
26
+ input: z.json(), status: z.enum(['running', 'recovery-required', 'completed', 'completed-with-recovery', 'cancelled']),
20
27
  startedAt: z.number().nonnegative(), finishedAt: z.number().nonnegative().optional(), result: z.json().optional(),
21
- loops: z.record(z.string(), loopValidator).optional(),
22
- steps: z.record(z.string(), z.object({
28
+ loops: dictionaryRecord(loopValidator).optional(),
29
+ steps: dictionaryRecord(z.object({
23
30
  status: z.enum(['pending', 'running', 'completed', 'failed', 'timed-out', 'interrupted', 'skipped', 'blocked', 'cancelled']), recovery: z.boolean().optional(),
24
31
  attempts: z.array(attemptValidator), output: z.json().optional(), outcome: z.enum(['success', 'failure', 'timeout', 'true', 'false']).optional(),
25
32
  }).strict()),
33
+ };
34
+ const invocationValidator = z.object({
35
+ ...checkpointFields, id: z.string().min(1), parentInvocationId: z.string().min(1).optional(),
36
+ callStepId: z.string().min(1), callAttempt: z.number().int().positive(), definitionId: z.string().min(1),
26
37
  }).strict();
27
- export function parseExecution(value) {
28
- const record = workflowExecutionValidator.parse(value);
38
+ export const workflowExecutionValidator = z.object({
39
+ ...checkpointFields, version: z.union([z.literal(1), z.literal(2)]), occurrenceId: z.string().regex(/^[a-zA-Z0-9_-]+$/).optional(), runtime: z.object({ nodePath: z.string().optional(), isolationMode: z.enum(['none', 'bubblewrap', 'sandbox']) }).strict().optional(), id: z.string().min(1), sessionId: z.string().min(1).optional(), scope: z.string(), definition: workflowDefinitionValidator,
40
+ retainedDefinitions: z.preprocess(value => value && typeof value === 'object' && !Array.isArray(value) ? new Map(Object.entries(value)) : value, z.map(workflowDefinitionValidator.shape.id, workflowDefinitionValidator)).transform(entries => Object.fromEntries(entries)).optional(),
41
+ invocations: dictionaryRecord(invocationValidator).optional(),
42
+ launchId: z.string().min(1).optional(), naming: z.enum(['pending', 'requested']).optional(), testStepId: z.string().optional(),
43
+ }).strict();
44
+ function validateCheckpoint(record) {
29
45
  const graph = validateDefinition(record.definition);
30
46
  if (graph.order.length !== Object.keys(record.steps).length || graph.order.some(step => !Object.hasOwn(record.steps, step.id)))
31
47
  throw new Error('Execution steps do not match the definition');
48
+ // Walk corrections backwards to validate both their contracts and the snapshot chain.
49
+ // The checkpoint before pump may name the next attempt before it has been appended.
50
+ let definition = record.definition;
51
+ const nextAttempts = new Map();
52
+ for (const update of [...(record.definitionUpdates ?? [])].reverse()) {
53
+ const state = record.steps[update.stepId];
54
+ const next = definition.steps.find(step => step.id === update.stepId);
55
+ if (!state || update.previousStep.id !== update.stepId || !isDeepStrictEqual(next, update.nextStep))
56
+ throw new Error('Invalid definition update snapshot');
57
+ if (update.attempt > state.attempts.length + 1 || (nextAttempts.has(update.stepId) && update.attempt > nextAttempts.get(update.stepId)))
58
+ throw new Error('Invalid definition update attempt');
59
+ const attempt = state.attempts[update.attempt - 1];
60
+ if ((attempt && attempt.action !== 'retry') || !state.attempts[update.attempt - 2]?.error)
61
+ throw new Error('Definition update requires a failed retry attempt');
62
+ nextAttempts.set(update.stepId, update.attempt);
63
+ const previous = { ...definition, steps: definition.steps.map(step => step.id === update.stepId ? update.previousStep : step) };
64
+ validateCompatibleDefinition(previous, definition, update.stepId);
65
+ definition = previous;
66
+ }
67
+ const original = definition;
32
68
  if (record.testStepId && !Object.hasOwn(record.steps, record.testStepId))
33
69
  throw new Error('Unknown test step');
34
70
  if (record.testStepId && record.naming)
@@ -76,6 +112,11 @@ export function parseExecution(value) {
76
112
  }
77
113
  const containing = loops.filter(loop => loop.memberIds.includes(id));
78
114
  for (const [index, attempt] of step.attempts.entries()) {
115
+ if (attempt.deadlineAt !== undefined) {
116
+ const configuration = stepConfiguration(record, original, id, attempt.number);
117
+ if (configuration?.kind !== 'workflow' || configuration.timeoutMs === undefined || attempt.deadlineAt !== attempt.startedAt + configuration.timeoutMs)
118
+ throw new Error('Invalid call attempt deadline');
119
+ }
79
120
  if ((attempt.loops ?? []).length !== containing.length || containing.some(loop => !attempt.loops?.some(identity => identity.headerId === loop.headerId)))
80
121
  throw new Error('Invalid attempt loop identities');
81
122
  if (containing.length && index === 0 && attempt.action !== 'execute')
@@ -109,5 +150,104 @@ export function parseExecution(value) {
109
150
  }
110
151
  if (['completed', 'completed-with-recovery'].includes(record.status) && Object.values(record.steps).some(step => ['pending', 'running', 'interrupted', 'blocked'].includes(step.status)))
111
152
  throw new Error('Completed execution contains unfinished work');
153
+ return original;
154
+ }
155
+ function stepConfiguration(record, original, stepId, attempt) {
156
+ let step = original.steps.find(step => step.id === stepId);
157
+ for (const update of record.definitionUpdates ?? [])
158
+ if (update.stepId === stepId && update.attempt <= attempt)
159
+ step = update.nextStep;
160
+ return step;
161
+ }
162
+ export function parseExecution(value) {
163
+ const record = workflowExecutionValidator.parse(value);
164
+ executionIdentity(record);
165
+ const original = validateCheckpoint(record);
166
+ const manifest = record.retainedDefinitions;
167
+ if (!manifest) {
168
+ if (record.invocations || record.definition.steps.some(step => step.kind === 'workflow'))
169
+ throw new Error('Missing retained Workflow Definitions');
170
+ return record;
171
+ }
172
+ for (const [id, definition] of Object.entries(manifest))
173
+ if (id !== definition.id)
174
+ throw new Error('Invalid retained definition identity');
175
+ if (!isDeepStrictEqual(manifest[original.id], original))
176
+ throw new Error('Retained root definition does not match the original checkpoint');
177
+ const resolved = resolveWorkflowCalls(original, id => {
178
+ if (!Object.hasOwn(manifest, id))
179
+ throw new Error('Missing retained definition');
180
+ return manifest[id];
181
+ }, record.testStepId);
182
+ if (!isDeepStrictEqual(resolved, manifest))
183
+ throw new Error('Retained definitions do not match the call manifest');
184
+ const locals = new Map();
185
+ const originals = new Map();
186
+ for (const [id, invocation] of Object.entries(record.invocations ?? {})) {
187
+ if (id !== invocation.id || id === record.id)
188
+ throw new Error('Invalid invocation identity');
189
+ const retained = manifest[invocation.definitionId];
190
+ if (!retained)
191
+ throw new Error('Missing invocation definition');
192
+ const definition = structuredClone(retained);
193
+ for (const update of invocation.definitionUpdates ?? []) {
194
+ const index = definition.steps.findIndex(step => step.id === update.stepId);
195
+ if (index < 0)
196
+ throw new Error('Unknown invocation correction step');
197
+ definition.steps[index] = structuredClone(update.nextStep);
198
+ }
199
+ const local = { ...invocation, ...executionIdentity(record), scope: record.scope, definition };
200
+ if (!isDeepStrictEqual(validateCheckpoint(local), retained))
201
+ throw new Error('Invocation corrections do not match the retained definition');
202
+ locals.set(id, local);
203
+ originals.set(id, retained);
204
+ }
205
+ const checked = new Set();
206
+ for (const id of locals.keys()) {
207
+ const path = new Set();
208
+ let current = id;
209
+ while (current !== undefined && !checked.has(current)) {
210
+ if (path.has(current))
211
+ throw new Error('Invocation parent cycle');
212
+ path.add(current);
213
+ const invocation = record.invocations[current];
214
+ if (!invocation)
215
+ throw new Error('Missing parent invocation');
216
+ current = invocation.parentInvocationId;
217
+ }
218
+ for (const ancestor of path)
219
+ checked.add(ancestor);
220
+ }
221
+ const owners = new Set();
222
+ for (const [id, invocation] of Object.entries(record.invocations ?? {})) {
223
+ const parentId = invocation.parentInvocationId;
224
+ const parent = parentId === undefined ? record : locals.get(parentId);
225
+ const parentOriginal = parentId === undefined ? original : originals.get(parentId);
226
+ const step = stepConfiguration(parent, parentOriginal, invocation.callStepId, invocation.callAttempt);
227
+ const state = parent.steps[invocation.callStepId];
228
+ const attempt = state?.attempts[invocation.callAttempt - 1];
229
+ if (step?.kind !== 'workflow' || step.workflowId !== invocation.definitionId || !attempt || attempt.action === 'supply' || (parent.testStepId !== undefined && parent.testStepId !== step.id))
230
+ throw new Error('Invalid invocation call ownership');
231
+ if (!isDeepStrictEqual(invocation.input, attempt.input))
232
+ throw new Error('Invocation input does not match the call attempt');
233
+ if (step.timeoutMs !== undefined && attempt.deadlineAt === undefined)
234
+ throw new Error('Missing call attempt deadline');
235
+ if (invocation.callAttempt < state.attempts.length && ['running', 'recovery-required'].includes(invocation.status))
236
+ throw new Error('Unfinished invocation belongs to an earlier call attempt');
237
+ const owner = JSON.stringify([parentId ?? null, invocation.callStepId, invocation.callAttempt]);
238
+ if (owners.has(owner))
239
+ throw new Error('Duplicate invocation call ownership');
240
+ owners.add(owner);
241
+ if (['completed', 'completed-with-recovery'].includes(invocation.status) && invocation.result === undefined)
242
+ throw new Error('Missing completed invocation result');
243
+ if (['completed', 'completed-with-recovery'].includes(record.status) && ['running', 'recovery-required'].includes(invocation.status))
244
+ throw new Error('Completed execution contains unfinished invocations');
245
+ if (!locals.has(id))
246
+ throw new Error('Missing invocation checkpoint');
247
+ }
112
248
  return record;
113
249
  }
250
+ /** Stable checkpoint owner, independent of optional Agent Session association. */
251
+ export function executionOwner(record) {
252
+ return executionOwnerKey(executionOwnerOf(record));
253
+ }
@@ -1,15 +1,100 @@
1
1
  import { createHash } from 'node:crypto';
2
+ import { isDeepStrictEqual } from 'node:util';
3
+ import { validateDefinition } from './graph.js';
4
+ import { invocationExecution } from './invocations.js';
5
+ // Object key order is not part of a saved definition's identity; array order is.
6
+ function canonical(value) {
7
+ if (Array.isArray(value))
8
+ return value.map(canonical);
9
+ if (value !== null && typeof value === 'object')
10
+ return Object.fromEntries(Object.entries(value).filter(([, value]) => value !== undefined).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, value]) => [key, canonical(value)]));
11
+ return value;
12
+ }
13
+ /** Authority over exactly the saved definition resolved by the host. Not recoveryRevision. */
14
+ export function savedDefinitionRevision(definition) {
15
+ return createHash('sha256').update(JSON.stringify(canonical(definition))).digest('hex');
16
+ }
17
+ function fixedStep(step) {
18
+ // An allowlist keeps future contracts and policy fields immutable by default.
19
+ const configurable = new Set(['timeoutMs', 'secrets']);
20
+ if (step.kind === 'agent')
21
+ ['instructions', 'model', 'effort'].forEach(key => configurable.add(key));
22
+ if (step.kind === 'shell')
23
+ ['command', 'acceptedExitCodes'].forEach(key => configurable.add(key));
24
+ if (step.kind === 'typescript')
25
+ configurable.add('code');
26
+ if (step.kind === 'branch')
27
+ configurable.add('condition');
28
+ // MCP tool snapshots include identity and schemas, so they remain fixed.
29
+ return Object.fromEntries(Object.entries(step).filter(([key]) => !configurable.has(key)));
30
+ }
31
+ /**
32
+ * Pure host preflight: validate the candidate and allow executable config edits only on stepId.
33
+ * Eligibility, runtime readiness and saved-definition authority are checked by recover itself.
34
+ * Names, positions, permissions, contracts, mappings, tool snapshots and topology stay fixed.
35
+ */
36
+ export function validateCompatibleDefinition(previous, candidate, stepId) {
37
+ const graph = validateDefinition(candidate);
38
+ const old = validateDefinition(previous).definition;
39
+ const target = old.steps.find(step => step.id === stepId);
40
+ const next = graph.definition.steps.find(step => step.id === stepId);
41
+ if (!target || !next)
42
+ throw new Error('Unknown recovery step');
43
+ if (!isDeepStrictEqual(fixedStep(target), fixedStep(next)))
44
+ throw new Error('Updated definition changes the recovery step contract or policy');
45
+ const { steps: oldSteps, ...oldRest } = old;
46
+ const { steps: nextSteps, ...nextRest } = graph.definition;
47
+ if (!isDeepStrictEqual(oldRest, nextRest) || !isDeepStrictEqual(oldSteps.map(step => step.id === stepId ? fixedStep(step) : step), nextSteps.map(step => step.id === stepId ? fixedStep(step) : step))) {
48
+ throw new Error('Updated definition may change only the recovery step executable configuration');
49
+ }
50
+ return graph;
51
+ }
52
+ export function recoverySteps(root, action, replacement) {
53
+ const steps = [];
54
+ let invocationId = action.invocationId, selected = true;
55
+ for (;;) {
56
+ const current = invocationId === undefined ? root : invocationExecution(root, invocationId);
57
+ const graph = validateDefinition(selected && replacement ? replacement : current.definition);
58
+ const repeating = new Set(current.testStepId ? [] : graph.loops.filter(loop => ['active', 'repeating', 'limit'].includes(current.loops?.[loop.headerId]?.phase ?? 'inactive')).flatMap(loop => loop.memberIds));
59
+ const owned = new Set(Object.values(root.invocations ?? {}).filter(invocation => {
60
+ const call = current.steps[invocation.callStepId];
61
+ return invocation.parentInvocationId === invocationId && call?.status === 'running' && invocation.callAttempt === call.attempts.length;
62
+ }).map(invocation => invocation.callStepId));
63
+ for (const step of graph.order) {
64
+ if (current.testStepId && current.testStepId !== step.id)
65
+ continue;
66
+ if (!repeating.has(step.id)) {
67
+ const state = current.steps[step.id];
68
+ if (!current.testStepId && ['failed', 'timed-out'].includes(state.status) && !state.recovery && graph.outgoing.get(step.id).some(edge => edge.outcome === state.outcome))
69
+ continue;
70
+ if (state.status === 'completed' || owned.has(step.id))
71
+ continue;
72
+ if (selected && action.kind === 'supply' && action.stepId === step.id)
73
+ continue;
74
+ }
75
+ steps.push(step);
76
+ }
77
+ if (invocationId === undefined)
78
+ return steps;
79
+ invocationId = root.invocations[invocationId].parentInvocationId;
80
+ selected = false;
81
+ }
82
+ }
2
83
  /** State identity, not wall-clock time: repeated notifications cannot mint new authority. */
3
84
  export function recoveryRevision(record) {
4
85
  return createHash('sha256').update(JSON.stringify({ id: record.id, status: record.status,
5
86
  steps: Object.entries(record.steps).map(([id, step]) => [id, step.status, step.attempts.map(a => [a.number, a.action, a.finishedAt, a.error])]),
6
- loops: record.loops,
87
+ loops: record.loops, definition: savedDefinitionRevision(record.definition), definitionUpdates: record.definitionUpdates,
88
+ invocations: record.invocations, retainedDefinitions: record.retainedDefinitions,
7
89
  })).digest('hex');
8
90
  }
9
91
  export function successfulProgress(record) {
10
- return Object.values(record.steps).reduce((count, step) => count + step.attempts.filter(a => a.finishedAt !== undefined && a.output !== undefined && !a.error && a.action !== 'supply').length, 0);
92
+ const local = (execution) => Object.entries(execution.steps).reduce((count, [id, step]) => count + (execution.definition.steps.find(step => step.id === id)?.kind === 'workflow' ? 0 : step.attempts.filter(a => a.finishedAt !== undefined && a.output !== undefined && !a.error && a.action !== 'supply').length), 0);
93
+ return local(record) + Object.keys(record.invocations ?? {}).reduce((count, id) => count + local(invocationExecution(record, id)), 0);
11
94
  }
12
95
  export function safeAutomaticRecovery(record, action) {
96
+ if (action.invocationId)
97
+ record = invocationExecution(record, action.invocationId);
13
98
  if (record.status !== 'recovery-required' || Object.values(record.loops ?? {}).some(loop => loop.phase === 'limit'))
14
99
  return false;
15
100
  if (action.kind === 'retry') {
@@ -1,23 +1,23 @@
1
1
  import { accessSync, constants, statSync } from 'node:fs';
2
2
  import { delimiter, isAbsolute, join } from 'node:path';
3
- import { DEFAULT_WORKFLOW_RUNTIME } from "../protocol/settings.js";
4
- export function workflowRuntimeOptions(settings = DEFAULT_WORKFLOW_RUNTIME, path) {
5
- const discover = (name, search) => {
6
- for (const directory of search.split(delimiter)) {
7
- if (!isAbsolute(directory))
3
+ import { DEFAULT_WORKFLOW_RUNTIME } from '../protocol/settings.js';
4
+ export function findExecutable(name, search) {
5
+ for (const directory of search.split(delimiter)) {
6
+ if (!isAbsolute(directory))
7
+ continue;
8
+ const candidate = join(directory, name);
9
+ try {
10
+ if (!statSync(candidate).isFile())
8
11
  continue;
9
- const candidate = join(directory, name);
10
- try {
11
- if (!statSync(candidate).isFile())
12
- continue;
13
- accessSync(candidate, constants.X_OK);
14
- return candidate;
15
- }
16
- catch { }
12
+ accessSync(candidate, constants.X_OK);
13
+ return candidate;
17
14
  }
18
- return undefined;
19
- };
15
+ catch { }
16
+ }
17
+ return undefined;
18
+ }
19
+ export function workflowRuntimeOptions(settings = DEFAULT_WORKFLOW_RUNTIME, path) {
20
20
  return {
21
- nodePath: settings.nodePath ?? discover('node', path ?? process.env.PATH ?? ''),
21
+ nodePath: settings.nodePath ?? findExecutable('node', path ?? process.env.PATH ?? ''),
22
22
  };
23
23
  }
@@ -2,9 +2,9 @@ import { spawn } from 'node:child_process';
2
2
  import { constants, mkdirSync, openSync, closeSync, readFileSync, fstatSync, writeFileSync, realpathSync } from 'node:fs';
3
3
  import { resolve, relative, isAbsolute } from 'node:path';
4
4
  import { createInterface } from 'node:readline';
5
- import ts from 'typescript';
5
+ import ts from 'typescript-api';
6
6
  import { getQuickJS } from 'quickjs-emscripten';
7
- import { libraries } from "./runtime-libs.js";
7
+ import { libraries } from './runtime-libs.js';
8
8
  const LIMIT = 100_000;
9
9
  const controller = new AbortController();
10
10
  let stop = () => { controller.abort(); };
@@ -0,0 +1,2 @@
1
+ export class ScheduleValidationError extends Error {
2
+ }