@oisincoveney/pipeline 2.6.0 → 2.8.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 (36) hide show
  1. package/defaults/pipeline.yaml +25 -0
  2. package/dist/argo-graph.js +7 -7
  3. package/dist/bench/eval-report.js +27 -0
  4. package/dist/cli/program.js +19 -3
  5. package/dist/commands/bench-command.js +18 -0
  6. package/dist/config/load.js +17 -0
  7. package/dist/config/schemas.d.ts +22 -5
  8. package/dist/config/schemas.js +20 -7
  9. package/dist/context/repo-map.js +203 -0
  10. package/dist/install-commands/opencode.js +10 -1
  11. package/dist/mcp/gateway.js +3 -3
  12. package/dist/moka-submit.d.ts +6 -6
  13. package/dist/pipeline-init.js +18 -12
  14. package/dist/pipeline-runtime.js +12 -1
  15. package/dist/planning/compile.d.ts +8 -3
  16. package/dist/planning/compile.js +7 -7
  17. package/dist/planning/generate.d.ts +6 -1
  18. package/dist/planning/generate.js +29 -7
  19. package/dist/runner-command-contract.d.ts +6 -1
  20. package/dist/runner-command-contract.js +6 -5
  21. package/dist/runner-event-schema.d.ts +6 -6
  22. package/dist/runner-event-sink.js +6 -5
  23. package/dist/runner.d.ts +6 -1
  24. package/dist/runner.js +3 -3
  25. package/dist/runtime/agent-node/agent-node.js +22 -4
  26. package/dist/runtime/local-scheduler.js +45 -0
  27. package/dist/runtime/opencode-server.js +6 -3
  28. package/dist/runtime/parallel-node/parallel-node.js +77 -58
  29. package/dist/runtime/parallel-worktrees/parallel-worktrees.js +49 -4
  30. package/dist/runtime/run-journal.js +21 -0
  31. package/dist/runtime/scheduler.js +122 -93
  32. package/dist/runtime/select-candidate/select-candidate.js +13 -1
  33. package/dist/runtime/services/worktree-service.js +18 -0
  34. package/dist/schedule/passes/candidates.js +17 -8
  35. package/docs/config-architecture.md +105 -0
  36. package/package.json +7 -2
@@ -164,6 +164,13 @@ Project-authored skill and rule paths resolve from the project root and must
164
164
  exist for runtime use. If default skill files are missing, run `moka init` to
165
165
  install them before executing workflows.
166
166
 
167
+ `moka init --skill-scope` (PIPE-83.12) chooses how the default set is installed:
168
+ `project` (default) vendors a repo-local copy (`skills add … --copy`,
169
+ `skills-lock.json`); `personal` installs once at user/global scope
170
+ (`skills add … --global`) so every repo the user opens inherits the skills with
171
+ no per-repo copy and no project lockfile — the standardization path for a single
172
+ user across many projects.
173
+
167
174
  MCP-enabled profiles use one gateway grant:
168
175
 
