sneakoscope 4.8.6 → 5.1.2
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/README.md +51 -726
- package/bench/tasks/t01-off-by-one/repo/package.json +9 -0
- package/bench/tasks/t01-off-by-one/repo/src/pagination.js +5 -0
- package/bench/tasks/t01-off-by-one/repo/test.js +5 -0
- package/bench/tasks/t01-off-by-one/task.json +13 -0
- package/bench/tasks/t02-signature-cochange/repo/package.json +9 -0
- package/bench/tasks/t02-signature-cochange/repo/src/admin.js +5 -0
- package/bench/tasks/t02-signature-cochange/repo/src/audit.js +5 -0
- package/bench/tasks/t02-signature-cochange/repo/src/labels.js +3 -0
- package/bench/tasks/t02-signature-cochange/repo/src/profile.js +5 -0
- package/bench/tasks/t02-signature-cochange/repo/test.js +9 -0
- package/bench/tasks/t02-signature-cochange/task.json +12 -0
- package/bench/tasks/t03-type-puzzle/repo/package.json +9 -0
- package/bench/tasks/t03-type-puzzle/repo/src/config.js +4 -0
- package/bench/tasks/t03-type-puzzle/repo/test.js +6 -0
- package/bench/tasks/t03-type-puzzle/task.json +13 -0
- package/bench/tasks/t04-refactor-preserve/repo/package.json +9 -0
- package/bench/tasks/t04-refactor-preserve/repo/src/cart.js +8 -0
- package/bench/tasks/t04-refactor-preserve/repo/test.js +4 -0
- package/bench/tasks/t04-refactor-preserve/task.json +12 -0
- package/bench/tasks/t05-performance/repo/package.json +9 -0
- package/bench/tasks/t05-performance/repo/src/pairs.js +9 -0
- package/bench/tasks/t05-performance/repo/test.js +11 -0
- package/bench/tasks/t05-performance/task.json +12 -0
- package/bench/tasks/t06-mistake-rule/repo/package.json +9 -0
- package/bench/tasks/t06-mistake-rule/repo/src/loader.js +6 -0
- package/bench/tasks/t06-mistake-rule/repo/test.js +7 -0
- package/bench/tasks/t06-mistake-rule/task.json +12 -0
- package/config/bench-baseline.json +7 -0
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/crates/sks-core/src/main.rs +1 -1
- package/dist/bin/install.js +35 -0
- package/dist/bin/sks.js +1 -1
- package/dist/cli/cli-theme.js +51 -0
- package/dist/cli/command-registry.js +75 -42
- package/dist/cli/help-fast.js +18 -8
- package/dist/cli/insane-search-command.js +36 -8
- package/dist/cli/install-helpers.js +147 -47
- package/dist/cli/router.js +58 -2
- package/dist/commands/codex-lb.js +6 -4
- package/dist/commands/doctor.js +146 -8
- package/dist/commands/proof.js +6 -3
- package/dist/commands/zellij-monitor-pane.js +25 -0
- package/dist/commands/zellij-slot-pane.js +39 -2
- package/dist/commands/zellij-viewport-pane.js +56 -0
- package/dist/commands/zellij.js +55 -2
- package/dist/config/skills-manifest.json +493 -0
- package/dist/core/agents/agent-conflict-graph.js +5 -0
- package/dist/core/agents/agent-lease.js +5 -0
- package/dist/core/agents/agent-ledger-schemas.js +1 -0
- package/dist/core/agents/agent-lifecycle.js +86 -35
- package/dist/core/agents/agent-orchestrator.js +287 -72
- package/dist/core/agents/agent-output-validator.js +14 -3
- package/dist/core/agents/agent-patch-queue-store.js +108 -4
- package/dist/core/agents/agent-patch-queue.js +10 -3
- package/dist/core/agents/agent-patch-schema.js +13 -0
- package/dist/core/agents/agent-proof-evidence.js +6 -1
- package/dist/core/agents/agent-runner-fake.js +40 -0
- package/dist/core/agents/agent-scheduler.js +2 -3
- package/dist/core/agents/agent-worker-pipeline.js +36 -2
- package/dist/core/agents/codex-exec-worker-adapter.js +2 -0
- package/dist/core/agents/native-cli-session-swarm.js +30 -13
- package/dist/core/agents/native-cli-worker.js +2 -1
- package/dist/core/agents/native-worker-backend-router.js +58 -1
- package/dist/core/auto-review.js +25 -4
- package/dist/core/codex/agent-config-file-repair.js +15 -2
- package/dist/core/codex/codex-config-eperm-repair.js +8 -2
- package/dist/core/codex/codex-config-guard.js +289 -0
- package/dist/core/codex/codex-config-toml.js +122 -0
- package/dist/core/codex/codex-project-config-policy.js +59 -7
- package/dist/core/codex-app/sks-menubar.js +780 -122
- package/dist/core/codex-app.js +1 -0
- package/dist/core/codex-control/codex-fake-sdk-adapter.js +6 -4
- package/dist/core/codex-control/codex-sdk-config-policy.js +2 -1
- package/dist/core/codex-control/codex-sdk-env-policy.js +1 -1
- package/dist/core/codex-control/codex-task-runner.js +32 -14
- package/dist/core/codex-control/python-codex-sdk-adapter.js +4 -1
- package/dist/core/codex-control/schemas/agent-worker-result.schema.js +12 -3
- package/dist/core/codex-hooks/codex-hook-managed-install.js +5 -0
- package/dist/core/codex-hooks/codex-hook-state-writer.js +70 -11
- package/dist/core/codex-hooks/codex-hook-trust-doctor.js +2 -2
- package/dist/core/codex-lb/codex-lb-env.js +20 -1
- package/dist/core/codex-lb/codex-lb-setup.js +2 -5
- package/dist/core/codex-native/skill-registry-ledger.js +24 -5
- package/dist/core/commands/basic-cli.js +21 -2
- package/dist/core/commands/check-command.js +37 -5
- package/dist/core/commands/command-utils.js +22 -2
- package/dist/core/commands/computer-use-command.js +62 -7
- package/dist/core/commands/db-command.js +31 -5
- package/dist/core/commands/fast-mode-command.js +39 -11
- package/dist/core/commands/gate-result-contract.js +43 -0
- package/dist/core/commands/gates-command.js +6 -1
- package/dist/core/commands/gc-command.js +29 -2
- package/dist/core/commands/goal-command.js +9 -2
- package/dist/core/commands/gx-command.js +79 -7
- package/dist/core/commands/image-ux-review-command.js +188 -13
- package/dist/core/commands/mad-db-command.js +85 -176
- package/dist/core/commands/mad-sks-command.js +248 -34
- package/dist/core/commands/menubar-command.js +146 -0
- package/dist/core/commands/naruto-command.js +64 -10
- package/dist/core/commands/pipeline-command.js +21 -2
- package/dist/core/commands/plan-command.js +76 -0
- package/dist/core/commands/ppt-command.js +159 -24
- package/dist/core/commands/qa-loop-command.js +6 -2
- package/dist/core/commands/release-command.js +55 -2
- package/dist/core/commands/research-command.js +1 -1
- package/dist/core/commands/review-command.js +217 -0
- package/dist/core/commands/route-command.js +62 -0
- package/dist/core/commands/route-success-helpers.js +59 -0
- package/dist/core/commands/run-command.js +19 -7
- package/dist/core/commands/seo-command.js +49 -1
- package/dist/core/commands/status-command.js +21 -1
- package/dist/core/commands/team-legacy-observe-command.js +221 -3
- package/dist/core/commands/ui-command.js +161 -0
- package/dist/core/commands/uninstall-command.js +312 -0
- package/dist/core/db-safety.js +7 -3
- package/dist/core/doctor/codex-startup-config-repair.js +14 -3
- package/dist/core/doctor/confirm-repair.js +27 -0
- package/dist/core/doctor/context7-mcp-repair.js +35 -7
- package/dist/core/doctor/doctor-codex-startup-repair.js +10 -3
- package/dist/core/doctor/doctor-context7-repair.js +17 -4
- package/dist/core/doctor/doctor-dirty-planner.js +27 -9
- package/dist/core/doctor/doctor-native-capability-repair.js +12 -2
- package/dist/core/doctor/doctor-readiness-matrix.js +27 -2
- package/dist/core/doctor/doctor-repair-postcheck.js +4 -0
- package/dist/core/doctor/doctor-transaction.js +21 -5
- package/dist/core/doctor/doctor-zellij-repair.js +1 -0
- package/dist/core/doctor/imagegen-repair.js +161 -0
- package/dist/core/doctor/supabase-mcp-repair.js +23 -5
- package/dist/core/feature-fixture-runner.js +2 -2
- package/dist/core/feature-fixtures.js +65 -37
- package/dist/core/feature-registry.js +106 -3
- package/dist/core/fsx.js +91 -2
- package/dist/core/hooks-runtime/skill-reconcile-preflight.js +43 -0
- package/dist/core/hooks-runtime.js +86 -46
- package/dist/core/image-ux-review/imagegen-adapter.js +48 -11
- package/dist/core/image-ux-review.js +16 -0
- package/dist/core/imagegen/imagegen-capability.js +11 -5
- package/dist/core/imagegen/require-imagegen.js +57 -0
- package/dist/core/init/skills.js +271 -14
- package/dist/core/init.js +13 -10
- package/dist/core/mad-db/mad-db-coordinator.js +96 -20
- package/dist/core/mad-db/mad-db-policy.js +12 -10
- package/dist/core/mad-sks/executors/executor-base.js +8 -2
- package/dist/core/mad-sks/executors/index.js +4 -0
- package/dist/core/mad-sks/executors/sql-plane-executor.js +194 -0
- package/dist/core/mission.js +138 -5
- package/dist/core/naruto/naruto-active-pool.js +84 -30
- package/dist/core/naruto/naruto-backpressure.js +5 -1
- package/dist/core/naruto/naruto-real-worker-child.js +10 -0
- package/dist/core/naruto/naruto-real-worker-runtime.js +9 -7
- package/dist/core/naruto/naruto-role-policy.js +3 -0
- package/dist/core/naruto/naruto-task-hints.js +10 -0
- package/dist/core/naruto/naruto-work-graph.js +8 -2
- package/dist/core/naruto/naruto-work-item.js +6 -0
- package/dist/core/naruto/resource-pressure-monitor.js +33 -15
- package/dist/core/naruto/solution-tournament.js +101 -0
- package/dist/core/permission-gates.js +30 -0
- package/dist/core/pipeline-internals/runtime-core.js +72 -222
- package/dist/core/pipeline-internals/runtime-gates.js +140 -24
- package/dist/core/ppt-review/index.js +6 -1
- package/dist/core/ppt-review/slide-imagegen-review.js +75 -10
- package/dist/core/ppt.js +70 -2
- package/dist/core/proof/auto-finalize.js +70 -11
- package/dist/core/proof/proof-schema.js +2 -0
- package/dist/core/proof/route-adapter.js +5 -1
- package/dist/core/proof/route-finalizer.js +8 -5
- package/dist/core/proof/selftest-proof-fixtures.js +18 -5
- package/dist/core/proof/validation.js +2 -0
- package/dist/core/provider/model-router.js +53 -0
- package/dist/core/questions.js +1 -1
- package/dist/core/recallpulse.js +1 -1
- package/dist/core/release/gate-manifest.js +2 -2
- package/dist/core/release/release-gate-affected-selector.js +3 -10
- package/dist/core/release/release-gate-batch-runner.js +4 -2
- package/dist/core/release/release-gate-cache-v2.js +27 -14
- package/dist/core/release/release-gate-dag.js +6 -1
- package/dist/core/release/release-gate-hermetic-env.js +10 -0
- package/dist/core/release/release-gate-node.js +3 -0
- package/dist/core/release/release-gate-resource-governor.js +1 -0
- package/dist/core/retention.js +89 -4
- package/dist/core/routes/constants.js +1 -1
- package/dist/core/routes/diagnostic-allowlist.js +55 -0
- package/dist/core/routes.js +83 -33
- package/dist/core/safety/mutation-guard.js +5 -1
- package/dist/core/skill-forge.js +9 -4
- package/dist/core/stop-gate/gate-evaluator.js +102 -0
- package/dist/core/stop-gate/stop-gate-check.js +26 -4
- package/dist/core/stop-gate/stop-gate-resolver.js +19 -3
- package/dist/core/stop-gate/stop-gate-writer.js +20 -1
- package/dist/core/team-dag.js +12 -465
- package/dist/core/team-dashboard-renderer.js +13 -94
- package/dist/core/team-live.js +68 -804
- package/dist/core/triwiki/agents-md-projector.js +184 -0
- package/dist/core/triwiki-wrongness/wrongness-schema.js +3 -1
- package/dist/core/trust-kernel/trust-kernel-schema.js +1 -0
- package/dist/core/trust-kernel/trust-report.js +1 -1
- package/dist/core/trust-kernel/trust-status.js +2 -0
- package/dist/core/ui/dashboard-html.js +111 -0
- package/dist/core/update/update-migration-state.js +383 -42
- package/dist/core/update-check.js +201 -78
- package/dist/core/verification/diff-quality.js +100 -0
- package/dist/core/verification/impact-scan.js +164 -0
- package/dist/core/verification/machine-feedback.js +146 -0
- package/dist/core/verification/mistake-rule-compiler.js +195 -0
- package/dist/core/version.js +1 -1
- package/dist/core/zellij/zellij-layout-builder.js +44 -16
- package/dist/core/zellij/zellij-monitor-renderer.js +53 -0
- package/dist/core/zellij/zellij-self-heal.js +27 -32
- package/dist/core/zellij/zellij-slot-pane-renderer.js +162 -153
- package/dist/core/zellij/zellij-slot-telemetry.js +2 -0
- package/dist/core/zellij/zellij-theme.js +67 -0
- package/dist/core/zellij/zellij-ui-mode.js +16 -0
- package/dist/core/zellij/zellij-viewport-binder.js +59 -0
- package/dist/core/zellij/zellij-worker-pane-manager.js +53 -5
- package/dist/scripts/agent-patch-swarm-gate-lib.js +2 -2
- package/dist/scripts/build-dist.js +8 -0
- package/dist/scripts/check-feature-quality.js +2 -2
- package/dist/scripts/cli-output-consistency-check.js +57 -0
- package/dist/scripts/codex-lb-fast-ui-preservation-check.js +106 -0
- package/dist/scripts/codex-lb-gpt55-fast-profile-check.js +105 -0
- package/dist/scripts/codex-lb-missing-env-regression.js +2 -3
- package/dist/scripts/codex-project-config-policy-merge-regression.js +3 -3
- package/dist/scripts/coding-bench-check.js +136 -0
- package/dist/scripts/concurrent-session-collision-check.js +67 -0
- package/dist/scripts/docs-truthfulness-check.js +1 -1
- package/dist/scripts/doctor-imagegen-repair-check.js +62 -0
- package/dist/scripts/ensure-bin-executable.js +11 -3
- package/dist/scripts/gate-policy-audit-check.js +130 -0
- package/dist/scripts/harness-benchmark-check.js +104 -0
- package/dist/scripts/hook-latency-budget-check.js +45 -0
- package/dist/scripts/legacy-update-e2e-check.js +228 -0
- package/dist/scripts/lib/codex-sdk-gate-lib.js +2 -2
- package/dist/scripts/lib/real-codex-parallel-gate.js +2 -2
- package/dist/scripts/loop-directive-check-lib.js +1 -1
- package/dist/scripts/mad-db-command-check.js +11 -8
- package/dist/scripts/mad-db-real-supabase-e2e.js +2 -2
- package/dist/scripts/mad-db-route-identity-check.js +8 -6
- package/dist/scripts/mad-db-safety-conflict-matrix-check.js +31 -8
- package/dist/scripts/mad-db-skill-policy-snapshot-check.js +4 -5
- package/dist/scripts/mad-sks-zellij-default-pane-worker-check.js +3 -2
- package/dist/scripts/mad-sks-zellij-launch-check.js +1 -1
- package/dist/scripts/naruto-zellij-dynamic-right-column-check.js +7 -7
- package/dist/scripts/parallel-claim-enforcement-check.js +14 -5
- package/dist/scripts/ppt-real-imagegen-wiring-check.js +5 -1
- package/dist/scripts/project-skill-dedupe-check.js +23 -5
- package/dist/scripts/proof-root-cause-policy-check.js +2 -0
- package/dist/scripts/release-affected-selector-check.js +2 -2
- package/dist/scripts/release-cache-glob-hashing-check.js +1 -0
- package/dist/scripts/release-dag-full-coverage-check.js +13 -4
- package/dist/scripts/release-gate-dag-runner-check.js +10 -2
- package/dist/scripts/release-gate-dag-runner.js +22 -0
- package/dist/scripts/release-gate-existence-audit.js +2 -1
- package/dist/scripts/release-gate-planner.js +2 -1
- package/dist/scripts/release-gate-script-parity-check.js +1 -1
- package/dist/scripts/release-metadata-1-19-check.js +2 -1
- package/dist/scripts/release-readiness-report.js +38 -7
- package/dist/scripts/release-stability-report-check.js +12 -8
- package/dist/scripts/search-visibility-gate-lib.js +2 -2
- package/dist/scripts/seo-geo-feature-fixture-quality-check.js +1 -1
- package/dist/scripts/skills-manifest-continuity-check.js +46 -0
- package/dist/scripts/sks-1-11-gate-lib.js +8 -6
- package/dist/scripts/sks-menubar-install-check.js +87 -21
- package/dist/scripts/sks-uninstall-regression-check.js +54 -0
- package/dist/scripts/uninstall-inventory-check.js +3 -0
- package/dist/scripts/ux-review-real-loop-fixture-check.js +9 -4
- package/dist/scripts/ux-review-run-wires-imagegen-check.js +4 -0
- package/dist/scripts/zellij-layout-valid-check.js +18 -11
- package/dist/scripts/zellij-right-column-geometry-proof.js +2 -4
- package/dist/scripts/zellij-slot-pane-renderer-check.js +9 -9
- package/dist/scripts/zellij-slot-pane-stale-detection-check.js +3 -4
- package/dist/scripts/zellij-slot-pane-telemetry-renderer-check.js +3 -2
- package/dist/scripts/zellij-slot-telemetry-renderer-check.js +4 -2
- package/dist/scripts/zellij-spawn-on-demand-layout-check.js +8 -2
- package/dist/scripts/zellij-viewport-binder-check.js +9 -0
- package/docs/assets/sneakoscope-architecture-pipeline.jpg +0 -0
- package/docs/demo.tape +28 -0
- package/package.json +70 -3
- package/schemas/codex/completion-proof.schema.json +3 -2
- package/schemas/release/release-gate-node.schema.json +2 -1
- package/dist/scripts/agent-backfill-route-blackbox.js +0 -5
- package/dist/scripts/agent-dynamic-pool-route-blackbox.js +0 -5
- package/dist/scripts/agent-parallel-write-blackbox.js +0 -56
- package/dist/scripts/agent-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/agent-route-blackbox-lib.js +0 -132
- package/dist/scripts/blackbox-command-import-smoke.js +0 -143
- package/dist/scripts/blackbox-global-shim.js +0 -77
- package/dist/scripts/blackbox-matrix.js +0 -70
- package/dist/scripts/blackbox-npx-one-shot.js +0 -69
- package/dist/scripts/blackbox-pack-install.js +0 -174
- package/dist/scripts/brand-neutrality-zero-leakage-blackbox.js +0 -4
- package/dist/scripts/build-once-runner-blackbox.js +0 -34
- package/dist/scripts/codex-0140-integration-blackbox.js +0 -13
- package/dist/scripts/codex-agent-type-blackbox.js +0 -4
- package/dist/scripts/codex-app-harness-blackbox.js +0 -4
- package/dist/scripts/codex-app-skill-agent-blackbox.js +0 -4
- package/dist/scripts/codex-hook-approval-blackbox.js +0 -4
- package/dist/scripts/codex-init-deep-directory-local-blackbox.js +0 -4
- package/dist/scripts/codex-native-feature-broker-blackbox.js +0 -4
- package/dist/scripts/codex-native-pattern-analysis-blackbox.js +0 -4
- package/dist/scripts/codex-native-read-repair-split-blackbox.js +0 -55
- package/dist/scripts/codex-native-reference-cache-blackbox.js +0 -41
- package/dist/scripts/core-skill-integrity-blackbox.js +0 -33
- package/dist/scripts/dfix-fast-blackbox-check.js +0 -37
- package/dist/scripts/dfix-parallel-write-blackbox.js +0 -48
- package/dist/scripts/dfix-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/doctor-context7-mcp-repair-blackbox.js +0 -16
- package/dist/scripts/doctor-dirty-repair-blackbox.js +0 -22
- package/dist/scripts/doctor-dirty-semantic-blackbox.js +0 -8
- package/dist/scripts/doctor-fix-production-blackbox.js +0 -26
- package/dist/scripts/doctor-native-capability-repair-blackbox.js +0 -39
- package/dist/scripts/doctor-startup-config-repair-blackbox.js +0 -13
- package/dist/scripts/doctor-supabase-mcp-repair-blackbox.js +0 -14
- package/dist/scripts/doctor-transaction-engine-blackbox.js +0 -28
- package/dist/scripts/doctor-zellij-fix-blackbox.js +0 -4
- package/dist/scripts/doctor-zellij-no-homebrew-blackbox.js +0 -4
- package/dist/scripts/doctor-zellij-upgrade-blackbox.js +0 -4
- package/dist/scripts/gate-pack-runner-blackbox.js +0 -27
- package/dist/scripts/gate-pack-v2-blackbox.js +0 -18
- package/dist/scripts/geo-cli-blackbox-check.js +0 -18
- package/dist/scripts/loop-collision-blackbox.js +0 -3
- package/dist/scripts/loop-concurrency-oversubscription-blackbox.js +0 -3
- package/dist/scripts/loop-fixture-production-misuse-blackbox.js +0 -3
- package/dist/scripts/loop-kill-interrupt-real-blackbox.js +0 -3
- package/dist/scripts/loop-merge-strategy-blackbox.js +0 -3
- package/dist/scripts/loop-mesh-production-e2e-blackbox.js +0 -3
- package/dist/scripts/loop-side-effect-blackbox.js +0 -3
- package/dist/scripts/mad-db-operation-lifecycle-blackbox.js +0 -29
- package/dist/scripts/mad-sks-actual-executor-blackbox.js +0 -5
- package/dist/scripts/mad-zellij-headless-fallback-blackbox.js +0 -4
- package/dist/scripts/mad-zellij-self-heal-blackbox.js +0 -4
- package/dist/scripts/naruto-loop-mesh-blackbox.js +0 -3
- package/dist/scripts/naruto-real-parallelism-blackbox.js +0 -307
- package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -29
- package/dist/scripts/parallel-runtime-real-blackbox.js +0 -44
- package/dist/scripts/pipeline-codex-native-doctor-mad-routing-real-blackbox.js +0 -77
- package/dist/scripts/pipeline-codex-native-e2e-blackbox.js +0 -13
- package/dist/scripts/pipeline-codex-native-image-routing-real-blackbox.js +0 -50
- package/dist/scripts/pipeline-codex-native-loop-routing-real-blackbox.js +0 -74
- package/dist/scripts/pipeline-codex-native-qa-routing-real-blackbox.js +0 -51
- package/dist/scripts/pipeline-codex-native-research-routing-real-blackbox.js +0 -45
- package/dist/scripts/pipeline-execution-profile-routing-blackbox.js +0 -4
- package/dist/scripts/postinstall-global-doctor-blackbox.js +0 -12
- package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -109
- package/dist/scripts/ppt-imagegen-blackbox-check.js +0 -46
- package/dist/scripts/project-skill-dedupe-blackbox.js +0 -36
- package/dist/scripts/qa-backfill-route-blackbox.js +0 -5
- package/dist/scripts/qa-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/release-full-parallelism-blackbox.js +0 -41
- package/dist/scripts/release-triwiki-first-runner-blackbox.js +0 -48
- package/dist/scripts/release-wiring-3110-blackbox.js +0 -27
- package/dist/scripts/release-wiring-3112-blackbox.js +0 -17
- package/dist/scripts/release-wiring-3113-blackbox.js +0 -17
- package/dist/scripts/research-backfill-route-blackbox.js +0 -5
- package/dist/scripts/research-final-reviewer-blackbox.js +0 -70
- package/dist/scripts/research-stage-cycle-runtime-blackbox.js +0 -40
- package/dist/scripts/research-synthesis-writer-blackbox.js +0 -24
- package/dist/scripts/route-blackbox-realism-check.js +0 -21
- package/dist/scripts/scheduler-resource-claim-blackbox.js +0 -24
- package/dist/scripts/seo-cli-blackbox-check.js +0 -18
- package/dist/scripts/sks-3110-all-feature-regression-blackbox.js +0 -116
- package/dist/scripts/sks-3112-all-feature-regression-blackbox.js +0 -29
- package/dist/scripts/sks-3113-all-feature-regression-blackbox.js +0 -17
- package/dist/scripts/sks-400-all-feature-regression-blackbox.js +0 -21
- package/dist/scripts/sks-400-extreme-parallel-blackbox.js +0 -8
- package/dist/scripts/sks-400-five-minute-blackbox.js +0 -9
- package/dist/scripts/sks-400-legacy-purge-blackbox.js +0 -8
- package/dist/scripts/sks-401-all-feature-regression-blackbox.js +0 -46
- package/dist/scripts/sks-401-five-minute-actual-blackbox.js +0 -23
- package/dist/scripts/sks-402-all-feature-regression-blackbox.js +0 -9
- package/dist/scripts/sks-402-five-minute-real-blackbox.js +0 -22
- package/dist/scripts/sksd-warm-cache-blackbox.js +0 -12
- package/dist/scripts/supabase-secret-preservation-blackbox.js +0 -29
- package/dist/scripts/team-backfill-route-blackbox.js +0 -5
- package/dist/scripts/team-parallel-write-blackbox.js +0 -55
- package/dist/scripts/team-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/triwiki-affected-graph-blackbox.js +0 -28
- package/dist/scripts/triwiki-proof-bank-blackbox.js +0 -30
- package/dist/scripts/triwiki-proof-bank-lock-blackbox.js +0 -7
- package/dist/scripts/update-preserves-supabase-keys-blackbox.js +0 -27
- package/dist/scripts/ux-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -67
- package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -28
- package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -80
- package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -137
- package/dist/scripts/zellij-self-heal-typed-blackbox.js +0 -4
- package/dist/scripts/zellij-slot-telemetry-real-blackbox.js +0 -20
- package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -81
- package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -202
package/dist/core/team-dag.js
CHANGED
|
@@ -1,511 +1,58 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import {
|
|
2
|
+
import { exists, readJson } from './fsx.js';
|
|
3
3
|
export const TEAM_GRAPH_ARTIFACT = 'team-graph.json';
|
|
4
4
|
export const TEAM_RUNTIME_TASKS_ARTIFACT = 'team-runtime-tasks.json';
|
|
5
5
|
export const TEAM_DECOMPOSITION_ARTIFACT = 'team-decomposition-report.json';
|
|
6
6
|
export const TEAM_INBOX_DIR = 'team-inbox';
|
|
7
|
-
const TASK_ID_PREFIX = 'task-';
|
|
8
7
|
export function teamRuntimeRequiredArtifacts() {
|
|
9
8
|
return [TEAM_GRAPH_ARTIFACT, TEAM_RUNTIME_TASKS_ARTIFACT, TEAM_DECOMPOSITION_ARTIFACT, TEAM_INBOX_DIR];
|
|
10
9
|
}
|
|
11
10
|
export function teamRuntimePlanMetadata() {
|
|
12
11
|
return {
|
|
13
12
|
schema_version: 1,
|
|
13
|
+
legacy_observe_only: true,
|
|
14
14
|
graph_artifact: TEAM_GRAPH_ARTIFACT,
|
|
15
15
|
runtime_tasks_artifact: TEAM_RUNTIME_TASKS_ARTIFACT,
|
|
16
16
|
decomposition_artifact: TEAM_DECOMPOSITION_ARTIFACT,
|
|
17
|
-
inbox_dir: TEAM_INBOX_DIR
|
|
18
|
-
dependency_policy: 'symbolic_node_ids_are_remapped_to_concrete_task_ids_before_worker_inboxes_are_written',
|
|
19
|
-
allocation_policy: 'role_path_domain_load_scoring_with_same_scope_affinity'
|
|
17
|
+
inbox_dir: TEAM_INBOX_DIR
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
|
-
export async function writeTeamRuntimeArtifacts(dir, plan, opts = {}) {
|
|
23
|
-
const compiled = compileTeamRuntime(plan, opts);
|
|
24
|
-
if (!compiled.ok) {
|
|
25
|
-
const message = compiled.validation.errors.join('; ') || 'unknown Team DAG validation error';
|
|
26
|
-
throw new Error(`Team DAG compile failed: ${message}`);
|
|
27
|
-
}
|
|
28
|
-
await writeJsonAtomic(path.join(dir, TEAM_GRAPH_ARTIFACT), compiled.graph);
|
|
29
|
-
await writeJsonAtomic(path.join(dir, TEAM_RUNTIME_TASKS_ARTIFACT), compiled.runtime);
|
|
30
|
-
await writeJsonAtomic(path.join(dir, TEAM_DECOMPOSITION_ARTIFACT), compiled.report);
|
|
31
|
-
await writeWorkerInboxes(dir, compiled);
|
|
32
|
-
return {
|
|
33
|
-
...compiled,
|
|
34
|
-
gate_fields: teamRuntimeGateFields(compiled),
|
|
35
|
-
artifacts: {
|
|
36
|
-
graph: TEAM_GRAPH_ARTIFACT,
|
|
37
|
-
runtime_tasks: TEAM_RUNTIME_TASKS_ARTIFACT,
|
|
38
|
-
decomposition_report: TEAM_DECOMPOSITION_ARTIFACT,
|
|
39
|
-
inbox_dir: TEAM_INBOX_DIR
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
export function compileTeamRuntime(plan, opts = {}) {
|
|
44
|
-
const dag = normalizeTeamDag(opts.dag || plan?.team_dag || planToTeamDag(plan, opts), plan, opts);
|
|
45
|
-
const validation = validateTeamDag(dag);
|
|
46
|
-
if (!validation.ok)
|
|
47
|
-
return { ok: false, validation, dag };
|
|
48
|
-
const order = topologicalOrder(dag.nodes);
|
|
49
|
-
const nodeIdToTaskId = {};
|
|
50
|
-
const agentReasoning = teamAgentReasoningById(plan?.roster || {});
|
|
51
|
-
const tasks = order.map((node, index) => {
|
|
52
|
-
const taskId = `${TASK_ID_PREFIX}${String(index + 1).padStart(3, '0')}`;
|
|
53
|
-
nodeIdToTaskId[node.id] = taskId;
|
|
54
|
-
const reasoning = agentReasoning[node.agent || ''] || {};
|
|
55
|
-
return {
|
|
56
|
-
task_id: taskId,
|
|
57
|
-
symbolic_id: node.id,
|
|
58
|
-
subject: node.subject,
|
|
59
|
-
description: node.description,
|
|
60
|
-
role: node.role || 'worker',
|
|
61
|
-
phase: node.phase || null,
|
|
62
|
-
agent_hint: node.agent || null,
|
|
63
|
-
file_paths: node.file_paths || [],
|
|
64
|
-
domains: node.domains || [],
|
|
65
|
-
lane: node.lane || null,
|
|
66
|
-
reasoning_effort: reasoning.reasoning_effort || null,
|
|
67
|
-
reasoning_profile: reasoning.reasoning_profile || null,
|
|
68
|
-
service_tier: reasoning.service_tier || 'fast',
|
|
69
|
-
reasoning_reason: reasoning.reasoning_reason || null,
|
|
70
|
-
depends_on: [],
|
|
71
|
-
blocked_by: [],
|
|
72
|
-
status: 'pending'
|
|
73
|
-
};
|
|
74
|
-
});
|
|
75
|
-
const bySymbolic = new Map(order.map((node) => [node.id, node]));
|
|
76
|
-
for (const task of tasks) {
|
|
77
|
-
const node = bySymbolic.get(task.symbolic_id);
|
|
78
|
-
task.depends_on = (node.depends_on || []).map((id) => nodeIdToTaskId[id]).filter(Boolean);
|
|
79
|
-
task.blocked_by = [...task.depends_on];
|
|
80
|
-
}
|
|
81
|
-
const allocation = allocateTasks(tasks, plan);
|
|
82
|
-
const runtimeTasks = tasks.map((task) => ({
|
|
83
|
-
...task,
|
|
84
|
-
worker: allocation.by_task_id[task.task_id]?.worker || 'parent_orchestrator',
|
|
85
|
-
allocation_reason: allocation.by_task_id[task.task_id]?.reason || 'default_parent_orchestrator'
|
|
86
|
-
}));
|
|
87
|
-
const runtime = {
|
|
88
|
-
schema_version: 1,
|
|
89
|
-
compiled_at: nowIso(),
|
|
90
|
-
mission_id: plan?.mission_id || opts.missionId || null,
|
|
91
|
-
node_id_to_task_id: nodeIdToTaskId,
|
|
92
|
-
tasks: runtimeTasks,
|
|
93
|
-
dependency_policy: 'all_runtime_dependencies_are_concrete_task_ids'
|
|
94
|
-
};
|
|
95
|
-
const report = {
|
|
96
|
-
schema_version: 1,
|
|
97
|
-
compiled_at: runtime.compiled_at,
|
|
98
|
-
mission_id: runtime.mission_id,
|
|
99
|
-
source: dag.source,
|
|
100
|
-
validation,
|
|
101
|
-
task_count: runtimeTasks.length,
|
|
102
|
-
ready_lane_count: runtimeTasks.filter((task) => task.depends_on.length === 0).length,
|
|
103
|
-
useful_lane_count: allocation.useful_lane_count,
|
|
104
|
-
verification_lane_reserved: allocation.verification_lane_reserved,
|
|
105
|
-
worker_allocations: allocation.workers,
|
|
106
|
-
write_scope_conflicts: allocation.write_scope_conflicts,
|
|
107
|
-
inboxes: Object.keys(groupTasksByWorker(runtimeTasks)).sort(),
|
|
108
|
-
node_id_to_task_id: nodeIdToTaskId
|
|
109
|
-
};
|
|
110
|
-
const graph = {
|
|
111
|
-
...dag,
|
|
112
|
-
validation,
|
|
113
|
-
node_id_to_task_id: nodeIdToTaskId,
|
|
114
|
-
runtime_task_ids: runtimeTasks.map((task) => task.task_id)
|
|
115
|
-
};
|
|
116
|
-
return { ok: true, graph, runtime, report, validation, inboxes: groupTasksByWorker(runtimeTasks) };
|
|
117
|
-
}
|
|
118
|
-
function teamAgentReasoningById(roster = {}) {
|
|
119
|
-
const out = {};
|
|
120
|
-
const groups = ['analysis_team', 'debate_team', 'development_team', 'validation_team', 'all_agents'];
|
|
121
|
-
for (const group of groups) {
|
|
122
|
-
for (const agent of Array.isArray(roster[group]) ? roster[group] : []) {
|
|
123
|
-
if (!agent?.id || out[agent.id])
|
|
124
|
-
continue;
|
|
125
|
-
out[agent.id] = {
|
|
126
|
-
reasoning_effort: agent.reasoning_effort || agent.model_reasoning_effort || null,
|
|
127
|
-
reasoning_profile: agent.reasoning_profile || null,
|
|
128
|
-
service_tier: agent.service_tier || 'fast',
|
|
129
|
-
reasoning_reason: agent.reasoning_reason || null
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return out;
|
|
134
|
-
}
|
|
135
20
|
export async function validateTeamRuntimeArtifacts(dir) {
|
|
136
21
|
const issues = [];
|
|
137
22
|
const graph = await readJson(path.join(dir, TEAM_GRAPH_ARTIFACT), null);
|
|
138
23
|
const runtime = await readJson(path.join(dir, TEAM_RUNTIME_TASKS_ARTIFACT), null);
|
|
139
24
|
const report = await readJson(path.join(dir, TEAM_DECOMPOSITION_ARTIFACT), null);
|
|
25
|
+
const inboxRoot = path.join(dir, TEAM_INBOX_DIR);
|
|
140
26
|
if (!graph)
|
|
141
27
|
issues.push(TEAM_GRAPH_ARTIFACT);
|
|
142
28
|
if (!runtime)
|
|
143
29
|
issues.push(TEAM_RUNTIME_TASKS_ARTIFACT);
|
|
144
30
|
if (!report)
|
|
145
31
|
issues.push(TEAM_DECOMPOSITION_ARTIFACT);
|
|
146
|
-
if (!await exists(
|
|
32
|
+
if (!(await exists(inboxRoot)))
|
|
147
33
|
issues.push(TEAM_INBOX_DIR);
|
|
148
34
|
if (!runtime?.tasks?.length)
|
|
149
35
|
issues.push(`${TEAM_RUNTIME_TASKS_ARTIFACT}:tasks`);
|
|
150
|
-
for (const worker of Array.isArray(report?.inboxes) ? report.inboxes : []) {
|
|
151
|
-
if (!await exists(path.join(dir, TEAM_INBOX_DIR, `${safeName(worker)}.md`)))
|
|
152
|
-
issues.push(`${TEAM_INBOX_DIR}:${worker}`);
|
|
153
|
-
}
|
|
154
36
|
const ids = new Set((runtime?.tasks || []).map((task) => task.task_id));
|
|
155
37
|
for (const task of runtime?.tasks || []) {
|
|
156
|
-
if (!String(task.task_id || '').startsWith(
|
|
38
|
+
if (!String(task.task_id || '').startsWith('task-'))
|
|
157
39
|
issues.push(`${task.task_id || 'task'}:task_id`);
|
|
158
40
|
for (const dep of [...(task.depends_on || []), ...(task.blocked_by || [])]) {
|
|
159
41
|
if (!ids.has(dep))
|
|
160
42
|
issues.push(`${task.task_id}:dependency:${dep}`);
|
|
161
|
-
if (!String(dep).startsWith(
|
|
43
|
+
if (!String(dep).startsWith('task-'))
|
|
162
44
|
issues.push(`${task.task_id}:symbolic_dependency:${dep}`);
|
|
163
45
|
}
|
|
164
46
|
if (!task.worker)
|
|
165
47
|
issues.push(`${task.task_id}:worker`);
|
|
166
48
|
}
|
|
49
|
+
for (const worker of Array.isArray(report?.inboxes) ? report.inboxes : []) {
|
|
50
|
+
const name = String(worker || 'worker').replace(/[^A-Za-z0-9_.-]+/g, '_');
|
|
51
|
+
if (!(await exists(path.join(inboxRoot, `${name}.md`))))
|
|
52
|
+
issues.push(`${TEAM_INBOX_DIR}:${worker}`);
|
|
53
|
+
}
|
|
167
54
|
if (Array.isArray(report?.write_scope_conflicts) && report.write_scope_conflicts.length > 0)
|
|
168
55
|
issues.push(`${TEAM_DECOMPOSITION_ARTIFACT}:write_scope_conflicts`);
|
|
169
|
-
if (!report?.node_id_to_task_id || Object.keys(report.node_id_to_task_id).length !== (runtime?.tasks || []).length)
|
|
170
|
-
issues.push(`${TEAM_DECOMPOSITION_ARTIFACT}:node_id_to_task_id`);
|
|
171
56
|
return { ok: issues.length === 0, issues, graph, runtime, report };
|
|
172
57
|
}
|
|
173
|
-
export function teamRuntimeGateFields(compiledOrValidation) {
|
|
174
|
-
const report = compiledOrValidation?.report || compiledOrValidation;
|
|
175
|
-
const ok = Boolean(compiledOrValidation?.ok ?? report?.validation?.ok);
|
|
176
|
-
const noConflicts = Array.isArray(report?.write_scope_conflicts) ? report.write_scope_conflicts.length === 0 : ok;
|
|
177
|
-
return {
|
|
178
|
-
team_graph_required: true,
|
|
179
|
-
team_graph_compiled: ok,
|
|
180
|
-
runtime_dependencies_concrete: ok,
|
|
181
|
-
worker_inboxes_written: ok,
|
|
182
|
-
write_scope_conflicts_zero: noConflicts,
|
|
183
|
-
task_claim_readiness_checked: ok && noConflicts
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function planToTeamDag(plan = {}, opts = {}) {
|
|
187
|
-
const nodes = [];
|
|
188
|
-
let previousIds = [];
|
|
189
|
-
for (const phase of plan.phases || []) {
|
|
190
|
-
const agents = Array.isArray(phase.agents) && phase.agents.length ? phase.agents.map(String) : ['parent_orchestrator'];
|
|
191
|
-
const parallel = agents.length > 1 && (/parallel|debate|review/i.test(String(phase.id || '')) || phase.max_parallel_native_sessions || phase.max_parallel_subagents);
|
|
192
|
-
const created = parallel
|
|
193
|
-
? agents.map((agent) => phaseNode(phase, { agent, suffix: agent, dependsOn: previousIds }))
|
|
194
|
-
: [phaseNode(phase, { agent: agents[0], dependsOn: previousIds })];
|
|
195
|
-
nodes.push(...created);
|
|
196
|
-
previousIds = created.map((node) => node.id);
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
schema_version: 1,
|
|
200
|
-
source: 'team_plan_phases',
|
|
201
|
-
mission_id: plan.mission_id || opts.missionId || null,
|
|
202
|
-
prompt_hash: shortHash(plan.prompt || plan.task || opts.prompt || ''),
|
|
203
|
-
contract_hash: opts.contractHash || plan.contract_hash || null,
|
|
204
|
-
nodes
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function phaseNode(phase = {}, opts = {}) {
|
|
208
|
-
const idBase = String(phase.id || 'team_task').replace(/[^A-Za-z0-9_-]+/g, '_').replace(/^_+|_+$/g, '') || 'team_task';
|
|
209
|
-
const agentSuffix = opts.suffix ? `_${String(opts.suffix).replace(/[^A-Za-z0-9_-]+/g, '_')}` : '';
|
|
210
|
-
const id = `${idBase}${agentSuffix}`;
|
|
211
|
-
const description = String(phase.goal || phase.description || phase.subject || idBase);
|
|
212
|
-
const hints = extractTaskHints(description, phase);
|
|
213
|
-
return {
|
|
214
|
-
id,
|
|
215
|
-
subject: String(phase.subject || humanizeId(idBase)),
|
|
216
|
-
description,
|
|
217
|
-
depends_on: opts.dependsOn || [],
|
|
218
|
-
role: inferRole(phase, opts.agent),
|
|
219
|
-
agent: opts.agent || null,
|
|
220
|
-
phase: String(phase.id || idBase),
|
|
221
|
-
lane: inferLane(phase, opts.agent),
|
|
222
|
-
file_paths: hints.file_paths,
|
|
223
|
-
domains: hints.domains,
|
|
224
|
-
write_policy: phase.write_policy || null
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function normalizeTeamDag(dag = {}, plan = {}, opts = {}) {
|
|
228
|
-
return {
|
|
229
|
-
schema_version: dag.schema_version || 1,
|
|
230
|
-
source: dag.source || 'explicit_team_dag',
|
|
231
|
-
mission_id: dag.mission_id || plan?.mission_id || opts.missionId || null,
|
|
232
|
-
prompt_hash: dag.prompt_hash || shortHash(plan?.prompt || plan?.task || opts.prompt || ''),
|
|
233
|
-
contract_hash: dag.contract_hash || opts.contractHash || plan?.contract_hash || null,
|
|
234
|
-
nodes: (dag.nodes || []).map((node) => ({
|
|
235
|
-
id: String(node.id || '').trim(),
|
|
236
|
-
subject: String(node.subject || node.id || '').trim(),
|
|
237
|
-
description: String(node.description || node.goal || node.subject || '').trim(),
|
|
238
|
-
depends_on: Array.isArray(node.depends_on) ? node.depends_on.map(String) : [],
|
|
239
|
-
role: node.role ? String(node.role) : undefined,
|
|
240
|
-
agent: node.agent ? String(node.agent) : undefined,
|
|
241
|
-
phase: node.phase ? String(node.phase) : undefined,
|
|
242
|
-
lane: node.lane ? String(node.lane) : undefined,
|
|
243
|
-
file_paths: Array.isArray(node.file_paths) ? [...new Set(node.file_paths.map(String).filter(Boolean))] : [],
|
|
244
|
-
domains: Array.isArray(node.domains) ? [...new Set(node.domains.map(String).filter(Boolean))] : [],
|
|
245
|
-
write_policy: node.write_policy ? String(node.write_policy) : undefined
|
|
246
|
-
}))
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
function validateTeamDag(dag) {
|
|
250
|
-
const errors = [];
|
|
251
|
-
const ids = new Set();
|
|
252
|
-
for (const node of dag.nodes || []) {
|
|
253
|
-
if (!node.id || !/^[A-Za-z0-9_-]+$/.test(node.id))
|
|
254
|
-
errors.push(`invalid_node_id:${node.id || 'missing'}`);
|
|
255
|
-
if (ids.has(node.id))
|
|
256
|
-
errors.push(`duplicate_node_id:${node.id}`);
|
|
257
|
-
ids.add(node.id);
|
|
258
|
-
if (!node.subject)
|
|
259
|
-
errors.push(`missing_subject:${node.id || 'unknown'}`);
|
|
260
|
-
if (!node.description)
|
|
261
|
-
errors.push(`missing_description:${node.id || 'unknown'}`);
|
|
262
|
-
}
|
|
263
|
-
for (const node of dag.nodes || []) {
|
|
264
|
-
for (const dep of node.depends_on || []) {
|
|
265
|
-
if (!ids.has(dep))
|
|
266
|
-
errors.push(`unknown_dependency:${node.id}->${dep}`);
|
|
267
|
-
if (dep === node.id)
|
|
268
|
-
errors.push(`self_dependency:${node.id}`);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
const cycle = findCycle(dag.nodes || []);
|
|
272
|
-
if (cycle.length)
|
|
273
|
-
errors.push(`cycle:${cycle.join('->')}`);
|
|
274
|
-
return { ok: errors.length === 0, errors, checked_nodes: (dag.nodes || []).length };
|
|
275
|
-
}
|
|
276
|
-
function topologicalOrder(nodes = []) {
|
|
277
|
-
const byId = new Map(nodes.map((node) => [node.id, node]));
|
|
278
|
-
const seen = new Set();
|
|
279
|
-
const out = [];
|
|
280
|
-
const visit = (node) => {
|
|
281
|
-
if (!node || seen.has(node.id))
|
|
282
|
-
return;
|
|
283
|
-
for (const dep of node.depends_on || [])
|
|
284
|
-
visit(byId.get(dep));
|
|
285
|
-
seen.add(node.id);
|
|
286
|
-
out.push(node);
|
|
287
|
-
};
|
|
288
|
-
for (const node of nodes)
|
|
289
|
-
visit(node);
|
|
290
|
-
return out;
|
|
291
|
-
}
|
|
292
|
-
function findCycle(nodes = []) {
|
|
293
|
-
const byId = new Map(nodes.map((node) => [node.id, node]));
|
|
294
|
-
const visiting = new Set();
|
|
295
|
-
const visited = new Set();
|
|
296
|
-
const stack = [];
|
|
297
|
-
const visit = (node) => {
|
|
298
|
-
if (!node)
|
|
299
|
-
return [];
|
|
300
|
-
if (visiting.has(node.id))
|
|
301
|
-
return stack.slice(stack.indexOf(node.id)).concat(node.id);
|
|
302
|
-
if (visited.has(node.id))
|
|
303
|
-
return [];
|
|
304
|
-
visiting.add(node.id);
|
|
305
|
-
stack.push(node.id);
|
|
306
|
-
for (const dep of node.depends_on || []) {
|
|
307
|
-
const cycle = visit(byId.get(dep));
|
|
308
|
-
if (cycle.length)
|
|
309
|
-
return cycle;
|
|
310
|
-
}
|
|
311
|
-
stack.pop();
|
|
312
|
-
visiting.delete(node.id);
|
|
313
|
-
visited.add(node.id);
|
|
314
|
-
return [];
|
|
315
|
-
};
|
|
316
|
-
for (const node of nodes) {
|
|
317
|
-
const cycle = visit(node);
|
|
318
|
-
if (cycle.length)
|
|
319
|
-
return cycle;
|
|
320
|
-
}
|
|
321
|
-
return [];
|
|
322
|
-
}
|
|
323
|
-
function allocateTasks(tasks = [], plan = {}) {
|
|
324
|
-
const roster = plan.roster || {};
|
|
325
|
-
const workerIds = [
|
|
326
|
-
'parent_orchestrator',
|
|
327
|
-
...(roster.analysis_team || []).map((agent) => agent.id),
|
|
328
|
-
...(roster.debate_team || []).map((agent) => agent.id),
|
|
329
|
-
...(roster.development_team || []).map((agent) => agent.id),
|
|
330
|
-
...(roster.validation_team || []).map((agent) => agent.id)
|
|
331
|
-
];
|
|
332
|
-
const workers = Object.fromEntries([...new Set(workerIds)].map((id) => [id, { worker: id, load: 0, file_paths: [], domains: [], tasks: [] }]));
|
|
333
|
-
const byTask = {};
|
|
334
|
-
for (const task of tasks) {
|
|
335
|
-
const worker = workers[task.agent_hint] ? task.agent_hint : chooseWorker(task, workers);
|
|
336
|
-
const state = workers[worker] || workers.parent_orchestrator;
|
|
337
|
-
const reason = task.agent_hint && workers[task.agent_hint] ? 'phase_agent_hint' : allocationReason(task, state);
|
|
338
|
-
state.load += 1;
|
|
339
|
-
state.tasks.push(task.task_id);
|
|
340
|
-
state.file_paths = [...new Set([...state.file_paths, ...(task.file_paths || [])])];
|
|
341
|
-
state.domains = [...new Set([...state.domains, ...(task.domains || [])])];
|
|
342
|
-
byTask[task.task_id] = { worker: state.worker, reason };
|
|
343
|
-
}
|
|
344
|
-
const writeScopeConflicts = detectWriteScopeConflicts(tasks, byTask);
|
|
345
|
-
const usedWorkers = Object.values(workers).filter((worker) => worker.tasks.length > 0);
|
|
346
|
-
return {
|
|
347
|
-
by_task_id: byTask,
|
|
348
|
-
workers: usedWorkers,
|
|
349
|
-
useful_lane_count: usedWorkers.filter((worker) => worker.worker !== 'parent_orchestrator').length,
|
|
350
|
-
verification_lane_reserved: tasks.some((task) => task.role === 'executor') && usedWorkers.some((worker) => /^reviewer_/.test(worker.worker)),
|
|
351
|
-
write_scope_conflicts: writeScopeConflicts
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
function chooseWorker(task, workers) {
|
|
355
|
-
const candidates = Object.values(workers).filter((worker) => {
|
|
356
|
-
if (task.role === 'executor')
|
|
357
|
-
return /^executor_/.test(worker.worker);
|
|
358
|
-
if (task.role === 'analysis')
|
|
359
|
-
return /^native_agent_/.test(worker.worker);
|
|
360
|
-
if (task.role === 'reviewer')
|
|
361
|
-
return /^reviewer_/.test(worker.worker) || /^user_/.test(worker.worker);
|
|
362
|
-
if (task.role === 'planner')
|
|
363
|
-
return /debate_|native_agent_orchestrator|parent_orchestrator/.test(worker.worker);
|
|
364
|
-
return true;
|
|
365
|
-
});
|
|
366
|
-
const scored = (candidates.length ? candidates : Object.values(workers)).map((worker) => {
|
|
367
|
-
const pathOverlap = overlapCount(task.file_paths || [], worker.file_paths || []);
|
|
368
|
-
const domainOverlap = overlapCount(task.domains || [], worker.domains || []);
|
|
369
|
-
const roleScore = roleMatchesWorker(task.role, worker.worker) ? 4 : 0;
|
|
370
|
-
return { worker, score: roleScore + pathOverlap * 3 + domainOverlap * 2 - worker.load };
|
|
371
|
-
}).sort((a, b) => b.score - a.score || a.worker.worker.localeCompare(b.worker.worker));
|
|
372
|
-
return scored[0]?.worker.worker || 'parent_orchestrator';
|
|
373
|
-
}
|
|
374
|
-
function allocationReason(task, worker) {
|
|
375
|
-
const pathOverlap = overlapCount(task.file_paths || [], worker.file_paths || []);
|
|
376
|
-
const domainOverlap = overlapCount(task.domains || [], worker.domains || []);
|
|
377
|
-
if (pathOverlap || domainOverlap)
|
|
378
|
-
return `scope_affinity:path_overlap=${pathOverlap},domain_overlap=${domainOverlap}`;
|
|
379
|
-
if (roleMatchesWorker(task.role, worker.worker))
|
|
380
|
-
return `role_match:${task.role}`;
|
|
381
|
-
return 'lowest_load_default';
|
|
382
|
-
}
|
|
383
|
-
function detectWriteScopeConflicts(tasks, byTask) {
|
|
384
|
-
const conflicts = [];
|
|
385
|
-
const writable = tasks.filter((task) => task.role === 'executor' && task.file_paths?.length);
|
|
386
|
-
for (let i = 0; i < writable.length; i++) {
|
|
387
|
-
for (let j = i + 1; j < writable.length; j++) {
|
|
388
|
-
const a = writable[i];
|
|
389
|
-
const b = writable[j];
|
|
390
|
-
const overlap = a.file_paths.filter((file) => b.file_paths.includes(file));
|
|
391
|
-
if (overlap.length && byTask[a.task_id]?.worker !== byTask[b.task_id]?.worker) {
|
|
392
|
-
conflicts.push({ tasks: [a.task_id, b.task_id], file_paths: overlap, workers: [byTask[a.task_id]?.worker, byTask[b.task_id]?.worker] });
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
return conflicts;
|
|
397
|
-
}
|
|
398
|
-
async function writeWorkerInboxes(dir, compiled) {
|
|
399
|
-
const inboxRoot = path.join(dir, TEAM_INBOX_DIR);
|
|
400
|
-
await ensureDir(inboxRoot);
|
|
401
|
-
for (const [worker, tasks] of Object.entries(compiled.inboxes || {})) {
|
|
402
|
-
await writeTextAtomic(path.join(inboxRoot, `${safeName(worker)}.md`), inboxMarkdown(worker, tasks, compiled));
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
function inboxMarkdown(worker, tasks, compiled) {
|
|
406
|
-
const lines = [
|
|
407
|
-
`# Team Inbox: ${worker}`,
|
|
408
|
-
'',
|
|
409
|
-
`Mission: ${compiled.runtime.mission_id || 'unknown'}`,
|
|
410
|
-
'',
|
|
411
|
-
'Use concrete task ids for readiness and handoff. Dependencies below are runtime task ids, not plan-only symbolic ids.',
|
|
412
|
-
'Before task work, read `.sneakoscope/wiki/context-pack.json`: use `attention.use_first` for compact high-trust context and hydrate `attention.hydrate_first` from source before risky or lower-trust decisions.',
|
|
413
|
-
'Do not create fallback implementation code, substitute behavior, mock behavior, or compatibility shims unless the user or sealed decision contract explicitly requested them.',
|
|
414
|
-
''
|
|
415
|
-
];
|
|
416
|
-
for (const task of tasks) {
|
|
417
|
-
lines.push(`## ${task.task_id} ${task.subject}`);
|
|
418
|
-
lines.push('');
|
|
419
|
-
lines.push(`- Symbolic id: ${task.symbolic_id}`);
|
|
420
|
-
lines.push(`- Role: ${task.role}`);
|
|
421
|
-
lines.push(`- Phase: ${task.phase || 'n/a'}`);
|
|
422
|
-
lines.push(`- Depends on: ${(task.depends_on || []).join(', ') || 'none'}`);
|
|
423
|
-
lines.push(`- Blocked by: ${(task.blocked_by || []).join(', ') || 'none'}`);
|
|
424
|
-
lines.push(`- File paths: ${(task.file_paths || []).join(', ') || 'none declared'}`);
|
|
425
|
-
lines.push(`- Domains: ${(task.domains || []).join(', ') || 'general'}`);
|
|
426
|
-
lines.push(`- Allocation reason: ${task.allocation_reason}`);
|
|
427
|
-
lines.push('');
|
|
428
|
-
lines.push(task.description);
|
|
429
|
-
lines.push('');
|
|
430
|
-
}
|
|
431
|
-
return `${lines.join('\n').trimEnd()}\n`;
|
|
432
|
-
}
|
|
433
|
-
function groupTasksByWorker(tasks = []) {
|
|
434
|
-
const grouped = {};
|
|
435
|
-
for (const task of tasks) {
|
|
436
|
-
const worker = task.worker || 'parent_orchestrator';
|
|
437
|
-
grouped[worker] ||= [];
|
|
438
|
-
grouped[worker].push(task);
|
|
439
|
-
}
|
|
440
|
-
return grouped;
|
|
441
|
-
}
|
|
442
|
-
function inferRole(phase = {}, agent = '') {
|
|
443
|
-
const text = `${phase.id || ''} ${phase.write_policy || ''} ${agent || ''}`.toLowerCase();
|
|
444
|
-
if (text.includes('workspace-write') || /^executor_/.test(agent))
|
|
445
|
-
return 'executor';
|
|
446
|
-
if (/native_agent|analysis/.test(text))
|
|
447
|
-
return 'analysis';
|
|
448
|
-
if (/reviewer|review|qa|user_/.test(text))
|
|
449
|
-
return 'reviewer';
|
|
450
|
-
if (/debate|planner|consensus/.test(text))
|
|
451
|
-
return 'planner';
|
|
452
|
-
return 'orchestrator';
|
|
453
|
-
}
|
|
454
|
-
function inferLane(phase = {}, agent = '') {
|
|
455
|
-
if (/executor_/.test(agent))
|
|
456
|
-
return 'implementation';
|
|
457
|
-
if (/native_agent/.test(agent))
|
|
458
|
-
return 'analysis';
|
|
459
|
-
if (/reviewer_|user_/.test(agent))
|
|
460
|
-
return 'verification';
|
|
461
|
-
if (/debate_/.test(agent))
|
|
462
|
-
return 'debate';
|
|
463
|
-
return String(phase.id || 'orchestration');
|
|
464
|
-
}
|
|
465
|
-
function extractTaskHints(description, phase = {}) {
|
|
466
|
-
const hay = `${description || ''} ${phase.output ? JSON.stringify(phase.output) : ''}`;
|
|
467
|
-
const filePaths = new Set();
|
|
468
|
-
const re = /(?:^|[\s`"'(])((?:src|bin|scripts|docs|test|tests|\.agents|\.codex|\.sneakoscope|README\.md|CHANGELOG\.md|package\.json|package-lock\.json)[A-Za-z0-9_./-]*)/g;
|
|
469
|
-
let match;
|
|
470
|
-
while ((match = re.exec(hay)))
|
|
471
|
-
if (match[1])
|
|
472
|
-
filePaths.add(match[1].replace(/[),.;:]+$/, ''));
|
|
473
|
-
const domains = new Set();
|
|
474
|
-
const domainRules = [
|
|
475
|
-
['triwiki', /triwiki|wiki|context-pack/i],
|
|
476
|
-
['team', /team|worker|executor|analysis|debate|inbox|roster/i],
|
|
477
|
-
['qa', /qa|test|verify|review/i],
|
|
478
|
-
['codex-app', /codex|skill|agent/i],
|
|
479
|
-
['release', /version|changelog|publish|package|npm|size/i],
|
|
480
|
-
['docs', /readme|docs|documentation/i]
|
|
481
|
-
];
|
|
482
|
-
for (const [domain, rule] of domainRules)
|
|
483
|
-
if (rule.test(hay))
|
|
484
|
-
domains.add(domain);
|
|
485
|
-
return { file_paths: [...filePaths].sort(), domains: [...domains].sort() };
|
|
486
|
-
}
|
|
487
|
-
function roleMatchesWorker(role, worker) {
|
|
488
|
-
if (role === 'executor')
|
|
489
|
-
return /^executor_/.test(worker);
|
|
490
|
-
if (role === 'analysis')
|
|
491
|
-
return /^native_agent_/.test(worker);
|
|
492
|
-
if (role === 'reviewer')
|
|
493
|
-
return /^reviewer_|^user_/.test(worker);
|
|
494
|
-
if (role === 'planner')
|
|
495
|
-
return /^debate_|native_agent_orchestrator|parent_orchestrator/.test(worker);
|
|
496
|
-
return worker === 'parent_orchestrator';
|
|
497
|
-
}
|
|
498
|
-
function overlapCount(a = [], b = []) {
|
|
499
|
-
const set = new Set(b);
|
|
500
|
-
return a.filter((item) => set.has(item)).length;
|
|
501
|
-
}
|
|
502
|
-
function shortHash(input) {
|
|
503
|
-
return sha256(String(input || '')).slice(0, 16);
|
|
504
|
-
}
|
|
505
|
-
function humanizeId(id) {
|
|
506
|
-
return String(id || '').replace(/[_-]+/g, ' ').replace(/\b\w/g, (ch) => ch.toUpperCase());
|
|
507
|
-
}
|
|
508
|
-
function safeName(name) {
|
|
509
|
-
return String(name || 'worker').replace(/[^A-Za-z0-9_.-]+/g, '_');
|
|
510
|
-
}
|
|
511
58
|
//# sourceMappingURL=team-dag.js.map
|
|
@@ -1,104 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { ARTIFACT_FILES, validateTeamDashboardState } from './artifact-schemas.js';
|
|
4
|
-
export const TEAM_DASHBOARD_PANES = [
|
|
5
|
-
'Mission / Goal View',
|
|
6
|
-
'Agent Grid View',
|
|
7
|
-
'MultiAgentV2 Graph View',
|
|
8
|
-
'Work Order Ledger View',
|
|
9
|
-
'Skill Autopilot View',
|
|
10
|
-
'TriWiki Memory Health View',
|
|
11
|
-
'Forget Queue',
|
|
12
|
-
'Mistake Immunity',
|
|
13
|
-
'Tool Reliability View',
|
|
14
|
-
'Harness Experiments View',
|
|
15
|
-
'Dogfood Evidence View',
|
|
16
|
-
'Code Structure',
|
|
17
|
-
'Statusline / Terminal Title Preview',
|
|
18
|
-
'Artifacts and Evidence',
|
|
19
|
-
'Performance',
|
|
20
|
-
'From-Chat-IMG Visual Map'
|
|
21
|
-
];
|
|
22
|
-
export async function buildTeamDashboardState(dir, opts = {}) {
|
|
23
|
-
const mission = opts.mission || await readJson(path.join(dir, 'mission.json'), {});
|
|
24
|
-
const dashboard = await readJson(path.join(dir, 'team-dashboard.json'), {});
|
|
25
|
-
const runtime = await readJson(path.join(dir, 'team-runtime-tasks.json'), {});
|
|
26
|
-
const gate = await readJson(path.join(dir, 'team-gate.json'), {});
|
|
27
|
-
const dogfood = await readJson(path.join(dir, 'dogfood-report.json'), null);
|
|
28
|
-
const visualMap = await readJson(path.join(dir, 'from-chat-img-visual-map.json'), null);
|
|
29
|
-
const memorySweep = await readJson(path.join(dir, 'memory-sweep-report.json'), null);
|
|
30
|
-
const skillForge = await readJson(path.join(dir, 'skill-forge-report.json'), null);
|
|
31
|
-
const mistakeMemory = await readJson(path.join(dir, 'mistake-memory-report.json'), null);
|
|
32
|
-
const codeStructure = await readJson(path.join(dir, 'code-structure-report.json'), null);
|
|
33
|
-
const isFromChat = Boolean(visualMap || gate.from_chat_img_required);
|
|
1
|
+
export const TEAM_DASHBOARD_PANES = ['Legacy Team Observation'];
|
|
2
|
+
export async function buildTeamDashboardState(_dir, opts = {}) {
|
|
34
3
|
return {
|
|
35
4
|
schema_version: 1,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
phase: opts.phase || 'intake',
|
|
43
|
-
progress_pct: Number(opts.progress_pct || 0),
|
|
44
|
-
next_action: opts.next_action || 'continue mission lifecycle'
|
|
45
|
-
},
|
|
46
|
-
gates: Object.entries(gate || {}).filter(([, value]) => typeof value === 'boolean').map(([name, value]) => ({ name, status: value ? 'pass' : 'fail', evidence: [] })),
|
|
47
|
-
agents: Object.entries(dashboard.agents || {}).map(([id, value]) => ({ id, role: value.role || null, status: value.status || 'pending', current_task: value.phase || null })),
|
|
48
|
-
tasks: (runtime.tasks || []).map((task) => ({ id: task.task_id, deps: task.depends_on || [], status: task.status || 'pending' })),
|
|
49
|
-
qa: {
|
|
50
|
-
failed_checks: (dogfood?.findings || []).filter((finding) => finding.post_fix_verification === 'failed').map((finding) => finding.id),
|
|
51
|
-
unresolved_fixable_findings: Number(dogfood?.unresolved_fixable_findings || 0)
|
|
52
|
-
},
|
|
53
|
-
performance: {
|
|
54
|
-
elapsed_ms: Number(opts.elapsed_ms || 0),
|
|
55
|
-
route_ms: Number(opts.route_ms || 0),
|
|
56
|
-
context_build_ms: Number(opts.context_build_ms || 0),
|
|
57
|
-
dashboard_render_ms: Number(opts.dashboard_render_ms || 0),
|
|
58
|
-
slowest_operations: opts.slowest_operations || []
|
|
59
|
-
},
|
|
60
|
-
artifacts: opts.artifacts || ['team-plan.json', 'team-gate.json', 'team-live.md', 'team-dashboard.json', 'team-runtime-tasks.json'],
|
|
61
|
-
memory: {
|
|
62
|
-
retrieved: (memorySweep?.operations || []).filter((op) => op.operation === 'NOOP').slice(0, 8),
|
|
63
|
-
forget_queue: (memorySweep?.operations || []).filter((op) => ['DEMOTE', 'SOFT_FORGET', 'ARCHIVE', 'HARD_DELETE', 'CONSOLIDATE'].includes(op.operation)).slice(0, 12)
|
|
64
|
-
},
|
|
65
|
-
skills: {
|
|
66
|
-
injected: skillForge?.injection?.injected || [],
|
|
67
|
-
candidates: skillForge?.candidates || [],
|
|
68
|
-
retirements: skillForge?.retirements || []
|
|
69
|
-
},
|
|
70
|
-
mistakes: {
|
|
71
|
-
relevant: mistakeMemory?.relevant_fingerprints || [],
|
|
72
|
-
recovery_required: Boolean(mistakeMemory?.recovery_required)
|
|
73
|
-
},
|
|
74
|
-
code_structure: {
|
|
75
|
-
risks: codeStructure?.remaining_risks || [],
|
|
76
|
-
files: codeStructure?.files || []
|
|
77
|
-
},
|
|
78
|
-
visual_map: visualMap || null
|
|
5
|
+
legacy_observe_only: true,
|
|
6
|
+
mission: { id: opts.missionId || 'unknown', route: 'team', phase: 'legacy_observe' },
|
|
7
|
+
panes: TEAM_DASHBOARD_PANES,
|
|
8
|
+
gates: [],
|
|
9
|
+
agents: [],
|
|
10
|
+
tasks: []
|
|
79
11
|
};
|
|
80
12
|
}
|
|
81
13
|
export async function writeTeamDashboardState(dir, opts = {}) {
|
|
14
|
+
const { writeJsonAtomic } = await import('./fsx.js');
|
|
15
|
+
const { ARTIFACT_FILES } = await import('./artifact-schemas.js');
|
|
82
16
|
const state = await buildTeamDashboardState(dir, opts);
|
|
83
|
-
await writeJsonAtomic(
|
|
84
|
-
return
|
|
17
|
+
await writeJsonAtomic(`${dir}/${ARTIFACT_FILES.team_dashboard_state}`, state);
|
|
18
|
+
return { ok: true, state };
|
|
85
19
|
}
|
|
86
20
|
export function renderTeamDashboardState(state = {}) {
|
|
87
|
-
|
|
88
|
-
lines.push(`Mission: ${state.mission?.id || 'unknown'} (${state.mission?.route || 'team'})`);
|
|
89
|
-
lines.push(`Effort: ${state.mission?.effort || 'unknown'} | Phase: ${state.mission?.phase || 'unknown'} | Progress: ${state.mission?.progress_pct || 0}%`);
|
|
90
|
-
lines.push(`Next: ${state.mission?.next_action || 'unknown'}`);
|
|
91
|
-
lines.push('');
|
|
92
|
-
for (const pane of state.panes || [])
|
|
93
|
-
lines.push(`[${pane}]`);
|
|
94
|
-
if (state.memory?.forget_queue?.length)
|
|
95
|
-
lines.push(`Forget Queue: ${state.memory.forget_queue.length}`);
|
|
96
|
-
if (state.skills?.injected?.length)
|
|
97
|
-
lines.push(`Skill Autopilot: ${state.skills.injected.length} matched`);
|
|
98
|
-
if (state.mistakes?.recovery_required)
|
|
99
|
-
lines.push('Mistake Immunity: recovery required');
|
|
100
|
-
if (state.code_structure?.risks?.length)
|
|
101
|
-
lines.push(`Code Structure Risks: ${state.code_structure.risks.length}`);
|
|
102
|
-
return lines.join('\n');
|
|
21
|
+
return `Mission: ${state.mission?.id || 'unknown'} (${state.mission?.route || 'team'})\nPhase: ${state.mission?.phase || 'legacy_observe'}`;
|
|
103
22
|
}
|
|
104
23
|
//# sourceMappingURL=team-dashboard-renderer.js.map
|