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,90 @@
|
|
|
1
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
import ts from "typescript";
|
|
5
|
+
|
|
6
|
+
const repoRoot = process.cwd();
|
|
7
|
+
const runtimeRoot = join(repoRoot, "reports/benchmarks/coding-agent-benchmark/live-dokploy-pilot-v3/autonomy-secret-smoke-runtime");
|
|
8
|
+
|
|
9
|
+
const sourceFiles = [
|
|
10
|
+
".pi/extensions/zob-harness/src/interactive-autonomy.ts",
|
|
11
|
+
".pi/extensions/zob-harness/src/utils/hashing.ts",
|
|
12
|
+
".pi/extensions/zob-harness/src/utils/records.ts",
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
mkdirSync(runtimeRoot, { recursive: true });
|
|
16
|
+
writeFileSync(join(runtimeRoot, "package.json"), `${JSON.stringify({ type: "module" })}\n`, "utf8");
|
|
17
|
+
|
|
18
|
+
for (const sourceFile of sourceFiles) {
|
|
19
|
+
const sourcePath = join(repoRoot, sourceFile);
|
|
20
|
+
const outputPath = join(runtimeRoot, sourceFile.replace(/^\.pi\/extensions\/zob-harness\/src\//, "").replace(/\.ts$/, ".js"));
|
|
21
|
+
mkdirSync(dirname(outputPath), { recursive: true });
|
|
22
|
+
const source = readFileSync(sourcePath, "utf8");
|
|
23
|
+
const transpiled = ts.transpileModule(source, {
|
|
24
|
+
compilerOptions: {
|
|
25
|
+
module: ts.ModuleKind.ES2022,
|
|
26
|
+
target: ts.ScriptTarget.ES2022,
|
|
27
|
+
moduleResolution: ts.ModuleResolutionKind.NodeNext,
|
|
28
|
+
esModuleInterop: true,
|
|
29
|
+
verbatimModuleSyntax: true,
|
|
30
|
+
},
|
|
31
|
+
fileName: sourceFile,
|
|
32
|
+
});
|
|
33
|
+
writeFileSync(outputPath, transpiled.outputText, "utf8");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const { DEFAULT_INTERACTIVE_AUTONOMY_POLICY, scoreMissionReadiness } = await import(pathToFileURL(join(runtimeRoot, "interactive-autonomy.js")).href);
|
|
37
|
+
|
|
38
|
+
const generatedAt = "2026-05-31T00:00:00.000Z";
|
|
39
|
+
const negativeDenylistPrompt = `Fix V3 autonomy readiness in .pi/extensions/zob-harness/src/interactive-autonomy.ts.
|
|
40
|
+
Acceptance criteria: validate with npm run check -- --pretty false and a deterministic smoke.
|
|
41
|
+
MUST NOT: Do not read .env/key files, ~/.ssh, or ~/.aws.
|
|
42
|
+
Deliver evidence and keep safety gates enabled.`;
|
|
43
|
+
const explicitEnvReadPrompt = `Fix the harness by reading .env first, then use the values to validate the runtime.`;
|
|
44
|
+
const explicitApiKeyPrompt = `Inspect and print the API key so it can be copied into the validation report.`;
|
|
45
|
+
|
|
46
|
+
const negative = scoreMissionReadiness(negativeDenylistPrompt, { mode: "adaptive", policy: DEFAULT_INTERACTIVE_AUTONOMY_POLICY, generatedAt });
|
|
47
|
+
const envRead = scoreMissionReadiness(explicitEnvReadPrompt, { mode: "adaptive", policy: DEFAULT_INTERACTIVE_AUTONOMY_POLICY, generatedAt });
|
|
48
|
+
const apiKeyRead = scoreMissionReadiness(explicitApiKeyPrompt, { mode: "adaptive", policy: DEFAULT_INTERACTIVE_AUTONOMY_POLICY, generatedAt });
|
|
49
|
+
|
|
50
|
+
const failures = [];
|
|
51
|
+
if (negative.blockerCodes.includes("secret_access_requested")) failures.push("negative denylist prompt produced secret_access_requested");
|
|
52
|
+
if (negative.decision !== "auto_launch") failures.push(`negative denylist prompt decision=${negative.decision}, expected auto_launch`);
|
|
53
|
+
if (!envRead.blockerCodes.includes("secret_access_requested") || envRead.decision !== "block") failures.push("explicit .env read was not blocked as secret_access_requested");
|
|
54
|
+
if (!apiKeyRead.blockerCodes.includes("secret_access_requested") || apiKeyRead.decision !== "block") failures.push("explicit API key print/copy was not blocked as secret_access_requested");
|
|
55
|
+
|
|
56
|
+
const summary = {
|
|
57
|
+
schema: "zob.autonomy-secret-readiness-smoke.v1",
|
|
58
|
+
generatedAt,
|
|
59
|
+
cases: {
|
|
60
|
+
negativeDenylist: {
|
|
61
|
+
decision: negative.decision,
|
|
62
|
+
verdict: negative.verdict,
|
|
63
|
+
blockerCodes: negative.blockerCodes,
|
|
64
|
+
noShip: negative.noShip,
|
|
65
|
+
},
|
|
66
|
+
explicitEnvRead: {
|
|
67
|
+
decision: envRead.decision,
|
|
68
|
+
verdict: envRead.verdict,
|
|
69
|
+
blockerCodes: envRead.blockerCodes,
|
|
70
|
+
noShip: envRead.noShip,
|
|
71
|
+
},
|
|
72
|
+
explicitApiKeyRead: {
|
|
73
|
+
decision: apiKeyRead.decision,
|
|
74
|
+
verdict: apiKeyRead.verdict,
|
|
75
|
+
blockerCodes: apiKeyRead.blockerCodes,
|
|
76
|
+
noShip: apiKeyRead.noShip,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
passed: failures.length === 0,
|
|
80
|
+
failures,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
writeFileSync(join(runtimeRoot, "mission-readiness-secret-smoke.json"), `${JSON.stringify(summary, null, 2)}\n`, "utf8");
|
|
84
|
+
|
|
85
|
+
if (failures.length > 0) {
|
|
86
|
+
console.error(JSON.stringify(summary, null, 2));
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { dirname, relative, resolve } from "node:path";
|
|
5
|
+
|
|
6
|
+
const repoRoot = process.cwd();
|
|
7
|
+
const profiles = new Set(["low", "medium", "high", "xhigh", "max"]);
|
|
8
|
+
const lanes = {
|
|
9
|
+
low: [{ id: "deterministic_preview", agent: "agent", maxWorkers: 1, tools: ["read", "grep", "find", "ls"], outputContract: "metadata.v1", validation: "narrow" }],
|
|
10
|
+
medium: [{ id: "deterministic_preview", agent: "agent", maxWorkers: 1, tools: ["read", "grep", "find", "ls"], outputContract: "metadata.v1", validation: "targeted" }, { id: "targeted_validation", agent: "qa", maxWorkers: 1, tools: ["read", "grep", "find", "ls", "bash"], outputContract: "oracle.v1", validation: "smoke" }],
|
|
11
|
+
high: [{ id: "architecture", agent: "explore", maxWorkers: 2, tools: ["read", "grep", "find", "ls"], outputContract: "explore.v1", validation: "cited" }, { id: "implementation", agent: "implementer", maxWorkers: 2, tools: ["read", "grep", "find", "ls"], outputContract: "implement.v1", validation: "full_local" }, { id: "validation", agent: "oracle", maxWorkers: 1, tools: ["read", "grep", "find", "ls", "bash"], outputContract: "oracle.v1", validation: "required" }],
|
|
12
|
+
xhigh: [{ id: "architecture", agent: "explore", maxWorkers: 3, tools: ["read", "grep", "find", "ls"], outputContract: "explore.v1", validation: "cited" }, { id: "safety", agent: "oracle", maxWorkers: 2, tools: ["read", "grep", "find", "ls"], outputContract: "oracle.v1", validation: "adversarial" }, { id: "implementation", agent: "implementer", maxWorkers: 4, tools: ["read", "grep", "find", "ls"], outputContract: "implement.v1", validation: "full_plus_adversarial" }, { id: "benchmark", agent: "qa", maxWorkers: 2, tools: ["read", "grep", "find", "ls", "bash"], outputContract: "qa.v1", validation: "suite" }],
|
|
13
|
+
max: [{ id: "architecture", agent: "explore", maxWorkers: 4, tools: ["read", "grep", "find", "ls"], outputContract: "explore.v1", validation: "cited" }, { id: "safety", agent: "oracle", maxWorkers: 4, tools: ["read", "grep", "find", "ls"], outputContract: "oracle.v1", validation: "multi_oracle" }, { id: "implementation", agent: "implementer", maxWorkers: 8, tools: ["read", "grep", "find", "ls"], outputContract: "implement.v1", validation: "exhaustive_within_scope" }, { id: "benchmark", agent: "qa", maxWorkers: 4, tools: ["read", "grep", "find", "ls", "bash"], outputContract: "qa.v1", validation: "suite_plus_regression" }, { id: "human_approval_packet", agent: "planner", maxWorkers: 1, tools: ["read", "grep", "find", "ls"], outputContract: "plan.v1", validation: "human_required" }],
|
|
14
|
+
};
|
|
15
|
+
function sha256(value) { return createHash("sha256").update(value).digest("hex"); }
|
|
16
|
+
function usage() { console.error("Usage: node scripts/compute-profile/plan-workflow.mjs --resolution reports/.../compute-profile-resolution.json --out reports/.../compute-workflow-shape.json"); }
|
|
17
|
+
function parseArgs(argv) {
|
|
18
|
+
const out = {};
|
|
19
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
20
|
+
if (argv[i] === "--resolution") out.resolution = argv[++i];
|
|
21
|
+
else if (argv[i] === "--out") out.out = argv[++i];
|
|
22
|
+
else if (argv[i] === "--help" || argv[i] === "-h") { usage(); process.exit(0); }
|
|
23
|
+
else throw new Error(`unknown argument: ${argv[i]}`);
|
|
24
|
+
}
|
|
25
|
+
if (!out.resolution || !out.out) throw new Error("--resolution and --out are required");
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
function repoPath(path) {
|
|
29
|
+
const resolved = resolve(repoRoot, path);
|
|
30
|
+
const root = resolve(repoRoot);
|
|
31
|
+
if (resolved !== root && !resolved.startsWith(`${root}/`)) throw new Error(`path must stay inside repo: ${path}`);
|
|
32
|
+
return resolved;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const args = parseArgs(process.argv.slice(2));
|
|
36
|
+
const resolutionPath = repoPath(args.resolution);
|
|
37
|
+
if (!existsSync(resolutionPath)) throw new Error(`missing resolution: ${args.resolution}`);
|
|
38
|
+
const resolution = JSON.parse(readFileSync(resolutionPath, "utf8"));
|
|
39
|
+
const profile = profiles.has(resolution.effectiveProfile) ? resolution.effectiveProfile : "low";
|
|
40
|
+
const caps = resolution.caps || {};
|
|
41
|
+
const maxAgents = typeof caps.maxAgents === "number" ? caps.maxAgents : 1;
|
|
42
|
+
const maxParallel = typeof caps.maxParallel === "number" ? caps.maxParallel : 1;
|
|
43
|
+
const plannedLanes = lanes[profile].map((lane) => ({ ...lane, maxWorkers: Math.min(lane.maxWorkers, maxAgents, maxParallel), parentOwnedDispatch: true, childDirectDispatch: false }));
|
|
44
|
+
const highScale = profile === 'max' || maxAgents > 20;
|
|
45
|
+
const maxAgentsPerWave = Math.max(1, Math.min(maxParallel, maxAgents));
|
|
46
|
+
const shape = {
|
|
47
|
+
schema: "zob.compute-workflow-shape.v1",
|
|
48
|
+
runId: resolution.runId,
|
|
49
|
+
domain: resolution.domain,
|
|
50
|
+
requestedProfile: resolution.requestedProfile,
|
|
51
|
+
effectiveProfile: profile,
|
|
52
|
+
resolutionHash: sha256(JSON.stringify(resolution)),
|
|
53
|
+
resolutionEmbedded: false,
|
|
54
|
+
caps: { maxAgents, maxDelegationDepth: caps.maxDelegationDepth, maxParallel, maxIterations: caps.maxIterations, maxDurationMs: caps.maxDurationMs, maxContextTokens: caps.maxContextTokens },
|
|
55
|
+
lanes: plannedLanes,
|
|
56
|
+
promptPolicy: { schema: 'zob.adaptive-prompt-policy-hint.v1', rootCanWriteDirectly: false, rootDirectWriteToolsBlocked: ['bash', 'edit', 'write'], promptStackHashRequired: true, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false },
|
|
57
|
+
modelPolicy: { schema: 'zob.adaptive-model-policy.v1', downgradePolicy: 'blocked_for_oracle_security', laneAssignments: plannedLanes.map((lane) => ({ laneId: lane.id, agent: lane.agent, outputContract: lane.outputContract, modelClass: lane.agent === 'oracle' ? 'strong_oracle' : lane.agent === 'planner' || lane.id === 'architecture' ? 'strong_reasoning' : lane.agent === 'agent' || lane.agent === 'explore' ? 'cheap_scout' : 'balanced_worker', reasonHash: sha256(JSON.stringify({ laneId: lane.id, agent: lane.agent, outputContract: lane.outputContract })) })), bodyStored: false, promptBodiesStored: false, outputBodiesStored: false },
|
|
58
|
+
scalePolicy: { schema: 'zob.adaptive-scale-policy.v1', requestedScale: highScale ? 'large' : 'default', maxTotalAgents: maxAgents, maxParallelAgents: maxParallel, maxAgentsPerWave, maxWaves: Math.max(1, Math.ceil(maxAgents / maxAgentsPerWave)), requiresBudget: caps.strictBudgetRequired === true, requiresScaleApproval: highScale, requiresOracleAfterWave: highScale || caps.oracleRequired === true, duplicateDetectionRequired: true, stalePeerBlocksCompletion: true, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false },
|
|
59
|
+
documentationPolicy: { schema: 'zob.adaptive-documentation-policy-hint.v1', required: true, rootDocs: ['AGENTS.md', 'README.md'], layerDocsRequired: true, roleDocPacksRequired: true, writebackPolicy: 'human_approval_required', maxDocsPerAgent: 12, bodyStored: false, promptBodiesStored: false, outputBodiesStored: false },
|
|
60
|
+
validationLevel: caps.validationLevel,
|
|
61
|
+
oraclePolicy: caps.oraclePolicy,
|
|
62
|
+
benchmarkLevel: caps.benchmarkLevel,
|
|
63
|
+
adaptiveDelegationPolicyHint: resolution.adaptiveDelegationPolicyHint,
|
|
64
|
+
parentOwnedDispatch: true,
|
|
65
|
+
childDirectDispatch: false,
|
|
66
|
+
liveDispatchEnabled: false,
|
|
67
|
+
noExecution: true,
|
|
68
|
+
networkAccessed: false,
|
|
69
|
+
sourceProjectModified: false,
|
|
70
|
+
bodyStored: false,
|
|
71
|
+
promptBodiesStored: false,
|
|
72
|
+
outputBodiesStored: false,
|
|
73
|
+
noShip: resolution.noShip === true,
|
|
74
|
+
blockers: Array.isArray(resolution.blockers) ? resolution.blockers : [],
|
|
75
|
+
generatedAt: new Date().toISOString(),
|
|
76
|
+
};
|
|
77
|
+
const outPath = repoPath(args.out);
|
|
78
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
79
|
+
writeFileSync(outPath, JSON.stringify(shape, null, 2), "utf8");
|
|
80
|
+
console.log(JSON.stringify({ schema: "zob.compute-workflow-shape-cli.v1", workflowShapePath: relative(repoRoot, outPath), effectiveProfile: profile, lanes: shape.lanes.length, noShip: shape.noShip }, null, 2));
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
83
|
+
usage();
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { existsSync, mkdirSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { basename, dirname, extname, relative, resolve } from "node:path";
|
|
5
|
+
|
|
6
|
+
const repoRoot = process.cwd();
|
|
7
|
+
const PROFILES = ["low", "medium", "high", "xhigh", "max"];
|
|
8
|
+
const REQUESTED = ["auto", ...PROFILES];
|
|
9
|
+
const DOMAINS = ["generic", "project-dna", "factory", "orchestration"];
|
|
10
|
+
const MAX_PREVIEW_FILES = 5000;
|
|
11
|
+
const forbiddenNames = new Set([".env", ".git", ".npmrc", ".ssh", ".aws", "node_modules", "dist", "build", "coverage", ".next", ".nuxt", "out", "vendor", "generated"]);
|
|
12
|
+
const generatedNames = new Set(["node_modules", "dist", "build", "coverage", ".next", ".nuxt", "out", "vendor", "generated"]);
|
|
13
|
+
const secretPatterns = [/\.env(?:\..*)?$/i, /secret/i, /credential/i, /(?:^|[-_])key(?:[-_.]|$)/i, /\.pem$/i, /\.p12$/i, /\.pfx$/i, /^id_rsa$/i, /^id_ed25519$/i];
|
|
14
|
+
const languageExts = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".py", ".rs", ".go", ".java", ".kt", ".cs", ".rb", ".php", ".swift", ".vue", ".svelte"]);
|
|
15
|
+
|
|
16
|
+
const defaultCaps = {
|
|
17
|
+
low: { maxAgents: 1, maxDelegationDepth: 0, maxParallel: 1, maxIterations: 1, maxDurationMs: 120000, maxCostUsd: 0.25, maxContextTokens: 3000, strictBudgetRequired: false, oracleRequired: false, validationLevel: "narrow", oraclePolicy: "off_unless_risky", benchmarkLevel: "none" },
|
|
18
|
+
medium: { maxAgents: 4, maxDelegationDepth: 1, maxParallel: 2, maxIterations: 2, maxDurationMs: 300000, maxCostUsd: 1, maxContextTokens: 6000, strictBudgetRequired: false, oracleRequired: false, validationLevel: "targeted", oraclePolicy: "conditional", benchmarkLevel: "smoke" },
|
|
19
|
+
high: { maxAgents: 10, maxDelegationDepth: 2, maxParallel: 4, maxIterations: 3, maxDurationMs: 600000, maxCostUsd: 5, maxContextTokens: 12000, strictBudgetRequired: true, oracleRequired: true, validationLevel: "full_local", oraclePolicy: "required_for_completion", benchmarkLevel: "smoke_plus_targeted_cases" },
|
|
20
|
+
xhigh: { maxAgents: 20, maxDelegationDepth: 3, maxParallel: 6, maxIterations: 4, maxDurationMs: 1200000, maxCostUsd: 15, maxContextTokens: 20000, strictBudgetRequired: true, oracleRequired: true, validationLevel: "full_plus_adversarial", oraclePolicy: "required_with_no_ship_gate", benchmarkLevel: "suite" },
|
|
21
|
+
max: { maxAgents: 30, maxDelegationDepth: 4, maxParallel: 8, maxIterations: 5, maxDurationMs: 3600000, maxCostUsd: 50, maxContextTokens: 32000, strictBudgetRequired: true, oracleRequired: true, validationLevel: "exhaustive_within_scope", oraclePolicy: "required_multiple_oracle_lanes", benchmarkLevel: "suite_plus_regression" },
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function sha256(value) { return createHash("sha256").update(value).digest("hex"); }
|
|
25
|
+
function clamp01(value) { return Number.isFinite(value) ? Math.max(0, Math.min(1, value)) : 0; }
|
|
26
|
+
function safeStem(value) { return String(value || "compute-profile").replace(/[^a-z0-9._-]+/gi, "-").replace(/^-+|-+$/g, "").slice(0, 80) || "compute-profile"; }
|
|
27
|
+
function usage() {
|
|
28
|
+
console.error(`Usage: node scripts/compute-profile/preview.mjs --domain project-dna --path .pi/factories/project-dna --requested auto --out reports/.../compute-preview.json [--resolution-out reports/.../compute-profile-resolution.json]`);
|
|
29
|
+
}
|
|
30
|
+
function parseArgs(argv) {
|
|
31
|
+
const out = { requested: "auto", domain: "generic", riskHints: [] };
|
|
32
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
33
|
+
const arg = argv[i];
|
|
34
|
+
const next = () => argv[++i];
|
|
35
|
+
if (arg === "--domain") out.domain = next();
|
|
36
|
+
else if (arg === "--path" || arg === "--target-path") out.path = next();
|
|
37
|
+
else if (arg === "--requested" || arg === "--requested-profile") out.requested = next();
|
|
38
|
+
else if (arg === "--max-profile") out.maxProfile = next();
|
|
39
|
+
else if (arg === "--task-hash") out.taskHash = next();
|
|
40
|
+
else if (arg === "--run-id") out.runId = next();
|
|
41
|
+
else if (arg === "--out") out.out = next();
|
|
42
|
+
else if (arg === "--resolution-out") out.resolutionOut = next();
|
|
43
|
+
else if (arg === "--risk-hint") out.riskHints.push(next());
|
|
44
|
+
else if (arg === "--help" || arg === "-h") { usage(); process.exit(0); }
|
|
45
|
+
else throw new Error(`unknown argument: ${arg}`);
|
|
46
|
+
}
|
|
47
|
+
if (!out.out) throw new Error("--out is required");
|
|
48
|
+
if (!out.path) out.path = ".";
|
|
49
|
+
out.domain = DOMAINS.includes(out.domain) ? out.domain : "generic";
|
|
50
|
+
out.requested = REQUESTED.includes(out.requested) ? out.requested : "auto";
|
|
51
|
+
out.maxProfile = PROFILES.includes(out.maxProfile) ? out.maxProfile : undefined;
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
function insideRepo(requestedPath) {
|
|
55
|
+
const resolved = resolve(repoRoot, requestedPath);
|
|
56
|
+
const root = resolve(repoRoot);
|
|
57
|
+
return { resolved, errors: resolved === root || resolved.startsWith(`${root}/`) ? [] : [`Path must stay inside repo root: ${requestedPath}`] };
|
|
58
|
+
}
|
|
59
|
+
function forbidden(name) { return forbiddenNames.has(name) || secretPatterns.some((pattern) => pattern.test(name)); }
|
|
60
|
+
function isTest(file) { return /(^|\/)(__tests__|test|tests|spec)(\/|$)/i.test(file) || /\.(test|spec)\.[cm]?[tj]sx?$/i.test(file); }
|
|
61
|
+
function isDocs(file) { return /(^|\/)(docs?|documentation)(\/|$)/i.test(file) || /(^|\/)(readme|architecture|design|guide)[^/]*\.md$/i.test(file); }
|
|
62
|
+
function isExample(file) { return /(^|\/)(examples?|samples?)(\/|$)/i.test(file); }
|
|
63
|
+
function isConfig(file) { return /(^|\/)(package\.json|tsconfig\.json|vite\.config\.|next\.config\.|eslint\.|prettier\.|tailwind\.|factory\.json|.*\.schema\.json)$/i.test(file); }
|
|
64
|
+
function emptyStats(exists, kind, errors = []) {
|
|
65
|
+
return { exists, targetKind: kind, fileCount: 0, directoryCount: 0, skippedCount: 0, totalBytesEstimate: 0, extensionCounts: {}, languageCount: 0, packageManifestCount: 0, workspaceIndicatorCount: 0, testFileCount: 0, docsFileCount: 0, exampleFileCount: 0, configFileCount: 0, forbiddenVisibleCount: 0, generatedVendorSkippedCount: 0, maxFilesReached: false, errors };
|
|
66
|
+
}
|
|
67
|
+
function collectStats(targetPath) {
|
|
68
|
+
const checked = insideRepo(targetPath);
|
|
69
|
+
if (checked.errors.length) return emptyStats(false, "missing", checked.errors);
|
|
70
|
+
if (!existsSync(checked.resolved)) return emptyStats(false, "missing", [`target_path does not exist: ${targetPath}`]);
|
|
71
|
+
const root = resolve(repoRoot);
|
|
72
|
+
const stats = emptyStats(true, checked.resolved === root ? "repo" : "repo_path");
|
|
73
|
+
const targetBase = basename(checked.resolved);
|
|
74
|
+
if (forbidden(targetBase)) {
|
|
75
|
+
stats.skippedCount += 1;
|
|
76
|
+
stats.forbiddenVisibleCount += 1;
|
|
77
|
+
stats.errors.push(`target_path is forbidden and was not scanned: ${targetBase}`);
|
|
78
|
+
return stats;
|
|
79
|
+
}
|
|
80
|
+
function visit(dir) {
|
|
81
|
+
if (stats.fileCount >= MAX_PREVIEW_FILES) { stats.maxFilesReached = true; return; }
|
|
82
|
+
let entries;
|
|
83
|
+
try { entries = readdirSync(dir, { withFileTypes: true }); }
|
|
84
|
+
catch (error) { stats.errors.push(`could not read directory metadata: ${relative(root, dir) || "."}: ${error.message}`); return; }
|
|
85
|
+
for (const entry of entries) {
|
|
86
|
+
if (stats.fileCount >= MAX_PREVIEW_FILES) { stats.maxFilesReached = true; return; }
|
|
87
|
+
const abs = resolve(dir, entry.name);
|
|
88
|
+
const rel = relative(root, abs).replace(/\\/g, "/");
|
|
89
|
+
if (forbidden(entry.name)) {
|
|
90
|
+
stats.skippedCount += 1;
|
|
91
|
+
stats.forbiddenVisibleCount += 1;
|
|
92
|
+
if (generatedNames.has(entry.name)) stats.generatedVendorSkippedCount += 1;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (entry.isDirectory()) { stats.directoryCount += 1; visit(abs); continue; }
|
|
96
|
+
if (!entry.isFile()) continue;
|
|
97
|
+
stats.fileCount += 1;
|
|
98
|
+
try { stats.totalBytesEstimate += statSync(abs).size; } catch {}
|
|
99
|
+
const ext = extname(entry.name).toLowerCase() || "[no-ext]";
|
|
100
|
+
stats.extensionCounts[ext] = (stats.extensionCounts[ext] || 0) + 1;
|
|
101
|
+
if (entry.name === "package.json") stats.packageManifestCount += 1;
|
|
102
|
+
if (["pnpm-workspace.yaml", "lerna.json", "turbo.json", "nx.json"].includes(entry.name)) stats.workspaceIndicatorCount += 1;
|
|
103
|
+
if (isTest(rel)) stats.testFileCount += 1;
|
|
104
|
+
if (isDocs(rel)) stats.docsFileCount += 1;
|
|
105
|
+
if (isExample(rel)) stats.exampleFileCount += 1;
|
|
106
|
+
if (isConfig(rel)) stats.configFileCount += 1;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const stat = statSync(checked.resolved);
|
|
110
|
+
if (stat.isDirectory()) visit(checked.resolved);
|
|
111
|
+
else if (stat.isFile()) {
|
|
112
|
+
stats.fileCount = 1;
|
|
113
|
+
stats.totalBytesEstimate = stat.size;
|
|
114
|
+
stats.extensionCounts[extname(checked.resolved).toLowerCase() || "[no-ext]"] = 1;
|
|
115
|
+
}
|
|
116
|
+
stats.languageCount = Object.keys(stats.extensionCounts).filter((ext) => languageExts.has(ext)).length;
|
|
117
|
+
return stats;
|
|
118
|
+
}
|
|
119
|
+
function score(stats, args) {
|
|
120
|
+
const sourceFiles = Object.entries(stats.extensionCounts).filter(([ext]) => languageExts.has(ext)).reduce((sum, [, count]) => sum + count, 0);
|
|
121
|
+
const sourceFileRatio = stats.fileCount > 0 ? sourceFiles / stats.fileCount : 0;
|
|
122
|
+
const hints = new Set(args.riskHints.map((hint) => hint.toLowerCase()));
|
|
123
|
+
const domainBoost = args.domain === "project-dna" ? 0.15 : 0;
|
|
124
|
+
const size = clamp01((stats.fileCount / 1000) * 0.35 + (stats.packageManifestCount / 20) * 0.25 + (stats.languageCount / 8) * 0.15 + (stats.totalBytesEstimate / 50000000) * 0.25);
|
|
125
|
+
const material = clamp01(sourceFileRatio * 0.25 + Math.min(stats.testFileCount, 50) / 50 * 0.25 + Math.min(stats.docsFileCount, 25) / 25 * 0.15 + Math.min(stats.packageManifestCount, 5) / 5 * 0.15 + Math.min(stats.exampleFileCount, 20) / 20 * 0.10 + Math.min(stats.configFileCount, 20) / 20 * 0.10);
|
|
126
|
+
const complexity = clamp01((stats.packageManifestCount / 10) * 0.30 + (stats.workspaceIndicatorCount / 4) * 0.20 + (stats.languageCount / 8) * 0.25 + (stats.configFileCount / 30) * 0.25);
|
|
127
|
+
const ambiguity = clamp01(args.taskHash ? 0.15 : 0.30);
|
|
128
|
+
const risk = clamp01((stats.forbiddenVisibleCount > 0 ? 0.20 : 0) + (hints.has("write") || hints.has("apply") ? 0.25 : 0) + (hints.has("network") || hints.has("browser") || hints.has("cloud") ? 0.15 : 0) + (hints.has("promotion") || hints.has("durable") ? 0.20 : 0) + (stats.errors.length > 0 ? 0.10 : 0));
|
|
129
|
+
const novelty = clamp01(args.domain === "generic" ? 0.35 : 0.45 + domainBoost);
|
|
130
|
+
const reuseValue = clamp01((args.domain === "project-dna" || args.domain === "factory" || args.domain === "orchestration" ? 0.55 : 0.30) + domainBoost + Math.min(stats.packageManifestCount, 5) / 5 * 0.20 + Math.min(stats.docsFileCount, 10) / 10 * 0.10);
|
|
131
|
+
const validationNeed = clamp01(Math.max(complexity, risk) * 0.7 + material * 0.3);
|
|
132
|
+
return { size, material, complexity, ambiguity, risk, novelty, reuseValue, validationNeed };
|
|
133
|
+
}
|
|
134
|
+
function recommend(scores, stats) {
|
|
135
|
+
const qualityNeed = Math.max(scores.complexity, scores.ambiguity, scores.reuseValue, scores.validationNeed);
|
|
136
|
+
const computeWorth = scores.material * scores.reuseValue;
|
|
137
|
+
if (stats.errors.length > 0 && scores.material < 0.15) return "low";
|
|
138
|
+
if (qualityNeed > 0.85 && computeWorth > 0.75) return "xhigh";
|
|
139
|
+
if (qualityNeed > 0.65 && computeWorth > 0.55) return "high";
|
|
140
|
+
if (qualityNeed > 0.35 || stats.fileCount > 25) return "medium";
|
|
141
|
+
return "low";
|
|
142
|
+
}
|
|
143
|
+
function reasons(stats, scores, domain) {
|
|
144
|
+
const out = [];
|
|
145
|
+
if (domain !== "generic") out.push(`${domain}_domain`);
|
|
146
|
+
if (stats.fileCount >= 500) out.push("large_file_count"); else if (stats.fileCount >= 100) out.push("medium_file_count");
|
|
147
|
+
if (stats.packageManifestCount > 1) out.push("multiple_package_manifests");
|
|
148
|
+
if (stats.workspaceIndicatorCount > 0) out.push("workspace_indicators_present");
|
|
149
|
+
if (stats.testFileCount > 0) out.push("tests_present");
|
|
150
|
+
if (stats.docsFileCount > 0) out.push("docs_present");
|
|
151
|
+
if (stats.forbiddenVisibleCount > 0) out.push("forbidden_paths_visible_but_skipped");
|
|
152
|
+
if (stats.maxFilesReached) out.push("preview_file_cap_reached");
|
|
153
|
+
if (scores.reuseValue >= 0.7) out.push("high_reuse_value");
|
|
154
|
+
if (scores.complexity >= 0.65) out.push("high_complexity");
|
|
155
|
+
return out.length ? out : ["small_or_low_signal_target"];
|
|
156
|
+
}
|
|
157
|
+
function capProfile(profile, maxProfile) {
|
|
158
|
+
if (!maxProfile) return profile;
|
|
159
|
+
return PROFILES[Math.min(PROFILES.indexOf(profile), PROFILES.indexOf(maxProfile))] || profile;
|
|
160
|
+
}
|
|
161
|
+
function adaptivePolicyHint(profile) {
|
|
162
|
+
const depth = { low: 0, medium: 1, high: 2, xhigh: 3, max: 4 }[profile];
|
|
163
|
+
const parallel = { low: 1, medium: 2, high: 4, xhigh: 6, max: 8 }[profile];
|
|
164
|
+
return { schema: "zob.compute-adaptive-policy-hint.v1", profile, enabledByDefault: false, advisoryOnly: profile === "low" || profile === "medium", supervisedReadonlyEligible: profile === "high" || profile === "xhigh" || profile === "max", runtimeMaxDepthHint: depth, globalParallelMaxHint: parallel, parentOwnedDispatch: true, childDirectDispatch: false, liveDispatchEnabled: false, noExecution: true };
|
|
165
|
+
}
|
|
166
|
+
function build(args) {
|
|
167
|
+
const stats = collectStats(args.path);
|
|
168
|
+
const scores = score(stats, args);
|
|
169
|
+
const recommended = recommend(scores, stats);
|
|
170
|
+
const noShip = !stats.exists || stats.errors.length > 0;
|
|
171
|
+
const preview = {
|
|
172
|
+
schema: "zob.compute-preview.v1",
|
|
173
|
+
runId: args.runId,
|
|
174
|
+
domain: args.domain,
|
|
175
|
+
requestedProfile: args.requested,
|
|
176
|
+
recommendedProfile: recommended,
|
|
177
|
+
confidence: stats.errors.length || stats.maxFilesReached ? "medium" : "high",
|
|
178
|
+
scores,
|
|
179
|
+
reasonCodes: reasons(stats, scores, args.domain),
|
|
180
|
+
target: { targetKind: stats.targetKind, targetPathHash: sha256(args.path || "."), targetPathStored: false, targetBasename: basename(args.path || repoRoot), exists: stats.exists },
|
|
181
|
+
stats: { ...stats, errors: undefined },
|
|
182
|
+
blockers: noShip ? ["preview_metadata_errors_present"] : [],
|
|
183
|
+
errors: stats.errors,
|
|
184
|
+
noShip,
|
|
185
|
+
noExecution: true,
|
|
186
|
+
childDispatchAllowed: false,
|
|
187
|
+
networkAccessed: false,
|
|
188
|
+
sourceProjectModified: false,
|
|
189
|
+
knowledgeBackendWriteEnabled: false,
|
|
190
|
+
bodyStored: false,
|
|
191
|
+
promptBodiesStored: false,
|
|
192
|
+
outputBodiesStored: false,
|
|
193
|
+
generatedAt: new Date().toISOString(),
|
|
194
|
+
};
|
|
195
|
+
const requestedEffective = args.requested === "auto" ? recommended : args.requested;
|
|
196
|
+
const effectiveProfile = args.requested === "auto" && recommended === "max" ? capProfile("xhigh", args.maxProfile) : capProfile(requestedEffective, args.maxProfile);
|
|
197
|
+
const resolution = {
|
|
198
|
+
schema: "zob.compute-profile-resolution.v1",
|
|
199
|
+
runId: args.runId,
|
|
200
|
+
domain: args.domain,
|
|
201
|
+
requestedProfile: args.requested,
|
|
202
|
+
recommendedProfile: recommended,
|
|
203
|
+
effectiveProfile,
|
|
204
|
+
confidence: preview.confidence,
|
|
205
|
+
reasonCodes: preview.reasonCodes,
|
|
206
|
+
previewHash: sha256(JSON.stringify(preview)),
|
|
207
|
+
previewEmbedded: false,
|
|
208
|
+
caps: defaultCaps[effectiveProfile],
|
|
209
|
+
gates: { strictBudgetRequired: defaultCaps[effectiveProfile].strictBudgetRequired, oracleRequired: defaultCaps[effectiveProfile].oracleRequired, humanApprovalRequired: effectiveProfile === "max", sandboxRequiredForWrites: true, parentOwnedDispatch: true, childDirectDispatch: false },
|
|
210
|
+
adaptiveDelegationPolicyHint: adaptivePolicyHint(effectiveProfile),
|
|
211
|
+
noShip,
|
|
212
|
+
blockers: preview.blockers,
|
|
213
|
+
noExecution: true,
|
|
214
|
+
childDispatchAllowed: false,
|
|
215
|
+
networkAccessed: false,
|
|
216
|
+
sourceProjectModified: false,
|
|
217
|
+
knowledgeBackendWriteEnabled: false,
|
|
218
|
+
bodyStored: false,
|
|
219
|
+
promptBodiesStored: false,
|
|
220
|
+
outputBodiesStored: false,
|
|
221
|
+
generatedAt: new Date().toISOString(),
|
|
222
|
+
};
|
|
223
|
+
return { preview, resolution };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
try {
|
|
227
|
+
const args = parseArgs(process.argv.slice(2));
|
|
228
|
+
if (!args.runId) args.runId = safeStem(`${args.domain}-${args.requested}-preview`);
|
|
229
|
+
const { preview, resolution } = build(args);
|
|
230
|
+
mkdirSync(dirname(resolve(repoRoot, args.out)), { recursive: true });
|
|
231
|
+
writeFileSync(resolve(repoRoot, args.out), JSON.stringify(preview, null, 2), "utf8");
|
|
232
|
+
if (args.resolutionOut) {
|
|
233
|
+
mkdirSync(dirname(resolve(repoRoot, args.resolutionOut)), { recursive: true });
|
|
234
|
+
writeFileSync(resolve(repoRoot, args.resolutionOut), JSON.stringify(resolution, null, 2), "utf8");
|
|
235
|
+
}
|
|
236
|
+
console.log(JSON.stringify({ schema: "zob.compute-profile-preview-cli.v1", previewPath: relative(repoRoot, resolve(repoRoot, args.out)), resolutionPath: args.resolutionOut ? relative(repoRoot, resolve(repoRoot, args.resolutionOut)) : undefined, recommendedProfile: preview.recommendedProfile, effectiveProfile: resolution.effectiveProfile, noShip: preview.noShip }, null, 2));
|
|
237
|
+
if (preview.noShip) process.exitCode = 1;
|
|
238
|
+
} catch (error) {
|
|
239
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
240
|
+
usage();
|
|
241
|
+
process.exit(1);
|
|
242
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
const repoRoot = process.cwd();
|
|
6
|
+
const profiles = ["low", "medium", "high", "xhigh", "max"];
|
|
7
|
+
const defaults = JSON.parse(readFileSync(join(repoRoot, ".pi/compute-profiles/defaults.json"), "utf8"));
|
|
8
|
+
const errors = [];
|
|
9
|
+
for (const profile of profiles) {
|
|
10
|
+
const caps = defaults.profiles?.[profile];
|
|
11
|
+
if (!caps) {
|
|
12
|
+
errors.push(`missing caps for ${profile}`);
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (caps.maxAgents > defaults.hardCaps.maxAgents) errors.push(`${profile} maxAgents exceeds hard cap`);
|
|
16
|
+
if (caps.maxDelegationDepth > defaults.hardCaps.maxDelegationDepth) errors.push(`${profile} maxDelegationDepth exceeds hard cap`);
|
|
17
|
+
if (caps.maxParallel > defaults.hardCaps.maxParallel) errors.push(`${profile} maxParallel exceeds hard cap`);
|
|
18
|
+
if (profile === "low" && caps.maxAgents !== 1) errors.push("low must remain single-agent");
|
|
19
|
+
if ((profile === "high" || profile === "xhigh" || profile === "max") && caps.oracleRequired !== true) errors.push(`${profile} must require oracle`);
|
|
20
|
+
if ((profile === "xhigh" || profile === "max") && caps.strictBudgetRequired !== true) errors.push(`${profile} must require strict budget`);
|
|
21
|
+
if (profile === "max" && caps.humanApprovalRequired !== true) errors.push("max must require human approval");
|
|
22
|
+
}
|
|
23
|
+
if (defaults.parentOwnedDispatch !== true) errors.push("parentOwnedDispatch must be true");
|
|
24
|
+
if (defaults.childDirectDispatch !== false) errors.push("childDirectDispatch must be false");
|
|
25
|
+
const result = {
|
|
26
|
+
schema: "zob.compute-profile-regression-smoke.v1",
|
|
27
|
+
valid: errors.length === 0,
|
|
28
|
+
profilesChecked: profiles,
|
|
29
|
+
errors,
|
|
30
|
+
maxApprovalGated: defaults.profiles.max?.humanApprovalRequired === true,
|
|
31
|
+
parentOwnedDispatch: defaults.parentOwnedDispatch === true,
|
|
32
|
+
childDirectDispatch: defaults.childDirectDispatch === false ? false : true,
|
|
33
|
+
noExecution: true,
|
|
34
|
+
networkAccessed: false,
|
|
35
|
+
bodyStored: false
|
|
36
|
+
};
|
|
37
|
+
console.log(JSON.stringify(result, null, 2));
|
|
38
|
+
if (errors.length > 0) process.exit(1);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, relative, resolve } from "node:path";
|
|
4
|
+
|
|
5
|
+
const repoRoot = process.cwd();
|
|
6
|
+
function usage() { console.error("Usage: node scripts/compute-profile/summarize.mjs --resolution reports/.../compute-profile-resolution.json --workflow reports/.../compute-workflow-shape.json --out reports/.../compute-mission-control-summary.json"); }
|
|
7
|
+
function parseArgs(argv) {
|
|
8
|
+
const out = {};
|
|
9
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
10
|
+
if (argv[i] === "--resolution") out.resolution = argv[++i];
|
|
11
|
+
else if (argv[i] === "--workflow") out.workflow = argv[++i];
|
|
12
|
+
else if (argv[i] === "--out") out.out = argv[++i];
|
|
13
|
+
else if (argv[i] === "--help" || argv[i] === "-h") { usage(); process.exit(0); }
|
|
14
|
+
else throw new Error(`unknown argument: ${argv[i]}`);
|
|
15
|
+
}
|
|
16
|
+
if (!out.resolution || !out.workflow || !out.out) throw new Error("--resolution, --workflow, and --out are required");
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
function repoPath(path) {
|
|
20
|
+
const resolved = resolve(repoRoot, path);
|
|
21
|
+
const root = resolve(repoRoot);
|
|
22
|
+
if (resolved !== root && !resolved.startsWith(`${root}/`)) throw new Error(`path must stay inside repo: ${path}`);
|
|
23
|
+
return resolved;
|
|
24
|
+
}
|
|
25
|
+
function readJson(path) {
|
|
26
|
+
const resolved = repoPath(path);
|
|
27
|
+
if (!existsSync(resolved)) throw new Error(`missing artifact: ${path}`);
|
|
28
|
+
return JSON.parse(readFileSync(resolved, "utf8"));
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const args = parseArgs(process.argv.slice(2));
|
|
32
|
+
const resolution = readJson(args.resolution);
|
|
33
|
+
const workflow = readJson(args.workflow);
|
|
34
|
+
const summary = {
|
|
35
|
+
schema: "zob.compute-mission-control-summary.v1",
|
|
36
|
+
runId: resolution.runId,
|
|
37
|
+
domain: resolution.domain,
|
|
38
|
+
requestedProfile: resolution.requestedProfile,
|
|
39
|
+
recommendedProfile: resolution.recommendedProfile,
|
|
40
|
+
effectiveProfile: resolution.effectiveProfile,
|
|
41
|
+
caps: resolution.caps,
|
|
42
|
+
gates: resolution.gates,
|
|
43
|
+
workflow: {
|
|
44
|
+
laneCount: Array.isArray(workflow.lanes) ? workflow.lanes.length : 0,
|
|
45
|
+
laneIds: Array.isArray(workflow.lanes) ? workflow.lanes.map((lane) => lane.id).filter(Boolean) : [],
|
|
46
|
+
parentOwnedDispatch: workflow.parentOwnedDispatch === true,
|
|
47
|
+
childDirectDispatch: workflow.childDirectDispatch === true,
|
|
48
|
+
liveDispatchEnabled: workflow.liveDispatchEnabled === true,
|
|
49
|
+
noExecution: workflow.noExecution === true
|
|
50
|
+
},
|
|
51
|
+
noShip: resolution.noShip === true || workflow.noShip === true,
|
|
52
|
+
blockers: [...new Set([...(resolution.blockers || []), ...(workflow.blockers || [])])],
|
|
53
|
+
uiReadyMetadataOnly: true,
|
|
54
|
+
fullHudWidgetWiringImplemented: false,
|
|
55
|
+
fullHudWidgetWiringBlocker: "runtime TUI/HUD rendering is intentionally left as a future UI slice; this summary provides body-free Mission Control-compatible metadata now",
|
|
56
|
+
bodyStored: false,
|
|
57
|
+
promptBodiesStored: false,
|
|
58
|
+
outputBodiesStored: false,
|
|
59
|
+
networkAccessed: false,
|
|
60
|
+
childDispatchAllowed: false,
|
|
61
|
+
generatedAt: new Date().toISOString()
|
|
62
|
+
};
|
|
63
|
+
const outPath = repoPath(args.out);
|
|
64
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
65
|
+
writeFileSync(outPath, JSON.stringify(summary, null, 2), "utf8");
|
|
66
|
+
console.log(JSON.stringify({ schema: "zob.compute-summary-cli.v1", summaryPath: relative(repoRoot, outPath), effectiveProfile: summary.effectiveProfile, noShip: summary.noShip }, null, 2));
|
|
67
|
+
if (summary.noShip) process.exitCode = 1;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
70
|
+
usage();
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
const repoRoot = process.cwd();
|
|
6
|
+
const files = {
|
|
7
|
+
defaults: ".pi/compute-profiles/defaults.json",
|
|
8
|
+
overrides: ".pi/compute-profiles/overrides.json",
|
|
9
|
+
riskRules: ".pi/compute-profiles/risk-rules.json",
|
|
10
|
+
};
|
|
11
|
+
const profiles = ["low", "medium", "high", "xhigh", "max"];
|
|
12
|
+
function readJson(path) {
|
|
13
|
+
const full = join(repoRoot, path);
|
|
14
|
+
if (!existsSync(full)) throw new Error(`missing ${path}`);
|
|
15
|
+
return JSON.parse(readFileSync(full, "utf8"));
|
|
16
|
+
}
|
|
17
|
+
const errors = [];
|
|
18
|
+
let defaults;
|
|
19
|
+
let overrides;
|
|
20
|
+
let riskRules;
|
|
21
|
+
try { defaults = readJson(files.defaults); } catch (error) { errors.push(error.message); }
|
|
22
|
+
try { overrides = readJson(files.overrides); } catch (error) { errors.push(error.message); }
|
|
23
|
+
try { riskRules = readJson(files.riskRules); } catch (error) { errors.push(error.message); }
|
|
24
|
+
if (defaults) {
|
|
25
|
+
if (defaults.schema !== "zob.compute-profile-defaults.v1") errors.push("defaults schema mismatch");
|
|
26
|
+
for (const profile of profiles) {
|
|
27
|
+
const entry = defaults.profiles?.[profile];
|
|
28
|
+
if (!entry) errors.push(`missing profile ${profile}`);
|
|
29
|
+
if (entry?.maxAgents > defaults.hardCaps?.maxAgents) errors.push(`${profile} maxAgents exceeds hard cap`);
|
|
30
|
+
if (entry?.maxDelegationDepth > defaults.hardCaps?.maxDelegationDepth) errors.push(`${profile} maxDelegationDepth exceeds hard cap`);
|
|
31
|
+
if (entry?.maxParallel > defaults.hardCaps?.maxParallel) errors.push(`${profile} maxParallel exceeds hard cap`);
|
|
32
|
+
}
|
|
33
|
+
if (defaults.profiles?.max?.humanApprovalRequired !== true) errors.push("max profile must require human approval");
|
|
34
|
+
if (defaults.childDirectDispatch !== false) errors.push("defaults childDirectDispatch must be false");
|
|
35
|
+
if (defaults.bodyStored !== false) errors.push("defaults bodyStored must be false");
|
|
36
|
+
}
|
|
37
|
+
if (overrides) {
|
|
38
|
+
if (overrides.schema !== "zob.compute-profile-overrides.v1") errors.push("overrides schema mismatch");
|
|
39
|
+
if (overrides.maxRequiresHumanApproval !== true) errors.push("overrides must keep maxRequiresHumanApproval=true");
|
|
40
|
+
if (overrides.bodyStored !== false) errors.push("overrides bodyStored must be false");
|
|
41
|
+
}
|
|
42
|
+
if (riskRules) {
|
|
43
|
+
if (riskRules.schema !== "zob.compute-profile-risk-rules.v1") errors.push("risk rules schema mismatch");
|
|
44
|
+
if (!riskRules.secretPatterns?.includes(".env")) errors.push("risk rules must include .env secret pattern");
|
|
45
|
+
if (riskRules.childDirectDispatch !== false) errors.push("risk rules childDirectDispatch must be false");
|
|
46
|
+
if (riskRules.bodyStored !== false) errors.push("risk rules bodyStored must be false");
|
|
47
|
+
}
|
|
48
|
+
const result = { schema: "zob.compute-profile-policy-validation.v1", valid: errors.length === 0, errors, files, noExecution: true, childDispatchAllowed: false, networkAccessed: false, bodyStored: false };
|
|
49
|
+
console.log(JSON.stringify(result, null, 2));
|
|
50
|
+
if (errors.length > 0) process.exit(1);
|