zob-harness 0.2.0 → 0.3.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 (214) hide show
  1. package/.pi/capabilities/zob-public-runtime-capabilities.json +4 -4
  2. package/.pi/extensions/zob-child-safety/AGENTS.md +12 -0
  3. package/.pi/extensions/zob-child-safety/index.ts +4 -105
  4. package/.pi/extensions/zob-child-safety/src/AGENTS.md +10 -0
  5. package/.pi/extensions/zob-child-safety/src/policy.ts +106 -0
  6. package/.pi/extensions/zob-harness/AGENTS.md +2 -0
  7. package/.pi/extensions/zob-harness/index.ts +94 -94
  8. package/.pi/extensions/zob-harness/src/AGENTS.md +4 -0
  9. package/.pi/extensions/zob-harness/src/core/AGENTS.md +24 -0
  10. package/.pi/extensions/zob-harness/src/{constants.ts → core/constants.ts} +10 -1
  11. package/.pi/extensions/zob-harness/src/core/utils/AGENTS.md +23 -0
  12. package/.pi/extensions/zob-harness/src/{utils → core/utils}/formatting.ts +1 -1
  13. package/.pi/extensions/zob-harness/src/{utils → core/utils}/records.ts +1 -1
  14. package/.pi/extensions/zob-harness/src/{utils → core/utils}/resources.ts +1 -1
  15. package/.pi/extensions/zob-harness/src/domains/AGENTS.md +23 -0
  16. package/.pi/extensions/zob-harness/src/domains/autonomy/AGENTS.md +21 -0
  17. package/.pi/extensions/zob-harness/src/{autonomous-runtime.ts → domains/autonomy/autonomous-runtime.ts} +22 -22
  18. package/.pi/extensions/zob-harness/src/{autonomy-readiness.ts → domains/autonomy/autonomy-readiness.ts} +18 -18
  19. package/.pi/extensions/zob-harness/src/{daemon-policy.ts → domains/autonomy/daemon-policy.ts} +6 -6
  20. package/.pi/extensions/zob-harness/src/{daemon-readiness.ts → domains/autonomy/daemon-readiness.ts} +7 -7
  21. package/.pi/extensions/zob-harness/src/{daemon-runtime.ts → domains/autonomy/daemon-runtime.ts} +2 -2
  22. package/.pi/extensions/zob-harness/src/{full-autonomy-test.ts → domains/autonomy/full-autonomy-test.ts} +4 -4
  23. package/.pi/extensions/zob-harness/src/{interactive-autonomy.ts → domains/autonomy/interactive-autonomy.ts} +2 -2
  24. package/.pi/extensions/zob-harness/src/{compute-profile.ts → domains/compute/compute-profile.ts} +3 -3
  25. package/.pi/extensions/zob-harness/src/{compute-workflow-shape.ts → domains/compute/compute-workflow-shape.ts} +3 -3
  26. package/.pi/extensions/zob-harness/src/domains/coms/AGENTS.md +21 -0
  27. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/envelope.ts +2 -2
  28. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/identity.ts +3 -3
  29. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/ledger-bridge.ts +2 -2
  30. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/local-transport.ts +1 -1
  31. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/policy.ts +3 -3
  32. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/presence.ts +1 -1
  33. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/registry.ts +3 -3
  34. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/response-capture.ts +1 -1
  35. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/transcript-capture.ts +2 -2
  36. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/zpeer-profile.ts +3 -3
  37. package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/zpeer.ts +3 -3
  38. package/.pi/extensions/zob-harness/src/{mission-control.ts → domains/coms/mission-control.ts} +8 -8
  39. package/.pi/extensions/zob-harness/src/{zagents.ts → domains/coms/zagents.ts} +86 -4
  40. package/.pi/extensions/zob-harness/src/domains/context/AGENTS.md +20 -0
  41. package/.pi/extensions/zob-harness/src/{context-gbrain.ts → domains/context/context-gbrain.ts} +4 -4
  42. package/.pi/extensions/zob-harness/src/domains/delegation/AGENTS.md +21 -0
  43. package/.pi/extensions/zob-harness/src/{agents.ts → domains/delegation/agents.ts} +2 -2
  44. package/.pi/extensions/zob-harness/src/{capabilities.ts → domains/delegation/capabilities.ts} +6 -6
  45. package/.pi/extensions/zob-harness/src/{child-runner.ts → domains/delegation/child-runner.ts} +8 -8
  46. package/.pi/extensions/zob-harness/src/{output-contracts.ts → domains/delegation/output-contracts.ts} +1 -1
  47. package/.pi/extensions/zob-harness/src/{prompt-packs.ts → domains/delegation/prompt-packs.ts} +4 -4
  48. package/.pi/extensions/zob-harness/src/domains/factory/AGENTS.md +21 -0
  49. package/.pi/extensions/zob-harness/src/{factory → domains/factory}/agentic-plan.ts +1 -1
  50. package/.pi/extensions/zob-harness/src/{factory-selector.ts → domains/factory/factory-selector.ts} +4 -4
  51. package/.pi/extensions/zob-harness/src/{factory → domains/factory}/quarantine.ts +5 -5
  52. package/.pi/extensions/zob-harness/src/{factory → domains/factory}/run.ts +5 -5
  53. package/.pi/extensions/zob-harness/src/{factory → domains/factory}/validation.ts +10 -10
  54. package/.pi/extensions/zob-harness/src/domains/git/AGENTS.md +20 -0
  55. package/.pi/extensions/zob-harness/src/{git-ops.ts → domains/git/git-ops.ts} +3 -3
  56. package/.pi/extensions/zob-harness/src/domains/goal/AGENTS.md +22 -0
  57. package/.pi/extensions/zob-harness/src/{goal-room.ts → domains/goal/goal-room.ts} +7 -7
  58. package/.pi/extensions/zob-harness/src/{goal-todo-imports.ts → domains/goal/goal-todo-imports.ts} +1 -1
  59. package/.pi/extensions/zob-harness/src/{goal-todo-types.ts → domains/goal/goal-todo-types.ts} +1 -1
  60. package/.pi/extensions/zob-harness/src/{goal-todos.ts → domains/goal/goal-todos.ts} +4 -4
  61. package/.pi/extensions/zob-harness/src/{goal.ts → domains/goal/goal.ts} +1 -1
  62. package/.pi/extensions/zob-harness/src/domains/governance/AGENTS.md +21 -0
  63. package/.pi/extensions/zob-harness/src/{budget-policy.ts → domains/governance/budget-policy.ts} +6 -6
  64. package/.pi/extensions/zob-harness/src/{governed-requests.ts → domains/governance/governed-requests.ts} +7 -7
  65. package/.pi/extensions/zob-harness/src/{launch-apply.ts → domains/governance/launch-apply.ts} +4 -4
  66. package/.pi/extensions/zob-harness/src/{merge-queue.ts → domains/governance/merge-queue.ts} +6 -6
  67. package/.pi/extensions/zob-harness/src/{rules.ts → domains/governance/rules.ts} +7 -7
  68. package/.pi/extensions/zob-harness/src/{safety.ts → domains/governance/safety.ts} +3 -3
  69. package/.pi/extensions/zob-harness/src/{sandbox.ts → domains/governance/sandbox.ts} +5 -5
  70. package/.pi/extensions/zob-harness/src/{worker-pool.ts → domains/governance/worker-pool.ts} +7 -7
  71. package/.pi/extensions/zob-harness/src/{workspace-claims.ts → domains/governance/workspace-claims.ts} +6 -6
  72. package/.pi/extensions/zob-harness/src/domains/models/AGENTS.md +20 -0
  73. package/.pi/extensions/zob-harness/src/{model-availability.ts → domains/models/model-availability.ts} +1 -1
  74. package/.pi/extensions/zob-harness/src/{model-routing.ts → domains/models/model-routing.ts} +6 -6
  75. package/.pi/extensions/zob-harness/src/domains/orchestration/AGENTS.md +21 -0
  76. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/adaptive-delegation.ts +8 -8
  77. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/adaptive-workflow.ts +4 -4
  78. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/lead-plan.ts +5 -5
  79. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/plan.ts +5 -5
  80. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/room.ts +4 -4
  81. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/run.ts +6 -6
  82. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/supervised-readonly.ts +6 -6
  83. package/.pi/extensions/zob-harness/src/{orchestration → domains/orchestration}/widget-readers.ts +2 -2
  84. package/.pi/extensions/zob-harness/src/domains/project-dna/AGENTS.md +19 -0
  85. package/.pi/extensions/zob-harness/src/{project-dna.ts → domains/project-dna/project-dna.ts} +4 -4
  86. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/candidate.ts +5 -5
  87. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/coms.ts +3 -3
  88. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/documentation.ts +4 -4
  89. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/factory.ts +2 -2
  90. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/temp-agent.ts +4 -4
  91. package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/write-lane.ts +3 -3
  92. package/.pi/extensions/zob-harness/src/domains/telemetry/AGENTS.md +19 -0
  93. package/.pi/extensions/zob-harness/src/{chronicle.ts → domains/telemetry/chronicle.ts} +3 -3
  94. package/.pi/extensions/zob-harness/src/{queue.ts → domains/telemetry/queue.ts} +7 -7
  95. package/.pi/extensions/zob-harness/src/{telemetry.ts → domains/telemetry/telemetry.ts} +4 -4
  96. package/.pi/extensions/zob-harness/src/{topology → domains/topology}/chains.ts +10 -10
  97. package/.pi/extensions/zob-harness/src/{topology → domains/topology}/coms.ts +3 -3
  98. package/.pi/extensions/zob-harness/src/{topology → domains/topology}/orchestration-profiles.ts +8 -8
  99. package/.pi/extensions/zob-harness/src/{topology → domains/topology}/teams.ts +8 -8
  100. package/.pi/extensions/zob-harness/src/runtime/adaptive-zmode.ts +2 -2
  101. package/.pi/extensions/zob-harness/src/runtime/auto-compaction.ts +2 -2
  102. package/.pi/extensions/zob-harness/src/runtime/commands.ts +49 -27
  103. package/.pi/extensions/zob-harness/src/runtime/compaction-policy.ts +2 -2
  104. package/.pi/extensions/zob-harness/src/runtime/delegation-feed.ts +1 -1
  105. package/.pi/extensions/zob-harness/src/runtime/delegation-monitor.ts +1 -1
  106. package/.pi/extensions/zob-harness/src/runtime/events.ts +52 -37
  107. package/.pi/extensions/zob-harness/src/{goal-runtime.ts → runtime/goal-runtime.ts} +9 -9
  108. package/.pi/extensions/zob-harness/src/runtime/goal-todo-overlay.ts +1 -1
  109. package/.pi/extensions/zob-harness/src/runtime/plan-capture.ts +2 -2
  110. package/.pi/extensions/zob-harness/src/runtime/state.ts +15 -13
  111. package/.pi/extensions/zob-harness/src/runtime/tools-autonomous.ts +2 -2
  112. package/.pi/extensions/zob-harness/src/runtime/tools-compute.ts +3 -3
  113. package/.pi/extensions/zob-harness/src/runtime/tools-coms.ts +15 -12
  114. package/.pi/extensions/zob-harness/src/runtime/tools-context.ts +2 -2
  115. package/.pi/extensions/zob-harness/src/runtime/tools-delegation.ts +13 -13
  116. package/.pi/extensions/zob-harness/src/runtime/tools-factory.ts +19 -19
  117. package/.pi/extensions/zob-harness/src/runtime/tools-goal-room.ts +3 -3
  118. package/.pi/extensions/zob-harness/src/runtime/tools-governed-requests.ts +3 -3
  119. package/.pi/extensions/zob-harness/src/runtime/tools-merge-queue.ts +3 -3
  120. package/.pi/extensions/zob-harness/src/runtime/tools-mission-control.ts +3 -3
  121. package/.pi/extensions/zob-harness/src/runtime/tools-orchestration.ts +9 -9
  122. package/.pi/extensions/zob-harness/src/runtime/tools-project-dna.ts +2 -2
  123. package/.pi/extensions/zob-harness/src/runtime/tools-worker-pool.ts +3 -3
  124. package/.pi/extensions/zob-harness/src/runtime/tools-workspace-claims.ts +3 -3
  125. package/.pi/extensions/zob-harness/src/runtime/tools-zcommit.ts +3 -3
  126. package/.pi/extensions/zob-harness/src/runtime/widget.ts +25 -8
  127. package/.pi/extensions/zob-harness/src/runtime/zobHarness.ts +1 -1
  128. package/.pi/extensions/zob-harness/src/types.ts +2 -2
  129. package/.pi/extensions/zob-switch/AGENTS.md +9 -0
  130. package/.pi/extensions/zob-switch/index.ts +9 -121
  131. package/.pi/extensions/zob-switch/src/AGENTS.md +8 -0
  132. package/.pi/extensions/zob-switch/src/autocomplete.ts +12 -0
  133. package/.pi/extensions/zob-switch/src/paths.ts +8 -0
  134. package/.pi/extensions/zob-switch/src/settings.ts +25 -0
  135. package/.pi/extensions/zob-switch/src/snapshot.ts +34 -0
  136. package/.pi/extensions/zob-switch/src/state.ts +57 -0
  137. package/.pi/factories/agentic-spec-team/README.md +35 -0
  138. package/.pi/factories/agentic-spec-team/batch-manifest.json +11 -0
  139. package/.pi/factories/agentic-spec-team/example-agentic-spec-manifest.json +19 -0
  140. package/.pi/factories/agentic-spec-team/factory.json +98 -0
  141. package/.pi/factories/agentic-spec-team/pilot-manifest.json +11 -0
  142. package/.pi/factories/agentic-spec-team/schemas/final-report.schema.json +15 -0
  143. package/.pi/factories/agentic-spec-team/schemas/manifest.schema.json +14 -0
  144. package/.pi/factories/agentic-spec-team/schemas/question.schema.json +18 -0
  145. package/.pi/factories/agentic-spec-team/schemas/source-register.schema.json +11 -0
  146. package/.pi/factories/agentic-spec-team/schemas/traceability.schema.json +11 -0
  147. package/.pi/factories/agentic-spec-team/smoke-manifest.json +11 -0
  148. package/.pi/skills/zob-agentic-spec-team/SKILL.md +145 -0
  149. package/.pi/skills/zob-split-refactor/SKILL.md +1 -1
  150. package/.pi/skills/zob-zagent-creator/SKILL.md +256 -12
  151. package/.pi/zagents/bdd-writer.json +20 -0
  152. package/.pi/zagents/data-profile-analyst.json +20 -0
  153. package/.pi/zagents/domain-modeler.json +20 -0
  154. package/.pi/zagents/planner-handoff-writer.json +20 -0
  155. package/.pi/zagents/prompts/agentic-spec-run-role.md +30 -0
  156. package/.pi/zagents/source-intake-steward.json +20 -0
  157. package/.pi/zagents/spec-chief.json +21 -0
  158. package/.pi/zagents/spec-oracle.json +20 -0
  159. package/.pi/zagents/spec-writer.json +20 -0
  160. package/.pi/zagents/ux-flow-analyst.json +20 -0
  161. package/.pi/zteams/agentic-spec-run.json +42 -0
  162. package/.pi/zteams/agentic-spec-run.tmux.sh +134 -0
  163. package/SOURCE_INDEX.md +1 -1
  164. package/package.json +9 -1
  165. package/scripts/README.md +1 -1
  166. package/scripts/agentic-spec-team/validate-bdd.mjs +13 -0
  167. package/scripts/agentic-spec-team/validate-final-report.mjs +14 -0
  168. package/scripts/agentic-spec-team/validate-manifest.mjs +14 -0
  169. package/scripts/agentic-spec-team/validate-oracle-ready.mjs +13 -0
  170. package/scripts/agentic-spec-team/validate-question-loop.mjs +15 -0
  171. package/scripts/agentic-spec-team/validate-run.mjs +11 -0
  172. package/scripts/agentic-spec-team/validate-source-register.mjs +17 -0
  173. package/scripts/agentic-spec-team/validate-traceability.mjs +20 -0
  174. package/scripts/agentic-spec-team/validate-workgraph.mjs +13 -0
  175. package/scripts/autonomy/mission-readiness-secret-smoke.mjs +5 -5
  176. package/scripts/git-ops/commit-policy-smoke.mjs +5 -4
  177. package/scripts/goal-todo/child-goal-ref-smoke.mjs +2 -2
  178. package/scripts/path-policy/validate-smoke.mjs +3 -3
  179. package/scripts/project-dna/AGENTS.md +39 -0
  180. package/scripts/project-dna/{validate-scaffold.mjs → validation/validate-scaffold.mjs} +7 -7
  181. package/scripts/spec-run.mjs +365 -0
  182. package/scripts/worker-pool/static-smoke.mjs +5 -5
  183. package/scripts/zagent-static-smoke.mjs +35 -6
  184. package/scripts/zpeer-local-e2e-smoke.mjs +6 -5
  185. package/scripts/zpeer-static-smoke.mjs +17 -17
  186. /package/.pi/extensions/zob-harness/src/{types → core/types}/core.ts +0 -0
  187. /package/.pi/extensions/zob-harness/src/{utils → core/utils}/hashing.ts +0 -0
  188. /package/.pi/extensions/zob-harness/src/{utils → core/utils}/json.ts +0 -0
  189. /package/.pi/extensions/zob-harness/src/{utils → core/utils}/paths.ts +0 -0
  190. /package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/AGENTS.md +0 -0
  191. /package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/pending-replies.ts +0 -0
  192. /package/.pi/extensions/zob-harness/src/{coms-v2 → domains/coms/coms-v2}/types.ts +0 -0
  193. /package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/ledger.ts +0 -0
  194. /package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/types.ts +0 -0
  195. /package/.pi/extensions/zob-harness/src/{promotion → domains/promotion}/validate.ts +0 -0
  196. /package/.pi/extensions/zob-harness/src/{schemas-project-dna.ts → runtime/schemas-project-dna.ts} +0 -0
  197. /package/.pi/extensions/zob-harness/src/{schemas.ts → runtime/schemas.ts} +0 -0
  198. /package/scripts/project-dna/{bench-smoke.mjs → benchmark/bench-smoke.mjs} +0 -0
  199. /package/scripts/project-dna/{build-capsules.mjs → capsules/build-capsules.mjs} +0 -0
  200. /package/scripts/project-dna/{emit-golden-cases.mjs → emit/emit-golden-cases.mjs} +0 -0
  201. /package/scripts/project-dna/{emit-ontology.mjs → emit/emit-ontology.mjs} +0 -0
  202. /package/scripts/project-dna/{oracle-review-smoke.mjs → oracle/oracle-review-smoke.mjs} +0 -0
  203. /package/scripts/project-dna/{query-context.mjs → query/query-context.mjs} +0 -0
  204. /package/scripts/project-dna/{query-steward.mjs → query/query-steward.mjs} +0 -0
  205. /package/scripts/project-dna/{build-sample-spec.mjs → sample/build-sample-spec.mjs} +0 -0
  206. /package/scripts/project-dna/{generate-sample.mjs → sample/generate-sample.mjs} +0 -0
  207. /package/scripts/project-dna/{validate-sample-project.mjs → sample/validate-sample-project.mjs} +0 -0
  208. /package/scripts/project-dna/{scan.mjs → scan/scan.mjs} +0 -0
  209. /package/scripts/project-dna/{validate-scan-artifacts.mjs → scan/validate-scan-artifacts.mjs} +0 -0
  210. /package/scripts/project-dna/{validate-5of5.mjs → validation/validate-5of5.mjs} +0 -0
  211. /package/scripts/project-dna/{validate-golden-cases.mjs → validation/validate-golden-cases.mjs} +0 -0
  212. /package/scripts/project-dna/{validate-ontology.mjs → validation/validate-ontology.mjs} +0 -0
  213. /package/scripts/project-dna/{plan-workflow.mjs → workflow/plan-workflow.mjs} +0 -0
  214. /package/scripts/project-dna/{validate-workflow.mjs → workflow/validate-workflow.mjs} +0 -0
