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,338 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
4
|
+
|
|
5
|
+
import { DEFAULT_RULES } from "./constants.js";
|
|
6
|
+
import type { BudgetSidecar, DamageRules, HarnessAgent } from "./types.js";
|
|
7
|
+
import { expandHome, pathMatches } from "./utils/paths.js";
|
|
8
|
+
|
|
9
|
+
function loadDamageRules(cwd: string): DamageRules {
|
|
10
|
+
const candidates = [join(cwd, ".pi", "damage-control-rules.json"), join(getAgentDir(), "damage-control-rules.json")];
|
|
11
|
+
for (const candidate of candidates) {
|
|
12
|
+
if (!existsSync(candidate)) continue;
|
|
13
|
+
try {
|
|
14
|
+
const loaded = JSON.parse(readFileSync(candidate, "utf8")) as Partial<DamageRules>;
|
|
15
|
+
return {
|
|
16
|
+
bashToolPatterns: loaded.bashToolPatterns ?? DEFAULT_RULES.bashToolPatterns,
|
|
17
|
+
zeroAccessPaths: loaded.zeroAccessPaths ?? DEFAULT_RULES.zeroAccessPaths,
|
|
18
|
+
readOnlyPaths: loaded.readOnlyPaths ?? DEFAULT_RULES.readOnlyPaths,
|
|
19
|
+
noDeletePaths: loaded.noDeletePaths ?? DEFAULT_RULES.noDeletePaths,
|
|
20
|
+
};
|
|
21
|
+
} catch {
|
|
22
|
+
return DEFAULT_RULES;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return DEFAULT_RULES;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function formatContractTemplate(task = "[atomic goal]"): string {
|
|
29
|
+
return `1. TASK: ${task}
|
|
30
|
+
2. EXPECTED OUTCOME: [observable artifact, verdict, or changed file set]
|
|
31
|
+
3. REQUIRED TOOLS: [allowed tools / APIs only]
|
|
32
|
+
4. MUST DO:
|
|
33
|
+
- Restate constraints before tool use.
|
|
34
|
+
- Verify existing state before changing anything.
|
|
35
|
+
- Produce concrete evidence before claiming done.
|
|
36
|
+
5. MUST NOT DO:
|
|
37
|
+
- No secret reads or writes.
|
|
38
|
+
- No broad destructive commands.
|
|
39
|
+
- No commits unless explicitly requested.
|
|
40
|
+
6. CONTEXT:
|
|
41
|
+
- Paths:
|
|
42
|
+
- Prior evidence:
|
|
43
|
+
- Downstream use:
|
|
44
|
+
|
|
45
|
+
FINAL FORMAT:
|
|
46
|
+
- Verdict / result
|
|
47
|
+
- Evidence (files, commands, outputs)
|
|
48
|
+
- Risks / blockers
|
|
49
|
+
- Compliance line
|
|
50
|
+
- deliverable_delivered: yes/no`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const CONTRACT_PARTS: Array<{ label: string; pattern: RegExp }> = [
|
|
54
|
+
{ label: "TASK", pattern: /(?:^|\n)\s*(?:\d+\.\s*)?TASK\s*:/i },
|
|
55
|
+
{ label: "EXPECTED OUTCOME", pattern: /(?:^|\n)\s*(?:\d+\.\s*)?EXPECTED\s+OUTCOME\s*:/i },
|
|
56
|
+
{ label: "REQUIRED TOOLS", pattern: /(?:^|\n)\s*(?:\d+\.\s*)?(?:REQUIRED\s+TOOLS|TOOLS)\s*:/i },
|
|
57
|
+
{ label: "MUST DO", pattern: /(?:^|\n)\s*(?:\d+\.\s*)?MUST\s+DO\s*:/i },
|
|
58
|
+
{ label: "MUST NOT DO", pattern: /(?:^|\n)\s*(?:\d+\.\s*)?MUST\s+NOT(?:\s+DO)?\s*:/i },
|
|
59
|
+
{ label: "CONTEXT", pattern: /(?:^|\n)\s*(?:\d+\.\s*)?CONTEXT\s*:/i },
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
export function validateSixPartContract(task: string): string[] {
|
|
63
|
+
const errors: string[] = [];
|
|
64
|
+
const matches = CONTRACT_PARTS.map((part) => {
|
|
65
|
+
const match = part.pattern.exec(task);
|
|
66
|
+
return { ...part, index: match?.index ?? -1, end: match ? match.index + match[0].length : -1 };
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
for (const match of matches) {
|
|
70
|
+
if (match.index === -1) errors.push(`Missing contract section: ${match.label}`);
|
|
71
|
+
}
|
|
72
|
+
if (errors.length > 0) return errors;
|
|
73
|
+
|
|
74
|
+
for (let index = 1; index < matches.length; index += 1) {
|
|
75
|
+
if (matches[index].index < matches[index - 1].index) {
|
|
76
|
+
errors.push(`Contract section out of order: ${matches[index].label}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const ordered = [...matches].sort((left, right) => left.index - right.index);
|
|
81
|
+
for (const [index, match] of ordered.entries()) {
|
|
82
|
+
const next = ordered[index + 1];
|
|
83
|
+
const body = task.slice(match.end, next?.index ?? task.length).trim();
|
|
84
|
+
if (!body || /^\[.*\]$/.test(body)) errors.push(`Empty contract section: ${match.label}`);
|
|
85
|
+
}
|
|
86
|
+
return errors;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function parseToolList(input: string | undefined): string[] | undefined {
|
|
90
|
+
if (!input) return undefined;
|
|
91
|
+
return input
|
|
92
|
+
.split(",")
|
|
93
|
+
.map((tool) => tool.trim())
|
|
94
|
+
.filter(Boolean);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function validateToolList(agent: HarnessAgent, requestedTools: string[] | undefined): string[] {
|
|
98
|
+
const errors: string[] = [];
|
|
99
|
+
const allowed = new Set(agent.tools ?? []);
|
|
100
|
+
if (!requestedTools || requestedTools.length === 0) return errors;
|
|
101
|
+
if (allowed.size === 0) return [`Agent '${agent.name}' has no declared tool allowlist; refusing tool override.`];
|
|
102
|
+
for (const tool of requestedTools) {
|
|
103
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(tool)) errors.push(`Invalid tool name '${tool}'`);
|
|
104
|
+
if (!allowed.has(tool)) errors.push(`Tool '${tool}' is not allowed for agent '${agent.name}'. Allowed: ${[...allowed].join(", ")}`);
|
|
105
|
+
}
|
|
106
|
+
return errors;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function resolveChildCwd(repoRoot: string, requestedCwd: string | undefined): { cwd: string; errors: string[] } {
|
|
110
|
+
const root = resolve(repoRoot);
|
|
111
|
+
const cwd = requestedCwd ? resolve(root, expandHome(requestedCwd)) : root;
|
|
112
|
+
if (cwd !== root && !cwd.startsWith(`${root}/`)) {
|
|
113
|
+
return { cwd, errors: [`Child cwd must stay inside repo root. Requested: ${requestedCwd}`] };
|
|
114
|
+
}
|
|
115
|
+
return { cwd, errors: [] };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function staysInsideRepo(path: string, repoRoot: string): boolean {
|
|
119
|
+
const root = resolve(repoRoot);
|
|
120
|
+
const resolved = resolve(root, expandHome(path));
|
|
121
|
+
return resolved === root || resolved.startsWith(`${root}/`);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function normalizePolicyPattern(path: string): string {
|
|
125
|
+
return path.trim().replace(/\\+/g, "/").replace(/\/+/g, "/");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function isBroadDenyPattern(path: string): boolean {
|
|
129
|
+
const normalized = normalizePolicyPattern(path);
|
|
130
|
+
return normalized === "" || normalized === "." || normalized === "./" || normalized === "/" || normalized === "/*" || normalized === "*" || normalized === "**" || normalized === "~" || normalized === "~/";
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function isRepoRelativePattern(path: string): boolean {
|
|
134
|
+
const normalized = normalizePolicyPattern(path);
|
|
135
|
+
return !normalized.startsWith("/") && !normalized.startsWith("~/") && normalized !== "~";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function isWindowsAbsolutePattern(path: string): boolean {
|
|
139
|
+
return /^[a-zA-Z]:\//.test(normalizePolicyPattern(path));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function hasTraversalSegment(path: string): boolean {
|
|
143
|
+
return normalizePolicyPattern(path).split("/").some((segment) => segment === "..");
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function allowedPathGuidance(label: string, path: string, reason: string): string {
|
|
147
|
+
return `${label} path must be repo-relative only (${reason}) and stay inside repo root: ${path}. If the child needs external context, write or cite a repo-local snapshot/context_ref under reports/... and pass that repo-relative ref instead.`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function validateAllowedPathPolicy(paths: string[] | undefined, label: string, repoRoot: string): string[] {
|
|
151
|
+
const errors: string[] = [];
|
|
152
|
+
for (const path of paths ?? []) {
|
|
153
|
+
const normalized = normalizePolicyPattern(path);
|
|
154
|
+
if (path.includes("\0")) {
|
|
155
|
+
errors.push(allowedPathGuidance(label, path, "NUL bytes are not allowed"));
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
if (normalized === "" || normalized === "." || normalized === "./") {
|
|
159
|
+
errors.push(allowedPathGuidance(label, path, "broad repo roots are not allowed"));
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (normalized.startsWith("/") || normalized === "~" || normalized.startsWith("~/") || isWindowsAbsolutePattern(normalized)) {
|
|
163
|
+
errors.push(allowedPathGuidance(label, path, "absolute and home paths are not allowed"));
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (hasTraversalSegment(normalized)) {
|
|
167
|
+
errors.push(allowedPathGuidance(label, path, "path traversal segments are not allowed anywhere in allowed_paths"));
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (!staysInsideRepo(path, repoRoot)) errors.push(allowedPathGuidance(label, path, "path must not escape the repo"));
|
|
171
|
+
}
|
|
172
|
+
return errors;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function validateForbiddenPathPolicy(paths: string[] | undefined, label: string, repoRoot: string): string[] {
|
|
176
|
+
const errors: string[] = [];
|
|
177
|
+
for (const path of paths ?? []) {
|
|
178
|
+
if (path.includes("\0")) {
|
|
179
|
+
errors.push(`${label} path contains a NUL byte: ${path}`);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (isBroadDenyPattern(path)) {
|
|
183
|
+
errors.push(`${label} path is too broad for a deny-only pattern: ${path}`);
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (isRepoRelativePattern(path) && !staysInsideRepo(path, repoRoot)) {
|
|
187
|
+
errors.push(`${label} repo-relative deny pattern must stay inside repo root: ${path}`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return errors;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function validatePathPolicy(paths: string[] | undefined, label: string, repoRoot: string): string[] {
|
|
194
|
+
return validateAllowedPathPolicy(paths, label, repoRoot);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function parsePathListEnv(value: string | undefined): string[] {
|
|
198
|
+
if (!value) return [];
|
|
199
|
+
return value
|
|
200
|
+
.split(/[,:\n]/)
|
|
201
|
+
.map((item) => item.trim())
|
|
202
|
+
.filter(Boolean);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function validateRuntimeWritePolicy(input: {
|
|
206
|
+
targetPath: string;
|
|
207
|
+
cwd: string;
|
|
208
|
+
policyRoot?: string;
|
|
209
|
+
allowedPaths?: string[];
|
|
210
|
+
forbiddenPaths?: string[];
|
|
211
|
+
zeroAccessPaths?: string[];
|
|
212
|
+
readOnlyPaths?: string[];
|
|
213
|
+
sandboxRoot?: string;
|
|
214
|
+
}): { allowed: boolean; violations: string[] } {
|
|
215
|
+
const policyRoot = input.policyRoot ?? input.cwd;
|
|
216
|
+
const violations: string[] = [];
|
|
217
|
+
for (const protectedPattern of input.zeroAccessPaths ?? []) {
|
|
218
|
+
if (pathMatches(input.targetPath, protectedPattern, input.cwd, policyRoot)) violations.push(`zero-access path: ${protectedPattern}`);
|
|
219
|
+
}
|
|
220
|
+
for (const forbiddenPattern of input.forbiddenPaths ?? []) {
|
|
221
|
+
if (pathMatches(input.targetPath, forbiddenPattern, input.cwd, policyRoot)) violations.push(`forbidden path: ${forbiddenPattern}`);
|
|
222
|
+
}
|
|
223
|
+
for (const readOnlyPattern of input.readOnlyPaths ?? []) {
|
|
224
|
+
if (pathMatches(input.targetPath, readOnlyPattern, input.cwd, policyRoot)) violations.push(`read-only path: ${readOnlyPattern}`);
|
|
225
|
+
}
|
|
226
|
+
const allowedPaths = input.allowedPaths ?? [];
|
|
227
|
+
if (allowedPaths.length > 0 && !allowedPaths.some((allowedPath) => pathMatches(input.targetPath, allowedPath, input.cwd, policyRoot))) {
|
|
228
|
+
violations.push(`outside allowed_paths: ${allowedPaths.join(", ")}`);
|
|
229
|
+
}
|
|
230
|
+
if (input.sandboxRoot) {
|
|
231
|
+
const sandboxRoot = resolve(policyRoot, expandHome(input.sandboxRoot));
|
|
232
|
+
const target = resolve(input.cwd, expandHome(input.targetPath));
|
|
233
|
+
if (target !== sandboxRoot && !target.startsWith(`${sandboxRoot}/`)) violations.push(`outside sandbox root: ${input.sandboxRoot}`);
|
|
234
|
+
}
|
|
235
|
+
return { allowed: violations.length === 0, violations };
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export function validateDelegationWriteScope(source: string, requiredTools: string[], allowedPaths: string[] | undefined): string[] {
|
|
239
|
+
const wantsWrite = requiredTools.some((tool) => tool === "write" || tool === "edit");
|
|
240
|
+
if (wantsWrite && (allowedPaths?.length ?? 0) === 0) return [`${source} with write/edit tools requires non-empty allowed_paths`];
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function validateDelegateTaskWriteScope(requiredTools: string[], allowedPaths: string[] | undefined): string[] {
|
|
245
|
+
return validateDelegationWriteScope("delegate_task", requiredTools, allowedPaths);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function createSandboxMetadata(input: { runId: string; repoRoot: string; sandboxRoot: string; allowedPaths?: string[]; forbiddenPaths?: string[]; budget?: BudgetSidecar }): Record<string, unknown> {
|
|
249
|
+
return {
|
|
250
|
+
schema: "zob.sandbox-metadata.v1",
|
|
251
|
+
runId: input.runId,
|
|
252
|
+
repoRoot: resolve(input.repoRoot),
|
|
253
|
+
sandboxRoot: resolve(input.repoRoot, input.sandboxRoot),
|
|
254
|
+
allowedPaths: input.allowedPaths ?? [],
|
|
255
|
+
forbiddenPaths: input.forbiddenPaths ?? [],
|
|
256
|
+
tempCopy: true,
|
|
257
|
+
autoApply: false,
|
|
258
|
+
budgetEnforced: false,
|
|
259
|
+
budget: input.budget ?? { mode: "advisory", advisory: true, budgetEnforced: false, strictRequested: false, strictEnabled: false },
|
|
260
|
+
promptBodiesStored: false,
|
|
261
|
+
outputBodiesStored: false,
|
|
262
|
+
createdAt: new Date().toISOString(),
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function createDiffGateResult(input: { runId: string; diffHash?: string; changedPaths?: string[]; allowed: boolean; violations?: string[] }): Record<string, unknown> {
|
|
267
|
+
return {
|
|
268
|
+
schema: "zob.diff-gate-result.v1",
|
|
269
|
+
runId: input.runId,
|
|
270
|
+
diffHash: input.diffHash,
|
|
271
|
+
changedPaths: input.changedPaths ?? [],
|
|
272
|
+
allowed: input.allowed,
|
|
273
|
+
violations: input.violations ?? [],
|
|
274
|
+
applyRequired: true,
|
|
275
|
+
autoApply: false,
|
|
276
|
+
budgetEnforced: false,
|
|
277
|
+
bodyStored: false,
|
|
278
|
+
promptBodiesStored: false,
|
|
279
|
+
outputBodiesStored: false,
|
|
280
|
+
evaluatedAt: new Date().toISOString(),
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export function createRollbackMetadata(input: { runId: string; baseRef?: string; snapshotPath?: string; changedPaths?: string[] }): Record<string, unknown> {
|
|
285
|
+
return {
|
|
286
|
+
schema: "zob.rollback-metadata.v1",
|
|
287
|
+
runId: input.runId,
|
|
288
|
+
baseRef: input.baseRef,
|
|
289
|
+
snapshotPath: input.snapshotPath,
|
|
290
|
+
changedPaths: input.changedPaths ?? [],
|
|
291
|
+
rollbackPrepared: true,
|
|
292
|
+
rollbackApplied: false,
|
|
293
|
+
autoApply: false,
|
|
294
|
+
budgetEnforced: false,
|
|
295
|
+
bodyStored: false,
|
|
296
|
+
promptBodiesStored: false,
|
|
297
|
+
outputBodiesStored: false,
|
|
298
|
+
createdAt: new Date().toISOString(),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export function buildChildEnv(repoRoot: string, pathPolicy?: { allowedPaths?: string[]; forbiddenPaths?: string[]; sandboxRoot?: string }): NodeJS.ProcessEnv {
|
|
303
|
+
const keepExact = new Set([
|
|
304
|
+
"PATH",
|
|
305
|
+
"HOME",
|
|
306
|
+
"PWD",
|
|
307
|
+
"SHELL",
|
|
308
|
+
"TMPDIR",
|
|
309
|
+
"TMP",
|
|
310
|
+
"TEMP",
|
|
311
|
+
"NODE_PATH",
|
|
312
|
+
"NVM_DIR",
|
|
313
|
+
"LANG",
|
|
314
|
+
"LC_ALL",
|
|
315
|
+
"TERM",
|
|
316
|
+
"USER",
|
|
317
|
+
"LOGNAME",
|
|
318
|
+
"PI_OFFLINE",
|
|
319
|
+
"OPENAI_API_KEY",
|
|
320
|
+
"ANTHROPIC_API_KEY",
|
|
321
|
+
"GOOGLE_API_KEY",
|
|
322
|
+
"GEMINI_API_KEY",
|
|
323
|
+
"OPENROUTER_API_KEY",
|
|
324
|
+
"ZAI_API_KEY",
|
|
325
|
+
]);
|
|
326
|
+
const env: NodeJS.ProcessEnv = {};
|
|
327
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
328
|
+
if (value === undefined) continue;
|
|
329
|
+
if (keepExact.has(key)) env[key] = value;
|
|
330
|
+
}
|
|
331
|
+
env.ZOB_HARNESS_ROOT = repoRoot;
|
|
332
|
+
if (pathPolicy?.allowedPaths && pathPolicy.allowedPaths.length > 0) env.ZOB_ALLOWED_PATHS = pathPolicy.allowedPaths.join(",");
|
|
333
|
+
if (pathPolicy?.forbiddenPaths && pathPolicy.forbiddenPaths.length > 0) env.ZOB_FORBIDDEN_PATHS = pathPolicy.forbiddenPaths.join(",");
|
|
334
|
+
if (pathPolicy?.sandboxRoot) env.ZOB_SANDBOX_ROOT = pathPolicy.sandboxRoot;
|
|
335
|
+
return env;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export { formatContractTemplate, loadDamageRules };
|