169
176
  ```yaml
@@ -352,6 +359,104 @@ The toposort uses `@dagrejs/graphlib` for the graph model but an iterative
352
359
  traversal for the topological sort, because graphlib's recursive topsort can
353
360
  overflow the call stack on deep generated workflow chains.
354
361
 
362
+ ## Context, durability & best-of-N features (PIPE-83)
363
+
364
+ The shipped `defaults/pipeline.yaml` turns **`context_handoff`, `repo_map`,
365
+ `durability`, `best_of_n` (n=2 on green), and `parallel_worktrees` ON** — moka
366
+ uses its architecture by default. `best_of_n` is the cost/quality dial: n=2
367
+ ~doubles green-node spend, so lower `n` or set `enabled: false` to spend the
368
+ minimum. Each block can be overridden in `pipeline.yaml`; the per-block
369
+ `# default …` notes below mark the *schema* default that applies when a block is
370
+ omitted entirely.
371
+
372
+ ### `context_handoff` — curated node-to-node handoffs
373
+
374
+ ```yaml
375
+ context_handoff:
376
+ enabled: true # default false
377
+ model: openai/gpt-5.5-fast # optional cheap model for the deriving call
378
+ ```
379
+
380
+ When enabled, each agent node derives a structured `NodeHandoff`
381
+ (`summary`, `decisions`, `artifacts`, `testNames`, `openQuestions`) from its raw
382
+ output via a cheap read-only finalizer. Downstream nodes then receive that
383
+ curated handoff in their prompt instead of the upstream node's full transcript
384
+ (`renderAgentPrompt`), which kills the prompt-bloat from re-hydrating every
385
+ ancestor's output. When a node produces no handoff, consumers fall back to the
386
+ raw output text, so disabling the flag is byte-identical to prior behaviour.
387
+
388
+ ### `parallel_worktrees` — isolated parallel children
389
+
390
+ ```yaml
391
+ parallel_worktrees:
392
+ enabled: true # default false
393
+ ```
394
+
395
+ When enabled, every child of a `kind: parallel` node runs in its own git
396
+ worktree on an auto-named branch (`.pipeline/worktrees/...`), so concurrent
397
+ candidate edits cannot collide. Teardown is idempotent and crash-safe: a
398
+ worktree with dirty or unpushed work is retained (never deleted), and orphaned
399
+ worktrees are GC'd on the next parallel node under the same guard. A worktree is
400
+ *not* a sandbox (node_modules/build state are shared) — real isolation remains
401
+ k8s mode. SDK-runner nodes honour the per-child directory via `plan.cwd`.
402
+
403
+ ### `best_of_n` — generate N candidates and select the winner
404
+
405
+ ```yaml
406
+ best_of_n:
407
+ enabled: true # default false
408
+ n: 3 # candidates per matching node (default 1 = off)
409
+ categories: [green] # which node categories fan out (id-substring match)
410
+ judge_model: openai/gpt-5.5 # optional LLM judge; omit for status-only
411
+ ```
412
+
413
+ When enabled with `n > 1`, the `candidates` schedule pass expands each matching
414
+ agent node into a `kind: parallel` of N candidate children
415
+ (`<node>--candidates`) feeding a `select-candidate` builtin that keeps the
416
+ original node id. Each candidate builds in its own worktree (pair with
417
+ `parallel_worktrees`) and is throttled by its category's
418
+ `token_budget.fan_out_width` cap. The selector scores candidates by a hybrid of
419
+ execution status (PASS/FAIL) and, when `judge_model` is set, a 0..1 LLM judge
420
+ score; it emits the winner's output and **never self-fixes** — if no candidate
421
+ passes, the node fails with evidence.
422
+
423
+ ### `durability` — durable crash-resume
424
+
425
+ ```yaml
426
+ durability:
427
+ enabled: true # default false
428
+ dir: .pipeline/journal # default
429
+ ```
430
+
431
+ When enabled, the scheduler journals each terminal node result to an
432
+ append-only JSONL log under `dir`, keyed by run id (`<dir>/<runId>.jsonl`). A
433
+ killed run, re-invoked with the same run id, resumes from the last **passed**
434
+ node — finished nodes are not re-run and their tokens are not re-spent — while a
435
+ failed node and everything downstream replay so fail-fast and blocked-descendant
436
+ handling stay live. The journal is a swappable seam (`RunJournal`): the shipped
437
+ `fileRunJournal` needs zero external infra; a future `@effect/workflow` / cluster
438
+ provider can implement the same interface without touching the scheduler. Off by
439
+ default → the scheduler runs purely in-memory, exactly as before.
440
+
441
+ ### `mcp_gateway.host_scope` — register the gateway once globally
442
+
443
+ ```yaml
444
+ mcp_gateway:
445
+ provider: toolhive
446
+ mode: hosted
447
+ host_scope: global # default "project"
448
+ ```
449
+
450
+ The singleton pipeline gateway is normally synthesized into each repo's
451
+ `.opencode/opencode.json` (`host_scope: project`, the default — unchanged
452
+ goldens). Setting `host_scope: global` stops that per-project synthesis: the
453
+ generated project config omits the `pipeline-gateway` MCP entry and instead
454
+ inherits one global registration written once via
455
+ `moka gateway configure-host --scope global` (which targets
456
+ `$OPENCODE_CONFIG_DIR`/`$XDG_CONFIG_HOME/opencode/opencode.json`). This is the
457
+ PIPE-83.11 standardization path — register the MCP gateway once per machine
458
+ rather than re-emitting it into every project.
459
+
355
460
  ## Troubleshooting
356
461
 
357
462
  - Missing host resources: run `moka install-commands`; `moka run` loads the
package/package.json CHANGED
@@ -6,18 +6,23 @@
6
6
  "ajv": "^8.20.0",
7
7
  "ajv-formats": "^3.0.1",
8
8
  "commander": "^14.0.3",
9
+ "effect": "^3.21.3",
9
10
  "execa": "^9.5.2",
10
11
  "git-url-parse": "^16.1.0",
12
+ "graphology": "0.26.0",
13
+ "graphology-metrics": "2.4.0",
11
14
  "gray-matter": "^4.0.3",
12
15
  "js-tiktoken": "^1.0.21",
13
16
  "jsonc-parser": "^3.3.1",
14
17
  "ky": "^2.0.2",
15
18
  "micromatch": "^4.0.8",
16
- "p-limit": "^7.3.0",
17
19
  "package-manager-detector": "^1.6.0",
18
20
  "pino": "^10.3.1",
19
21
  "secure-json-parse": "^4.1.0",
20
22
  "simple-git": "^3.36.0",
23
+ "tree-sitter-javascript": "0.25.0",
24
+ "tree-sitter-typescript": "0.23.2",
25
+ "web-tree-sitter": "0.26.9",
21
26
  "yaml": "^2.9.0",
22
27
  "zod": "^4.4.3"
23
28
  },
@@ -121,7 +126,7 @@
121
126
  "prepack": "bun run build:cli"
122
127
  },
123
128
  "type": "module",
124
- "version": "2.6.0",
129
+ "version": "2.8.0",
125
130
  "description": "Config-driven multi-agent pipeline runner for repository work",
126
131
  "main": "./dist/index.js",
127
132
  "types": "./dist/index.d.ts",