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
|
@@ -3,7 +3,7 @@ import fs from 'node:fs';
|
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { PACKAGE_VERSION, appendJsonlBounded, exists, nowIso, packageRoot, readJson, sksRoot, writeJsonAtomic } from '../fsx.js';
|
|
5
5
|
import { initProject } from '../init.js';
|
|
6
|
-
import { createMission, setCurrent } from '../mission.js';
|
|
6
|
+
import { createMission, findLatestMission, missionDir, setCurrent, stateFile } from '../mission.js';
|
|
7
7
|
import { buildMadHighLaunchProfileNoWrite, madHighProfileName } from '../auto-review.js';
|
|
8
8
|
import { permissionGateSummary } from '../permission-gates.js';
|
|
9
9
|
import { attachZellijSessionInteractive, launchMadZellijUi, sanitizeZellijSessionName } from '../zellij/zellij-launcher.js';
|
|
@@ -26,6 +26,7 @@ import { repairZellijForSks } from '../zellij/zellij-self-heal.js';
|
|
|
26
26
|
import { buildMadGlmLaunchArtifact, buildMadGlmLaunchProfileNoWrite, resolveMadGlmLaunchKey, writeMadGlmCodexWrapper } from '../providers/glm/glm-mad-launch.js';
|
|
27
27
|
import { GLM_MAD_MODE } from '../providers/glm/glm-52-settings.js';
|
|
28
28
|
import { assertNonGlmMadRoute } from '../routes/model-mode-router.js';
|
|
29
|
+
const MAD_SKS_DEFAULT_TTL_MS = 10 * 60 * 1000;
|
|
29
30
|
export async function madHighCommand(args = [], deps = {}) {
|
|
30
31
|
const subcommand = firstSubcommand(args);
|
|
31
32
|
if (subcommand)
|
|
@@ -65,6 +66,7 @@ export async function madHighCommand(args = [], deps = {}) {
|
|
|
65
66
|
const launchRoot = process.cwd();
|
|
66
67
|
if (!(await exists(path.join(launchRoot, '.sneakoscope'))))
|
|
67
68
|
await initProject(launchRoot, {});
|
|
69
|
+
await cleanupExpiredMadSks(launchRoot);
|
|
68
70
|
if (dryRun) {
|
|
69
71
|
const zellijPlan = skipZellijRepair
|
|
70
72
|
? { schema: 'sks.zellij-self-heal.v1', ok: true, status: 'skipped', dry_run: true, planned_mutations: [], command: null, blockers: [], warnings: ['zellij_repair_skipped'] }
|
|
@@ -76,7 +78,8 @@ export async function madHighCommand(args = [], deps = {}) {
|
|
|
76
78
|
interactive: false,
|
|
77
79
|
installHomebrew: rawArgs.includes('--install-homebrew'),
|
|
78
80
|
allowHeadlessFallback: headlessZellij,
|
|
79
|
-
dryRun: true
|
|
81
|
+
dryRun: true,
|
|
82
|
+
quiet: rawArgs.includes('--json')
|
|
80
83
|
});
|
|
81
84
|
const report = {
|
|
82
85
|
schema: 'sks.mad-sks-zellij-dry-run.v1',
|
|
@@ -123,7 +126,8 @@ export async function madHighCommand(args = [], deps = {}) {
|
|
|
123
126
|
autoApprove: rawArgs.includes('--yes') || rawArgs.includes('-y'),
|
|
124
127
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY && process.env.SKS_NO_QUESTION !== '1'),
|
|
125
128
|
installHomebrew: rawArgs.includes('--install-homebrew'),
|
|
126
|
-
allowHeadlessFallback: headlessZellij
|
|
129
|
+
allowHeadlessFallback: headlessZellij,
|
|
130
|
+
quiet: rawArgs.includes('--json')
|
|
127
131
|
});
|
|
128
132
|
const zellijRepairBlocked = !headlessZellij && (zellijUpdate.status === 'manual_required'
|
|
129
133
|
|| zellijUpdate.strategy === 'manual-required'
|
|
@@ -240,15 +244,21 @@ export async function madHighCommand(args = [], deps = {}) {
|
|
|
240
244
|
if (glmRuntime?.profile)
|
|
241
245
|
console.log(`GLM MAD launch active: ${glmRuntime.profile.model} via OpenRouter; GPT fallback blocked.`);
|
|
242
246
|
if (madDbGrant.requested)
|
|
243
|
-
console.log('MAD-DB flag observed;
|
|
247
|
+
console.log('MAD-DB flag observed; deprecated route now redirects to MAD-SKS SQL-plane: sks mad-sks sql|apply-migration.');
|
|
244
248
|
if (updateNotice.update_available === true)
|
|
245
249
|
console.log(`SKS update notice: ${updateNotice.latest_version} available (non-blocking).`);
|
|
246
|
-
console.log('Scoped high-power maintenance authority active; add explicit --allow-* flags for packages, services, network, browser/Computer Use, generated assets, file permissions, or system/admin scopes.
|
|
250
|
+
console.log('Scoped high-power maintenance authority active; add explicit --allow-* flags for packages, services, network, browser/Computer Use, generated assets, file permissions, or system/admin scopes. SQL-plane execution is available through MAD-SKS sql-plane and still requires control-plane denial, read-back proof, and read-only restoration.');
|
|
247
251
|
const launchLb = lb.status === 'present' ? { ...lb, status: 'configured' } : lb;
|
|
252
|
+
const zellijVisiblePaneSetting = readOption(cleanArgs, '--zellij-visible-panes', process.env.SKS_ZELLIJ_VISIBLE_PANES || process.env.SKS_ZELLIJ_VISIBLE_PANE_CAP || '8');
|
|
253
|
+
const zellijViewportSetting = readOption(cleanArgs, '--zellij-viewports', process.env.SKS_ZELLIJ_VIEWPORTS || '4');
|
|
254
|
+
const zellijRefreshMsSetting = readOption(cleanArgs, '--zellij-refresh-ms', process.env.SKS_ZELLIJ_REFRESH_MS || '1000');
|
|
248
255
|
const madSksEnv = {
|
|
249
256
|
SKS_PROTECTED_CORE_POLICY: madLaunch.gate.protected_core_policy,
|
|
250
257
|
SKS_MAD_SKS_TARGET_ROOT: madLaunch.gate.cwd,
|
|
251
|
-
SKS_MAD_SKS_PROTECTED_CORE_DIGEST: madLaunch.gate.protected_core_digest
|
|
258
|
+
SKS_MAD_SKS_PROTECTED_CORE_DIGEST: madLaunch.gate.protected_core_digest,
|
|
259
|
+
SKS_ZELLIJ_VISIBLE_PANES: String(zellijVisiblePaneSetting),
|
|
260
|
+
SKS_ZELLIJ_VIEWPORTS: String(Math.max(0, Math.min(Number(zellijViewportSetting || 4), 6))),
|
|
261
|
+
SKS_ZELLIJ_REFRESH_MS: String(zellijRefreshMsSetting),
|
|
252
262
|
};
|
|
253
263
|
const explicitWorkspace = readOption(cleanArgs, '--workspace', readOption(cleanArgs, '--session', null));
|
|
254
264
|
const launchProfile = glmRuntime?.profile || profile;
|
|
@@ -290,10 +300,12 @@ export async function madHighCommand(args = [], deps = {}) {
|
|
|
290
300
|
mission_id: madLaunch.mission_id,
|
|
291
301
|
session_name: launch.session_name || null,
|
|
292
302
|
live_panes: !headlessZellij,
|
|
293
|
-
initial_panes: '
|
|
294
|
-
dashboard_created:
|
|
303
|
+
initial_panes: 'orchestrator-monitor-viewports',
|
|
304
|
+
dashboard_created: true,
|
|
295
305
|
worker_panes_created: 0,
|
|
296
|
-
|
|
306
|
+
viewport_panes_created: Number(madSksEnv.SKS_ZELLIJ_VIEWPORTS),
|
|
307
|
+
ui_architecture: 'monitor_plus_viewports',
|
|
308
|
+
right_column_mode: 'monitor-plus-viewports'
|
|
297
309
|
});
|
|
298
310
|
const madNativeSwarmPromise = startMadNativeSwarm(madLaunch.root, madLaunch, args, launchProfile, {
|
|
299
311
|
env: {
|
|
@@ -303,7 +315,7 @@ export async function madHighCommand(args = [], deps = {}) {
|
|
|
303
315
|
glmLaunch: glmRuntime ? { provider: glmRuntime.profile.provider, model: glmRuntime.profile.model } : null,
|
|
304
316
|
zellijSessionName: launch.session_name || null,
|
|
305
317
|
workerPlacement: headlessZellij ? 'process' : shouldAutoAttachZellij(args) ? 'zellij-pane' : 'process',
|
|
306
|
-
zellijVisiblePaneCap: Number(process.env.SKS_ZELLIJ_VISIBLE_PANE_CAP || 8)
|
|
318
|
+
zellijVisiblePaneCap: Number(process.env.SKS_ZELLIJ_VISIBLE_PANE_CAP || zellijVisiblePaneSetting || 8)
|
|
307
319
|
}).catch((err) => appendJsonlBounded(path.join(madLaunch.dir, 'events.jsonl'), { ts: nowIso(), type: 'mad_sks.native_swarm_background_failed', error: err?.message || String(err) }));
|
|
308
320
|
void madNativeSwarmPromise;
|
|
309
321
|
// The launcher only creates a detached background session. In an interactive
|
|
@@ -694,12 +706,20 @@ async function activateMadZellijPermissionState(cwd = process.cwd(), args = [])
|
|
|
694
706
|
direct_execute_sql_allowed: dbWriteAllowed,
|
|
695
707
|
normal_db_writes_allowed: dbWriteAllowed,
|
|
696
708
|
migration_apply_allowed: dbWriteAllowed,
|
|
709
|
+
sql_plane: {
|
|
710
|
+
requested: false,
|
|
711
|
+
capability_id: null,
|
|
712
|
+
operation_classes: [],
|
|
713
|
+
read_back_passed: false,
|
|
714
|
+
profile_closed: false
|
|
715
|
+
},
|
|
697
716
|
catastrophic_safety_guard_active: true,
|
|
698
717
|
permission_profile: permissionGateSummary(),
|
|
699
718
|
permission_model: permission,
|
|
700
719
|
protected_core_policy: protectedCorePolicyPath,
|
|
701
720
|
protected_core_before: protectedCoreBeforePath,
|
|
702
721
|
protected_core_digest: protectedCoreBefore.digest,
|
|
722
|
+
expires_at: new Date(Date.now() + MAD_SKS_DEFAULT_TTL_MS).toISOString(),
|
|
703
723
|
codex_native_invocation_plan: {
|
|
704
724
|
selected_strategy: 'message-role-fallback',
|
|
705
725
|
hook_evidence_policy: 'background-verification-do-not-count-until-refreshed',
|
|
@@ -767,6 +787,9 @@ function baseMadLaunchOnlyFlags() {
|
|
|
767
787
|
'--skip-zellij-repair',
|
|
768
788
|
'--install-homebrew',
|
|
769
789
|
'--headless',
|
|
790
|
+
'--zellij-compact-slots',
|
|
791
|
+
'--zellij-dashboard',
|
|
792
|
+
'--zellij-full-debug',
|
|
770
793
|
'--allow-system',
|
|
771
794
|
'--allow-db-write',
|
|
772
795
|
'--allow-package-install',
|
|
@@ -826,6 +849,8 @@ function madLaunchValueFlags(includeGlmFlags = false) {
|
|
|
826
849
|
'--mad-swarm-work-items',
|
|
827
850
|
'--mad-swarm-backend',
|
|
828
851
|
'--mad-swarm-prompt',
|
|
852
|
+
'--zellij-visible-panes',
|
|
853
|
+
'--zellij-refresh-ms',
|
|
829
854
|
'--ack'
|
|
830
855
|
]);
|
|
831
856
|
if (includeGlmFlags)
|
|
@@ -884,7 +909,7 @@ function codexLbImmediateLaunchOpts(args = [], lb = {}, opts = {}) {
|
|
|
884
909
|
const session = explicitSession || sanitizeZellijSessionName(`sks-openai-fallback-${Date.now().toString(36)}-${path.basename(root) || 'project'}`);
|
|
885
910
|
console.log(`codex-lb bypass active for this launch: ${lb.chain_health?.status || lb.status}`);
|
|
886
911
|
console.log(`Using fresh OpenAI fallback Zellij session: ${session}`);
|
|
887
|
-
return { ...opts, session, codexArgs: [...(opts.codexArgs || []), '-c', 'model_provider="openai"'], codexLbBypassed: true };
|
|
912
|
+
return { ...opts, session, codexArgs: [...(opts.codexArgs || []), '-c', 'model_provider="openai"'], 'codexLbBypassed': true };
|
|
888
913
|
}
|
|
889
914
|
if (!lb?.ok)
|
|
890
915
|
return opts;
|
|
@@ -902,7 +927,17 @@ export async function madSksFixture(root) {
|
|
|
902
927
|
const { id, dir } = await createMission(root, { mode: 'mad-sks', prompt: '$MAD-SKS fixture permission gate' });
|
|
903
928
|
await writeCodex0138CapabilityArtifacts(root, { missionId: id }).catch(() => null);
|
|
904
929
|
await writeCodex0139CapabilityArtifacts(root, { missionId: id }).catch(() => null);
|
|
905
|
-
const gate = {
|
|
930
|
+
const gate = {
|
|
931
|
+
schema_version: 1,
|
|
932
|
+
passed: false,
|
|
933
|
+
execution_class: 'mock_fixture',
|
|
934
|
+
mad_sks_permission_active: false,
|
|
935
|
+
permissions_deactivated: false,
|
|
936
|
+
catastrophic_safety_guard_active: true,
|
|
937
|
+
permission_profile: permissionGateSummary(),
|
|
938
|
+
fixture: true,
|
|
939
|
+
blockers: ['mad_sks_fixture_mode_cannot_claim_real']
|
|
940
|
+
};
|
|
906
941
|
await writeJsonAtomic(path.join(dir, 'mad-sks-gate.json'), gate);
|
|
907
942
|
return { mission_id: id, dir, gate };
|
|
908
943
|
}
|
|
@@ -910,8 +945,12 @@ const MAD_SKS_COMMAND_SURFACE = Object.freeze([
|
|
|
910
945
|
'plan',
|
|
911
946
|
'run',
|
|
912
947
|
'apply',
|
|
948
|
+
'sql',
|
|
949
|
+
'apply-migration',
|
|
913
950
|
'doctor',
|
|
914
951
|
'status',
|
|
952
|
+
'close',
|
|
953
|
+
'revoke',
|
|
915
954
|
'permissions',
|
|
916
955
|
'proof',
|
|
917
956
|
'repair-config',
|
|
@@ -924,9 +963,16 @@ async function madSksSubcommand(subcommand, args = []) {
|
|
|
924
963
|
const json = args.includes('--json');
|
|
925
964
|
const targetRoot = path.resolve(readOption(args, '--target-root', process.cwd()));
|
|
926
965
|
const userIntent = readOption(args, '--intent', 'MAD-SKS user-authorized maintenance');
|
|
927
|
-
const
|
|
966
|
+
const sqlPlaneSubcommand = subcommand === 'sql' || subcommand === 'apply-migration';
|
|
967
|
+
const flags = parseMadSksFlags([
|
|
968
|
+
'--mad-sks',
|
|
969
|
+
subcommand === 'plan' ? '--plan-only' : '',
|
|
970
|
+
...(sqlPlaneSubcommand ? ['--allow-db-write', '--yes'] : []),
|
|
971
|
+
...args
|
|
972
|
+
].filter(Boolean));
|
|
928
973
|
const permission = buildMadSksPermissionModel({ targetRoot, userIntent, flags });
|
|
929
974
|
const root = await sksRoot();
|
|
975
|
+
await cleanupExpiredMadSks(root);
|
|
930
976
|
if (subcommand === 'permissions') {
|
|
931
977
|
const protectedCore = resolveProtectedCore({ packageRoot: packageRoot(), targetRoot });
|
|
932
978
|
return emit({
|
|
@@ -958,7 +1004,7 @@ async function madSksSubcommand(subcommand, args = []) {
|
|
|
958
1004
|
return emit({
|
|
959
1005
|
schema: 'sks.mad-sks-explain.v1',
|
|
960
1006
|
ok: true,
|
|
961
|
-
summary: 'MAD-SKS is a user-authorized general permission widening mode
|
|
1007
|
+
summary: 'MAD-SKS is a user-authorized general permission widening mode and the merged SQL-plane execution route. Target project work can be widened by explicit flags, while SQL-plane work runs through the sql-plane executor with MadDB capability/profile/read-back safeguards and SKS harness/package/dist/scripts/schemas/release metadata remain immutable protected core.',
|
|
962
1008
|
command_surface: [...MAD_SKS_COMMAND_SURFACE],
|
|
963
1009
|
catastrophic_safeguards: permission.forbidden_scopes,
|
|
964
1010
|
immutable_harness_guard: 'installed_harness_only_with_engine_source_exception'
|
|
@@ -979,6 +1025,9 @@ async function madSksSubcommand(subcommand, args = []) {
|
|
|
979
1025
|
permission_active: false
|
|
980
1026
|
}, json);
|
|
981
1027
|
}
|
|
1028
|
+
if (subcommand === 'close' || subcommand === 'revoke') {
|
|
1029
|
+
return closeMadSks(root, args, json, subcommand);
|
|
1030
|
+
}
|
|
982
1031
|
if (subcommand === 'repair-config') {
|
|
983
1032
|
const apply = args.includes('--apply') || args.includes('--yes');
|
|
984
1033
|
const dryRun = args.includes('--dry-run') || !apply;
|
|
@@ -1049,6 +1098,34 @@ async function madSksSubcommand(subcommand, args = []) {
|
|
|
1049
1098
|
if (subcommand === 'run') {
|
|
1050
1099
|
return materializeMadSksRun(root, targetRoot, permission, userIntent, json, { action: 'run', args });
|
|
1051
1100
|
}
|
|
1101
|
+
if (subcommand === 'sql') {
|
|
1102
|
+
const sql = readOption(args, '--sql', null) || positionalText(args);
|
|
1103
|
+
return materializeMadSksRun(root, targetRoot, permission, sql || userIntent, json, {
|
|
1104
|
+
action: 'apply',
|
|
1105
|
+
resultSchema: 'sks.mad-sks-sql.v1',
|
|
1106
|
+
args,
|
|
1107
|
+
executor: 'sql-plane',
|
|
1108
|
+
sql,
|
|
1109
|
+
verifySql: readOption(args, '--verify-sql', null),
|
|
1110
|
+
rollbackSql: readOption(args, '--rollback-sql', null),
|
|
1111
|
+
acceptNotRollbackable: args.includes('--accept-not-rollbackable')
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
if (subcommand === 'apply-migration') {
|
|
1115
|
+
const migrationFile = readOption(args, '--file', null) || args.find((arg) => !String(arg).startsWith('--')) || null;
|
|
1116
|
+
return materializeMadSksRun(root, targetRoot, permission, userIntent, json, {
|
|
1117
|
+
action: 'apply',
|
|
1118
|
+
resultSchema: 'sks.mad-sks-apply-migration.v1',
|
|
1119
|
+
args,
|
|
1120
|
+
executor: 'sql-plane',
|
|
1121
|
+
sqlAction: 'apply-migration',
|
|
1122
|
+
migrationFile,
|
|
1123
|
+
migrationName: readOption(args, '--name', null),
|
|
1124
|
+
verifySql: readOption(args, '--verify-sql', null),
|
|
1125
|
+
rollbackSql: readOption(args, '--rollback-sql', null),
|
|
1126
|
+
acceptNotRollbackable: args.includes('--accept-not-rollbackable')
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1052
1129
|
if (subcommand === 'rollback-apply') {
|
|
1053
1130
|
const rollbackPlanPath = readOption(args, '--rollback-plan', readOption(args, '--plan', null));
|
|
1054
1131
|
const result = await applyMadSksRollbackPlan({
|
|
@@ -1084,7 +1161,7 @@ async function materializeMadSksRun(root, targetRoot, permission, userIntent, js
|
|
|
1084
1161
|
if (!opts.authorizationManifestPath)
|
|
1085
1162
|
await writeJsonAtomic(authorizationPath, authorization);
|
|
1086
1163
|
const args = Array.isArray(opts.args) ? opts.args : [];
|
|
1087
|
-
const executorId = readOption(args, '--executor', inferMadSksExecutor(args));
|
|
1164
|
+
const executorId = opts.executor || readOption(args, '--executor', inferMadSksExecutor(args));
|
|
1088
1165
|
const targetFile = readOption(args, '--write-file', readOption(args, '--path', path.join('.sneakoscope', 'mad-sks-target-file.txt')));
|
|
1089
1166
|
const executorInput = {
|
|
1090
1167
|
executor: executorId,
|
|
@@ -1098,13 +1175,20 @@ async function materializeMadSksRun(root, targetRoot, permission, userIntent, js
|
|
|
1098
1175
|
authorization_manifest: authorization,
|
|
1099
1176
|
authorization_manifest_path: authorizationPath,
|
|
1100
1177
|
permission_model: permission,
|
|
1101
|
-
yes: args.includes('--yes')
|
|
1178
|
+
yes: args.includes('--yes') || opts.acceptNotRollbackable === true,
|
|
1179
|
+
mission_id: id,
|
|
1180
|
+
user_intent: userIntent,
|
|
1181
|
+
args
|
|
1102
1182
|
};
|
|
1103
1183
|
const operation = readOption(args, '--operation', null);
|
|
1104
1184
|
const command = readOption(args, '--command', null);
|
|
1105
1185
|
const argv = readRepeatedOption(args, '--argv');
|
|
1106
|
-
const sql = readOption(args, '--sql', null);
|
|
1107
|
-
const rollbackSql = readOption(args, '--rollback-sql', null);
|
|
1186
|
+
const sql = opts.sql || readOption(args, '--sql', null);
|
|
1187
|
+
const rollbackSql = opts.rollbackSql || readOption(args, '--rollback-sql', null);
|
|
1188
|
+
const verifySql = opts.verifySql || readOption(args, '--verify-sql', null);
|
|
1189
|
+
const migrationFile = opts.migrationFile || readOption(args, '--migration-file', null) || readOption(args, '--file', null);
|
|
1190
|
+
const migrationName = opts.migrationName || readOption(args, '--name', null);
|
|
1191
|
+
const sqlAction = opts.sqlAction || null;
|
|
1108
1192
|
if (operation)
|
|
1109
1193
|
executorInput.operation = operation;
|
|
1110
1194
|
if (command)
|
|
@@ -1115,6 +1199,16 @@ async function materializeMadSksRun(root, targetRoot, permission, userIntent, js
|
|
|
1115
1199
|
executorInput.sql = sql;
|
|
1116
1200
|
if (rollbackSql)
|
|
1117
1201
|
executorInput.rollback_sql = rollbackSql;
|
|
1202
|
+
if (verifySql)
|
|
1203
|
+
executorInput.verify_sql = verifySql;
|
|
1204
|
+
if (migrationFile)
|
|
1205
|
+
executorInput.migration_file = migrationFile;
|
|
1206
|
+
if (migrationName)
|
|
1207
|
+
executorInput.migration_name = migrationName;
|
|
1208
|
+
if (sqlAction)
|
|
1209
|
+
executorInput.action = sqlAction;
|
|
1210
|
+
if (opts.acceptNotRollbackable === true)
|
|
1211
|
+
executorInput.accept_not_rollbackable = true;
|
|
1118
1212
|
const executorResult = await runMadSksExecutor(executorInput);
|
|
1119
1213
|
const protectedProbe = await evaluateMadSksWrite({ packageRoot: packageRoot(), targetRoot, operation: 'file_write', path: path.join(packageRoot(), 'src', 'core', 'version.ts') });
|
|
1120
1214
|
const audit = createMadSksAuditLedger({
|
|
@@ -1169,19 +1263,6 @@ async function materializeMadSksRun(root, targetRoot, permission, userIntent, js
|
|
|
1169
1263
|
]
|
|
1170
1264
|
});
|
|
1171
1265
|
await writeMadSksProofEvidence(proofPath, proof);
|
|
1172
|
-
const gate = {
|
|
1173
|
-
schema_version: 1,
|
|
1174
|
-
passed: proof.ok === true && executorResult.ok === true,
|
|
1175
|
-
mad_sks_permission_active: true,
|
|
1176
|
-
permissions_deactivated: true,
|
|
1177
|
-
full_system_authority: permission.mode === 'full_system_authority',
|
|
1178
|
-
immutable_harness_guard_passed: comparison.ok === true,
|
|
1179
|
-
audit_ledger: auditPath,
|
|
1180
|
-
rollback_plan: rollbackPath,
|
|
1181
|
-
proof_evidence: proofPath,
|
|
1182
|
-
permission_profile: permissionGateSummary()
|
|
1183
|
-
};
|
|
1184
|
-
await writeJsonAtomic(path.join(dir, 'mad-sks-gate.json'), gate);
|
|
1185
1266
|
await setCurrent(root, {
|
|
1186
1267
|
mission_id: id,
|
|
1187
1268
|
route: 'MadSKS',
|
|
@@ -1193,9 +1274,37 @@ async function materializeMadSksRun(root, targetRoot, permission, userIntent, js
|
|
|
1193
1274
|
mad_sks_gate_file: 'mad-sks-gate.json',
|
|
1194
1275
|
prompt: userIntent
|
|
1195
1276
|
});
|
|
1277
|
+
const restore = await verifyMadSksPermissionRestored(root, id);
|
|
1278
|
+
const sqlPlane = executorResult.sql_plane && typeof executorResult.sql_plane === 'object'
|
|
1279
|
+
? executorResult.sql_plane
|
|
1280
|
+
: { requested: false, capability_id: null, operation_classes: [], read_back_passed: false, profile_closed: false };
|
|
1281
|
+
const sqlPlaneRequested = sqlPlane.requested === true;
|
|
1282
|
+
const sqlPlanePassed = !sqlPlaneRequested || (sqlPlane.read_back_passed === true && sqlPlane.profile_closed === true);
|
|
1283
|
+
const gateBlockers = [
|
|
1284
|
+
...(restore.permissions_deactivated === true ? [] : ['permission_restore_failed']),
|
|
1285
|
+
...(comparison.ok === true ? [] : ['protected_core_changed']),
|
|
1286
|
+
...(executorResult.ok === true ? [] : (executorResult.blockers || ['mad_sks_executor_failed'])),
|
|
1287
|
+
...(sqlPlanePassed ? [] : ['mad_sks_sql_plane_read_back_or_profile_close_failed'])
|
|
1288
|
+
];
|
|
1289
|
+
const gate = {
|
|
1290
|
+
schema_version: 1,
|
|
1291
|
+
passed: proof.ok === true && executorResult.ok === true && restore.permissions_deactivated === true && comparison.ok === true && sqlPlanePassed,
|
|
1292
|
+
mad_sks_permission_active: false,
|
|
1293
|
+
permissions_deactivated: restore.permissions_deactivated === true,
|
|
1294
|
+
full_system_authority: permission.mode === 'full_system_authority',
|
|
1295
|
+
immutable_harness_guard_passed: comparison.ok === true,
|
|
1296
|
+
audit_ledger: auditPath,
|
|
1297
|
+
rollback_plan: rollbackPath,
|
|
1298
|
+
proof_evidence: proofPath,
|
|
1299
|
+
permission_restore_read_back: restore,
|
|
1300
|
+
permission_profile: permissionGateSummary(),
|
|
1301
|
+
sql_plane: sqlPlane,
|
|
1302
|
+
blockers: [...new Set(gateBlockers)]
|
|
1303
|
+
};
|
|
1304
|
+
await writeJsonAtomic(path.join(dir, 'mad-sks-gate.json'), gate);
|
|
1196
1305
|
return emit({
|
|
1197
|
-
schema: opts.action === 'apply' ? 'sks.mad-sks-apply.v1' : 'sks.mad-sks-run.v1',
|
|
1198
|
-
ok:
|
|
1306
|
+
schema: opts.resultSchema || (opts.action === 'apply' ? 'sks.mad-sks-apply.v1' : 'sks.mad-sks-run.v1'),
|
|
1307
|
+
ok: gate.passed === true,
|
|
1199
1308
|
status: executorResult.status,
|
|
1200
1309
|
mission_id: id,
|
|
1201
1310
|
target_root: targetRoot,
|
|
@@ -1211,9 +1320,86 @@ async function materializeMadSksRun(root, targetRoot, permission, userIntent, js
|
|
|
1211
1320
|
blocked_actions: [protectedProbe, ...(executorResult.blocked_actions || [])]
|
|
1212
1321
|
}, json);
|
|
1213
1322
|
}
|
|
1323
|
+
async function closeMadSks(root, args = [], json = false, action = 'close') {
|
|
1324
|
+
const missionId = readOption(args, '--mission', null) || args.find((arg) => !String(arg).startsWith('--')) || await findLatestMission(root);
|
|
1325
|
+
if (!missionId) {
|
|
1326
|
+
const result = { schema: 'sks.mad-sks-close.v1', ok: false, action, mission_id: null, blockers: ['mad_sks_mission_missing'] };
|
|
1327
|
+
process.exitCode = 1;
|
|
1328
|
+
return emit(result, json);
|
|
1329
|
+
}
|
|
1330
|
+
await setCurrent(root, {
|
|
1331
|
+
mission_id: missionId,
|
|
1332
|
+
route: 'MadSKS',
|
|
1333
|
+
route_command: '$MAD-SKS',
|
|
1334
|
+
mode: 'MADSKS',
|
|
1335
|
+
phase: action === 'revoke' ? 'MADSKS_PERMISSION_REVOKED' : 'MADSKS_PERMISSION_CLOSED',
|
|
1336
|
+
mad_sks_active: false,
|
|
1337
|
+
mad_sks_modifier: false,
|
|
1338
|
+
mad_sks_gate_file: 'mad-sks-gate.json',
|
|
1339
|
+
mad_sks_closed_at: nowIso()
|
|
1340
|
+
});
|
|
1341
|
+
const restore = await verifyMadSksPermissionRestored(root, missionId);
|
|
1342
|
+
const result = await writeMadSksCloseGate(root, missionId, action, restore);
|
|
1343
|
+
if (!result.ok)
|
|
1344
|
+
process.exitCode = 1;
|
|
1345
|
+
return emit(result, json);
|
|
1346
|
+
}
|
|
1347
|
+
async function cleanupExpiredMadSks(root) {
|
|
1348
|
+
const missionId = await findLatestMission(root);
|
|
1349
|
+
if (!missionId)
|
|
1350
|
+
return null;
|
|
1351
|
+
const gate = await readJson(path.join(missionDir(root, missionId), 'mad-sks-gate.json'), null);
|
|
1352
|
+
const expires = Date.parse(String(gate?.expires_at || ''));
|
|
1353
|
+
if (gate?.mad_sks_permission_active !== true || !Number.isFinite(expires) || expires > Date.now())
|
|
1354
|
+
return gate;
|
|
1355
|
+
await setCurrent(root, {
|
|
1356
|
+
mission_id: missionId,
|
|
1357
|
+
route: 'MadSKS',
|
|
1358
|
+
route_command: '$MAD-SKS',
|
|
1359
|
+
mode: 'MADSKS',
|
|
1360
|
+
phase: 'MADSKS_PERMISSION_EXPIRED_CLOSED',
|
|
1361
|
+
mad_sks_active: false,
|
|
1362
|
+
mad_sks_modifier: false,
|
|
1363
|
+
mad_sks_gate_file: 'mad-sks-gate.json'
|
|
1364
|
+
});
|
|
1365
|
+
const restore = await verifyMadSksPermissionRestored(root, missionId);
|
|
1366
|
+
return writeMadSksCloseGate(root, missionId, 'ttl_expired_lazy_cleanup', restore);
|
|
1367
|
+
}
|
|
1368
|
+
async function writeMadSksCloseGate(root, missionId, action, restore) {
|
|
1369
|
+
const file = path.join(missionDir(root, missionId), 'mad-sks-gate.json');
|
|
1370
|
+
const previous = await readJson(file, {});
|
|
1371
|
+
const gate = {
|
|
1372
|
+
...previous,
|
|
1373
|
+
schema_version: previous.schema_version || 1,
|
|
1374
|
+
passed: restore.permissions_deactivated === true,
|
|
1375
|
+
mad_sks_permission_active: false,
|
|
1376
|
+
permissions_deactivated: restore.permissions_deactivated === true,
|
|
1377
|
+
permission_restore_read_back: restore,
|
|
1378
|
+
closed_at: nowIso(),
|
|
1379
|
+
close_reason: action,
|
|
1380
|
+
blockers: restore.permissions_deactivated === true ? [] : ['permission_restore_failed']
|
|
1381
|
+
};
|
|
1382
|
+
await writeJsonAtomic(file, gate);
|
|
1383
|
+
return { schema: 'sks.mad-sks-close.v1', ok: gate.passed === true, action, mission_id: missionId, gate };
|
|
1384
|
+
}
|
|
1385
|
+
async function verifyMadSksPermissionRestored(root, missionId) {
|
|
1386
|
+
const state = await readJson(stateFile(root), {});
|
|
1387
|
+
const gate = await readJson(path.join(missionDir(root, missionId), 'mad-sks-gate.json'), {});
|
|
1388
|
+
const permissionsDeactivated = state.mission_id === missionId
|
|
1389
|
+
&& state.mad_sks_active !== true
|
|
1390
|
+
&& gate.mad_sks_permission_active !== true;
|
|
1391
|
+
return {
|
|
1392
|
+
schema: 'sks.mad-sks-permission-restore-readback.v1',
|
|
1393
|
+
checked_at: nowIso(),
|
|
1394
|
+
mission_id: missionId,
|
|
1395
|
+
permissions_deactivated: permissionsDeactivated,
|
|
1396
|
+
state_mad_sks_active: state.mad_sks_active === true,
|
|
1397
|
+
gate_mad_sks_permission_active: gate.mad_sks_permission_active === true
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1214
1400
|
function inferMadSksExecutor(args = []) {
|
|
1215
1401
|
if (readOption(args, '--sql', null))
|
|
1216
|
-
return '
|
|
1402
|
+
return 'sql-plane';
|
|
1217
1403
|
if (readOption(args, '--command', null) || args.includes('--argv'))
|
|
1218
1404
|
return 'shell-command';
|
|
1219
1405
|
if (readOption(args, '--package', null) || args.includes('--allow-package-install'))
|
|
@@ -1228,6 +1414,34 @@ function inferMadSksExecutor(args = []) {
|
|
|
1228
1414
|
return 'generated-asset';
|
|
1229
1415
|
return 'file-write';
|
|
1230
1416
|
}
|
|
1417
|
+
function positionalText(args = []) {
|
|
1418
|
+
const valueFlags = new Set([
|
|
1419
|
+
'--sql',
|
|
1420
|
+
'--verify-sql',
|
|
1421
|
+
'--rollback-sql',
|
|
1422
|
+
'--target-root',
|
|
1423
|
+
'--intent',
|
|
1424
|
+
'--executor',
|
|
1425
|
+
'--cwd',
|
|
1426
|
+
'--name',
|
|
1427
|
+
'--file',
|
|
1428
|
+
'--migration-file'
|
|
1429
|
+
]);
|
|
1430
|
+
const out = [];
|
|
1431
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
1432
|
+
const arg = String(args[index] || '');
|
|
1433
|
+
if (!arg || arg === '--json' || arg === '--yes' || arg === '-y' || arg === '--accept-not-rollbackable')
|
|
1434
|
+
continue;
|
|
1435
|
+
if (valueFlags.has(arg)) {
|
|
1436
|
+
index += 1;
|
|
1437
|
+
continue;
|
|
1438
|
+
}
|
|
1439
|
+
if (arg.startsWith('--'))
|
|
1440
|
+
continue;
|
|
1441
|
+
out.push(arg);
|
|
1442
|
+
}
|
|
1443
|
+
return out.join(' ').trim();
|
|
1444
|
+
}
|
|
1231
1445
|
function readRepeatedOption(args = [], name) {
|
|
1232
1446
|
const values = [];
|
|
1233
1447
|
for (let i = 0; i < args.length; i += 1) {
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { ui as cliUi } from '../../cli/cli-theme.js';
|
|
3
|
+
import { projectRoot } from '../fsx.js';
|
|
4
|
+
import { inspectSksMenuBarStatus, installSksMenuBar, restartSksMenuBar, uninstallSksMenuBar } from '../codex-app/sks-menubar.js';
|
|
5
|
+
export async function menubarCommand(subcommand = 'status', args = []) {
|
|
6
|
+
const action = normalizeAction(subcommand);
|
|
7
|
+
const root = path.resolve(String(readOption(args, '--root', '') || await projectRoot()));
|
|
8
|
+
const home = stringOption(args, '--home');
|
|
9
|
+
if (action === 'status') {
|
|
10
|
+
const result = await inspectSksMenuBarStatus({ root, ...(home ? { home } : {}) });
|
|
11
|
+
if (flag(args, '--json'))
|
|
12
|
+
return printJson(result);
|
|
13
|
+
cliUi.banner('menubar status');
|
|
14
|
+
if (result.ok)
|
|
15
|
+
cliUi.ok(result.running ? 'running' : 'installed status checked');
|
|
16
|
+
else
|
|
17
|
+
cliUi.warn('needs attention');
|
|
18
|
+
printStatus(result);
|
|
19
|
+
if (!result.ok)
|
|
20
|
+
process.exitCode = 1;
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
if (action === 'install') {
|
|
24
|
+
const result = await installSksMenuBar({ root, ...(home ? { home } : {}), apply: true, launch: !flag(args, '--no-launch'), quiet: flag(args, '--json') });
|
|
25
|
+
if (flag(args, '--json'))
|
|
26
|
+
return printJson(result);
|
|
27
|
+
cliUi.banner('menubar install');
|
|
28
|
+
if (result.ok)
|
|
29
|
+
cliUi.ok(result.status);
|
|
30
|
+
else
|
|
31
|
+
cliUi.fail(result.status);
|
|
32
|
+
console.log(`SKS menu bar install: ${result.status}`);
|
|
33
|
+
for (const actionLine of result.actions)
|
|
34
|
+
console.log(`- ${actionLine}`);
|
|
35
|
+
for (const warning of result.warnings)
|
|
36
|
+
console.log(`warning: ${warning}`);
|
|
37
|
+
for (const blocker of result.blockers)
|
|
38
|
+
console.log(`blocker: ${blocker}`);
|
|
39
|
+
if (!result.ok)
|
|
40
|
+
process.exitCode = 1;
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
if (action === 'restart') {
|
|
44
|
+
const result = await restartSksMenuBar({ root, ...(home ? { home } : {}) });
|
|
45
|
+
if (flag(args, '--json'))
|
|
46
|
+
return printJson(result);
|
|
47
|
+
cliUi.banner('menubar restart');
|
|
48
|
+
if (result.ok)
|
|
49
|
+
cliUi.ok('restart requested');
|
|
50
|
+
else
|
|
51
|
+
cliUi.fail('restart failed');
|
|
52
|
+
console.log(`SKS menu bar restart: ${result.ok ? 'ok' : 'failed'}`);
|
|
53
|
+
if ('error' in result && result.error)
|
|
54
|
+
console.log(`error: ${result.error}`);
|
|
55
|
+
if (!result.ok)
|
|
56
|
+
process.exitCode = 1;
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
if (action === 'uninstall') {
|
|
60
|
+
const result = await uninstallSksMenuBar({ root, ...(home ? { home } : {}) });
|
|
61
|
+
if (flag(args, '--json'))
|
|
62
|
+
return printJson(result);
|
|
63
|
+
cliUi.banner('menubar uninstall');
|
|
64
|
+
if (result.ok)
|
|
65
|
+
cliUi.ok('uninstall complete');
|
|
66
|
+
else
|
|
67
|
+
cliUi.fail('uninstall failed');
|
|
68
|
+
console.log(`SKS menu bar uninstall: ${result.ok ? 'ok' : 'failed'}`);
|
|
69
|
+
for (const actionLine of result.actions)
|
|
70
|
+
console.log(`- ${actionLine}`);
|
|
71
|
+
for (const warning of result.warnings)
|
|
72
|
+
console.log(`warning: ${warning}`);
|
|
73
|
+
for (const blocker of result.blockers)
|
|
74
|
+
console.log(`blocker: ${blocker}`);
|
|
75
|
+
if (!result.ok)
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
printUsage();
|
|
80
|
+
process.exitCode = 2;
|
|
81
|
+
}
|
|
82
|
+
function normalizeAction(value) {
|
|
83
|
+
const text = String(value || 'status').toLowerCase();
|
|
84
|
+
if (['status', 'inspect', 'doctor'].includes(text))
|
|
85
|
+
return 'status';
|
|
86
|
+
if (['install', 'fix', 'repair'].includes(text))
|
|
87
|
+
return 'install';
|
|
88
|
+
if (['restart', 'reload'].includes(text))
|
|
89
|
+
return 'restart';
|
|
90
|
+
if (['uninstall', 'remove', 'disable'].includes(text))
|
|
91
|
+
return 'uninstall';
|
|
92
|
+
return 'help';
|
|
93
|
+
}
|
|
94
|
+
function printStatus(result) {
|
|
95
|
+
console.log('SKS menu bar');
|
|
96
|
+
console.log(`Installed: ${result.installed ? 'yes' : 'no'}`);
|
|
97
|
+
console.log(`Running: ${result.running ? 'yes' : 'no'}`);
|
|
98
|
+
console.log(`Launchd: ${result.launchd.ok ? result.launchd.state || 'present' : result.launchd.error || 'missing'}`);
|
|
99
|
+
console.log(`Version: ${result.build_stamp?.package_version || 'unknown'} (package ${result.package_version})`);
|
|
100
|
+
console.log(`Target: ${result.action_target.sks_entry || 'missing'} ${result.action_target.sks_entry_exists ? '(ok)' : '(missing)'}`);
|
|
101
|
+
console.log(`Signature: ${result.signature.identifier || 'unknown'} ${result.signature.ok ? '(ok)' : '(check)'}`);
|
|
102
|
+
if (result.warnings.length) {
|
|
103
|
+
console.log('Warnings:');
|
|
104
|
+
for (const warning of result.warnings)
|
|
105
|
+
console.log(`- ${warning}`);
|
|
106
|
+
}
|
|
107
|
+
if (result.blockers.length) {
|
|
108
|
+
console.log('Blockers:');
|
|
109
|
+
for (const blocker of result.blockers)
|
|
110
|
+
console.log(`- ${blocker}`);
|
|
111
|
+
}
|
|
112
|
+
if (result.next_actions.length) {
|
|
113
|
+
console.log('Next actions:');
|
|
114
|
+
for (const action of result.next_actions)
|
|
115
|
+
console.log(`- ${action}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function printUsage() {
|
|
119
|
+
console.log(`SKS Menu Bar
|
|
120
|
+
|
|
121
|
+
Usage:
|
|
122
|
+
sks menubar status [--json]
|
|
123
|
+
sks menubar install [--no-launch] [--json]
|
|
124
|
+
sks menubar restart [--json]
|
|
125
|
+
sks menubar uninstall [--json]
|
|
126
|
+
`);
|
|
127
|
+
}
|
|
128
|
+
function printJson(value) {
|
|
129
|
+
console.log(JSON.stringify(value, null, 2));
|
|
130
|
+
}
|
|
131
|
+
function flag(args = [], name) {
|
|
132
|
+
return args.includes(name);
|
|
133
|
+
}
|
|
134
|
+
function readOption(args = [], name, fallback = null) {
|
|
135
|
+
const index = args.indexOf(name);
|
|
136
|
+
if (index >= 0 && args[index + 1] && !String(args[index + 1]).startsWith('--'))
|
|
137
|
+
return args[index + 1];
|
|
138
|
+
const prefixed = args.find((arg) => String(arg).startsWith(name + '='));
|
|
139
|
+
return prefixed ? prefixed.slice(name.length + 1) : fallback;
|
|
140
|
+
}
|
|
141
|
+
function stringOption(args = [], name) {
|
|
142
|
+
const value = readOption(args, name, null);
|
|
143
|
+
const text = value == null ? '' : String(value).trim();
|
|
144
|
+
return text || null;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=menubar-command.js.map
|