@venn-lang/runtime 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +158 -0
  3. package/dist/index.d.ts +453 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +3314 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +56 -0
  8. package/src/check/check-calls.ts +82 -0
  9. package/src/check/check-deco-body.ts +77 -0
  10. package/src/check/check-document.ts +106 -0
  11. package/src/check/check-env.ts +96 -0
  12. package/src/check/check-fragment-call.ts +27 -0
  13. package/src/check/check-imports.ts +82 -0
  14. package/src/check/check-interpolation.ts +58 -0
  15. package/src/check/check-options.ts +18 -0
  16. package/src/check/check-uncalled.ts +42 -0
  17. package/src/check/check.types.ts +30 -0
  18. package/src/check/index.ts +4 -0
  19. package/src/context/action-context.ts +20 -0
  20. package/src/context/index.ts +1 -0
  21. package/src/decorators/builtin-decorators.ts +87 -0
  22. package/src/decorators/create-decorator-source.ts +25 -0
  23. package/src/decorators/index.ts +2 -0
  24. package/src/emit/create-emitter.ts +16 -0
  25. package/src/emit/emitter.types.ts +6 -0
  26. package/src/emit/index.ts +3 -0
  27. package/src/emit/run-id.ts +11 -0
  28. package/src/eventsink/event-sink.port.ts +13 -0
  29. package/src/eventsink/event-sink.types.ts +11 -0
  30. package/src/eventsink/index.ts +4 -0
  31. package/src/eventsink/memory-sink.ts +17 -0
  32. package/src/eventsink/ndjson-sink.ts +14 -0
  33. package/src/index.ts +14 -0
  34. package/src/ports/create-port-resolver.ts +39 -0
  35. package/src/ports/index.ts +2 -0
  36. package/src/ports/port-resolver.types.ts +12 -0
  37. package/src/registry/build-registry.ts +76 -0
  38. package/src/registry/index.ts +2 -0
  39. package/src/registry/registry.types.ts +24 -0
  40. package/src/run/create-runner.ts +103 -0
  41. package/src/run/index.ts +4 -0
  42. package/src/run/resolve-imports.ts +166 -0
  43. package/src/run/runner.types.ts +67 -0
  44. package/src/scheduler/absorb-exit.ts +19 -0
  45. package/src/scheduler/aliases.ts +44 -0
  46. package/src/scheduler/annotations.ts +48 -0
  47. package/src/scheduler/base-scope.ts +25 -0
  48. package/src/scheduler/bind-globals.ts +55 -0
  49. package/src/scheduler/bind-imports.ts +130 -0
  50. package/src/scheduler/bind-namespaces.ts +61 -0
  51. package/src/scheduler/bind-prelude.ts +11 -0
  52. package/src/scheduler/block-plan.ts +66 -0
  53. package/src/scheduler/branch-engine.ts +13 -0
  54. package/src/scheduler/call-params.ts +140 -0
  55. package/src/scheduler/cleanup.types.ts +18 -0
  56. package/src/scheduler/collect.ts +60 -0
  57. package/src/scheduler/concurrency.ts +16 -0
  58. package/src/scheduler/create-cleanup-list.ts +17 -0
  59. package/src/scheduler/declared-arity.ts +13 -0
  60. package/src/scheduler/engine.types.ts +50 -0
  61. package/src/scheduler/filter.ts +5 -0
  62. package/src/scheduler/filter.types.ts +9 -0
  63. package/src/scheduler/flaky.ts +32 -0
  64. package/src/scheduler/flaky.types.ts +7 -0
  65. package/src/scheduler/index.ts +16 -0
  66. package/src/scheduler/invocation.ts +103 -0
  67. package/src/scheduler/local-call.ts +28 -0
  68. package/src/scheduler/node-span.ts +29 -0
  69. package/src/scheduler/opts-text.ts +10 -0
  70. package/src/scheduler/opts.ts +14 -0
  71. package/src/scheduler/pending.types.ts +9 -0
  72. package/src/scheduler/run-action.ts +163 -0
  73. package/src/scheduler/run-around.ts +23 -0
  74. package/src/scheduler/run-attempts.ts +105 -0
  75. package/src/scheduler/run-bindings.ts +67 -0
  76. package/src/scheduler/run-block.ts +65 -0
  77. package/src/scheduler/run-document.ts +181 -0
  78. package/src/scheduler/run-expect.ts +48 -0
  79. package/src/scheduler/run-flow.ts +69 -0
  80. package/src/scheduler/run-foreach.ts +148 -0
  81. package/src/scheduler/run-group.ts +9 -0
  82. package/src/scheduler/run-if.ts +21 -0
  83. package/src/scheduler/run-lifecycle.ts +86 -0
  84. package/src/scheduler/run-matcher.ts +99 -0
  85. package/src/scheduler/run-parallel.ts +68 -0
  86. package/src/scheduler/run-prologue.ts +59 -0
  87. package/src/scheduler/run-race.ts +20 -0
  88. package/src/scheduler/run-repeat.ts +54 -0
  89. package/src/scheduler/run-run.ts +41 -0
  90. package/src/scheduler/run-script.ts +48 -0
  91. package/src/scheduler/run-statements.ts +107 -0
  92. package/src/scheduler/run-step.ts +76 -0
  93. package/src/scheduler/run-try.ts +34 -0
  94. package/src/scheduler/run-while.ts +50 -0
  95. package/src/scheduler/script-lifecycle.ts +47 -0
  96. package/src/scheduler/settled.ts +20 -0
  97. package/src/scheduler/signals.ts +33 -0
  98. package/src/scheduler/target.ts +30 -0
  99. package/src/scheduler/unknown-option.ts +87 -0
  100. package/src/scope/create-scope.ts +67 -0
  101. package/src/scope/index.ts +2 -0
  102. package/src/scope/scope.types.ts +12 -0
  103. package/src/types/create-type-catalog.ts +70 -0
  104. package/src/types/index.ts +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["nearest","distance","bind","planOf","resume","planOf","isDefer","planOf","isDefer","problem","problem"],"sources":["../src/scheduler/signals.ts","../src/scheduler/absorb-exit.ts","../src/scheduler/aliases.ts","../src/scheduler/bind-globals.ts","../src/scheduler/bind-imports.ts","../src/scope/create-scope.ts","../src/scheduler/collect.ts","../src/scheduler/create-cleanup-list.ts","../src/scheduler/filter.ts","../src/scheduler/invocation.ts","../src/scheduler/node-span.ts","../src/scheduler/annotations.ts","../src/scheduler/bind-namespaces.ts","../src/scheduler/bind-prelude.ts","../src/scheduler/base-scope.ts","../src/scheduler/flaky.ts","../src/scheduler/run-around.ts","../src/scheduler/run-attempts.ts","../src/scheduler/unknown-option.ts","../src/scheduler/call-params.ts","../src/scheduler/declared-arity.ts","../src/scheduler/local-call.ts","../src/scheduler/settled.ts","../src/scheduler/target.ts","../src/scheduler/run-action.ts","../src/scheduler/run-bindings.ts","../src/scheduler/run-matcher.ts","../src/scheduler/run-expect.ts","../src/scheduler/concurrency.ts","../src/scheduler/opts.ts","../src/scheduler/run-foreach.ts","../src/scheduler/run-group.ts","../src/scheduler/run-if.ts","../src/scheduler/branch-engine.ts","../src/scheduler/opts-text.ts","../src/scheduler/run-parallel.ts","../src/scheduler/run-race.ts","../src/scheduler/run-repeat.ts","../src/scheduler/run-run.ts","../src/scheduler/run-step.ts","../src/scheduler/run-try.ts","../src/scheduler/run-while.ts","../src/scheduler/run-statements.ts","../src/scheduler/block-plan.ts","../src/scheduler/run-block.ts","../src/scheduler/run-lifecycle.ts","../src/scheduler/run-flow.ts","../src/scheduler/run-prologue.ts","../src/scheduler/run-document.ts","../src/scheduler/script-lifecycle.ts","../src/scheduler/run-script.ts","../src/check/check-options.ts","../src/check/check-calls.ts","../src/check/check-deco-body.ts","../src/check/check-env.ts","../src/check/check-fragment-call.ts","../src/check/check-interpolation.ts","../src/check/check-uncalled.ts","../src/check/check-document.ts","../src/check/check-imports.ts","../src/decorators/builtin-decorators.ts","../src/decorators/create-decorator-source.ts","../src/emit/create-emitter.ts","../src/emit/run-id.ts","../src/eventsink/event-sink.port.ts","../src/eventsink/memory-sink.ts","../src/eventsink/ndjson-sink.ts","../src/ports/create-port-resolver.ts","../src/registry/build-registry.ts","../src/context/action-context.ts","../src/run/create-runner.ts","../src/run/resolve-imports.ts","../src/types/create-type-catalog.ts"],"sourcesContent":["// Control-flow signals thrown to unwind loops and fragments. Deliberately not\n// Errors, so a `try/catch` in a flow re-throws them instead of treating them as\n// failures.\n\nexport class BreakSignal {}\nexport class ContinueSignal {}\nexport class ReturnSignal {\n constructor(readonly value: unknown) {}\n}\n/** Thrown at a statement boundary when the branch's race has already been won. */\nexport class CancelSignal {}\n/**\n * Thrown by `exit`, carrying the code the host should leave with.\n *\n * A signal and not an error: a run that exits has not failed. The code it\n * carries is the whole verdict, and `exit 0` is a clean ending, which an error\n * unwinding as a failure could not express.\n */\nexport class ExitSignal {\n constructor(readonly code: number) {}\n}\n\nexport type ControlSignal = BreakSignal | ContinueSignal | ReturnSignal | CancelSignal | ExitSignal;\n\nexport function isControlSignal(value: unknown): value is ControlSignal {\n return (\n value instanceof BreakSignal ||\n value instanceof ContinueSignal ||\n value instanceof ReturnSignal ||\n value instanceof CancelSignal ||\n value instanceof ExitSignal\n );\n}\n","import type { Engine } from \"./engine.types.js\";\nimport { ExitSignal } from \"./signals.js\";\n\n/**\n * Run `body`, letting an `exit` end it.\n *\n * The exit code travels on the engine rather than on the throw, so whatever\n * wraps this still finishes the way it always does: teardowns run, `run.finished`\n * is emitted, and the host reads one number off the result. Any other error keeps\n * unwinding untouched.\n */\nexport async function absorbExit(engine: Engine, body: () => Promise<void>): Promise<void> {\n try {\n await body();\n } catch (error) {\n if (!(error instanceof ExitSignal)) throw error;\n engine.exit = error.code;\n }\n}\n","import { type Document, isLetStmt, isUseDecl } from \"@venn-lang/core\";\nimport type { Registry } from \"../registry/index.js\";\n\n/**\n * The namespaces this file actually brought in with `use`: the alias when one\n * was given, otherwise the namespace the package contributes. A name outside\n * this set was never imported, however well the registry knows it.\n */\nexport function collectNamespaces(document: Document, registry: Registry): Set<string> {\n const names = new Set<string>();\n for (const decl of document.imports) {\n if (!isUseDecl(decl)) continue;\n const bound = decl.alias ?? registry.namespaceOf(decl.pkg);\n if (bound) names.add(bound);\n }\n return names;\n}\n\n/**\n * The names this file binds at the top level.\n *\n * `page.click()` reads like a namespace and a verb, and is neither: it is a\n * method on something the file holds. The registry has no schema for it, so it\n * is known here and verified nowhere, which beats reporting it as an unknown\n * action it plainly is not.\n */\nexport function collectBoundNames(document: Document): Set<string> {\n const names = new Set<string>();\n for (const decl of document.decls) {\n if (isLetStmt(decl)) names.add(decl.name);\n }\n return names;\n}\n\n/** `use \"venn/http\" as h` → `{ h → \"http\" }`, resolved through the registry. */\nexport function collectAliases(document: Document, registry: Registry): Map<string, string> {\n const aliases = new Map<string, string>();\n for (const decl of document.imports) {\n if (!isUseDecl(decl) || !decl.alias) continue;\n const namespace = registry.namespaceOf(decl.pkg);\n if (namespace) aliases.set(decl.alias, namespace);\n }\n return aliases;\n}\n","import {\n closureOfDecl,\n type Document,\n decorateCallable,\n evaluate,\n isFnDecl,\n isLetStmt,\n type LetStmt,\n} from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\n\n/**\n * Bind every top-level `fn` as a callable closure. Hoisted so a function can be\n * called before its textual position, and so functions may reference each other\n * regardless of order.\n *\n * A `deco` that asked to `wrap` one is honoured here, at the only moment the\n * function becomes a value: the name a caller reaches is already the decorated\n * one, so a middleware cannot be stepped around by calling from somewhere else.\n */\nexport function bindFunctions(doc: Document, scope: Scope): void {\n for (const decl of doc.decls) {\n if (isFnDecl(decl)) scope.set(decl.name, decorateCallable(decl, closureOfDecl(decl, scope)));\n }\n}\n\n/**\n * Bind top-level functions and the plain `const`/`let` globals every flow can\n * read without anything having run yet.\n *\n * Only pure values. One that calls a verb is a statement, and statements run in\n * the prologue, in order and once, before the flows: opening a database is\n * something a program *does*, not something a name quietly is.\n */\nexport function bindGlobals(doc: Document, scope: Scope): void {\n bindFunctions(doc, scope);\n bindPlainValues(doc, scope);\n}\n\n/**\n * The `const`/`let` globals, evaluated where they stand.\n *\n * Separate from the functions because the order matters across files: a function\n * is hoisted and reads its scope when it is *called*, while a value is read now,\n * so anything a value might depend on has to be in place first.\n */\nexport function bindPlainValues(doc: Document, scope: Scope): void {\n for (const decl of doc.decls) {\n if (isLetStmt(decl) && isPlainValue(decl)) scope.set(decl.name, evaluate(decl.value, scope));\n }\n}\n\nfunction isPlainValue(decl: LetStmt): boolean {\n return decl.args.length === 0 && !decl.opts;\n}\n","import {\n type Document,\n isFnDecl,\n isPackageSpecifier,\n isValueImport,\n type ValueImport,\n} from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport { bindFunctions, bindPlainValues } from \"./bind-globals.js\";\n\n/** The files an import graph reached, and how one file names another. */\nexport interface ImportGraph {\n modules: ReadonlyMap<string, Document>;\n resolve: (from: string, spec: string) => string;\n /** What each npm specifier loaded to, already a value. */\n npm?: ReadonlyMap<string, Record<string, unknown>>;\n}\n\n/**\n * Bind the names a document imported, each to the value its own module made.\n *\n * A `pub fn` is a closure over the file it was written in (it calls that file's\n * private helpers and reads that file's globals) so it cannot simply be lifted\n * into the importer's scope. Each module gets a scope of its own, built the same\n * way the entry document's is, and the importer takes only the names it asked\n * for out of it.\n *\n * Three passes over every module at once, not one walk per import: two files\n * that call each other are ordinary, and no single order resolves them. Filling\n * every scope first and wiring afterwards has no order to get wrong, because a\n * function captures the scope object and wiring mutates that same object.\n *\n * Call this before the document's own globals are bound, so a local name of the\n * same spelling wins. That is the rule fragments already follow.\n */\nexport function bindImports(args: {\n document: Document;\n uri: string;\n scope: Scope;\n graph: ImportGraph;\n /** How the scope a module is read in gets made: the same one the entry gets. */\n base: () => Scope;\n}): void {\n const built = new Map<string, Scope>();\n for (const [uri, module] of args.graph.modules) {\n const scope = args.base();\n built.set(uri, scope);\n bindFunctions(module, scope);\n }\n for (const [uri, module] of args.graph.modules) {\n wire({ document: module, uri, into: scopeAt(built, uri), graph: args.graph, built });\n }\n // Last, because a value is read where it stands: whatever it names, local\n // function or imported one, has to be in place by now.\n for (const [uri, module] of args.graph.modules) bindPlainValues(module, scopeAt(built, uri));\n wire({ document: args.document, uri: args.uri, into: args.scope, graph: args.graph, built });\n}\n\nfunction scopeAt(built: ReadonlyMap<string, Scope>, uri: string): Scope {\n return built.get(uri) as Scope;\n}\n\ninterface Wiring {\n document: Document;\n uri: string;\n into: Scope;\n graph: ImportGraph;\n built: ReadonlyMap<string, Scope>;\n}\n\nfunction wire(args: Wiring): void {\n for (const decl of args.document.imports) {\n if (!isValueImport(decl)) continue;\n if (isPackageSpecifier(decl.path)) {\n takePackage({ decl, graph: args.graph, into: args.into });\n continue;\n }\n const from = args.graph.resolve(args.uri, decl.path);\n const module = args.graph.modules.get(from);\n const source = args.built.get(from);\n if (module && source) take({ decl, module, source, into: args.into });\n }\n}\n\n/**\n * The names an installed package published.\n *\n * Everything it exports is fair game: a package has no `pub`, its exports *are*\n * what it made public, so unlike a `.vn` module there is nothing to filter\n * against. `default` is bound too, under whichever name the import gave it,\n * because that is the only name it has here.\n */\nfunction takePackage(args: { decl: ValueImport; graph: ImportGraph; into: Scope }): void {\n const module = args.graph.npm?.get(args.decl.path);\n if (!module) return;\n if (args.decl.wildcard) return void args.into.set(args.decl.wildcard, { ...module });\n if (args.decl.default) return void args.into.set(args.decl.default, module.default);\n for (const name of args.decl.names) {\n if (name in module) args.into.set(name, module[name]);\n }\n}\n\nfunction take(args: { decl: ValueImport; module: Document; source: Scope; into: Scope }): void {\n const exported = exportedFunctions(args.module);\n if (args.decl.wildcard) {\n args.into.set(args.decl.wildcard, gathered(exported, args.source));\n return;\n }\n // Only what the module offered. Reaching a private name would work here and\n // then stop working the day that file rearranges its own insides.\n for (const name of args.decl.names) {\n if (exported.has(name)) args.into.set(name, args.source.lookup(name));\n }\n}\n\n/** `import * as u`: one value holding everything the module published. */\nfunction gathered(names: ReadonlySet<string>, source: Scope): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const name of names) out[name] = source.lookup(name);\n return out;\n}\n\n/** The names a module made `pub` that are values a caller can hold. */\nfunction exportedFunctions(document: Document): Set<string> {\n const names = new Set<string>();\n for (const decl of document.decls) {\n if (isFnDecl(decl) && decl.export) names.add(decl.name);\n }\n return names;\n}\n","import type { Cell } from \"@venn-lang/core\";\nimport type { Scope } from \"./scope.types.js\";\n\n/**\n * A lexical scope.\n *\n * A class, not an object literal: a `forEach` over 50k items builds 50k scopes,\n * and a literal allocates a closure per method for each of them. One prototype\n * does for all.\n *\n * Bindings live in cells rather than as bare values, so a compiled function can\n * address one once and read it by index on every call after. The cell exists as\n * soon as anyone asks for it, which is what lets a recursive `fn` work: the\n * closure asks for its own name while being built, before the binding fills it.\n */\nclass MapScope implements Scope {\n private readonly vars = new Map<string, Cell>();\n\n constructor(private readonly parent?: Scope) {}\n\n lookup(name: string): unknown {\n // A cell always exists once asked for, so its presence answers whether this\n // scope binds the name. A binding legitimately holding `undefined` reads as\n // its own value rather than falling through to the parent.\n const found = this.vars.get(name);\n return found === undefined ? this.parent?.lookup(name) : found.value;\n }\n\n set(name: string, value: unknown): void {\n const own = this.vars.get(name);\n if (own) {\n own.value = value;\n return;\n }\n this.vars.set(name, { value });\n }\n\n /**\n * The cell holding `name`, taken from wherever in the chain already has one.\n *\n * A function reading a global must get the global's own cell, not a fresh\n * local one that the binding would never fill. Only a name nobody has bound\n * anywhere gets its cell here, where a later `set` will land.\n */\n cell(name: string): Cell {\n const own = this.vars.get(name);\n if (own) return own;\n const inherited = this.parent?.cell(name);\n if (inherited) return inherited;\n const made: Cell = { value: undefined };\n this.vars.set(name, made);\n return made;\n }\n\n child(): Scope {\n return new MapScope(this);\n }\n}\n\n/**\n * Create a scope; `lookup` falls back to the parent, `set` writes locally.\n *\n * @param parent The enclosing scope, or nothing for a root scope.\n */\nexport function createScope(parent?: Scope): Scope {\n return new MapScope(parent);\n}\n","import {\n type Document,\n evaluate,\n type FragmentDecl,\n isConfigDecl,\n isFragmentDecl,\n isLifecycleDecl,\n type LifecycleDecl,\n} from \"@venn-lang/core\";\nimport { createScope } from \"../scope/index.js\";\n\n/** Top-level lifecycle blocks, grouped by hook. */\nexport interface SuiteHooks {\n setup: LifecycleDecl[];\n teardown: LifecycleDecl[];\n beforeEach: LifecycleDecl[];\n afterEach: LifecycleDecl[];\n}\n\n/** Index the document's fragments by name for `run`. */\nexport function collectFragments(doc: Document): Map<string, FragmentDecl> {\n const map = new Map<string, FragmentDecl>();\n for (const decl of doc.decls) {\n if (isFragmentDecl(decl)) map.set(decl.name, decl);\n }\n return map;\n}\n\n/** Evaluate the top-level `config { … }` block with `env` bound, for the action context. */\nexport function collectConfig(\n doc: Document,\n env: Record<string, unknown>,\n): Record<string, unknown> {\n const decl = doc.decls.find(isConfigDecl);\n if (!decl) return {};\n const scope = createScope();\n scope.set(\"env\", env);\n return evaluate(decl.body, scope) as Record<string, unknown>;\n}\n\n/** Gather top-level setup/teardown/beforeEach/afterEach blocks. */\nexport function collectHooks(doc: Document): SuiteHooks {\n const hooks: SuiteHooks = { setup: [], teardown: [], beforeEach: [], afterEach: [] };\n for (const decl of doc.decls) {\n if (isLifecycleDecl(decl)) addHook(hooks, decl);\n }\n return hooks;\n}\n\n/** Gather the `on <event> { … }` handlers a flow declared, for one event. */\nexport function collectOn(stmts: readonly unknown[], event: string): LifecycleDecl[] {\n return stmts.filter(\n (stmt): stmt is LifecycleDecl => isLifecycleDecl(stmt) && stmt.event === event,\n );\n}\n\nfunction addHook(hooks: SuiteHooks, decl: LifecycleDecl): void {\n const bucket = hooks[decl.hook as keyof SuiteHooks];\n if (bucket) bucket.push(decl);\n}\n","import type { Cleanup, CleanupList } from \"./cleanup.types.js\";\n\n/**\n * The runtime's own sink, for a host that does not bring one.\n *\n * Closing runs newest first and survives a cleanup that throws: a program on its\n * way out still has to hand back everything else it was holding.\n */\nexport function createCleanupList(): CleanupList {\n const pending: Cleanup[] = [];\n return {\n add: (cleanup) => pending.push(cleanup),\n close: async () => {\n for (const cleanup of pending.splice(0).reverse()) await cleanup().catch(() => {});\n },\n };\n}\n","/** A title matches when the needle is absent, or contained case-insensitively. */\nexport function matchesTitle(title: string, needle: string | undefined): boolean {\n if (!needle) return true;\n return title.toLowerCase().includes(needle.toLowerCase());\n}\n","import {\n type AstNode,\n type Call,\n type Expr,\n isCall,\n isMember,\n isRef,\n type LetStmt,\n type MapLit,\n} from \"@venn-lang/core\";\n\n/** What running an action needs, whichever syntax spelled it. */\nexport interface Invocation {\n target: string;\n args: readonly Expr[];\n opts?: MapLit;\n /**\n * Where the call is written, for a failure with no smaller node to point at.\n * Absent when the invocation *is* the node: a call spelled as a statement.\n */\n node?: AstNode;\n}\n\n/**\n * The dotted path an expression spells, such as `http.post`, or undefined when\n * it is not a plain path. The parser cannot tell a namespace from a field; only\n * the registry can, so the path is carried this far as an expression.\n */\nexport function actionTarget(expr: Expr | undefined): string | undefined {\n if (!expr) return undefined;\n if (isRef(expr)) return expr.name;\n if (!isMember(expr) || expr.optional) return undefined;\n const receiver = actionTarget(expr.receiver);\n return receiver === undefined ? undefined : `${receiver}.${expr.member}`;\n}\n\n/**\n * The bareword action a `let` spells: `let auth = http.post url { … }`. The\n * trailing arguments or options map are what mark it as a call. A parenthesised\n * call (`f(x)`) is an ordinary expression the evaluator runs, since it may be a\n * `fn` or a method rather than an action; only {@link actionCall} rescues the\n * case where it turns out to name a plugin action.\n */\nexport function invocationOf(stmt: LetStmt): Invocation | undefined {\n return remember(invocations, stmt, readInvocation);\n}\n\nfunction readInvocation(stmt: LetStmt): Invocation | undefined {\n if (stmt.args.length === 0 && !stmt.opts) return undefined;\n const target = actionTarget(stmt.value);\n if (target === undefined) return undefined;\n return { target, args: stmt.args, opts: stmt.opts, node: stmt };\n}\n\n/**\n * An action written in expression position: the bare path `data.faker.uuid`, or\n * the parenthesised `data.faker.uuid()`. Returns the target and its arguments,\n * or undefined when it is not a dotted path at all.\n */\nexport function actionCall(value: Expr): ActionShape | undefined {\n return remember(calls, value, readActionCall);\n}\n\nfunction readActionCall(value: Expr): ActionShape | undefined {\n const bare = actionTarget(value);\n if (bare !== undefined) return { target: bare, args: [] };\n if (!isCall(value)) return undefined;\n const target = actionTarget(value.callee);\n return target === undefined ? undefined : { target, args: argValues(value) };\n}\n\n/** An action in expression position: the path it names and its arguments. */\nexport interface ActionShape {\n target: string;\n args: readonly Expr[];\n}\n\n/**\n * What a node spells, worked out once.\n *\n * The shape of the tree decides whether `let y = x * 2` names an action, and the\n * tree does not change, so the answer is cached per node rather than rewalked\n * through the type guards on every execution. Whether the *name* resolves to an\n * action depends on the scope and the registry, so that part is not cached.\n */\nconst invocations = new WeakMap<LetStmt, Invocation | null>();\nconst calls = new WeakMap<Expr, ActionShape | null>();\n\nfunction remember<K extends object, V>(\n cache: WeakMap<K, V | null>,\n key: K,\n read: (key: K) => V | undefined,\n): V | undefined {\n const known = cache.get(key);\n if (known !== undefined) return known ?? undefined;\n const found = read(key) ?? null;\n cache.set(key, found);\n return found ?? undefined;\n}\n\nfunction argValues(call: Call): Expr[] {\n return (call.args?.args ?? []).map((arg) => arg.value);\n}\n","import type { Span } from \"@venn-lang/core\";\n\n/** Minimal structural view of a Langium CST node (avoids importing langium). */\ninterface CstView {\n offset?: number;\n length?: number;\n text?: string;\n range?: { start?: { line?: number; character?: number } };\n}\ninterface WithCst {\n $cstNode?: CstView;\n}\n\n/** The exact source text of an AST node, for the event stream. */\nexport function nodeSource(node: WithCst): string {\n return node.$cstNode?.text ?? \"\";\n}\n\n/** A Span for an AST node, for a runtime Problem. */\nexport function nodeSpan(node: WithCst, uri: string): Span {\n const cst = node.$cstNode;\n return {\n uri,\n offset: cst?.offset ?? 0,\n length: cst?.length ?? 0,\n line: (cst?.range?.start?.line ?? 0) + 1,\n column: (cst?.range?.start?.character ?? 0) + 1,\n };\n}\n","import { type Annotation, readMeta } from \"@venn-lang/core\";\n\n/** Any AST node that carries decorators (`@tags`, `@timeout`, `@retry`…). */\nexport interface Annotated {\n annotations: Annotation[];\n}\n\n/** A parsed `@retry(n, { backoff, factor })` specification. */\nexport interface RetrySpec {\n attempts: number;\n backoffMs: number;\n factor: number;\n}\n\n/**\n * Whether a decorator set this flag on the node.\n *\n * The scheduler reads what expansion concluded, never the annotation list\n * itself, so a decorator is understood in exactly one place.\n */\nexport function hasAnnotation(node: Annotated, name: string): boolean {\n return readMeta<boolean>(node, name) === true;\n}\n\n/** `@timeout(90s)` → milliseconds, or undefined. */\nexport function readTimeout(node: Annotated): number | undefined {\n return readMeta<number>(node, \"timeout\");\n}\n\n/** `@retry(2, { backoff: 500ms, factor: 2 })` → a retry spec, or undefined. */\nexport function readRetry(node: Annotated): RetrySpec | undefined {\n return readMeta<RetrySpec>(node, \"retry\");\n}\n\n/** `@lock(\"orders\")` → the lock name, or undefined. */\nexport function readLock(node: Annotated): string | undefined {\n return readMeta<string>(node, \"lock\");\n}\n\n/** `@flaky(0.05)` → the tolerated failure ratio; bare `@flaky` tolerates all. */\nexport function readFlaky(node: Annotated): number | undefined {\n return readMeta<number>(node, \"flaky\");\n}\n\n/** `@tags(smoke, critical)` → the tag names. */\nexport function readTags(node: Annotated): string[] {\n return readMeta<string[]>(node, \"tags\") ?? [];\n}\n","import { namespaceValue, nativeFn } from \"@venn-lang/core\";\nimport type { ActionContext, ActionDefinition } from \"@venn-lang/sdk\";\nimport type { Registry } from \"../registry/index.js\";\nimport type { Scope } from \"../scope/index.js\";\n\n/**\n * Put every plugin namespace in the root scope as a value, so its verbs work\n * inside any expression (`print(fmt.table(rows))`, `\"${crypto.hash(x)}\"`) and\n * not only as a bare statement.\n *\n * A verb reached this way runs synchronously: it is the pure corner of the\n * stdlib (`fmt`, `data`, `crypto`). An action that does I/O returns its promise,\n * so those stay written as statements, where the runtime awaits them.\n */\nexport function bindNamespaces(args: {\n registry: Registry;\n ctx: ActionContext;\n scope: Scope;\n}): void {\n const byNamespace = new Map<string, Record<string, unknown>>();\n for (const entry of args.registry.actions()) {\n const members = byNamespace.get(entry.namespace) ?? {};\n place({ members, path: entry.name, action: entry.action, ctx: args.ctx });\n byNamespace.set(entry.namespace, members);\n }\n for (const [namespace, members] of byNamespace) {\n args.scope.set(namespace, namespaceValue(members));\n }\n}\n\n/** `jwt.decode` nests: `{ jwt: { decode: fn } }`, so the dotted call reads naturally. */\nfunction place(args: {\n members: Record<string, unknown>;\n path: string;\n action: ActionDefinition;\n ctx: ActionContext;\n}): void {\n const parts = args.path.split(\".\");\n const leaf = parts.pop();\n if (!leaf) return;\n let level = args.members;\n for (const part of parts) {\n level[part] = (level[part] as Record<string, unknown>) ?? {};\n level = level[part] as Record<string, unknown>;\n }\n level[leaf] = verb(args.action, args.ctx);\n}\n\nfunction verb(action: ActionDefinition, ctx: ActionContext): unknown {\n return nativeFn((values) => action.run(ctx, { args: values, params: params(action) }));\n}\n\n/** No options map in expression position, so let the schema supply its defaults. */\nfunction params(action: ActionDefinition): unknown {\n if (!action.params) return {};\n try {\n return action.params.parse({});\n } catch {\n return {};\n }\n}\n","import { PRELUDE_VALUES } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\n\n/**\n * Put the pure prelude values (`len`, `range`, `pretty`, `str`, `min`…) in the\n * root scope. Being values rather than verbs is what lets them appear in any\n * expression: `xs.take(len(ys))`, `\"${pretty(user)}\"`.\n */\nexport function bindPrelude(scope: Scope): void {\n for (const [name, value] of Object.entries(PRELUDE_VALUES)) scope.set(name, value);\n}\n","import { createScope, type Scope } from \"../scope/index.js\";\nimport { bindNamespaces } from \"./bind-namespaces.js\";\nimport { bindPrelude } from \"./bind-prelude.js\";\nimport type { Engine } from \"./engine.types.js\";\n\n/**\n * What every scope in a run starts as: the prelude, the plugin namespaces and\n * `env`, plus the matrix variant when there is one.\n *\n * One place, shared by test runs and program runs, so `venn test` and `venn run`\n * cannot drift apart. Every scope a module is read in starts here too, which is\n * what makes an imported function see the same world its own file did.\n */\nexport function createBaseScope(args: {\n engine: Engine;\n /** The `matrix` variant, for a test run. A program has none. */\n variant?: Record<string, unknown>;\n}): Scope {\n const scope = createScope();\n bindPrelude(scope);\n bindNamespaces({ registry: args.engine.registry, ctx: args.engine.ctx, scope });\n scope.set(\"env\", args.engine.env);\n if (args.variant) scope.set(\"matrix\", args.variant);\n return scope;\n}\n","import { type Annotated, readFlaky } from \"./annotations.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport type { FlakyTally } from \"./flaky.types.js\";\n\n/** Record one execution of a `@flaky(ratio)` node, and how much it failed by. */\nexport function recordFlaky(engine: Engine, node: Annotated, before: number): void {\n const ratio = readFlaky(node);\n if (ratio === undefined) return;\n const tally = engine.flaky.get(node) ?? { ratio, runs: 0, failedRuns: 0, failedUnits: 0 };\n const delta = engine.result.failed - before;\n tally.runs += 1;\n tally.failedRuns += delta > 0 ? 1 : 0;\n tally.failedUnits += delta > 0 ? delta : 0;\n engine.flaky.set(node, tally);\n}\n\n/**\n * Forgive the failures of every `@flaky` node whose observed failure ratio\n * stayed within its declared tolerance. Settled once, so the verdict does not\n * depend on the order iterations happened to fail in.\n */\nexport function settleFlaky(engine: Engine): void {\n for (const tally of engine.flaky.values()) {\n if (tally.failedRuns === 0 || tally.failedRuns / tally.runs > tally.ratio) continue;\n engine.result.failed = Math.max(0, engine.result.failed - tally.failedUnits);\n engine.emitter.emit({ kind: \"log\", data: { level: \"warn\", message: message(tally) } });\n }\n}\n\nfunction message(tally: FlakyTally): string {\n return `flaky tolerated: ${tally.failedRuns}/${tally.runs} runs failed, within ratio ${tally.ratio}`;\n}\n","import { invoke, readDecorations } from \"@venn-lang/core\";\n\n/**\n * Run the `.before` and `.after` closures a `deco` left on a flow or a step.\n *\n * The language has no syntax for \"around this body\", so the verbs leave a fact\n * behind and this is where it is honoured. `.after` runs from a `finally`,\n * because a hook that only runs when nothing went wrong is the one case it was\n * written for.\n */\nexport async function runAround(node: object, body: () => unknown): Promise<void> {\n const around = readDecorations(node);\n if (!around) {\n await body();\n return;\n }\n for (const fn of around.before) invoke(fn, []);\n try {\n await body();\n } finally {\n for (const fn of around.after) invoke(fn, []);\n }\n}\n","import { VennError } from \"@venn-lang/contracts\";\nimport type { Annotation } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport { type RetrySpec, readRetry, readTimeout } from \"./annotations.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { isControlSignal } from \"./signals.js\";\n\ninterface AnnotatedNode {\n annotations: Annotation[];\n}\n\n/** Run a step/flow body applying its `@timeout` and `@retry` annotations. */\nexport async function runWithAnnotations(args: {\n engine: Engine;\n node: AnnotatedNode;\n scope: Scope;\n title: string;\n run: () => Promise<void>;\n}): Promise<void> {\n const timeout = readTimeout(args.node);\n const retry = readRetry(args.node);\n const attempt = (): Promise<void> => withTimeout(timeout, args.run);\n if (!retry || retry.attempts === 0) return attempt();\n await withRetry({ engine: args.engine, retry, title: args.title, run: attempt });\n}\n\n/** Hold the named mutex (`@lock`/`@serial`) around `run`, releasing on exit. */\nexport async function withLock(\n engine: Engine,\n name: string | undefined,\n run: () => Promise<void>,\n): Promise<void> {\n if (!name) return run();\n const release = await engine.lock.acquire(name);\n try {\n await run();\n } finally {\n release();\n }\n}\n\nasync function withTimeout(timeoutMs: number | undefined, run: () => Promise<void>): Promise<void> {\n if (timeoutMs === undefined) return run();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const guard = new Promise<never>((_resolve, reject) => {\n timer = setTimeout(() => reject(timeoutError(timeoutMs)), timeoutMs);\n });\n try {\n await Promise.race([run(), guard]);\n } finally {\n if (timer) clearTimeout(timer);\n }\n}\n\nasync function withRetry(args: {\n engine: Engine;\n retry: RetrySpec;\n title: string;\n run: () => Promise<void>;\n}): Promise<void> {\n const total = args.retry.attempts + 1;\n for (let i = 1; i <= total; i++) {\n const snapshot = { ...args.engine.result };\n const outcome = await attempt(args.engine, args.run);\n if (outcome.ok) return;\n if (i >= total) {\n if (outcome.error) throw outcome.error;\n return;\n }\n Object.assign(args.engine.result, snapshot);\n emitRetrying({ engine: args.engine, title: args.title, attempt: i });\n await args.engine.clock.sleep(backoff(args.retry, i));\n }\n}\n\ninterface AttemptOutcome {\n ok: boolean;\n error?: unknown;\n}\n\nasync function attempt(engine: Engine, run: () => Promise<void>): Promise<AttemptOutcome> {\n const before = engine.result.failed;\n try {\n await run();\n return { ok: engine.result.failed === before };\n } catch (error) {\n if (isControlSignal(error)) throw error;\n return { ok: false, error };\n }\n}\n\nfunction emitRetrying(args: { engine: Engine; title: string; attempt: number }): void {\n args.engine.emitter.emit({\n kind: \"flow.retrying\",\n data: { title: args.title, attempt: args.attempt, reason: \"previous attempt failed\" },\n });\n}\n\nfunction backoff(retry: RetrySpec, attempt: number): number {\n return retry.backoffMs * retry.factor ** (attempt - 1);\n}\n\nfunction timeoutError(ms: number): VennError {\n return new VennError({ code: \"VN8001\", message: `Timed out after ${ms}ms.` });\n}\n","import { buildProblem, CODES, type MapEntry, type MapLit, type Problem } from \"@venn-lang/core\";\nimport { type ParamSpec, paramSpecs } from \"@venn-lang/sdk\";\nimport { nodeSpan } from \"./node-span.js\";\n\n/**\n * The keys an options map spells that the schema behind it never declared,\n * whether that schema is an action's or a matcher's.\n *\n * One list, two readers: the checker squiggles them before anything runs, the\n * runtime refuses them when the line executes. Same code, same words, so a typo\n * cannot read one way in the editor and another in the terminal.\n *\n * A schema that declares no keys accepts a free-form map, and nothing there is\n * unknown: `grpc.request` takes a `z.record`, `db.seed` takes no schema at all\n * and reads the whole map as table names.\n */\nexport function unknownOptions(args: {\n opts: MapLit | undefined;\n params: unknown;\n uri: string;\n}): Problem[] {\n const specs = paramSpecs(args.params as never);\n if (!args.opts || specs.length === 0 || welcomesMore(args.params)) return [];\n const known = new Set(specs.map((spec) => spec.name));\n return args.opts.entries\n .filter((entry) => !known.has(entry.key))\n .map((entry) => unknownOption({ entry, specs, uri: args.uri }));\n}\n\n/**\n * A schema written with a catchall (`z.looseObject`, `.catchall(…)`) names some\n * keys and takes the rest as well. A key it never named is still a key it asked\n * to receive, so there is nothing to report. Read structurally, past the\n * wrappers `.optional()` and `.default()` add, the way {@link paramSpecs} reads\n * the shape.\n */\nfunction welcomesMore(params: unknown): boolean {\n const def = (params as { def?: { catchall?: unknown; innerType?: unknown } } | undefined)?.def;\n if (def?.catchall !== undefined) return true;\n return def?.innerType !== undefined && welcomesMore(def.innerType);\n}\n\nfunction unknownOption(args: {\n entry: MapEntry;\n specs: readonly ParamSpec[];\n uri: string;\n}): Problem {\n const { key } = args.entry;\n const hint = nearest(key, args.specs);\n const accepted = args.specs.map((spec) => spec.name).join(\", \");\n const title = hint\n ? `\"${key}\" is not an option here — did you mean \"${hint}\"?`\n : `\"${key}\" is not an option here. Accepted: ${accepted}.`;\n return buildProblem({\n spec: CODES.VN3001_UNKNOWN_OPTION,\n span: nodeSpan(args.entry, args.uri),\n title,\n });\n}\n\n/** The closest accepted key, when one is close enough to be worth suggesting. */\nfunction nearest(key: string, specs: readonly ParamSpec[]): string | undefined {\n const scored = specs\n .map((spec) => ({ name: spec.name, distance: distance(key, spec.name) }))\n .sort((left, right) => left.distance - right.distance)[0];\n return scored && scored.distance <= Math.max(2, Math.floor(key.length / 2))\n ? scored.name\n : undefined;\n}\n\n/** Levenshtein, small enough to keep here and precise enough for a \"did you mean\". */\nfunction distance(left: string, right: string): number {\n let previous = Array.from({ length: right.length + 1 }, (_value, index) => index);\n for (let i = 1; i <= left.length; i += 1) {\n const current = [i];\n for (let j = 1; j <= right.length; j += 1) {\n const cost = left[i - 1] === right[j - 1] ? 0 : 1;\n current[j] = Math.min(\n (current[j - 1] ?? 0) + 1,\n (previous[j] ?? 0) + 1,\n (previous[j - 1] ?? 0) + cost,\n );\n }\n previous = current;\n }\n return previous[right.length] ?? 0;\n}\n","import {\n type AstNode,\n buildProblem,\n CODES,\n display,\n type MapEntry,\n type MapLit,\n type Problem,\n ProblemError,\n typeName,\n} from \"@venn-lang/core\";\nimport type { ZodType } from \"@venn-lang/sdk\";\nimport { nodeSpan } from \"./node-span.js\";\nimport { unknownOptions } from \"./unknown-option.js\";\n\n/** The bits of a Zod failure this reads. Structural, so no Zod internals leak out. */\ninterface Issue {\n code?: string;\n path?: readonly PropertyKey[];\n expected?: string;\n values?: readonly unknown[];\n}\n\n/** Zod's word for a type, in the word the language uses for it. */\nconst WORDS: Record<string, string> = {\n object: \"map\",\n record: \"map\",\n array: \"list\",\n boolean: \"bool\",\n int: \"number\",\n bigint: \"number\",\n};\n\n/**\n * The options map of a call, an action's or a matcher's, validated before the\n * thing it belongs to ever sees it.\n *\n * Unknown keys are refused rather than stripped, because `z.object` drops them\n * in silence and `crypto.hash \"x\" { algorithmm: \"sha512\" }` would then hash with\n * the default. A rejected value becomes a `Problem` rather than escaping as a\n * ZodError, whose `message` is a JSON dump of issues.\n *\n * @param args.site Where the call is written, for a failure with no smaller node\n * to point at: a required option nobody typed leaves nothing to underline.\n * @returns The parsed options.\n * @throws ProblemError `VN3010` when a key is unknown or a value is rejected.\n */\nexport function callParams(args: {\n schema: ZodType | undefined;\n opts: MapLit | undefined;\n raw: unknown;\n site: AstNode;\n uri: string;\n}): unknown {\n const { schema, opts, raw, site, uri } = args;\n if (!schema) return raw;\n const unknown = unknownOptions({ opts, params: schema, uri });\n if (unknown[0]) throw new ProblemError(unknown[0]);\n return parsed({ schema, opts, raw, site, uri });\n}\n\n/** Parse, and turn a rejection into a sentence about the option that failed. */\nfunction parsed(args: {\n schema: ZodType;\n opts: MapLit | undefined;\n raw: unknown;\n site: AstNode;\n uri: string;\n}): unknown {\n try {\n return args.schema.parse(args.raw);\n } catch (error) {\n const issue = firstIssue(error);\n // Not a schema rejection: a transform threw, and it already says why.\n if (!issue) throw error;\n const { raw, opts, site, uri } = args;\n throw new ProblemError(badOption({ issue, raw, opts, site, uri }));\n }\n}\n\nfunction badOption(args: {\n issue: Issue;\n raw: unknown;\n opts: MapLit | undefined;\n site: AstNode;\n uri: string;\n}): Problem {\n const path = args.issue.path ?? [];\n return buildProblem({\n spec: CODES.VN3010_TYPE_MISMATCH,\n // The entry that failed, else the map; a required option nobody wrote has\n // neither, and then the call itself is the nearest true place.\n span: nodeSpan(entryFor(args.opts, path) ?? args.opts ?? args.site, args.uri),\n title: title({ key: path.join(\".\"), issue: args.issue, value: valueAt(args.raw, path) }),\n });\n}\n\n/**\n * One line, naming the option and what it wanted. Only the shapes worth\n * modelling get their own sentence; anything else says so plainly rather than\n * dressing up an issue it does not understand.\n */\nfunction title(args: { key: string; issue: Issue; value: unknown }): string {\n const { key, issue, value } = args;\n if (!key) return \"These options are not valid here.\";\n if (issue.code === \"invalid_value\" && issue.values) return oneOf(key, issue.values, value);\n if (issue.code !== \"invalid_type\" || !issue.expected) return `\"${key}\" is not a valid option.`;\n const needs = WORDS[issue.expected] ?? issue.expected;\n if (value === undefined) return `\"${key}\" is required here, and it takes a ${needs}.`;\n return `\"${key}\" needs a ${needs}, and ${shown(value)} is a ${typeName(value)}.`;\n}\n\n/** `{ algorithm: \"sha5\" }` against a schema that lists the digests it knows. */\nfunction oneOf(key: string, values: readonly unknown[], value: unknown): string {\n const accepted = values.map((option) => shown(option)).join(\", \");\n return `\"${key}\" must be one of ${accepted} — not ${shown(value)}.`;\n}\n\n/** A value as a message shows it: strings quoted, so `\"soon\"` reads as text. */\nfunction shown(value: unknown): string {\n return typeof value === \"string\" ? JSON.stringify(value) : display(value);\n}\n\nfunction valueAt(raw: unknown, path: readonly PropertyKey[]): unknown {\n let value = raw;\n for (const key of path) value = (value as Record<PropertyKey, unknown> | undefined)?.[key];\n return value;\n}\n\n/** The written entry to underline, when the failure names a key this map spells. */\nfunction entryFor(opts: MapLit | undefined, path: readonly PropertyKey[]): MapEntry | undefined {\n const key = String(path[0] ?? \"\");\n return opts?.entries.find((entry) => entry.key === key);\n}\n\n/** Zod's failure, read structurally: the runtime does not depend on zod itself. */\nfunction firstIssue(error: unknown): Issue | undefined {\n const issues = (error as { issues?: unknown } | undefined)?.issues;\n return Array.isArray(issues) ? (issues[0] as Issue) : undefined;\n}\n","import type { ActionDefinition } from \"@venn-lang/sdk\";\n\n/**\n * How many positional arguments a verb declared.\n *\n * Used to tell an argument that happens to be a map from the options map that\n * configures the call. A variadic verb such as `data.oneOf a b c` takes every\n * argument it is given, so nothing is left over to mistake for configuration.\n */\nexport function takes(action: ActionDefinition): number {\n if (action.args?.some((each) => each.rest)) return Number.POSITIVE_INFINITY;\n return action.args?.length ?? action.signature?.params.length ?? 0;\n}\n","import { isCallable, isNamespaceValue, memberValue } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\n\n/**\n * What a dotted statement target names, when it names something in scope.\n *\n * `conn.close()` and `http.get \"url\"` are written alike and mean different\n * things: one is a method on a value the program holds, the other a verb a\n * plugin contributes. Only the name can tell them apart, and a name the program\n * bound wins. That is the rule the evaluator already follows for `auth` the\n * variable against `auth` the namespace.\n *\n * Returns undefined whenever this is not that: no such name, a namespace, or a\n * path that leads somewhere uncallable. The caller then treats it as a verb,\n * and an unknown verb reports itself as it always did.\n */\nexport function localCallee(target: string, scope: Scope): unknown {\n const segments = target.split(\".\");\n const head = segments[0];\n if (!head) return undefined;\n const root = scope.lookup(head);\n if (root === undefined || isNamespaceValue(root)) return undefined;\n let value: unknown = root;\n for (let at = 1; at < segments.length; at += 1) {\n value = memberValue(value, segments[at] as string);\n }\n return isCallable(value) ? value : undefined;\n}\n","/**\n * Whether evaluating an expression produced something still running.\n *\n * Expressions compile synchronously, so a plugin verb called from inside one\n * hands back the promise it is running on rather than its result. Statement\n * position is already asynchronous, so it can wait, and `let id = newId()` binds\n * the id instead of `[object Promise]`.\n *\n * Callers branch on this rather than awaiting unconditionally: `await` on a\n * value that is not a promise still costs a turn of the event loop, and a\n * `forEach` over 50k items reads one expression per iteration.\n */\nexport function isPending(value: unknown): value is Promise<unknown> {\n return value instanceof Promise;\n}\n\n/** Wait for a value only if there is something to wait for. */\nexport async function settle<T>(value: T | Promise<T>): Promise<T> {\n return isPending(value) ? ((await value) as T) : (value as T);\n}\n","/**\n * Prelude verbs, callable without `use` (§12). `print` writes to the console,\n * `log` records into the event stream (what a reporter and a test see), and the\n * rest steer the run. Pure prelude *values* (`len`, `range`, `pretty`…) are not\n * here: they live in the root scope, so they work in any expression.\n */\nexport const PRELUDE: ReadonlySet<string> = new Set([\n \"print\",\n \"log\",\n \"wait\",\n \"skip\",\n \"fail\",\n \"exit\",\n]);\n\n/** Split an action target `namespace.action` into parts (no dot ⇒ namespace only). */\nexport function splitTarget(target: string): { namespace: string; name: string } {\n const dot = target.indexOf(\".\");\n if (dot < 0) return { namespace: target, name: \"\" };\n return { namespace: target.slice(0, dot), name: target.slice(dot + 1) };\n}\n\n/** Split a target, mapping a `use \"…\" as h` alias back to its real namespace. */\nexport function resolveTarget(\n target: string,\n aliases: ReadonlyMap<string, string>,\n): { namespace: string; name: string } {\n const { namespace, name } = splitTarget(target);\n return { namespace: aliases.get(namespace) ?? namespace, name };\n}\n","import { ConsolePort, VennError } from \"@venn-lang/contracts\";\nimport {\n type ActionCall,\n type AstNode,\n callArgs,\n display,\n evaluate,\n invoke,\n splitCall,\n} from \"@venn-lang/core\";\nimport type { ActionDefinition, ActionInput } from \"@venn-lang/sdk\";\nimport type { Scope } from \"../scope/index.js\";\nimport { callParams } from \"./call-params.js\";\nimport { takes } from \"./declared-arity.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport type { Invocation } from \"./invocation.js\";\nimport { localCallee } from \"./local-call.js\";\nimport { settle } from \"./settled.js\";\nimport { ExitSignal } from \"./signals.js\";\nimport { PRELUDE, resolveTarget } from \"./target.js\";\n\n/**\n * Resolve, invoke and time an action call.\n *\n * @returns Whatever the action produced. The caller names it: there is no\n * implicit `res` for a reader to know about.\n * @throws VennError `VN2003` when no plugin provides the target.\n */\nexport async function runAction(engine: Engine, call: Invocation, scope: Scope): Promise<unknown> {\n if (PRELUDE.has(call.target)) return runPrelude(engine, call, scope);\n // `conn.close()` is a method on something the program holds. A name it bound\n // beats a namespace of the same name, so this is asked first.\n const callee = localCallee(call.target, scope);\n if (callee !== undefined) return callMethod(callee, call, scope);\n const { namespace, name } = resolveTarget(call.target, engine.aliases);\n const resolved = engine.registry.action({ namespace, name });\n if (!resolved) throw unknownAction(call.target);\n engine.emitter.emit({ kind: \"action.started\", data: { namespace, action: name } });\n const start = engine.clock.now();\n const value = await resolved.action.run(\n engine.ctx,\n await buildInput({ action: resolved.action, call, scope, uri: engine.uri }),\n );\n const durationMs = engine.clock.now() - start;\n engine.emitter.emit({\n kind: \"action.finished\",\n data: { namespace, action: name, status: \"passed\", durationMs },\n });\n return value;\n}\n\n/** Call a value the program holds, and wait for it as any other call is waited for. */\nasync function callMethod(callee: unknown, call: Invocation, scope: Scope): Promise<unknown> {\n const values = await Promise.all(call.args.map((expr) => settle(evaluate(expr, scope))));\n return settle(invoke(callee, values));\n}\n\n/**\n * An action written as a bare statement: run it, drop what it returned.\n *\n * The arguments are normalised here because the two spellings, `conn.close()`\n * and `http.get \"url\"`, put them in different places on the node.\n */\nexport async function runActionStatement(\n engine: Engine,\n call: ActionCall,\n scope: Scope,\n): Promise<void> {\n await runAction(engine, { ...call, args: callArgs(call) }, scope);\n}\n\nasync function buildInput(args: {\n action: ActionDefinition;\n call: Invocation;\n scope: Scope;\n uri: string;\n}): Promise<ActionInput<unknown>> {\n // The trailing `{ … }` is the options in both spellings, but only the bareword\n // one puts it where the parser can label it. Splitting by declared arity is\n // what stops `http.get(url, { headers })` sending no headers at all.\n const split = splitCall(args.call.args, takes(args.action));\n const opts = args.call.opts ?? split.opts;\n const positional = await Promise.all(\n split.args.map((expr) => settle(evaluate(expr, args.scope))),\n );\n const raw = await settle(opts ? evaluate(opts, args.scope) : {});\n const schema = args.action.params;\n const site = siteOf(args.call);\n return {\n args: positional,\n params: callParams({ schema, opts, raw, site, uri: args.uri }),\n };\n}\n\n/**\n * Where the call is written. A call spelled as a statement is its own node; one\n * rescued out of a `let` carries the statement that spells it, since the\n * invocation itself is a plain object with no place in the source.\n */\nfunction siteOf(call: Invocation): AstNode {\n return call.node ?? (call as unknown as AstNode);\n}\n\nfunction unknownAction(target: string): VennError {\n return new VennError({\n code: \"VN2003\",\n message: `Unknown action \"${target}\".`,\n detail: { target },\n });\n}\n\n/** Prelude verbs, available without `use` (§12): print, log, wait, skip, fail, exit. */\nasync function runPrelude(engine: Engine, call: Invocation, scope: Scope): Promise<void> {\n const args = await Promise.all(call.args.map((arg) => settle(evaluate(arg, scope))));\n if (call.target === \"print\") return printLine(engine, args);\n if (call.target === \"log\") return logLine(engine, args);\n const message = String(args[0] ?? \"\");\n if (call.target === \"wait\") await engine.clock.sleep(waitMs(args[0]));\n else if (call.target === \"skip\") skipLog(engine, message);\n else if (call.target === \"exit\") throw new ExitSignal(exitCode(args[0]));\n else if (call.target === \"fail\") throw failError(message);\n}\n\n/**\n * `print x y`: the program's own output, on standard output. Distinct from\n * `log`, which records into the event stream a reporter reads.\n */\nfunction printLine(engine: Engine, args: readonly unknown[]): void {\n engine.ctx.port(ConsolePort).write(`${line(args)}\\n`);\n}\n\n/** `log a b c`: every argument, spaced, objects shown as JSON not `[object Object]`. */\nfunction logLine(engine: Engine, args: readonly unknown[]): void {\n engine.emitter.emit({ kind: \"log\", data: { level: \"info\", message: line(args) } });\n}\n\nfunction line(args: readonly unknown[]): string {\n return args.map(display).join(\" \");\n}\n\n/**\n * The code `exit` leaves with. Anything the machine cannot use as one still\n * ended badly, so `exit \"boom\"` leaves with 1 and never with 0, which would read\n * as success to whatever is waiting on this process.\n */\nfunction exitCode(value: unknown): number {\n const code = Math.trunc(Number(value ?? 0));\n return Number.isFinite(code) ? code : 1;\n}\n\nfunction skipLog(engine: Engine, message: string): void {\n engine.emitter.emit({ kind: \"log\", data: { level: \"warn\", message: `skipped: ${message}` } });\n}\n\nfunction waitMs(value: unknown): number {\n if (typeof value === \"number\") return value;\n const duration = value as { kind?: string; ms?: number };\n return duration?.kind === \"duration\" ? (duration.ms ?? 0) : 0;\n}\n\nfunction failError(message: string): VennError {\n return new VennError({ code: \"VN6002\", message: message || \"fail\" });\n}\n","import {\n type CaptureStmt,\n evaluate,\n isNamespaceValue,\n type LetStmt,\n type ReturnStmt,\n} from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { actionCall, type Invocation, invocationOf } from \"./invocation.js\";\nimport type { Pending } from \"./pending.types.js\";\nimport { runAction } from \"./run-action.js\";\nimport { isPending } from \"./settled.js\";\nimport { ReturnSignal } from \"./signals.js\";\nimport { resolveTarget } from \"./target.js\";\n\n/**\n * `let plan = \"pro\"` binds a value; `let auth = http.post url { … }` binds what\n * the action returned. Naming the result is what makes it readable: there is no\n * implicit variable to know about.\n */\nexport function runLet(engine: Engine, stmt: LetStmt, scope: Scope): Pending {\n const call = invocationOf(stmt) ?? impliedCall(engine, stmt, scope);\n // Only a call suspends. Binding a plain expression is the common case, and\n // an `async` here would cost a promise per iteration of every loop.\n if (!call) return bind(stmt.name, evaluate(stmt.value, scope), scope);\n return runAction(engine, call, scope).then((value) => scope.set(stmt.name, value));\n}\n\n/**\n * `let id = data.faker.uuid` or `let id = data.faker.uuid()`: a dotted path\n * naming a plugin action is a call, exactly as it would be as a statement.\n *\n * A binding in scope always wins, so `let code = res.status` reads a field and\n * `let parts = name.split(\" \")` calls a method. Neither turns into I/O, whatever\n * the registry happens to hold.\n */\nfunction impliedCall(engine: Engine, stmt: LetStmt, scope: Scope): Invocation | undefined {\n const call = actionCall(stmt.value);\n const dot = call ? call.target.indexOf(\".\") : -1;\n if (!call || dot < 0 || bound(scope, call.target.slice(0, dot))) return undefined;\n const resolved = engine.registry.action(resolveTarget(call.target, engine.aliases));\n return resolved ? { target: call.target, args: call.args, node: stmt } : undefined;\n}\n\n/** A name the user bound. A plugin namespace in scope is not one, so the verb still calls. */\nfunction bound(scope: Scope, name: string): boolean {\n const value = scope.lookup(name);\n return value !== undefined && !isNamespaceValue(value);\n}\n\n/** Bind now, or once the value it is waiting on arrives. */\nfunction bind(name: string, value: unknown, scope: Scope): Pending {\n if (isPending(value)) return value.then((settled) => scope.set(name, settled));\n return void scope.set(name, value);\n}\n\n/** `capture` is removed in favour of `let`; still run, so old files keep working. */\nexport function runCapture(stmt: CaptureStmt, scope: Scope): void {\n scope.set(stmt.name, evaluate(stmt.value, scope));\n}\n\n/** `return expr`: unwind to the enclosing fragment with the value. */\nexport function runReturn(stmt: ReturnStmt, scope: Scope): never {\n const value = stmt.value ? evaluate(stmt.value, scope) : undefined;\n throw new ReturnSignal(value);\n}\n","import { VennError } from \"@venn-lang/contracts\";\nimport {\n buildDiff,\n type Diff,\n type ExpectStmt,\n evaluate,\n type MatcherClause,\n} from \"@venn-lang/core\";\nimport type { MatcherArgs, MatcherDefinition } from \"@venn-lang/sdk\";\nimport type { ResolvedMatcher } from \"../registry/index.js\";\nimport type { Scope } from \"../scope/index.js\";\nimport { callParams } from \"./call-params.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { nodeSource } from \"./node-span.js\";\n\n/** The pass/fail, the one-line message, and the diff that message summarises. */\nexport interface MatcherOutcome {\n passed: boolean;\n message?: string;\n diff?: Diff;\n}\n\n/** Resolve a bareword matcher from the registry and run it against the subject. */\nexport async function evalMatcher(args: {\n engine: Engine;\n stmt: ExpectStmt;\n scope: Scope;\n}): Promise<MatcherOutcome> {\n const clause = args.stmt.matcher as MatcherClause;\n const resolved = args.engine.registry.matcher(clause.name);\n if (!resolved) throw unknownMatcher(clause.name);\n const input = buildArgs({ ...args, resolved, clause });\n const raw = await resolved.matcher.test(input);\n if (args.stmt.negate ? !raw : raw) return { passed: true };\n return failure({ matcher: resolved.matcher, input, stmt: args.stmt });\n}\n\n/**\n * A failing matcher hands back the two sides it compared, labelled with how the\n * flow spelled the subject. A negated expect gets no diff on purpose: under\n * `not` the two sides matched, and \"expected 200, actual 200\" explains nothing.\n */\nfunction failure(args: {\n matcher: MatcherDefinition;\n input: MatcherArgs<unknown>;\n stmt: ExpectStmt;\n}): MatcherOutcome {\n const message = args.matcher.message(args.input);\n const detail = args.stmt.negate ? undefined : args.matcher.detail?.(args.input);\n if (!detail) return { passed: false, message };\n const label = subjectLabel(args.stmt);\n return { passed: false, message, diff: buildDiff({ label, ...detail }) };\n}\n\n/** The diff's header: the subject as the flow spelled it, on one line. */\nfunction subjectLabel(stmt: ExpectStmt): string {\n const source = stmt.subject ? nodeSource(stmt.subject).replace(/\\s+/g, \" \").trim() : \"\";\n return source === \"\" ? \"value\" : source;\n}\n\nfunction buildArgs(args: {\n resolved: ResolvedMatcher;\n stmt: ExpectStmt;\n clause: MatcherClause;\n scope: Scope;\n engine: Engine;\n}): MatcherArgs<unknown> {\n const { stmt, clause, scope } = args;\n const subject = stmt.subject ? evaluate(stmt.subject, scope) : undefined;\n const positional = clause.args.map((expr) => evaluate(expr, scope));\n return { subject, args: positional, params: matcherOptions(args) };\n}\n\n/**\n * A matcher's options map goes through the same gate an action's does: a key it\n * never declared is refused rather than dropped, and a value it rejects reads as\n * one line. Nothing checks these before the run, since `checkOptions` only ever\n * sees calls, so this is the only place `{ withinn: 1 }` is ever noticed.\n */\nfunction matcherOptions(args: {\n resolved: ResolvedMatcher;\n stmt: ExpectStmt;\n clause: MatcherClause;\n scope: Scope;\n engine: Engine;\n}): unknown {\n const { resolved, stmt, clause, scope, engine } = args;\n const raw = clause.opts ? evaluate(clause.opts, scope) : {};\n const schema = resolved.matcher.params;\n return callParams({ schema, opts: clause.opts, raw, site: stmt, uri: engine.uri });\n}\n\nfunction unknownMatcher(name: string): VennError {\n return new VennError({\n code: \"VN2004\",\n message: `Unknown matcher \"${name}\".`,\n detail: { name },\n });\n}\n","import { buildProblem, CODES, type ExpectStmt, evaluate, truthy } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { nodeSource, nodeSpan } from \"./node-span.js\";\nimport { evalMatcher, type MatcherOutcome } from \"./run-matcher.js\";\nimport { settle } from \"./settled.js\";\n\n/** Evaluate an `expect` (matcher clause, `.all` checks, negated, or subject) and emit the outcome. */\nexport async function runExpect(engine: Engine, stmt: ExpectStmt, scope: Scope): Promise<void> {\n const outcome = stmt.matcher\n ? await evalMatcher({ engine, stmt, scope })\n : { passed: await evalBoolean({ stmt, scope }) };\n record({ engine, stmt, outcome });\n}\n\nasync function evalBoolean(args: { stmt: ExpectStmt; scope: Scope }): Promise<boolean> {\n return args.stmt.modifier === \"all\" ? evalChecks(args) : evalSubject(args);\n}\n\nasync function evalSubject(args: { stmt: ExpectStmt; scope: Scope }): Promise<boolean> {\n if (!args.stmt.subject) return true;\n const value = truthy(await settle(evaluate(args.stmt.subject, args.scope)));\n return args.stmt.negate ? !value : value;\n}\n\nasync function evalChecks(args: { stmt: ExpectStmt; scope: Scope }): Promise<boolean> {\n for (const check of args.stmt.checks) {\n if (!truthy(await settle(evaluate(check, args.scope)))) return false;\n }\n return true;\n}\n\nfunction record(args: { engine: Engine; stmt: ExpectStmt; outcome: MatcherOutcome }): void {\n if (args.outcome.passed) {\n args.engine.result.passed += 1;\n args.engine.emitter.emit({ kind: \"expect.passed\", data: { source: nodeSource(args.stmt) } });\n return;\n }\n args.engine.result.failed += 1;\n const problem = buildProblem({\n spec: CODES.VN6001_ASSERTION_FAILED,\n span: nodeSpan(args.stmt, args.engine.uri),\n title: args.outcome.message ?? `Expectation failed: ${nodeSource(args.stmt)}`,\n // The title is one line; the two sides it summarises travel as the body.\n diff: args.outcome.diff,\n });\n args.engine.emitter.emit({ kind: \"expect.failed\", data: { problem } });\n}\n","/** Run `task` over `items` with at most `limit` in flight at once. */\nexport async function runPool<T>(\n items: readonly T[],\n limit: number,\n task: (item: T, index: number) => Promise<void>,\n): Promise<void> {\n const size = Math.max(1, limit);\n let cursor = 0;\n const worker = async (): Promise<void> => {\n while (cursor < items.length) {\n const index = cursor++;\n await task(items[index] as T, index);\n }\n };\n await Promise.all(Array.from({ length: Math.min(size, items.length) }, worker));\n}\n","import { evaluate, type MapLit } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\n\n/** Read a numeric field from an options map literal (e.g. `{ concurrency: 4 }`). */\nexport function optsNumber(\n opts: MapLit | undefined,\n key: string,\n scope: Scope,\n): number | undefined {\n const entry = opts?.entries.find((candidate) => candidate.key === key);\n if (!entry) return undefined;\n const value = evaluate(entry.value, scope);\n return typeof value === \"number\" ? value : undefined;\n}\n","import {\n buildProblem,\n CODES,\n evaluate,\n type ForEachStmt,\n ProblemError,\n typeName,\n} from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport { planOf } from \"./block-plan.js\";\nimport { runPool } from \"./concurrency.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { nodeSpan } from \"./node-span.js\";\nimport { optsNumber } from \"./opts.js\";\nimport type { Pending } from \"./pending.types.js\";\nimport { runBlock, runSteps } from \"./run-block.js\";\nimport { settle } from \"./settled.js\";\nimport { BreakSignal, ContinueSignal } from \"./signals.js\";\n\n/** `forEach x in list { concurrency: N } { … }`: iterate, up to N in flight. */\nexport async function runForEach(engine: Engine, stmt: ForEachStmt, scope: Scope): Promise<void> {\n const source = await settle(evaluate(stmt.source, scope));\n if (!Array.isArray(source)) throw notAList({ engine, stmt, source });\n const concurrency = optsNumber(stmt.opts, \"concurrency\", scope) ?? 1;\n // One at a time is the default and by far the common case: run it as a plain\n // loop rather than through the pool, which allocates a worker, an array and a\n // `Promise.all` to supervise a single sequential walk.\n if (concurrency === 1) return sequential(engine, stmt, source, scope);\n await runPool(source, concurrency, (item) => runIteration({ engine, stmt, item, scope }));\n}\n\n/**\n * Anything but a list is refused, because iterating it zero times would report\n * success: a test that checked nothing, dressed as one that passed. Built here,\n * off the iteration path, so the loop itself pays nothing for it.\n */\nfunction notAList(args: { engine: Engine; stmt: ForEachStmt; source: unknown }): ProblemError {\n return new ProblemError(\n buildProblem({\n spec: CODES.VN3015_NOT_A_LIST,\n span: nodeSpan(args.stmt.source, args.engine.uri),\n title: `forEach needs a list, and this is a ${typeName(args.source)}.`,\n help: helpFor(args.source),\n }),\n );\n}\n\n/** The everyday cause: an endpoint answering `{ data: [...] }` rather than a list. */\nfunction helpFor(source: unknown): string | undefined {\n if (typeName(source) !== \"map\") return undefined;\n return \"Name the list inside it, as in `forEach item in res.data`.\";\n}\n\n/**\n * Walk the items one at a time, staying synchronous for as long as the body\n * does. A body of pure work (a binding, a comparison, arithmetic) never\n * suspends, so 50k iterations cost no promises at all. The first iteration that\n * does suspend hands the remainder to {@link resume}, from where it left off.\n */\nfunction sequential(\n engine: Engine,\n stmt: ForEachStmt,\n items: readonly unknown[],\n scope: Scope,\n): Pending {\n const plan = planOf(stmt.body);\n const name = stmt.item;\n if (plan.defers) return slowSequential(engine, stmt, items, scope);\n const child = scope.child();\n for (let at = 0; at < items.length; at += 1) {\n try {\n child.set(name, items[at]);\n const pending = runSteps(engine, plan.steps, child);\n if (pending) return resume(engine, stmt, items, at + 1, scope, pending);\n } catch (error) {\n if (error instanceof BreakSignal) return undefined;\n if (error instanceof ContinueSignal) continue;\n throw error;\n }\n }\n return undefined;\n}\n\nfunction slowSequential(\n engine: Engine,\n stmt: ForEachStmt,\n items: readonly unknown[],\n scope: Scope,\n): Pending {\n for (let at = 0; at < items.length; at += 1) {\n try {\n const pending = iterate(engine, stmt, items[at], scope);\n if (pending) return resume(engine, stmt, items, at + 1, scope, pending);\n } catch (error) {\n if (error instanceof BreakSignal) return undefined;\n if (error instanceof ContinueSignal) continue;\n throw error;\n }\n }\n return undefined;\n}\n\nfunction iterate(engine: Engine, stmt: ForEachStmt, item: unknown, scope: Scope): Pending {\n const child = scope.child();\n child.set(stmt.item, item);\n return runBlock(engine, stmt.body, child);\n}\n\nasync function resume(\n engine: Engine,\n stmt: ForEachStmt,\n items: readonly unknown[],\n from: number,\n scope: Scope,\n pending: Promise<void>,\n): Promise<void> {\n try {\n await pending;\n } catch (error) {\n if (error instanceof BreakSignal) return;\n if (!(error instanceof ContinueSignal)) throw error;\n }\n for (let at = from; at < items.length; at += 1) {\n try {\n await iterate(engine, stmt, items[at], scope);\n } catch (error) {\n if (error instanceof BreakSignal) return;\n if (error instanceof ContinueSignal) continue;\n throw error;\n }\n }\n}\n\nasync function runIteration(args: {\n engine: Engine;\n stmt: ForEachStmt;\n item: unknown;\n scope: Scope;\n}): Promise<void> {\n const child = args.scope.child();\n child.set(args.stmt.item, args.item);\n try {\n await runBlock(args.engine, args.stmt.body, child);\n } catch (error) {\n if (error instanceof BreakSignal || error instanceof ContinueSignal) return;\n throw error;\n }\n}\n","import type { GroupDecl } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { runBlock } from \"./run-block.js\";\n\n/** A group only clusters steps in the graph; it shares the enclosing scope. */\nexport async function runGroup(engine: Engine, stmt: GroupDecl, scope: Scope): Promise<void> {\n await runBlock(engine, stmt.body, scope);\n}\n","import { evaluate, type IfStmt, isIfStmt, truthy } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport type { Pending } from \"./pending.types.js\";\nimport { runBlock } from \"./run-block.js\";\nimport { isPending } from \"./settled.js\";\n\n/** `if cond { … } else if … else { … }`: evaluate and run the taken branch. */\nexport function runIf(engine: Engine, stmt: IfStmt, scope: Scope): Pending {\n const cond = evaluate(stmt.cond, scope);\n if (isPending(cond)) return cond.then((value) => void taken(engine, stmt, scope, truthy(value)));\n return taken(engine, stmt, scope, truthy(cond));\n}\n\nfunction taken(engine: Engine, stmt: IfStmt, scope: Scope, yes: boolean): Pending {\n if (yes) return runBlock(engine, stmt.then, scope.child());\n const branch = stmt.otherwise;\n if (!branch) return undefined;\n if (isIfStmt(branch)) return runIf(engine, branch, scope);\n return runBlock(engine, branch, scope.child());\n}\n","import type { Engine } from \"./engine.types.js\";\n\n/**\n * A per-branch view of the engine carrying the cancellation signal.\n *\n * Into `ctx` as well as onto the engine: the statement walker checks the signal\n * between statements, but a branch parked inside a long action is only reachable\n * through the context the action was handed. Without it, cancelling a branch\n * waits for whatever it is already doing to finish on its own.\n */\nexport function branchEngine(engine: Engine, signal: AbortSignal): Engine {\n return { ...engine, signal, ctx: { ...engine.ctx, signal } };\n}\n","import { evaluate, type MapLit } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\n\n/** Read a string field from an options map literal (e.g. `{ onError: \"cancel\" }`). */\nexport function optsText(opts: MapLit | undefined, key: string, scope: Scope): string | undefined {\n const entry = opts?.entries.find((candidate) => candidate.key === key);\n if (!entry) return undefined;\n const value = evaluate(entry.value, scope);\n return typeof value === \"string\" ? value : undefined;\n}\n","import type { ParallelStmt, Statement } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport { branchEngine } from \"./branch-engine.js\";\nimport { runPool } from \"./concurrency.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { optsNumber } from \"./opts.js\";\nimport { optsText } from \"./opts-text.js\";\nimport { runStatement } from \"./run-statements.js\";\nimport { CancelSignal, isControlSignal } from \"./signals.js\";\n\n/**\n * `parallel { concurrency: 2, onError: \"collect\" } { … }`: run each child\n * statement concurrently.\n *\n * The block does not outlive itself. However it ends, every branch has either\n * finished or been cancelled by the time this returns: `Promise.all` on its own\n * rejects at the first failure and leaves the rest running, which is how a\n * finished test carries on making requests.\n */\nexport async function runParallel(engine: Engine, stmt: ParallelStmt, scope: Scope): Promise<void> {\n const limit = optsNumber(stmt.opts, \"concurrency\", scope) ?? stmt.body.stmts.length;\n const onError = optsText(stmt.opts, \"onError\", scope) ?? \"cancel\";\n const controller = new AbortController();\n const failures: unknown[] = [];\n await runPool(stmt.body.stmts, Math.max(1, limit), (child) =>\n branch({ engine, child, scope, controller, failures, onError }),\n );\n report(failures);\n}\n\ninterface BranchArgs {\n engine: Engine;\n child: Statement;\n scope: Scope;\n controller: AbortController;\n failures: unknown[];\n onError: string;\n}\n\n/**\n * One branch, and what its failure means for the others.\n *\n * `cancel`, the default, stops the siblings at their next statement boundary,\n * because a run that has already failed should stop working. `collect` lets them\n * all finish and reports every failure, which is what a set of independent\n * checks wants.\n */\nasync function branch(args: BranchArgs): Promise<void> {\n const engine = branchEngine(args.engine, args.controller.signal);\n try {\n await runStatement(engine, args.child, args.scope.child());\n } catch (error) {\n if (error instanceof CancelSignal) return;\n if (isControlSignal(error)) throw error;\n args.failures.push(error);\n if (args.onError === \"cancel\") args.controller.abort();\n }\n}\n\n/**\n * One failure is raised as itself, so the reader sees the message the branch\n * produced. Several are raised together rather than one being picked.\n */\nfunction report(failures: readonly unknown[]): void {\n if (failures.length === 0) return;\n if (failures.length === 1) throw failures[0];\n throw new AggregateError(failures, `${failures.length} parallel branches failed.`);\n}\n","import type { RaceStmt } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport { branchEngine } from \"./branch-engine.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { runStatement } from \"./run-statements.js\";\n\n/** `race { … }`: the first branch to settle wins, the losers are cancelled. */\nexport async function runRace(engine: Engine, stmt: RaceStmt, scope: Scope): Promise<void> {\n const controller = new AbortController();\n const branches = stmt.body.stmts.map((child) =>\n Promise.resolve(runStatement(branchEngine(engine, controller.signal), child, scope.child())),\n );\n try {\n await Promise.race(branches);\n } finally {\n controller.abort();\n // The losers reject with CancelSignal once they reach a statement boundary.\n for (const branch of branches) branch.catch(() => {});\n }\n}\n","import {\n buildProblem,\n CODES,\n evaluate,\n ProblemError,\n type RepeatStmt,\n typeName,\n} from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { nodeSpan } from \"./node-span.js\";\nimport { runBlock } from \"./run-block.js\";\nimport { BreakSignal, ContinueSignal } from \"./signals.js\";\n\n/** `repeat N as i { … }`: run the body N times, honouring break/continue. */\nexport async function runRepeat(engine: Engine, stmt: RepeatStmt, scope: Scope): Promise<void> {\n const count = toCount(engine, stmt, evaluate(stmt.count, scope));\n for (let i = 1; i <= count; i++) {\n const child = scope.child();\n if (stmt.index) child.set(stmt.index, i);\n try {\n const pending = runBlock(engine, stmt.body, child);\n if (pending) await pending;\n } catch (error) {\n if (error instanceof BreakSignal) break;\n if (error instanceof ContinueSignal) continue;\n throw error;\n }\n }\n}\n\n/**\n * A count the machine cannot read as one is refused, because running the body\n * zero times would report success: `repeat cfg.times` with nothing behind\n * `times` would check nothing and pass.\n *\n * Zero and below still mean \"not at all\": a bound that computes to none is a\n * program saying so, not a mistake.\n */\nfunction toCount(engine: Engine, stmt: RepeatStmt, value: unknown): number {\n if (typeof value !== \"number\" || !Number.isFinite(value)) throw notANumber(engine, stmt, value);\n return value > 0 ? Math.floor(value) : 0;\n}\n\nfunction notANumber(engine: Engine, stmt: RepeatStmt, value: unknown): ProblemError {\n return new ProblemError(\n buildProblem({\n spec: CODES.VN3016_NOT_A_NUMBER,\n span: nodeSpan(stmt.count, engine.uri),\n title: `repeat needs a number of times, and this is a ${typeName(value)}.`,\n help: \"Give it a count, as in `repeat 3 { … }`.\",\n }),\n );\n}\n","import { VennError } from \"@venn-lang/contracts\";\nimport { evaluate, type FragmentDecl, type ParamList, type RunStmt } from \"@venn-lang/core\";\nimport { createScope, type Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { runBlock } from \"./run-block.js\";\nimport { ReturnSignal } from \"./signals.js\";\n\n/** `run fragment(args) as x`: invoke a fragment and bind its return value. */\nexport async function runRun(engine: Engine, stmt: RunStmt, scope: Scope): Promise<void> {\n const fragment = engine.fragments.get(stmt.target);\n if (!fragment) throw unknownFragment(stmt.target);\n const args = (stmt.args?.args ?? []).map((arg) => evaluate(arg.value, scope));\n const fragScope = createScope();\n bindParams(fragScope, fragment.params, args);\n const value = await runFragment(engine, fragment, fragScope);\n if (stmt.bind) scope.set(stmt.bind, value);\n}\n\nasync function runFragment(engine: Engine, fragment: FragmentDecl, scope: Scope): Promise<unknown> {\n try {\n await runBlock(engine, fragment.body, scope);\n return undefined;\n } catch (error) {\n if (error instanceof ReturnSignal) return error.value;\n throw error;\n }\n}\n\nfunction bindParams(scope: Scope, params: ParamList | undefined, args: readonly unknown[]): void {\n (params?.params ?? []).forEach((param, index) => {\n scope.set(param.name, args[index]);\n });\n}\n\nfunction unknownFragment(name: string): VennError {\n return new VennError({\n code: \"VN2005\",\n message: `Unknown fragment \"${name}\".`,\n detail: { fragment: name },\n });\n}\n","import { type Block, isBlock, isStepDecl, type StepDecl } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport { hasAnnotation, readLock } from \"./annotations.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { matchesTitle } from \"./filter.js\";\nimport { recordFlaky } from \"./flaky.js\";\nimport { runAround } from \"./run-around.js\";\nimport { runWithAnnotations, withLock } from \"./run-attempts.js\";\nimport { runBlock } from \"./run-block.js\";\nimport { isControlSignal } from \"./signals.js\";\n\n/** Run a step honouring @skip/@only, @lock, @timeout and @retry; its bindings are step-local. */\nexport async function runStep(engine: Engine, step: StepDecl, parent: Scope): Promise<void> {\n if (!included(engine, step)) return;\n engine.emitter.emit({ kind: \"step.started\", data: { title: step.title } });\n const before = engine.result.failed;\n const scope = parent.child();\n try {\n await execute(engine, step, { parent, scope });\n } catch (error) {\n if (!isControlSignal(error)) finished(engine, step.title, \"failed\");\n throw error;\n }\n recordFlaky(engine, step, before);\n finished(engine, step.title, engine.result.failed > before ? \"failed\" : \"passed\");\n}\n\n/**\n * The gate `selectFlows` puts on a flow, put on a step: `@only` focuses, `@skip`\n * drops, and only then the `--step` title filter.\n *\n * A step is focused among the steps it stands with, meaning the block it was\n * written in, the way a flow is focused among the flows of its document.\n */\nfunction included(engine: Engine, step: StepDecl): boolean {\n if (hasAnnotation(step, \"skip\")) return false;\n if (focusing(step.$container) && !hasAnnotation(step, \"only\")) return false;\n return matchesTitle(step.title, engine.filter.step);\n}\n\n/** Whether any step in this block asked to be the only one that runs. */\nconst focused = new WeakMap<Block, boolean>();\n\n/**\n * Answered once per block: the source cannot change mid-run, and a step inside a\n * `forEach` would otherwise re-read its siblings on every pass.\n */\nfunction focusing(container: unknown): boolean {\n if (!isBlock(container)) return false;\n const known = focused.get(container);\n if (known !== undefined) return known;\n const found = container.stmts.some((stmt) => isStepDecl(stmt) && hasAnnotation(stmt, \"only\"));\n focused.set(container, found);\n return found;\n}\n\nfunction execute(\n engine: Engine,\n step: StepDecl,\n scopes: { parent: Scope; scope: Scope },\n): Promise<void> {\n return withLock(engine, readLock(step), () =>\n runWithAnnotations({\n engine,\n node: step,\n scope: scopes.parent,\n title: step.title,\n // The caller wants a promise; a block that never suspended returns none.\n run: () => runAround(step, () => runBlock(engine, step.body, scopes.scope)),\n }),\n );\n}\n\nfunction finished(engine: Engine, title: string, status: \"passed\" | \"failed\"): void {\n engine.emitter.emit({ kind: \"step.finished\", data: { title, status } });\n}\n","import type { TryStmt } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { runBlock } from \"./run-block.js\";\nimport { isControlSignal } from \"./signals.js\";\n\n/** `try { } catch e { } finally { }`: control signals pass through, errors go to catch. */\nexport async function runTry(engine: Engine, stmt: TryStmt, scope: Scope): Promise<void> {\n try {\n await runBlock(engine, stmt.body, scope.child());\n } catch (error) {\n if (isControlSignal(error)) throw error;\n await runCatch({ engine, stmt, scope, error });\n } finally {\n if (stmt.finalizer) await runBlock(engine, stmt.finalizer, scope.child());\n }\n}\n\nasync function runCatch(args: {\n engine: Engine;\n stmt: TryStmt;\n scope: Scope;\n error: unknown;\n}): Promise<void> {\n if (!args.stmt.handler) return;\n const child = args.scope.child();\n if (args.stmt.error) child.set(args.stmt.error, toErrorValue(args.error));\n await runBlock(args.engine, args.stmt.handler, child);\n}\n\nfunction toErrorValue(error: unknown): { message: string; code: string } {\n const e = error as { message?: string; code?: string };\n return { message: e?.message ?? String(error), code: e?.code ?? \"VN7000\" };\n}\n","import {\n buildProblem,\n CODES,\n evaluate,\n ProblemError,\n truthy,\n type WhileStmt,\n} from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { nodeSpan } from \"./node-span.js\";\nimport { runBlock } from \"./run-block.js\";\nimport { settle } from \"./settled.js\";\nimport { BreakSignal, ContinueSignal } from \"./signals.js\";\n\n/**\n * Every `while` has an inherited timeout in the language; this is the hard cap\n * that stands in for it until timeouts are wired.\n */\nconst MAX_ITERATIONS = 100_000;\n\n/** `while cond { … }`: loop while the condition is truthy. */\nexport async function runWhile(engine: Engine, stmt: WhileStmt, scope: Scope): Promise<void> {\n let guard = 0;\n while (truthy(await settle(evaluate(stmt.cond, scope)))) {\n if (++guard > MAX_ITERATIONS) throw neverFinished(engine, stmt);\n try {\n await runBlock(engine, stmt.body, scope.child());\n } catch (error) {\n if (error instanceof BreakSignal) break;\n if (error instanceof ContinueSignal) continue;\n throw error;\n }\n }\n}\n\n/**\n * Reaching the cap is not the loop finishing, so it is raised rather than\n * returned: stopping at the limit in silence would report a pass.\n */\nfunction neverFinished(engine: Engine, stmt: WhileStmt): ProblemError {\n return new ProblemError(\n buildProblem({\n spec: CODES.VN8002_LOOP_LIMIT,\n span: nodeSpan(stmt, engine.uri),\n title: `This while loop ran ${MAX_ITERATIONS} times and its condition was still true.`,\n help: \"Change something the condition reads inside the loop, or use `repeat n` to bound it.\",\n }),\n );\n}\n","import type {\n ActionCall,\n CaptureStmt,\n ExpectStmt,\n ForEachStmt,\n GroupDecl,\n IfStmt,\n LetStmt,\n ParallelStmt,\n RaceStmt,\n RepeatStmt,\n ReturnStmt,\n RunStmt,\n Statement,\n StepDecl,\n TryStmt,\n WhileStmt,\n} from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport type { Pending } from \"./pending.types.js\";\nimport { runActionStatement } from \"./run-action.js\";\nimport { runCapture, runLet, runReturn } from \"./run-bindings.js\";\nimport { runExpect } from \"./run-expect.js\";\nimport { runForEach } from \"./run-foreach.js\";\nimport { runGroup } from \"./run-group.js\";\nimport { runIf } from \"./run-if.js\";\nimport { runParallel } from \"./run-parallel.js\";\nimport { runRace } from \"./run-race.js\";\nimport { runRepeat } from \"./run-repeat.js\";\nimport { runRun } from \"./run-run.js\";\nimport { runStep } from \"./run-step.js\";\nimport { runTry } from \"./run-try.js\";\nimport { runWhile } from \"./run-while.js\";\nimport { BreakSignal, CancelSignal, ContinueSignal } from \"./signals.js\";\n\n/** Run a block's statements in order. */\nexport async function runStatements(\n engine: Engine,\n stmts: readonly Statement[],\n scope: Scope,\n): Promise<void> {\n for (const stmt of stmts) {\n const pending = runStatement(engine, stmt, scope);\n if (pending) await pending;\n }\n}\n\n/**\n * Dispatch one statement to its handler. This is the single boundary where a\n * cancelled `race` branch stops advancing.\n *\n * Switched on `$type`, not on the `isXxx` guards: each guard asks Langium's\n * reflection whether one type is a subtype of another, and a chain of them costs\n * a double-digit share of a large `forEach`. `$type` is a plain string every\n * node carries, so one switch answers what thirteen questions would.\n */\nexport function runStatement(engine: Engine, stmt: Statement, scope: Scope): Pending {\n if (engine.signal?.aborted) throw new CancelSignal();\n switch (stmt.$type) {\n case \"LetStmt\":\n return runLet(engine, stmt as LetStmt, scope);\n case \"ActionCall\":\n return runActionStatement(engine, stmt as ActionCall, scope);\n case \"ExpectStmt\":\n return runExpect(engine, stmt as ExpectStmt, scope);\n case \"IfStmt\":\n return runIf(engine, stmt as IfStmt, scope);\n case \"StepDecl\":\n return runStep(engine, stmt as StepDecl, scope);\n case \"GroupDecl\":\n return runGroup(engine, stmt as GroupDecl, scope);\n default:\n return control(engine, stmt, scope);\n }\n}\n\n/** Loops, concurrency and the control-flow signals: the rarer half. */\nfunction control(engine: Engine, stmt: Statement, scope: Scope): Pending {\n switch (stmt.$type) {\n case \"ForEachStmt\":\n return runForEach(engine, stmt as ForEachStmt, scope);\n case \"RepeatStmt\":\n return runRepeat(engine, stmt as RepeatStmt, scope);\n case \"WhileStmt\":\n return runWhile(engine, stmt as WhileStmt, scope);\n case \"ParallelStmt\":\n return runParallel(engine, stmt as ParallelStmt, scope);\n case \"RaceStmt\":\n return runRace(engine, stmt as RaceStmt, scope);\n case \"TryStmt\":\n return runTry(engine, stmt as TryStmt, scope);\n case \"RunStmt\":\n return runRun(engine, stmt as RunStmt, scope);\n default:\n return leaf(stmt, scope);\n }\n}\n\nfunction leaf(stmt: Statement, scope: Scope): Pending {\n if (stmt.$type === \"CaptureStmt\") return runCapture(stmt as CaptureStmt, scope);\n if (stmt.$type === \"ReturnStmt\") return runReturn(stmt as ReturnStmt, scope);\n if (stmt.$type === \"BreakStmt\") throw new BreakSignal();\n if (stmt.$type === \"ContinueStmt\") throw new ContinueSignal();\n // LifecycleDecl (on/defer) is handled by runBlock / runFlow, not here.\n return undefined;\n}\n","import {\n type Block,\n compileExpr,\n isLetStmt,\n isLifecycleDecl,\n type LetStmt,\n type Statement,\n} from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { actionCall } from \"./invocation.js\";\nimport type { Pending } from \"./pending.types.js\";\nimport { runStatement } from \"./run-statements.js\";\nimport { isPending } from \"./settled.js\";\n\n/** One statement of a block, bound to everything the source already settled. */\nexport type Step = (engine: Engine, scope: Scope) => Pending;\n\n/** A block reduced to what running it needs, decided once from the source. */\nexport interface BlockPlan {\n readonly steps: readonly Step[];\n readonly defers: boolean;\n}\n\nconst plans = new WeakMap<Block, BlockPlan>();\n\n/** The plan for a block, built on first use and cached against the node itself. */\nexport function planOf(block: Block): BlockPlan {\n const known = plans.get(block);\n if (known) return known;\n const built: BlockPlan = {\n steps: block.stmts.map(stepOf),\n defers: block.stmts.some(isDefer),\n };\n plans.set(block, built);\n return built;\n}\n\nfunction isDefer(stmt: Statement): boolean {\n return isLifecycleDecl(stmt) && stmt.hook === \"defer\";\n}\n\nfunction stepOf(stmt: Statement): Step {\n return plainLet(stmt) ?? ((engine, scope) => runStatement(engine, stmt, scope));\n}\n\n/**\n * `const y = x * 2`: no trailing args, no options map, and a value that is not a\n * dotted path, so no registry lookup can turn it into a verb. The name, the\n * compiled expression and the decision are all fixed by the source.\n */\nfunction plainLet(stmt: Statement): Step | undefined {\n if (!isLetStmt(stmt)) return undefined;\n const let_ = stmt as LetStmt;\n if (let_.args.length > 0 || let_.opts) return undefined;\n const call = actionCall(let_.value);\n if (call && call.target.indexOf(\".\") >= 0) return undefined;\n const name = let_.name;\n const thunk = compileExpr(let_.value);\n return (_engine, scope) => bind(name, thunk(scope), scope);\n}\n\nfunction bind(name: string, value: unknown, scope: Scope): Pending {\n if (isPending(value)) return value.then((settled) => scope.set(name, settled));\n return void scope.set(name, value);\n}\n","import { type Block, isLifecycleDecl, type LifecycleDecl, type Statement } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport { type BlockPlan, planOf, type Step } from \"./block-plan.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport type { Pending } from \"./pending.types.js\";\nimport { runStatement } from \"./run-statements.js\";\nimport { CancelSignal } from \"./signals.js\";\n\n/**\n * Run a block's statements in order, running any `defer { … }` bodies LIFO on\n * the way out, including on error or a control-flow signal.\n */\nexport function runBlock(engine: Engine, block: Block, scope: Scope): Pending {\n const plan = planOf(block);\n if (plan.defers) return withDefers(engine, block, scope);\n return runSteps(engine, plan.steps, scope);\n}\n\n/** The walk over a plan, reusable by a loop that hoists `planOf` out of it. */\nexport function runSteps(engine: Engine, steps: readonly Step[], scope: Scope): Pending {\n for (let at = 0; at < steps.length; at += 1) {\n if (engine.signal?.aborted) throw new CancelSignal();\n const pending = (steps[at] as Step)(engine, scope);\n if (pending) return resume(engine, steps, at + 1, scope, pending);\n }\n return undefined;\n}\n\nasync function resume(\n engine: Engine,\n steps: readonly Step[],\n from: number,\n scope: Scope,\n pending: Promise<void>,\n): Promise<void> {\n await pending;\n for (let at = from; at < steps.length; at += 1) {\n if (engine.signal?.aborted) throw new CancelSignal();\n const next = (steps[at] as Step)(engine, scope);\n if (next) await next;\n }\n}\n\nasync function withDefers(engine: Engine, block: Block, scope: Scope): Promise<void> {\n const defers: Block[] = [];\n try {\n for (const stmt of block.stmts) {\n if (isDefer(stmt)) {\n defers.unshift(stmt.body);\n continue;\n }\n const pending = runStatement(engine, stmt, scope);\n if (pending) await pending;\n }\n } finally {\n const cleanup: Engine = { ...engine, signal: undefined };\n for (const body of defers) await runBlock(cleanup, body, scope.child());\n }\n}\n\nfunction isDefer(stmt: Statement): stmt is LifecycleDecl {\n return isLifecycleDecl(stmt) && stmt.hook === \"defer\";\n}\n\nexport type { BlockPlan };\n","import { buildProblem, CODES, type LifecycleDecl, type Problem } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { nodeSpan } from \"./node-span.js\";\nimport { runBlock } from \"./run-block.js\";\nimport { ExitSignal, isControlSignal } from \"./signals.js\";\n\n/**\n * Run a set of lifecycle blocks (setup/teardown/beforeEach/afterEach) in order.\n *\n * The caller passes the scope the hooks belong to (the suite root for\n * setup/teardown, the flow's own scope for beforeEach/afterEach) and each body\n * runs in a child of it, the way the `on` handlers below do. In a parentless\n * scope `env`, the prelude, the top-level bindings and the open resources would\n * all read as undefined and the hook would run anyway: a teardown written as\n * `db.exec \"DELETE FROM orders WHERE run = '${env.RUN_ID}'\"` deletes the table\n * it was meant to tidy.\n */\nexport async function runHooks(args: {\n engine: Engine;\n hooks: readonly LifecycleDecl[];\n scope: Scope;\n}): Promise<void> {\n for (const hook of args.hooks) await runHook(args.engine, hook, args.scope);\n}\n\n/**\n * Run the `on <event>` handlers whose event matches (e.g. \"failure\"/\"success\").\n *\n * Through the same boundary as the hooks above: a handler that reacts to a\n * failure by failing itself is a second failure, not the end of the run.\n */\nexport async function runOnHandlers(args: {\n engine: Engine;\n handlers: readonly LifecycleDecl[];\n event: string;\n scope: Scope;\n}): Promise<void> {\n for (const handler of args.handlers) {\n if (handler.event === args.event) await runHook(args.engine, handler, args.scope);\n }\n}\n\n/**\n * A hook that throws fails the suite instead of ending the run: it is counted\n * and reported, and the walk carries on to `run.finished`, so the reporters\n * still close their files and the files after this one still run.\n */\nasync function runHook(engine: Engine, hook: LifecycleDecl, scope: Scope): Promise<void> {\n try {\n await runBlock(engine, hook.body, scope.child());\n } catch (error) {\n // Read as a flow body reads it: `break`/`return` unwind, they do not fail.\n // `exit` is not the hook's to absorb: it ends the run, and the code it\n // carries is the whole verdict, so it keeps unwinding to whoever ends it.\n if (error instanceof ExitSignal) throw error;\n if (!isControlSignal(error)) recordFailure({ engine, hook, error });\n }\n}\n\n/**\n * Counted where a failing flow is counted, and carried on the event that already\n * puts a Problem in front of every reporter. A hook failure the reporters never\n * hear about ends as a green artifact over a broken run.\n */\nfunction recordFailure(args: { engine: Engine; hook: LifecycleDecl; error: unknown }): void {\n args.engine.result.failed += 1;\n args.engine.emitter.emit({ kind: \"expect.failed\", data: { problem: hookProblem(args) } });\n}\n\nfunction hookProblem(args: { engine: Engine; hook: LifecycleDecl; error: unknown }): Problem {\n return buildProblem({\n spec: CODES.VN7004_HOOK_FAILED,\n span: nodeSpan(args.hook, args.engine.uri),\n title: `${hookLabel(args.hook)} failed: ${messageOf(args.error)}`,\n });\n}\n\n/** The block named the way the user wrote it: `setup`, or `on failure`. */\nfunction hookLabel(hook: LifecycleDecl): string {\n return hook.hook ?? (hook.event ? `on ${hook.event}` : \"lifecycle\");\n}\n\nfunction messageOf(error: unknown): string {\n return (error as { message?: string })?.message ?? String(error);\n}\n","import { type FlowDecl, isLifecycleDecl, type LifecycleDecl, ProblemError } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport { hasAnnotation, readLock } from \"./annotations.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { recordFlaky } from \"./flaky.js\";\nimport { runAround } from \"./run-around.js\";\nimport { runWithAnnotations, withLock } from \"./run-attempts.js\";\nimport { runBlock } from \"./run-block.js\";\nimport { runOnHandlers } from \"./run-lifecycle.js\";\nimport { ExitSignal, isControlSignal } from \"./signals.js\";\n\n/** Run a flow: body, then its `on failure`/`on success` handlers, then finish. */\nexport async function runFlow(engine: Engine, flow: FlowDecl, scope: Scope): Promise<void> {\n engine.emitter.emit({ kind: \"flow.started\", data: { title: flow.title } });\n const before = engine.result.failed;\n const handlers = flow.body.stmts.filter(isOnHandler);\n await runFlowBody(engine, flow, scope);\n recordFlaky(engine, flow, before);\n const status = engine.result.failed > before ? \"failed\" : \"passed\";\n const event = status === \"failed\" ? \"failure\" : \"success\";\n await runOnHandlers({ engine, handlers, event, scope });\n engine.emitter.emit({ kind: \"flow.finished\", data: { title: flow.title, status } });\n}\n\nasync function runFlowBody(engine: Engine, flow: FlowDecl, scope: Scope): Promise<void> {\n try {\n await withLock(engine, flowLock(flow), () =>\n runWithAnnotations({\n engine,\n node: flow,\n scope,\n title: flow.title,\n // The caller wants a promise; a block that never suspended returns none.\n run: () => runAround(flow, () => runBlock(engine, flow.body, scope)),\n }),\n );\n } catch (error) {\n // `break`/`return` end the flow and no more than that. `exit` is not the\n // flow's to absorb: it ends the run, so it keeps unwinding.\n if (error instanceof ExitSignal) throw error;\n if (!isControlSignal(error)) recordError(engine, error);\n }\n}\n\n/** `@lock(\"x\")` uses a named mutex; `@serial` serialises runs of the same flow. */\nfunction flowLock(flow: FlowDecl): string | undefined {\n return readLock(flow) ?? (hasAnnotation(flow, \"serial\") ? `serial:${flow.title}` : undefined);\n}\n\nfunction isOnHandler(stmt: unknown): stmt is LifecycleDecl {\n return isLifecycleDecl(stmt) && Boolean((stmt as LifecycleDecl).event);\n}\n\n/**\n * A failure the flow itself could not handle.\n *\n * One that already knows what it is (a Problem, with its code, its span and its\n * help) travels on the event every reporter reads for failures. Flattening it to\n * a log line would strip the code and the location the raiser worked out.\n */\nfunction recordError(engine: Engine, error: unknown): void {\n engine.result.failed += 1;\n if (error instanceof ProblemError) {\n engine.emitter.emit({ kind: \"expect.failed\", data: { problem: error.problem } });\n return;\n }\n const message = (error as { message?: string })?.message ?? String(error);\n engine.emitter.emit({ kind: \"log\", data: { level: \"error\", message } });\n}\n","import {\n type Block,\n type Declaration,\n type Document,\n isLifecycleDecl,\n isRunnable,\n type LifecycleDecl,\n} from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { runBlock } from \"./run-block.js\";\nimport { runStatement } from \"./run-statements.js\";\n\n/** A cleanup a program deferred, to be run on the way out. */\nexport type Teardown = () => Promise<void>;\n\n/**\n * A document's top-level statements, run once, in the order they are written.\n *\n * The same lines mean the same thing in both modes: a script *is* its prologue,\n * and a test file runs one before its flows. So a `const` calling a verb at the\n * top of a file opens the thing either way, and the flows never find `null`.\n *\n * @param args.into Where deferred cleanups accumulate, in written order. A\n * program's ending is registered before its statements run, so it has to see\n * what they defer as they reach it rather than afterwards.\n * @returns The teardowns collected, which is `into` when one was supplied.\n */\nexport async function runPrologue(args: {\n engine: Engine;\n doc: Document;\n scope: Scope;\n into?: Teardown[];\n}): Promise<Teardown[]> {\n const teardowns = args.into ?? [];\n for (const node of args.doc.decls) {\n if (isDefer(node)) teardowns.push(deferred({ ...args, body: node.body }));\n else if (isRunnable(node)) await runStatement(args.engine, node, args.scope);\n }\n return teardowns;\n}\n\n/** `defer { … }` written at the top of a file: registered here, run on the way out. */\nfunction isDefer(node: Declaration): node is Declaration & LifecycleDecl {\n return isLifecycleDecl(node) && node.hook === \"defer\";\n}\n\nfunction deferred(args: { engine: Engine; body: Block; scope: Scope }): Teardown {\n // Cleanup must complete even when what it tidies was cancelled mid-flight.\n const engine: Engine = { ...args.engine, signal: undefined };\n return async () => {\n await runBlock(engine, args.body, args.scope.child());\n };\n}\n\n/** Undo in reverse: what opened last is given back first. */\nexport async function runTeardowns(teardowns: readonly Teardown[]): Promise<void> {\n for (const teardown of [...teardowns].reverse()) await teardown();\n}\n","import {\n type Document,\n evaluate,\n type FlowDecl,\n isFlowDecl,\n isMatrixDecl,\n isStepDecl,\n type PlannedStep,\n type RunPlan,\n} from \"@venn-lang/core\";\nimport { createScope, type Scope } from \"../scope/index.js\";\nimport { absorbExit } from \"./absorb-exit.js\";\nimport { hasAnnotation, readTags } from \"./annotations.js\";\nimport { createBaseScope } from \"./base-scope.js\";\nimport { bindGlobals } from \"./bind-globals.js\";\nimport { bindImports } from \"./bind-imports.js\";\nimport { collectHooks, type SuiteHooks } from \"./collect.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { matchesTitle } from \"./filter.js\";\nimport { settleFlaky } from \"./flaky.js\";\nimport { runFlow } from \"./run-flow.js\";\nimport { runHooks } from \"./run-lifecycle.js\";\nimport { runPrologue, runTeardowns } from \"./run-prologue.js\";\n\n/**\n * Walk a document: setup once, then for each `matrix` variant bind `env`/`matrix`\n * globals, open resources, run flows (with before/afterEach), close resources.\n */\nexport async function runDocument(engine: Engine, doc: Document): Promise<void> {\n const flows = selectFlows(engine, doc.decls.filter(isFlowDecl));\n const hooks = collectHooks(doc);\n engine.emitter.emit({ kind: \"run.started\", data: { plan: planOf(flows) } });\n const start = engine.clock.now();\n await runSuite({ engine, doc, flows, hooks });\n settleFlaky(engine);\n const durationMs = engine.clock.now() - start;\n engine.emitter.emit({ kind: \"run.finished\", data: { ...engine.result, durationMs } });\n}\n\n/**\n * Suite hooks run once, on either side of every variant, so they get a root of\n * their own: the document's bindings without any one variant's `matrix`.\n *\n * An `exit` in `setup` ends the run where it stands, so the variants never\n * start, and `teardown` still runs, because what `setup` opened is still open.\n * Both sides absorb their own, so the code reaches the host and `run.finished`\n * is still emitted above.\n */\nasync function runSuite(args: {\n engine: Engine;\n doc: Document;\n flows: readonly FlowDecl[];\n hooks: SuiteHooks;\n}): Promise<void> {\n const { engine, hooks } = args;\n const suite = rootScope({ engine, doc: args.doc, variant: {} });\n await absorbExit(engine, async () => {\n await runHooks({ engine, hooks: hooks.setup, scope: suite });\n await runVariants(args);\n });\n await absorbExit(engine, () => runHooks({ engine, hooks: hooks.teardown, scope: suite }));\n}\n\n/** Every `matrix` variant is a full pass over the flows, one after the other. */\nasync function runVariants(args: {\n engine: Engine;\n doc: Document;\n flows: readonly FlowDecl[];\n hooks: SuiteHooks;\n}): Promise<void> {\n for (const variant of matrixVariants(args.engine, args.doc)) {\n await runVariant({ ...args, variant });\n }\n}\n\nasync function runVariant(args: {\n engine: Engine;\n doc: Document;\n flows: readonly FlowDecl[];\n hooks: SuiteHooks;\n variant: Record<string, unknown>;\n}): Promise<void> {\n const root = rootScope({ engine: args.engine, doc: args.doc, variant: args.variant });\n const teardowns = await runPrologue({ engine: args.engine, doc: args.doc, scope: root });\n try {\n await runFlows({ ...args, root });\n } finally {\n // Whatever ends the pass, a failure or an `exit` on its way out of the run,\n // the suite still gives back what it opened.\n await runTeardowns(teardowns);\n }\n}\n\nasync function runFlows(args: {\n engine: Engine;\n flows: readonly FlowDecl[];\n hooks: SuiteHooks;\n root: Scope;\n}): Promise<void> {\n for (const flow of args.flows) {\n await runFlowWithHooks({ engine: args.engine, flow, hooks: args.hooks, root: args.root });\n if (args.engine.bail && args.engine.result.failed > 0) break;\n }\n}\n\nasync function runFlowWithHooks(args: {\n engine: Engine;\n flow: FlowDecl;\n hooks: SuiteHooks;\n root: Scope;\n}): Promise<void> {\n // A scope of its own, so what `beforeEach` opens dies with the flow that\n // needed it rather than lingering into the next one.\n const scope = args.root.child();\n const each = { engine: args.engine, scope };\n await runHooks({ ...each, hooks: args.hooks.beforeEach });\n await runFlow(args.engine, args.flow, scope);\n await runHooks({ ...each, hooks: args.hooks.afterEach });\n}\n\n/**\n * The scope a run reads from: the prelude, the plugin namespaces, `env`, the\n * matrix variant and the document's own globals. One per variant, so what one\n * variant binds is never visible to the next.\n */\nfunction rootScope(args: {\n engine: Engine;\n doc: Document;\n variant: Record<string, unknown>;\n}): Scope {\n const base = (): Scope => createBaseScope({ engine: args.engine, variant: args.variant });\n const root = base();\n const graph = args.engine.imports;\n // Before the document's own globals, so a local name of the same spelling\n // wins. That is the rule fragments already follow.\n if (graph) {\n bindImports({ document: args.doc, uri: args.engine.uri, scope: root, graph, base });\n }\n bindGlobals(args.doc, root);\n return root;\n}\n\n/** The cartesian product of the `matrix { … }` dimensions, else one empty variant. */\nfunction matrixVariants(engine: Engine, doc: Document): Record<string, unknown>[] {\n const matrix = doc.decls.find(isMatrixDecl);\n if (!matrix) return [{}];\n const scope = createScope();\n scope.set(\"env\", engine.env);\n return product(evaluate(matrix.body, scope) as Record<string, unknown>);\n}\n\nfunction product(dims: Record<string, unknown>): Record<string, unknown>[] {\n let combos: Record<string, unknown>[] = [{}];\n for (const [key, values] of Object.entries(dims)) {\n const list = Array.isArray(values) ? values : [values];\n combos = combos.flatMap((combo) => list.map((value) => ({ ...combo, [key]: value })));\n }\n return combos;\n}\n\n/** `@only` focuses, `@skip` drops, then the runner's own `--flow` / `--tags` filters. */\nfunction selectFlows(engine: Engine, flows: readonly FlowDecl[]): FlowDecl[] {\n const only = flows.filter((flow) => hasAnnotation(flow, \"only\"));\n const pool = only.length > 0 ? only : flows;\n const kept = pool.filter((flow) => !hasAnnotation(flow, \"skip\"));\n const named = kept.filter((flow) => matchesTitle(flow.title, engine.filter.flow));\n return byTags(named, engine.filter.tags);\n}\n\nfunction byTags(flows: FlowDecl[], tags: readonly string[] | undefined): FlowDecl[] {\n if (!tags || tags.length === 0) return flows;\n return flows.filter((flow) => readTags(flow).some((tag) => tags.includes(tag)));\n}\n\nfunction planOf(flows: readonly FlowDecl[]): RunPlan {\n return { flows: flows.map((flow) => ({ title: flow.title, steps: stepTitles(flow) })) };\n}\n\nfunction stepTitles(flow: FlowDecl): PlannedStep[] {\n return flow.body.stmts.filter(isStepDecl).map((step) => ({ title: step.title }));\n}\n","import type { Document } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport { collectHooks } from \"./collect.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { runHooks } from \"./run-lifecycle.js\";\nimport type { Teardown } from \"./run-prologue.js\";\nimport { runTeardowns } from \"./run-prologue.js\";\n\n/**\n * The program's `setup`, run before its first statement.\n *\n * It reads what the file declared, its functions, rather than what its\n * statements bind, because none of them has run yet. A `setup` that wants a\n * connection opens one.\n */\nexport async function runSetup(args: {\n engine: Engine;\n doc: Document;\n scope: Scope;\n}): Promise<void> {\n await runHooks({ engine: args.engine, hooks: collectHooks(args.doc).setup, scope: args.scope });\n}\n\n/** What the program will do on the way out, filled in as the program runs. */\nexport interface Ending {\n /** Cleanups the statements deferred, in the order they were written. */\n readonly deferred: Teardown[];\n}\n\n/**\n * Say how the program ends, before it starts.\n *\n * Registered up front because the ending has to be in place for an interrupt\n * that arrives mid-statement, while what it runs is decided later, as the\n * statements defer things. One entry rather than one per `defer`, so the order\n * is stated here instead of falling out of a stack: `teardown` first, while the\n * connections it needs are still open, then the deferred work in reverse.\n */\nexport function registerEnding(args: { engine: Engine; doc: Document; scope: Scope }): Ending {\n const ending: Ending = { deferred: [] };\n const teardown = collectHooks(args.doc).teardown;\n args.engine.cleanup.add(async () => {\n await runHooks({ engine: args.engine, hooks: teardown, scope: args.scope });\n await runTeardowns(ending.deferred);\n });\n return ending;\n}\n","import type { Document } from \"@venn-lang/core\";\nimport type { Scope } from \"../scope/index.js\";\nimport { absorbExit } from \"./absorb-exit.js\";\nimport { createBaseScope } from \"./base-scope.js\";\nimport { bindFunctions } from \"./bind-globals.js\";\nimport { bindImports } from \"./bind-imports.js\";\nimport type { Engine } from \"./engine.types.js\";\nimport { runPrologue } from \"./run-prologue.js\";\nimport { registerEnding, runSetup } from \"./script-lifecycle.js\";\n\n/**\n * Run a document as a program: its top-level statements, in order, top to\n * bottom, because the file itself is the entry point. Declarations (`flow`,\n * `fn`, `type`, …) are definitions and run only when something calls them.\n *\n * `setup`, `teardown` and `defer` are the program's own lifetime: `setup` runs\n * before the first statement and the rest are handed to the host to run on the\n * way out, because a program that serves outlives its last line.\n */\nexport async function runScript(engine: Engine, doc: Document): Promise<void> {\n const base = (): Scope => createBaseScope({ engine });\n const root = base();\n const graph = engine.imports;\n if (graph) bindImports({ document: doc, uri: engine.uri, scope: root, graph, base });\n bindFunctions(doc, root);\n engine.emitter.emit({ kind: \"run.started\", data: { plan: { flows: [] } } });\n const start = engine.clock.now();\n await absorbExit(engine, () => runProgram(engine, doc, root));\n const durationMs = engine.clock.now() - start;\n engine.emitter.emit({ kind: \"run.finished\", data: { ...engine.result, durationMs } });\n}\n\n/**\n * The program's lifetime: its `setup`, the ending it declared, then its\n * statements, all inside the one absorb, because `setup` is as much the program\n * as its first line. Outside it, an `exit` in `setup` would escape past\n * `run.finished` and leave the stream open.\n *\n * The ending is registered whatever happens to `setup`: a setup that exited or\n * failed still opened what it opened, and `teardown` is how it gives it back.\n */\nasync function runProgram(engine: Engine, doc: Document, scope: Scope): Promise<void> {\n const ending = registerEnding({ engine, doc, scope });\n await runSetup({ engine, doc, scope });\n // Collected into the ending as they are reached, so a program interrupted\n // halfway gives back exactly what it had managed to take.\n await runPrologue({ engine, doc, scope, into: ending.deferred });\n}\n","import type { MapLit, Problem } from \"@venn-lang/core\";\nimport { unknownOptions } from \"../scheduler/index.js\";\nimport type { CheckContext } from \"./check.types.js\";\n\n/**\n * Check the keys of an options map against the action's own schema.\n *\n * The runtime refuses an unknown key too, but only when the flow reaches that\n * line. Both read the same list and say the same sentence, so the editor can\n * mark the word before anything runs.\n */\nexport function checkOptions(args: {\n opts: MapLit | undefined;\n params: unknown;\n ctx: CheckContext;\n}): Problem[] {\n return unknownOptions({ opts: args.opts, params: args.params, uri: args.ctx.uri });\n}\n","import {\n type ActionCall,\n type AstNode,\n buildProblem,\n type CaptureStmt,\n CODES,\n type LetStmt,\n type MapLit,\n type Problem,\n} from \"@venn-lang/core\";\nimport { actionTarget, nodeSpan, PRELUDE, resolveTarget, splitTarget } from \"../scheduler/index.js\";\nimport type { CheckContext } from \"./check.types.js\";\nimport { checkOptions } from \"./check-options.js\";\n\n/** `http.get \"…\"` written as a statement. */\nexport function checkAction(call: ActionCall, ctx: CheckContext): Problem[] {\n return checkTarget({ node: call, target: call.target, opts: call.opts, ctx });\n}\n\n/**\n * `let auth = http.post url { … }`. Only the unmistakable call is checked: with\n * no arguments the path could be a field of a variable this pass cannot see, and\n * a false \"unknown action\" is worse than a missed one.\n */\nexport function checkLet(stmt: LetStmt, ctx: CheckContext): Problem[] {\n if (stmt.args.length === 0 && !stmt.opts) return [];\n const target = actionTarget(stmt.value);\n if (target === undefined) {\n return [problem(stmt, ctx, CODES.VN2003_UNKNOWN_ACTION, \"This is not an action to call.\")];\n }\n return checkTarget({ node: stmt, target, opts: stmt.opts, ctx });\n}\n\n/** `capture` is folded into `let`; say so where it is written. */\nexport function checkCapture(stmt: CaptureStmt, ctx: CheckContext): Problem {\n const title =\n \"`capture` was removed — use `let` for a value that changes, `const` for one that does not.\";\n return problem(stmt, ctx, CODES.VN5001_REMOVED_KEYWORD, title);\n}\n\n/**\n * A namespace is only usable when this file brought it in with `use` (or it is\n * a resource). Loading the whole stdlib must not make `use` optional.\n */\nfunction checkTarget(args: {\n node: AstNode;\n target: string;\n opts: MapLit | undefined;\n ctx: CheckContext;\n}): Problem[] {\n const { node, target, ctx } = args;\n if (PRELUDE.has(target)) return [];\n const written = splitTarget(target).namespace;\n if (ctx.bound.has(written)) return [];\n if (!ctx.imported.has(written)) return [missingImport(args, written)];\n const resolved = ctx.registry.action(resolveTarget(target, ctx.aliases));\n if (!resolved) {\n return [problem(node, ctx, CODES.VN2003_UNKNOWN_ACTION, `Unknown action \"${target}\".`)];\n }\n return checkOptions({ opts: args.opts, params: resolved.action.params, ctx });\n}\n\nfunction missingImport(\n args: { node: AstNode; target: string; ctx: CheckContext },\n namespace: string,\n): Problem {\n if (!args.ctx.registry.hasNamespace(namespace)) {\n const title = `Unknown action \"${args.target}\" — no loaded plugin provides it.`;\n return problem(args.node, args.ctx, CODES.VN2003_UNKNOWN_ACTION, title);\n }\n const title = `\"${namespace}\" is not imported in this file — add a \\`use\\` for its package.`;\n return problem(args.node, args.ctx, CODES.VN2007_NAMESPACE_NOT_IMPORTED, title);\n}\n\nfunction problem(\n node: AstNode,\n ctx: CheckContext,\n spec: (typeof CODES)[keyof typeof CODES],\n title: string,\n): Problem {\n return buildProblem({ spec, span: nodeSpan(node, ctx.uri), title });\n}\n","import {\n type AstNode,\n buildProblem,\n CODES,\n type DecoDecl,\n decoCannotCall,\n isActionCall,\n isDecoDecl,\n isLetStmt,\n type Problem,\n} from \"@venn-lang/core\";\nimport { actionTarget, nodeSpan, PRELUDE, splitTarget } from \"../scheduler/index.js\";\nimport type { CheckContext } from \"./check.types.js\";\n\n/**\n * Check a node written inside a `deco` body, which is not the program and so is\n * not resolved against the registry: `target.wrap(f)` is a verb on the handle\n * the body was handed, and expansion settles what the rest means. The one\n * refusal this pass can make is a verb from a plugin, which cannot work in a\n * `deco` because a decorator runs before the program exists.\n *\n * @returns The node's problems, or `undefined` when the node is not inside a\n * `deco`, which tells the caller to apply the ordinary document checks instead.\n */\nexport function checkInsideDeco(node: AstNode, ctx: CheckContext): Problem[] | undefined {\n const deco = enclosingDeco(node);\n if (!deco) return undefined;\n const target = calledTarget(node);\n const refused = target === undefined ? undefined : pluginVerb({ deco, target, ctx });\n return refused ? [problem(node, ctx, refused)] : [];\n}\n\n/** The `deco` this node is written inside, if any. */\nfunction enclosingDeco(node: AstNode): DecoDecl | undefined {\n for (let at: AstNode | undefined = node; at; at = at.$container) {\n if (isDecoDecl(at)) return at;\n }\n return undefined;\n}\n\n/** The dotted name this statement calls, if calling is what it does. */\nfunction calledTarget(node: AstNode): string | undefined {\n if (isActionCall(node)) return node.target;\n if (!isLetStmt(node) || (node.args.length === 0 && !node.opts)) return undefined;\n return actionTarget(node.value);\n}\n\n/**\n * Why this call cannot be made from here, if it cannot. Only a head the file can\n * already account for is refused: an imported namespace, a resource, a namespace\n * some loaded plugin owns. Anything else is a name only expansion resolves, and\n * guessing at it would put an error on every well-written decorator.\n */\nfunction pluginVerb(args: {\n deco: DecoDecl;\n target: string;\n ctx: CheckContext;\n}): string | undefined {\n const { namespace } = splitTarget(args.target);\n if (PRELUDE.has(args.target) || paramNames(args.deco).has(namespace)) return undefined;\n if (!reachesTheWorld(namespace, args.ctx)) return undefined;\n return decoCannotCall(args.target);\n}\n\nfunction reachesTheWorld(namespace: string, ctx: CheckContext): boolean {\n return (\n ctx.imported.has(namespace) || ctx.bound.has(namespace) || ctx.registry.hasNamespace(namespace)\n );\n}\n\nfunction paramNames(deco: DecoDecl): Set<string> {\n return new Set((deco.params?.params ?? []).map((param) => param.name));\n}\n\nfunction problem(node: AstNode, ctx: CheckContext, title: string): Problem {\n return buildProblem({ spec: CODES.VN2016_DECO_IMPURE, span: nodeSpan(node, ctx.uri), title });\n}\n","import {\n type AstNode,\n buildProblem,\n CODES,\n isMember,\n type Problem,\n type Span,\n} from \"@venn-lang/core\";\nimport { actionTarget, nodeSpan } from \"../scheduler/index.js\";\nimport type { CheckContext } from \"./check.types.js\";\n\n/** `env.NAME` as it appears inside a `${…}` placeholder. */\nconst ENV_READ = /\\benv\\.([A-Za-z_]\\w*)/g;\n\n/** Always present: the runner sets it to the `--env` that was selected. */\nconst BUILT_IN = new Set([\"name\"]);\n\n/**\n * Match every `env.*` read against what `venn.toml` declares, so a typo is an\n * error rather than an empty string and a puzzling 404.\n *\n * Nothing is reported when the manifest could not be read: a wrong error about a\n * variable that does exist is worse than no error at all.\n */\nexport function checkEnv(node: AstNode, ctx: CheckContext): Problem[] {\n if (!isMember(node) || isMember(node.$container)) return [];\n const path = actionTarget(node);\n const name = path?.startsWith(\"env.\") ? path.slice(4) : undefined;\n if (name === undefined || name.includes(\".\")) return [];\n const span = nodeSpan(node, ctx.uri);\n if (!ctx.imported.has(\"env\")) return [notImported(span)];\n if (!ctx.env || declared(name, ctx.env)) return [];\n return [envProblem(name, span, ctx)];\n}\n\n/**\n * Configuration is brought in like anything else. Reading `env.*` without saying\n * where it comes from is the same hole `use` closes for actions and matchers:\n * the reader should not have to know which names are magic.\n */\nfunction notImported(span: Span): Problem {\n return buildProblem({\n spec: CODES.VN2007_NAMESPACE_NOT_IMPORTED,\n span,\n title: '\"env\" is not imported in this file — add `use \"venn/env\"`.',\n });\n}\n\n/** The same checks for text the parser never turned into nodes: `\"${env.X}\"`. */\nexport function envProblemsIn(source: string, span: Span, ctx: CheckContext): Problem[] {\n const names = [...source.matchAll(ENV_READ)].map((match) => match[1] ?? \"\").filter(Boolean);\n if (names.length === 0) return [];\n if (!ctx.imported.has(\"env\")) return [notImported(span)];\n const env = ctx.env;\n if (!env) return [];\n return names.filter((name) => !declared(name, env)).map((name) => envProblem(name, span, ctx));\n}\n\nfunction declared(name: string, env: ReadonlySet<string>): boolean {\n return env.has(name) || BUILT_IN.has(name);\n}\n\n/** The undeclared-variable problem, with the nearest declared name as a hint. */\nexport function envProblem(name: string, span: Span, ctx: CheckContext): Problem {\n const hint = nearest(name, [...(ctx.env ?? [])]);\n const title = hint\n ? `\"env.${name}\" is not declared in venn.toml — did you mean \"env.${hint}\"?`\n : `\"env.${name}\" is not declared in venn.toml.`;\n return buildProblem({ spec: CODES.VN2006_UNKNOWN_ENV, span, title });\n}\n\nfunction nearest(name: string, known: readonly string[]): string | undefined {\n const best = known\n .map((candidate) => ({ candidate, distance: distance(name, candidate) }))\n .sort((left, right) => left.distance - right.distance)[0];\n const tolerance = Math.max(2, Math.floor(name.length / 3));\n return best && best.distance <= tolerance ? best.candidate : undefined;\n}\n\n/** Levenshtein edit distance, kept to two rows because only the score is needed. */\nfunction distance(left: string, right: string): number {\n let previous = Array.from({ length: right.length + 1 }, (_value, index) => index);\n for (let i = 1; i <= left.length; i += 1) {\n const current = [i];\n for (let j = 1; j <= right.length; j += 1) {\n const cost = left[i - 1] === right[j - 1] ? 0 : 1;\n current[j] = Math.min(\n (current[j - 1] ?? 0) + 1,\n (previous[j] ?? 0) + 1,\n (previous[j - 1] ?? 0) + cost,\n );\n }\n previous = current;\n }\n return previous[right.length] ?? 0;\n}\n","import { buildProblem, type Call, CODES, isRef, type Problem } from \"@venn-lang/core\";\nimport { nodeSpan } from \"../scheduler/index.js\";\nimport type { CheckContext } from \"./check.types.js\";\n\n/**\n * Refuse a fragment called as though it were a function.\n *\n * The two look alike where they are written but are different kinds of thing: a\n * `fn` gives back a value, a `fragment` gives back steps, and steps are recorded\n * in the report, can fail and belong to a flow. So a fragment is invoked with\n * `run`. `run entrar(…)` never reaches here: its target is a name, not an\n * expression.\n *\n * @param call The call expression to inspect.\n * @param ctx The document's resolved check context.\n * @returns A `VN3013` problem, or `undefined` when the callee is not a fragment.\n */\nexport function checkFragmentCall(call: Call, ctx: CheckContext): Problem | undefined {\n const callee = call.callee;\n if (!isRef(callee) || !ctx.fragments.has(callee.name)) return undefined;\n return buildProblem({\n spec: CODES.VN3013_NOT_CALLABLE,\n span: nodeSpan(call, ctx.uri),\n title: `${callee.name} is a fragment, so it cannot be called for a value.`,\n note: `Invoke it with \\`run ${callee.name}(…)\\`, which records its steps in the report.`,\n });\n}\n","import {\n type AstNode,\n buildProblem,\n CODES,\n type InterpolationSlot,\n isStringLit,\n type Problem,\n parseExpression,\n type Span,\n scanInterpolations,\n} from \"@venn-lang/core\";\nimport type { CheckContext } from \"./check.types.js\";\nimport { envProblemsIn } from \"./check-env.js\";\n\n/**\n * Check each `${…}` placeholder in a string literal and point at the placeholder\n * itself, not at the whole string. A slot that does not parse would otherwise\n * evaluate to an empty string, so a typo inside a URL fails as a puzzling 404.\n */\nexport function checkInterpolation(node: AstNode, ctx: CheckContext): Problem[] {\n const cst = node.$cstNode;\n if (!isStringLit(node) || !cst) return [];\n return scanInterpolations(cst.text).flatMap((slot) =>\n inSlot(slot, spanOf(slot, { cst, uri: ctx.uri }), ctx),\n );\n}\n\n/** A URL is where `env` reads live, so they are checked here as well as in the AST. */\nfunction inSlot(slot: InterpolationSlot, span: Span, ctx: CheckContext): Problem[] {\n if (!parseExpression(slot.source)) return [unreadable(slot, span)];\n return envProblemsIn(slot.source, span, ctx);\n}\n\nfunction unreadable(slot: InterpolationSlot, span: Span): Problem {\n return buildProblem({\n spec: CODES.VN1002_PARSE,\n span,\n title: `Cannot read \\`\\${${slot.source}}\\` — that is not an expression.`,\n });\n}\n\n/** The span of the placeholder itself: line and column follow the string's own start. */\nfunction spanOf(\n slot: InterpolationSlot,\n target: {\n cst: { offset: number; range?: { start: { line: number; character: number } } };\n uri: string;\n },\n): Span {\n const start = target.cst.range?.start;\n return {\n uri: target.uri,\n offset: target.cst.offset + slot.start,\n length: slot.end - slot.start,\n line: (start?.line ?? 0) + 1,\n column: (start?.character ?? 0) + 1 + slot.start,\n };\n}\n","import {\n type AstNode,\n buildProblem,\n CODES,\n isCall,\n isLetStmt,\n isMember,\n type Member,\n type Problem,\n} from \"@venn-lang/core\";\nimport { actionTarget, nodeSpan, resolveTarget } from \"../scheduler/index.js\";\nimport type { CheckContext } from \"./check.types.js\";\n\n/**\n * A plugin verb named but never called.\n *\n * `let id = data.faker.uuid` runs the verb, because the runtime recognises a\n * bare path that names an action. The same words inside an expression evaluate\n * to the verb itself, so a program meaning to read a value gets a function.\n * Rather than guess which was meant, this asks for the parentheses.\n */\nexport function checkUncalledAction(node: AstNode, ctx: CheckContext): Problem | undefined {\n if (!isMember(node) || !readsAsValue(node)) return undefined;\n const target = actionTarget(node);\n if (target === undefined) return undefined;\n if (!ctx.registry.action(resolveTarget(target, ctx.aliases))) return undefined;\n return buildProblem({\n spec: CODES.VN2008_UNCALLED_ACTION,\n span: nodeSpan(node, ctx.uri),\n title: `\\`${target}\\` is a verb, not a value — write \\`${target}()\\` to call it.`,\n });\n}\n\n/**\n * Where naming the verb produces the verb. Skipped when it is the head of a\n * longer path or the thing being called, and when it stands as a statement's\n * value, which the runtime calls anyway.\n */\nfunction readsAsValue(node: Member): boolean {\n const parent = node.$container;\n return !isMember(parent) && !isCall(parent) && !isLetStmt(parent);\n}\n","import {\n type AstNode,\n buildProblem,\n CODES,\n isActionCall,\n isCall,\n isCaptureStmt,\n isLetStmt,\n isMatcherClause,\n isRunStmt,\n type MatcherClause,\n type Problem,\n type RunStmt,\n walkAst,\n} from \"@venn-lang/core\";\nimport {\n collectAliases,\n collectBoundNames,\n collectNamespaces,\n nodeSpan,\n} from \"../scheduler/index.js\";\nimport type { CheckArgs, CheckContext } from \"./check.types.js\";\nimport { checkAction, checkCapture, checkLet } from \"./check-calls.js\";\nimport { checkInsideDeco } from \"./check-deco-body.js\";\nimport { checkEnv } from \"./check-env.js\";\nimport { checkFragmentCall } from \"./check-fragment-call.js\";\nimport { checkInterpolation } from \"./check-interpolation.js\";\nimport { checkUncalledAction } from \"./check-uncalled.js\";\n\n/**\n * Statically resolve every action, matcher and fragment reference in a parsed\n * document. The errors the runner would otherwise raise mid-run are surfaced all\n * at once, each with its source span.\n *\n * @param args Document, registry, known fragments and the declared `env` names.\n * @returns One `Problem` per unresolved reference; empty when the document is clean.\n */\nexport function checkDocument(args: CheckArgs): Problem[] {\n const ctx: CheckContext = {\n registry: args.registry,\n fragments: args.fragments,\n aliases: collectAliases(args.document, args.registry),\n imported: collectNamespaces(args.document, args.registry),\n bound: collectBoundNames(args.document),\n env: args.env ? new Set(args.env) : undefined,\n uri: args.uri ?? \"memory://inline.vn\",\n };\n const problems: Problem[] = [];\n for (const node of walkAst(args.document)) {\n const inDeco = checkInsideDeco(node, ctx);\n if (inDeco) problems.push(...inDeco);\n else problems.push(...everyCheck(node, ctx));\n }\n return problems;\n}\n\nfunction everyCheck(node: AstNode, ctx: CheckContext): Problem[] {\n return [\n ...checkNode(node, ctx),\n ...checkEnv(node, ctx),\n ...checkInterpolation(node, ctx),\n ...one(checkUncalledAction(node, ctx)),\n ];\n}\n\nfunction checkNode(node: AstNode, ctx: CheckContext): Problem[] {\n if (isActionCall(node)) return checkAction(node, ctx);\n if (isLetStmt(node)) return checkLet(node, ctx);\n if (isCaptureStmt(node)) return [checkCapture(node, ctx)];\n if (isMatcherClause(node)) return one(checkMatcher(node, ctx));\n if (isRunStmt(node)) return one(checkFragment(node, ctx));\n if (isCall(node)) return one(checkFragmentCall(node, ctx));\n return [];\n}\n\nfunction one(problem: Problem | undefined): Problem[] {\n return problem ? [problem] : [];\n}\n\n/**\n * A matcher comes from a plugin like any action, so the file has to bring that\n * plugin in. Resolving against the whole loaded stdlib would make `use` decorative.\n */\nfunction checkMatcher(clause: MatcherClause, ctx: CheckContext): Problem | undefined {\n const owner = ctx.registry.matcher(clause.name);\n if (!owner) {\n return problem(clause, ctx, CODES.VN2004_UNKNOWN_MATCHER, `Unknown matcher \"${clause.name}\".`);\n }\n if (ctx.imported.has(owner.plugin.namespace)) return undefined;\n const title = `\"${clause.name}\" comes from \"${owner.plugin.namespace}\", which is not imported in this file.`;\n return problem(clause, ctx, CODES.VN2007_NAMESPACE_NOT_IMPORTED, title);\n}\n\nfunction checkFragment(stmt: RunStmt, ctx: CheckContext): Problem | undefined {\n if (ctx.fragments.has(stmt.target)) return undefined;\n return problem(stmt, ctx, CODES.VN2005_UNKNOWN_FRAGMENT, `Unknown fragment \"${stmt.target}\".`);\n}\n\nfunction problem(\n node: AstNode,\n ctx: CheckContext,\n spec: (typeof CODES)[keyof typeof CODES],\n title: string,\n): Problem {\n return buildProblem({ spec, span: nodeSpan(node, ctx.uri), title });\n}\n","import {\n buildProblem,\n CODES,\n type Document,\n isDecoDecl,\n isFnDecl,\n isFragmentDecl,\n isValueImport,\n type Problem,\n type ValueImport,\n} from \"@venn-lang/core\";\nimport type { ImportGraph } from \"../scheduler/index.js\";\nimport { nodeSpan } from \"../scheduler/index.js\";\n\n/**\n * Check every name a file imports against what the file it names publishes.\n * Otherwise a misspelt import stays quietly `undefined` until something calls\n * it, and the run blames the call site rather than the import.\n *\n * @param args The importing document, its URI, and the resolved import graph.\n * @returns One `VN2009` problem per name the target does not publish.\n */\nexport function checkImports(args: {\n document: Document;\n uri: string;\n graph: ImportGraph;\n}): Problem[] {\n const problems: Problem[] = [];\n for (const decl of args.document.imports) {\n if (!isValueImport(decl)) continue;\n const target = args.graph.resolve(args.uri, decl.path);\n const module = args.graph.modules.get(target);\n // A path that reads nothing is already reported by whoever tried to read it.\n if (module) problems.push(...missing({ decl, module, uri: args.uri, path: decl.path }));\n }\n return problems;\n}\n\nfunction missing(args: {\n decl: ValueImport;\n module: Document;\n uri: string;\n path: string;\n}): Problem[] {\n const published = exported(args.module);\n return args.decl.names\n .filter((name) => !published.has(name))\n .map((name) =>\n buildProblem({\n spec: CODES.VN2009_NOT_EXPORTED,\n span: nodeSpan(args.decl, args.uri),\n title: `\"${args.path}\" does not publish ${name}.`,\n note: hint(name, args.module),\n }),\n );\n}\n\n/**\n * Why it is not there: written but kept private, or not written at all. The two\n * are different mistakes with different fixes, and a reader told only \"not\n * published\" goes looking for a typo they did not make.\n */\nfunction hint(name: string, module: Document): string {\n const declared = module.decls.some(\n (decl) =>\n (isFnDecl(decl) || isFragmentDecl(decl) || isDecoDecl(decl)) &&\n (decl as { name?: string }).name === name,\n );\n return declared\n ? `It is declared there, but not marked \\`pub\\`.`\n : `Nothing of that name is declared there.`;\n}\n\n/** Everything a file marked `pub`: functions, fragments and decorators alike. */\nfunction exported(document: Document): Set<string> {\n const names = new Set<string>();\n for (const decl of document.decls) {\n if (!isFnDecl(decl) && !isFragmentDecl(decl) && !isDecoDecl(decl)) continue;\n if (decl.export) names.add(decl.name);\n }\n return names;\n}\n","import type { DecoratorDefinition, ExpandContext } from \"@venn-lang/core\";\nimport type { RetrySpec } from \"../scheduler/annotations.js\";\n\n/** Where each of these may sit. Named once, so a wrong target is caught, not ignored. */\nconst RUNNABLE = [\"FlowDecl\", \"StepDecl\", \"GroupDecl\"] as const;\n\n/**\n * The decorators the language ships with, written the same way anyone else's\n * are. They go through the same expansion as a plugin decorator and leave\n * metadata on the node, because `@retry(2)` says something the grammar has no\n * other word for. Keeping them here rather than as special cases in the\n * scheduler is what makes the built-ins a stdlib instead of reserved words.\n */\nexport const builtinDecorators: readonly DecoratorDefinition[] = [\n flag(\"skip\", \"Do not run this.\"),\n flag(\"only\", \"Run this and nothing beside it.\"),\n flag(\"serial\", \"Never run this alongside another flow.\"),\n {\n name: \"tags\",\n doc: \"Label this for `--tags`.\",\n targets: [...RUNNABLE],\n expand: (ctx) =>\n ctx.meta(\n \"tags\",\n ctx.args.map(String).filter((tag) => tag !== \"\"),\n ),\n },\n {\n name: \"timeout\",\n doc: \"Give up after this long.\",\n targets: [...RUNNABLE],\n expand: (ctx) => ctx.meta(\"timeout\", durationMs(ctx.args[0])),\n },\n {\n name: \"retry\",\n doc: \"Run again on failure, up to n times.\",\n targets: [...RUNNABLE],\n expand: (ctx) => ctx.meta(\"retry\", retryOf(ctx)),\n },\n {\n name: \"lock\",\n doc: \"Hold this name for the duration; nothing else holding it runs.\",\n targets: [...RUNNABLE],\n expand: (ctx) => ctx.meta(\"lock\", ctx.args[0] === undefined ? undefined : String(ctx.args[0])),\n },\n {\n name: \"flaky\",\n doc: \"Tolerate failures up to this ratio.\",\n targets: [...RUNNABLE],\n expand: (ctx) => ctx.meta(\"flaky\", ratioOf(ctx.args[0])),\n },\n];\n\n/** A decorator with nothing to say beyond having been written. */\nfunction flag(name: string, doc: string): DecoratorDefinition {\n return {\n name,\n doc,\n targets: [...RUNNABLE],\n expand: (ctx) => ctx.meta(name, true),\n };\n}\n\nfunction retryOf(ctx: ExpandContext): RetrySpec {\n const opts = asRecord(ctx.args[1]);\n return {\n attempts: Math.max(0, Math.floor(Number(ctx.args[0]) || 0)),\n backoffMs: durationMs(opts.backoff) ?? 0,\n factor: Number(opts.factor ?? 1) || 1,\n };\n}\n\n/** A bare `@flaky` tolerates everything; a number is the ratio it tolerates. */\nfunction ratioOf(value: unknown): number {\n if (value === undefined) return 1;\n return typeof value === \"number\" ? value : 0;\n}\n\nfunction durationMs(value: unknown): number | undefined {\n if (typeof value === \"number\") return value;\n const duration = value as { kind?: string; ms?: number };\n return duration?.kind === \"duration\" ? duration.ms : undefined;\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> {\n return typeof value === \"object\" && value !== null ? (value as Record<string, unknown>) : {};\n}\n","import type { DecoratorDefinition, DecoratorSource } from \"@venn-lang/core\";\nimport type { PluginDefinition } from \"@venn-lang/sdk\";\nimport { builtinDecorators } from \"./builtin-decorators.js\";\n\n/**\n * Every decorator this run understands: the ones the language ships with, plus\n * whatever the loaded plugins contribute.\n *\n * A plugin's decorator overrides a built-in of the same name on purpose. The\n * built-ins are a stdlib, not a reserved word list, and a project that wants its\n * own `@retry` is entitled to it.\n *\n * @param plugins The plugins loaded for this run, in load order.\n * @returns A source that looks a decorator up by name.\n */\nexport function createDecoratorSource(plugins: readonly PluginDefinition[]): DecoratorSource {\n const byName = new Map<string, DecoratorDefinition>();\n for (const decorator of builtinDecorators) byName.set(decorator.name, decorator);\n for (const plugin of plugins) {\n for (const decorator of plugin.decorators ?? []) {\n byName.set(decorator.name, decorator as DecoratorDefinition);\n }\n }\n return { get: (name) => byName.get(name) };\n}\n","import type { Clock } from \"@venn-lang/contracts\";\nimport type { Envelope, RunId } from \"@venn-lang/core\";\nimport type { EventSink } from \"../eventsink/index.js\";\nimport type { Emitter } from \"./emitter.types.js\";\n\n/** Build the sole emitter: it owns `seq` and stamps `ts` from the runner's clock. */\nexport function createEmitter(args: { sink: EventSink; run: RunId; clock: Clock }): Emitter {\n let seq = 0;\n return {\n emit: ({ kind, data, node }) => {\n seq += 1;\n const ts = new Date(args.clock.now()).toISOString();\n args.sink.emit({ seq, ts, run: args.run, kind, node, data } as Envelope);\n },\n };\n}\n","import type { Clock, Random } from \"@venn-lang/contracts\";\nimport type { RunId } from \"@venn-lang/core\";\n\n/**\n * Mint a run id from the host clock and random source, so a seeded run is\n * reproducible. Real ULID minting comes later.\n */\nexport function newRunId(args: { clock: Clock; random: Random }): RunId {\n const rand = Math.floor(args.random.next() * 1e9).toString(36);\n return `run-${args.clock.now().toString(36)}-${rand}` as RunId;\n}\n","import type { Port } from \"@venn-lang/contracts\";\nimport type { EventSink } from \"./event-sink.types.js\";\n\n/**\n * The port every run event is written to. Bound at startup by whoever assembles\n * the host: the CLI binds NDJSON on stdout, tests bind the memory double.\n */\nexport const EventSinkPort: Port<EventSink> = {\n id: \"venn.port.event-sink\",\n version: 1,\n requires: [],\n methods: [\"emit\"],\n};\n","import type { Envelope } from \"@venn-lang/core\";\nimport type { MemorySink } from \"./event-sink.types.js\";\n\n/**\n * In-memory sink (the test double): keeps every envelope for assertions.\n *\n * @returns A sink whose `envelopes` array grows in emission order.\n */\nexport function createMemorySink(): MemorySink {\n const envelopes: Envelope[] = [];\n return {\n envelopes,\n emit: (envelope) => {\n envelopes.push(envelope);\n },\n };\n}\n","import type { EventSink } from \"./event-sink.types.js\";\n\n/**\n * NDJSON sink: one JSON envelope per line. The `write` sink is injected (the CLI\n * passes stdout) so this file stays neutral and needs no `node:*`.\n *\n * @param args.write Receives each line, newline included.\n * @returns A sink that serialises every envelope it is given.\n */\nexport function createNdjsonSink(args: { write: (line: string) => void }): EventSink {\n return {\n emit: (envelope) => args.write(`${JSON.stringify(envelope)}\\n`),\n };\n}\n","import { bindPort, type HostCapability, type Port, VennError } from \"@venn-lang/contracts\";\nimport type { PortBinding, PortResolver } from \"./port-resolver.types.js\";\n\n/**\n * Resolve ports from a set of bindings, running capability and shape negotiation\n * at the moment of resolution.\n *\n * @param args.bindings Every port the host chose to bind, with its implementation.\n * @param args.caps What this host offers, checked against each port's `requires`.\n * @returns A resolver whose `resolve` throws `VN7002` when the port is unbound,\n * and whatever `bindPort` raises when the capability or shape check fails.\n */\nexport function createPortResolver(args: {\n bindings: readonly PortBinding[];\n caps: readonly HostCapability[];\n}): PortResolver {\n const byId = new Map(args.bindings.map((binding) => [binding.port.id, binding] as const));\n return {\n resolve: <T>(port: Port<T>): T =>\n resolveOne({ port, binding: byId.get(port.id), caps: args.caps }),\n };\n}\n\nfunction resolveOne<T>(args: {\n port: Port<T>;\n binding: PortBinding | undefined;\n caps: readonly HostCapability[];\n}): T {\n if (!args.binding) throw unbound(args.port.id);\n return bindPort({ port: args.port, impl: args.binding.impl, caps: args.caps });\n}\n\nfunction unbound(id: string): VennError {\n return new VennError({\n code: \"VN7002\",\n message: `No implementation bound for port \"${id}\".`,\n detail: { port: id },\n });\n}\n","import { type HostCapability, missingCapabilities, VennError } from \"@venn-lang/contracts\";\nimport type { ActionDefinition, PluginDefinition } from \"@venn-lang/sdk\";\nimport type { Registry, ResolvedAction, ResolvedMatcher } from \"./registry.types.js\";\n\n/**\n * Ingest plugins after negotiating each plugin's capabilities against the host.\n *\n * @param args.plugins The plugins to index, in load order; later ones win a clash.\n * @param args.caps The capabilities this host offers.\n * @returns A registry resolving actions, matchers and namespaces.\n * @throws VennError `VN2010` when a plugin requires a capability the host lacks.\n */\nexport function buildRegistry(args: {\n plugins: readonly PluginDefinition[];\n caps: readonly HostCapability[];\n}): Registry {\n for (const plugin of args.plugins) assertPluginCaps({ plugin, caps: args.caps });\n return indexPlugins(args.plugins);\n}\n\nfunction assertPluginCaps(args: {\n plugin: PluginDefinition;\n caps: readonly HostCapability[];\n}): void {\n const missing = missingCapabilities({ requires: args.plugin.requires ?? [], caps: args.caps });\n if (missing.length === 0) return;\n const list = missing.map((cap) => `\"${cap}\"`).join(\", \");\n throw new VennError({\n code: \"VN2010\",\n message: `Plugin \"${args.plugin.name}\" requires capability ${list}, absent from this host.`,\n detail: { plugin: args.plugin.name, missing },\n });\n}\n\nfunction indexPlugins(plugins: readonly PluginDefinition[]): Registry {\n const actions = new Map<string, ResolvedAction>();\n const matchers = new Map<string, ResolvedMatcher>();\n const namespaces = new Set<string>();\n const packages = new Map<string, string>();\n for (const plugin of plugins) addPlugin({ plugin, actions, matchers, namespaces, packages });\n return {\n action: ({ namespace, name }) => actions.get(`${namespace}.${name}`),\n matcher: (name) => matchers.get(name),\n hasNamespace: (namespace) => namespaces.has(namespace),\n namespaceOf: (pkg) => packages.get(pkg),\n actions: () => listActions(actions),\n };\n}\n\nfunction listActions(\n actions: Map<string, ResolvedAction>,\n): { namespace: string; name: string; action: ActionDefinition }[] {\n return [...actions].map(([key, resolved]) => ({\n namespace: key.slice(0, key.indexOf(\".\")),\n name: key.slice(key.indexOf(\".\") + 1),\n action: resolved.action,\n }));\n}\n\nfunction addPlugin(args: {\n plugin: PluginDefinition;\n actions: Map<string, ResolvedAction>;\n matchers: Map<string, ResolvedMatcher>;\n namespaces: Set<string>;\n packages: Map<string, string>;\n}): void {\n const { plugin, actions, matchers, namespaces, packages } = args;\n namespaces.add(plugin.namespace);\n packages.set(plugin.name, plugin.namespace);\n for (const action of plugin.actions ?? []) {\n actions.set(`${plugin.namespace}.${action.name}`, { plugin, action });\n }\n for (const matcher of plugin.matchers ?? []) {\n matchers.set(matcher.name, { plugin, matcher });\n }\n}\n","import type { Host, Port } from \"@venn-lang/contracts\";\nimport { invoke } from \"@venn-lang/core\";\nimport type { ActionContext } from \"@venn-lang/sdk\";\nimport type { PortResolver } from \"../ports/index.js\";\n\n/** Build the context an action's `run` receives from the host and port resolver. */\nexport function createActionContext(args: {\n host: Host;\n ports: PortResolver;\n config?: Record<string, unknown>;\n}): ActionContext {\n return {\n port: <T>(port: Port<T>): T => args.ports.resolve(port),\n secrets: args.host.secrets,\n config: args.config ?? {},\n log: (message) => args.host.log.log({ level: \"info\", message }),\n redact: () => {},\n invoke: (fn, values) => invoke(fn, values),\n };\n}\n","import {\n type Document,\n expand,\n type FragmentDecl,\n type Problem,\n type RunId,\n} from \"@venn-lang/core\";\nimport { createActionContext } from \"../context/index.js\";\nimport { createDecoratorSource } from \"../decorators/index.js\";\nimport { createEmitter, newRunId } from \"../emit/index.js\";\nimport { createPortResolver } from \"../ports/index.js\";\nimport { buildRegistry } from \"../registry/index.js\";\nimport {\n absorbExit,\n collectAliases,\n collectConfig,\n collectFragments,\n createCleanupList,\n type Engine,\n runDocument,\n runScript,\n} from \"../scheduler/index.js\";\nimport type { Runner, RunnerArgs, RunOnceInput, RunResult } from \"./runner.types.js\";\n\n/**\n * Build a runner: negotiate plugins and wire ports once, then reuse them for\n * every run.\n *\n * @param args The host, the plugins, the event sink and the per-run options.\n * @returns A runner exposing test mode (`run`) and script mode (`script`).\n * @throws VennError `VN2010` when a plugin requires a capability the host lacks.\n */\nexport function createRunner(args: RunnerArgs): Runner {\n const registry = buildRegistry({ plugins: args.plugins, caps: args.host.caps });\n const resolver = createPortResolver({ bindings: args.ports ?? [], caps: args.host.caps });\n const decorators = createDecoratorSource(args.plugins);\n const drive = (walk: Walk) => (document: Document) => {\n // Decorators run first, on every path: what the scheduler walks is the tree\n // they left, not the one the parser produced.\n const expansion = expand({ document, decorators, uri: args.uri, imported: args.moduleDecos });\n return runOnce({ args, registry, resolver, document }, walk, expansion.problems);\n };\n return { run: drive(runDocument), script: drive(runScript) };\n}\n\ntype Walk = (engine: Engine, document: Document) => Promise<void>;\n\nasync function runOnce(input: RunOnceInput, walk: Walk, problems: Problem[]): Promise<RunResult> {\n const run = newRunId({ clock: input.args.host.clock, random: input.args.host.random });\n const engine = buildEngine(input, run);\n // The walk absorbs an `exit` of its own so the run still ends tidily; this is\n // the backstop for one thrown where no walk was left to absorb it.\n await absorbExit(engine, () => walk(engine, input.document));\n return {\n run,\n problems,\n passed: engine.result.passed,\n failed: engine.result.failed,\n exitCode: engine.exit,\n };\n}\n\nfunction buildEngine(input: RunOnceInput, run: RunId): Engine {\n const { args, registry } = input;\n return {\n registry,\n emitter: createEmitter({ sink: args.sink, run, clock: args.host.clock }),\n clock: args.host.clock,\n lock: args.host.lock,\n uri: args.uri ?? \"memory://inline.vn\",\n result: { passed: 0, failed: 0 },\n flaky: new Map(),\n filter: args.filter ?? {},\n bail: args.bail,\n cleanup: args.cleanup ?? createCleanupList(),\n ...documentParts(input),\n };\n}\n\n/** Everything derived from the document being run: config, fragments, aliases. */\nfunction documentParts(input: RunOnceInput) {\n const { args, registry, resolver, document } = input;\n const env = args.env ?? {};\n const config = collectConfig(document, env);\n return {\n ctx: createActionContext({ host: args.host, ports: resolver, config }),\n fragments: mergeFragments(collectFragments(document), args.moduleFragments),\n imports: args.modules,\n aliases: collectAliases(document, registry),\n env,\n };\n}\n\n/** Local fragments take precedence over imported ones of the same name. */\nfunction mergeFragments(\n local: Map<string, FragmentDecl>,\n imported: Map<string, FragmentDecl> | undefined,\n): Map<string, FragmentDecl> {\n if (!imported) return local;\n const merged = new Map(imported);\n for (const [name, fragment] of local) merged.set(name, fragment);\n return merged;\n}\n","import {\n type Document,\n type FragmentDecl,\n type ImportedDeco,\n isDecoDecl,\n isFragmentDecl,\n isPackageSpecifier,\n isUseDecl,\n isValueImport,\n parse,\n} from \"@venn-lang/core\";\n\n/** Read source by URI and resolve a specifier relative to a base URI. */\nexport interface ModuleIo {\n read: (uri: string) => Promise<string>;\n resolve: (base: string, spec: string) => string;\n}\n\n/**\n * Loading a package that was installed rather than written here.\n *\n * Kept apart from {@link ModuleIo} because the two answer different questions:\n * one reads `.vn` source to be parsed, the other hands back a module that is\n * already a value. A host without one simply has no packages, which is the state\n * of every run in a Web Worker and not an error.\n */\nexport interface NpmModules {\n load(spec: string): Promise<Record<string, unknown> | undefined>;\n}\n\n/** What a run needs from the files it reaches: their fragments, decos and plugins. */\nexport interface ResolvedImports {\n fragments: Map<string, FragmentDecl>;\n /** The `pub deco`s reachable through the import graph, with the file each came from. */\n decos: Map<string, ImportedDeco>;\n /** Every package `use`d anywhere in the graph, so only those need loading. */\n packages: Set<string>;\n /**\n * What each npm specifier loaded to, by the name that was written.\n *\n * Loaded here, before anything runs, because binding a scope cannot wait: by\n * the time a name is looked up the module has to already be a value.\n */\n npm: Map<string, Record<string, unknown>>;\n /**\n * Every module reached, parsed, keyed by its resolved URI.\n *\n * Carried whole rather than reduced to a list of exported names, because a\n * `pub fn` is a closure over the file it was written in: it calls that file's\n * private helpers and reads that file's globals. Handing over the function\n * without the place it came from produces something that resolves and then\n * fails on its first line.\n */\n modules: Map<string, Document>;\n}\n\n/**\n * Walk the import graph from one document, parsing every `.vn` file it reaches\n * and loading every package it names. A file already seen is skipped, so a cycle\n * ends rather than loops. A file that cannot be read is skipped in silence:\n * whoever tried to read it reports the failure.\n *\n * @param args The entry document, its URI, the source reader and the optional\n * package loader.\n * @returns The exported fragments and decos, the packages, the loaded npm\n * modules and every parsed document, keyed by resolved URI.\n */\nexport async function resolveImports(args: {\n document: Document;\n uri: string;\n io: ModuleIo;\n /** Absent when the host has no way to load one: a Worker, most tests. */\n npm?: NpmModules;\n}): Promise<ResolvedImports> {\n const found: Exports = { fragments: new Map(), decos: new Map() };\n const packages = new Set<string>();\n const modules = new Map<string, Document>();\n const npm = new Map<string, Record<string, unknown>>();\n collectUses(args.document, packages);\n await loadInto({\n document: args.document,\n uri: args.uri,\n io: args.io,\n npmLoader: args.npm,\n found,\n packages,\n modules,\n npm,\n seen: new Set([args.uri]),\n });\n return { ...found, packages, modules, npm };\n}\n\n/**\n * Add the packages a file declares with `use` to `into`. Collected across the\n * whole graph: a fragment imported from elsewhere calls the verbs *its* file\n * asked for.\n *\n * @param document The file to read `use` declarations from.\n * @param into The accumulating set of package specifiers, mutated in place.\n */\nexport function collectUses(document: Document, into: Set<string>): void {\n for (const decl of document.imports) {\n if (isUseDecl(decl)) into.add(decl.pkg);\n }\n}\n\n/** What `pub` has handed over so far, filled as the graph is walked. */\ninterface Exports {\n fragments: Map<string, FragmentDecl>;\n decos: Map<string, ImportedDeco>;\n}\n\ninterface LoadState {\n document: Document;\n uri: string;\n io: ModuleIo;\n npmLoader?: NpmModules;\n found: Exports;\n packages: Set<string>;\n modules: Map<string, Document>;\n npm: Map<string, Record<string, unknown>>;\n seen: Set<string>;\n}\n\nasync function loadInto(state: LoadState): Promise<void> {\n for (const decl of state.document.imports) {\n if (!isValueImport(decl)) continue;\n if (isPackageSpecifier(decl.path)) await loadPackage(state, decl.path);\n else await loadModule(state, decl.path);\n }\n}\n\n/**\n * A package that was installed, loaded once however many files name it.\n *\n * A host with no loader has no packages, which is the state of every run in a\n * Web Worker. The import is left unbound and the name reports itself as unknown,\n * rather than the load failing somewhere nobody can see.\n */\nasync function loadPackage(state: LoadState, spec: string): Promise<void> {\n if (state.npm.has(spec) || !state.npmLoader) return;\n const found = await state.npmLoader.load(spec).catch(() => undefined);\n if (found) state.npm.set(spec, found);\n}\n\nasync function loadModule(state: LoadState, spec: string): Promise<void> {\n const target = state.io.resolve(state.uri, spec);\n if (state.seen.has(target)) return;\n state.seen.add(target);\n const source = await state.io.read(target).catch(() => undefined);\n if (source === undefined) return;\n const { ast } = parse(source, { uri: target });\n state.modules.set(target, ast);\n collectExports({ document: ast, uri: target, found: state.found });\n collectUses(ast, state.packages);\n await loadInto({ ...state, document: ast, uri: target });\n}\n\n/** Everything a file marked `pub`. A `deco` keeps its file: its faults are its own. */\nfunction collectExports(args: { document: Document; uri: string; found: Exports }): void {\n for (const decl of args.document.decls) {\n if (isFragmentDecl(decl) && decl.export) args.found.fragments.set(decl.name, decl);\n if (isDecoDecl(decl) && decl.export) args.found.decos.set(decl.name, { decl, uri: args.uri });\n }\n}\n","import { type FnType, prune, specToType, type Type, type TypeCatalog } from \"@venn-lang/core\";\nimport type { PluginDefinition } from \"@venn-lang/sdk\";\nimport type { TypeSpec } from \"@venn-lang/types\";\n\n/** The published specs, indexed by the name a flow would write. */\ninterface Published {\n types: Map<string, TypeSpec>;\n signatures: Map<string, TypeSpec>;\n}\n\n/**\n * Turn what the loaded plugins publish into what the checker can ask.\n *\n * This is the seam the core deliberately does not cross: `@venn-lang/core` knows\n * nothing about plugins and gets told. Names are qualified here, once: a plugin\n * says `Request` and a flow writes `http.Request`.\n *\n * @param plugins The plugins loaded for this run.\n * @returns A catalog answering a type name or an action's signature.\n */\nexport function createTypeCatalog(plugins: readonly PluginDefinition[]): TypeCatalog {\n const published: Published = { types: new Map(), signatures: new Map() };\n for (const plugin of plugins) collect(plugin, published);\n const reader = createReader(published);\n return {\n typeOf: (name) => reader.read(published.types, name),\n signatureOf: (target) => asFn(reader.read(published.signatures, target)),\n };\n}\n\nfunction collect(plugin: PluginDefinition, into: Published): void {\n for (const [name, spec] of Object.entries(plugin.typeDefs ?? {})) {\n into.types.set(`${plugin.namespace}.${name}`, spec);\n }\n for (const action of plugin.actions ?? []) {\n const key = `${plugin.namespace}.${action.name}`;\n if (action.signature) into.signatures.set(key, action.signature);\n }\n}\n\n/**\n * Read a published spec once and keep the result.\n *\n * The same `http.Request` has to be the same object every time it is asked for:\n * inference writes into what it is handed, and two copies would drift apart in\n * the middle of a file. `open` guards a type that refers to itself, so the\n * second visit answers \"unknown\" rather than recurring forever.\n */\nfunction createReader(published: Published) {\n const cache = new Map<string, Type>();\n const open = new Set<string>();\n const read = (from: Map<string, TypeSpec>, name: string): Type | undefined => {\n const cached = cache.get(name);\n if (cached) return cached;\n const spec = from.get(name);\n if (!spec || open.has(name)) return undefined;\n open.add(name);\n const type = specToType(spec, (ref) => read(published.types, ref));\n open.delete(name);\n cache.set(name, type);\n return type;\n };\n return { read };\n}\n\nfunction asFn(type: Type | undefined): FnType | undefined {\n if (!type) return undefined;\n const pruned = prune(type);\n return pruned.kind === \"fn\" ? pruned : undefined;\n}\n"],"mappings":";;;;AAIA,IAAa,cAAb,MAAyB,CAAC;AAC1B,IAAa,iBAAb,MAA4B,CAAC;AAC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E,MAAM,SAAS,MAAM,IAAI,IAAI;EAC7B,IAAI,QAAQ,OAAO;EACnB,MAAM,OAAO,KAAK,IAAI,IAAI;EAC1B,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,GAAG,OAAO,KAAA;EACpC,KAAK,IAAI,IAAI;EACb,MAAM,OAAO,WAAW,OAAO,QAAQ,KAAK,UAAU,OAAO,GAAG,CAAC;EACjE,KAAK,OAAO,IAAI;EAChB,MAAM,IAAI,MAAM,IAAI;EACpB,OAAO;CACT;CACA,OAAO,EAAE,KAAK;AAChB;AAEA,SAAS,KAAK,MAA4C;CACxD,IAAI,CAAC,MAAM,OAAO,KAAA;CAClB,MAAM,SAAS,MAAM,IAAI;CACzB,OAAO,OAAO,SAAS,OAAO,SAAS,KAAA;AACzC"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@venn-lang/runtime",
