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,393 @@
|
|
|
1
|
+
import type { InteractiveAutonomyMode, InteractiveLaunchAuthorization, MissionReadinessReport } from "./interactive-autonomy.js";
|
|
2
|
+
import type { RuntimeGoal, RuntimeGoalStatus } from "./goal-runtime.js";
|
|
3
|
+
import type { GoalTodoNode, GoalTodoState, GoalTodoStatus } from "./goal-todos.js";
|
|
4
|
+
|
|
5
|
+
export const DAEMON_RUNTIME_STATUSES = [
|
|
6
|
+
"off",
|
|
7
|
+
"no_goal",
|
|
8
|
+
"no_launch_authorization",
|
|
9
|
+
"needs_user",
|
|
10
|
+
"claim_returned",
|
|
11
|
+
"needs_oracle",
|
|
12
|
+
"actionable_todo",
|
|
13
|
+
"idle",
|
|
14
|
+
"blocked",
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
export type DaemonRuntimeStatus = typeof DAEMON_RUNTIME_STATUSES[number];
|
|
18
|
+
export type DaemonRuntimeActionKind = "none" | "wait" | "request_user" | "request_oracle" | "review_claim" | "continue_todo" | "report_blocked";
|
|
19
|
+
export type DaemonLoopStatus = "stopped" | "running";
|
|
20
|
+
|
|
21
|
+
export interface DaemonLoopSnapshot {
|
|
22
|
+
schema: "zob.daemon-loop-snapshot.v1";
|
|
23
|
+
status: DaemonLoopStatus;
|
|
24
|
+
tickCount: number;
|
|
25
|
+
maxTicks?: number;
|
|
26
|
+
startedAt?: string;
|
|
27
|
+
stoppedAt?: string;
|
|
28
|
+
lastTickAt?: string;
|
|
29
|
+
blocker?: string;
|
|
30
|
+
supervised: true;
|
|
31
|
+
bounded: true;
|
|
32
|
+
sessionLocal: true;
|
|
33
|
+
autoStartDaemon: false;
|
|
34
|
+
continuousLoop: false;
|
|
35
|
+
cronEnabled: false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface DaemonRuntimePolicy {
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
planOnly: true;
|
|
41
|
+
scopedToActiveGoal: true;
|
|
42
|
+
requireLaunchAuthorization: boolean;
|
|
43
|
+
autoStartAllowed: false;
|
|
44
|
+
continuousLoopAllowed: false;
|
|
45
|
+
cronAllowed: false;
|
|
46
|
+
childDispatchAllowed: false;
|
|
47
|
+
queueClaimsAllowed: false;
|
|
48
|
+
todoMutationAllowed: false;
|
|
49
|
+
productionApplyAllowed: false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface DaemonRuntimeAutonomySnapshot {
|
|
53
|
+
mode?: InteractiveAutonomyMode;
|
|
54
|
+
enabled?: boolean;
|
|
55
|
+
lastReadiness?: MissionReadinessReport;
|
|
56
|
+
lastLaunchAuthorization?: InteractiveLaunchAuthorization;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface DaemonRuntimeStateInput {
|
|
60
|
+
policy?: Partial<DaemonRuntimePolicy>;
|
|
61
|
+
runtimeGoal?: RuntimeGoal;
|
|
62
|
+
goalTodos?: GoalTodoState;
|
|
63
|
+
autonomy?: DaemonRuntimeAutonomySnapshot;
|
|
64
|
+
loop?: DaemonLoopSnapshot;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface DaemonRuntimeTodoRef {
|
|
68
|
+
id: string;
|
|
69
|
+
goalId: string;
|
|
70
|
+
path: string;
|
|
71
|
+
status: GoalTodoStatus;
|
|
72
|
+
owner: GoalTodoNode["owner"];
|
|
73
|
+
required: boolean;
|
|
74
|
+
priority: GoalTodoNode["priority"];
|
|
75
|
+
evidenceRefCount: number;
|
|
76
|
+
validationCommandCount: number;
|
|
77
|
+
hasClaim: boolean;
|
|
78
|
+
hasValidation: boolean;
|
|
79
|
+
reviewNoShip: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface DaemonRuntimeTodoCounts {
|
|
83
|
+
total: number;
|
|
84
|
+
open: number;
|
|
85
|
+
requiredOpen: number;
|
|
86
|
+
needsUser: number;
|
|
87
|
+
claimReturned: number;
|
|
88
|
+
needsOracle: number;
|
|
89
|
+
actionable: number;
|
|
90
|
+
blocked: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface DaemonRuntimeState {
|
|
94
|
+
schema: "zob.daemon-runtime-state.v1";
|
|
95
|
+
status: DaemonRuntimeStatus;
|
|
96
|
+
reasonCodes: string[];
|
|
97
|
+
policy: DaemonRuntimePolicy;
|
|
98
|
+
loop?: DaemonLoopSnapshot;
|
|
99
|
+
goal?: {
|
|
100
|
+
goalId: string;
|
|
101
|
+
status: RuntimeGoalStatus;
|
|
102
|
+
oracleStatus: RuntimeGoal["oracle"]["status"];
|
|
103
|
+
oracleRequired: boolean;
|
|
104
|
+
oracleNoShip?: boolean;
|
|
105
|
+
loopEnabled: boolean;
|
|
106
|
+
turnsUsed: number;
|
|
107
|
+
maxTurns: number;
|
|
108
|
+
};
|
|
109
|
+
launchAuthorized: boolean;
|
|
110
|
+
selectedTodo?: DaemonRuntimeTodoRef;
|
|
111
|
+
todoCounts: DaemonRuntimeTodoCounts;
|
|
112
|
+
planOnly: true;
|
|
113
|
+
bodyStored: false;
|
|
114
|
+
promptBodiesStored: false;
|
|
115
|
+
outputBodiesStored: false;
|
|
116
|
+
autoStartDaemon: false;
|
|
117
|
+
continuousLoop: false;
|
|
118
|
+
cronEnabled: false;
|
|
119
|
+
childDispatchAllowed: false;
|
|
120
|
+
queueClaimed: false;
|
|
121
|
+
todoMutated: false;
|
|
122
|
+
productionApplyAllowed: false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface DaemonStopCondition {
|
|
126
|
+
schema: "zob.daemon-stop-condition.v1";
|
|
127
|
+
stop: boolean;
|
|
128
|
+
status: DaemonRuntimeStatus;
|
|
129
|
+
reasonCodes: string[];
|
|
130
|
+
planOnly: true;
|
|
131
|
+
bodyStored: false;
|
|
132
|
+
promptBodiesStored: false;
|
|
133
|
+
outputBodiesStored: false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface DaemonTickPlan {
|
|
137
|
+
schema: "zob.daemon-tick-plan.v1";
|
|
138
|
+
status: DaemonRuntimeStatus;
|
|
139
|
+
action: DaemonRuntimeActionKind;
|
|
140
|
+
reasonCodes: string[];
|
|
141
|
+
goalId?: string;
|
|
142
|
+
todo?: DaemonRuntimeTodoRef;
|
|
143
|
+
stop: DaemonStopCondition;
|
|
144
|
+
planOnly: true;
|
|
145
|
+
bodyStored: false;
|
|
146
|
+
promptBodiesStored: false;
|
|
147
|
+
outputBodiesStored: false;
|
|
148
|
+
writesPlanned: false;
|
|
149
|
+
todoMutationPlanned: false;
|
|
150
|
+
queueClaimPlanned: false;
|
|
151
|
+
childDispatchPlanned: false;
|
|
152
|
+
autoStartDaemon: false;
|
|
153
|
+
continuousLoop: false;
|
|
154
|
+
cronEnabled: false;
|
|
155
|
+
productionApplyAllowed: false;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const OPEN_TODO_STATUSES = new Set<GoalTodoStatus>(["planned", "ready", "in_progress", "delegated", "claim_returned", "needs_review", "needs_oracle", "needs_user", "blocked"]);
|
|
159
|
+
const ACTIONABLE_TODO_STATUSES = new Set<GoalTodoStatus>(["planned", "ready", "in_progress", "needs_review"]);
|
|
160
|
+
|
|
161
|
+
export const DEFAULT_DAEMON_RUNTIME_POLICY: DaemonRuntimePolicy = {
|
|
162
|
+
enabled: true,
|
|
163
|
+
planOnly: true,
|
|
164
|
+
scopedToActiveGoal: true,
|
|
165
|
+
requireLaunchAuthorization: true,
|
|
166
|
+
autoStartAllowed: false,
|
|
167
|
+
continuousLoopAllowed: false,
|
|
168
|
+
cronAllowed: false,
|
|
169
|
+
childDispatchAllowed: false,
|
|
170
|
+
queueClaimsAllowed: false,
|
|
171
|
+
todoMutationAllowed: false,
|
|
172
|
+
productionApplyAllowed: false,
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
function normalizePolicy(input: Partial<DaemonRuntimePolicy> | undefined): DaemonRuntimePolicy {
|
|
176
|
+
return {
|
|
177
|
+
...DEFAULT_DAEMON_RUNTIME_POLICY,
|
|
178
|
+
...input,
|
|
179
|
+
planOnly: true,
|
|
180
|
+
scopedToActiveGoal: true,
|
|
181
|
+
autoStartAllowed: false,
|
|
182
|
+
continuousLoopAllowed: false,
|
|
183
|
+
cronAllowed: false,
|
|
184
|
+
childDispatchAllowed: false,
|
|
185
|
+
queueClaimsAllowed: false,
|
|
186
|
+
todoMutationAllowed: false,
|
|
187
|
+
productionApplyAllowed: false,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function todoSort(left: GoalTodoNode, right: GoalTodoNode): number {
|
|
192
|
+
const priorityRank: Record<GoalTodoNode["priority"], number> = { critical: 0, high: 1, normal: 2, low: 3 };
|
|
193
|
+
return priorityRank[left.priority] - priorityRank[right.priority]
|
|
194
|
+
|| left.path.localeCompare(right.path, undefined, { numeric: true })
|
|
195
|
+
|| left.createdAt - right.createdAt
|
|
196
|
+
|| left.id.localeCompare(right.id);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function todosForGoal(goalTodos: GoalTodoState | undefined, goalId: string): GoalTodoNode[] {
|
|
200
|
+
return (goalTodos?.nodes ?? []).filter((node) => node.goalId === goalId).sort(todoSort);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function isOpenTodo(node: GoalTodoNode): boolean {
|
|
204
|
+
return OPEN_TODO_STATUSES.has(node.status);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function isActionableTodo(node: GoalTodoNode): boolean {
|
|
208
|
+
return ACTIONABLE_TODO_STATUSES.has(node.status) && node.owner !== "user" && node.owner !== "oracle";
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function todoRef(node: GoalTodoNode): DaemonRuntimeTodoRef {
|
|
212
|
+
return {
|
|
213
|
+
id: node.id,
|
|
214
|
+
goalId: node.goalId,
|
|
215
|
+
path: node.path,
|
|
216
|
+
status: node.status,
|
|
217
|
+
owner: node.owner,
|
|
218
|
+
required: node.required,
|
|
219
|
+
priority: node.priority,
|
|
220
|
+
evidenceRefCount: node.evidenceRefs.length,
|
|
221
|
+
validationCommandCount: node.validationCommands.length,
|
|
222
|
+
hasClaim: Boolean(node.claim),
|
|
223
|
+
hasValidation: Boolean(node.validation),
|
|
224
|
+
reviewNoShip: node.reviewNoShip === true,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function countTodos(nodes: GoalTodoNode[]): DaemonRuntimeTodoCounts {
|
|
229
|
+
const open = nodes.filter(isOpenTodo);
|
|
230
|
+
return {
|
|
231
|
+
total: nodes.length,
|
|
232
|
+
open: open.length,
|
|
233
|
+
requiredOpen: open.filter((node) => node.required !== false).length,
|
|
234
|
+
needsUser: open.filter((node) => node.status === "needs_user" || node.owner === "user").length,
|
|
235
|
+
claimReturned: open.filter((node) => node.status === "claim_returned").length,
|
|
236
|
+
needsOracle: open.filter((node) => node.status === "needs_oracle" || node.owner === "oracle").length,
|
|
237
|
+
actionable: open.filter(isActionableTodo).length,
|
|
238
|
+
blocked: open.filter((node) => node.status === "blocked").length,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function launchAuthorized(input: DaemonRuntimeStateInput, policy: DaemonRuntimePolicy, goal: RuntimeGoal | undefined): boolean {
|
|
243
|
+
if (!policy.requireLaunchAuthorization) return true;
|
|
244
|
+
if (!goal) return false;
|
|
245
|
+
const authorization = input.autonomy?.lastLaunchAuthorization;
|
|
246
|
+
return Boolean(
|
|
247
|
+
input.autonomy?.enabled !== false
|
|
248
|
+
&& input.autonomy?.mode !== "off"
|
|
249
|
+
&& authorization
|
|
250
|
+
&& authorization.launchAuthorizesInScopeActions === true
|
|
251
|
+
&& authorization.applyPolicy.productionApplyAllowed === false
|
|
252
|
+
&& authorization.globalProductionClaimAllowed === false,
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function selectNextActionableTodo(goalTodos: GoalTodoState | undefined, goalId: string | undefined): GoalTodoNode | undefined {
|
|
257
|
+
if (!goalId) return undefined;
|
|
258
|
+
const nodes = todosForGoal(goalTodos, goalId).filter(isOpenTodo);
|
|
259
|
+
return nodes.find((node) => node.status === "claim_returned")
|
|
260
|
+
?? nodes.find((node) => node.status === "needs_oracle" || node.owner === "oracle")
|
|
261
|
+
?? nodes.find((node) => node.status === "needs_user" || node.owner === "user")
|
|
262
|
+
?? nodes.find(isActionableTodo)
|
|
263
|
+
?? nodes.find((node) => node.status === "blocked");
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function buildDaemonRuntimeState(input: DaemonRuntimeStateInput = {}): DaemonRuntimeState {
|
|
267
|
+
const policy = normalizePolicy(input.policy);
|
|
268
|
+
const goal = input.runtimeGoal;
|
|
269
|
+
const nodes = goal ? todosForGoal(input.goalTodos, goal.goalId) : [];
|
|
270
|
+
const todoCounts = countTodos(nodes);
|
|
271
|
+
const selectedTodo = selectNextActionableTodo(input.goalTodos, goal?.goalId);
|
|
272
|
+
const authorized = launchAuthorized(input, policy, goal);
|
|
273
|
+
const reasonCodes: string[] = [];
|
|
274
|
+
let status: DaemonRuntimeStatus;
|
|
275
|
+
|
|
276
|
+
if (!policy.enabled) {
|
|
277
|
+
status = "off";
|
|
278
|
+
reasonCodes.push("daemon_policy_disabled");
|
|
279
|
+
} else if (!goal) {
|
|
280
|
+
status = "no_goal";
|
|
281
|
+
reasonCodes.push("runtime_goal_missing");
|
|
282
|
+
} else if (goal.status === "blocked" || goal.status === "budget_limited" || goal.status === "oracle_failed") {
|
|
283
|
+
status = "blocked";
|
|
284
|
+
reasonCodes.push(`runtime_goal_${goal.status}`);
|
|
285
|
+
} else if (goal.status === "ready_for_oracle" || goal.oracle.status === "needed" || goal.oracle.noShip === true) {
|
|
286
|
+
status = "needs_oracle";
|
|
287
|
+
reasonCodes.push("runtime_goal_needs_oracle");
|
|
288
|
+
} else if (!authorized) {
|
|
289
|
+
status = "no_launch_authorization";
|
|
290
|
+
reasonCodes.push("launch_authorization_missing");
|
|
291
|
+
} else if (todoCounts.needsUser > 0) {
|
|
292
|
+
status = "needs_user";
|
|
293
|
+
reasonCodes.push("todo_needs_user");
|
|
294
|
+
} else if (todoCounts.claimReturned > 0) {
|
|
295
|
+
status = "claim_returned";
|
|
296
|
+
reasonCodes.push("todo_claim_returned_parent_review_required");
|
|
297
|
+
} else if (todoCounts.needsOracle > 0) {
|
|
298
|
+
status = "needs_oracle";
|
|
299
|
+
reasonCodes.push("todo_needs_oracle");
|
|
300
|
+
} else if (selectedTodo && isActionableTodo(selectedTodo)) {
|
|
301
|
+
status = "actionable_todo";
|
|
302
|
+
reasonCodes.push("todo_actionable_plan_available");
|
|
303
|
+
} else if (todoCounts.open > 0 && todoCounts.open === todoCounts.blocked) {
|
|
304
|
+
status = "blocked";
|
|
305
|
+
reasonCodes.push("all_open_todos_blocked");
|
|
306
|
+
} else {
|
|
307
|
+
status = "idle";
|
|
308
|
+
reasonCodes.push(todoCounts.open === 0 ? "no_open_todos" : "no_actionable_todo");
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return {
|
|
312
|
+
schema: "zob.daemon-runtime-state.v1",
|
|
313
|
+
status,
|
|
314
|
+
reasonCodes,
|
|
315
|
+
policy,
|
|
316
|
+
loop: input.loop,
|
|
317
|
+
goal: goal
|
|
318
|
+
? {
|
|
319
|
+
goalId: goal.goalId,
|
|
320
|
+
status: goal.status,
|
|
321
|
+
oracleStatus: goal.oracle.status,
|
|
322
|
+
oracleRequired: goal.oracle.required,
|
|
323
|
+
oracleNoShip: goal.oracle.noShip,
|
|
324
|
+
loopEnabled: goal.loop.enabled,
|
|
325
|
+
turnsUsed: goal.usage.turnsUsed,
|
|
326
|
+
maxTurns: goal.loop.maxTurns,
|
|
327
|
+
}
|
|
328
|
+
: undefined,
|
|
329
|
+
launchAuthorized: authorized,
|
|
330
|
+
selectedTodo: selectedTodo ? todoRef(selectedTodo) : undefined,
|
|
331
|
+
todoCounts,
|
|
332
|
+
planOnly: true,
|
|
333
|
+
bodyStored: false,
|
|
334
|
+
promptBodiesStored: false,
|
|
335
|
+
outputBodiesStored: false,
|
|
336
|
+
autoStartDaemon: false,
|
|
337
|
+
continuousLoop: false,
|
|
338
|
+
cronEnabled: false,
|
|
339
|
+
childDispatchAllowed: false,
|
|
340
|
+
queueClaimed: false,
|
|
341
|
+
todoMutated: false,
|
|
342
|
+
productionApplyAllowed: false,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export function evaluateDaemonStopCondition(state: DaemonRuntimeState): DaemonStopCondition {
|
|
347
|
+
const stop = state.status !== "actionable_todo";
|
|
348
|
+
return {
|
|
349
|
+
schema: "zob.daemon-stop-condition.v1",
|
|
350
|
+
stop,
|
|
351
|
+
status: state.status,
|
|
352
|
+
reasonCodes: state.reasonCodes,
|
|
353
|
+
planOnly: true,
|
|
354
|
+
bodyStored: false,
|
|
355
|
+
promptBodiesStored: false,
|
|
356
|
+
outputBodiesStored: false,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function actionForStatus(status: DaemonRuntimeStatus): DaemonRuntimeActionKind {
|
|
361
|
+
if (status === "needs_user") return "request_user";
|
|
362
|
+
if (status === "needs_oracle") return "request_oracle";
|
|
363
|
+
if (status === "claim_returned") return "review_claim";
|
|
364
|
+
if (status === "actionable_todo") return "continue_todo";
|
|
365
|
+
if (status === "blocked") return "report_blocked";
|
|
366
|
+
if (status === "off" || status === "no_goal" || status === "no_launch_authorization" || status === "idle") return "wait";
|
|
367
|
+
return "none";
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export function buildDaemonTickPlan(input: DaemonRuntimeStateInput | DaemonRuntimeState = {}): DaemonTickPlan {
|
|
371
|
+
const state = "schema" in input && input.schema === "zob.daemon-runtime-state.v1" ? input : buildDaemonRuntimeState(input);
|
|
372
|
+
return {
|
|
373
|
+
schema: "zob.daemon-tick-plan.v1",
|
|
374
|
+
status: state.status,
|
|
375
|
+
action: actionForStatus(state.status),
|
|
376
|
+
reasonCodes: state.reasonCodes,
|
|
377
|
+
goalId: state.goal?.goalId,
|
|
378
|
+
todo: state.selectedTodo,
|
|
379
|
+
stop: evaluateDaemonStopCondition(state),
|
|
380
|
+
planOnly: true,
|
|
381
|
+
bodyStored: false,
|
|
382
|
+
promptBodiesStored: false,
|
|
383
|
+
outputBodiesStored: false,
|
|
384
|
+
writesPlanned: false,
|
|
385
|
+
todoMutationPlanned: false,
|
|
386
|
+
queueClaimPlanned: false,
|
|
387
|
+
childDispatchPlanned: false,
|
|
388
|
+
autoStartDaemon: false,
|
|
389
|
+
continuousLoop: false,
|
|
390
|
+
cronEnabled: false,
|
|
391
|
+
productionApplyAllowed: false,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Scope du dossier
|
|
2
|
+
|
|
3
|
+
- Validation factory, plan agentic, exécution factory et quarantine review/activate/verify.
|
|
4
|
+
- Ce dossier ne doit pas enregistrer de Pi tools directement; le runtime délègue ici.
|
|
5
|
+
|
|
6
|
+
# Invariants
|
|
7
|
+
|
|
8
|
+
- Préserver `SMOKE_PASSED.sentinel`, `PILOT_PASSED.sentinel`, `BATCH_PASSED.sentinel`, `DONE.sentinel`.
|
|
9
|
+
- `plan_only` ne crée pas de sentinels de complétion.
|
|
10
|
+
- Pilot exige une review oracle persistée et un manifest multi-item.
|
|
11
|
+
- Factory-forge quarantine ne s'auto-active jamais.
|
|
12
|
+
- Activation refuse overwrite et exige phrase exacte.
|
|
13
|
+
- Ne pas changer noms d'artefacts, statuts ou validations.
|
|
14
|
+
|
|
15
|
+
# Imports
|
|
16
|
+
|
|
17
|
+
- Peut importer utils/safety/output-contracts/telemetry/child-runner selon besoin.
|
|
18
|
+
- Interdit: importer depuis `index.ts`.
|
|
19
|
+
- Imports relatifs runtime avec suffixe `.js`.
|
|
20
|
+
|
|
21
|
+
# Validation locale
|
|
22
|
+
|
|
23
|
+
- `npm run check -- --pretty false`.
|
|
24
|
+
- `npm run smoke:harness` après toute tranche factory/quarantine.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { FactoryDefinition, FactoryInputManifest, FactoryManifestItem } from "../types.js";
|
|
2
|
+
|
|
3
|
+
function detectCanonicalPatterns(text: string): string[] {
|
|
4
|
+
const patterns = new Set<string>();
|
|
5
|
+
if (/TASK\s*:|EXPECTED\s+OUTCOME\s*:|MUST\s+NOT/i.test(text)) patterns.add("delegation.contract.structured");
|
|
6
|
+
if (/delegate_(agent|task)|sub-?agent|oracle|explore/i.test(text)) patterns.add("routing.subagent.specialized");
|
|
7
|
+
if (/PASS|FAIL|WARN|verdict/i.test(text)) patterns.add("verification.verdict_first");
|
|
8
|
+
if (/evidence|preuve|preuves|sentinel|DONE/i.test(text)) patterns.add("verification.evidence_required");
|
|
9
|
+
if (/factory_run|software factory|factory|manifest|checkpoint/i.test(text)) patterns.add("factory.workflow.manifest_checkpoint");
|
|
10
|
+
if (/damage-control|destructive|secret|zero-access|sandbox/i.test(text)) patterns.add("safety.damage_control");
|
|
11
|
+
if (/truncat|output cut|silent response/i.test(text)) patterns.add("failure.output.truncation");
|
|
12
|
+
if (/scope drift|multi-task|too broad/i.test(text)) patterns.add("failure.scope.drift");
|
|
13
|
+
return [...patterns].sort();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function renderFactoryTemplate(template: string, values: Record<string, string>): string {
|
|
17
|
+
return template.replace(/\{([a-zA-Z0-9_.-]+)\}/g, (match, key: string) => values[key] ?? match);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function buildFactoryAgenticPlan(
|
|
21
|
+
repoRoot: string,
|
|
22
|
+
definition: FactoryDefinition,
|
|
23
|
+
manifest: FactoryInputManifest,
|
|
24
|
+
selectedItems: FactoryManifestItem[],
|
|
25
|
+
run: { runId: string; runDir: string; mode: string; checkpointsDir: string; outputsDir: string },
|
|
26
|
+
): { factory: string; runId: string; mode: string; tasks: Array<Record<string, unknown>>; stageCount: number; itemCount: number } {
|
|
27
|
+
const tasks: Array<Record<string, unknown>> = [];
|
|
28
|
+
for (const stage of definition.stages ?? []) {
|
|
29
|
+
const stageItems = stage.type === "map" ? selectedItems : [undefined];
|
|
30
|
+
for (const item of stageItems) {
|
|
31
|
+
const values: Record<string, string> = {
|
|
32
|
+
"factory.name": definition.name,
|
|
33
|
+
"factory.version": definition.version,
|
|
34
|
+
"manifest.factory": manifest.factory,
|
|
35
|
+
"run.id": run.runId,
|
|
36
|
+
"run.dir": run.runDir,
|
|
37
|
+
"run.mode": run.mode,
|
|
38
|
+
"checkpoints.dir": run.checkpointsDir,
|
|
39
|
+
"outputs.dir": run.outputsDir,
|
|
40
|
+
"stage.name": stage.name,
|
|
41
|
+
"stage.type": stage.type,
|
|
42
|
+
"item.id": item?.id ?? "all-items",
|
|
43
|
+
"item.path": item?.path ?? "outputs/",
|
|
44
|
+
};
|
|
45
|
+
tasks.push({
|
|
46
|
+
stage: stage.name,
|
|
47
|
+
stageType: stage.type,
|
|
48
|
+
itemId: item?.id,
|
|
49
|
+
agent: stage.agent,
|
|
50
|
+
task: renderFactoryTemplate(stage.promptTemplate, values),
|
|
51
|
+
expected_outcome: stage.expectedOutcome ?? `Complete factory stage ${stage.name}`,
|
|
52
|
+
required_tools: stage.requiredTools,
|
|
53
|
+
must_do: stage.mustDo ?? ["Follow the factory output contract", "Cite evidence", "Respect sentinels and validation gates"],
|
|
54
|
+
must_not_do: stage.mustNotDo ?? ["No secrets", "No destructive commands", "No commits"],
|
|
55
|
+
context: renderFactoryTemplate(stage.context ?? `Factory {factory.name}, run {run.id}, stage {stage.name}, item {item.id}: {item.path}`, values),
|
|
56
|
+
output_contract: stage.outputContract,
|
|
57
|
+
run_in_background: false,
|
|
58
|
+
load_skills: [],
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return { factory: definition.name, runId: run.runId, mode: run.mode, tasks, stageCount: definition.stages?.length ?? 0, itemCount: selectedItems.length };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { detectCanonicalPatterns };
|