@@ -1,9 +1,9 @@
1
- import { SUPERVISED_READONLY_CHILD_TOOLS, SUPERVISED_SMOKE_CHILD_TOOLS } from "../constants.js";
2
- import type { OrchestrateExecutionMode, OrchestrateRunInput, TeamDefinition } from "../types.js";
1
+ import { SUPERVISED_READONLY_CHILD_TOOLS, SUPERVISED_SMOKE_CHILD_TOOLS } from "../../core/constants.js";
2
+ import type { OrchestrateExecutionMode, OrchestrateRunInput, TeamDefinition } from "../../types.js";
3
3
  import { normalizeAdaptiveDelegationPolicy } from "./adaptive-delegation.js";
4
- import { sha256 } from "../utils/hashing.js";
5
- import { safeFileStem } from "../utils/paths.js";
6
- import { isRecord } from "../utils/records.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { safeFileStem } from "../../core/utils/paths.js";
6
+ import { isRecord } from "../../core/utils/records.js";
7
7
 
8
8
  function renderOrchestrationTemplate(template: string, values: Record<string, string>): string {
9
9
  return template.replace(/\{([a-zA-Z0-9_.-]+)\}/g, (match, key: string) => values[key] ?? match);
@@ -1,10 +1,10 @@
1
1
  import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { SUPERVISED_READONLY_CHILD_TOOLS, SUPERVISED_SMOKE_CHILD_TOOLS } from "../constants.js";
5
- import type { OrchestrateExecutionMode, TeamDefinition } from "../types.js";
6
- import { sha256 } from "../utils/hashing.js";
7
- import { isRecord } from "../utils/records.js";
4
+ import { SUPERVISED_READONLY_CHILD_TOOLS, SUPERVISED_SMOKE_CHILD_TOOLS } from "../../core/constants.js";
5
+ import type { OrchestrateExecutionMode, TeamDefinition } from "../../types.js";
6
+ import { sha256 } from "../../core/utils/hashing.js";
7
+ import { isRecord } from "../../core/utils/records.js";
8
8
 
9
9
  function orchestrationLedger(runDir: string, entry: Record<string, unknown>): void {
10
10
  appendFileSync(join(runDir, "ledger.jsonl"), `${JSON.stringify({ ...entry, timestamp: new Date().toISOString() })}\n`, "utf8");
@@ -1,15 +1,15 @@
1
1
  import { existsSync, mkdirSync, unlinkSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { resolveComputeProfile } from "../compute-profile.js";
5
- import { SUPERVISED_SMOKE_CHILD_TOOLS } from "../constants.js";
6
- import type { OrchestrateExecutionMode, OrchestrateRunInput, OrchestrateRunResult, TeamDefinition } from "../types.js";
4
+ import { resolveComputeProfile } from "../compute/compute-profile.js";
5
+ import { SUPERVISED_SMOKE_CHILD_TOOLS } from "../../core/constants.js";
6
+ import type { OrchestrateExecutionMode, OrchestrateRunInput, OrchestrateRunResult, TeamDefinition } from "../../types.js";
7
7
  import { mirrorOrchestrationToComs } from "../topology/coms.js";
8
8
  import { loadOrchestrationProfile, teamDefinitionFromOrchestrationProfile, validateOrchestrateRunInputs } from "../topology/orchestration-profiles.js";
9
9
  import { loadTeamDefinition } from "../topology/teams.js";
10
- import { sha256 } from "../utils/hashing.js";
11
- import { safeRunId } from "../utils/paths.js";
12
- import { isRecord } from "../utils/records.js";
10
+ import { sha256 } from "../../core/utils/hashing.js";
11
+ import { safeRunId } from "../../core/utils/paths.js";
12
+ import { isRecord } from "../../core/utils/records.js";
13
13
  import { buildInitialAdaptiveDelegationGovernorState, normalizeAdaptiveDelegationPolicy } from "./adaptive-delegation.js";
14
14
  import { writeAdaptiveWorkflowArtifacts } from "./adaptive-workflow.js";
15
15
  import { buildOrchestrationPlan, redactBodyLikeFieldsForPersistence, redactOrchestrationPlanForPersistence } from "./plan.js";
@@ -1,13 +1,13 @@
1
1
  import { existsSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { SUPERVISED_READONLY_CHILD_TOOLS } from "../constants.js";
4
+ import { SUPERVISED_READONLY_CHILD_TOOLS } from "../../core/constants.js";
5
5
  import { ackZobComsMessage, appendZobComsMessage, getZobComsMessage, listZobComsMessages, replyZobComsMessage, transitionZobComsStatus } from "../topology/coms.js";
6
- import type { AdaptiveDelegationGovernorState, AdaptiveDelegationPolicy, DelegationRequestProposal, GovernorDecision, OrchestrateRunInput, ParentDispatchContract, SupervisedReadonlyDispatcher, SupervisedReadonlyDispatchResult, TeamDefinition } from "../types.js";
7
- import { sha256 } from "../utils/hashing.js";
8
- import { parseJsonFile, readJsonl, readJsonObjectIfPresent } from "../utils/json.js";
9
- import { safeRunId } from "../utils/paths.js";
10
- import { isRecord } from "../utils/records.js";
6
+ import type { AdaptiveDelegationGovernorState, AdaptiveDelegationPolicy, DelegationRequestProposal, GovernorDecision, OrchestrateRunInput, ParentDispatchContract, SupervisedReadonlyDispatcher, SupervisedReadonlyDispatchResult, TeamDefinition } from "../../types.js";
7
+ import { sha256 } from "../../core/utils/hashing.js";
8
+ import { parseJsonFile, readJsonl, readJsonObjectIfPresent } from "../../core/utils/json.js";
9
+ import { safeRunId } from "../../core/utils/paths.js";
10
+ import { isRecord } from "../../core/utils/records.js";
11
11
  import {
12
12
  ADAPTIVE_DELEGATION_HARD_MAX_DEPTH,
13
13
  buildInitialAdaptiveDelegationGovernorState,
@@ -1,8 +1,8 @@
1
1
  import { existsSync, lstatSync, readdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { parseJsonFile, readJsonObjectIfPresent } from "../utils/json.js";
5
- import { isRecord } from "../utils/records.js";
4
+ import { parseJsonFile, readJsonObjectIfPresent } from "../../core/utils/json.js";
5
+ import { isRecord } from "../../core/utils/records.js";
6
6
 
7
7
  function widgetCounts(value: unknown): string {
8
8
  if (!isRecord(value)) return "none";
@@ -0,0 +1,19 @@
1
+ # ProjectDNA domain guardrail
2
+
3
+ ## Scope
4
+
5
+ - ProjectDNA query, federated query, workflow planning helpers, schemas, and writeback proposals.
6
+
7
+ ## MUST DO
8
+
9
+ - Preserve read-only scan artifact usage, bounded cited context, proposal-only writeback, and quarantine/output path policy.
10
+
11
+ ## MUST NOT
12
+
13
+ - Do not scan external projects, import/sync/embed/write to backends, or promote ProjectDNA learnings by moving code.
14
+ - Do not import from `index.ts` or `index.js`.
15
+
16
+ ## Validation
17
+
18
+ - `npm run check -- --pretty false`.
19
+ - Run relevant `validate:project-dna*`/smoke scripts when ProjectDNA behavior moves.
@@ -1,9 +1,9 @@
1
1
  import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
2
2
  import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
3
3
 
4
- import { sha256 } from "./utils/hashing.js";
5
- import { isRecord } from "./utils/records.js";
6
- import { safeRunId } from "./utils/paths.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { isRecord } from "../../core/utils/records.js";
6
+ import { safeRunId } from "../../core/utils/paths.js";
7
7
 
8
8
  const STOPWORDS = new Set(["the", "and", "for", "with", "how", "does", "this", "that", "dans", "avec", "pour", "comment", "faire", "using", "use", "project", "style"]);
9
9
  const DEFAULT_SCAN_DIR = "reports/project-dna-scans/project-dna-factory-smoke";
@@ -463,7 +463,7 @@ export function buildProjectDnaReadinessAudit(repoRoot: string, input: { scanDir
463
463
  } catch (error) {
464
464
  scanErrors = [error instanceof Error ? error.message : String(error)];
465
465
  }
466
- const p4RuntimeReady = existsSync(resolve(repoRoot, ".pi/extensions/zob-harness/src/project-dna.ts")) && existsSync(resolve(repoRoot, ".pi/extensions/zob-harness/src/runtime/tools-project-dna.ts"));
466
+ const p4RuntimeReady = existsSync(resolve(repoRoot, ".pi/extensions/zob-harness/src/domains/project-dna/project-dna.ts")) && existsSync(resolve(repoRoot, ".pi/extensions/zob-harness/src/runtime/tools-project-dna.ts"));
467
467
  const p5FederationReady = p4RuntimeReady;
468
468
  const errors = [...missingRepoFiles.map((file) => `missing repo file: ${file}`), ...scanErrors];
469
469
  return {
@@ -1,11 +1,11 @@
1
1
  import { appendFileSync, existsSync, mkdirSync, readdirSync, statSync, writeFileSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
3
 
4
- import { DEFAULT_RULES } from "../constants.js";
5
- import { sha256 } from "../utils/hashing.js";
6
- import { readJsonObjectIfPresent } from "../utils/json.js";
7
- import { pathMatches, resolveRepoPath, safeFileStem } from "../utils/paths.js";
8
- import { isRecord } from "../utils/records.js";
4
+ import { DEFAULT_RULES } from "../../core/constants.js";
5
+ import { sha256 } from "../../core/utils/hashing.js";
6
+ import { readJsonObjectIfPresent } from "../../core/utils/json.js";
7
+ import { pathMatches, resolveRepoPath, safeFileStem } from "../../core/utils/paths.js";
8
+ import { isRecord } from "../../core/utils/records.js";
9
9
  import type { PromotionApplyScope, PromotionCandidateInput, PromotionCandidateRecord, PromotionGates, PromotionKind, PromotionStatus, PromotionTransitionInput } from "./types.js";
10
10
  import { PROMOTION_APPLY_SCOPES, PROMOTION_KINDS, PROMOTION_STATUSES } from "./types.js";
11
11
 
@@ -1,9 +1,9 @@
1
1
  import { mkdirSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { sha256 } from "../utils/hashing.js";
5
- import { safeFileStem } from "../utils/paths.js";
6
- import { isRecord } from "../utils/records.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { safeFileStem } from "../../core/utils/paths.js";
6
+ import { isRecord } from "../../core/utils/records.js";
7
7
  import { promotionCandidateDir, promotionCandidateRef } from "./candidate.js";
8
8
  import type { PromotionCandidateRecord, PromotionComsMessageRef, PromotionComsThreadInput, PromotionComsThreadRecord } from "./types.js";
9
9
 
@@ -1,10 +1,10 @@
1
1
  import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
 
4
- import { sha256 } from "../utils/hashing.js";
5
- import { resolveRepoPath, safeFileStem } from "../utils/paths.js";
6
- import { parseJsonFile } from "../utils/json.js";
7
- import { isRecord } from "../utils/records.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { resolveRepoPath, safeFileStem } from "../../core/utils/paths.js";
6
+ import { parseJsonFile } from "../../core/utils/json.js";
7
+ import { isRecord } from "../../core/utils/records.js";
8
8
  import { advancePromotionCandidate, createPromotionCandidate, promotionCandidateDir, promotionCandidateRef, validatePromotionCandidate, writePromotionCandidate } from "./candidate.js";
9
9
  import type { PromotionCandidateRecord } from "./types.js";
10
10
 
@@ -1,8 +1,8 @@
1
1
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { sha256 } from "../utils/hashing.js";
5
- import { isRecord } from "../utils/records.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { isRecord } from "../../core/utils/records.js";
6
6
  import { advancePromotionCandidate, createPromotionCandidate, promotionCandidateDir, promotionCandidateRef, validatePromotionCandidate, writePromotionCandidate } from "./candidate.js";
7
7
  import type { PromotionCandidateRecord } from "./types.js";
8
8
 
@@ -1,10 +1,10 @@
1
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { sha256 } from "../utils/hashing.js";
5
- import { safeFileStem } from "../utils/paths.js";
6
- import { parseJsonFile } from "../utils/json.js";
7
- import { isRecord } from "../utils/records.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { safeFileStem } from "../../core/utils/paths.js";
6
+ import { parseJsonFile } from "../../core/utils/json.js";
7
+ import { isRecord } from "../../core/utils/records.js";
8
8
  import { advancePromotionCandidate, createPromotionCandidate, promotionCandidateDir, promotionCandidateRef, validatePromotionCandidate, writePromotionCandidate } from "./candidate.js";
9
9
  import type { PromotionCandidateRecord } from "./types.js";
10
10
 
@@ -1,9 +1,9 @@
1
1
  import { mkdirSync, writeFileSync } from "node:fs";
2
2
  import { dirname, join, resolve } from "node:path";
3
3
 
4
- import { sha256 } from "../utils/hashing.js";
5
- import { safeFileStem } from "../utils/paths.js";
6
- import { isRecord } from "../utils/records.js";
4
+ import { sha256 } from "../../core/utils/hashing.js";
5
+ import { safeFileStem } from "../../core/utils/paths.js";
6
+ import { isRecord } from "../../core/utils/records.js";
7
7
  import { advancePromotionCandidate, createPromotionCandidate, promotionCandidateDir, promotionCandidateRef, validatePromotionCandidate, writePromotionCandidate } from "./candidate.js";
8
8
  import type { PromotionCandidateRecord } from "./types.js";
9
9
 
@@ -0,0 +1,19 @@
1
+ # Telemetry domain guardrail
2
+
3
+ ## Scope
4
+
5
+ - Chronicle classification, queue metadata, telemetry summaries, and body-free runtime evidence records.
6
+
7
+ ## MUST DO
8
+
9
+ - Preserve completion classifiers, budget preflight dry-run semantics, body-free telemetry, and artifact/ref names.
10
+
11
+ ## MUST NOT
12
+
13
+ - Do not persist raw prompts, outputs, diffs, patches, or secrets.
14
+ - Do not import from `index.ts` or `index.js`.
15
+
16
+ ## Validation
17
+
18
+ - `npm run check -- --pretty false`.
19
+ - `npm run smoke:harness` after chronicle/queue/runtime-facing moves.
@@ -9,9 +9,9 @@ import type {
9
9
  DelegationTelemetryInput,
10
10
  FactoryTelemetryInput,
11
11
  RunawayGuardInput,
12
- } from "./types.js";
13
- import { sha256 } from "./utils/hashing.js";
14
- import { safeFileStem } from "./utils/paths.js";
12
+ } from "../../types.js";
13
+ import { sha256 } from "../../core/utils/hashing.js";
14
+ import { safeFileStem } from "../../core/utils/paths.js";
15
15
 
16
16
  export const CHRONICLE_STATES = [
17
17
  "created",
@@ -1,15 +1,15 @@
1
1
  import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFileSync } from "node:fs";
2
2
  import { basename, join, resolve } from "node:path";
3
3
 
4
- import { evaluateStrictBudgetDispatchGate } from "./budget-policy.js";
4
+ import { evaluateStrictBudgetDispatchGate } from "../governance/budget-policy.js";
5
5
  import { classifyChildStopCondition, evaluateBudgetPreflightDryRun } from "./chronicle.js";
6
- import { DEFAULT_RULES } from "./constants.js";
6
+ import { DEFAULT_RULES } from "../../core/constants.js";
7
7
  import { incrementCounter, normalizeDailyTelemetryDate, stringFrom } from "./telemetry.js";
8
- import type { ChildStopCondition, FactoryRunBudgetInput, QueueState, QueueTickResult, ReadOnlyQueueJob, ReadOnlyQueueJobType } from "./types.js";
9
- import { sha256 } from "./utils/hashing.js";
10
- import { parseJsonFile } from "./utils/json.js";
11
- import { expandHome, isSafeArtifactName, pathMatches, safeFileStem } from "./utils/paths.js";
12
- import { isRecord } from "./utils/records.js";
8
+ import type { ChildStopCondition, FactoryRunBudgetInput, QueueState, QueueTickResult, ReadOnlyQueueJob, ReadOnlyQueueJobType } from "../../types.js";
9
+ import { sha256 } from "../../core/utils/hashing.js";
10
+ import { parseJsonFile } from "../../core/utils/json.js";
11
+ import { expandHome, isSafeArtifactName, pathMatches, safeFileStem } from "../../core/utils/paths.js";
12
+ import { isRecord } from "../../core/utils/records.js";
13
13
 
14
14
  export const READ_ONLY_QUEUE_JOB_TYPES: ReadOnlyQueueJobType[] = ["docs_watch", "repo_audit_readonly", "todo_risk_report", "session_analysis"];
15
15
  const QUEUE_STATES: QueueState[] = ["pending", "running", "done", "failed"];
@@ -2,10 +2,10 @@ import { existsSync, mkdirSync, readdirSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
4
  import { classifyDelegationChronicleCompletion, classifyFactoryChronicleCompletion, writeChronicleSnapshot } from "./chronicle.js";
5
- import type { AssistantLikeMessage, ChildResult, ChildStopCondition, DelegationTelemetryInput, FactoryTelemetryInput } from "./types.js";
6
- import { parseJsonFile } from "./utils/json.js";
7
- import { safeFileStem } from "./utils/paths.js";
8
- import { isRecord } from "./utils/records.js";
5
+ import type { AssistantLikeMessage, ChildResult, ChildStopCondition, DelegationTelemetryInput, FactoryTelemetryInput } from "../../types.js";
6
+ import { parseJsonFile } from "../../core/utils/json.js";
7
+ import { safeFileStem } from "../../core/utils/paths.js";
8
+ import { isRecord } from "../../core/utils/records.js";
9
9
 
10
10
  function usageEmpty(): ChildResult["usage"] {
11
11
  return { turns: 0, input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0 };
@@ -1,16 +1,16 @@
1
1
  import { appendFileSync, existsSync, mkdirSync, unlinkSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { loadProjectAgents } from "../agents.js";
5
- import { BLOCKED_CHAIN_TOOLS, READ_ONLY_CHAIN_TOOLS } from "../constants.js";
6
- import { validateOutputContractId } from "../output-contracts.js";
7
- import { validateToolList } from "../safety.js";
8
- import type { ChainDefinition, ChainRunInput, ChainRunResult, ChainStepDefinition } from "../types.js";
9
- import { sha256 } from "../utils/hashing.js";
10
- import { parseJsonFile } from "../utils/json.js";
11
- import { isSafeArtifactName, safeFileStem, safeRunId } from "../utils/paths.js";
12
- import { isRecord } from "../utils/records.js";
13
- import { listZobResourceJsonStems, readableZobResourcePath } from "../utils/resources.js";
4
+ import { loadProjectAgents } from "../delegation/agents.js";
5
+ import { BLOCKED_CHAIN_TOOLS, READ_ONLY_CHAIN_TOOLS } from "../../core/constants.js";
6
+ import { validateOutputContractId } from "../delegation/output-contracts.js";
7
+ import { validateToolList } from "../governance/safety.js";
8
+ import type { ChainDefinition, ChainRunInput, ChainRunResult, ChainStepDefinition } from "../../types.js";
9
+ import { sha256 } from "../../core/utils/hashing.js";
10
+ import { parseJsonFile } from "../../core/utils/json.js";
11
+ import { isSafeArtifactName, safeFileStem, safeRunId } from "../../core/utils/paths.js";
12
+ import { isRecord } from "../../core/utils/records.js";
13
+ import { listZobResourceJsonStems, readableZobResourcePath } from "../../core/utils/resources.js";
14
14
  import { isStringArray } from "./teams.js";
15
15
 
16
16
  function chainsDir(repoRoot: string): string {
@@ -1,9 +1,9 @@
1
1
  import { appendFileSync, mkdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import type { TeamDefinition, ZobComsMessageInput } from "../types.js";
5
- import { sha256 } from "../utils/hashing.js";
6
- import { readJsonl } from "../utils/json.js";
4
+ import type { TeamDefinition, ZobComsMessageInput } from "../../types.js";
5
+ import { sha256 } from "../../core/utils/hashing.js";
6
+ import { readJsonl } from "../../core/utils/json.js";
7
7
 
8
8
  function comsDir(repoRoot: string): string {
9
9
  return join(repoRoot, ".pi", "coms");
@@ -1,15 +1,15 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { loadProjectAgents } from "../agents.js";
4
+ import { loadProjectAgents } from "../delegation/agents.js";
5
5
  import { normalizeAdaptiveDelegationPolicy, validateAdaptiveDelegationPolicy } from "../orchestration/adaptive-delegation.js";
6
- import { validateOutputContractId } from "../output-contracts.js";
7
- import { validateAllowedPathPolicy, validateDelegateTaskWriteScope, validateForbiddenPathPolicy, validateToolList } from "../safety.js";
8
- import type { OrchestrateRunInput, OrchestrationProfileDefinition, OrchestrationProfilePhase, OrchestrationProfileRole, TeamDefinition } from "../types.js";
9
- import { parseJsonFile } from "../utils/json.js";
10
- import { isSafeArtifactName, safeFileStem } from "../utils/paths.js";
11
- import { isRecord } from "../utils/records.js";
12
- import { listZobResourceJsonStems, readableZobResourcePath } from "../utils/resources.js";
6
+ import { validateOutputContractId } from "../delegation/output-contracts.js";
7
+ import { validateAllowedPathPolicy, validateDelegateTaskWriteScope, validateForbiddenPathPolicy, validateToolList } from "../governance/safety.js";
8
+ import type { OrchestrateRunInput, OrchestrationProfileDefinition, OrchestrationProfilePhase, OrchestrationProfileRole, TeamDefinition } from "../../types.js";
9
+ import { parseJsonFile } from "../../core/utils/json.js";
10
+ import { isSafeArtifactName, safeFileStem } from "../../core/utils/paths.js";
11
+ import { isRecord } from "../../core/utils/records.js";
12
+ import { listZobResourceJsonStems, readableZobResourcePath } from "../../core/utils/resources.js";
13
13
  import { isStringArray, loadTeamDefinition, validateTeamDefinition } from "./teams.js";
14
14
 
15
15
  function orchestrationProfilesDir(repoRoot: string): string {
@@ -1,14 +1,14 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
- import { loadProjectAgents } from "../agents.js";
5
- import { validateOutputContractId } from "../output-contracts.js";
6
- import { validateToolList } from "../safety.js";
7
- import type { HarnessAgent, TeamDefinition, TeamLead, TeamRoleBase, TeamWorker } from "../types.js";
8
- import { parseJsonFile } from "../utils/json.js";
9
- import { isSafeArtifactName, safeFileStem } from "../utils/paths.js";
10
- import { isRecord } from "../utils/records.js";
11
- import { readableZobResourcePath } from "../utils/resources.js";
4
+ import { loadProjectAgents } from "../delegation/agents.js";
5
+ import { validateOutputContractId } from "../delegation/output-contracts.js";
6
+ import { validateToolList } from "../governance/safety.js";
7
+ import type { HarnessAgent, TeamDefinition, TeamLead, TeamRoleBase, TeamWorker } from "../../types.js";
8
+ import { parseJsonFile } from "../../core/utils/json.js";
9
+ import { isSafeArtifactName, safeFileStem } from "../../core/utils/paths.js";
10
+ import { isRecord } from "../../core/utils/records.js";
11
+ import { readableZobResourcePath } from "../../core/utils/resources.js";
12
12
 
13
13
  function isStringArray(value: unknown): value is string[] {
14
14
  return Array.isArray(value) && value.every((item) => typeof item === "string");
@@ -1,6 +1,6 @@
1
1
  import type { ModeName } from "../types.js";
2
- import { sha256 } from "../utils/hashing.js";
3
- import { isRecord } from "../utils/records.js";
2
+ import { sha256 } from "../core/utils/hashing.js";
3
+ import { isRecord } from "../core/utils/records.js";
4
4
 
5
5
  export type AdaptiveZmodeAlias = "orchestrator";
6
6
 
@@ -2,8 +2,8 @@ import { randomUUID } from "node:crypto";
2
2
  import type { CompactionResult, ExtensionAPI, ExtensionContext, SessionEntry } from "@earendil-works/pi-coding-agent";
3
3
  import { compact, estimateTokens, findCutPoint } from "@earendil-works/pi-coding-agent";
4
4
 
5
- import { sha256 } from "../utils/hashing.js";
6
- import { isRecord } from "../utils/records.js";
5
+ import { sha256 } from "../core/utils/hashing.js";
6
+ import { isRecord } from "../core/utils/records.js";
7
7
  import { buildZobCompactionInstructions, withZobCompactionDetails, ZOB_COMPACTION_TARGET_TOKENS, type ZobCompactionDetails } from "./compaction-policy.js";
8
8
  import type { HarnessRuntimeState } from "./state.js";
9
9
 
@@ -1,26 +1,26 @@
1
1
  import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
2
2
  import type { AutocompleteItem } from "@earendil-works/pi-tui";
3
3
 
4
- import { MODE_PROMPTS } from "../constants.js";
4
+ import { MODE_PROMPTS } from "../core/constants.js";
5
5
  import type { ModeName, QueueTickResult } from "../types.js";
6
- import { discoverAgents, formatAgentList } from "../agents.js";
7
- import { buildComputePreview, resolveComputeProfile, type ComputeRequestedProfile } from "../compute-profile.js";
8
- import { buildComputeWorkflowShape } from "../compute-workflow-shape.js";
9
- import { buildDaemonRuntimeState, buildDaemonTickPlan, type DaemonRuntimeState, type DaemonTickPlan } from "../daemon-runtime.js";
10
- import { runQueueDaemonTick } from "../queue.js";
11
- import { buildProjectDnaAgenticPlan, buildProjectDnaQueryResult, buildProjectDnaReadinessAudit } from "../project-dna.js";
12
- import { formatZagentList, formatZteamList, listZagentManifests, listZteamManifests, loadZagentManifest, loadZteamManifest, normalizeZagentRoomBindings, readZagentPrompt, type ZAgentManifest, type ZAgentRoomBinding, type ZTeamAgentManifest, type ZTeamManifest, type ZTeamMemberManifest } from "../zagents.js";
6
+ import { discoverAgents, formatAgentList } from "../domains/delegation/agents.js";
7
+ import { buildComputePreview, resolveComputeProfile, type ComputeRequestedProfile } from "../domains/compute/compute-profile.js";
8
+ import { buildComputeWorkflowShape } from "../domains/compute/compute-workflow-shape.js";
9
+ import { buildDaemonRuntimeState, buildDaemonTickPlan, type DaemonRuntimeState, type DaemonTickPlan } from "../domains/autonomy/daemon-runtime.js";
10
+ import { runQueueDaemonTick } from "../domains/telemetry/queue.js";
11
+ import { buildProjectDnaAgenticPlan, buildProjectDnaQueryResult, buildProjectDnaReadinessAudit } from "../domains/project-dna/project-dna.js";
12
+ import { formatZagentList, formatZteamList, listZagentManifests, listZteamManifests, loadZagentManifest, loadZteamManifest, normalizeZagentRoomBindings, readZagentPrompt, resolveZagentRuntimeRoomBindings, type ZAgentManifest, type ZAgentRoomBinding, type ZTeamAgentManifest, type ZTeamManifest, type ZTeamMemberManifest } from "../domains/coms/zagents.js";
13
13
  import { resolveAdaptiveZmodeEntrypoint, renderAdaptiveZmodeTemplate } from "./adaptive-zmode.js";
14
14
  import { handleZcompactCommand } from "./auto-compaction.js";
15
- import { sha256 } from "../utils/hashing.js";
16
- import { buildZcommitPlan, formatZcommitPlan, formatZcommitStatus, readZcommitPolicy, runGovernedZcommitAdopt, runGovernedZcommitCommit, runGovernedZcommitPush, type ZcommitAdoptResult, type ZcommitCommandResult, type ZcommitOwnedPathRef, type ZcommitToggleState } from "../git-ops.js";
17
- import { clearZpeerNewCarryoverProfile, writeZpeerLocalProfileFromPeer } from "../coms-v2/zpeer-profile.js";
18
- import { buildZpeerRoomSummary, changeZpeerAlias, changeZpeerRoom, clearZpeerRoom, joinZpeerRoom, leaveZpeerRoom, peerAliasInRoom, refreshZpeerSelf, sendZpeerPrompt, useZpeerRoom, zpeerMembershipsForPeer, type ZpeerSendMode } from "../coms-v2/zpeer.js";
15
+ import { sha256 } from "../core/utils/hashing.js";
16
+ import { buildZcommitPlan, formatZcommitPlan, formatZcommitStatus, readZcommitPolicy, runGovernedZcommitAdopt, runGovernedZcommitCommit, runGovernedZcommitPush, type ZcommitAdoptResult, type ZcommitCommandResult, type ZcommitOwnedPathRef, type ZcommitToggleState } from "../domains/git/git-ops.js";
17
+ import { clearZpeerNewCarryoverProfile, writeZpeerLocalProfileFromPeer } from "../domains/coms/coms-v2/zpeer-profile.js";
18
+ import { buildZpeerRoomSummary, changeZpeerAlias, changeZpeerRoom, clearZpeerRoom, joinZpeerRoom, leaveZpeerRoom, peerAliasInRoom, refreshZpeerSelf, sendZpeerPrompt, useZpeerRoom, zpeerMembershipsForPeer, type ZpeerSendMode } from "../domains/coms/coms-v2/zpeer.js";
19
19
  import { markZpeerNewHardResetPending } from "./events.js";
20
- import { parseBillableJobIntake, validateBillableJobIntake } from "../goal.js";
21
- import { handleGoalCommand, handleGoalGateCommand, pauseRuntimeGoalForStop } from "../goal-runtime.js";
22
- import { formatRuleResolution, resolveRuleProfile } from "../rules.js";
23
- import { formatContractTemplate } from "../safety.js";
20
+ import { parseBillableJobIntake, validateBillableJobIntake } from "../domains/goal/goal.js";
21
+ import { handleGoalCommand, handleGoalGateCommand, pauseRuntimeGoalForStop } from "./goal-runtime.js";
22
+ import { formatRuleResolution, resolveRuleProfile } from "../domains/governance/rules.js";
23
+ import { formatContractTemplate } from "../domains/governance/safety.js";
24
24
  import { showDelegationOverlay } from "./delegation-overlay.js";
25
25
  import { finishDelegationRun } from "./delegation-monitor.js";
26
26
  import { showGoalTodoOverlay } from "./goal-todo-overlay.js";
@@ -33,7 +33,7 @@ import {
33
33
  scoreMissionReadiness,
34
34
  toAutonomyStateLedgerEntry,
35
35
  toMissionReadinessLedgerEntry,
36
- } from "../interactive-autonomy.js";
36
+ } from "../domains/autonomy/interactive-autonomy.js";
37
37
  import { applyMode, renderHarnessWidget } from "./widget.js";
38
38
 
39
39
  const COMPUTE_PROFILES = ["auto", "low", "medium", "high", "xhigh", "max"] as const;
@@ -598,6 +598,7 @@ function formatZagentShow(loaded: ReturnType<typeof loadZagentManifest>): string
598
598
  loaded.manifest.team ? `team: ${loaded.manifest.team}` : undefined,
599
599
  loaded.manifest.role ? `role: ${loaded.manifest.role}` : undefined,
600
600
  loaded.manifest.alias ? `alias: @${loaded.manifest.alias}` : undefined,
601
+ loaded.manifest.defaultMode ? `defaultMode: ${loaded.manifest.defaultMode}` : undefined,
601
602
  rooms.length ? `rooms: ${rooms.map((room) => `${room.id}${room.alias ? `@${room.alias}` : ""}${room.active ? "*" : ""}`).join(", ")}` : "rooms: none",
602
603
  loaded.manifest.promptRef ? `promptRef: ${loaded.manifest.promptRef}` : "promptRef: none",
603
604
  loaded.promptPath ? `promptPath: ${loaded.promptPath}` : undefined,
@@ -627,7 +628,7 @@ function normalizeZpeerRole(role: string | undefined): "member" | "bridge" | "ob
627
628
 
628
629
  async function applyZagentToZpeer(repoRoot: string, peer: NonNullable<HarnessRuntimeState["zobLive"]["peerCard"]>, manifest: ZAgentManifest): Promise<{ ok: true; peer: NonNullable<HarnessRuntimeState["zobLive"]["peerCard"]> } | { ok: false; reason: string; peer: NonNullable<HarnessRuntimeState["zobLive"]["peerCard"]> }> {
629
630
  let current = refreshZpeerSelf(repoRoot, peer);
630
- const rooms = normalizeZagentRoomBindings(manifest.rooms, manifest.defaultRoom, manifest.activeRoom);
631
+ const rooms = resolveZagentRuntimeRoomBindings(repoRoot, manifest).rooms;
631
632
  if (rooms.length === 0 && manifest.alias) {
632
633
  const changed = await changeZpeerAlias(repoRoot, current, manifest.alias);
633
634
  if (!changed.ok) return { ok: false, reason: changed.reason, peer: current };
@@ -663,25 +664,44 @@ function zteamMembers(team: ZTeamManifest): Array<{ id: string; alias?: string;
663
664
  }));
664
665
  }
665
666
 
666
- function zteamLaunchPlanText(team: ZTeamManifest): { text: string; roomIds: string[]; agentIds: string[] } {
667
+ function safeLaunchPlanModel(value: string | undefined): string | undefined {
668
+ const trimmed = value?.trim();
669
+ if (!trimmed || trimmed.length > 160) return undefined;
670
+ if (trimmed.includes("\0") || trimmed.includes("\n") || trimmed.includes("\r") || trimmed.includes("..")) return undefined;
671
+ if (trimmed.startsWith("/") || trimmed.startsWith("~")) return undefined;
672
+ return /^[a-zA-Z0-9._:/+@-]+$/.test(trimmed) ? trimmed : undefined;
673
+ }
674
+
675
+ function zteamLaunchPlanText(repoRoot: string, team: ZTeamManifest): { text: string; roomIds: string[]; agentIds: string[]; modelIds: string[]; defaultModes: string[] } {
667
676
  const teamRooms = normalizeZagentRoomBindings(team.rooms, team.defaultRoom, team.activeRoom).map((room) => room.id);
668
677
  const members = zteamMembers(team);
669
678
  const roomIds = [...new Set([...teamRooms, ...members.flatMap((member) => (member.rooms ?? []).map((room) => room.id))])];
670
679
  const agentIds = members.map((member) => member.id);
680
+ const loadedAgents = members.map((member) => ({ member, loaded: loadZagentManifest(repoRoot, member.id) }));
681
+ const modelIds = [...new Set(loadedAgents.map(({ loaded }) => safeLaunchPlanModel(loaded.manifest.model)).filter((model): model is string => Boolean(model)))];
682
+ const defaultModes = [...new Set(loadedAgents.map(({ loaded }) => loaded.manifest.defaultMode).filter((mode): mode is ModeName => Boolean(mode)))];
671
683
  const lines = [
672
684
  `# ZTeam launch-plan: ${team.id}`,
673
685
  "No processes spawned. Copy/paste each command in a separate terminal when approved.",
674
686
  "",
675
- ...members.map((member) => {
687
+ ...loadedAgents.map(({ member, loaded }) => {
688
+ const rawModel = loaded.manifest.model;
689
+ const model = safeLaunchPlanModel(rawModel);
690
+ const defaultMode = loaded.manifest.defaultMode;
676
691
  const rooms = (member.rooms ?? []).map((room) => `${room.id}${room.active ? "*" : ""}`).join(", ") || teamRooms.join(", ") || "default";
677
692
  const alias = member.alias ? ` alias=@${member.alias}` : "";
678
- return `ZOB_ZAGENT_ID=${member.id} pi # expected_rooms=${rooms}${alias}`;
693
+ const modelArg = model ? ` --model ${model}` : "";
694
+ const modelNote = rawModel ? (model ? ` model=${model}` : " model=invalid_omitted") : "";
695
+ const modeNote = defaultMode ? ` defaultMode=${defaultMode}` : "";
696
+ return `ZOB_ZAGENT_ID=${member.id} pi${modelArg} # expected_rooms=${rooms}${alias}${modelNote}${modeNote}`;
679
697
  }),
680
698
  "",
681
699
  `Expected rooms: ${roomIds.join(", ") || "default"}`,
700
+ modelIds.length ? `Models: ${modelIds.join(", ")}` : "Models: default Pi model unless each ZAgent manifest sets a safe model",
701
+ defaultModes.length ? `Default modes: ${defaultModes.join(", ")}` : "Default modes: restored/current ZOB mode unless each ZAgent manifest sets defaultMode",
682
702
  "After each session starts, run /zagent use <id> to bind its ZPeer alias/rooms.",
683
703
  ];
684
- return { text: lines.join("\n"), roomIds, agentIds };
704
+ return { text: lines.join("\n"), roomIds, agentIds, modelIds, defaultModes };
685
705
  }
686
706
 
687
707
  function delegationArgumentCompletions(state: HarnessRuntimeState, prefix: string): AutocompleteItem[] | null {
@@ -874,11 +894,13 @@ export function registerHarnessCommands(pi: ExtensionAPI, state: HarnessRuntimeS
874
894
  }
875
895
  const loaded = loadZagentManifest(ctx.cwd, id);
876
896
  const prompt = readZagentPrompt(ctx.cwd, loaded.manifest.promptRef);
877
- const rooms = normalizeZagentRoomBindings(loaded.manifest.rooms, loaded.manifest.defaultRoom, loaded.manifest.activeRoom);
897
+ const resolved = resolveZagentRuntimeRoomBindings(ctx.cwd, loaded.manifest);
898
+ const rooms = resolved.rooms;
878
899
  const errors = [...loaded.errors, ...prompt.errors];
879
900
  state.zagent = {
880
901
  id: loaded.manifest.id,
881
- team: loaded.manifest.team,
902
+ team: loaded.manifest.team ?? resolved.teamIds[0],
903
+ teams: resolved.teamIds,
882
904
  role: loaded.manifest.role,
883
905
  alias: loaded.manifest.alias,
884
906
  description: loaded.manifest.description,
@@ -967,11 +989,11 @@ export function registerHarnessCommands(pi: ExtensionAPI, state: HarnessRuntimeS
967
989
  return;
968
990
  }
969
991
  const loaded = loadZteamManifest(ctx.cwd, id);
970
- const plan = zteamLaunchPlanText(loaded.manifest);
992
+ const plan = zteamLaunchPlanText(ctx.cwd, loaded.manifest);
971
993
  pi.appendEntry("zob-zagent", zagentLedgerEntry("zteam_launch_plan", { teamId: loaded.manifest.id, status: loaded.errors.length === 0 ? "ok" : "blocked", roomIds: plan.roomIds, path: loaded.path, errors: loaded.errors }));
972
994
  renderHarnessWidget(pi, state, ctx);
973
- void pi.sendMessage({ customType: "zob-zteam-launch-plan", content: loaded.errors.length ? `${plan.text}\n\nBlocked manifest errors:\n- ${loaded.errors.join("\n- ")}` : plan.text, display: true, details: { id: loaded.manifest.id, agentIdHashes: plan.agentIds.map((agentId) => sha256(agentId)), roomIdHashes: plan.roomIds.map((roomId) => sha256(roomId)), bodyStored: false } }, { triggerTurn: false });
974
- ctx.ui.notify(`zteam ${loaded.manifest.id} launch-plan printed; spawn count=0; expectedRooms=${plan.roomIds.join(",") || "default"}`, loaded.errors.length === 0 ? "info" : "warning");
995
+ void pi.sendMessage({ customType: "zob-zteam-launch-plan", content: loaded.errors.length ? `${plan.text}\n\nBlocked manifest errors:\n- ${loaded.errors.join("\n- ")}` : plan.text, display: true, details: { id: loaded.manifest.id, agentIdHashes: plan.agentIds.map((agentId) => sha256(agentId)), roomIdHashes: plan.roomIds.map((roomId) => sha256(roomId)), modelIdHashes: plan.modelIds.map((modelId) => sha256(modelId)), defaultModeHashes: plan.defaultModes.map((mode) => sha256(mode)), bodyStored: false } }, { triggerTurn: false });
996
+ ctx.ui.notify(`zteam ${loaded.manifest.id} launch-plan printed; spawn count=0; expectedRooms=${plan.roomIds.join(",") || "default"}; models=${plan.modelIds.length || "default"}; defaultModes=${plan.defaultModes.length || "current"}`, loaded.errors.length === 0 ? "info" : "warning");
975
997
  return;
976
998
  }
977
999
  ctx.ui.notify("Usage: /zteam list | /zteam show <id> | /zteam launch-plan <id>", "warning");
@@ -1,7 +1,7 @@
1
1
  import type { CompactionResult } from "@earendil-works/pi-coding-agent";
2
2
 
3
- import { goalTodoCompletionDiagnostics, summarizeGoalTodos } from "../goal-todos.js";
4
- import { sha256 } from "../utils/hashing.js";
3
+ import { goalTodoCompletionDiagnostics, summarizeGoalTodos } from "../domains/goal/goal-todos.js";
4
+ import { sha256 } from "../core/utils/hashing.js";
5
5
  import type { HarnessRuntimeState } from "./state.js";
6
6
 
7
7
  export const ZOB_COMPACTION_ENTRY_TYPE = "zob-compaction";
@@ -5,7 +5,7 @@ import { Markdown, truncateToWidth, visibleWidth, type MarkdownTheme } from "@ea
5
5
 
6
6
  import { delegationDurationMs, delegationSignalBadge, delegationSignalColor, formatDelegationContextLabel, formatDelegationCostLabel, formatDelegationModelLabel, formatDelegationSignalBadge, formatDuration, statusIcon, type DelegationRunView } from "./delegation-monitor.js";
7
7
  import { sanitizeDelegationText } from "./delegation-markdown.js";
8
- import { isRecord } from "../utils/records.js";
8
+ import { isRecord } from "../core/utils/records.js";
9
9
 
10
10
  const FEED_MAX_BYTES = 240_000;
11
11
  const FEED_MAX_LINES = 1_200;
@@ -2,7 +2,7 @@ import { closeSync, existsSync, openSync, readFileSync, readSync, statSync } fro
2
2
  import { resolve, sep } from "node:path";
3
3
 
4
4
  import type { ChildResult, DelegationFailureKind } from "../types.js";
5
- import { isRecord } from "../utils/records.js";
5
+ import { isRecord } from "../core/utils/records.js";
6
6
 
7
7
  export type DelegationRunSource = "delegate_agent" | "delegate_task";
8
8
  export type DelegationRunMode = "single" | "parallel" | "chain";