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
|
@@ -11,7 +11,7 @@ import { writeCodeStructureReport } from '../code-structure.js';
|
|
|
11
11
|
import { writeMemorySweepReport } from '../memory-governor.js';
|
|
12
12
|
import { writeMistakeMemoryReport } from '../mistake-memory.js';
|
|
13
13
|
import { MISTAKE_RECALL_ARTIFACT, mistakeRecallGateStatus } from '../mistake-recall.js';
|
|
14
|
-
import { recordSkillDreamEvent, skillDreamPolicyText, writeSkillForgeReport } from '../skill-forge.js';
|
|
14
|
+
import { recordSkillDreamEvent, SKILL_DREAM_POLICY, skillDreamPolicyText, writeSkillForgeReport } from '../skill-forge.js';
|
|
15
15
|
import { evaluateResearchGate, writeResearchPlan } from '../research.js';
|
|
16
16
|
import { PPT_REQUIRED_GATE_FIELDS, writePptRouteArtifacts } from '../ppt.js';
|
|
17
17
|
import { writeQaLoopArtifacts } from '../qa-loop.js';
|
|
@@ -28,13 +28,12 @@ import { normalizeAgentPolicy, routeRequiresAgentIntake, agentPipelineStage } fr
|
|
|
28
28
|
import { readAgentGateStatus } from '../agents/agent-gate.js';
|
|
29
29
|
import { CODEX_APP_IMAGE_GENERATION_DOC_URL, CODEX_COMPUTER_USE_EVIDENCE_SOURCE, CODEX_COMPUTER_USE_ONLY_POLICY, CODEX_IMAGEGEN_REQUIRED_POLICY, CODEX_WEB_VERIFICATION_POLICY, FROM_CHAT_IMG_CHECKLIST_ARTIFACT, FROM_CHAT_IMG_COVERAGE_ARTIFACT, FROM_CHAT_IMG_QA_LOOP_ARTIFACT, FROM_CHAT_IMG_TEMP_TRIWIKI_ARTIFACT, FROM_CHAT_IMG_TEMP_TRIWIKI_SESSIONS, SOLUTION_SCOUT_STAGE_ID, chatCaptureIntakeText, context7RequirementText, dollarCommand, evidenceMentionsForbiddenBrowserAutomation, getdesignReferencePolicyText, hasFromChatImgSignal, hasMadSksSignal, imageUxReviewPipelinePolicyText, leanEngineeringCompactText, looksLikeProblemSolvingRequest, pptPipelineAllowlistPolicyText, reflectionRequiredForRoute, reasoningInstruction, routeNeedsContext7, routePrompt, routeReasoning, routeRequiresSubagents, solutionScoutPolicyText, stripDollarCommand, stripMadSksSignal, stripVisibleDecisionAnswerBlocks, subagentExecutionPolicyText, stackCurrentDocsPolicyText, triwikiContextTracking, triwikiContextTrackingText, triwikiStagePolicyText } from '../routes.js';
|
|
30
30
|
import { normalizeLeanDecision, validateLeanDecision } from '../lean-engineering-policy.js';
|
|
31
|
-
import {
|
|
32
|
-
import { formatAgentReasoning, formatRoleCounts, initTeamLive, parseTeamSpecText, teamReasoningPolicy } from '../team-live.js';
|
|
33
|
-
import { evaluateTeamReviewPolicyGate, MIN_TEAM_REVIEWER_LANES, MIN_TEAM_REVIEW_POLICY_TEXT, teamReviewPolicy } from '../team-review-policy.js';
|
|
31
|
+
import { MIN_TEAM_REVIEWER_LANES, MIN_TEAM_REVIEW_POLICY_TEXT } from '../team-review-policy.js';
|
|
34
32
|
import { normalizeCodexMultiAgentEventName } from '../codex-control/codex-multi-agent-event-normalizer.js';
|
|
35
33
|
export { routePrompt };
|
|
36
34
|
export const PIPELINE_PLAN_ARTIFACT = 'pipeline-plan.json';
|
|
37
35
|
export const PIPELINE_PLAN_SCHEMA_VERSION = 1;
|
|
36
|
+
const SKILL_DREAM_HOT_PATH_COUNTERS = new Map();
|
|
38
37
|
function ambientGoalContinuation() {
|
|
39
38
|
return {
|
|
40
39
|
schema_version: 1,
|
|
@@ -509,9 +508,10 @@ export function answerOnlyContext(prompt, route = routePrompt(prompt)) {
|
|
|
509
508
|
'Answer directly and concisely. If the prompt is actually asking for code/work after inspection, state the re-route and use the proper execution pipeline.'
|
|
510
509
|
].join('\n');
|
|
511
510
|
}
|
|
512
|
-
export async function prepareRoute(root, prompt, state = {}) {
|
|
511
|
+
export async function prepareRoute(root, prompt, state = {}, opts = {}) {
|
|
513
512
|
const cleanPrompt = stripVisibleDecisionAnswerBlocks(prompt);
|
|
514
513
|
const route = routePrompt(cleanPrompt);
|
|
514
|
+
const sessionKey = opts.sessionKey || state?._session_key || null;
|
|
515
515
|
const madSksAuthorization = hasMadSksSignal(cleanPrompt);
|
|
516
516
|
const task = stripDollarCommand(stripMadSksSignal(cleanPrompt)) || stripMadSksSignal(stripDollarCommand(cleanPrompt)) || String(cleanPrompt || '').trim();
|
|
517
517
|
const explicit = Boolean(dollarCommand(cleanPrompt));
|
|
@@ -527,30 +527,30 @@ export async function prepareRoute(root, prompt, state = {}) {
|
|
|
527
527
|
if (route.id === 'Wiki')
|
|
528
528
|
return withSkillDreamContext(await prepareWikiQuickRoute(route, task), dreamContext);
|
|
529
529
|
if (route.id === 'Goal')
|
|
530
|
-
return withSkillDreamContext(await prepareGoal(root, route, task, routeNeedsContext7(route, cleanPrompt)), dreamContext);
|
|
530
|
+
return withSkillDreamContext(await prepareGoal(root, route, task, routeNeedsContext7(route, cleanPrompt), { sessionKey }), dreamContext);
|
|
531
531
|
if (route.id === 'ImageUXReview')
|
|
532
|
-
return withSkillDreamContext(await prepareImageUxReview(root, route, task, routeNeedsContext7(route, cleanPrompt)), dreamContext);
|
|
532
|
+
return withSkillDreamContext(await prepareImageUxReview(root, route, task, routeNeedsContext7(route, cleanPrompt), { sessionKey }), dreamContext);
|
|
533
533
|
if (route.id === 'MadDB')
|
|
534
|
-
return withSkillDreamContext(await prepareMadDb(root, route, task, routeNeedsContext7(route, cleanPrompt)), dreamContext);
|
|
534
|
+
return withSkillDreamContext(await prepareMadDb(root, route, task, routeNeedsContext7(route, cleanPrompt), { sessionKey }), dreamContext);
|
|
535
535
|
const required = routeNeedsContext7(route, cleanPrompt);
|
|
536
536
|
const reasoning = routeReasoning(route, cleanPrompt);
|
|
537
537
|
const nativeSessionsRequired = routeRequiresSubagents(route, cleanPrompt);
|
|
538
538
|
if (QUESTION_GATE_ROUTES.has(route.id) || route.id === 'MadSKS')
|
|
539
|
-
return withSkillDreamContext(await prepareClarificationGate(root, route, task, required, { madSksAuthorization }), dreamContext);
|
|
539
|
+
return withSkillDreamContext(await prepareClarificationGate(root, route, task, required, { madSksAuthorization, sessionKey }), dreamContext);
|
|
540
540
|
if (route.id === 'Naruto')
|
|
541
|
-
return withSkillDreamContext(await prepareNaruto(root, route, task, required, { madSksAuthorization }), dreamContext);
|
|
541
|
+
return withSkillDreamContext(await prepareNaruto(root, route, task, required, { madSksAuthorization, sessionKey }), dreamContext);
|
|
542
542
|
if (route.id === 'Team')
|
|
543
|
-
return withSkillDreamContext(await prepareNaruto(root, { ...route, id: 'Naruto', command: '$Naruto', mode: 'NARUTO', stopGate: 'naruto-gate.json', requiredSkills: ['naruto', 'pipeline-runner', 'prompt-pipeline', 'honest-mode'] }, task, required, { madSksAuthorization, teamAlias: true }), dreamContext);
|
|
543
|
+
return withSkillDreamContext(await prepareNaruto(root, { ...route, id: 'Naruto', command: '$Naruto', mode: 'NARUTO', stopGate: 'naruto-gate.json', requiredSkills: ['naruto', 'pipeline-runner', 'prompt-pipeline', 'honest-mode'] }, task, required, { madSksAuthorization, teamAlias: true, sessionKey }), dreamContext);
|
|
544
544
|
if (route.id === 'Research')
|
|
545
|
-
return withSkillDreamContext(await prepareResearch(root, route, task, required), dreamContext);
|
|
545
|
+
return withSkillDreamContext(await prepareResearch(root, route, task, required, { sessionKey }), dreamContext);
|
|
546
546
|
if (route.id === 'AutoResearch')
|
|
547
|
-
return withSkillDreamContext(await prepareAutoResearch(root, route, task, required), dreamContext);
|
|
547
|
+
return withSkillDreamContext(await prepareAutoResearch(root, route, task, required, { sessionKey }), dreamContext);
|
|
548
548
|
if (route.id === 'DB')
|
|
549
|
-
return withSkillDreamContext(await prepareDb(root, route, task, required), dreamContext);
|
|
549
|
+
return withSkillDreamContext(await prepareDb(root, route, task, required, { sessionKey }), dreamContext);
|
|
550
550
|
if (route.id === 'GX')
|
|
551
|
-
return withSkillDreamContext(await prepareGx(root, route, task, required), dreamContext);
|
|
551
|
+
return withSkillDreamContext(await prepareGx(root, route, task, required, { sessionKey }), dreamContext);
|
|
552
552
|
if (explicit || required)
|
|
553
|
-
return withSkillDreamContext(await prepareLightRoute(root, route, task, required), dreamContext);
|
|
553
|
+
return withSkillDreamContext(await prepareLightRoute(root, route, task, required, { sessionKey }), dreamContext);
|
|
554
554
|
return withSkillDreamContext({
|
|
555
555
|
route,
|
|
556
556
|
additionalContext: `${promptPipelineContext(prompt, route)}\n\nReasoning: ${reasoning.effort} (${reasoning.reason}); temporary profile ${reasoning.profile}.\nRequired skills: ${route.requiredSkills.join(', ')}.\nNative sessions required: ${nativeSessionsRequired ? 'yes' : 'no'}.`
|
|
@@ -558,12 +558,17 @@ export async function prepareRoute(root, prompt, state = {}) {
|
|
|
558
558
|
}
|
|
559
559
|
async function routeSkillDreamContext(root, route, task) {
|
|
560
560
|
try {
|
|
561
|
+
const counterKey = path.resolve(root);
|
|
562
|
+
const observed = (SKILL_DREAM_HOT_PATH_COUNTERS.get(counterKey) || 0) + 1;
|
|
563
|
+
SKILL_DREAM_HOT_PATH_COUNTERS.set(counterKey, observed);
|
|
564
|
+
if (observed % SKILL_DREAM_POLICY.min_events_between_runs !== 0)
|
|
565
|
+
return '';
|
|
561
566
|
const result = await recordSkillDreamEvent(root, {
|
|
562
567
|
route: route.id,
|
|
563
568
|
command: route.command,
|
|
564
569
|
required_skills: route.requiredSkills || [],
|
|
565
570
|
prompt: task
|
|
566
|
-
});
|
|
571
|
+
}, { event_count: SKILL_DREAM_POLICY.min_events_between_runs });
|
|
567
572
|
if (!result.report)
|
|
568
573
|
return '';
|
|
569
574
|
return [
|
|
@@ -632,8 +637,8 @@ async function prepareWikiQuickRoute(route, task) {
|
|
|
632
637
|
].join('\n')
|
|
633
638
|
};
|
|
634
639
|
}
|
|
635
|
-
async function prepareImageUxReview(root, route, task, required) {
|
|
636
|
-
const { id, dir, mission } = await createMission(root, { mode: 'image-ux-review', prompt: task });
|
|
640
|
+
async function prepareImageUxReview(root, route, task, required, opts = {}) {
|
|
641
|
+
const { id, dir, mission } = await createMission(root, { mode: 'image-ux-review', prompt: task, sessionKey: opts.sessionKey });
|
|
637
642
|
const contract = {
|
|
638
643
|
prompt: task,
|
|
639
644
|
answers: {
|
|
@@ -667,7 +672,7 @@ async function prepareImageUxReview(root, route, task, required) {
|
|
|
667
672
|
image_ux_review_policy_ready: true,
|
|
668
673
|
pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok,
|
|
669
674
|
pipeline_plan_path: PIPELINE_PLAN_ARTIFACT
|
|
670
|
-
}));
|
|
675
|
+
}), { sessionKey: opts.sessionKey });
|
|
671
676
|
return routeContext(route, id, task, required, `Capture or attach source UI screenshots, run Codex App $imagegen/gpt-image-2 to generate annotated review images, extract those generated images into ${IMAGE_UX_REVIEW_ISSUE_LEDGER_ARTIFACT}, then update ${IMAGE_UX_REVIEW_GATE_ARTIFACT}. ${CODEX_IMAGEGEN_REQUIRED_POLICY} Initial gate blockers: ${(artifacts.gate.blockers || []).join(', ') || 'none'}.`);
|
|
672
677
|
}
|
|
673
678
|
export async function activeRouteContext(root, state) {
|
|
@@ -689,7 +694,7 @@ export async function activeRouteContext(root, state) {
|
|
|
689
694
|
const context7 = state.context7_required && !(await hasContext7DocsEvidence(root, state))
|
|
690
695
|
? ' Context7 evidence is still required before completion: use resolve-library-id, then query-docs (or legacy get-library-docs).'
|
|
691
696
|
: '';
|
|
692
|
-
const roles = state.role_counts ? ` Role counts: ${
|
|
697
|
+
const roles = state.role_counts ? ` Role counts: ${formatLegacyRoleCounts(state.role_counts)}.` : '';
|
|
693
698
|
return `Active Team mission ${state.mission_id || 'latest'} must keep the user-visible live transcript updated. Native session budget: ${state.agent_sessions || MIN_TEAM_REVIEWER_LANES}.${roles} Run native sessions, TriWiki refresh, debate, consensus, fresh development, minimum ${MIN_TEAM_REVIEWER_LANES}-lane review/integration, then close or account for every Team native session and write ${TEAM_SESSION_CLEANUP_ARTIFACT} before reflection/final. ${MIN_TEAM_REVIEW_POLICY_TEXT} After each native-session status/result/handoff, run: sks team event ${state.mission_id || 'latest'} --agent <name> --phase <phase> --message "...". Inspect with sks team log/watch ${state.mission_id || 'latest'}.${reasoningNote}${context7}${planNote}`;
|
|
694
699
|
}
|
|
695
700
|
if (state.mode === 'NARUTO') {
|
|
@@ -719,8 +724,8 @@ async function activePipelinePlanNote(root, state = {}) {
|
|
|
719
724
|
const intake = plan.request_intake?.artifact ? ` Request intake: .sneakoscope/missions/${state.mission_id}/${plan.request_intake.artifact}; execution prompt=${plan.request_intake.transformed_prompt_available ? 'available' : 'missing'}.` : '';
|
|
720
725
|
return ` Pipeline plan: .sneakoscope/missions/${state.mission_id}/${PIPELINE_PLAN_ARTIFACT} (${lane}; kept=${kept}, skipped=${skipped}).${intake}${next}`;
|
|
721
726
|
}
|
|
722
|
-
async function prepareGoal(root, route, task, required) {
|
|
723
|
-
const { id, dir, mission } = await createMission(root, { mode: 'goal', prompt: task });
|
|
727
|
+
async function prepareGoal(root, route, task, required, opts = {}) {
|
|
728
|
+
const { id, dir, mission } = await createMission(root, { mode: 'goal', prompt: task, sessionKey: opts.sessionKey });
|
|
724
729
|
const workflow = await writeGoalWorkflow(dir, mission, { action: 'create', prompt: task });
|
|
725
730
|
await writeJsonAtomic(path.join(dir, 'route-context.json'), { route: route.id, command: route.command, mode: route.mode, task, required_skills: route.requiredSkills, context7_required: required, native_goal: workflow.native_goal, stop_gate: route.stopGate });
|
|
726
731
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'not_required' } });
|
|
@@ -730,7 +735,7 @@ async function prepareGoal(root, route, task, required) {
|
|
|
730
735
|
&& !['Answer', 'DFix', 'Goal', 'Help'].includes(executionRoute.id);
|
|
731
736
|
if (shouldDelegateExecution) {
|
|
732
737
|
await appendJsonl(path.join(dir, 'events.jsonl'), { ts: nowIso(), type: 'goal.delegated_execution_route', route: executionRoute.id, command: executionRoute.command });
|
|
733
|
-
const delegated = await prepareRoute(root, task, {});
|
|
738
|
+
const delegated = await prepareRoute(root, task, {}, { sessionKey: opts.sessionKey });
|
|
734
739
|
return {
|
|
735
740
|
route,
|
|
736
741
|
additionalContext: [
|
|
@@ -743,11 +748,11 @@ Delegated execution route: ${executionRoute.command}. The delegated route missio
|
|
|
743
748
|
].filter(Boolean).join('\n\n')
|
|
744
749
|
};
|
|
745
750
|
}
|
|
746
|
-
await setCurrent(root, routeState(id, route, 'GOAL_READY', required, { prompt: task, native_goal: workflow.native_goal, stop_gate: route.stopGate, implementation_allowed: true, questions_allowed: true, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }));
|
|
751
|
+
await setCurrent(root, routeState(id, route, 'GOAL_READY', required, { prompt: task, native_goal: workflow.native_goal, stop_gate: route.stopGate, implementation_allowed: true, questions_allowed: true, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }), { sessionKey: opts.sessionKey });
|
|
747
752
|
return routeContext(route, id, task, required, `Use Codex native ${workflow.native_goal.slash_command} control for persisted continuation, then continue the relevant SKS route gates for any implementation work.`);
|
|
748
753
|
}
|
|
749
754
|
async function prepareClarificationGate(root, route, task, required, opts = {}) {
|
|
750
|
-
const { id, dir, mission } = await createMission(root, { mode: String(route.mode || route.id || 'route').toLowerCase(), prompt: task });
|
|
755
|
+
const { id, dir, mission } = await createMission(root, { mode: String(route.mode || route.id || 'route').toLowerCase(), prompt: task, sessionKey: opts.sessionKey });
|
|
751
756
|
const schema = buildQuestionSchemaForRoute(route, task);
|
|
752
757
|
if (opts.madSksAuthorization)
|
|
753
758
|
applyMadSksAuthorizationToSchema(schema);
|
|
@@ -758,14 +763,7 @@ async function prepareClarificationGate(root, route, task, required, opts = {})
|
|
|
758
763
|
await writeJsonAtomic(path.join(dir, 'answers.json'), autoAnswersForSchema(schema));
|
|
759
764
|
const result = await sealContract(dir, mission);
|
|
760
765
|
let materialized = {};
|
|
761
|
-
if (result.ok && route?.id === '
|
|
762
|
-
materialized = await materializeAutoSealedTeam(root, id, dir, route, task, result.contract?.sealed_hash || null);
|
|
763
|
-
if (opts.madSksAuthorization) {
|
|
764
|
-
const madSksState = await materializeMadSksAuthorization(dir, id, route, routeContext, result.contract || {});
|
|
765
|
-
materialized = { ...materialized, state: { ...(materialized.state || {}), ...madSksState } };
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
else if (result.ok && route?.id === 'MadSKS') {
|
|
766
|
+
if (result.ok && route?.id === 'MadSKS') {
|
|
769
767
|
materialized = await materializeAutoSealedMadSks(dir, id, route, routeContext, result.contract || {});
|
|
770
768
|
}
|
|
771
769
|
else if (result.ok && route?.id === 'QALoop') {
|
|
@@ -809,7 +807,7 @@ async function prepareClarificationGate(root, route, task, required, opts = {})
|
|
|
809
807
|
original_stop_gate: route.stopGate,
|
|
810
808
|
stop_gate: route.stopGate,
|
|
811
809
|
...(materialized.state || {})
|
|
812
|
-
}));
|
|
810
|
+
}), { sessionKey: opts.sessionKey });
|
|
813
811
|
const materializedLine = materialized.phase ? `\nRoute artifacts were materialized immediately; state advanced to ${materialized.phase}.` : '';
|
|
814
812
|
return {
|
|
815
813
|
route,
|
|
@@ -872,6 +870,13 @@ async function materializeAutoSealedMadSks(dir, id, route, routeContext = {}, co
|
|
|
872
870
|
normal_db_writes_allowed: true,
|
|
873
871
|
live_server_writes_allowed: true,
|
|
874
872
|
migration_apply_allowed: true,
|
|
873
|
+
sql_plane: {
|
|
874
|
+
requested: false,
|
|
875
|
+
capability_id: null,
|
|
876
|
+
operation_classes: [],
|
|
877
|
+
read_back_passed: false,
|
|
878
|
+
profile_closed: false
|
|
879
|
+
},
|
|
875
880
|
catastrophic_safety_guard_active: true,
|
|
876
881
|
permission_profile: permissionGateSummary(),
|
|
877
882
|
contract_hash: contract.sealed_hash || null
|
|
@@ -938,196 +943,33 @@ async function materializeMadSksAuthorization(dir, id, route, routeContext = {},
|
|
|
938
943
|
catastrophic_safety_guard_active: true
|
|
939
944
|
};
|
|
940
945
|
}
|
|
941
|
-
async function
|
|
942
|
-
const
|
|
943
|
-
const cleanTask = spec.prompt || task;
|
|
944
|
-
const fromChatImgRequired = hasFromChatImgSignal(cleanTask);
|
|
945
|
-
const { agentSessions, roleCounts, roster } = spec;
|
|
946
|
-
const plan = {
|
|
947
|
-
schema_version: 1,
|
|
948
|
-
mission_id: id,
|
|
949
|
-
task: cleanTask,
|
|
950
|
-
agent_session_count: agentSessions,
|
|
951
|
-
default_agent_session_count: MIN_TEAM_REVIEWER_LANES,
|
|
952
|
-
role_counts: roleCounts,
|
|
953
|
-
session_policy: `Use at most ${agentSessions} native multi-session lanes at a time; the parent orchestrator is not counted.`,
|
|
954
|
-
review_policy: teamReviewPolicy(),
|
|
955
|
-
review_gate: evaluateTeamReviewPolicyGate({ roleCounts, agentSessions, roster }),
|
|
956
|
-
bundle_size: roster.bundle_size,
|
|
957
|
-
roster,
|
|
958
|
-
goal_continuation: ambientGoalContinuation(),
|
|
959
|
-
reasoning: teamReasoningPolicy(cleanTask, roster),
|
|
960
|
-
contract_hash: contractHash,
|
|
961
|
-
ssot_guard: buildSsotGuard({ route: route?.id || 'Team', mode: route?.mode || 'TEAM', task: cleanTask, contractHash }),
|
|
962
|
-
team_model: {
|
|
963
|
-
phases: ['native_agent_intake', 'triwiki_stage_refresh', 'debate_team', 'runtime_task_graph', 'development_team', 'review'],
|
|
964
|
-
analysis_team: `Native multi-session agent intake with exactly ${roster.bundle_size} native_agent_N agents.`,
|
|
965
|
-
debate_team: `Read-only role debate with exactly ${roster.bundle_size} participants.`,
|
|
966
|
-
development_team: `Fresh parallel development bundle with exactly ${roster.bundle_size} executor_N developers implementing disjoint slices.`,
|
|
967
|
-
review_team: `Validation runs at least ${MIN_TEAM_REVIEWER_LANES} independent reviewer/QA lanes before integration or final.`
|
|
968
|
-
},
|
|
969
|
-
context_tracking: triwikiContextTracking(),
|
|
970
|
-
team_runtime: teamRuntimePlanMetadata(),
|
|
971
|
-
phases: [
|
|
972
|
-
{ id: 'team_roster_confirmation', goal: `Materialize the Team roster from default SKS counts or explicit user counts, write team-roster.json, and surface role counts ${formatRoleCounts(roleCounts)}.`, agents: ['parent_orchestrator'], output: 'team-roster.json' },
|
|
973
|
-
{ id: 'native_agent_intake', goal: `Read TriWiki context, then run exactly ${roster.bundle_size} bounded workspace-write native_agent_N sessions in parallel. ${fromChatImgRequired ? `From-Chat-IMG active: ${CODEX_COMPUTER_USE_ONLY_POLICY}` : 'From-Chat-IMG inactive: do not assume ordinary images are chat captures.'} Native agents may edit only parent-assigned lease paths and parent integration owns final changes.`, agents: roster.analysis_team.map((agent) => agent.id), max_parallel_native_sessions: agentSessions, write_policy: 'bounded workspace-write leases; parent-owned integration' },
|
|
974
|
-
{ id: 'triwiki_refresh', goal: `Refresh or pack TriWiki and run ${triwikiContextTracking().validate_command}.`, agents: ['parent_orchestrator'], output: '.sneakoscope/wiki/context-pack.json' },
|
|
975
|
-
{ id: 'ssot_guard', goal: ssotGuardPolicyText(), agents: ['parent_orchestrator'], output: SSOT_GUARD_ARTIFACT },
|
|
976
|
-
{ id: 'planning_debate', goal: 'Run read-only planning debate, map constraints and implementation slices, then seal one objective.', agents: roster.debate_team.map((agent) => agent.id) },
|
|
977
|
-
{ id: 'runtime_task_graph_compile', goal: `Compile the agreed Team plan into ${TEAM_GRAPH_ARTIFACT}, ${TEAM_RUNTIME_TASKS_ARTIFACT}, ${TEAM_DECOMPOSITION_ARTIFACT}, and ${TEAM_INBOX_DIR}.`, agents: ['parent_orchestrator'], output: [TEAM_GRAPH_ARTIFACT, TEAM_RUNTIME_TASKS_ARTIFACT, TEAM_DECOMPOSITION_ARTIFACT, TEAM_INBOX_DIR] },
|
|
978
|
-
{ id: 'parallel_implementation', goal: `Close debate agents, then run a fresh ${roster.bundle_size}-person executor development team with non-overlapping write ownership.`, agents: roster.development_team.map((agent) => agent.id) },
|
|
979
|
-
{ id: 'review_integration', goal: `${MIN_TEAM_REVIEW_POLICY_TEXT} Integrate, verify, and record evidence before final.`, agents: roster.validation_team.map((agent) => agent.id), min_reviewer_lanes: MIN_TEAM_REVIEWER_LANES },
|
|
980
|
-
{ id: 'session_cleanup', goal: `Close or account for Team native sessions and write ${TEAM_SESSION_CLEANUP_ARTIFACT}.`, agents: ['parent_orchestrator'] }
|
|
981
|
-
],
|
|
982
|
-
live_visibility: {
|
|
983
|
-
markdown: 'team-live.md',
|
|
984
|
-
transcript: 'team-transcript.jsonl',
|
|
985
|
-
dashboard: 'team-dashboard.json',
|
|
986
|
-
zellij: 'CLI Team entrypoints open Zellij live lanes for the visible Team agent budget when Zellij is available.',
|
|
987
|
-
commands: ['sks team status latest', 'sks team log latest', 'sks team tail latest', 'sks team open-zellij latest', 'sks team watch latest', 'sks team lane latest --agent <name> --follow']
|
|
988
|
-
},
|
|
989
|
-
required_artifacts: ['team-roster.json', 'team-analysis.md', ...(fromChatImgRequired ? [FROM_CHAT_IMG_COVERAGE_ARTIFACT, FROM_CHAT_IMG_CHECKLIST_ARTIFACT, FROM_CHAT_IMG_TEMP_TRIWIKI_ARTIFACT, FROM_CHAT_IMG_QA_LOOP_ARTIFACT] : []), SSOT_GUARD_ARTIFACT, 'team-consensus.md', ...teamRuntimeRequiredArtifacts(), 'team-review.md', 'team-gate.json', TEAM_SESSION_CLEANUP_ARTIFACT, 'reflection.md', 'reflection-gate.json', 'team-live.md', 'team-transcript.jsonl', 'team-dashboard.json', '.sneakoscope/wiki/context-pack.json', 'context7-evidence.jsonl']
|
|
990
|
-
};
|
|
991
|
-
await writeJsonAtomic(path.join(dir, 'team-plan.json'), plan);
|
|
992
|
-
await writeJsonAtomic(path.join(dir, SSOT_GUARD_ARTIFACT), plan.ssot_guard);
|
|
993
|
-
await writeJsonAtomic(path.join(dir, 'team-roster.json'), { schema_version: 1, mission_id: id, role_counts: roleCounts, agent_sessions: agentSessions, bundle_size: roster.bundle_size, roster, confirmed: true, source: 'auto_sealed_team_spec' });
|
|
994
|
-
const contextTracking = triwikiContextTracking();
|
|
995
|
-
await writeTextAtomic(path.join(dir, 'team-workflow.md'), `# SKS Team Workflow\n\nTask: ${cleanTask}\n\nAgent session budget: ${agentSessions}\nBundle size: ${roster.bundle_size}\nRole counts: ${formatRoleCounts(roleCounts)}\nReview policy: ${MIN_TEAM_REVIEW_POLICY_TEXT}\nContext tracking: ${contextTracking.ssot} SSOT, ${contextTracking.default_pack}.\n\nAuto-sealed ambiguity gate: no user question was required. Continue directly with Team agenting, debate, runtime task graph, implementation, minimum ${MIN_TEAM_REVIEWER_LANES}-lane review, cleanup, reflection, and Honest Mode.\n`);
|
|
996
|
-
await initTeamLive(id, dir, cleanTask, { agentSessions, roleCounts, roster });
|
|
997
|
-
const runtime = await writeTeamRuntimeArtifacts(dir, plan, { contractHash });
|
|
998
|
-
await writeMemorySweepReport(root, dir, { missionId: id }).catch(() => null);
|
|
999
|
-
await writeSkillForgeReport(dir, { mission_id: id, route: 'team', task_signature: cleanTask }).catch(() => null);
|
|
1000
|
-
await writeMistakeMemoryReport(dir, { mission_id: id, route: 'team', task: cleanTask }).catch(() => null);
|
|
1001
|
-
await writeCodeStructureReport(root, dir, { missionId: id, exception: 'Team auto-seal records split-review risk; extraction happens only when the mission scope includes the touched file.' }).catch(() => null);
|
|
1002
|
-
await writeJsonAtomic(path.join(dir, 'team-gate.json'), {
|
|
1003
|
-
passed: false,
|
|
1004
|
-
team_roster_confirmed: true,
|
|
1005
|
-
analysis_artifact: false,
|
|
1006
|
-
triwiki_refreshed: false,
|
|
1007
|
-
triwiki_validated: false,
|
|
1008
|
-
consensus_artifact: false,
|
|
1009
|
-
...runtime.gate_fields,
|
|
1010
|
-
implementation_team_fresh: false,
|
|
1011
|
-
review_artifact: false,
|
|
1012
|
-
integration_evidence: false,
|
|
1013
|
-
session_cleanup: false,
|
|
1014
|
-
context7_evidence: false,
|
|
1015
|
-
ssot_guard: false,
|
|
1016
|
-
...(fromChatImgRequired ? { from_chat_img_required: true, from_chat_img_request_coverage: false } : {}),
|
|
1017
|
-
contract_hash: contractHash
|
|
1018
|
-
});
|
|
1019
|
-
await appendJsonl(path.join(dir, 'events.jsonl'), { ts: nowIso(), type: 'team.materialized_after_auto_sealed_ambiguity_gate', route: route.id, bundle_size: roster.bundle_size, agent_sessions: agentSessions });
|
|
1020
|
-
return {
|
|
1021
|
-
phase: 'TEAM_NATIVE_AGENT_INTAKE',
|
|
1022
|
-
prompt: cleanTask,
|
|
1023
|
-
state: {
|
|
1024
|
-
agent_sessions: agentSessions,
|
|
1025
|
-
role_counts: roleCounts,
|
|
1026
|
-
team_roster_confirmed: true,
|
|
1027
|
-
team_plan_ready: true,
|
|
1028
|
-
team_graph_ready: runtime.ok,
|
|
1029
|
-
team_live_ready: true,
|
|
1030
|
-
from_chat_img_required: fromChatImgRequired
|
|
1031
|
-
}
|
|
1032
|
-
};
|
|
1033
|
-
}
|
|
1034
|
-
async function prepareTeam(root, route, task, required, opts = {}) {
|
|
1035
|
-
const spec = parseTeamSpecText(task);
|
|
1036
|
-
const cleanTask = spec.prompt || task;
|
|
1037
|
-
const fromChatImgRequired = hasFromChatImgSignal(cleanTask);
|
|
1038
|
-
const { agentSessions, roleCounts, roster } = spec;
|
|
1039
|
-
const { id, dir } = await createMission(root, { mode: 'team', prompt: cleanTask });
|
|
1040
|
-
const plan = {
|
|
1041
|
-
schema_version: 1,
|
|
1042
|
-
mission_id: id,
|
|
1043
|
-
task: cleanTask,
|
|
1044
|
-
agent_session_count: agentSessions,
|
|
1045
|
-
default_agent_session_count: MIN_TEAM_REVIEWER_LANES,
|
|
1046
|
-
role_counts: roleCounts,
|
|
1047
|
-
session_policy: `Use at most ${agentSessions} native multi-session lanes at a time; the parent orchestrator is not counted.`,
|
|
1048
|
-
review_policy: teamReviewPolicy(),
|
|
1049
|
-
review_gate: evaluateTeamReviewPolicyGate({ roleCounts, agentSessions, roster }),
|
|
1050
|
-
bundle_size: roster.bundle_size,
|
|
1051
|
-
roster,
|
|
1052
|
-
goal_continuation: ambientGoalContinuation(),
|
|
1053
|
-
reasoning: teamReasoningPolicy(cleanTask, roster),
|
|
1054
|
-
ssot_guard: buildSsotGuard({ route: route?.id || 'Team', mode: route?.mode || 'TEAM', task: cleanTask }),
|
|
1055
|
-
team_model: {
|
|
1056
|
-
phases: ['native_agent_intake', 'triwiki_stage_refresh', 'debate_team', 'triwiki_stage_refresh', 'runtime_task_graph', 'development_team', 'triwiki_stage_refresh', 'review'],
|
|
1057
|
-
analysis_team: `Native multi-session agent intake with exactly ${roster.bundle_size} native_agent_N agents. Each native agent owns one investigation slice and returns TriWiki-ready findings with source paths, risks, and suggested implementation slices.`,
|
|
1058
|
-
debate_team: `Read-only role debate with exactly ${roster.bundle_size} participants composed from user, planner, reviewer, and executor voices applying compact Hyperplan-derived adversarial lenses.`,
|
|
1059
|
-
development_team: `Fresh parallel development bundle with exactly ${roster.bundle_size} executor_N developers implementing disjoint slices; validation_team reviews afterward.`,
|
|
1060
|
-
review_team: `Validation runs at least ${MIN_TEAM_REVIEWER_LANES} independent reviewer/QA lanes before integration or final.`
|
|
1061
|
-
},
|
|
1062
|
-
context_tracking: triwikiContextTracking(),
|
|
1063
|
-
team_runtime: teamRuntimePlanMetadata(),
|
|
1064
|
-
phases: [
|
|
1065
|
-
{ id: 'team_roster_confirmation', goal: `Before any implementation, materialize the Team roster from default SKS counts or explicit user counts, write team-roster.json, and surface role counts ${formatRoleCounts(roleCounts)}. Implementation cannot be considered complete unless team-gate.json has team_roster_confirmed=true.`, agents: ['parent_orchestrator'], output: 'team-roster.json' },
|
|
1066
|
-
{ id: 'native_agent_intake', goal: `Before native agent intake, read TriWiki context. ${fromChatImgRequired ? `From-Chat-IMG active: for web/browser/webapp targets require Codex Chrome Extension readiness first; for native Mac/non-web surfaces use Codex Computer Use visual inspection when available. List every visible customer request, match every screenshot image region to attachments, write ${FROM_CHAT_IMG_COVERAGE_ARTIFACT}, ${FROM_CHAT_IMG_CHECKLIST_ARTIFACT}, and ${FROM_CHAT_IMG_TEMP_TRIWIKI_ARTIFACT}, then require scoped QA-LOOP evidence in ${FROM_CHAT_IMG_QA_LOOP_ARTIFACT} after the customer-request work is done. ${CODEX_WEB_VERIFICATION_POLICY} ${CODEX_COMPUTER_USE_ONLY_POLICY}` : `From-Chat-IMG inactive: do not assume ordinary images are chat captures. ${CODEX_WEB_VERIFICATION_POLICY} ${CODEX_COMPUTER_USE_ONLY_POLICY}`} Run exactly ${roster.bundle_size} bounded workspace-write native_agent_N sessions in parallel, using the full available session budget without exceeding ${agentSessions}. Split repo/docs/tests/API/user-flow/risk investigation into independent slices, hydrate relevant low-trust claims from source, record source-backed findings, and edit only parent-assigned lease paths.`, agents: roster.analysis_team.map((agent) => agent.id), max_parallel_native_sessions: agentSessions, write_policy: 'bounded workspace-write leases; parent-owned integration' },
|
|
1067
|
-
{ id: 'triwiki_refresh', goal: `Parent orchestrator updates Team analysis artifacts, then runs ${triwikiContextTracking().refresh_command} or ${triwikiContextTracking().pack_command}, prunes with ${triwikiContextTracking().prune_command} when stale/oversized wiki state would pollute handoffs, and runs ${triwikiContextTracking().validate_command} so the next stage uses current TriWiki context.`, agents: ['parent_orchestrator'], output: '.sneakoscope/wiki/context-pack.json' },
|
|
1068
|
-
{ id: 'ssot_guard', goal: ssotGuardPolicyText(), agents: ['parent_orchestrator'], output: SSOT_GUARD_ARTIFACT },
|
|
1069
|
-
{ id: 'planning_debate', goal: `Before debate, read the refreshed TriWiki pack. Debate team of exactly ${roster.bundle_size} participants maps user inconvenience, options, constraints, affected files, DB/test risk, and tradeoffs while applying compact Hyperplan-derived lenses: challenge framing, subtract surface, demand evidence, test integration risk, and consider one simpler alternative. Hydrate low-trust claims from source.`, agents: roster.debate_team.map((agent) => agent.id) },
|
|
1070
|
-
{ id: 'consensus', goal: `Seal one objective with acceptance criteria and disjoint implementation slices, then refresh/validate TriWiki so implementation receives current consensus context.` },
|
|
1071
|
-
{ id: 'runtime_task_graph_compile', goal: `Compile the agreed Team plan into ${TEAM_GRAPH_ARTIFACT}, ${TEAM_RUNTIME_TASKS_ARTIFACT}, and ${TEAM_DECOMPOSITION_ARTIFACT}; remap symbolic plan nodes to concrete task ids, allocate role/path/domain worker lanes, and write ${TEAM_INBOX_DIR} before executor work starts.`, agents: ['parent_orchestrator'], output: [TEAM_GRAPH_ARTIFACT, TEAM_RUNTIME_TASKS_ARTIFACT, TEAM_DECOMPOSITION_ARTIFACT, TEAM_INBOX_DIR] },
|
|
1072
|
-
{ id: 'parallel_implementation', goal: `Before implementation, read relevant TriWiki context and current source. Close debate agents, then run a fresh ${roster.bundle_size}-person executor development team with non-overlapping write ownership. Refresh TriWiki after implementation changes or blockers.`, agents: roster.development_team.map((agent) => agent.id) },
|
|
1073
|
-
{ id: 'review_integration', goal: `Before review and final output, read/validate current TriWiki context, integrate executor output, run at least ${MIN_TEAM_REVIEWER_LANES} independent reviewer/QA validation lanes for correctness/DB safety/tests/evidence, validate user friction with validation_team, refresh after review findings, and record evidence.`, agents: roster.validation_team.map((agent) => agent.id), min_reviewer_lanes: MIN_TEAM_REVIEWER_LANES },
|
|
1074
|
-
{ id: 'session_cleanup', goal: `Close or account for all Team native sessions, finalize live transcript state, and write ${TEAM_SESSION_CLEANUP_ARTIFACT} before reflection or final.`, agents: ['parent_orchestrator'] }
|
|
1075
|
-
],
|
|
1076
|
-
live_visibility: {
|
|
1077
|
-
markdown: 'team-live.md',
|
|
1078
|
-
transcript: 'team-transcript.jsonl',
|
|
1079
|
-
dashboard: 'team-dashboard.json',
|
|
1080
|
-
zellij: 'CLI Team entrypoints open Zellij live lanes for the visible Team agent budget when Zellij is available.',
|
|
1081
|
-
commands: ['sks team status latest', 'sks team log latest', 'sks team tail latest', 'sks team open-zellij latest', 'sks team watch latest', 'sks team lane latest --agent <name> --follow', 'sks team event latest --agent <name> --phase <phase> --message "..."']
|
|
1082
|
-
},
|
|
1083
|
-
required_artifacts: ['team-roster.json', 'team-analysis.md', ...(fromChatImgRequired ? [FROM_CHAT_IMG_COVERAGE_ARTIFACT, FROM_CHAT_IMG_CHECKLIST_ARTIFACT, FROM_CHAT_IMG_TEMP_TRIWIKI_ARTIFACT, FROM_CHAT_IMG_QA_LOOP_ARTIFACT] : []), SSOT_GUARD_ARTIFACT, 'team-consensus.md', ...teamRuntimeRequiredArtifacts(), 'team-review.md', 'team-gate.json', TEAM_SESSION_CLEANUP_ARTIFACT, 'reflection.md', 'reflection-gate.json', 'team-live.md', 'team-transcript.jsonl', 'team-dashboard.json', '.sneakoscope/wiki/context-pack.json', 'context7-evidence.jsonl']
|
|
1084
|
-
};
|
|
1085
|
-
await writeJsonAtomic(path.join(dir, 'team-plan.json'), plan);
|
|
1086
|
-
await writeJsonAtomic(path.join(dir, SSOT_GUARD_ARTIFACT), plan.ssot_guard);
|
|
1087
|
-
await writeJsonAtomic(path.join(dir, 'team-roster.json'), { schema_version: 1, mission_id: id, role_counts: roleCounts, agent_sessions: agentSessions, bundle_size: roster.bundle_size, roster, confirmed: true, source: 'default_or_prompt_team_spec' });
|
|
1088
|
-
const contextTracking = triwikiContextTracking();
|
|
1089
|
-
await writeTextAtomic(path.join(dir, 'team-workflow.md'), `# SKS Team Workflow\n\nTask: ${cleanTask}\n\nAgent session budget: ${agentSessions}\nBundle size: ${roster.bundle_size}\nRole counts: ${formatRoleCounts(roleCounts)}\nReview policy: ${MIN_TEAM_REVIEW_POLICY_TEXT}\nReasoning: dynamic per-agent Fast reasoning; simple bounded lanes can use low, tool-heavy runtime lanes medium, and knowledge/safety/release lanes high or xhigh.\nGoal continuation: ambient Codex native /goal overlay is available when useful, without replacing Team route gates.\nContext tracking: ${contextTracking.ssot} SSOT, ${contextTracking.default_pack}; use relevant TriWiki context before every work stage, refresh/validate after findings, and preserve hydratable source anchors.\n\nNative agent intake reasoning:\n${roster.analysis_team.map((agent) => `- ${agent.id}: ${formatAgentReasoning(agent)}`).join('\n')}\n\n1. Run exactly ${roster.bundle_size} native agent intake agents and write team-analysis.md.\n2. Refresh/validate TriWiki before debate.\n3. Run exactly ${roster.bundle_size} debate participants through the compact Hyperplan-derived adversarial lens pass, then write consensus and implementation slices.\n4. Compile ${TEAM_GRAPH_ARTIFACT}, ${TEAM_RUNTIME_TASKS_ARTIFACT}, ${TEAM_DECOMPOSITION_ARTIFACT}, and ${TEAM_INBOX_DIR} so worker handoff uses concrete runtime task ids.\n5. Close debate agents before starting a fresh ${roster.bundle_size}-person executor team.\n6. Run at least ${MIN_TEAM_REVIEWER_LANES} independent reviewer/QA validation lanes, integrate, verify, and record evidence.\n7. Close/clean remaining Team sessions, finalize live transcript state, and write ${TEAM_SESSION_CLEANUP_ARTIFACT} before reflection/final.\n\nNo unrequested fallback implementation code is allowed in any stage, executor lane, review lane, MAD route, or MAD-SKS route. If the requested path cannot be implemented inside the sealed contract, block with evidence instead of adding substitute behavior.\n\nLive visibility:\n- sks team log ${id}\n- sks team tail ${id}\n- sks team watch ${id}\n- sks team lane ${id} --agent native_agent_1 --follow\n- sks team event ${id} --agent <name> --phase <phase> --message \"...\"\n`);
|
|
1090
|
-
await initTeamLive(id, dir, cleanTask, { agentSessions, roleCounts, roster });
|
|
1091
|
-
const runtime = await writeTeamRuntimeArtifacts(dir, plan, {});
|
|
1092
|
-
await writeMemorySweepReport(root, dir, { missionId: id }).catch(() => null);
|
|
1093
|
-
await writeSkillForgeReport(dir, { mission_id: id, route: 'team', task_signature: cleanTask }).catch(() => null);
|
|
1094
|
-
await writeMistakeMemoryReport(dir, { mission_id: id, route: 'team', task: cleanTask }).catch(() => null);
|
|
1095
|
-
await writeCodeStructureReport(root, dir, { missionId: id, exception: 'Team prepare records split-review risk; extraction happens only when the mission scope includes the touched file.' }).catch(() => null);
|
|
1096
|
-
await writeJsonAtomic(path.join(dir, 'team-gate.json'), { passed: false, team_roster_confirmed: true, analysis_artifact: false, triwiki_refreshed: false, triwiki_validated: false, consensus_artifact: false, ...runtime.gate_fields, implementation_team_fresh: false, review_artifact: false, integration_evidence: false, session_cleanup: false, context7_evidence: false, ssot_guard: false, ...(fromChatImgRequired ? { from_chat_img_required: true, from_chat_img_request_coverage: false } : {}) });
|
|
1097
|
-
const madSksState = opts.madSksAuthorization
|
|
1098
|
-
? await materializeMadSksAuthorization(dir, id, route, { mad_sks_authorization: true }, {})
|
|
1099
|
-
: {};
|
|
1100
|
-
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task: cleanTask, required, ambiguity: { required: false, status: 'direct_team_cli' } });
|
|
1101
|
-
await setCurrent(root, routeState(id, route, 'TEAM_NATIVE_AGENT_INTAKE', required, { prompt: cleanTask, implementation_allowed: true, ambiguity_gate_required: false, ambiguity_gate_passed: true, agent_sessions: agentSessions, role_counts: roleCounts, team_roster_confirmed: true, team_plan_ready: true, team_graph_ready: runtime.ok, context_tracking: 'triwiki', from_chat_img_required: fromChatImgRequired, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT, ...madSksState }));
|
|
1102
|
-
return routeContext(route, id, cleanTask, required, `Run agents, refresh/validate TriWiki, debate, close debate agents, form a fresh ${roster.bundle_size}-person executor team, run minimum ${MIN_TEAM_REVIEWER_LANES}-lane review/integration, then close/clean Team sessions and write ${TEAM_SESSION_CLEANUP_ARTIFACT} before reflection.`);
|
|
1103
|
-
}
|
|
1104
|
-
async function prepareResearch(root, route, task, required) {
|
|
1105
|
-
const { id, dir } = await createMission(root, { mode: 'research', prompt: task });
|
|
946
|
+
async function prepareResearch(root, route, task, required, opts = {}) {
|
|
947
|
+
const { id, dir } = await createMission(root, { mode: 'research', prompt: task, sessionKey: opts.sessionKey });
|
|
1106
948
|
await writeResearchPlan(dir, task, {});
|
|
1107
949
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'direct_route' } });
|
|
1108
|
-
await setCurrent(root, routeState(id, route, 'RESEARCH_PREPARED', required, { prompt: task, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }));
|
|
950
|
+
await setCurrent(root, routeState(id, route, 'RESEARCH_PREPARED', required, { prompt: task, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }), { sessionKey: opts.sessionKey });
|
|
1109
951
|
return routeContext(route, id, task, required, 'Run sks research run latest as a real long-running source-gathering pass, never an automatic mock fallback; do not modify repository source code; create research-source-skill.md, maximize layered public source search, require every agent effort=xhigh plus one Eureka! idea, repeat agent/debate/falsification cycles until unanimous_consensus=true for every agent or the explicit safety cap pauses the run, fill source-ledger.json, agent-ledger.json, debate-ledger.json, novelty-ledger.json, falsification-ledger.json, research-report.md, research-paper.md, genius-opinion-summary.md, and pass research-gate.json.');
|
|
1110
952
|
}
|
|
1111
|
-
async function prepareAutoResearch(root, route, task, required) {
|
|
1112
|
-
const { id, dir } = await createMission(root, { mode: 'autoresearch', prompt: task });
|
|
953
|
+
async function prepareAutoResearch(root, route, task, required, opts = {}) {
|
|
954
|
+
const { id, dir } = await createMission(root, { mode: 'autoresearch', prompt: task, sessionKey: opts.sessionKey });
|
|
1113
955
|
await writeJsonAtomic(path.join(dir, 'autoresearch-plan.json'), { schema_version: 1, task, loop: ['program', 'hypothesis', 'experiment', 'measure', 'keep_or_discard', 'falsify', 'honest_conclusion'] });
|
|
1114
956
|
await writeJsonAtomic(path.join(dir, 'experiment-ledger.json'), { schema_version: 1, entries: [] });
|
|
1115
957
|
await writeJsonAtomic(path.join(dir, 'autoresearch-gate.json'), { passed: false, experiment_ledger_present: true, metric_present: false, keep_or_discard_decision: false, falsification_present: false, honest_conclusion: false, context7_evidence: false });
|
|
1116
958
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'direct_route' } });
|
|
1117
|
-
await setCurrent(root, routeState(id, route, 'AUTORESEARCH_EXPERIMENT_LOOP', required, { prompt: task, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }));
|
|
959
|
+
await setCurrent(root, routeState(id, route, 'AUTORESEARCH_EXPERIMENT_LOOP', required, { prompt: task, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }), { sessionKey: opts.sessionKey });
|
|
1118
960
|
return routeContext(route, id, task, required, 'Run the smallest useful experiment loop, update experiment-ledger.json, falsify the result, and pass autoresearch-gate.json.');
|
|
1119
961
|
}
|
|
1120
|
-
async function prepareDb(root, route, task, required) {
|
|
1121
|
-
const { id, dir } = await createMission(root, { mode: 'db', prompt: task });
|
|
962
|
+
async function prepareDb(root, route, task, required, opts = {}) {
|
|
963
|
+
const { id, dir } = await createMission(root, { mode: 'db', prompt: task, sessionKey: opts.sessionKey });
|
|
1122
964
|
const scan = await scanDbSafety(root).catch((err) => ({ ok: false, findings: [{ id: 'db_scan_failed', severity: 'high', reason: err.message }] }));
|
|
1123
965
|
await writeJsonAtomic(path.join(dir, 'db-safety-scan.json'), scan);
|
|
1124
966
|
await writeJsonAtomic(path.join(dir, 'db-review.json'), { passed: false, scan_ok: scan.ok, destructive_operation_zero: true, safe_mcp_policy: false, context7_evidence: false, notes: [] });
|
|
1125
967
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'direct_route' } });
|
|
1126
|
-
await setCurrent(root, routeState(id, route, 'DB_REVIEW_REQUIRED', required, { prompt: task, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }));
|
|
968
|
+
await setCurrent(root, routeState(id, route, 'DB_REVIEW_REQUIRED', required, { prompt: task, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }), { sessionKey: opts.sessionKey });
|
|
1127
969
|
return routeContext(route, id, task, required, 'Run sks db policy/scan/check as needed, keep DB operations read-only, record safe MCP policy, and pass db-review.json.');
|
|
1128
970
|
}
|
|
1129
|
-
async function prepareMadDb(root, route, task, required) {
|
|
1130
|
-
const prepared = await prepareMadDbMission({ root, task, verifyTools: false });
|
|
971
|
+
async function prepareMadDb(root, route, task, required, opts = {}) {
|
|
972
|
+
const prepared = await prepareMadDbMission({ root, task, verifyTools: false, sessionKey: opts.sessionKey, route: 'MadSKS', routeCommand: '$MAD-SKS' });
|
|
1131
973
|
const dir = missionDir(root, prepared.mission_id);
|
|
1132
974
|
const pipelinePlan = await writePipelinePlan(dir, {
|
|
1133
975
|
missionId: prepared.mission_id,
|
|
@@ -1143,7 +985,7 @@ async function prepareMadDb(root, route, task, required) {
|
|
|
1143
985
|
cycle_id: prepared.cycle_id,
|
|
1144
986
|
blockers: prepared.blockers
|
|
1145
987
|
});
|
|
1146
|
-
await setCurrent(root, routeState(prepared.mission_id, route, prepared.ok ? '
|
|
988
|
+
await setCurrent(root, routeState(prepared.mission_id, route, prepared.ok ? 'MADSKS_SQL_PLANE_CAPABILITY_ACTIVE' : 'MADSKS_SQL_PLANE_BLOCKED', required, {
|
|
1147
989
|
prompt: task,
|
|
1148
990
|
questions_allowed: false,
|
|
1149
991
|
implementation_allowed: prepared.ok,
|
|
@@ -1155,29 +997,31 @@ async function prepareMadDb(root, route, task, required) {
|
|
|
1155
997
|
mad_db_profile_sha256: prepared.capability.transport.profile_sha256,
|
|
1156
998
|
mad_db_capability_mission_id: prepared.mission_id,
|
|
1157
999
|
mad_db_capability_file: 'mad-db-capability.json',
|
|
1158
|
-
|
|
1000
|
+
mad_sks_gate_file: 'mad-sks-gate.json',
|
|
1001
|
+
stop_gate: 'mad-sks-gate.json',
|
|
1159
1002
|
pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok,
|
|
1160
1003
|
pipeline_plan_path: PIPELINE_PLAN_ARTIFACT
|
|
1161
|
-
}));
|
|
1004
|
+
}), { sessionKey: opts.sessionKey });
|
|
1162
1005
|
return routeContext(route, prepared.mission_id, task, required, `MadDB mission/capability/profile were created atomically for cycle ${prepared.cycle_id}. Verify Supabase MCP tool inventory exposes execute_sql and apply_migration before claiming ready; after execution require read-back proof, finally close the profile/capability and prove read-only restoration.`);
|
|
1163
1006
|
}
|
|
1164
|
-
async function prepareGx(root, route, task, required) {
|
|
1165
|
-
const { id, dir } = await createMission(root, { mode: 'gx', prompt: task });
|
|
1007
|
+
async function prepareGx(root, route, task, required, opts = {}) {
|
|
1008
|
+
const { id, dir } = await createMission(root, { mode: 'gx', prompt: task, sessionKey: opts.sessionKey });
|
|
1166
1009
|
await writeJsonAtomic(path.join(dir, 'gx-gate.json'), { passed: false, vgraph_beta_render: false, validation: false, drift_snapshot: false, context7_evidence: false });
|
|
1167
1010
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'direct_route' } });
|
|
1168
|
-
await setCurrent(root, routeState(id, route, 'GX_VALIDATE_REQUIRED', required, { prompt: task, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }));
|
|
1011
|
+
await setCurrent(root, routeState(id, route, 'GX_VALIDATE_REQUIRED', required, { prompt: task, pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }), { sessionKey: opts.sessionKey });
|
|
1169
1012
|
return routeContext(route, id, task, required, 'Run sks gx init/render/validate/drift/snapshot, then pass gx-gate.json.');
|
|
1170
1013
|
}
|
|
1171
|
-
async function prepareLightRoute(root, route, task, required) {
|
|
1172
|
-
const { id, dir } = await createMission(root, { mode: route.id.toLowerCase(), prompt: task });
|
|
1014
|
+
async function prepareLightRoute(root, route, task, required, opts = {}) {
|
|
1015
|
+
const { id, dir } = await createMission(root, { mode: route.id.toLowerCase(), prompt: task, sessionKey: opts.sessionKey });
|
|
1173
1016
|
await writeJsonAtomic(path.join(dir, 'route-context.json'), { route: route.id, command: route.command, task, required_skills: route.requiredSkills, context7_required: required, context_tracking: triwikiContextTracking(), stop_gate: 'honest_mode' });
|
|
1174
1017
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'light_route' } });
|
|
1175
|
-
await setCurrent(root, routeState(id, route, 'ROUTE_CONTEXT_READY', required, { prompt: task, stop_gate: 'none', pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }));
|
|
1018
|
+
await setCurrent(root, routeState(id, route, 'ROUTE_CONTEXT_READY', required, { prompt: task, stop_gate: 'none', pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }), { sessionKey: opts.sessionKey });
|
|
1176
1019
|
return routeContext(route, id, task, required, 'Load the route skill context, execute the smallest matching action, and finish with Honest Mode.');
|
|
1177
1020
|
}
|
|
1178
1021
|
async function prepareNaruto(root, route, task, required, opts = {}) {
|
|
1179
1022
|
const cleanTask = stripDollarCommand(task) || String(task || '').trim();
|
|
1180
|
-
const
|
|
1023
|
+
const fromChatImgRequired = hasFromChatImgSignal(cleanTask);
|
|
1024
|
+
const { id, dir } = await createMission(root, { mode: 'naruto', prompt: cleanTask, sessionKey: opts.sessionKey });
|
|
1181
1025
|
const routeContextPayload = {
|
|
1182
1026
|
route: 'Naruto',
|
|
1183
1027
|
command: '$Naruto',
|
|
@@ -1188,6 +1032,7 @@ async function prepareNaruto(root, route, task, required, opts = {}) {
|
|
|
1188
1032
|
context_tracking: triwikiContextTracking(),
|
|
1189
1033
|
stop_gate: 'naruto-gate.json',
|
|
1190
1034
|
team_alias: opts.teamAlias === true,
|
|
1035
|
+
from_chat_img_required: fromChatImgRequired,
|
|
1191
1036
|
mad_sks_authorization: Boolean(opts.madSksAuthorization)
|
|
1192
1037
|
};
|
|
1193
1038
|
await writeJsonAtomic(path.join(dir, 'route-context.json'), routeContextPayload);
|
|
@@ -1208,6 +1053,7 @@ async function prepareNaruto(root, route, task, required, opts = {}) {
|
|
|
1208
1053
|
native_agent_proof: false,
|
|
1209
1054
|
final_arbiter_accepted: false,
|
|
1210
1055
|
session_cleanup: false,
|
|
1056
|
+
...(fromChatImgRequired ? { from_chat_img_required: true, from_chat_img_request_coverage: false } : {}),
|
|
1211
1057
|
blockers: ['naruto_run_not_started'],
|
|
1212
1058
|
updated_at: nowIso()
|
|
1213
1059
|
});
|
|
@@ -1224,10 +1070,11 @@ async function prepareNaruto(root, route, task, required, opts = {}) {
|
|
|
1224
1070
|
required_skills: routeContextPayload.required_skills,
|
|
1225
1071
|
subagents_required: true,
|
|
1226
1072
|
native_sessions_required: true,
|
|
1073
|
+
from_chat_img_required: fromChatImgRequired,
|
|
1227
1074
|
naruto_gate_file: 'naruto-gate.json',
|
|
1228
1075
|
pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok,
|
|
1229
1076
|
pipeline_plan_path: PIPELINE_PLAN_ARTIFACT
|
|
1230
|
-
}));
|
|
1077
|
+
}), { sessionKey: opts.sessionKey });
|
|
1231
1078
|
return routeContext(route, id, cleanTask, required, `Run sks naruto run ${JSON.stringify(cleanTask)} --json (or continue with Codex native workers for the same mission), then update naruto-gate.json from the worker proof and verification DAG.`);
|
|
1232
1079
|
}
|
|
1233
1080
|
function routeState(id, route, phase, context7Required, extra = {}) {
|
|
@@ -1323,7 +1170,7 @@ export async function recordContext7Evidence(root, state, payload) {
|
|
|
1323
1170
|
await appendJsonl(file, record);
|
|
1324
1171
|
if (id) {
|
|
1325
1172
|
const evidence = await context7Evidence(root, state);
|
|
1326
|
-
await setCurrent(root, { context7_resolved: evidence.resolve, context7_docs: evidence.docs, context7_verified: evidence.ok });
|
|
1173
|
+
await setCurrent(root, { context7_resolved: evidence.resolve, context7_docs: evidence.docs, context7_verified: evidence.ok }, { sessionKey: state._session_key });
|
|
1327
1174
|
}
|
|
1328
1175
|
return record;
|
|
1329
1176
|
}
|
|
@@ -1339,7 +1186,7 @@ export async function recordSubagentEvidence(root, state, payload) {
|
|
|
1339
1186
|
await appendJsonl(file, record);
|
|
1340
1187
|
if (id) {
|
|
1341
1188
|
const evidence = await subagentEvidence(root, state);
|
|
1342
|
-
await setCurrent(root, { subagents_spawned: evidence.spawn, subagents_reported: evidence.result, subagents_verified: evidence.ok });
|
|
1189
|
+
await setCurrent(root, { subagents_spawned: evidence.spawn, subagents_reported: evidence.result, subagents_verified: evidence.ok }, { sessionKey: state._session_key });
|
|
1343
1190
|
}
|
|
1344
1191
|
return record;
|
|
1345
1192
|
}
|
|
@@ -1441,6 +1288,9 @@ function context7DirectSignal(payload = {}) {
|
|
|
1441
1288
|
}
|
|
1442
1289
|
return '';
|
|
1443
1290
|
}
|
|
1291
|
+
function formatLegacyRoleCounts(roleCounts = {}) {
|
|
1292
|
+
return Object.entries(roleCounts || {}).map(([role, count]) => `${role}:${count}`).join(' ');
|
|
1293
|
+
}
|
|
1444
1294
|
function context7SafeInput(input) {
|
|
1445
1295
|
if (!input || typeof input !== 'object' || Array.isArray(input))
|
|
1446
1296
|
return input ?? null;
|