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,225 @@
1
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
2
+ import { basename, join } from "node:path";
3
+
4
+ import type { ModeName, RuleEnforcementLevel, RuleOracleRequirement, RulePack, RuleResolution, RuleResolverInput } from "./types.js";
5
+ import { pathMatches, safeFileStem } from "./utils/paths.js";
6
+ import { isRecord } from "./utils/records.js";
7
+
8
+ const RULE_PACK_SCHEMA = "zob.rule-pack.v1";
9
+ const RULE_RESOLUTION_SCHEMA = "zob.rule-resolution.v1";
10
+ const RULE_PACK_ORDER = ["always", "project", "runtime", "factory", "orchestration", "prompts", "docs", "sandbox", "oracle"];
11
+ const MODE_NAMES = new Set<ModeName>(["explore", "plan", "implement", "oracle", "factory", "orchestrator"]);
12
+ const ENFORCEMENT_LEVELS = new Set<RuleEnforcementLevel>(["advisory", "warn", "preflight_fail", "block", "no_ship", "human_approval"]);
13
+
14
+ const PROFILE_PATHS: Array<{ profile: string; patterns: string[] }> = [
15
+ { profile: "factory-engineer", patterns: [".pi/extensions/zob-harness/src/factory/**", ".pi/factories/**", "reports/factory-runs/**"] },
16
+ { profile: "orchestration-engineer", patterns: [".pi/extensions/zob-harness/src/orchestration/**", ".pi/extensions/zob-harness/src/topology/**", ".pi/teams/**", ".pi/orchestrations/**", "reports/orchestrations/**"] },
17
+ { profile: "prompt-ops", patterns: [".pi/agents/**", ".pi/prompts/**", ".pi/skills/**", ".pi/output-contracts/**", ".pi/chains/**"] },
18
+ { profile: "sandbox-engineer", patterns: ["reports/sandbox-runs/**", ".pi/extensions/zob-harness/src/safety.ts", ".pi/extensions/zob-harness/src/child-runner.ts"] },
19
+ { profile: "runtime-maintainer", patterns: [".pi/extensions/zob-harness/index.ts", ".pi/extensions/zob-harness/src/runtime/**", ".pi/extensions/zob-harness/src/schemas.ts", ".pi/extensions/zob-harness/src/types.ts", ".pi/extensions/zob-harness/src/rules.ts"] },
20
+ { profile: "docs-maintainer", patterns: ["docs/**", "README.md", "AGENTS.md"] },
21
+ ];
22
+
23
+ function isStringArray(value: unknown): value is string[] {
24
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
25
+ }
26
+
27
+ function isOracleRequirement(value: unknown): value is RuleOracleRequirement {
28
+ return typeof value === "boolean" || value === "conditional";
29
+ }
30
+
31
+ function rulesDir(repoRoot: string): string {
32
+ return join(repoRoot, ".pi", "rules");
33
+ }
34
+
35
+ function extractJsonBlock(markdown: string): string | undefined {
36
+ const fenced = markdown.match(/```json\s*([\s\S]*?)```/i);
37
+ if (fenced?.[1]) return fenced[1].trim();
38
+ const firstBrace = markdown.indexOf("{");
39
+ const lastBrace = markdown.lastIndexOf("}");
40
+ if (firstBrace >= 0 && lastBrace > firstBrace) return markdown.slice(firstBrace, lastBrace + 1);
41
+ return undefined;
42
+ }
43
+
44
+ function parseRulePackFile(filePath: string): { pack?: RulePack; errors: string[] } {
45
+ try {
46
+ const raw = readFileSync(filePath, "utf8");
47
+ const json = extractJsonBlock(raw);
48
+ if (!json) return { errors: [`Rule pack missing fenced json block: ${filePath}`] };
49
+ const parsed = JSON.parse(json) as unknown;
50
+ if (!isRecord(parsed)) return { errors: [`Rule pack json must be an object: ${filePath}`] };
51
+ const pack = parsed as unknown as RulePack;
52
+ pack.sourcePath = filePath;
53
+ const errors = validateRulePack(pack);
54
+ return errors.length > 0 ? { errors: errors.map((error) => `${basename(filePath)}: ${error}`) } : { pack, errors: [] };
55
+ } catch (error) {
56
+ return { errors: [`Could not parse rule pack '${filePath}': ${error instanceof Error ? error.message : String(error)}`] };
57
+ }
58
+ }
59
+
60
+ function dangerousPositiveInstruction(text: string): boolean {
61
+ return /\b(read|open|cat|print|dump|exfiltrate|extract)\b[^\n]*(\.env|secret|private key|~\/.ssh|~\/.aws|\.pem|\.key)/i.test(text)
62
+ || /\b(rm\s+-rf|git\s+reset\s+--hard|git\s+clean\s+-|sudo\b)\b/i.test(text);
63
+ }
64
+
65
+ export function validateRulePack(pack: RulePack | undefined): string[] {
66
+ const errors: string[] = [];
67
+ if (!pack || !isRecord(pack)) return ["Rule pack is missing"];
68
+ if (pack.schema !== RULE_PACK_SCHEMA) errors.push(`schema must be ${RULE_PACK_SCHEMA}`);
69
+ if (typeof pack.id !== "string" || pack.id.trim().length === 0) errors.push("id is required");
70
+ else if (safeFileStem(pack.id) !== pack.id) errors.push(`id must be path-safe: ${pack.id}`);
71
+ if (typeof pack.description !== "string" || pack.description.trim().length === 0) errors.push("description is required");
72
+ if (!isRecord(pack.applies_to)) {
73
+ errors.push("applies_to is required");
74
+ } else {
75
+ if (pack.applies_to.paths !== undefined && !isStringArray(pack.applies_to.paths)) errors.push("applies_to.paths must be a string array");
76
+ if (pack.applies_to.modes !== undefined && (!isStringArray(pack.applies_to.modes) || pack.applies_to.modes.some((mode) => !MODE_NAMES.has(mode as ModeName)))) errors.push("applies_to.modes must contain valid ZOB modes");
77
+ if (pack.applies_to.task_types !== undefined && !isStringArray(pack.applies_to.task_types)) errors.push("applies_to.task_types must be a string array");
78
+ if (pack.applies_to.profiles !== undefined && !isStringArray(pack.applies_to.profiles)) errors.push("applies_to.profiles must be a string array");
79
+ }
80
+ if (!isStringArray(pack.must_do) || pack.must_do.length === 0) errors.push("must_do must be a non-empty string array");
81
+ if (!isStringArray(pack.must_not_do) || pack.must_not_do.length === 0) errors.push("must_not_do must be a non-empty string array");
82
+ if (pack.allowed_tools !== undefined && !isStringArray(pack.allowed_tools)) errors.push("allowed_tools must be a string array");
83
+ if (!isStringArray(pack.required_validation)) errors.push("required_validation must be a string array");
84
+ if (!isOracleRequirement(pack.oracle_required)) errors.push("oracle_required must be boolean or 'conditional'");
85
+ if (!isStringArray(pack.no_ship_conditions)) errors.push("no_ship_conditions must be a string array");
86
+ if (!ENFORCEMENT_LEVELS.has(pack.enforcement)) errors.push("enforcement must be a known rule enforcement level");
87
+
88
+ for (const instruction of [...(isStringArray(pack.must_do) ? pack.must_do : []), ...(isStringArray(pack.required_validation) ? pack.required_validation : [])]) {
89
+ if (dangerousPositiveInstruction(instruction)) errors.push(`rule must not positively require secret access or destructive commands: ${instruction}`);
90
+ }
91
+ for (const tool of pack.allowed_tools ?? []) {
92
+ if (/secret|credential|sudo|rm-rf|shell-root/i.test(tool)) errors.push(`allowed_tools contains unsafe tool name: ${tool}`);
93
+ }
94
+ return errors;
95
+ }
96
+
97
+ export function listRulePackPaths(repoRoot: string): string[] {
98
+ const dir = rulesDir(repoRoot);
99
+ if (!existsSync(dir)) return [];
100
+ const files = readdirSync(dir).filter((fileName) => fileName.endsWith(".md"));
101
+ return files
102
+ .sort((left, right) => {
103
+ const leftIndex = RULE_PACK_ORDER.indexOf(basename(left, ".md"));
104
+ const rightIndex = RULE_PACK_ORDER.indexOf(basename(right, ".md"));
105
+ const normalizedLeft = leftIndex >= 0 ? leftIndex : RULE_PACK_ORDER.length;
106
+ const normalizedRight = rightIndex >= 0 ? rightIndex : RULE_PACK_ORDER.length;
107
+ return normalizedLeft - normalizedRight || left.localeCompare(right);
108
+ })
109
+ .map((fileName) => join(dir, fileName));
110
+ }
111
+
112
+ export function loadRulePack(repoRoot: string, id: string): { pack?: RulePack; rulePath: string; errors: string[] } {
113
+ if (safeFileStem(id) !== id) return { rulePath: join(rulesDir(repoRoot), `${safeFileStem(id)}.md`), errors: [`Invalid rule pack id '${id}'`] };
114
+ const rulePath = join(rulesDir(repoRoot), `${id}.md`);
115
+ if (!existsSync(rulePath)) return { rulePath, errors: [`Rule pack not found: ${rulePath}`] };
116
+ const parsed = parseRulePackFile(rulePath);
117
+ return { rulePath, ...parsed };
118
+ }
119
+
120
+ export function loadRulePacks(repoRoot: string): { packs: RulePack[]; errors: string[] } {
121
+ const packs: RulePack[] = [];
122
+ const errors: string[] = [];
123
+ for (const rulePath of listRulePackPaths(repoRoot)) {
124
+ const parsed = parseRulePackFile(rulePath);
125
+ if (parsed.pack) packs.push(parsed.pack);
126
+ errors.push(...parsed.errors);
127
+ }
128
+ return { packs, errors };
129
+ }
130
+
131
+ function pathPatternApplies(repoRoot: string, targetPath: string, pattern: string): boolean {
132
+ if (pattern === "**" || pattern === "*") return true;
133
+ return pathMatches(targetPath, pattern, repoRoot, repoRoot);
134
+ }
135
+
136
+ export function inferRuleProfile(input: RuleResolverInput): string {
137
+ if (input.profile && input.profile.trim().length > 0) return input.profile;
138
+ const targetPaths = input.paths ?? [];
139
+ for (const targetPath of targetPaths) {
140
+ for (const candidate of PROFILE_PATHS) {
141
+ if (candidate.patterns.some((pattern) => pathPatternApplies(input.repoRoot, targetPath, pattern))) return candidate.profile;
142
+ }
143
+ }
144
+ const text = input.taskText?.toLowerCase() ?? "";
145
+ if (/sandbox|write autonomy|diff gate|rollback/.test(text)) return "sandbox-engineer";
146
+ if (input.mode === "factory") return "factory-engineer";
147
+ if (input.mode === "oracle") return "oracle-reviewer";
148
+ return "project-maintainer";
149
+ }
150
+
151
+ function rulePackApplies(pack: RulePack, input: RuleResolverInput, profile: string): boolean {
152
+ if (pack.id === "always" || pack.id === "project") return true;
153
+ const applies = pack.applies_to;
154
+ if (applies.profiles?.includes(profile)) return true;
155
+ if (input.mode && applies.modes?.includes(input.mode)) return true;
156
+ const taskText = input.taskText?.toLowerCase() ?? "";
157
+ if (taskText && applies.task_types?.some((taskType) => taskText.includes(taskType.toLowerCase()))) return true;
158
+ const targetPaths = input.paths ?? [];
159
+ if (targetPaths.length > 0 && applies.paths?.some((pattern) => targetPaths.some((targetPath) => pathPatternApplies(input.repoRoot, targetPath, pattern)))) return true;
160
+ return false;
161
+ }
162
+
163
+ function dedupe<T>(values: T[]): T[] {
164
+ const seen = new Set<T>();
165
+ const output: T[] = [];
166
+ for (const value of values) {
167
+ if (seen.has(value)) continue;
168
+ seen.add(value);
169
+ output.push(value);
170
+ }
171
+ return output;
172
+ }
173
+
174
+ function oracleRequirement(values: RuleOracleRequirement[]): RuleOracleRequirement {
175
+ if (values.some((value) => value === true)) return true;
176
+ if (values.some((value) => value === "conditional")) return "conditional";
177
+ return false;
178
+ }
179
+
180
+ export function resolveRuleProfile(input: RuleResolverInput): RuleResolution {
181
+ const loaded = loadRulePacks(input.repoRoot);
182
+ const profile = inferRuleProfile(input);
183
+ const selected: RulePack[] = [];
184
+ const byId = new Map(loaded.packs.map((pack) => [pack.id, pack]));
185
+ const addPack = (pack: RulePack | undefined): void => {
186
+ if (!pack || selected.some((candidate) => candidate.id === pack.id)) return;
187
+ selected.push(pack);
188
+ };
189
+
190
+ addPack(byId.get("always"));
191
+ addPack(byId.get("project"));
192
+ for (const pack of loaded.packs) {
193
+ if (rulePackApplies(pack, input, profile)) addPack(pack);
194
+ }
195
+ if (selected.some((pack) => pack.id !== "oracle" && pack.oracle_required === true)) addPack(byId.get("oracle"));
196
+
197
+ return {
198
+ schema: RULE_RESOLUTION_SCHEMA,
199
+ profile,
200
+ rulePacks: selected.map((pack) => pack.id),
201
+ allowedTools: dedupe(selected.flatMap((pack) => pack.allowed_tools ?? [])),
202
+ requiredValidation: dedupe(selected.flatMap((pack) => pack.required_validation)),
203
+ oracleRequired: oracleRequirement(selected.map((pack) => pack.oracle_required)),
204
+ noShipConditions: dedupe(selected.flatMap((pack) => pack.no_ship_conditions)),
205
+ mustDo: dedupe(selected.flatMap((pack) => pack.must_do)),
206
+ mustNotDo: dedupe(selected.flatMap((pack) => pack.must_not_do)),
207
+ enforcement: dedupe(selected.map((pack) => pack.enforcement)),
208
+ errors: loaded.errors,
209
+ promptBodiesStored: false,
210
+ outputBodiesStored: false,
211
+ };
212
+ }
213
+
214
+ export function formatRuleResolution(resolution: RuleResolution): string {
215
+ return [
216
+ `ZOB rules profile: ${resolution.profile}`,
217
+ `rule packs: ${resolution.rulePacks.length > 0 ? resolution.rulePacks.join(", ") : "none"}`,
218
+ `allowed tools: ${resolution.allowedTools.length > 0 ? resolution.allowedTools.join(", ") : "not specified"}`,
219
+ `required validation: ${resolution.requiredValidation.length > 0 ? resolution.requiredValidation.join(" | ") : "not specified"}`,
220
+ `oracle required: ${String(resolution.oracleRequired)}`,
221
+ `enforcement: ${resolution.enforcement.length > 0 ? resolution.enforcement.join(", ") : "none"}`,
222
+ `no-ship: ${resolution.noShipConditions.length > 0 ? resolution.noShipConditions.join(" | ") : "none"}`,
223
+ resolution.errors.length > 0 ? `errors:\n- ${resolution.errors.join("\n- ")}` : "errors: none",
224
+ ].join("\n");
225
+ }
@@ -0,0 +1,26 @@
1
+ # Scope du dossier
2
+
3
+ - Registrations Pi: commands, tools, events, widget, runtime state et `zobHarness`.
4
+ - Runtime est extrait en dernier, après types/constants/helpers/domaines.
5
+
6
+ # Invariants
7
+
8
+ - Préserver la compatibilité publique des tools/commandes enregistrés; vérifier les comptes et références via `.pi/capabilities/zob-public-runtime-capabilities.json` et `npm run audit:prompt-context` plutôt que des nombres hardcodés.
9
+ - Préserver les event handlers existants sauf preuve smoke ciblée.
10
+ - Préserver defaults: `activeMode = "explore"`, `currentRules = DEFAULT_RULES`, `activeGoal = undefined`, `goalRequired = false`.
11
+ - Préserver snippets/guidelines de modes, messages bloquants, schemas Typebox et descriptions.
12
+ - Ne pas changer la fermeture d'état runtime sans preuve smoke.
13
+
14
+ # Imports
15
+
16
+ - Peut importer domaines `src/**` avec suffixe `.js`.
17
+ - Interdit: importer depuis `index.ts`.
18
+ - Garder `ExtensionAPI` dans runtime uniquement lorsque nécessaire.
19
+
20
+ # Validation locale
21
+
22
+ - `npm run audit:prompt-context` pour détecter les tools/commandes manquants, refs invalides et vieux contextes hardcodés.
23
+ - `npm run check -- --pretty false`.
24
+ - `npm run smoke:harness`.
25
+ - `npm run pi:check`.
26
+ - Avant close runtime: `npm run check:all`.
@@ -0,0 +1,116 @@
1
+ import type { ModeName } from "../types.js";
2
+ import { sha256 } from "../utils/hashing.js";
3
+ import { isRecord } from "../utils/records.js";
4
+
5
+ export type AdaptiveZmodeAlias = "orchestrator";
6
+
7
+ export interface AdaptiveZmodeEntrypoint {
8
+ schema: "zob.adaptive-zmode-entrypoint.v1";
9
+ requestedMode: AdaptiveZmodeAlias;
10
+ accepted: true;
11
+ appliedHarnessMode: Extract<ModeName, "orchestrator">;
12
+ profile: "adaptive-chief-vision";
13
+ executionDefault: "plan_only";
14
+ allowedExecutions: ["plan_only", "supervised_readonly"];
15
+ computeProfileDefault: "high";
16
+ rootNonCoding: true;
17
+ parentOwnedDispatch: true;
18
+ childDirectDispatch: false;
19
+ directWriteToolsBlocked: ["bash", "edit", "write"];
20
+ sandboxRequiredForWrites: true;
21
+ oracleRequiredForCompletion: true;
22
+ tempAgentsProposalOnly: true;
23
+ documentationWritebackPolicy: "human_approval_required";
24
+ factoryPromotionPolicy: "smoke_pilot_oracle_human_approval_required";
25
+ templateHash: string;
26
+ templateBodyStored: false;
27
+ bodyStored: false;
28
+ promptBodiesStored: false;
29
+ outputBodiesStored: false;
30
+ }
31
+
32
+ const ADAPTIVE_ZMODE_ALIASES = new Set<string>(["orchestrator"]);
33
+
34
+ const ADAPTIVE_ZMODE_TEMPLATE_LINES = [
35
+ "# ZOB orchestrator workflow entrypoint",
36
+ "",
37
+ "Use profile: adaptive-chief-vision",
38
+ "Default execution: plan_only",
39
+ "Allowed execution escalation: supervised_readonly only after parent/oracle gates",
40
+ "Root role: Chief Vision non-coding orchestrator",
41
+ "Root work: goal/TODO governance, routing, lightweight synthesis, evidence/blocker decisions",
42
+ "Substantive work: always create/delegate bounded subtasks for exploration, implementation, QA, security, docs, and oracle judgment",
43
+ "Dispatch policy: parent-owned; child-direct dispatch blocked",
44
+ "Write policy: sandbox/manual/oracle/human gates required before writes",
45
+ "Temp agents: run-scoped proposals only until promotion approval + smoke + oracle",
46
+ "Documentation writeback: human_approval_required",
47
+ "Completion: propose_goal_completion only after evidence + oracle PASS/no_ship=false",
48
+ ];
49
+
50
+ export function isAdaptiveZmodeAlias(value: string | undefined): value is AdaptiveZmodeAlias {
51
+ return ADAPTIVE_ZMODE_ALIASES.has((value ?? "").trim().toLowerCase());
52
+ }
53
+
54
+ export function renderAdaptiveZmodeTemplate(entry?: Pick<AdaptiveZmodeEntrypoint, "profile" | "executionDefault" | "computeProfileDefault">): string {
55
+ const profile = entry?.profile ?? "adaptive-chief-vision";
56
+ const execution = entry?.executionDefault ?? "plan_only";
57
+ const computeProfile = entry?.computeProfileDefault ?? "high";
58
+ return [
59
+ ...ADAPTIVE_ZMODE_TEMPLATE_LINES,
60
+ "",
61
+ "Suggested tool call (parent-owned):",
62
+ `orchestrate_run profile=${profile} execution=${execution} compute_profile=${computeProfile} goal_id=<active-goal-id> todo_id=<root-todo-id>`,
63
+ ].join("\n");
64
+ }
65
+
66
+ export function resolveAdaptiveZmodeEntrypoint(requestedMode: string): AdaptiveZmodeEntrypoint | undefined {
67
+ const normalized = requestedMode.trim().toLowerCase();
68
+ if (!isAdaptiveZmodeAlias(normalized)) return undefined;
69
+ const template = renderAdaptiveZmodeTemplate({ profile: "adaptive-chief-vision", executionDefault: "plan_only", computeProfileDefault: "high" });
70
+ return {
71
+ schema: "zob.adaptive-zmode-entrypoint.v1",
72
+ requestedMode: normalized,
73
+ accepted: true,
74
+ appliedHarnessMode: "orchestrator",
75
+ profile: "adaptive-chief-vision",
76
+ executionDefault: "plan_only",
77
+ allowedExecutions: ["plan_only", "supervised_readonly"],
78
+ computeProfileDefault: "high",
79
+ rootNonCoding: true,
80
+ parentOwnedDispatch: true,
81
+ childDirectDispatch: false,
82
+ directWriteToolsBlocked: ["bash", "edit", "write"],
83
+ sandboxRequiredForWrites: true,
84
+ oracleRequiredForCompletion: true,
85
+ tempAgentsProposalOnly: true,
86
+ documentationWritebackPolicy: "human_approval_required",
87
+ factoryPromotionPolicy: "smoke_pilot_oracle_human_approval_required",
88
+ templateHash: sha256(template),
89
+ templateBodyStored: false,
90
+ bodyStored: false,
91
+ promptBodiesStored: false,
92
+ outputBodiesStored: false,
93
+ };
94
+ }
95
+
96
+ export function validateAdaptiveZmodeEntrypoint(entry: unknown): string[] {
97
+ const errors: string[] = [];
98
+ if (!isRecord(entry)) return ["entrypoint must be an object"];
99
+ if (entry.schema !== "zob.adaptive-zmode-entrypoint.v1") errors.push("schema must be zob.adaptive-zmode-entrypoint.v1");
100
+ if (!isAdaptiveZmodeAlias(String(entry.requestedMode ?? ""))) errors.push("requestedMode must be orchestrator");
101
+ if (entry.appliedHarnessMode !== "orchestrator") errors.push("adaptive zmode must enter safe orchestrator mode by default");
102
+ if (entry.profile !== "adaptive-chief-vision") errors.push("adaptive zmode must route to adaptive-chief-vision");
103
+ if (entry.executionDefault !== "plan_only") errors.push("adaptive zmode default execution must be plan_only");
104
+ if (!Array.isArray(entry.allowedExecutions) || entry.allowedExecutions.includes("supervised_write") || entry.allowedExecutions.includes("live_write")) errors.push("adaptive zmode allowed executions must not include write/live-write bypasses");
105
+ if (entry.rootNonCoding !== true) errors.push("rootNonCoding must be true");
106
+ if (entry.parentOwnedDispatch !== true || entry.childDirectDispatch !== false) errors.push("dispatch must remain parent-owned with childDirectDispatch=false");
107
+ const directWriteToolsBlocked = Array.isArray(entry.directWriteToolsBlocked) ? entry.directWriteToolsBlocked : [];
108
+ if (!["bash", "edit", "write"].every((tool) => directWriteToolsBlocked.includes(tool))) errors.push("direct write tools must be blocked for Chief Vision root");
109
+ if (entry.sandboxRequiredForWrites !== true) errors.push("sandboxRequiredForWrites must be true");
110
+ if (entry.oracleRequiredForCompletion !== true) errors.push("oracleRequiredForCompletion must be true");
111
+ if (entry.tempAgentsProposalOnly !== true) errors.push("tempAgentsProposalOnly must be true");
112
+ if (entry.documentationWritebackPolicy !== "human_approval_required") errors.push("documentation writeback must require human approval");
113
+ if (typeof entry.templateHash !== "string" || !/^[a-f0-9]{64}$/.test(entry.templateHash)) errors.push("templateHash must be sha256 hex");
114
+ if (entry.templateBodyStored !== false || entry.bodyStored !== false || entry.promptBodiesStored !== false || entry.outputBodiesStored !== false) errors.push("adaptive zmode entrypoint must be body-free");
115
+ return errors;
116
+ }