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.
- package/.pi/adapters/registry.json +103 -0
- package/.pi/agents/architecture-cartographer.md +53 -0
- package/.pi/agents/chief-vision.md +39 -0
- package/.pi/agents/clarifier.md +58 -0
- package/.pi/agents/context-steward.md +52 -0
- package/.pi/agents/doc-steward.md +34 -0
- package/.pi/agents/explore.md +49 -0
- package/.pi/agents/factory.md +41 -0
- package/.pi/agents/implementer.md +44 -0
- package/.pi/agents/librarian.md +32 -0
- package/.pi/agents/oracle-merge.md +50 -0
- package/.pi/agents/oracle.md +55 -0
- package/.pi/agents/pattern-miner.md +53 -0
- package/.pi/agents/planner.md +39 -0
- package/.pi/agents/project-dna-golden-evaluator.md +32 -0
- package/.pi/agents/project-dna-ontology-steward.md +30 -0
- package/.pi/agents/project-dna-oracle.md +56 -0
- package/.pi/agents/project-dna-orchestrator.md +60 -0
- package/.pi/agents/project-dna-query-steward.md +38 -0
- package/.pi/agents/project-dna-safety-preflight.md +54 -0
- package/.pi/agents/project-dna-test-linker.md +27 -0
- package/.pi/agents/qa.md +38 -0
- package/.pi/agents/refactor-cartographer.md +28 -0
- package/.pi/agents/refactor-mover.md +31 -0
- package/.pi/agents/refactor-oracle.md +49 -0
- package/.pi/agents/repo-scout.md +60 -0
- package/.pi/agents/sample-architect.md +48 -0
- package/.pi/agents/specifier.md +57 -0
- package/.pi/agents/symbol-range-curator.md +41 -0
- package/.pi/agents/synthesis.md +52 -0
- package/.pi/agents/temp-agent-creator.md +35 -0
- package/.pi/autonomy-policy.json +67 -0
- package/.pi/budget-policy.json +54 -0
- package/.pi/capabilities/zob-public-runtime-capabilities.json +1700 -0
- package/.pi/chains/explore-plan-oracle.json +78 -0
- package/.pi/chains/explore-spec-clarify-plan-oracle.json +64 -0
- package/.pi/chains/explore-spec-plan-oracle.json +53 -0
- package/.pi/chains/spec-clarify-plan-oracle.json +53 -0
- package/.pi/chains/spec-factory-oracle.json +42 -0
- package/.pi/chains/spec-plan-oracle.json +42 -0
- package/.pi/compute-profiles/defaults.json +19 -0
- package/.pi/compute-profiles/overrides.json +13 -0
- package/.pi/compute-profiles/risk-rules.json +16 -0
- package/.pi/daemon-policy.json +80 -0
- package/.pi/damage-control-rules.json +45 -0
- package/.pi/extensions/zob-child-safety/index.ts +212 -0
- package/.pi/extensions/zob-harness/AGENTS.md +28 -0
- package/.pi/extensions/zob-harness/index.ts +391 -0
- package/.pi/extensions/zob-harness/src/AGENTS.md +25 -0
- package/.pi/extensions/zob-harness/src/agents.ts +82 -0
- package/.pi/extensions/zob-harness/src/autonomous-runtime.ts +2912 -0
- package/.pi/extensions/zob-harness/src/autonomy-readiness.ts +778 -0
- package/.pi/extensions/zob-harness/src/budget-policy.ts +308 -0
- package/.pi/extensions/zob-harness/src/capabilities.ts +249 -0
- package/.pi/extensions/zob-harness/src/child-runner.ts +249 -0
- package/.pi/extensions/zob-harness/src/chronicle.ts +262 -0
- package/.pi/extensions/zob-harness/src/compute-profile.ts +602 -0
- package/.pi/extensions/zob-harness/src/compute-workflow-shape.ts +168 -0
- package/.pi/extensions/zob-harness/src/coms-v2/AGENTS.md +16 -0
- package/.pi/extensions/zob-harness/src/coms-v2/envelope.ts +121 -0
- package/.pi/extensions/zob-harness/src/coms-v2/identity.ts +53 -0
- package/.pi/extensions/zob-harness/src/coms-v2/ledger-bridge.ts +67 -0
- package/.pi/extensions/zob-harness/src/coms-v2/local-transport.ts +147 -0
- package/.pi/extensions/zob-harness/src/coms-v2/pending-replies.ts +80 -0
- package/.pi/extensions/zob-harness/src/coms-v2/policy.ts +125 -0
- package/.pi/extensions/zob-harness/src/coms-v2/presence.ts +55 -0
- package/.pi/extensions/zob-harness/src/coms-v2/registry.ts +113 -0
- package/.pi/extensions/zob-harness/src/coms-v2/response-capture.ts +50 -0
- package/.pi/extensions/zob-harness/src/coms-v2/transcript-capture.ts +164 -0
- package/.pi/extensions/zob-harness/src/coms-v2/types.ts +149 -0
- package/.pi/extensions/zob-harness/src/coms-v2/zpeer-profile.ts +140 -0
- package/.pi/extensions/zob-harness/src/coms-v2/zpeer.ts +452 -0
- package/.pi/extensions/zob-harness/src/constants.ts +108 -0
- package/.pi/extensions/zob-harness/src/context-gbrain.ts +465 -0
- package/.pi/extensions/zob-harness/src/daemon-policy.ts +223 -0
- package/.pi/extensions/zob-harness/src/daemon-readiness.ts +134 -0
- package/.pi/extensions/zob-harness/src/daemon-runtime.ts +393 -0
- package/.pi/extensions/zob-harness/src/factory/AGENTS.md +24 -0
- package/.pi/extensions/zob-harness/src/factory/agentic-plan.ts +65 -0
- package/.pi/extensions/zob-harness/src/factory/quarantine.ts +319 -0
- package/.pi/extensions/zob-harness/src/factory/run.ts +520 -0
- package/.pi/extensions/zob-harness/src/factory/validation.ts +454 -0
- package/.pi/extensions/zob-harness/src/factory-selector.ts +318 -0
- package/.pi/extensions/zob-harness/src/full-autonomy-test.ts +226 -0
- package/.pi/extensions/zob-harness/src/git-ops.ts +868 -0
- package/.pi/extensions/zob-harness/src/goal-room.ts +178 -0
- package/.pi/extensions/zob-harness/src/goal-runtime.ts +1569 -0
- package/.pi/extensions/zob-harness/src/goal-todo-imports.ts +111 -0
- package/.pi/extensions/zob-harness/src/goal-todo-types.ts +231 -0
- package/.pi/extensions/zob-harness/src/goal-todos.ts +1410 -0
- package/.pi/extensions/zob-harness/src/goal.ts +152 -0
- package/.pi/extensions/zob-harness/src/governed-requests.ts +436 -0
- package/.pi/extensions/zob-harness/src/interactive-autonomy.ts +595 -0
- package/.pi/extensions/zob-harness/src/launch-apply.ts +313 -0
- package/.pi/extensions/zob-harness/src/merge-queue.ts +290 -0
- package/.pi/extensions/zob-harness/src/mission-control.ts +573 -0
- package/.pi/extensions/zob-harness/src/model-availability.ts +52 -0
- package/.pi/extensions/zob-harness/src/model-routing.ts +429 -0
- package/.pi/extensions/zob-harness/src/orchestration/AGENTS.md +23 -0
- package/.pi/extensions/zob-harness/src/orchestration/adaptive-delegation.ts +547 -0
- package/.pi/extensions/zob-harness/src/orchestration/adaptive-workflow.ts +585 -0
- package/.pi/extensions/zob-harness/src/orchestration/lead-plan.ts +192 -0
- package/.pi/extensions/zob-harness/src/orchestration/plan.ts +168 -0
- package/.pi/extensions/zob-harness/src/orchestration/room.ts +346 -0
- package/.pi/extensions/zob-harness/src/orchestration/run.ts +134 -0
- package/.pi/extensions/zob-harness/src/orchestration/supervised-readonly.ts +1147 -0
- package/.pi/extensions/zob-harness/src/orchestration/widget-readers.ts +132 -0
- package/.pi/extensions/zob-harness/src/output-contracts.ts +656 -0
- package/.pi/extensions/zob-harness/src/project-dna.ts +533 -0
- package/.pi/extensions/zob-harness/src/promotion/AGENTS.md +24 -0
- package/.pi/extensions/zob-harness/src/promotion/candidate.ts +336 -0
- package/.pi/extensions/zob-harness/src/promotion/coms.ts +127 -0
- package/.pi/extensions/zob-harness/src/promotion/documentation.ts +142 -0
- package/.pi/extensions/zob-harness/src/promotion/factory.ts +107 -0
- package/.pi/extensions/zob-harness/src/promotion/ledger.ts +2 -0
- package/.pi/extensions/zob-harness/src/promotion/temp-agent.ts +151 -0
- package/.pi/extensions/zob-harness/src/promotion/types.ts +149 -0
- package/.pi/extensions/zob-harness/src/promotion/validate.ts +6 -0
- package/.pi/extensions/zob-harness/src/promotion/write-lane.ts +162 -0
- package/.pi/extensions/zob-harness/src/prompt-packs.ts +239 -0
- package/.pi/extensions/zob-harness/src/queue.ts +386 -0
- package/.pi/extensions/zob-harness/src/rules.ts +225 -0
- package/.pi/extensions/zob-harness/src/runtime/AGENTS.md +26 -0
- package/.pi/extensions/zob-harness/src/runtime/adaptive-zmode.ts +116 -0
- package/.pi/extensions/zob-harness/src/runtime/auto-compaction.ts +715 -0
- package/.pi/extensions/zob-harness/src/runtime/commands.ts +1315 -0
- package/.pi/extensions/zob-harness/src/runtime/compaction-policy.ts +516 -0
- package/.pi/extensions/zob-harness/src/runtime/delegation-click-markers.ts +141 -0
- package/.pi/extensions/zob-harness/src/runtime/delegation-feed.ts +415 -0
- package/.pi/extensions/zob-harness/src/runtime/delegation-markdown.ts +97 -0
- package/.pi/extensions/zob-harness/src/runtime/delegation-monitor.ts +553 -0
- package/.pi/extensions/zob-harness/src/runtime/delegation-mouse.ts +205 -0
- package/.pi/extensions/zob-harness/src/runtime/delegation-overlay.ts +434 -0
- package/.pi/extensions/zob-harness/src/runtime/events.ts +736 -0
- package/.pi/extensions/zob-harness/src/runtime/goal-todo-overlay.ts +214 -0
- package/.pi/extensions/zob-harness/src/runtime/mode-intent.ts +144 -0
- package/.pi/extensions/zob-harness/src/runtime/plan-capture.ts +270 -0
- package/.pi/extensions/zob-harness/src/runtime/state.ts +403 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-autonomous.ts +117 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-compute.ts +136 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-coms.ts +365 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-context.ts +70 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-delegation.ts +1854 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-factory.ts +810 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-goal-room.ts +46 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-governed-requests.ts +38 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-merge-queue.ts +61 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-mission-control.ts +77 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-orchestration.ts +106 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-project-dna.ts +123 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-worker-pool.ts +93 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-workspace-claims.ts +62 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-zcommit.ts +147 -0
- package/.pi/extensions/zob-harness/src/runtime/widget.ts +353 -0
- package/.pi/extensions/zob-harness/src/runtime/zobHarness.ts +60 -0
- package/.pi/extensions/zob-harness/src/safety.ts +338 -0
- package/.pi/extensions/zob-harness/src/sandbox.ts +1508 -0
- package/.pi/extensions/zob-harness/src/schemas-project-dna.ts +47 -0
- package/.pi/extensions/zob-harness/src/schemas.ts +695 -0
- package/.pi/extensions/zob-harness/src/telemetry.ts +373 -0
- package/.pi/extensions/zob-harness/src/topology/AGENTS.md +22 -0
- package/.pi/extensions/zob-harness/src/topology/chains.ts +236 -0
- package/.pi/extensions/zob-harness/src/topology/coms.ts +211 -0
- package/.pi/extensions/zob-harness/src/topology/orchestration-profiles.ts +204 -0
- package/.pi/extensions/zob-harness/src/topology/teams.ts +113 -0
- package/.pi/extensions/zob-harness/src/types/core.ts +47 -0
- package/.pi/extensions/zob-harness/src/types.ts +939 -0
- package/.pi/extensions/zob-harness/src/utils/AGENTS.md +22 -0
- package/.pi/extensions/zob-harness/src/utils/formatting.ts +34 -0
- package/.pi/extensions/zob-harness/src/utils/hashing.ts +11 -0
- package/.pi/extensions/zob-harness/src/utils/json.ts +28 -0
- package/.pi/extensions/zob-harness/src/utils/paths.ts +54 -0
- package/.pi/extensions/zob-harness/src/utils/records.ts +25 -0
- package/.pi/extensions/zob-harness/src/utils/resources.ts +38 -0
- package/.pi/extensions/zob-harness/src/worker-pool.ts +672 -0
- package/.pi/extensions/zob-harness/src/workspace-claims.ts +297 -0
- package/.pi/extensions/zob-switch/index.ts +180 -0
- package/.pi/factories/budget-preflight-dry-run/batch-manifest.json +59 -0
- package/.pi/factories/budget-preflight-dry-run/factory.json +94 -0
- package/.pi/factories/budget-preflight-dry-run/pilot-manifest.json +50 -0
- package/.pi/factories/budget-preflight-dry-run/smoke-manifest.json +43 -0
- package/.pi/factories/code-review-matrix/batch-manifest.json +61 -0
- package/.pi/factories/code-review-matrix/factory.json +163 -0
- package/.pi/factories/code-review-matrix/pilot-manifest.json +41 -0
- package/.pi/factories/code-review-matrix/smoke-manifest.json +35 -0
- package/.pi/factories/factory-forge/batch-manifest.json +56 -0
- package/.pi/factories/factory-forge/factory.json +84 -0
- package/.pi/factories/factory-forge/pilot-manifest.json +32 -0
- package/.pi/factories/factory-forge/smoke-manifest.json +19 -0
- package/.pi/factories/opencode-pattern-canonizer/batch-manifest.json +54 -0
- package/.pi/factories/opencode-pattern-canonizer/factory.json +86 -0
- package/.pi/factories/opencode-pattern-canonizer/pilot-manifest.json +39 -0
- package/.pi/factories/opencode-pattern-canonizer/smoke-manifest.json +26 -0
- package/.pi/factories/project-dna/README.md +182 -0
- package/.pi/factories/project-dna/batch-manifest.json +37 -0
- package/.pi/factories/project-dna/example-project-dna-manifest-v2.json +80 -0
- package/.pi/factories/project-dna/example-project-dna-manifest.json +58 -0
- package/.pi/factories/project-dna/factory.json +131 -0
- package/.pi/factories/project-dna/golden-cases-smoke.json +62 -0
- package/.pi/factories/project-dna/pi-agentic-ontology.json +88 -0
- package/.pi/factories/project-dna/pilot-manifest.json +32 -0
- package/.pi/factories/project-dna/schemas/benchmark-suite.schema.json +27 -0
- package/.pi/factories/project-dna/schemas/code-knowledge-graph.schema.json +97 -0
- package/.pi/factories/project-dna/schemas/context-pack.schema.json +43 -0
- package/.pi/factories/project-dna/schemas/golden-case.schema.json +36 -0
- package/.pi/factories/project-dna/schemas/manifest-v2.schema.json +128 -0
- package/.pi/factories/project-dna/schemas/manifest.schema.json +77 -0
- package/.pi/factories/project-dna/schemas/ontology.schema.json +45 -0
- package/.pi/factories/project-dna/schemas/project-fingerprint.schema.json +28 -0
- package/.pi/factories/project-dna/schemas/query-steward-report.schema.json +52 -0
- package/.pi/factories/project-dna/smoke-manifest.json +27 -0
- package/.pi/factories/roadmap-smoke-lots/batch-manifest.json +49 -0
- package/.pi/factories/roadmap-smoke-lots/factory.json +89 -0
- package/.pi/factories/roadmap-smoke-lots/pilot-manifest.json +50 -0
- package/.pi/factories/roadmap-smoke-lots/smoke-manifest.json +35 -0
- package/.pi/git-policy.json +120 -0
- package/.pi/mission-control/zob_coms_transport.json +64 -0
- package/.pi/model-catalog.example.json +345 -0
- package/.pi/model-economy.example.json +196 -0
- package/.pi/model-routing.json +86 -0
- package/.pi/orchestrations/adaptive-chief-vision.json +193 -0
- package/.pi/orchestrations/ceo-feature-build.json +182 -0
- package/.pi/orchestrations/readonly-dynamic-smoke.json +75 -0
- package/.pi/output-contracts/agent-event.v1.json +19 -0
- package/.pi/output-contracts/base.v1.json +24 -0
- package/.pi/output-contracts/brain-lookup.v1.json +21 -0
- package/.pi/output-contracts/clarification.v1.json +21 -0
- package/.pi/output-contracts/context-pack.v1.json +20 -0
- package/.pi/output-contracts/context-request.v1.json +21 -0
- package/.pi/output-contracts/context-steward.v1.json +19 -0
- package/.pi/output-contracts/context-writeback-proposal.v1.json +18 -0
- package/.pi/output-contracts/delegation-request.v1.json +21 -0
- package/.pi/output-contracts/explore.v1.json +52 -0
- package/.pi/output-contracts/factory.v1.json +48 -0
- package/.pi/output-contracts/guidance-steward.v1.json +18 -0
- package/.pi/output-contracts/implement.v1.json +40 -0
- package/.pi/output-contracts/launch-authorization.v1.json +21 -0
- package/.pi/output-contracts/lead-plan.v1.json +22 -0
- package/.pi/output-contracts/mission-readiness.v1.json +20 -0
- package/.pi/output-contracts/oracle-merge.v1.json +44 -0
- package/.pi/output-contracts/oracle-request.v1.json +20 -0
- package/.pi/output-contracts/oracle.v1.json +44 -0
- package/.pi/output-contracts/orchestration-profile.v1.json +22 -0
- package/.pi/output-contracts/plan.v1.json +48 -0
- package/.pi/output-contracts/prompt-pack.v1.json +20 -0
- package/.pi/output-contracts/qa.v1.json +40 -0
- package/.pi/output-contracts/research.v1.json +36 -0
- package/.pi/output-contracts/spec.v1.json +22 -0
- package/.pi/output-contracts/synthesis.v1.json +44 -0
- package/.pi/output-contracts/temp-agent-card.v1.json +23 -0
- package/.pi/output-contracts/todo-child-result.v1.json +20 -0
- package/.pi/output-contracts/todo-child-result.v2.json +22 -0
- package/.pi/output-contracts/todo-claim-validation.v1.json +22 -0
- package/.pi/output-contracts/todo-split-request.v1.json +20 -0
- package/.pi/prompts/adaptive-workflow.md +63 -0
- package/.pi/prompts/autonomous-runtime.md +15 -0
- package/.pi/prompts/benchmark-contender.md +15 -0
- package/.pi/prompts/benchmark-judge.md +19 -0
- package/.pi/prompts/clarify-spec.md +20 -0
- package/.pi/prompts/compute-plan.md +36 -0
- package/.pi/prompts/compute-preview.md +42 -0
- package/.pi/prompts/contract.md +29 -0
- package/.pi/prompts/explore.md +13 -0
- package/.pi/prompts/factory-run.md +36 -0
- package/.pi/prompts/factory.md +20 -0
- package/.pi/prompts/implement.md +27 -0
- package/.pi/prompts/model-catalog.md +68 -0
- package/.pi/prompts/model-economy.md +64 -0
- package/.pi/prompts/oracle-merge.md +18 -0
- package/.pi/prompts/oracle.md +13 -0
- package/.pi/prompts/orchestrator.md +48 -0
- package/.pi/prompts/parallel-review.md +21 -0
- package/.pi/prompts/plan.md +21 -0
- package/.pi/prompts/project-dna.md +90 -0
- package/.pi/prompts/refactor-oracle.md +23 -0
- package/.pi/prompts/refactor-slice.md +24 -0
- package/.pi/prompts/research.md +20 -0
- package/.pi/prompts/spec.md +19 -0
- package/.pi/prompts/synthesis.md +18 -0
- package/.pi/rules/always.md +38 -0
- package/.pi/rules/docs.md +32 -0
- package/.pi/rules/factory.md +44 -0
- package/.pi/rules/oracle.md +34 -0
- package/.pi/rules/orchestration.md +44 -0
- package/.pi/rules/project.md +34 -0
- package/.pi/rules/prompts.md +43 -0
- package/.pi/rules/runtime.md +43 -0
- package/.pi/rules/sandbox.md +43 -0
- package/.pi/settings.json +28 -0
- package/.pi/skills/zob-agentic-access/SKILL.md +20 -0
- package/.pi/skills/zob-autonomous-runtime/SKILL.md +41 -0
- package/.pi/skills/zob-commit/SKILL.md +79 -0
- package/.pi/skills/zob-compaction-policy/SKILL.md +92 -0
- package/.pi/skills/zob-compute-profile/SKILL.md +108 -0
- package/.pi/skills/zob-coms-safety/SKILL.md +54 -0
- package/.pi/skills/zob-coms-v2-live/SKILL.md +47 -0
- package/.pi/skills/zob-delegation-routing/SKILL.md +82 -0
- package/.pi/skills/zob-factory/SKILL.md +28 -0
- package/.pi/skills/zob-goal-todo-tree/SKILL.md +279 -0
- package/.pi/skills/zob-harness/SKILL.md +68 -0
- package/.pi/skills/zob-mission-control-coms/SKILL.md +39 -0
- package/.pi/skills/zob-oracle/SKILL.md +21 -0
- package/.pi/skills/zob-owner-pool-drill-writer/SKILL.md +244 -0
- package/.pi/skills/zob-owner-pool-launcher/SKILL.md +261 -0
- package/.pi/skills/zob-project-dna/SKILL.md +275 -0
- package/.pi/skills/zob-sandbox/SKILL.md +29 -0
- package/.pi/skills/zob-spec/SKILL.md +25 -0
- package/.pi/skills/zob-split-refactor/SKILL.md +39 -0
- package/.pi/skills/zob-tool-router/SKILL.md +104 -0
- package/.pi/teams/zob-core.json +122 -0
- package/AGENTS.md +89 -0
- package/CONTRIBUTING.md +56 -0
- package/LICENSE +21 -0
- package/README.md +360 -0
- package/SECURITY.md +35 -0
- package/SOURCE_INDEX.md +46 -0
- package/package.json +135 -0
- package/scripts/README.md +57 -0
- package/scripts/autonomy/mission-readiness-secret-smoke.mjs +90 -0
- package/scripts/compute-profile/plan-workflow.mjs +85 -0
- package/scripts/compute-profile/preview.mjs +242 -0
- package/scripts/compute-profile/regression-smoke.mjs +38 -0
- package/scripts/compute-profile/summarize.mjs +72 -0
- package/scripts/compute-profile/validate-policy.mjs +50 -0
- package/scripts/compute-profile/validate-preview.mjs +95 -0
- package/scripts/compute-profile/validate-workflow.mjs +58 -0
- package/scripts/git-ops/commit-policy-smoke.mjs +221 -0
- package/scripts/goal-todo/child-goal-ref-smoke.mjs +252 -0
- package/scripts/harness-switch/static-smoke.mjs +43 -0
- package/scripts/model-catalog/validate-economy.mjs +223 -0
- package/scripts/model-catalog/validate.mjs +199 -0
- package/scripts/package-surface/validate-script-refs.mjs +190 -0
- package/scripts/path-policy/validate-smoke.mjs +103 -0
- package/scripts/project-dna/bench-smoke.mjs +217 -0
- package/scripts/project-dna/build-capsules.mjs +207 -0
- package/scripts/project-dna/build-sample-spec.mjs +140 -0
- package/scripts/project-dna/emit-golden-cases.mjs +75 -0
- package/scripts/project-dna/emit-ontology.mjs +75 -0
- package/scripts/project-dna/generate-sample.mjs +302 -0
- package/scripts/project-dna/oracle-review-smoke.mjs +157 -0
- package/scripts/project-dna/plan-workflow.mjs +289 -0
- package/scripts/project-dna/query-context.mjs +276 -0
- package/scripts/project-dna/query-steward.mjs +149 -0
- package/scripts/project-dna/scan.mjs +553 -0
- package/scripts/project-dna/validate-5of5.mjs +159 -0
- package/scripts/project-dna/validate-golden-cases.mjs +78 -0
- package/scripts/project-dna/validate-ontology.mjs +97 -0
- package/scripts/project-dna/validate-sample-project.mjs +105 -0
- package/scripts/project-dna/validate-scaffold.mjs +383 -0
- package/scripts/project-dna/validate-scan-artifacts.mjs +187 -0
- package/scripts/project-dna/validate-workflow.mjs +166 -0
- package/scripts/start-pi.sh +4 -0
- package/scripts/worker-pool/static-smoke.mjs +54 -0
- package/scripts/zpeer-local-e2e-smoke.mjs +395 -0
- package/scripts/zpeer-static-smoke.mjs +129 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { loadProjectAgents } from "../agents.js";
|
|
2
|
+
import { validateOutputContractId } from "../output-contracts.js";
|
|
3
|
+
import { validateAllowedPathPolicy, validateDelegateTaskWriteScope, validateForbiddenPathPolicy, validateToolList } from "../safety.js";
|
|
4
|
+
import { sha256 } from "../utils/hashing.js";
|
|
5
|
+
import { isRecord } from "../utils/records.js";
|
|
6
|
+
|
|
7
|
+
export interface LeadPlanWorkerContract {
|
|
8
|
+
worker_id: string;
|
|
9
|
+
lead_id?: string;
|
|
10
|
+
agent: string;
|
|
11
|
+
task: string;
|
|
12
|
+
expected_outcome: string;
|
|
13
|
+
required_tools: string[];
|
|
14
|
+
output_contract: string;
|
|
15
|
+
must_do: string[];
|
|
16
|
+
must_not_do: string[];
|
|
17
|
+
context: string;
|
|
18
|
+
allowed_paths?: string[];
|
|
19
|
+
forbidden_paths?: string[];
|
|
20
|
+
model_class?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface LeadPlanWorkerContractExtraction {
|
|
24
|
+
schema: "zob.lead-plan-worker-contract-extraction.v1";
|
|
25
|
+
contracts: LeadPlanWorkerContract[];
|
|
26
|
+
errors: string[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface LeadPlanWorkerContractValidationOptions {
|
|
30
|
+
leadId?: string;
|
|
31
|
+
allowedWorkerIds?: string[];
|
|
32
|
+
allowedTools?: string[];
|
|
33
|
+
supervisedReadonly?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function isStringArray(value: unknown): value is string[] {
|
|
37
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function parseJsonCandidate(text: string): unknown | undefined {
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(text);
|
|
43
|
+
} catch {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function jsonCandidates(output: string): unknown[] {
|
|
49
|
+
const candidates: unknown[] = [];
|
|
50
|
+
const trimmed = output.trim();
|
|
51
|
+
const whole = parseJsonCandidate(trimmed);
|
|
52
|
+
if (whole !== undefined) candidates.push(whole);
|
|
53
|
+
|
|
54
|
+
for (const match of trimmed.matchAll(/```(?:json)?\s*([\s\S]*?)```/gi)) {
|
|
55
|
+
const parsed = parseJsonCandidate(match[1].trim());
|
|
56
|
+
if (parsed !== undefined) candidates.push(parsed);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
for (const match of trimmed.matchAll(/<worker_contracts>\s*([\s\S]*?)\s*<\/worker_contracts>/gi)) {
|
|
60
|
+
const parsed = parseJsonCandidate(match[1].trim());
|
|
61
|
+
if (parsed !== undefined) candidates.push(parsed);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return candidates;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function contractsRoot(candidate: unknown): unknown[] | undefined {
|
|
68
|
+
if (Array.isArray(candidate)) return candidate;
|
|
69
|
+
if (!isRecord(candidate)) return undefined;
|
|
70
|
+
if (Array.isArray(candidate.worker_contracts)) return candidate.worker_contracts;
|
|
71
|
+
if (Array.isArray(candidate.workerContracts)) return candidate.workerContracts;
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function normalizeContract(value: unknown, index: number): { contract?: LeadPlanWorkerContract; errors: string[] } {
|
|
76
|
+
const errors: string[] = [];
|
|
77
|
+
if (!isRecord(value)) return { errors: [`worker_contracts[${index}] must be an object`] };
|
|
78
|
+
|
|
79
|
+
const workerId = typeof value.worker_id === "string" ? value.worker_id : typeof value.workerId === "string" ? value.workerId : undefined;
|
|
80
|
+
const leadId = typeof value.lead_id === "string" ? value.lead_id : typeof value.leadId === "string" ? value.leadId : undefined;
|
|
81
|
+
const expectedOutcome = typeof value.expected_outcome === "string" ? value.expected_outcome : typeof value.expectedOutcome === "string" ? value.expectedOutcome : undefined;
|
|
82
|
+
const requiredTools = isStringArray(value.required_tools) ? value.required_tools : isStringArray(value.requiredTools) ? value.requiredTools : undefined;
|
|
83
|
+
const outputContract = typeof value.output_contract === "string" ? value.output_contract : typeof value.outputContract === "string" ? value.outputContract : undefined;
|
|
84
|
+
const mustDo = isStringArray(value.must_do) ? value.must_do : isStringArray(value.mustDo) ? value.mustDo : undefined;
|
|
85
|
+
const mustNotDo = isStringArray(value.must_not_do) ? value.must_not_do : isStringArray(value.mustNotDo) ? value.mustNotDo : undefined;
|
|
86
|
+
const allowedPaths = isStringArray(value.allowed_paths) ? value.allowed_paths : isStringArray(value.allowedPaths) ? value.allowedPaths : undefined;
|
|
87
|
+
const forbiddenPaths = isStringArray(value.forbidden_paths) ? value.forbidden_paths : isStringArray(value.forbiddenPaths) ? value.forbiddenPaths : undefined;
|
|
88
|
+
const modelClass = typeof value.model_class === "string" ? value.model_class : typeof value.modelClass === "string" ? value.modelClass : undefined;
|
|
89
|
+
|
|
90
|
+
if (!workerId) errors.push(`worker_contracts[${index}].worker_id is required`);
|
|
91
|
+
if (leadId !== undefined && leadId.length === 0) errors.push(`worker_contracts[${index}].lead_id must not be empty`);
|
|
92
|
+
if (typeof value.agent !== "string" || value.agent.length === 0) errors.push(`worker_contracts[${index}].agent is required`);
|
|
93
|
+
if (typeof value.task !== "string" || value.task.length === 0) errors.push(`worker_contracts[${index}].task is required`);
|
|
94
|
+
if (!expectedOutcome) errors.push(`worker_contracts[${index}].expected_outcome is required`);
|
|
95
|
+
if (!requiredTools) errors.push(`worker_contracts[${index}].required_tools must be a string array`);
|
|
96
|
+
if (!outputContract) errors.push(`worker_contracts[${index}].output_contract is required`);
|
|
97
|
+
if (!mustDo) errors.push(`worker_contracts[${index}].must_do must be a string array`);
|
|
98
|
+
if (!mustNotDo) errors.push(`worker_contracts[${index}].must_not_do must be a string array`);
|
|
99
|
+
if (typeof value.context !== "string" || value.context.length === 0) errors.push(`worker_contracts[${index}].context is required`);
|
|
100
|
+
if (errors.length > 0) return { errors };
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
contract: {
|
|
104
|
+
worker_id: workerId!,
|
|
105
|
+
lead_id: leadId,
|
|
106
|
+
agent: value.agent as string,
|
|
107
|
+
task: value.task as string,
|
|
108
|
+
expected_outcome: expectedOutcome!,
|
|
109
|
+
required_tools: requiredTools!,
|
|
110
|
+
output_contract: outputContract!,
|
|
111
|
+
must_do: mustDo!,
|
|
112
|
+
must_not_do: mustNotDo!,
|
|
113
|
+
context: value.context as string,
|
|
114
|
+
allowed_paths: allowedPaths,
|
|
115
|
+
forbidden_paths: forbiddenPaths,
|
|
116
|
+
model_class: modelClass,
|
|
117
|
+
},
|
|
118
|
+
errors: [],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function extractLeadPlanWorkerContracts(output: string): LeadPlanWorkerContractExtraction {
|
|
123
|
+
const candidates = jsonCandidates(output);
|
|
124
|
+
for (const candidate of candidates) {
|
|
125
|
+
const root = contractsRoot(candidate);
|
|
126
|
+
if (!root) continue;
|
|
127
|
+
const contracts: LeadPlanWorkerContract[] = [];
|
|
128
|
+
const errors: string[] = [];
|
|
129
|
+
root.forEach((item, index) => {
|
|
130
|
+
const normalized = normalizeContract(item, index);
|
|
131
|
+
if (normalized.contract) contracts.push(normalized.contract);
|
|
132
|
+
errors.push(...normalized.errors);
|
|
133
|
+
});
|
|
134
|
+
return { schema: "zob.lead-plan-worker-contract-extraction.v1", contracts, errors };
|
|
135
|
+
}
|
|
136
|
+
return { schema: "zob.lead-plan-worker-contract-extraction.v1", contracts: [], errors: ["No parseable worker_contracts JSON found in lead-plan output"] };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function redactLeadPlanWorkerContractsForPersistence(contracts: LeadPlanWorkerContract[]): Array<Record<string, unknown>> {
|
|
140
|
+
return contracts.map((contract) => ({
|
|
141
|
+
worker_id: contract.worker_id,
|
|
142
|
+
lead_id: contract.lead_id,
|
|
143
|
+
agent: contract.agent,
|
|
144
|
+
taskHash: sha256(contract.task),
|
|
145
|
+
expected_outcomeHash: sha256(contract.expected_outcome),
|
|
146
|
+
required_tools: contract.required_tools,
|
|
147
|
+
output_contract: contract.output_contract,
|
|
148
|
+
must_doHashes: contract.must_do.map((item) => sha256(item)),
|
|
149
|
+
must_not_doHashes: contract.must_not_do.map((item) => sha256(item)),
|
|
150
|
+
contextHash: sha256(contract.context),
|
|
151
|
+
allowed_paths: contract.allowed_paths,
|
|
152
|
+
forbidden_paths: contract.forbidden_paths,
|
|
153
|
+
model_class: contract.model_class,
|
|
154
|
+
bodyStored: false,
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function validateLeadPlanWorkerContracts(repoRoot: string, contracts: LeadPlanWorkerContract[], options: LeadPlanWorkerContractValidationOptions = {}): string[] {
|
|
159
|
+
const errors: string[] = [];
|
|
160
|
+
const agents = new Map(loadProjectAgents(repoRoot).map((agent) => [agent.name.toLowerCase(), agent]));
|
|
161
|
+
const allowedWorkers = options.allowedWorkerIds ? new Set(options.allowedWorkerIds) : undefined;
|
|
162
|
+
const allowedTools = options.allowedTools ? new Set(options.allowedTools) : undefined;
|
|
163
|
+
|
|
164
|
+
contracts.forEach((contract, index) => {
|
|
165
|
+
const label = `worker_contracts[${index}] '${contract.worker_id}'`;
|
|
166
|
+
if (options.leadId && contract.lead_id && contract.lead_id !== options.leadId) errors.push(`${label}: lead_id must match '${options.leadId}'`);
|
|
167
|
+
if (allowedWorkers && !allowedWorkers.has(contract.worker_id)) errors.push(`${label}: worker_id is not delegated by this lead`);
|
|
168
|
+
|
|
169
|
+
const agent = agents.get(contract.agent.toLowerCase());
|
|
170
|
+
if (!agent) {
|
|
171
|
+
errors.push(`${label}: unknown agent '${contract.agent}'`);
|
|
172
|
+
} else {
|
|
173
|
+
errors.push(...validateToolList(agent, contract.required_tools).map((error) => `${label}: ${error}`));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (allowedTools) {
|
|
177
|
+
const blockedTools = contract.required_tools.filter((tool) => !allowedTools.has(tool));
|
|
178
|
+
if (blockedTools.length > 0) errors.push(`${label}: tools not allowed by execution boundary: ${blockedTools.join(", ")}`);
|
|
179
|
+
}
|
|
180
|
+
if (options.supervisedReadonly) {
|
|
181
|
+
const writeLike = contract.required_tools.filter((tool) => ["bash", "edit", "write", "delegate_agent", "delegate_task", "orchestrate_run", "factory_run"].includes(tool));
|
|
182
|
+
if (writeLike.length > 0) errors.push(`${label}: supervised_readonly worker contracts must remain read-only: ${writeLike.join(", ")}`);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
errors.push(...validateOutputContractId(contract.output_contract).map((error) => `${label}: ${error}`));
|
|
186
|
+
errors.push(...validateDelegateTaskWriteScope(contract.required_tools, contract.allowed_paths).map((error) => `${label}: ${error}`));
|
|
187
|
+
errors.push(...validateAllowedPathPolicy(contract.allowed_paths, `${label} allowed_paths`, repoRoot));
|
|
188
|
+
errors.push(...validateForbiddenPathPolicy(contract.forbidden_paths, `${label} forbidden_paths`, repoRoot));
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
return errors;
|
|
192
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { SUPERVISED_READONLY_CHILD_TOOLS, SUPERVISED_SMOKE_CHILD_TOOLS } from "../constants.js";
|
|
2
|
+
import type { OrchestrateExecutionMode, OrchestrateRunInput, TeamDefinition } from "../types.js";
|
|
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";
|
|
7
|
+
|
|
8
|
+
function renderOrchestrationTemplate(template: string, values: Record<string, string>): string {
|
|
9
|
+
return template.replace(/\{([a-zA-Z0-9_.-]+)\}/g, (match, key: string) => values[key] ?? match);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const RAW_PERSISTENCE_KEYS = new Set(["goal", "originalUserAsk", "original_user_ask", "task", "expected_outcome", "context", "taskTemplate", "prompt", "output", "body", "content", "diff", "patch"]);
|
|
13
|
+
const RAW_PERSISTENCE_ARRAY_KEYS = new Set(["must_do", "must_not_do"]);
|
|
14
|
+
|
|
15
|
+
function redactRawPersistenceFields(value: unknown): unknown {
|
|
16
|
+
if (Array.isArray(value)) return value.map(redactRawPersistenceFields);
|
|
17
|
+
if (!isRecord(value)) return value;
|
|
18
|
+
const redacted: Record<string, unknown> = {};
|
|
19
|
+
for (const [key, child] of Object.entries(value)) {
|
|
20
|
+
if (RAW_PERSISTENCE_KEYS.has(key)) {
|
|
21
|
+
if (typeof child === "string") redacted[`${key}Hash`] = sha256(child);
|
|
22
|
+
else if (child !== undefined && child !== null) redacted[`${key}Hash`] = sha256(JSON.stringify(child));
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (RAW_PERSISTENCE_ARRAY_KEYS.has(key) && Array.isArray(child)) {
|
|
26
|
+
redacted[`${key}Hashes`] = child.map((item) => sha256(typeof item === "string" ? item : JSON.stringify(item)));
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
redacted[key] = redactRawPersistenceFields(child);
|
|
30
|
+
}
|
|
31
|
+
return redacted;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function redactBodyLikeFieldsForPersistence(value: Record<string, unknown>): Record<string, unknown> {
|
|
35
|
+
const redacted = redactRawPersistenceFields(value);
|
|
36
|
+
return isRecord(redacted) ? { ...redacted, redactedForPersistence: true, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false } : { redactedForPersistence: true, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function redactOrchestrationPlanForPersistence(plan: Record<string, unknown>): Record<string, unknown> {
|
|
40
|
+
const tasks = Array.isArray(plan.tasks) ? plan.tasks.map((task) => {
|
|
41
|
+
if (!isRecord(task)) return task;
|
|
42
|
+
const redacted: Record<string, unknown> = { ...task };
|
|
43
|
+
for (const field of ["task", "expected_outcome", "context"] as const) {
|
|
44
|
+
const value = redacted[field];
|
|
45
|
+
if (typeof value === "string") redacted[`${field}Hash`] = sha256(value);
|
|
46
|
+
delete redacted[field];
|
|
47
|
+
}
|
|
48
|
+
for (const field of ["must_do", "must_not_do"] as const) {
|
|
49
|
+
const value = redacted[field];
|
|
50
|
+
if (Array.isArray(value)) redacted[`${field}Hashes`] = value.filter((item): item is string => typeof item === "string").map((item) => sha256(item));
|
|
51
|
+
delete redacted[field];
|
|
52
|
+
}
|
|
53
|
+
return redacted;
|
|
54
|
+
}) : plan.tasks;
|
|
55
|
+
return redactBodyLikeFieldsForPersistence({ ...plan, tasks });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function buildOrchestrationPlan(
|
|
59
|
+
definition: TeamDefinition,
|
|
60
|
+
input: OrchestrateRunInput,
|
|
61
|
+
run: { runId: string; runDir: string; execution: OrchestrateExecutionMode },
|
|
62
|
+
): Record<string, unknown> {
|
|
63
|
+
const workerLimit = input.max_workers ?? definition.workers.length;
|
|
64
|
+
const selectedWorkers = definition.workers.slice(0, workerLimit);
|
|
65
|
+
const selectedWorkerIds = new Set(selectedWorkers.map((worker) => worker.id));
|
|
66
|
+
const tasks: Array<Record<string, unknown>> = [];
|
|
67
|
+
const goal = input.goal.trim();
|
|
68
|
+
const originalUserAsk = input.original_user_ask ?? goal;
|
|
69
|
+
const adaptiveDelegation = normalizeAdaptiveDelegationPolicy(input.adaptive_delegation);
|
|
70
|
+
|
|
71
|
+
for (const lead of definition.leads) {
|
|
72
|
+
const leadWorkerIds = (lead.workerIds ?? selectedWorkers.filter((worker) => worker.leadId === lead.id).map((worker) => worker.id)).filter((workerId) => selectedWorkerIds.has(workerId));
|
|
73
|
+
tasks.push({
|
|
74
|
+
id: `${safeFileStem(lead.id)}-lead-plan`,
|
|
75
|
+
type: "lead_plan",
|
|
76
|
+
goalId: input.goal_id,
|
|
77
|
+
todoId: input.todo_id,
|
|
78
|
+
todoRef: input.todo_id ? { rootTodoId: input.todo_id, attachmentKind: "lead_plan" } : undefined,
|
|
79
|
+
role: "lead",
|
|
80
|
+
leadId: lead.id,
|
|
81
|
+
agent: lead.agent,
|
|
82
|
+
parent: definition.orchestrator.id,
|
|
83
|
+
task: `Plan lead lane '${lead.id}' for goal: ${goal}. Propose worker task contracts for: ${leadWorkerIds.join(", ") || "no selected workers"}. Do not execute workers. Return machine-readable worker contracts inside <worker_contracts>{\"worker_contracts\":[...]}</worker_contracts>. Each contract object must include worker_id, lead_id, agent, task, expected_outcome, required_tools, output_contract, must_do, must_not_do, context, and optional allowed_paths, forbidden_paths, model_class. allowed_paths must be repo-relative only; do not include absolute paths, home paths, or '~' paths. forbidden_paths are deny-only patterns and may be repo-local, absolute, or home-relative; broad roots are rejected. The final lead-plan response must include literal fields: lead_id, phase, worker_contracts, required_tools, allowed_paths, forbidden_paths, output_contract, model_class, evidence_needed, no_ship_criteria, evidence, risks/blockers, compliance.`,
|
|
84
|
+
expected_outcome: `Lead '${lead.id}' produces scoped worker contracts and risk notes in extractable lead-plan.v1 format`,
|
|
85
|
+
required_tools: lead.requiredTools,
|
|
86
|
+
must_do: ["Stay in planning mode", "Return worker task contracts only", "Return worker_contracts as parseable JSON inside <worker_contracts> tags", "Use only repo-relative allowed_paths; forbidden_paths are deny-only patterns and may be repo-local, absolute, or home-relative", "Include literal evidence_needed and no_ship_criteria fields", "Cite required evidence and gaps", "Respect parent orchestrator preflight"],
|
|
87
|
+
must_not_do: ["Do not execute worker tasks", "No edits", "No secrets", "No destructive commands", "No worker-spawns-worker"],
|
|
88
|
+
context: `Orchestration run ${run.runId}; team ${definition.name}; original ask: ${originalUserAsk}`,
|
|
89
|
+
output_contract: lead.outputContract,
|
|
90
|
+
run_in_background: false,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
for (const worker of selectedWorkers) {
|
|
95
|
+
const values = {
|
|
96
|
+
"goal": goal,
|
|
97
|
+
"original_user_ask": originalUserAsk,
|
|
98
|
+
"run.id": run.runId,
|
|
99
|
+
"run.dir": run.runDir,
|
|
100
|
+
"team.name": definition.name,
|
|
101
|
+
"worker.id": worker.id,
|
|
102
|
+
"lead.id": worker.leadId,
|
|
103
|
+
};
|
|
104
|
+
tasks.push({
|
|
105
|
+
id: `${safeFileStem(worker.leadId)}-${safeFileStem(worker.id)}-worker-contract`,
|
|
106
|
+
type: "worker_contract",
|
|
107
|
+
goalId: input.goal_id,
|
|
108
|
+
todoId: input.todo_id,
|
|
109
|
+
todoRef: input.todo_id ? { rootTodoId: input.todo_id, attachmentKind: "worker_contract", proposedBy: worker.leadId } : undefined,
|
|
110
|
+
role: "worker",
|
|
111
|
+
leadId: worker.leadId,
|
|
112
|
+
workerId: worker.id,
|
|
113
|
+
agent: worker.agent,
|
|
114
|
+
parent: definition.orchestrator.id,
|
|
115
|
+
proposedBy: worker.leadId,
|
|
116
|
+
task: renderOrchestrationTemplate(worker.taskTemplate ?? `Execute the bounded worker slice for {goal}. Return evidence, blockers, and next steps.`, values),
|
|
117
|
+
expected_outcome: `Worker '${worker.id}' returns its contract-compliant deliverable`,
|
|
118
|
+
required_tools: worker.requiredTools,
|
|
119
|
+
must_do: ["Use the assigned output contract", "Cite evidence", "Report blockers", "Return deliverable_delivered: yes/no"],
|
|
120
|
+
must_not_do: ["No secrets", "No destructive commands", "No commits", "No worker-spawns-worker"],
|
|
121
|
+
context: `Orchestration run ${run.runId}; team ${definition.name}; lead ${worker.leadId}; worker ${worker.id}; original ask: ${originalUserAsk}`,
|
|
122
|
+
output_contract: worker.outputContract,
|
|
123
|
+
run_in_background: false,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
schema: "zob.orchestration-plan.v1",
|
|
129
|
+
team: definition.name,
|
|
130
|
+
runId: run.runId,
|
|
131
|
+
runDir: run.runDir,
|
|
132
|
+
execution: run.execution,
|
|
133
|
+
goal,
|
|
134
|
+
originalUserAsk,
|
|
135
|
+
goalId: input.goal_id,
|
|
136
|
+
rootTodoId: input.todo_id,
|
|
137
|
+
todoGraphBinding: input.todo_id ? { goalId: input.goal_id, rootTodoId: input.todo_id, attachmentPolicy: "messages_delegations_blockers_claims_evidence_attach_to_todo" } : undefined,
|
|
138
|
+
topology: {
|
|
139
|
+
orchestrator: definition.orchestrator,
|
|
140
|
+
leads: definition.leads.map((lead) => ({ ...lead, workerIds: (lead.workerIds ?? selectedWorkers.filter((worker) => worker.leadId === lead.id).map((worker) => worker.id)).filter((workerId) => selectedWorkerIds.has(workerId)) })),
|
|
141
|
+
workers: selectedWorkers,
|
|
142
|
+
},
|
|
143
|
+
invariants: {
|
|
144
|
+
parentPreflightRequired: true,
|
|
145
|
+
parentDispatchOnly: true,
|
|
146
|
+
workerSpawnsWorker: false,
|
|
147
|
+
freeFormPeerChat: false,
|
|
148
|
+
networkedComs: false,
|
|
149
|
+
noExecutionInPlanOnly: true,
|
|
150
|
+
supervisedSmokeReadOnly: run.execution === "supervised_smoke" ? true : undefined,
|
|
151
|
+
supervisedSmokeAllowedTools: run.execution === "supervised_smoke" ? [...SUPERVISED_SMOKE_CHILD_TOOLS] : undefined,
|
|
152
|
+
supervisedReadonly: run.execution === "supervised_readonly" ? true : undefined,
|
|
153
|
+
supervisedReadonlyAllowedTools: run.execution === "supervised_readonly" ? [...SUPERVISED_READONLY_CHILD_TOOLS] : undefined,
|
|
154
|
+
supervisedReadonlyDispatcherBoundary: run.execution === "supervised_readonly" ? true : undefined,
|
|
155
|
+
liveChildExecution: false,
|
|
156
|
+
adaptiveDelegationDefaultOff: adaptiveDelegation.enabled === false,
|
|
157
|
+
adaptiveDelegationParentOwned: adaptiveDelegation.enabled ? adaptiveDelegation.parentOwnedDispatch === true : undefined,
|
|
158
|
+
adaptiveDelegationChildDirectDispatch: adaptiveDelegation.enabled ? adaptiveDelegation.childDirectDispatch : undefined,
|
|
159
|
+
adaptiveDelegationConfiguredMaxDepth: adaptiveDelegation.enabled ? adaptiveDelegation.configuredMaxDepth : undefined,
|
|
160
|
+
adaptiveDelegationRuntimeMaxDepth: adaptiveDelegation.enabled ? adaptiveDelegation.runtimeMaxDepth : undefined,
|
|
161
|
+
adaptiveDelegationDispatch: adaptiveDelegation.enabled ? adaptiveDelegation.dispatch : undefined,
|
|
162
|
+
},
|
|
163
|
+
...(adaptiveDelegation.enabled ? { adaptiveDelegation } : {}),
|
|
164
|
+
tasks,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export { buildOrchestrationPlan, redactOrchestrationPlanForPersistence };
|