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,318 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { basename, join } from "node:path";
|
|
3
|
+
|
|
4
|
+
import { sha256 } from "./utils/hashing.js";
|
|
5
|
+
import { safeFileStem } from "./utils/paths.js";
|
|
6
|
+
import { isRecord } from "./utils/records.js";
|
|
7
|
+
import { readableZobResourcePaths } from "./utils/resources.js";
|
|
8
|
+
|
|
9
|
+
export type FactoryDemandSignal = "code_review" | "budget_preflight" | "roadmap_lots" | "opencode_patterns" | "project_dna" | "factory_forge";
|
|
10
|
+
export type FactorySelectionStatus = "existing_factory_selected" | "factory_forge_quarantine_recommended" | "no_factory_available";
|
|
11
|
+
|
|
12
|
+
export interface FactoryDemandInput {
|
|
13
|
+
id?: string;
|
|
14
|
+
refinedSpec?: string;
|
|
15
|
+
acceptanceCriteria?: string[];
|
|
16
|
+
expectedArtifacts?: string[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface FactorySelectorCandidateInput {
|
|
20
|
+
id?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
sourcePath?: string;
|
|
23
|
+
summary?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
manifests?: string[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface FactorySelectorDemandSummary {
|
|
30
|
+
demandId: string;
|
|
31
|
+
demandHash: string;
|
|
32
|
+
signals: FactoryDemandSignal[];
|
|
33
|
+
acceptanceCriteriaHashes: string[];
|
|
34
|
+
expectedArtifactHashes: string[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface FactorySelectorCandidateScore {
|
|
38
|
+
kind: "factory";
|
|
39
|
+
id: string;
|
|
40
|
+
sourcePath?: string;
|
|
41
|
+
score: number;
|
|
42
|
+
confidence: number;
|
|
43
|
+
reasonCodes: string[];
|
|
44
|
+
demandMatches: Array<{ demandId: string; signals: FactoryDemandSignal[]; score: number; reasonCodes: string[] }>;
|
|
45
|
+
manifestAvailability: { smoke: boolean; pilot: boolean; batch: boolean };
|
|
46
|
+
summaryHash?: string;
|
|
47
|
+
selected: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface FactorySelectorResult {
|
|
51
|
+
schema: "zob.factory-selector.v1" | "zob.autonomous-factory-selection-score.v1";
|
|
52
|
+
selectionStatus: FactorySelectionStatus;
|
|
53
|
+
selectedFactory?: string;
|
|
54
|
+
selectedScore: number;
|
|
55
|
+
confidence: number;
|
|
56
|
+
signals: FactoryDemandSignal[];
|
|
57
|
+
demands: FactorySelectorDemandSummary[];
|
|
58
|
+
deterministicScoring: true;
|
|
59
|
+
multiDemand: true;
|
|
60
|
+
candidates: FactorySelectorCandidateScore[];
|
|
61
|
+
factoryForge: {
|
|
62
|
+
available: boolean;
|
|
63
|
+
selected: boolean;
|
|
64
|
+
quarantineRequired: boolean;
|
|
65
|
+
noAutoActivation: true;
|
|
66
|
+
activationRequiresReview: true;
|
|
67
|
+
activationPerformed: false;
|
|
68
|
+
quarantineOnly: true;
|
|
69
|
+
};
|
|
70
|
+
noAutoActivation: true;
|
|
71
|
+
quarantineRequiredForNewFactory: boolean;
|
|
72
|
+
bodyStored: false;
|
|
73
|
+
promptBodiesStored: false;
|
|
74
|
+
outputBodiesStored: false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface FactorySelectorSmokeReport {
|
|
78
|
+
schema: "zob.factory-selector-smoke.v1";
|
|
79
|
+
status: "passed" | "failed";
|
|
80
|
+
result: FactorySelectorResult;
|
|
81
|
+
checks: Array<{ name: string; passed: boolean }>;
|
|
82
|
+
failedChecks: string[];
|
|
83
|
+
no_ship: boolean;
|
|
84
|
+
bodyStored: false;
|
|
85
|
+
promptBodiesStored: false;
|
|
86
|
+
outputBodiesStored: false;
|
|
87
|
+
generatedAt: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const SIGNAL_MATCHERS: Array<{ signal: FactoryDemandSignal; pattern: RegExp }> = [
|
|
91
|
+
{ signal: "code_review", pattern: /\b(code review|review code|review changes|oracle matrix|security review|qa review|correctness|architecture)\b/i },
|
|
92
|
+
{ signal: "budget_preflight", pattern: /\b(budget|cost|costs|cap|caps|preflight|strict budget|max runs|max cost|parallel children)\b/i },
|
|
93
|
+
{ signal: "roadmap_lots", pattern: /\b(roadmap|lot|lots|milestone|unchecked item|execution queue)\b/i },
|
|
94
|
+
{ signal: "opencode_patterns", pattern: /\b(opencode|pattern|patterns|canonizer|canonical|taxonomy|workflow rules|quality gates)\b/i },
|
|
95
|
+
{ signal: "project_dna", pattern: /\b(projectdna|project dna|project-dna|knowledge graph|code knowledge|context pack|repo scan|reference project)\b/i },
|
|
96
|
+
{ signal: "factory_forge", pattern: /\b(new factory|create factory|generate factory|factory scaffold|quarantine|factory-forge|forge)\b/i },
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
const FACTORY_SIGNAL_IDS: Record<FactoryDemandSignal, string> = {
|
|
100
|
+
code_review: "code-review-matrix",
|
|
101
|
+
budget_preflight: "budget-preflight-dry-run",
|
|
102
|
+
roadmap_lots: "roadmap-smoke-lots",
|
|
103
|
+
opencode_patterns: "opencode-pattern-canonizer",
|
|
104
|
+
project_dna: "project-dna",
|
|
105
|
+
factory_forge: "factory-forge",
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
function uniqueSorted<T extends string>(items: T[]): T[] {
|
|
109
|
+
return [...new Set(items)].sort() as T[];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function stableStrings(items: unknown): string[] {
|
|
113
|
+
return Array.isArray(items) ? items.filter((item): item is string => typeof item === "string" && item.trim().length > 0).map((item) => item.trim()).sort() : [];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function hashList(items: string[]): string[] {
|
|
117
|
+
return items.map((item) => sha256(item)).sort();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function detectFactoryDemandSignals(...values: string[]): FactoryDemandSignal[] {
|
|
121
|
+
const text = values.join("\n");
|
|
122
|
+
return uniqueSorted(SIGNAL_MATCHERS.filter((entry) => entry.pattern.test(text)).map((entry) => entry.signal));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function manifestAvailability(manifests: string[]): { smoke: boolean; pilot: boolean; batch: boolean } {
|
|
126
|
+
return {
|
|
127
|
+
smoke: manifests.includes("smoke-manifest.json"),
|
|
128
|
+
pilot: manifests.includes("pilot-manifest.json"),
|
|
129
|
+
batch: manifests.includes("batch-manifest.json"),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function candidateManifests(candidate: FactorySelectorCandidateInput): string[] {
|
|
134
|
+
const metadata = isRecord(candidate.metadata) ? candidate.metadata : {};
|
|
135
|
+
return uniqueSorted([
|
|
136
|
+
...stableStrings(candidate.manifests),
|
|
137
|
+
...stableStrings(metadata.manifests),
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function candidateId(candidate: FactorySelectorCandidateInput): string {
|
|
142
|
+
return safeFileStem(typeof candidate.id === "string" ? candidate.id : typeof candidate.name === "string" ? candidate.name : "unknown");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function summarizeDemand(demand: FactoryDemandInput, index: number): FactorySelectorDemandSummary {
|
|
146
|
+
const acceptanceCriteria = stableStrings(demand.acceptanceCriteria);
|
|
147
|
+
const expectedArtifacts = stableStrings(demand.expectedArtifacts);
|
|
148
|
+
const refinedSpec = typeof demand.refinedSpec === "string" ? demand.refinedSpec : "";
|
|
149
|
+
return {
|
|
150
|
+
demandId: safeFileStem(demand.id ?? `demand-${index + 1}`),
|
|
151
|
+
demandHash: sha256([refinedSpec, ...acceptanceCriteria, ...expectedArtifacts].join("\n")),
|
|
152
|
+
signals: detectFactoryDemandSignals(refinedSpec, acceptanceCriteria.join("\n"), expectedArtifacts.join("\n")),
|
|
153
|
+
acceptanceCriteriaHashes: hashList(acceptanceCriteria),
|
|
154
|
+
expectedArtifactHashes: hashList(expectedArtifacts),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function scoreDemandForFactory(factoryId: string, demand: FactorySelectorDemandSummary): { score: number; reasonCodes: string[] } {
|
|
159
|
+
const reasonCodes: string[] = [];
|
|
160
|
+
let score = 0;
|
|
161
|
+
for (const signal of demand.signals) {
|
|
162
|
+
if (FACTORY_SIGNAL_IDS[signal] === factoryId) {
|
|
163
|
+
score += 8;
|
|
164
|
+
reasonCodes.push(`signal:${signal}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return { score, reasonCodes };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function scoreFactoryCandidate(candidate: FactorySelectorCandidateInput, demands: FactorySelectorDemandSummary[]): Omit<FactorySelectorCandidateScore, "selected"> {
|
|
171
|
+
const id = candidateId(candidate);
|
|
172
|
+
const manifests = candidateManifests(candidate);
|
|
173
|
+
const availability = manifestAvailability(manifests);
|
|
174
|
+
const demandMatches = demands.map((demand) => {
|
|
175
|
+
const score = scoreDemandForFactory(id, demand);
|
|
176
|
+
return { demandId: demand.demandId, signals: demand.signals, score: score.score, reasonCodes: score.reasonCodes.sort() };
|
|
177
|
+
});
|
|
178
|
+
const manifestScore = (availability.smoke ? 1 : 0) + (availability.pilot ? 1 : 0) + (availability.batch ? 1 : 0);
|
|
179
|
+
const signalScore = demandMatches.reduce((sum, match) => sum + match.score, 0);
|
|
180
|
+
const reasonCodes = uniqueSorted([
|
|
181
|
+
...demandMatches.flatMap((match) => match.reasonCodes),
|
|
182
|
+
...(availability.smoke ? ["manifest:smoke"] : []),
|
|
183
|
+
...(availability.pilot ? ["manifest:pilot"] : []),
|
|
184
|
+
...(availability.batch ? ["manifest:batch"] : []),
|
|
185
|
+
]);
|
|
186
|
+
const score = signalScore + manifestScore;
|
|
187
|
+
const candidateSummary = typeof candidate.summary === "string" ? candidate.summary : typeof candidate.description === "string" ? candidate.description : undefined;
|
|
188
|
+
return {
|
|
189
|
+
kind: "factory",
|
|
190
|
+
id,
|
|
191
|
+
sourcePath: candidate.sourcePath,
|
|
192
|
+
score,
|
|
193
|
+
confidence: Math.max(0, Math.min(0.99, score / Math.max(12, demands.length * 10))),
|
|
194
|
+
reasonCodes,
|
|
195
|
+
demandMatches,
|
|
196
|
+
manifestAvailability: availability,
|
|
197
|
+
summaryHash: candidateSummary ? sha256(candidateSummary) : undefined,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export function selectFactoryForDemands(input: { factories: FactorySelectorCandidateInput[]; demands?: FactoryDemandInput[]; refinedSpec?: string; acceptanceCriteria?: string[]; expectedArtifacts?: string[]; schema?: FactorySelectorResult["schema"] }): FactorySelectorResult {
|
|
202
|
+
const demandInputs = input.demands && input.demands.length > 0
|
|
203
|
+
? input.demands
|
|
204
|
+
: [{ id: "primary", refinedSpec: input.refinedSpec ?? "", acceptanceCriteria: input.acceptanceCriteria ?? [], expectedArtifacts: input.expectedArtifacts ?? [] }];
|
|
205
|
+
const demands = demandInputs.map(summarizeDemand);
|
|
206
|
+
const signals = uniqueSorted(demands.flatMap((demand) => demand.signals));
|
|
207
|
+
const scoredWithoutSelection = input.factories
|
|
208
|
+
.map((candidate) => scoreFactoryCandidate(candidate, demands))
|
|
209
|
+
.sort((left, right) => right.score - left.score || left.id.localeCompare(right.id));
|
|
210
|
+
const forgeCandidate = scoredWithoutSelection.find((candidate) => candidate.id === "factory-forge");
|
|
211
|
+
const bestExisting = scoredWithoutSelection.find((candidate) => candidate.id !== "factory-forge" && candidate.score >= 8);
|
|
212
|
+
const selected = bestExisting ?? (forgeCandidate && (forgeCandidate.score >= 8 || !bestExisting) ? forgeCandidate : undefined);
|
|
213
|
+
const selectedFactory = selected?.id;
|
|
214
|
+
const selectionStatus: FactorySelectionStatus = selectedFactory && selectedFactory !== "factory-forge"
|
|
215
|
+
? "existing_factory_selected"
|
|
216
|
+
: selectedFactory === "factory-forge"
|
|
217
|
+
? "factory_forge_quarantine_recommended"
|
|
218
|
+
: "no_factory_available";
|
|
219
|
+
const candidates = scoredWithoutSelection.map((candidate) => ({ ...candidate, selected: candidate.id === selectedFactory }));
|
|
220
|
+
const forgeSelected = selectedFactory === "factory-forge";
|
|
221
|
+
return {
|
|
222
|
+
schema: input.schema ?? "zob.factory-selector.v1",
|
|
223
|
+
selectionStatus,
|
|
224
|
+
selectedFactory,
|
|
225
|
+
selectedScore: selected?.score ?? 0,
|
|
226
|
+
confidence: selected?.confidence ?? 0,
|
|
227
|
+
signals,
|
|
228
|
+
demands,
|
|
229
|
+
deterministicScoring: true,
|
|
230
|
+
multiDemand: true,
|
|
231
|
+
candidates,
|
|
232
|
+
factoryForge: {
|
|
233
|
+
available: Boolean(forgeCandidate),
|
|
234
|
+
selected: forgeSelected,
|
|
235
|
+
quarantineRequired: forgeSelected,
|
|
236
|
+
noAutoActivation: true,
|
|
237
|
+
activationRequiresReview: true,
|
|
238
|
+
activationPerformed: false,
|
|
239
|
+
quarantineOnly: true,
|
|
240
|
+
},
|
|
241
|
+
noAutoActivation: true,
|
|
242
|
+
quarantineRequiredForNewFactory: forgeSelected,
|
|
243
|
+
bodyStored: false,
|
|
244
|
+
promptBodiesStored: false,
|
|
245
|
+
outputBodiesStored: false,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export function loadFactorySelectorCandidates(repoRoot: string): FactorySelectorCandidateInput[] {
|
|
250
|
+
const byId = new Map<string, FactorySelectorCandidateInput>();
|
|
251
|
+
for (const factoriesDir of readableZobResourcePaths(repoRoot, "factories")) {
|
|
252
|
+
for (const entry of readdirSync(factoriesDir, { withFileTypes: true }).filter((item) => item.isDirectory())) {
|
|
253
|
+
const factoryName = safeFileStem(entry.name);
|
|
254
|
+
const factoryDir = join(factoriesDir, factoryName);
|
|
255
|
+
const factoryJsonPath = join(factoryDir, "factory.json");
|
|
256
|
+
const parsed = existsSync(factoryJsonPath) ? JSON.parse(readFileSync(factoryJsonPath, "utf8")) as unknown : {};
|
|
257
|
+
const record = isRecord(parsed) ? parsed : {};
|
|
258
|
+
const candidate = {
|
|
259
|
+
id: typeof record.name === "string" ? record.name : factoryName,
|
|
260
|
+
sourcePath: `.pi/factories/${factoryName}/factory.json`,
|
|
261
|
+
summary: typeof record.summary === "string" ? record.summary : undefined,
|
|
262
|
+
description: typeof record.description === "string" ? record.description : undefined,
|
|
263
|
+
manifests: readdirSync(factoryDir, { withFileTypes: true }).filter((file) => file.isFile() && file.name.endsWith("-manifest.json")).map((file) => basename(file.name)).sort(),
|
|
264
|
+
metadata: isRecord(record.metadata) ? record.metadata : {},
|
|
265
|
+
};
|
|
266
|
+
byId.set(candidateId(candidate), candidate);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return [...byId.values()].sort((left, right) => candidateId(left).localeCompare(candidateId(right)));
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export function buildFactorySelectorSmokeReport(repoRoot: string): FactorySelectorSmokeReport {
|
|
273
|
+
const candidates = loadFactorySelectorCandidates(repoRoot);
|
|
274
|
+
const result = selectFactoryForDemands({
|
|
275
|
+
factories: candidates,
|
|
276
|
+
demands: [
|
|
277
|
+
{
|
|
278
|
+
id: "code-review",
|
|
279
|
+
refinedSpec: "Run a code review matrix with architecture, correctness, security, and QA review.",
|
|
280
|
+
acceptanceCriteria: ["oracle matrix", "security review"],
|
|
281
|
+
expectedArtifacts: ["code-review-matrix.json"],
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
id: "new-factory",
|
|
285
|
+
refinedSpec: "Create a new factory scaffold in quarantine for visual QA workflow.",
|
|
286
|
+
acceptanceCriteria: ["factory-forge quarantine", "manual activation required"],
|
|
287
|
+
expectedArtifacts: ["factory.json", "smoke-manifest.json"],
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
});
|
|
291
|
+
const forgeOnly = selectFactoryForDemands({
|
|
292
|
+
factories: candidates,
|
|
293
|
+
refinedSpec: "Generate a new factory scaffold in quarantine for a future workflow.",
|
|
294
|
+
acceptanceCriteria: ["quarantine only", "no activation"],
|
|
295
|
+
expectedArtifacts: ["factory scaffold"],
|
|
296
|
+
});
|
|
297
|
+
const checks = [
|
|
298
|
+
{ name: "multi_demand_enabled", passed: result.multiDemand === true && result.demands.length === 2 },
|
|
299
|
+
{ name: "existing_factory_selected_for_existing_signal", passed: result.selectedFactory === "code-review-matrix" && result.signals.includes("code_review") },
|
|
300
|
+
{ name: "factory_forge_available", passed: result.factoryForge.available === true && result.candidates.some((candidate) => candidate.id === "factory-forge") },
|
|
301
|
+
{ name: "forge_only_routes_to_quarantine", passed: forgeOnly.selectedFactory === "factory-forge" && forgeOnly.quarantineRequiredForNewFactory === true && forgeOnly.factoryForge.activationPerformed === false },
|
|
302
|
+
{ name: "no_auto_activation", passed: result.noAutoActivation === true && forgeOnly.noAutoActivation === true },
|
|
303
|
+
{ name: "body_free", passed: result.bodyStored === false && result.promptBodiesStored === false && result.outputBodiesStored === false },
|
|
304
|
+
];
|
|
305
|
+
const failedChecks = checks.filter((check) => !check.passed).map((check) => check.name);
|
|
306
|
+
return {
|
|
307
|
+
schema: "zob.factory-selector-smoke.v1",
|
|
308
|
+
status: failedChecks.length === 0 ? "passed" : "failed",
|
|
309
|
+
result,
|
|
310
|
+
checks,
|
|
311
|
+
failedChecks,
|
|
312
|
+
no_ship: failedChecks.length > 0,
|
|
313
|
+
bodyStored: false,
|
|
314
|
+
promptBodiesStored: false,
|
|
315
|
+
outputBodiesStored: false,
|
|
316
|
+
generatedAt: new Date().toISOString(),
|
|
317
|
+
};
|
|
318
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
import { loadFactorySelectorCandidates, selectFactoryForDemands, type FactorySelectorResult } from "./factory-selector.js";
|
|
5
|
+
import { buildControlledWorkerPoolPlan, evaluateLaunchAuthorizedApplyGate, type ControlledWorkerPoolPlan, type LaunchAuthorizedApplyGate } from "./launch-apply.js";
|
|
6
|
+
import { sha256 } from "./utils/hashing.js";
|
|
7
|
+
import { safeFileStem } from "./utils/paths.js";
|
|
8
|
+
|
|
9
|
+
export interface FullAutonomyTestInput {
|
|
10
|
+
runId?: string;
|
|
11
|
+
launchConfirmed?: boolean;
|
|
12
|
+
allowedPaths?: string[];
|
|
13
|
+
forbiddenPaths?: string[];
|
|
14
|
+
maxParallelWorkers?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface FullAutonomyTestRun {
|
|
18
|
+
schema: "zob.full-autonomy-test-run.v1";
|
|
19
|
+
runId: string;
|
|
20
|
+
status: "full_autonomy_test_ready" | "blocked";
|
|
21
|
+
no_ship: boolean;
|
|
22
|
+
testMode: true;
|
|
23
|
+
productionMode: false;
|
|
24
|
+
scopedTestAutonomyEnabled: boolean;
|
|
25
|
+
globalAutonomyClaimAllowed: false;
|
|
26
|
+
manualPerActionApprovalRequired: false;
|
|
27
|
+
launchAuthorization: Record<string, unknown>;
|
|
28
|
+
workerPool: ControlledWorkerPoolPlan;
|
|
29
|
+
factorySelection: FactorySelectorResult;
|
|
30
|
+
applyGate: LaunchAuthorizedApplyGate;
|
|
31
|
+
inScopeAutonomousTestWrite: {
|
|
32
|
+
performed: boolean;
|
|
33
|
+
relativePath: string;
|
|
34
|
+
pathHash: string;
|
|
35
|
+
artifactHash: string;
|
|
36
|
+
allowedByLaunch: boolean;
|
|
37
|
+
productionWrite: false;
|
|
38
|
+
};
|
|
39
|
+
safety: {
|
|
40
|
+
secretsAccessed: false;
|
|
41
|
+
destructiveCommandsRun: false;
|
|
42
|
+
commitsCreated: false;
|
|
43
|
+
networkAccessed: false;
|
|
44
|
+
productionWritesPerformed: false;
|
|
45
|
+
outOfScopeWritesPerformed: false;
|
|
46
|
+
bodyStored: false;
|
|
47
|
+
promptBodiesStored: false;
|
|
48
|
+
outputBodiesStored: false;
|
|
49
|
+
};
|
|
50
|
+
checks: Array<{ name: string; passed: boolean }>;
|
|
51
|
+
failedChecks: string[];
|
|
52
|
+
evidenceRefs: string[];
|
|
53
|
+
bodyStored: false;
|
|
54
|
+
promptBodiesStored: false;
|
|
55
|
+
outputBodiesStored: false;
|
|
56
|
+
generatedAt: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function defaultForbiddenPaths(input?: string[]): string[] {
|
|
60
|
+
return [...new Set([...(input ?? []), ".env", ".env.*", "**/.env*", "~/.ssh", "~/.aws", "node_modules", "dist", "build", "secrets", "raw-conversation-history"])].sort();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function buildLaunchAuthorization(runId: string, allowedPaths: string[], forbiddenPaths: string[], launchConfirmed: boolean): Record<string, unknown> {
|
|
64
|
+
return {
|
|
65
|
+
schema: "zob.launch-authorization.v1",
|
|
66
|
+
runId,
|
|
67
|
+
originalUserAskHash: sha256("enable full autonomous test mode"),
|
|
68
|
+
refinedSpecHash: sha256("spec locked: run a scoped full-autonomy test with in-scope autonomous test write and no production apply"),
|
|
69
|
+
specLocked: true,
|
|
70
|
+
userLaunchConfirmed: launchConfirmed,
|
|
71
|
+
launchConfirmedAt: launchConfirmed ? new Date().toISOString() : undefined,
|
|
72
|
+
authorizedAutonomyLevel: "L6",
|
|
73
|
+
allowedActions: ["read_repo", "context_lookup", "select_factory", "run_worker_pool", "sandbox_edit", "apply_in_scope_test_artifact", "post_apply_validation", "post_apply_oracle"],
|
|
74
|
+
allowedPaths,
|
|
75
|
+
forbiddenPaths,
|
|
76
|
+
applyPolicy: {
|
|
77
|
+
mode: "auto_apply_in_scope",
|
|
78
|
+
rollbackRequired: true,
|
|
79
|
+
exactDiffHashRequired: true,
|
|
80
|
+
postApplyValidationRequired: true,
|
|
81
|
+
postApplyOracleRequired: true,
|
|
82
|
+
},
|
|
83
|
+
budgetPolicy: {
|
|
84
|
+
mode: "strict_requested",
|
|
85
|
+
strict: true,
|
|
86
|
+
strictBudgetRequired: true,
|
|
87
|
+
strictBudgetSatisfied: true,
|
|
88
|
+
},
|
|
89
|
+
stopConditions: ["scope_drift", "secret_required", "validation_fail_exhausted", "oracle_no_ship", "budget_exceeded", "forbidden_path", "destructive_command"],
|
|
90
|
+
launchAuthorizesInScopeActions: launchConfirmed,
|
|
91
|
+
actionExecutionBlockedUntilLaunch: !launchConfirmed,
|
|
92
|
+
exceptionApprovalRequiredOnlyForOutOfScope: true,
|
|
93
|
+
bodyStored: false,
|
|
94
|
+
promptBodiesStored: false,
|
|
95
|
+
outputBodiesStored: false,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function writeFullAutonomyTestRun(repoRoot: string, input: FullAutonomyTestInput = {}): FullAutonomyTestRun {
|
|
100
|
+
const runId = safeFileStem(input.runId ?? `full-autonomy-test-${Date.now()}`);
|
|
101
|
+
const runRoot = join("reports", "autonomous-runs", runId);
|
|
102
|
+
const runDir = join(repoRoot, runRoot);
|
|
103
|
+
const testArtifactRelativePath = `${runRoot}/autonomous-test-action.json`;
|
|
104
|
+
const allowedPaths = [...new Set([...(input.allowedPaths ?? []), `${runRoot}/`])].sort();
|
|
105
|
+
const forbiddenPaths = defaultForbiddenPaths(input.forbiddenPaths);
|
|
106
|
+
const launchConfirmed = input.launchConfirmed === true;
|
|
107
|
+
const launchAuthorization = buildLaunchAuthorization(runId, allowedPaths, forbiddenPaths, launchConfirmed);
|
|
108
|
+
const workerPool = buildControlledWorkerPoolPlan({ runId, maxParallelWorkers: input.maxParallelWorkers ?? 5, launchAuthorization });
|
|
109
|
+
const factories = loadFactorySelectorCandidates(repoRoot);
|
|
110
|
+
const factorySelection = selectFactoryForDemands({
|
|
111
|
+
factories,
|
|
112
|
+
demands: [
|
|
113
|
+
{
|
|
114
|
+
id: "full-autonomy-test",
|
|
115
|
+
refinedSpec: "Run a full autonomous test lane with factory selection, worker pool, in-scope apply gate, validation and oracle.",
|
|
116
|
+
acceptanceCriteria: ["launch authorization", "worker pool", "factory selector", "apply in scope", "oracle validation"],
|
|
117
|
+
expectedArtifacts: ["autonomous-test-action.json", "FULL_AUTONOMY_TEST_READY.sentinel"],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "fallback-forge-quarantine",
|
|
121
|
+
refinedSpec: "If a new factory is needed, use factory-forge quarantine only and never auto-activate.",
|
|
122
|
+
acceptanceCriteria: ["factory-forge quarantine", "no auto activation"],
|
|
123
|
+
expectedArtifacts: ["factory.json", "smoke-manifest.json"],
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
});
|
|
127
|
+
const testArtifact = {
|
|
128
|
+
schema: "zob.full-autonomy-test-action.v1",
|
|
129
|
+
runId,
|
|
130
|
+
launchAuthorizationHash: sha256(JSON.stringify(launchAuthorization)),
|
|
131
|
+
workerPoolHash: sha256(JSON.stringify(workerPool)),
|
|
132
|
+
factorySelectionHash: sha256(JSON.stringify(factorySelection)),
|
|
133
|
+
inScopeAutonomousTestAction: true,
|
|
134
|
+
productionWrite: false,
|
|
135
|
+
bodyStored: false,
|
|
136
|
+
promptBodiesStored: false,
|
|
137
|
+
outputBodiesStored: false,
|
|
138
|
+
generatedAt: new Date().toISOString(),
|
|
139
|
+
};
|
|
140
|
+
const diffHash = sha256(JSON.stringify(testArtifact));
|
|
141
|
+
const applyGate = evaluateLaunchAuthorizedApplyGate(repoRoot, {
|
|
142
|
+
runId,
|
|
143
|
+
launchAuthorization,
|
|
144
|
+
workerPoolPlan: workerPool,
|
|
145
|
+
changedPaths: [testArtifactRelativePath],
|
|
146
|
+
diffHash,
|
|
147
|
+
sandboxRunId: runId,
|
|
148
|
+
oracleReviewRef: `${runRoot}/full-autonomy-test-oracle.json`,
|
|
149
|
+
validationRefs: ["npm run full-autonomy:test", "npm run check -- --pretty false"],
|
|
150
|
+
});
|
|
151
|
+
const canWriteTestArtifact = applyGate.applyEligible === true && launchConfirmed;
|
|
152
|
+
mkdirSync(runDir, { recursive: true });
|
|
153
|
+
if (canWriteTestArtifact) {
|
|
154
|
+
writeFileSync(join(repoRoot, testArtifactRelativePath), `${JSON.stringify(testArtifact, null, 2)}\n`, "utf8");
|
|
155
|
+
writeFileSync(join(runDir, "FULL_AUTONOMY_TEST_READY.sentinel"), `full autonomy test ready ${new Date().toISOString()}\n`, "utf8");
|
|
156
|
+
}
|
|
157
|
+
const checks = [
|
|
158
|
+
{ name: "spec_locked", passed: launchAuthorization.specLocked === true },
|
|
159
|
+
{ name: "user_launch_confirmed", passed: launchConfirmed },
|
|
160
|
+
{ name: "manual_per_action_approval_disabled_for_in_scope", passed: applyGate.manualPerActionApprovalRequired === false },
|
|
161
|
+
{ name: "worker_pool_enabled", passed: workerPool.workerPoolEnabledByLaunch === true && workerPool.parentOwnedDispatch === true && workerPool.childDirectDispatch === false },
|
|
162
|
+
{ name: "factory_selector_ready", passed: factorySelection.selectionStatus !== "no_factory_available" && factorySelection.noAutoActivation === true },
|
|
163
|
+
{ name: "apply_gate_eligible", passed: applyGate.applyEligible === true && applyGate.autoApplyAuthorizedByLaunch === true },
|
|
164
|
+
{ name: "in_scope_autonomous_test_write_performed", passed: canWriteTestArtifact },
|
|
165
|
+
{ name: "production_writes_blocked", passed: applyGate.productionWritesPerformed === false },
|
|
166
|
+
{ name: "forbidden_paths_preserved", passed: forbiddenPaths.some((path) => path.includes(".env")) && applyGate.gates.forbiddenPathsClear === true },
|
|
167
|
+
];
|
|
168
|
+
const failedChecks = checks.filter((check) => !check.passed).map((check) => check.name);
|
|
169
|
+
const report: FullAutonomyTestRun = {
|
|
170
|
+
schema: "zob.full-autonomy-test-run.v1",
|
|
171
|
+
runId,
|
|
172
|
+
status: failedChecks.length === 0 ? "full_autonomy_test_ready" : "blocked",
|
|
173
|
+
no_ship: failedChecks.length > 0,
|
|
174
|
+
testMode: true,
|
|
175
|
+
productionMode: false,
|
|
176
|
+
scopedTestAutonomyEnabled: failedChecks.length === 0,
|
|
177
|
+
globalAutonomyClaimAllowed: false,
|
|
178
|
+
manualPerActionApprovalRequired: false,
|
|
179
|
+
launchAuthorization,
|
|
180
|
+
workerPool,
|
|
181
|
+
factorySelection,
|
|
182
|
+
applyGate,
|
|
183
|
+
inScopeAutonomousTestWrite: {
|
|
184
|
+
performed: canWriteTestArtifact,
|
|
185
|
+
relativePath: testArtifactRelativePath,
|
|
186
|
+
pathHash: sha256(testArtifactRelativePath),
|
|
187
|
+
artifactHash: canWriteTestArtifact ? sha256(JSON.stringify(testArtifact)) : sha256("not-written"),
|
|
188
|
+
allowedByLaunch: applyGate.applyEligible === true,
|
|
189
|
+
productionWrite: false,
|
|
190
|
+
},
|
|
191
|
+
safety: {
|
|
192
|
+
secretsAccessed: false,
|
|
193
|
+
destructiveCommandsRun: false,
|
|
194
|
+
commitsCreated: false,
|
|
195
|
+
networkAccessed: false,
|
|
196
|
+
productionWritesPerformed: false,
|
|
197
|
+
outOfScopeWritesPerformed: false,
|
|
198
|
+
bodyStored: false,
|
|
199
|
+
promptBodiesStored: false,
|
|
200
|
+
outputBodiesStored: false,
|
|
201
|
+
},
|
|
202
|
+
checks,
|
|
203
|
+
failedChecks,
|
|
204
|
+
evidenceRefs: canWriteTestArtifact ? [testArtifactRelativePath, `${runRoot}/FULL_AUTONOMY_TEST_READY.sentinel`] : [],
|
|
205
|
+
bodyStored: false,
|
|
206
|
+
promptBodiesStored: false,
|
|
207
|
+
outputBodiesStored: false,
|
|
208
|
+
generatedAt: new Date().toISOString(),
|
|
209
|
+
};
|
|
210
|
+
const oracle = {
|
|
211
|
+
schema: "zob.full-autonomy-test-oracle.v1",
|
|
212
|
+
runId,
|
|
213
|
+
verdict: report.no_ship ? "FAIL" : "PASS",
|
|
214
|
+
no_ship: report.no_ship,
|
|
215
|
+
scopedTestAutonomyEnabled: report.scopedTestAutonomyEnabled,
|
|
216
|
+
globalAutonomyClaimAllowed: false,
|
|
217
|
+
failedChecks,
|
|
218
|
+
bodyStored: false,
|
|
219
|
+
promptBodiesStored: false,
|
|
220
|
+
outputBodiesStored: false,
|
|
221
|
+
generatedAt: new Date().toISOString(),
|
|
222
|
+
};
|
|
223
|
+
writeFileSync(join(runDir, "full-autonomy-test-run.json"), `${JSON.stringify(report, null, 2)}\n`, "utf8");
|
|
224
|
+
writeFileSync(join(runDir, "full-autonomy-test-oracle.json"), `${JSON.stringify(oracle, null, 2)}\n`, "utf8");
|
|
225
|
+
return report;
|
|
226
|
+
}
|