zob-harness 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 (356) hide show
  1. package/.pi/adapters/registry.json +103 -0
  2. package/.pi/agents/architecture-cartographer.md +53 -0
  3. package/.pi/agents/chief-vision.md +39 -0
  4. package/.pi/agents/clarifier.md +58 -0
  5. package/.pi/agents/context-steward.md +52 -0
  6. package/.pi/agents/doc-steward.md +34 -0
  7. package/.pi/agents/explore.md +49 -0
  8. package/.pi/agents/factory.md +41 -0
  9. package/.pi/agents/implementer.md +44 -0
  10. package/.pi/agents/librarian.md +32 -0
  11. package/.pi/agents/oracle-merge.md +50 -0
  12. package/.pi/agents/oracle.md +55 -0
  13. package/.pi/agents/pattern-miner.md +53 -0
  14. package/.pi/agents/planner.md +39 -0
  15. package/.pi/agents/project-dna-golden-evaluator.md +32 -0
  16. package/.pi/agents/project-dna-ontology-steward.md +30 -0
  17. package/.pi/agents/project-dna-oracle.md +56 -0
  18. package/.pi/agents/project-dna-orchestrator.md +60 -0
  19. package/.pi/agents/project-dna-query-steward.md +38 -0
  20. package/.pi/agents/project-dna-safety-preflight.md +54 -0
  21. package/.pi/agents/project-dna-test-linker.md +27 -0
  22. package/.pi/agents/qa.md +38 -0
  23. package/.pi/agents/refactor-cartographer.md +28 -0
  24. package/.pi/agents/refactor-mover.md +31 -0
  25. package/.pi/agents/refactor-oracle.md +49 -0
  26. package/.pi/agents/repo-scout.md +60 -0
  27. package/.pi/agents/sample-architect.md +48 -0
  28. package/.pi/agents/specifier.md +57 -0
  29. package/.pi/agents/symbol-range-curator.md +41 -0
  30. package/.pi/agents/synthesis.md +52 -0
  31. package/.pi/agents/temp-agent-creator.md +35 -0
  32. package/.pi/autonomy-policy.json +67 -0
  33. package/.pi/budget-policy.json +54 -0
  34. package/.pi/capabilities/zob-public-runtime-capabilities.json +1700 -0
  35. package/.pi/chains/explore-plan-oracle.json +78 -0
  36. package/.pi/chains/explore-spec-clarify-plan-oracle.json +64 -0
  37. package/.pi/chains/explore-spec-plan-oracle.json +53 -0
  38. package/.pi/chains/spec-clarify-plan-oracle.json +53 -0
  39. package/.pi/chains/spec-factory-oracle.json +42 -0
  40. package/.pi/chains/spec-plan-oracle.json +42 -0
  41. package/.pi/compute-profiles/defaults.json +19 -0
  42. package/.pi/compute-profiles/overrides.json +13 -0
  43. package/.pi/compute-profiles/risk-rules.json +16 -0
  44. package/.pi/daemon-policy.json +80 -0
  45. package/.pi/damage-control-rules.json +45 -0
  46. package/.pi/extensions/zob-child-safety/index.ts +212 -0
  47. package/.pi/extensions/zob-harness/AGENTS.md +28 -0
  48. package/.pi/extensions/zob-harness/index.ts +391 -0
  49. package/.pi/extensions/zob-harness/src/AGENTS.md +25 -0
  50. package/.pi/extensions/zob-harness/src/agents.ts +82 -0
  51. package/.pi/extensions/zob-harness/src/autonomous-runtime.ts +2912 -0
  52. package/.pi/extensions/zob-harness/src/autonomy-readiness.ts +778 -0
  53. package/.pi/extensions/zob-harness/src/budget-policy.ts +308 -0
  54. package/.pi/extensions/zob-harness/src/capabilities.ts +249 -0
  55. package/.pi/extensions/zob-harness/src/child-runner.ts +249 -0
  56. package/.pi/extensions/zob-harness/src/chronicle.ts +262 -0
  57. package/.pi/extensions/zob-harness/src/compute-profile.ts +602 -0
  58. package/.pi/extensions/zob-harness/src/compute-workflow-shape.ts +168 -0
  59. package/.pi/extensions/zob-harness/src/coms-v2/AGENTS.md +16 -0
  60. package/.pi/extensions/zob-harness/src/coms-v2/envelope.ts +121 -0
  61. package/.pi/extensions/zob-harness/src/coms-v2/identity.ts +53 -0
  62. package/.pi/extensions/zob-harness/src/coms-v2/ledger-bridge.ts +67 -0
  63. package/.pi/extensions/zob-harness/src/coms-v2/local-transport.ts +147 -0
  64. package/.pi/extensions/zob-harness/src/coms-v2/pending-replies.ts +80 -0
  65. package/.pi/extensions/zob-harness/src/coms-v2/policy.ts +125 -0
  66. package/.pi/extensions/zob-harness/src/coms-v2/presence.ts +55 -0
  67. package/.pi/extensions/zob-harness/src/coms-v2/registry.ts +113 -0
  68. package/.pi/extensions/zob-harness/src/coms-v2/response-capture.ts +50 -0
  69. package/.pi/extensions/zob-harness/src/coms-v2/transcript-capture.ts +164 -0
  70. package/.pi/extensions/zob-harness/src/coms-v2/types.ts +149 -0
  71. package/.pi/extensions/zob-harness/src/coms-v2/zpeer-profile.ts +140 -0
  72. package/.pi/extensions/zob-harness/src/coms-v2/zpeer.ts +452 -0
  73. package/.pi/extensions/zob-harness/src/constants.ts +108 -0
  74. package/.pi/extensions/zob-harness/src/context-gbrain.ts +465 -0
  75. package/.pi/extensions/zob-harness/src/daemon-policy.ts +223 -0
  76. package/.pi/extensions/zob-harness/src/daemon-readiness.ts +134 -0
  77. package/.pi/extensions/zob-harness/src/daemon-runtime.ts +393 -0
  78. package/.pi/extensions/zob-harness/src/factory/AGENTS.md +24 -0
  79. package/.pi/extensions/zob-harness/src/factory/agentic-plan.ts +65 -0
  80. package/.pi/extensions/zob-harness/src/factory/quarantine.ts +319 -0
  81. package/.pi/extensions/zob-harness/src/factory/run.ts +520 -0
  82. package/.pi/extensions/zob-harness/src/factory/validation.ts +454 -0
  83. package/.pi/extensions/zob-harness/src/factory-selector.ts +318 -0
  84. package/.pi/extensions/zob-harness/src/full-autonomy-test.ts +226 -0
  85. package/.pi/extensions/zob-harness/src/git-ops.ts +868 -0
  86. package/.pi/extensions/zob-harness/src/goal-room.ts +178 -0
  87. package/.pi/extensions/zob-harness/src/goal-runtime.ts +1569 -0
  88. package/.pi/extensions/zob-harness/src/goal-todo-imports.ts +111 -0
  89. package/.pi/extensions/zob-harness/src/goal-todo-types.ts +231 -0
  90. package/.pi/extensions/zob-harness/src/goal-todos.ts +1410 -0
  91. package/.pi/extensions/zob-harness/src/goal.ts +152 -0
  92. package/.pi/extensions/zob-harness/src/governed-requests.ts +436 -0
  93. package/.pi/extensions/zob-harness/src/interactive-autonomy.ts +595 -0
  94. package/.pi/extensions/zob-harness/src/launch-apply.ts +313 -0
  95. package/.pi/extensions/zob-harness/src/merge-queue.ts +290 -0
  96. package/.pi/extensions/zob-harness/src/mission-control.ts +573 -0
  97. package/.pi/extensions/zob-harness/src/model-availability.ts +52 -0
  98. package/.pi/extensions/zob-harness/src/model-routing.ts +429 -0
  99. package/.pi/extensions/zob-harness/src/orchestration/AGENTS.md +23 -0
  100. package/.pi/extensions/zob-harness/src/orchestration/adaptive-delegation.ts +547 -0
  101. package/.pi/extensions/zob-harness/src/orchestration/adaptive-workflow.ts +585 -0
  102. package/.pi/extensions/zob-harness/src/orchestration/lead-plan.ts +192 -0
  103. package/.pi/extensions/zob-harness/src/orchestration/plan.ts +168 -0
  104. package/.pi/extensions/zob-harness/src/orchestration/room.ts +346 -0
  105. package/.pi/extensions/zob-harness/src/orchestration/run.ts +134 -0
  106. package/.pi/extensions/zob-harness/src/orchestration/supervised-readonly.ts +1147 -0
  107. package/.pi/extensions/zob-harness/src/orchestration/widget-readers.ts +132 -0
  108. package/.pi/extensions/zob-harness/src/output-contracts.ts +656 -0
  109. package/.pi/extensions/zob-harness/src/project-dna.ts +533 -0
  110. package/.pi/extensions/zob-harness/src/promotion/AGENTS.md +24 -0
  111. package/.pi/extensions/zob-harness/src/promotion/candidate.ts +336 -0
  112. package/.pi/extensions/zob-harness/src/promotion/coms.ts +127 -0
  113. package/.pi/extensions/zob-harness/src/promotion/documentation.ts +142 -0
  114. package/.pi/extensions/zob-harness/src/promotion/factory.ts +107 -0
  115. package/.pi/extensions/zob-harness/src/promotion/ledger.ts +2 -0
  116. package/.pi/extensions/zob-harness/src/promotion/temp-agent.ts +151 -0
  117. package/.pi/extensions/zob-harness/src/promotion/types.ts +149 -0
  118. package/.pi/extensions/zob-harness/src/promotion/validate.ts +6 -0
  119. package/.pi/extensions/zob-harness/src/promotion/write-lane.ts +162 -0
  120. package/.pi/extensions/zob-harness/src/prompt-packs.ts +239 -0
  121. package/.pi/extensions/zob-harness/src/queue.ts +386 -0
  122. package/.pi/extensions/zob-harness/src/rules.ts +225 -0
  123. package/.pi/extensions/zob-harness/src/runtime/AGENTS.md +26 -0
  124. package/.pi/extensions/zob-harness/src/runtime/adaptive-zmode.ts +116 -0
  125. package/.pi/extensions/zob-harness/src/runtime/auto-compaction.ts +715 -0
  126. package/.pi/extensions/zob-harness/src/runtime/commands.ts +1315 -0
  127. package/.pi/extensions/zob-harness/src/runtime/compaction-policy.ts +516 -0
  128. package/.pi/extensions/zob-harness/src/runtime/delegation-click-markers.ts +141 -0
  129. package/.pi/extensions/zob-harness/src/runtime/delegation-feed.ts +415 -0
  130. package/.pi/extensions/zob-harness/src/runtime/delegation-markdown.ts +97 -0
  131. package/.pi/extensions/zob-harness/src/runtime/delegation-monitor.ts +553 -0
  132. package/.pi/extensions/zob-harness/src/runtime/delegation-mouse.ts +205 -0
  133. package/.pi/extensions/zob-harness/src/runtime/delegation-overlay.ts +434 -0
  134. package/.pi/extensions/zob-harness/src/runtime/events.ts +736 -0
  135. package/.pi/extensions/zob-harness/src/runtime/goal-todo-overlay.ts +214 -0
  136. package/.pi/extensions/zob-harness/src/runtime/mode-intent.ts +144 -0
  137. package/.pi/extensions/zob-harness/src/runtime/plan-capture.ts +270 -0
  138. package/.pi/extensions/zob-harness/src/runtime/state.ts +403 -0
  139. package/.pi/extensions/zob-harness/src/runtime/tools-autonomous.ts +117 -0
  140. package/.pi/extensions/zob-harness/src/runtime/tools-compute.ts +136 -0
  141. package/.pi/extensions/zob-harness/src/runtime/tools-coms.ts +365 -0
  142. package/.pi/extensions/zob-harness/src/runtime/tools-context.ts +70 -0
  143. package/.pi/extensions/zob-harness/src/runtime/tools-delegation.ts +1854 -0
  144. package/.pi/extensions/zob-harness/src/runtime/tools-factory.ts +810 -0
  145. package/.pi/extensions/zob-harness/src/runtime/tools-goal-room.ts +46 -0
  146. package/.pi/extensions/zob-harness/src/runtime/tools-governed-requests.ts +38 -0
  147. package/.pi/extensions/zob-harness/src/runtime/tools-merge-queue.ts +61 -0
  148. package/.pi/extensions/zob-harness/src/runtime/tools-mission-control.ts +77 -0
  149. package/.pi/extensions/zob-harness/src/runtime/tools-orchestration.ts +106 -0
  150. package/.pi/extensions/zob-harness/src/runtime/tools-project-dna.ts +123 -0
  151. package/.pi/extensions/zob-harness/src/runtime/tools-worker-pool.ts +93 -0
  152. package/.pi/extensions/zob-harness/src/runtime/tools-workspace-claims.ts +62 -0
  153. package/.pi/extensions/zob-harness/src/runtime/tools-zcommit.ts +147 -0
  154. package/.pi/extensions/zob-harness/src/runtime/widget.ts +353 -0
  155. package/.pi/extensions/zob-harness/src/runtime/zobHarness.ts +60 -0
  156. package/.pi/extensions/zob-harness/src/safety.ts +338 -0
  157. package/.pi/extensions/zob-harness/src/sandbox.ts +1508 -0
  158. package/.pi/extensions/zob-harness/src/schemas-project-dna.ts +47 -0
  159. package/.pi/extensions/zob-harness/src/schemas.ts +695 -0
  160. package/.pi/extensions/zob-harness/src/telemetry.ts +373 -0
  161. package/.pi/extensions/zob-harness/src/topology/AGENTS.md +22 -0
  162. package/.pi/extensions/zob-harness/src/topology/chains.ts +236 -0
  163. package/.pi/extensions/zob-harness/src/topology/coms.ts +211 -0
  164. package/.pi/extensions/zob-harness/src/topology/orchestration-profiles.ts +204 -0
  165. package/.pi/extensions/zob-harness/src/topology/teams.ts +113 -0
  166. package/.pi/extensions/zob-harness/src/types/core.ts +47 -0
  167. package/.pi/extensions/zob-harness/src/types.ts +939 -0
  168. package/.pi/extensions/zob-harness/src/utils/AGENTS.md +22 -0
  169. package/.pi/extensions/zob-harness/src/utils/formatting.ts +34 -0
  170. package/.pi/extensions/zob-harness/src/utils/hashing.ts +11 -0
  171. package/.pi/extensions/zob-harness/src/utils/json.ts +28 -0
  172. package/.pi/extensions/zob-harness/src/utils/paths.ts +54 -0
  173. package/.pi/extensions/zob-harness/src/utils/records.ts +25 -0
  174. package/.pi/extensions/zob-harness/src/utils/resources.ts +38 -0
  175. package/.pi/extensions/zob-harness/src/worker-pool.ts +672 -0
  176. package/.pi/extensions/zob-harness/src/workspace-claims.ts +297 -0
  177. package/.pi/extensions/zob-switch/index.ts +180 -0
  178. package/.pi/factories/budget-preflight-dry-run/batch-manifest.json +59 -0
  179. package/.pi/factories/budget-preflight-dry-run/factory.json +94 -0
  180. package/.pi/factories/budget-preflight-dry-run/pilot-manifest.json +50 -0
  181. package/.pi/factories/budget-preflight-dry-run/smoke-manifest.json +43 -0
  182. package/.pi/factories/code-review-matrix/batch-manifest.json +61 -0
  183. package/.pi/factories/code-review-matrix/factory.json +163 -0
  184. package/.pi/factories/code-review-matrix/pilot-manifest.json +41 -0
  185. package/.pi/factories/code-review-matrix/smoke-manifest.json +35 -0
  186. package/.pi/factories/factory-forge/batch-manifest.json +56 -0
  187. package/.pi/factories/factory-forge/factory.json +84 -0
  188. package/.pi/factories/factory-forge/pilot-manifest.json +32 -0
  189. package/.pi/factories/factory-forge/smoke-manifest.json +19 -0
  190. package/.pi/factories/opencode-pattern-canonizer/batch-manifest.json +54 -0
  191. package/.pi/factories/opencode-pattern-canonizer/factory.json +86 -0
  192. package/.pi/factories/opencode-pattern-canonizer/pilot-manifest.json +39 -0
  193. package/.pi/factories/opencode-pattern-canonizer/smoke-manifest.json +26 -0
  194. package/.pi/factories/project-dna/README.md +182 -0
  195. package/.pi/factories/project-dna/batch-manifest.json +37 -0
  196. package/.pi/factories/project-dna/example-project-dna-manifest-v2.json +80 -0
  197. package/.pi/factories/project-dna/example-project-dna-manifest.json +58 -0
  198. package/.pi/factories/project-dna/factory.json +131 -0
  199. package/.pi/factories/project-dna/golden-cases-smoke.json +62 -0
  200. package/.pi/factories/project-dna/pi-agentic-ontology.json +88 -0
  201. package/.pi/factories/project-dna/pilot-manifest.json +32 -0
  202. package/.pi/factories/project-dna/schemas/benchmark-suite.schema.json +27 -0
  203. package/.pi/factories/project-dna/schemas/code-knowledge-graph.schema.json +97 -0
  204. package/.pi/factories/project-dna/schemas/context-pack.schema.json +43 -0
  205. package/.pi/factories/project-dna/schemas/golden-case.schema.json +36 -0
  206. package/.pi/factories/project-dna/schemas/manifest-v2.schema.json +128 -0
  207. package/.pi/factories/project-dna/schemas/manifest.schema.json +77 -0
  208. package/.pi/factories/project-dna/schemas/ontology.schema.json +45 -0
  209. package/.pi/factories/project-dna/schemas/project-fingerprint.schema.json +28 -0
  210. package/.pi/factories/project-dna/schemas/query-steward-report.schema.json +52 -0
  211. package/.pi/factories/project-dna/smoke-manifest.json +27 -0
  212. package/.pi/factories/roadmap-smoke-lots/batch-manifest.json +49 -0
  213. package/.pi/factories/roadmap-smoke-lots/factory.json +89 -0
  214. package/.pi/factories/roadmap-smoke-lots/pilot-manifest.json +50 -0
  215. package/.pi/factories/roadmap-smoke-lots/smoke-manifest.json +35 -0
  216. package/.pi/git-policy.json +120 -0
  217. package/.pi/mission-control/zob_coms_transport.json +64 -0
  218. package/.pi/model-catalog.example.json +345 -0
  219. package/.pi/model-economy.example.json +196 -0
  220. package/.pi/model-routing.json +86 -0
  221. package/.pi/orchestrations/adaptive-chief-vision.json +193 -0
  222. package/.pi/orchestrations/ceo-feature-build.json +182 -0
  223. package/.pi/orchestrations/readonly-dynamic-smoke.json +75 -0
  224. package/.pi/output-contracts/agent-event.v1.json +19 -0
  225. package/.pi/output-contracts/base.v1.json +24 -0
  226. package/.pi/output-contracts/brain-lookup.v1.json +21 -0
  227. package/.pi/output-contracts/clarification.v1.json +21 -0
  228. package/.pi/output-contracts/context-pack.v1.json +20 -0
  229. package/.pi/output-contracts/context-request.v1.json +21 -0
  230. package/.pi/output-contracts/context-steward.v1.json +19 -0
  231. package/.pi/output-contracts/context-writeback-proposal.v1.json +18 -0
  232. package/.pi/output-contracts/delegation-request.v1.json +21 -0
  233. package/.pi/output-contracts/explore.v1.json +52 -0
  234. package/.pi/output-contracts/factory.v1.json +48 -0
  235. package/.pi/output-contracts/guidance-steward.v1.json +18 -0
  236. package/.pi/output-contracts/implement.v1.json +40 -0
  237. package/.pi/output-contracts/launch-authorization.v1.json +21 -0
  238. package/.pi/output-contracts/lead-plan.v1.json +22 -0
  239. package/.pi/output-contracts/mission-readiness.v1.json +20 -0
  240. package/.pi/output-contracts/oracle-merge.v1.json +44 -0
  241. package/.pi/output-contracts/oracle-request.v1.json +20 -0
  242. package/.pi/output-contracts/oracle.v1.json +44 -0
  243. package/.pi/output-contracts/orchestration-profile.v1.json +22 -0
  244. package/.pi/output-contracts/plan.v1.json +48 -0
  245. package/.pi/output-contracts/prompt-pack.v1.json +20 -0
  246. package/.pi/output-contracts/qa.v1.json +40 -0
  247. package/.pi/output-contracts/research.v1.json +36 -0
  248. package/.pi/output-contracts/spec.v1.json +22 -0
  249. package/.pi/output-contracts/synthesis.v1.json +44 -0
  250. package/.pi/output-contracts/temp-agent-card.v1.json +23 -0
  251. package/.pi/output-contracts/todo-child-result.v1.json +20 -0
  252. package/.pi/output-contracts/todo-child-result.v2.json +22 -0
  253. package/.pi/output-contracts/todo-claim-validation.v1.json +22 -0
  254. package/.pi/output-contracts/todo-split-request.v1.json +20 -0
  255. package/.pi/prompts/adaptive-workflow.md +63 -0
  256. package/.pi/prompts/autonomous-runtime.md +15 -0
  257. package/.pi/prompts/benchmark-contender.md +15 -0
  258. package/.pi/prompts/benchmark-judge.md +19 -0
  259. package/.pi/prompts/clarify-spec.md +20 -0
  260. package/.pi/prompts/compute-plan.md +36 -0
  261. package/.pi/prompts/compute-preview.md +42 -0
  262. package/.pi/prompts/contract.md +29 -0
  263. package/.pi/prompts/explore.md +13 -0
  264. package/.pi/prompts/factory-run.md +36 -0
  265. package/.pi/prompts/factory.md +20 -0
  266. package/.pi/prompts/implement.md +27 -0
  267. package/.pi/prompts/model-catalog.md +68 -0
  268. package/.pi/prompts/model-economy.md +64 -0
  269. package/.pi/prompts/oracle-merge.md +18 -0
  270. package/.pi/prompts/oracle.md +13 -0
  271. package/.pi/prompts/orchestrator.md +48 -0
  272. package/.pi/prompts/parallel-review.md +21 -0
  273. package/.pi/prompts/plan.md +21 -0
  274. package/.pi/prompts/project-dna.md +90 -0
  275. package/.pi/prompts/refactor-oracle.md +23 -0
  276. package/.pi/prompts/refactor-slice.md +24 -0
  277. package/.pi/prompts/research.md +20 -0
  278. package/.pi/prompts/spec.md +19 -0
  279. package/.pi/prompts/synthesis.md +18 -0
  280. package/.pi/rules/always.md +38 -0
  281. package/.pi/rules/docs.md +32 -0
  282. package/.pi/rules/factory.md +44 -0
  283. package/.pi/rules/oracle.md +34 -0
  284. package/.pi/rules/orchestration.md +44 -0
  285. package/.pi/rules/project.md +34 -0
  286. package/.pi/rules/prompts.md +43 -0
  287. package/.pi/rules/runtime.md +43 -0
  288. package/.pi/rules/sandbox.md +43 -0
  289. package/.pi/settings.json +28 -0
  290. package/.pi/skills/zob-agentic-access/SKILL.md +20 -0
  291. package/.pi/skills/zob-autonomous-runtime/SKILL.md +41 -0
  292. package/.pi/skills/zob-commit/SKILL.md +79 -0
  293. package/.pi/skills/zob-compaction-policy/SKILL.md +92 -0
  294. package/.pi/skills/zob-compute-profile/SKILL.md +108 -0
  295. package/.pi/skills/zob-coms-safety/SKILL.md +54 -0
  296. package/.pi/skills/zob-coms-v2-live/SKILL.md +47 -0
  297. package/.pi/skills/zob-delegation-routing/SKILL.md +82 -0
  298. package/.pi/skills/zob-factory/SKILL.md +28 -0
  299. package/.pi/skills/zob-goal-todo-tree/SKILL.md +279 -0
  300. package/.pi/skills/zob-harness/SKILL.md +68 -0
  301. package/.pi/skills/zob-mission-control-coms/SKILL.md +39 -0
  302. package/.pi/skills/zob-oracle/SKILL.md +21 -0
  303. package/.pi/skills/zob-owner-pool-drill-writer/SKILL.md +244 -0
  304. package/.pi/skills/zob-owner-pool-launcher/SKILL.md +261 -0
  305. package/.pi/skills/zob-project-dna/SKILL.md +275 -0
  306. package/.pi/skills/zob-sandbox/SKILL.md +29 -0
  307. package/.pi/skills/zob-spec/SKILL.md +25 -0
  308. package/.pi/skills/zob-split-refactor/SKILL.md +39 -0
  309. package/.pi/skills/zob-tool-router/SKILL.md +104 -0
  310. package/.pi/teams/zob-core.json +122 -0
  311. package/AGENTS.md +89 -0
  312. package/CONTRIBUTING.md +56 -0
  313. package/LICENSE +21 -0
  314. package/README.md +360 -0
  315. package/SECURITY.md +35 -0
  316. package/SOURCE_INDEX.md +46 -0
  317. package/package.json +135 -0
  318. package/scripts/README.md +57 -0
  319. package/scripts/autonomy/mission-readiness-secret-smoke.mjs +90 -0
  320. package/scripts/compute-profile/plan-workflow.mjs +85 -0
  321. package/scripts/compute-profile/preview.mjs +242 -0
  322. package/scripts/compute-profile/regression-smoke.mjs +38 -0
  323. package/scripts/compute-profile/summarize.mjs +72 -0
  324. package/scripts/compute-profile/validate-policy.mjs +50 -0
  325. package/scripts/compute-profile/validate-preview.mjs +95 -0
  326. package/scripts/compute-profile/validate-workflow.mjs +58 -0
  327. package/scripts/git-ops/commit-policy-smoke.mjs +221 -0
  328. package/scripts/goal-todo/child-goal-ref-smoke.mjs +252 -0
  329. package/scripts/harness-switch/static-smoke.mjs +43 -0
  330. package/scripts/model-catalog/validate-economy.mjs +223 -0
  331. package/scripts/model-catalog/validate.mjs +199 -0
  332. package/scripts/package-surface/validate-script-refs.mjs +190 -0
  333. package/scripts/path-policy/validate-smoke.mjs +103 -0
  334. package/scripts/project-dna/bench-smoke.mjs +217 -0
  335. package/scripts/project-dna/build-capsules.mjs +207 -0
  336. package/scripts/project-dna/build-sample-spec.mjs +140 -0
  337. package/scripts/project-dna/emit-golden-cases.mjs +75 -0
  338. package/scripts/project-dna/emit-ontology.mjs +75 -0
  339. package/scripts/project-dna/generate-sample.mjs +302 -0
  340. package/scripts/project-dna/oracle-review-smoke.mjs +157 -0
  341. package/scripts/project-dna/plan-workflow.mjs +289 -0
  342. package/scripts/project-dna/query-context.mjs +276 -0
  343. package/scripts/project-dna/query-steward.mjs +149 -0
  344. package/scripts/project-dna/scan.mjs +553 -0
  345. package/scripts/project-dna/validate-5of5.mjs +159 -0
  346. package/scripts/project-dna/validate-golden-cases.mjs +78 -0
  347. package/scripts/project-dna/validate-ontology.mjs +97 -0
  348. package/scripts/project-dna/validate-sample-project.mjs +105 -0
  349. package/scripts/project-dna/validate-scaffold.mjs +383 -0
  350. package/scripts/project-dna/validate-scan-artifacts.mjs +187 -0
  351. package/scripts/project-dna/validate-workflow.mjs +166 -0
  352. package/scripts/start-pi.sh +4 -0
  353. package/scripts/worker-pool/static-smoke.mjs +54 -0
  354. package/scripts/zpeer-local-e2e-smoke.mjs +395 -0
  355. package/scripts/zpeer-static-smoke.mjs +129 -0
  356. package/tsconfig.json +12 -0