3
+ "version": "0.1.0",
4
+ "description": "Executes a parsed Venn document: the scheduler, the plugin registry, the event stream.",
5
+ "keywords": [
6
+ "venn",
7
+ "testing",
8
+ "e2e",
9
+ "runtime",
10
+ "interpreter"
11
+ ],
12
+ "homepage": "https://github.com/venn-lang/venn/tree/main/packages/runtime#readme",
13
+ "bugs": "https://github.com/venn-lang/venn/issues",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/venn-lang/venn.git",
17
+ "directory": "packages/runtime"
18
+ },
19
+ "license": "MIT",
20
+ "author": "Vinicius Borges",
21
+ "type": "module",
22
+ "sideEffects": false,
23
+ "exports": {
24
+ ".": {
25
+ "development": "./src/index.ts",
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js",
28
+ "default": "./dist/index.js"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "src",
34
+ "!src/**/*.test.ts",
35
+ "!src/**/*.suite.ts"
36
+ ],
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "dependencies": {
41
+ "@venn-lang/contracts": "0.1.0",
42
+ "@venn-lang/core": "0.1.0",
43
+ "@venn-lang/sdk": "0.1.0",
44
+ "@venn-lang/types": "0.1.0"
45
+ },
46
+ "devDependencies": {
47
+ "tsdown": "^0.22.14",
48
+ "typescript": "^7.0.2",
49
+ "vitest": "^4.1.10"
50
+ },
51
+ "scripts": {
52
+ "build": "tsdown",
53
+ "test": "vitest run",
54
+ "typecheck": "tsc --noEmit"
55
+ }
56
+ }