@@ -0,0 +1,46 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ import { appendGoalRoomMessage, listGoalRoomMessages } from "../goal-room.js";
4
+ import { ZobGoalRoomListParams, ZobGoalRoomSendParams } from "../schemas.js";
5
+ import { loadTeamDefinition, validateTeamDefinition } from "../topology/teams.js";
6
+ import type { TeamDefinition } from "../types.js";
7
+
8
+ export function registerGoalRoomTools(pi: ExtensionAPI): void {
9
+ pi.registerTool({
10
+ name: "zob_goal_room_send",
11
+ label: "ZOB Goal Room Send",
12
+ description: "Append a visible typed GOAL_ROOM_MESSAGE.v1 to the parent-visible goal room. Metadata/hash-only; no hidden worker-to-worker free chat; no action execution.",
13
+ promptSnippet: "Post a typed metadata-only message to the shared goal room.",
14
+ parameters: ZobGoalRoomSendParams,
15
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
16
+ const team = loadTeamDefinition(ctx.cwd, params.team ?? "zob-core");
17
+ const errors = [...team.errors, ...validateTeamDefinition(ctx.cwd, team.definition)];
18
+ if (errors.length > 0 || !team.definition) return { content: [{ type: "text", text: `zob_goal_room_send failed_preflight:\n- ${errors.join("\n- ")}` }], details: { status: "failed_preflight", errors } };
19
+ try {
20
+ const message = appendGoalRoomMessage(ctx.cwd, team.definition as TeamDefinition, params);
21
+ pi.appendEntry("zob-goal-room", { event: "message_appended", msgId: message.msgId, goalId: message.goalId, sender: message.sender, kind: message.kind, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false });
22
+ return { content: [{ type: "text", text: `zob_goal_room_send: ${message.msgId}` }], details: { schema: "zob.goal-room-send-result.v1", message } };
23
+ } catch (error) {
24
+ const message = error instanceof Error ? error.message : String(error);
25
+ return { content: [{ type: "text", text: `zob_goal_room_send blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
26
+ }
27
+ },
28
+ });
29
+
30
+ pi.registerTool({
31
+ name: "zob_goal_room_list",
32
+ label: "ZOB Goal Room List",
33
+ description: "List parent-visible typed goal-room messages. Bodies are never returned because only hashes/metadata are persisted.",
34
+ promptSnippet: "List metadata-only messages in the shared goal room.",
35
+ parameters: ZobGoalRoomListParams,
36
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
37
+ try {
38
+ const messages = listGoalRoomMessages(ctx.cwd, params);
39
+ return { content: [{ type: "text", text: `zob_goal_room_list: ${messages.length} message(s)` }], details: { schema: "zob.goal-room-list.v1", messages } };
40
+ } catch (error) {
41
+ const message = error instanceof Error ? error.message : String(error);
42
+ return { content: [{ type: "text", text: `zob_goal_room_list blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
43
+ }
44
+ },
45
+ });
46
+ }
@@ -0,0 +1,38 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ import { appendGovernedRequestsToGoalRoom, extractGovernedRequestsFromText, governedRequestBodyFreeViolations } from "../governed-requests.js";
4
+ import { GovernedRequestExtractParams } from "../schemas.js";
5
+ import { loadTeamDefinition, validateTeamDefinition } from "../topology/teams.js";
6
+
7
+ export function registerGovernedRequestTools(pi: ExtensionAPI): void {
8
+ pi.registerTool({
9
+ name: "zob_governed_request_extract",
10
+ label: "ZOB Governed Request Extract",
11
+ description: "Extract DELEGATION_REQUEST.v1 / ORACLE_REQUEST.v1 / CONTEXT_REQUEST.v1 / OWNER_CHANGE_REQUEST.v1 from transient text, append parent-visible Goal Room requests, and never dispatch, apply, or mutate TODO state.",
12
+ promptSnippet: "Extract governed requests from transient child output without executing actions.",
13
+ parameters: GovernedRequestExtractParams,
14
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
15
+ const team = loadTeamDefinition(ctx.cwd, params.team ?? "zob-core");
16
+ const errors = [...team.errors, ...validateTeamDefinition(ctx.cwd, team.definition)];
17
+ if (!team.definition || errors.length > 0) return { content: [{ type: "text", text: `zob_governed_request_extract failed_preflight:\n- ${errors.join("\n- ")}` }], details: { status: "failed_preflight", errors } };
18
+ const extraction = extractGovernedRequestsFromText(params.transient_text);
19
+ const persisted = params.append_to_goal_room === false ? extraction : appendGovernedRequestsToGoalRoom(ctx.cwd, team.definition, params.goal_id, extraction);
20
+ const bodyFreeViolations = governedRequestBodyFreeViolations(persisted);
21
+ const details = {
22
+ ...persisted,
23
+ bodyFreeViolations,
24
+ appendToGoalRoom: params.append_to_goal_room !== false,
25
+ parentOwnedActions: true,
26
+ childDirectDispatch: false,
27
+ dispatchExecuted: false,
28
+ canonicalTodoMutation: false,
29
+ };
30
+ const status = persisted.extractionErrors.length === 0 && bodyFreeViolations.length === 0 ? "ok" : "blocked";
31
+ pi.appendEntry("zob-governed-request", { event: "extracted", status, requests: persisted.requests.length, goalRoomMessages: persisted.goalRoomMessageIds.length, sourceOutputHash: persisted.sourceOutputHash, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false, dispatchExecuted: false, childDirectDispatch: false });
32
+ return {
33
+ content: [{ type: "text", text: `zob_governed_request_extract: ${status}; requests=${persisted.requests.length}; goal_room_messages=${persisted.goalRoomMessageIds.length}` }],
34
+ details,
35
+ };
36
+ },
37
+ });
38
+ }
@@ -0,0 +1,61 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ import { decideMergeCandidate, listMergeQueue, mergeQueueBodyFreeViolations, submitMergeCandidate } from "../merge-queue.js";
4
+ import { MergeCandidateSubmitParams, MergeQueueDecideParams, MergeQueueListParams } from "../schemas.js";
5
+ import { loadTeamDefinition, validateTeamDefinition } from "../topology/teams.js";
6
+
7
+ export function registerMergeQueueTools(pi: ExtensionAPI): void {
8
+ pi.registerTool({
9
+ name: "zob_merge_candidate_submit",
10
+ label: "ZOB Merge Candidate Submit",
11
+ description: "Submit a sandbox diff as a parent-owned merge-queue candidate. Metadata-only; never applies changes or writes source files.",
12
+ promptSnippet: "Queue a sandboxed merge candidate for parent review.",
13
+ parameters: MergeCandidateSubmitParams,
14
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
15
+ const team = loadTeamDefinition(ctx.cwd, params.team ?? "zob-core");
16
+ const errors = [...team.errors, ...validateTeamDefinition(ctx.cwd, team.definition)];
17
+ if (!team.definition || errors.length > 0) return { content: [{ type: "text", text: `zob_merge_candidate_submit failed_preflight:\n- ${errors.join("\n- ")}` }], details: { status: "failed_preflight", errors } };
18
+ try {
19
+ const candidate = submitMergeCandidate(ctx.cwd, team.definition, params);
20
+ pi.appendEntry("zob-merge-queue", { event: "candidate_queued", candidateId: candidate.candidateId, runId: candidate.runId, applyPerformed: false, productionWritesPerformed: false, autoApply: false, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false });
21
+ return { content: [{ type: "text", text: `zob_merge_candidate_submit: queued ${candidate.candidateId}` }], details: { schema: "zob.merge-candidate-submit-result.v1", candidate, bodyFreeViolations: mergeQueueBodyFreeViolations(candidate) } };
22
+ } catch (error) {
23
+ const message = error instanceof Error ? error.message : String(error);
24
+ return { content: [{ type: "text", text: `zob_merge_candidate_submit blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
25
+ }
26
+ },
27
+ });
28
+
29
+ pi.registerTool({
30
+ name: "zob_merge_queue_decide",
31
+ label: "ZOB Merge Queue Decide",
32
+ description: "Record a parent-owned merge queue decision. Approval means manual-apply eligible only; this tool never applies changes.",
33
+ promptSnippet: "Record a parent-owned merge queue decision.",
34
+ parameters: MergeQueueDecideParams,
35
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
36
+ const team = loadTeamDefinition(ctx.cwd, params.team ?? "zob-core");
37
+ const errors = [...team.errors, ...validateTeamDefinition(ctx.cwd, team.definition)];
38
+ if (!team.definition || errors.length > 0) return { content: [{ type: "text", text: `zob_merge_queue_decide failed_preflight:\n- ${errors.join("\n- ")}` }], details: { status: "failed_preflight", errors } };
39
+ try {
40
+ const decision = decideMergeCandidate(ctx.cwd, team.definition, params);
41
+ pi.appendEntry("zob-merge-queue", { event: "decision_recorded", candidateId: decision.candidateId, decision: decision.decision, applyPerformed: false, productionWritesPerformed: false, autoApply: false, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false });
42
+ return { content: [{ type: "text", text: `zob_merge_queue_decide: ${decision.decision} ${decision.candidateId}` }], details: { schema: "zob.merge-decision-result.v1", decision, bodyFreeViolations: mergeQueueBodyFreeViolations(decision) } };
43
+ } catch (error) {
44
+ const message = error instanceof Error ? error.message : String(error);
45
+ return { content: [{ type: "text", text: `zob_merge_queue_decide blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
46
+ }
47
+ },
48
+ });
49
+
50
+ pi.registerTool({
51
+ name: "zob_merge_queue_list",
52
+ label: "ZOB Merge Queue List",
53
+ description: "List metadata-only parent merge-queue candidates and latest decisions. Bodies/diffs are never returned.",
54
+ promptSnippet: "List parent-owned merge queue metadata.",
55
+ parameters: MergeQueueListParams,
56
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
57
+ const candidates = listMergeQueue(ctx.cwd, params);
58
+ return { content: [{ type: "text", text: `zob_merge_queue_list: ${candidates.length} candidate(s)` }], details: { schema: "zob.merge-queue-list.v1", candidates, bodyFreeViolations: mergeQueueBodyFreeViolations(candidates) } };
59
+ },
60
+ });
61
+ }
@@ -0,0 +1,77 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ import {
4
+ MissionControlProposeCommandParams,
5
+ MissionControlSnapshotParams,
6
+ ZobComsReadinessParams,
7
+ } from "../schemas.js";
8
+ import type { TeamDefinition } from "../types.js";
9
+ import {
10
+ buildMissionControlSnapshot,
11
+ buildZobCommunicationReadinessAudit,
12
+ writeMissionControlCommandProposal,
13
+ } from "../mission-control.js";
14
+ import { loadTeamDefinition, validateTeamDefinition } from "../topology/teams.js";
15
+
16
+ function loadValidTeam(repoRoot: string, teamName: string | undefined): { definition?: TeamDefinition; errors: string[] } {
17
+ const team = loadTeamDefinition(repoRoot, teamName ?? "zob-core");
18
+ const errors = [...team.errors, ...validateTeamDefinition(repoRoot, team.definition)];
19
+ return { definition: team.definition, errors };
20
+ }
21
+
22
+ export function registerMissionControlTools(pi: ExtensionAPI): void {
23
+ pi.registerTool({
24
+ name: "zob_coms_readiness",
25
+ label: "ZOB Coms Readiness",
26
+ description: "Audit local ZOB communication readiness: topology guard, hash-only ledgers, bounded awaits, disabled transport, proposal-only commands. No network coms.",
27
+ parameters: ZobComsReadinessParams,
28
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
29
+ const team = loadValidTeam(ctx.cwd, params.team);
30
+ if (team.errors.length > 0 || !team.definition) return { content: [{ type: "text", text: `zob_coms_readiness failed_preflight:\n- ${team.errors.join("\n- ")}` }], details: { status: "failed_preflight", errors: team.errors } };
31
+ const audit = buildZobCommunicationReadinessAudit(ctx.cwd, team.definition);
32
+ return { content: [{ type: "text", text: `zob_coms_readiness: ${audit.verdict}` }], details: audit };
33
+ },
34
+ });
35
+
36
+ pi.registerTool({
37
+ name: "zob_mission_control_snapshot",
38
+ label: "ZOB Mission Control Snapshot",
39
+ description: "Read a metadata-only Mission Control dashboard snapshot over queue, runs, factories, telemetry, coms, autonomy audit, and disabled transport status.",
40
+ parameters: MissionControlSnapshotParams,
41
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
42
+ const team = loadValidTeam(ctx.cwd, params.team);
43
+ if (team.errors.length > 0 || !team.definition) return { content: [{ type: "text", text: `zob_mission_control_snapshot failed_preflight:\n- ${team.errors.join("\n- ")}` }], details: { status: "failed_preflight", errors: team.errors } };
44
+ const snapshot = buildMissionControlSnapshot(ctx.cwd, team.definition, { runId: params.runId, limit: params.limit });
45
+ return { content: [{ type: "text", text: "zob_mission_control_snapshot: metadata-only" }], details: snapshot };
46
+ },
47
+ });
48
+
49
+ pi.registerTool({
50
+ name: "zob_mission_control_propose_command",
51
+ label: "ZOB Mission Control Propose Command",
52
+ description: "Create a typed parent-owned Mission Control command proposal. Proposal-only; no direct worker writes, no transport dispatch, no raw rationale/body storage.",
53
+ parameters: MissionControlProposeCommandParams,
54
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
55
+ const team = loadValidTeam(ctx.cwd, params.team);
56
+ if (team.errors.length > 0 || !team.definition) return { content: [{ type: "text", text: `zob_mission_control_propose_command failed_preflight:\n- ${team.errors.join("\n- ")}` }], details: { status: "failed_preflight", errors: team.errors } };
57
+ try {
58
+ const proposal = writeMissionControlCommandProposal(ctx.cwd, team.definition, {
59
+ proposalId: params.proposalId,
60
+ runId: params.runId,
61
+ command: params.command,
62
+ requestedBy: params.requestedBy,
63
+ targetRole: params.targetRole,
64
+ priority: params.priority,
65
+ rationaleHash: params.rationaleHash,
66
+ artifactRefs: params.artifactRefs,
67
+ todoId: params.todoId,
68
+ subtreeRootTodoId: params.subtreeRootTodoId,
69
+ });
70
+ return { content: [{ type: "text", text: `zob_mission_control_propose_command proposed: ${proposal.proposalId}` }], details: proposal };
71
+ } catch (error) {
72
+ const message = error instanceof Error ? error.message : String(error);
73
+ return { content: [{ type: "text", text: `zob_mission_control_propose_command blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
74
+ }
75
+ },
76
+ });
77
+ }
@@ -0,0 +1,106 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ import { buildZobLivePresenceSummary } from "../coms-v2/presence.js";
4
+ import { readZobComsV2Policy } from "../coms-v2/policy.js";
5
+ import { OrchestrateRunParams, ChainRunParams } from "../schemas.js";
6
+ import { createSupervisedReadonlyDispatcher } from "../child-runner.js";
7
+ import { runOrchestrateRun } from "../orchestration/run.js";
8
+ import { runSupervisedReadonlyOrchestration } from "../orchestration/supervised-readonly.js";
9
+ import { runChainPlanOnly } from "../topology/chains.js";
10
+ import { sha256 } from "../utils/hashing.js";
11
+ import { isRecord } from "../utils/records.js";
12
+ import type { HarnessRuntimeState } from "./state.js";
13
+ import { strictGoalSpecErrors } from "./state.js";
14
+
15
+ function agenticComsLivePreflightErrors(repoRoot: string, execution: string | undefined): string[] {
16
+ if (execution !== "supervised_readonly") return [];
17
+ const policy = readZobComsV2Policy(repoRoot);
18
+ if (!policy.agenticWorkflowsRequireLive) return [];
19
+ if (policy.legacy.appendOnlySendEnabled !== false) return ["ZOB coms v2 blocks supervised_readonly: legacy append-only send must be disabled for agentic workflows"];
20
+ if (policy.mode !== "required_local" && policy.mode !== "required_network") return [`ZOB coms v2 blocks supervised_readonly: agentic workflows require required_local live transport, current mode=${policy.mode}`];
21
+ if (policy.mode === "required_network") return ["ZOB coms v2 blocks supervised_readonly: required_network remains gated; use required_local live transport"];
22
+ const presence = buildZobLivePresenceSummary(repoRoot);
23
+ if (presence.dispatchEnabled !== true || presence.online <= 0 || presence.networkEnabled !== false) return [`ZOB coms v2 blocks supervised_readonly: live local registry is not ready (${JSON.stringify({ online: presence.online, stale: presence.stale, offline: presence.offline, dispatchEnabled: presence.dispatchEnabled, networkEnabled: presence.networkEnabled })})`];
24
+ return [];
25
+ }
26
+
27
+ export function registerOrchestrationTools(pi: ExtensionAPI, state: HarnessRuntimeState): void {
28
+ pi.registerTool({
29
+ name: "orchestrate_run",
30
+ label: "Orchestrate Run",
31
+ description: [
32
+ "Plan a ZOB Orchestrator -> Lead -> Worker run from a team topology manifest.",
33
+ "v1.4 supports plan_only, model-free supervised_smoke metadata, and explicit supervised_readonly parent-owned read-only child dispatch.",
34
+ ].join(" "),
35
+ promptSnippet: "Plan an Orchestrator/Lead/Worker run; only execution=supervised_readonly dispatches read-only child agents",
36
+ promptGuidelines: [
37
+ "Use orchestrate_run when a task needs multiple leads/workers but should remain parent-preflighted.",
38
+ "Use execution=plan_only for contracts only, execution=supervised_smoke for model-free read-only planning metadata, or execution=supervised_readonly only when live parent-owned read-only child dispatch is explicitly intended.",
39
+ "Do not treat a planned orchestration as completed implementation work.",
40
+ ],
41
+ parameters: OrchestrateRunParams,
42
+ async execute(_toolCallId, params, signal, onUpdate, ctx) {
43
+ const goalErrors = strictGoalSpecErrors(state, { kind: "orchestrate_run", goal: params.goal, originalUserAsk: params.original_user_ask });
44
+ if (goalErrors.length > 0) {
45
+ const result = { status: "failed_preflight", runId: params.run_id ?? "not-started", runDir: "", tasks: 0, artifacts: [], errors: goalErrors };
46
+ return { content: [{ type: "text", text: `orchestrate_run failed_preflight:\n- ${goalErrors.join("\n- ")}\nSet /goal_gate or /job_intake before dispatch.` }], details: result };
47
+ }
48
+ const liveComsErrors = agenticComsLivePreflightErrors(ctx.cwd, params.execution);
49
+ if (liveComsErrors.length > 0) {
50
+ const result = { status: "failed_preflight", runId: params.run_id ?? "not-started", runDir: "", tasks: 0, artifacts: [], errors: liveComsErrors, comsLiveRequired: true };
51
+ return { content: [{ type: "text", text: `orchestrate_run failed_preflight:\n- ${liveComsErrors.join("\n- ")}` }], details: result };
52
+ }
53
+ const result = params.execution === "supervised_readonly"
54
+ ? await runSupervisedReadonlyOrchestration(ctx.cwd, params, createSupervisedReadonlyDispatcher(ctx, signal, undefined, (partial) => {
55
+ onUpdate?.({ content: [{ type: "text", text: partial.output || partial.stderr || "supervised_readonly child running..." }], details: { status: "running", agent: partial.agent, outputHash: partial.output ? sha256(partial.output) : undefined } });
56
+ }))
57
+ : runOrchestrateRun(ctx.cwd, params);
58
+ const resultRecord = isRecord(result) ? result : {};
59
+ pi.appendEntry("zob-orchestrate-run", {
60
+ runId: typeof resultRecord.runId === "string" ? resultRecord.runId : params.run_id ?? "unknown-run",
61
+ team: params.team ?? "zob-core",
62
+ execution: params.execution ?? "plan_only",
63
+ status: typeof resultRecord.status === "string" ? resultRecord.status : "unknown",
64
+ tasks: typeof resultRecord.tasks === "number" ? resultRecord.tasks : 0,
65
+ artifacts: Array.isArray(resultRecord.artifacts) ? resultRecord.artifacts : [],
66
+ errors: Array.isArray(resultRecord.errors) ? resultRecord.errors : [],
67
+ });
68
+ const artifacts = Array.isArray(resultRecord.artifacts) ? resultRecord.artifacts.filter((artifact): artifact is string => typeof artifact === "string") : [];
69
+ const errors = Array.isArray(resultRecord.errors) ? resultRecord.errors.filter((error): error is string => typeof error === "string") : [];
70
+ const text = [
71
+ `orchestrate_run ${String(resultRecord.status ?? "unknown")}: ${String(resultRecord.runId ?? "unknown-run")}`,
72
+ `runDir: ${String(resultRecord.runDir ?? "")}`,
73
+ `execution: ${params.execution ?? "plan_only"}`,
74
+ `tasks: ${String(resultRecord.tasks ?? 0)}`,
75
+ typeof resultRecord.dispatched === "number" ? `dispatched: ${resultRecord.dispatched}` : undefined,
76
+ typeof resultRecord.completed === "number" ? `completed: ${resultRecord.completed}` : undefined,
77
+ typeof resultRecord.failed === "number" ? `failed: ${resultRecord.failed}` : undefined,
78
+ artifacts.length > 0 ? `artifacts:\n- ${artifacts.join("\n- ")}` : "artifacts: none",
79
+ errors.length > 0 ? `errors:\n- ${errors.join("\n- ")}` : "errors: none",
80
+ ].filter((line): line is string => typeof line === "string").join("\n");
81
+ return { content: [{ type: "text", text }], details: result };
82
+ },
83
+ });
84
+
85
+ pi.registerTool({
86
+ name: "chain_run",
87
+ label: "Chain Run",
88
+ description: [
89
+ "Plan a typed contract-first chain from .pi/chains without live child execution.",
90
+ "Only plan_only read-only chains are supported; unsafe tools, unknown agents, and unknown output contracts fail preflight.",
91
+ ].join(" "),
92
+ promptSnippet: "Plan a typed read-only chain run without executing child agents",
93
+ promptGuidelines: [
94
+ "Use chain_run for reusable explore/plan/oracle flows where delegate_task-shaped contracts should be planned first.",
95
+ "Do not use chain_run for write-enabled execution; sandboxed execution is not implemented.",
96
+ ],
97
+ parameters: ChainRunParams,
98
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
99
+ const result = runChainPlanOnly(ctx.cwd, params);
100
+ const text = result.status === "planned"
101
+ ? `chain_run planned ${result.steps} step(s) for ${result.chain} at ${result.runDir}`
102
+ : `chain_run preflight failed:\n- ${result.errors.join("\n- ")}`;
103
+ return { content: [{ type: "text", text }], details: result };
104
+ },
105
+ });
106
+ }
@@ -0,0 +1,123 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ import { buildProjectDnaAgenticPlan, buildProjectDnaFederatedQueryResult, buildProjectDnaQueryResult, buildProjectDnaReadinessAudit, writeProjectDnaWritebackProposal } from "../project-dna.js";
4
+ import { ProjectDnaFederatedQueryParams, ProjectDnaPlanWorkflowParams, ProjectDnaQueryParams, ProjectDnaReadinessParams, ProjectDnaWritebackProposalParams } from "../schemas.js";
5
+
6
+ export function registerProjectDnaTools(pi: ExtensionAPI): void {
7
+ pi.registerTool({
8
+ name: "zob_project_dna_readiness",
9
+ label: "ZOB ProjectDNA Readiness",
10
+ description: "Audit ProjectDNA plan/runtime readiness from repo-local artifacts. Read-only, metadata-only, no source scan or backend write.",
11
+ parameters: ProjectDnaReadinessParams,
12
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
13
+ try {
14
+ const audit = buildProjectDnaReadinessAudit(ctx.cwd, { scanDir: params.scan_dir });
15
+ const verdict = typeof audit.verdict === "string" ? audit.verdict : "unknown";
16
+ const noShip = audit.no_ship === true ? " no_ship=true" : "";
17
+ return { content: [{ type: "text", text: `zob_project_dna_readiness: ${verdict}${noShip}` }], details: audit };
18
+ } catch (error) {
19
+ const message = error instanceof Error ? error.message : String(error);
20
+ return { content: [{ type: "text", text: `zob_project_dna_readiness blocked: ${message}` }], details: { schema: "zob.project-dna-readiness.v1", verdict: "blocked", errors: [message], no_ship: true, source_project_modified: false, knowledge_backend_write_enabled: false } };
21
+ }
22
+ },
23
+ });
24
+
25
+ pi.registerTool({
26
+ name: "zob_project_dna_plan_workflow",
27
+ label: "ZOB ProjectDNA Plan Workflow",
28
+ description: "Build a metadata-only agentic ProjectDNA workflow plan from a repo-local manifest v2. No source scan, child dispatch, network, source write, or backend write.",
29
+ parameters: ProjectDnaPlanWorkflowParams,
30
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
31
+ try {
32
+ const plan = buildProjectDnaAgenticPlan(ctx.cwd, {
33
+ manifestPath: params.manifest_path,
34
+ scanDir: params.scan_dir,
35
+ });
36
+ const profile = typeof plan.effective_compute_profile === "string" ? plan.effective_compute_profile : "unknown";
37
+ const capture = typeof plan.effective_capture_mode === "string" ? plan.effective_capture_mode : "unknown";
38
+ const lanes = Array.isArray(plan.lanes) ? plan.lanes.length : 0;
39
+ return { content: [{ type: "text", text: `zob_project_dna_plan_workflow: profile=${profile} capture=${capture} lanes=${lanes}` }], details: plan };
40
+ } catch (error) {
41
+ const message = error instanceof Error ? error.message : String(error);
42
+ return { content: [{ type: "text", text: `zob_project_dna_plan_workflow blocked: ${message}` }], details: { schema: "zob.project-dna-agentic-plan.v1", status: "blocked", errors: [message], metadata_only: true, no_execution: true, source_project_modified: false, knowledge_backend_write_enabled: false, child_direct_dispatch: false } };
43
+ }
44
+ },
45
+ });
46
+
47
+ pi.registerTool({
48
+ name: "zob_project_dna_query",
49
+ label: "ZOB ProjectDNA Query",
50
+ description: "Return a bounded cited ProjectDNA context pack from repo-local scan artifacts. Read-only; no source scan, no backend write, no child dispatch.",
51
+ parameters: ProjectDnaQueryParams,
52
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
53
+ try {
54
+ const result = buildProjectDnaQueryResult(ctx.cwd, {
55
+ scanDir: params.scan_dir,
56
+ query: params.query,
57
+ maxFiles: params.max_files,
58
+ maxContextTokens: params.max_context_tokens,
59
+ allowedSources: params.allowed_sources,
60
+ contextScopeId: params.context_scope_id,
61
+ });
62
+ const sourceId = typeof result.source_id === "string" ? result.source_id : "unknown-source";
63
+ const files = Array.isArray(result.files_to_read_first) ? result.files_to_read_first.length : 0;
64
+ const citations = Array.isArray(result.citations) ? result.citations.length : 0;
65
+ return { content: [{ type: "text", text: `zob_project_dna_query: source=${sourceId} files=${files} citations=${citations}` }], details: result };
66
+ } catch (error) {
67
+ const message = error instanceof Error ? error.message : String(error);
68
+ return { content: [{ type: "text", text: `zob_project_dna_query blocked: ${message}` }], details: { schema: "zob.project-dna-query-result.v1", status: "blocked", errors: [message], raw_query_persisted: false, source_project_modified: false, knowledge_backend_write_enabled: false, child_dispatch_allowed: false } };
69
+ }
70
+ },
71
+ });
72
+
73
+ pi.registerTool({
74
+ name: "zob_project_dna_federated_query",
75
+ label: "ZOB ProjectDNA Federated Query",
76
+ description: "Merge bounded cited ProjectDNA context from multiple repo-local scan artifact directories. Metadata-only and proposal-only.",
77
+ parameters: ProjectDnaFederatedQueryParams,
78
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
79
+ try {
80
+ const result = buildProjectDnaFederatedQueryResult(ctx.cwd, {
81
+ scanDirs: params.scan_dirs,
82
+ query: params.query,
83
+ maxFilesPerSource: params.max_files_per_source,
84
+ maxTotalFiles: params.max_total_files,
85
+ maxContextTokens: params.max_context_tokens,
86
+ allowedSources: params.allowed_sources,
87
+ contextScopeId: params.context_scope_id,
88
+ });
89
+ const sourceCount = typeof result.source_count === "number" ? result.source_count : 0;
90
+ const files = Array.isArray(result.files_to_read_first) ? result.files_to_read_first.length : 0;
91
+ return { content: [{ type: "text", text: `zob_project_dna_federated_query: sources=${sourceCount} files=${files}` }], details: result };
92
+ } catch (error) {
93
+ const message = error instanceof Error ? error.message : String(error);
94
+ return { content: [{ type: "text", text: `zob_project_dna_federated_query blocked: ${message}` }], details: { schema: "zob.project-dna-federated-query-result.v1", status: "blocked", errors: [message], raw_query_persisted: false, source_project_modified: false, knowledge_backend_write_enabled: false, child_dispatch_allowed: false } };
95
+ }
96
+ },
97
+ });
98
+
99
+ pi.registerTool({
100
+ name: "zob_project_dna_writeback_proposal",
101
+ label: "ZOB ProjectDNA Writeback Proposal",
102
+ description: "Append a hash-only ProjectDNA learning/writeback proposal. No durable promotion and no external knowledge-backend write.",
103
+ parameters: ProjectDnaWritebackProposalParams,
104
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
105
+ try {
106
+ const proposal = writeProjectDnaWritebackProposal(ctx.cwd, {
107
+ runId: params.run_id,
108
+ proposalId: params.proposal_id,
109
+ sourceIds: params.source_ids,
110
+ observedPatternHash: params.observed_pattern_hash,
111
+ proposedCapsuleHash: params.proposed_capsule_hash,
112
+ evidenceRefs: params.evidence_refs,
113
+ recommendedArtifact: params.recommended_artifact,
114
+ });
115
+ const proposalId = typeof proposal.proposal_id === "string" ? proposal.proposal_id : "unknown";
116
+ return { content: [{ type: "text", text: `zob_project_dna_writeback_proposal proposed: ${proposalId}` }], details: proposal };
117
+ } catch (error) {
118
+ const message = error instanceof Error ? error.message : String(error);
119
+ return { content: [{ type: "text", text: `zob_project_dna_writeback_proposal blocked: ${message}` }], details: { schema: "zob.project-dna-writeback-proposal.v1", status: "blocked", errors: [message], raw_problem_stored: false, raw_pattern_stored: false, external_knowledge_backend_write_enabled: false } };
120
+ }
121
+ },
122
+ });
123
+ }
@@ -0,0 +1,93 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ import { createWorkerPoolOwnerDecision, createWorkerPoolOwnerRequest, createWorkerPoolPlan, listWorkerPoolPlans, workerPoolBodyFreeViolations } from "../worker-pool.js";
4
+ import { WorkerPoolOwnerDecisionParams, WorkerPoolOwnerRequestParams, WorkerPoolPlanParams, WorkerPoolStatusParams } from "../schemas.js";
5
+ import { loadTeamDefinition, validateTeamDefinition } from "../topology/teams.js";
6
+
7
+ export function registerWorkerPoolTools(pi: ExtensionAPI): void {
8
+ pi.registerTool({
9
+ name: "zob_worker_pool_plan",
10
+ label: "ZOB Worker Pool Plan",
11
+ description: "Create a parent-owned metadata-only worker pool plan for read-across/write-by-owner coordination. Enforces write paths within owned paths, integrates active workspace claims, records sandbox/merge/rollback/oracle gates, and never applies changes.",
12
+ promptSnippet: "Plan parent-owned worker pool assignments with owned/write/read-across paths, workspace claims, and no-apply safety gates.",
13
+ parameters: WorkerPoolPlanParams,
14
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
15
+ const team = loadTeamDefinition(ctx.cwd, params.team ?? "zob-core");
16
+ const errors = [...team.errors, ...validateTeamDefinition(ctx.cwd, team.definition)];
17
+ if (!team.definition || errors.length > 0) return { content: [{ type: "text", text: `zob_worker_pool_plan failed_preflight:\n- ${errors.join("\n- ")}` }], details: { status: "failed_preflight", errors } };
18
+ try {
19
+ const { team: _team, ...input } = params;
20
+ const plan = createWorkerPoolPlan(ctx.cwd, team.definition, input);
21
+ const bodyFreeViolations = workerPoolBodyFreeViolations(plan);
22
+ pi.appendEntry("zob-worker-pool", { event: "plan_recorded", poolId: plan.poolId, goalId: plan.goalId, status: plan.status, conflicts: plan.conflicts.length, productionWritesPerformed: false, autoApply: false, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false });
23
+ return { content: [{ type: "text", text: `zob_worker_pool_plan: ${plan.status} ${plan.poolId}` }], details: { schema: "zob.worker-pool-plan-result.v1", plan, bodyFreeViolations } };
24
+ } catch (error) {
25
+ const message = error instanceof Error ? error.message : String(error);
26
+ return { content: [{ type: "text", text: `zob_worker_pool_plan blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
27
+ }
28
+ },
29
+ });
30
+
31
+ pi.registerTool({
32
+ name: "zob_worker_pool_status",
33
+ label: "ZOB Worker Pool Status",
34
+ description: "List parent-owned metadata-only worker pool plans, ownership coverage, workspace-claim posture, and sandbox/merge gate blockers. Bodies are never persisted or returned.",
35
+ promptSnippet: "List worker pool metadata, ownership coverage, claim coverage, and conflict posture.",
36
+ parameters: WorkerPoolStatusParams,
37
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
38
+ try {
39
+ const plans = listWorkerPoolPlans(ctx.cwd, params);
40
+ return { content: [{ type: "text", text: `zob_worker_pool_status: ${plans.length} plan(s)` }], details: { schema: "zob.worker-pool-status.v1", plans, bodyFreeViolations: workerPoolBodyFreeViolations(plans) } };
41
+ } catch (error) {
42
+ const message = error instanceof Error ? error.message : String(error);
43
+ return { content: [{ type: "text", text: `zob_worker_pool_status blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
44
+ }
45
+ },
46
+ });
47
+
48
+ pi.registerTool({
49
+ name: "zob_worker_pool_owner_request",
50
+ label: "ZOB Worker Pool Owner Request",
51
+ description: "Validate an owner request against the existing pool plan, then append a body-free OWNER_CHANGE_REQUEST to parent-visible Goal Room. No direct worker-to-worker free chat or apply.",
52
+ promptSnippet: "Request an owner-handled change through canonical Goal Room metadata after owner path coverage validation.",
53
+ parameters: WorkerPoolOwnerRequestParams,
54
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
55
+ const team = loadTeamDefinition(ctx.cwd, params.team ?? "zob-core");
56
+ const errors = [...team.errors, ...validateTeamDefinition(ctx.cwd, team.definition)];
57
+ if (!team.definition || errors.length > 0) return { content: [{ type: "text", text: `zob_worker_pool_owner_request failed_preflight:\n- ${errors.join("\n- ")}` }], details: { status: "failed_preflight", errors } };
58
+ try {
59
+ const { team: _team, ...input } = params;
60
+ const request = createWorkerPoolOwnerRequest(ctx.cwd, team.definition, input);
61
+ const bodyFreeViolations = workerPoolBodyFreeViolations(request);
62
+ pi.appendEntry("zob-worker-pool", { event: "owner_request_recorded", requestId: request.requestId, poolId: request.poolId, goalRoomMsgId: request.goalRoomMsgId, parentVisible: true, hiddenPeerChat: false, workerToWorkerDirect: false, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false });
63
+ return { content: [{ type: "text", text: `zob_worker_pool_owner_request: ${request.requestId}` }], details: { schema: "zob.worker-pool-owner-request-result.v1", request, bodyFreeViolations } };
64
+ } catch (error) {
65
+ const message = error instanceof Error ? error.message : String(error);
66
+ return { content: [{ type: "text", text: `zob_worker_pool_owner_request blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
67
+ }
68
+ },
69
+ });
70
+
71
+ pi.registerTool({
72
+ name: "zob_worker_pool_owner_decision",
73
+ label: "ZOB Worker Pool Owner Decision",
74
+ description: "Append a body-free OWNER_CHANGE_DECISION to the parent-visible Goal Room and record parent-owned owner decision metadata. Does not apply diffs.",
75
+ promptSnippet: "Record an owner decision for a worker pool change request.",
76
+ parameters: WorkerPoolOwnerDecisionParams,
77
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
78
+ const team = loadTeamDefinition(ctx.cwd, params.team ?? "zob-core");
79
+ const errors = [...team.errors, ...validateTeamDefinition(ctx.cwd, team.definition)];
80
+ if (!team.definition || errors.length > 0) return { content: [{ type: "text", text: `zob_worker_pool_owner_decision failed_preflight:\n- ${errors.join("\n- ")}` }], details: { status: "failed_preflight", errors } };
81
+ try {
82
+ const { team: _team, ...input } = params;
83
+ const decision = createWorkerPoolOwnerDecision(ctx.cwd, team.definition, input);
84
+ const bodyFreeViolations = workerPoolBodyFreeViolations(decision);
85
+ pi.appendEntry("zob-worker-pool", { event: "owner_decision_recorded", decisionId: decision.decisionId, requestId: decision.requestId, poolId: decision.poolId, goalRoomMsgId: decision.goalRoomMsgId, parentVisible: true, hiddenPeerChat: false, workerToWorkerDirect: false, productionWritesPerformed: false, autoApply: false, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false });
86
+ return { content: [{ type: "text", text: `zob_worker_pool_owner_decision: ${decision.decisionId}` }], details: { schema: "zob.worker-pool-owner-decision-result.v1", decision, bodyFreeViolations } };
87
+ } catch (error) {
88
+ const message = error instanceof Error ? error.message : String(error);
89
+ return { content: [{ type: "text", text: `zob_worker_pool_owner_decision blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
90
+ }
91
+ },
92
+ });
93
+ }
@@ -0,0 +1,62 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ import { createWorkspaceClaim, listWorkspaceClaims, releaseWorkspaceClaim, workspaceClaimBodyFreeViolations } from "../workspace-claims.js";
4
+ import { WorkspaceClaimParams, WorkspaceClaimsListParams, WorkspaceReleaseParams } from "../schemas.js";
5
+ import { loadTeamDefinition, validateTeamDefinition } from "../topology/teams.js";
6
+
7
+ export function registerWorkspaceClaimTools(pi: ExtensionAPI): void {
8
+ pi.registerTool({
9
+ name: "zob_workspace_claim",
10
+ label: "ZOB Workspace Claim",
11
+ description: "Create a metadata-only workspace path lease for parallel write intent. Detects conflicts and never writes source files or applies changes.",
12
+ promptSnippet: "Claim workspace paths for governed parallel write intent.",
13
+ parameters: WorkspaceClaimParams,
14
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
15
+ const team = loadTeamDefinition(ctx.cwd, params.team ?? "zob-core");
16
+ const errors = [...team.errors, ...validateTeamDefinition(ctx.cwd, team.definition)];
17
+ if (!team.definition || errors.length > 0) return { content: [{ type: "text", text: `zob_workspace_claim failed_preflight:\n- ${errors.join("\n- ")}` }], details: { status: "failed_preflight", errors } };
18
+ try {
19
+ const claim = createWorkspaceClaim(ctx.cwd, team.definition, params);
20
+ const bodyFreeViolations = workspaceClaimBodyFreeViolations(claim);
21
+ pi.appendEntry("zob-workspace-claim", { event: claim.status, claimId: claim.claimId, conflicts: claim.conflicts.length, productionWritesPerformed: false, autoApply: false, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false });
22
+ return { content: [{ type: "text", text: `zob_workspace_claim: ${claim.status} ${claim.claimId}` }], details: { schema: "zob.workspace-claim-result.v1", claim, bodyFreeViolations } };
23
+ } catch (error) {
24
+ const message = error instanceof Error ? error.message : String(error);
25
+ return { content: [{ type: "text", text: `zob_workspace_claim blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
26
+ }
27
+ },
28
+ });
29
+
30
+ pi.registerTool({
31
+ name: "zob_workspace_release",
32
+ label: "ZOB Workspace Release",
33
+ description: "Release a metadata-only workspace path lease. Does not apply changes or mutate source files.",
34
+ promptSnippet: "Release a governed workspace claim.",
35
+ parameters: WorkspaceReleaseParams,
36
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
37
+ const team = loadTeamDefinition(ctx.cwd, params.team ?? "zob-core");
38
+ const errors = [...team.errors, ...validateTeamDefinition(ctx.cwd, team.definition)];
39
+ if (!team.definition || errors.length > 0) return { content: [{ type: "text", text: `zob_workspace_release failed_preflight:\n- ${errors.join("\n- ")}` }], details: { status: "failed_preflight", errors } };
40
+ try {
41
+ const release = releaseWorkspaceClaim(ctx.cwd, team.definition, params);
42
+ pi.appendEntry("zob-workspace-claim", { event: "released", claimId: release.claimId, releaseId: release.releaseId, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false });
43
+ return { content: [{ type: "text", text: `zob_workspace_release: ${release.claimId}` }], details: { schema: "zob.workspace-release-result.v1", release } };
44
+ } catch (error) {
45
+ const message = error instanceof Error ? error.message : String(error);
46
+ return { content: [{ type: "text", text: `zob_workspace_release blocked: ${message}` }], details: { status: "blocked", errors: [message] } };
47
+ }
48
+ },
49
+ });
50
+
51
+ pi.registerTool({
52
+ name: "zob_workspace_claims_list",
53
+ label: "ZOB Workspace Claims List",
54
+ description: "List active metadata-only workspace claims/leases. Bodies are never stored or returned.",
55
+ promptSnippet: "List governed workspace claims.",
56
+ parameters: WorkspaceClaimsListParams,
57
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
58
+ const claims = listWorkspaceClaims(ctx.cwd, params);
59
+ return { content: [{ type: "text", text: `zob_workspace_claims_list: ${claims.length} claim(s)` }], details: { schema: "zob.workspace-claims-list.v1", claims, bodyFreeViolations: workspaceClaimBodyFreeViolations(claims) } };
60
+ },
61
+ });
62
+ }