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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { ARTIFACT_FILES } from '../artifact-schemas.js';
|
|
3
|
-
import { readJson, sksRoot, writeJsonAtomic } from '../fsx.js';
|
|
3
|
+
import { appendJsonlBounded, nowIso, readJson, readText, sksRoot, writeJsonAtomic, writeTextAtomic } from '../fsx.js';
|
|
4
4
|
import { loadMission } from '../mission.js';
|
|
5
5
|
import { MIN_TEAM_REVIEWER_LANES } from '../team-review-policy.js';
|
|
6
|
-
import { renderTeamDashboardState, writeTeamDashboardState } from '../team-dashboard-renderer.js';
|
|
7
|
-
import { appendTeamEvent, formatRoleCounts, isTerminalTeamAgentStatus, readTeamControl, readTeamDashboard, readTeamLive, readTeamTranscriptTail, renderTeamAgentLane, renderTeamCleanupSummary, renderTeamWatch, requestTeamSessionCleanup, teamCleanupRequested } from '../team-live.js';
|
|
8
6
|
import { attachZellijSessionInteractive, launchTeamZellijView } from '../zellij/zellij-launcher.js';
|
|
9
7
|
import { flag, readFlagValue } from './command-utils.js';
|
|
8
|
+
const TEAM_SESSION_CLEANUP_ARTIFACT = 'team-session-cleanup.json';
|
|
9
|
+
const TEAM_RUNTIME_TASKS_ARTIFACT = 'team-runtime-tasks.json';
|
|
10
10
|
export const teamLegacySubcommands = new Set([
|
|
11
11
|
'log',
|
|
12
12
|
'tail',
|
|
@@ -179,4 +179,222 @@ function shouldAutoAttachTeamZellij(args = []) {
|
|
|
179
179
|
return true;
|
|
180
180
|
return Boolean(process.stdout.isTTY && process.stdin.isTTY);
|
|
181
181
|
}
|
|
182
|
+
function teamLogPaths(dir) {
|
|
183
|
+
return {
|
|
184
|
+
live: path.join(dir, 'team-live.md'),
|
|
185
|
+
transcript: path.join(dir, 'team-transcript.jsonl'),
|
|
186
|
+
dashboard: path.join(dir, 'team-dashboard.json'),
|
|
187
|
+
control: path.join(dir, 'team-control.json')
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function defaultTeamControl(id) {
|
|
191
|
+
return {
|
|
192
|
+
schema_version: 1,
|
|
193
|
+
mission_id: id,
|
|
194
|
+
status: 'running',
|
|
195
|
+
cleanup_requested: false,
|
|
196
|
+
cleanup_requested_at: null,
|
|
197
|
+
cleanup_requested_by: null,
|
|
198
|
+
cleanup_reason: null,
|
|
199
|
+
final_message: null
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function formatRoleCounts(roleCounts = {}) {
|
|
203
|
+
return Object.entries(roleCounts || {}).map(([role, count]) => `${role}:${count}`).join(' ');
|
|
204
|
+
}
|
|
205
|
+
async function readTeamDashboard(dir) {
|
|
206
|
+
return readJson(teamLogPaths(dir).dashboard, null);
|
|
207
|
+
}
|
|
208
|
+
async function readTeamLive(dir) {
|
|
209
|
+
return readText(teamLogPaths(dir).live, '');
|
|
210
|
+
}
|
|
211
|
+
async function readTeamTranscriptTail(dir, count = 20) {
|
|
212
|
+
const text = await readText(teamLogPaths(dir).transcript, '');
|
|
213
|
+
return text.split(/\n/).filter(Boolean).slice(-Math.max(1, Number(count) || 20));
|
|
214
|
+
}
|
|
215
|
+
async function readTeamControl(dir) {
|
|
216
|
+
const control = await readJson(teamLogPaths(dir).control, defaultTeamControl(path.basename(dir)));
|
|
217
|
+
const cleanup = await readJson(path.join(dir, TEAM_SESSION_CLEANUP_ARTIFACT), null).catch(() => null);
|
|
218
|
+
if (!cleanup || (cleanup.passed !== true && cleanup.live_transcript_finalized !== true && cleanup.all_sessions_closed !== true))
|
|
219
|
+
return control;
|
|
220
|
+
return {
|
|
221
|
+
...defaultTeamControl(path.basename(dir)),
|
|
222
|
+
...control,
|
|
223
|
+
status: 'ended',
|
|
224
|
+
cleanup_requested: true,
|
|
225
|
+
cleanup_requested_at: cleanup.updated_at || cleanup.completed_at || cleanup.closed_at || control.cleanup_requested_at || 'artifact',
|
|
226
|
+
cleanup_requested_by: cleanup.agent || control.cleanup_requested_by || 'parent_orchestrator',
|
|
227
|
+
cleanup_reason: cleanup.reason || control.cleanup_reason || `${TEAM_SESSION_CLEANUP_ARTIFACT} passed.`,
|
|
228
|
+
final_message: cleanup.final_message || control.final_message || 'Team session ended. Legacy observation lanes can stop.'
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
async function appendTeamEvent(dir, event) {
|
|
232
|
+
const files = teamLogPaths(dir);
|
|
233
|
+
const record = {
|
|
234
|
+
ts: event.ts || nowIso(),
|
|
235
|
+
agent: String(event.agent || 'parent_orchestrator'),
|
|
236
|
+
phase: String(event.phase || 'general'),
|
|
237
|
+
type: String(event.type || 'status'),
|
|
238
|
+
to: event.to ? String(event.to).slice(0, 200) : undefined,
|
|
239
|
+
message: String(event.message || '').slice(0, 4000),
|
|
240
|
+
artifact: event.artifact ? String(event.artifact) : undefined
|
|
241
|
+
};
|
|
242
|
+
await appendJsonlBounded(files.transcript, record, 1024 * 1024);
|
|
243
|
+
const dashboard = await readJson(files.dashboard, null);
|
|
244
|
+
if (dashboard) {
|
|
245
|
+
dashboard.updated_at = record.ts;
|
|
246
|
+
dashboard.latest_messages = [...(dashboard.latest_messages || []), record].slice(-20);
|
|
247
|
+
dashboard.agents ||= {};
|
|
248
|
+
dashboard.agents[record.agent] ||= {};
|
|
249
|
+
dashboard.agents[record.agent].status = isTerminalTeamAgentStatus(record.type) ? record.type : record.type || 'active';
|
|
250
|
+
dashboard.agents[record.agent].phase = record.phase;
|
|
251
|
+
dashboard.agents[record.agent].last_seen = record.ts;
|
|
252
|
+
await writeJsonAtomic(files.dashboard, dashboard);
|
|
253
|
+
}
|
|
254
|
+
const target = record.to ? ` -> ${record.to}` : '';
|
|
255
|
+
const current = await readText(files.live, '# SKS Team Live Transcript\n\n## Live Events\n');
|
|
256
|
+
const line = `\n- ${record.ts} [${record.phase}] ${record.agent}${target}: ${record.message}${record.artifact ? ` (${record.artifact})` : ''}\n`;
|
|
257
|
+
await writeTextAtomic(files.live, `${current.trimEnd()}${line}`);
|
|
258
|
+
return record;
|
|
259
|
+
}
|
|
260
|
+
async function requestTeamSessionCleanup(dir, opts = {}) {
|
|
261
|
+
const current = await readTeamControl(dir);
|
|
262
|
+
const next = {
|
|
263
|
+
...defaultTeamControl(current?.mission_id || opts.missionId || path.basename(dir)),
|
|
264
|
+
...current,
|
|
265
|
+
status: 'cleanup_requested',
|
|
266
|
+
cleanup_requested: true,
|
|
267
|
+
cleanup_requested_at: opts.ts || nowIso(),
|
|
268
|
+
cleanup_requested_by: opts.agent || 'parent_orchestrator',
|
|
269
|
+
cleanup_reason: opts.reason || 'Team session cleanup requested.',
|
|
270
|
+
final_message: opts.finalMessage || 'Team session ended.'
|
|
271
|
+
};
|
|
272
|
+
await writeJsonAtomic(teamLogPaths(dir).control, next);
|
|
273
|
+
return next;
|
|
274
|
+
}
|
|
275
|
+
function teamCleanupRequested(control = {}) {
|
|
276
|
+
return Boolean(control?.cleanup_requested || control?.status === 'cleanup_requested' || control?.status === 'ended');
|
|
277
|
+
}
|
|
278
|
+
function isTerminalTeamAgentStatus(status = '') {
|
|
279
|
+
return /(?:^|_)(?:done|complete|completed|closed|cleanup|cancelled|canceled|failed|ended|stopped)(?:_|$)/i.test(String(status || ''));
|
|
280
|
+
}
|
|
281
|
+
function renderTeamCleanupSummary(control = {}) {
|
|
282
|
+
if (!teamCleanupRequested(control))
|
|
283
|
+
return '';
|
|
284
|
+
return [
|
|
285
|
+
'# SKS Team Session Cleanup',
|
|
286
|
+
'',
|
|
287
|
+
`Status: ${control.status || 'cleanup_requested'}`,
|
|
288
|
+
`Requested at: ${control.cleanup_requested_at || 'unknown'}`,
|
|
289
|
+
`Requested by: ${control.cleanup_requested_by || 'unknown'}`,
|
|
290
|
+
`Reason: ${control.cleanup_reason || 'Team session cleanup requested.'}`,
|
|
291
|
+
'',
|
|
292
|
+
control.final_message || 'Team session ended.'
|
|
293
|
+
].join('\n');
|
|
294
|
+
}
|
|
295
|
+
async function renderTeamAgentLane(dir, opts = {}) {
|
|
296
|
+
const agent = String(opts.agent || opts.agentId || 'parent_orchestrator');
|
|
297
|
+
const lines = Math.max(1, Number(opts.lines) || 12);
|
|
298
|
+
const dashboard = await readTeamDashboard(dir);
|
|
299
|
+
const control = await readTeamControl(dir);
|
|
300
|
+
const runtime = await readJson(path.join(dir, TEAM_RUNTIME_TASKS_ARTIFACT), null);
|
|
301
|
+
const status = dashboard?.agents?.[agent] || {};
|
|
302
|
+
const tasks = (Array.isArray(runtime?.tasks) ? runtime.tasks : []).filter((task) => task?.worker === agent || task?.agent_hint === agent);
|
|
303
|
+
const events = (await readTeamTranscriptTail(dir, lines)).map(parseTranscriptLine).filter((event) => event.raw || event.agent === agent || event.to === agent || event.to === 'all');
|
|
304
|
+
return [
|
|
305
|
+
'# SKS Team Agent Lane',
|
|
306
|
+
'',
|
|
307
|
+
`Mission: ${opts.missionId || dashboard?.mission_id || runtime?.mission_id || path.basename(dir)}`,
|
|
308
|
+
`Agent: ${agent}`,
|
|
309
|
+
teamCleanupRequested(control) ? `Cleanup: requested at ${control.cleanup_requested_at || 'unknown'}` : null,
|
|
310
|
+
'',
|
|
311
|
+
'## Agent Status',
|
|
312
|
+
`- status: ${status.status || 'pending'}`,
|
|
313
|
+
`- phase: ${status.phase || 'unknown'}`,
|
|
314
|
+
`- last_seen: ${status.last_seen || 'never'}`,
|
|
315
|
+
'',
|
|
316
|
+
'## Assigned Runtime Tasks',
|
|
317
|
+
...formatRuntimeTasks(tasks),
|
|
318
|
+
'',
|
|
319
|
+
'## Recent Events',
|
|
320
|
+
...(events.length ? events.map(formatTranscriptEvent) : ['- No matching events yet.']),
|
|
321
|
+
teamCleanupRequested(control) ? ['', renderTeamCleanupSummary(control)].join('\n') : null
|
|
322
|
+
].filter((line) => line !== null).join('\n');
|
|
323
|
+
}
|
|
324
|
+
async function renderTeamWatch(dir, opts = {}) {
|
|
325
|
+
const lines = Math.max(1, Number(opts.lines) || 20);
|
|
326
|
+
const dashboard = await readTeamDashboard(dir);
|
|
327
|
+
const control = await readTeamControl(dir);
|
|
328
|
+
const runtime = await readJson(path.join(dir, TEAM_RUNTIME_TASKS_ARTIFACT), null);
|
|
329
|
+
const events = (await readTeamTranscriptTail(dir, lines)).map(parseTranscriptLine);
|
|
330
|
+
const agents = Object.entries(dashboard?.agents || {}).slice(0, Math.max(3, Number(dashboard?.agent_session_count) || 3));
|
|
331
|
+
return [
|
|
332
|
+
'# SKS Team Legacy Observation',
|
|
333
|
+
'',
|
|
334
|
+
`Mission: ${opts.missionId || dashboard?.mission_id || runtime?.mission_id || path.basename(dir)}`,
|
|
335
|
+
`Updated: ${dashboard?.updated_at || 'unknown'}`,
|
|
336
|
+
`Agent session budget: ${dashboard?.agent_session_count || 'unknown'}`,
|
|
337
|
+
dashboard?.role_counts ? `Role counts: ${formatRoleCounts(dashboard.role_counts)}` : null,
|
|
338
|
+
teamCleanupRequested(control) ? `Cleanup: requested at ${control.cleanup_requested_at || 'unknown'}` : null,
|
|
339
|
+
'',
|
|
340
|
+
'## Visible Agent Lanes',
|
|
341
|
+
...(agents.length ? agents.map(([name, status]) => `- ${name}: ${status.status || 'pending'} | ${status.phase || 'unknown'} | last_seen:${status.last_seen || 'never'}`) : ['- No agent lanes registered yet.']),
|
|
342
|
+
'',
|
|
343
|
+
'## Runtime Task Snapshot',
|
|
344
|
+
...formatRuntimeTasks((Array.isArray(runtime?.tasks) ? runtime.tasks : []).slice(0, 8)),
|
|
345
|
+
'',
|
|
346
|
+
'## Recent Mission Events',
|
|
347
|
+
...(events.length ? events.map(formatTranscriptEvent) : ['- No transcript events yet.']),
|
|
348
|
+
teamCleanupRequested(control) ? ['', renderTeamCleanupSummary(control)].join('\n') : null
|
|
349
|
+
].filter((line) => line !== null).join('\n');
|
|
350
|
+
}
|
|
351
|
+
async function writeTeamDashboardState(dir, opts = {}) {
|
|
352
|
+
const mission = await readJson(path.join(dir, 'mission.json'), {});
|
|
353
|
+
const dashboard = await readTeamDashboard(dir) || {};
|
|
354
|
+
const runtime = await readJson(path.join(dir, TEAM_RUNTIME_TASKS_ARTIFACT), {});
|
|
355
|
+
const gate = await readJson(path.join(dir, 'team-gate.json'), {});
|
|
356
|
+
const state = {
|
|
357
|
+
schema_version: 1,
|
|
358
|
+
updated_at: nowIso(),
|
|
359
|
+
mission: { id: mission.id || dashboard.mission_id || opts.missionId || 'unknown', route: mission.mode || 'team', phase: opts.phase || 'legacy_observe' },
|
|
360
|
+
gates: Object.entries(gate || {}).filter(([, value]) => typeof value === 'boolean').map(([name, value]) => ({ name, status: value ? 'pass' : 'fail', evidence: [] })),
|
|
361
|
+
agents: Object.entries(dashboard.agents || {}).map(([id, value]) => ({ id, role: value.role || null, status: value.status || 'pending', current_task: value.phase || null })),
|
|
362
|
+
tasks: (runtime.tasks || []).map((task) => ({ id: task.task_id, deps: task.depends_on || [], status: task.status || 'pending' })),
|
|
363
|
+
artifacts: ['team-plan.json', 'team-gate.json', 'team-live.md', 'team-dashboard.json', TEAM_RUNTIME_TASKS_ARTIFACT]
|
|
364
|
+
};
|
|
365
|
+
await writeJsonAtomic(path.join(dir, ARTIFACT_FILES.team_dashboard_state), state);
|
|
366
|
+
return { ok: true, state };
|
|
367
|
+
}
|
|
368
|
+
function renderTeamDashboardState(state = {}) {
|
|
369
|
+
return [
|
|
370
|
+
`Mission: ${state.mission?.id || 'unknown'} (${state.mission?.route || 'team'})`,
|
|
371
|
+
`Phase: ${state.mission?.phase || 'unknown'}`,
|
|
372
|
+
'',
|
|
373
|
+
...(state.gates || []).map((gate) => `[${gate.name}] ${gate.status}`),
|
|
374
|
+
...(state.agents?.length ? [`Agents: ${state.agents.length}`] : []),
|
|
375
|
+
...(state.tasks?.length ? [`Tasks: ${state.tasks.length}`] : [])
|
|
376
|
+
].join('\n');
|
|
377
|
+
}
|
|
378
|
+
function parseTranscriptLine(line) {
|
|
379
|
+
try {
|
|
380
|
+
return JSON.parse(line);
|
|
381
|
+
}
|
|
382
|
+
catch {
|
|
383
|
+
return { raw: String(line || '').slice(0, 1000) };
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
function formatTranscriptEvent(event = {}) {
|
|
387
|
+
if (event.raw)
|
|
388
|
+
return `- ${event.raw}`;
|
|
389
|
+
const parts = [event.ts || 'no-ts', `[${event.phase || 'general'}]`, event.agent || 'unknown', event.to ? `-> ${event.to}` : null, event.type ? `(${event.type})` : null].filter(Boolean);
|
|
390
|
+
return `- ${parts.join(' ')}: ${String(event.message || '').slice(0, 500)}${event.artifact ? ` (${event.artifact})` : ''}`;
|
|
391
|
+
}
|
|
392
|
+
function formatRuntimeTasks(tasks = []) {
|
|
393
|
+
if (!tasks.length)
|
|
394
|
+
return ['- No assigned runtime tasks found.'];
|
|
395
|
+
return tasks.slice(0, 12).map((task) => {
|
|
396
|
+
const details = [task.status || 'pending', task.phase || task.role || 'team', task.depends_on?.length ? `deps:${task.depends_on.join(',')}` : null, task.file_paths?.length ? `files:${task.file_paths.slice(0, 3).join(',')}` : null].filter(Boolean).join(' | ');
|
|
397
|
+
return `- ${task.task_id || 'task'} ${task.subject || task.symbolic_id || 'untitled'} (${details})`;
|
|
398
|
+
});
|
|
399
|
+
}
|
|
182
400
|
//# sourceMappingURL=team-legacy-observe-command.js.map
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import * as http from 'node:http';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { flag } from '../../cli/args.js';
|
|
4
|
+
import { printJson } from '../../cli/output.js';
|
|
5
|
+
import { ui } from '../../cli/cli-theme.js';
|
|
6
|
+
import { DASHBOARD_HTML } from '../ui/dashboard-html.js';
|
|
7
|
+
import { findLatestMission, missionDir } from '../mission.js';
|
|
8
|
+
import { nowIso, projectRoot, readJson, readText, runProcess } from '../fsx.js';
|
|
9
|
+
import { readZellijSlotTelemetrySnapshot } from '../zellij/zellij-slot-telemetry.js';
|
|
10
|
+
export async function uiCommand(args = []) {
|
|
11
|
+
const root = path.resolve(String(readOption(args, '--root', '') || await projectRoot()));
|
|
12
|
+
if (flag(args, '--once')) {
|
|
13
|
+
const state = await collectUiState(root, String(readOption(args, '--mission', 'latest') || 'latest'));
|
|
14
|
+
if (flag(args, '--json'))
|
|
15
|
+
return printJson(state);
|
|
16
|
+
ui.banner('ui');
|
|
17
|
+
ui.ok(`state ${state.mission_id || 'latest'} ${state.gates.length} gates`);
|
|
18
|
+
return state;
|
|
19
|
+
}
|
|
20
|
+
const requestedPort = Number(readOption(args, '--port', '4477'));
|
|
21
|
+
const port = Number.isFinite(requestedPort) && requestedPort > 0 ? Math.floor(requestedPort) : 4477;
|
|
22
|
+
const mission = String(readOption(args, '--mission', 'latest') || 'latest');
|
|
23
|
+
const server = http.createServer(async (req, res) => {
|
|
24
|
+
try {
|
|
25
|
+
const url = new URL(req.url || '/', 'http://127.0.0.1');
|
|
26
|
+
if (url.pathname === '/') {
|
|
27
|
+
res.writeHead(200, { 'content-type': 'text/html; charset=utf-8' });
|
|
28
|
+
res.end(DASHBOARD_HTML);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (url.pathname === '/events')
|
|
32
|
+
return sseStream(res, root, String(url.searchParams.get('mission') || mission));
|
|
33
|
+
if (url.pathname === '/api/state') {
|
|
34
|
+
res.writeHead(200, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' });
|
|
35
|
+
res.end(JSON.stringify(await collectUiState(root, String(url.searchParams.get('mission') || mission))));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
res.writeHead(404);
|
|
39
|
+
res.end('not found');
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
res.writeHead(500, { 'content-type': 'application/json; charset=utf-8' });
|
|
43
|
+
res.end(JSON.stringify({ ok: false, error: sanitizeText(err?.message || String(err)) }));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const actualPort = await listenLocal(server, port);
|
|
47
|
+
const url = `http://127.0.0.1:${actualPort}`;
|
|
48
|
+
ui.banner('ui');
|
|
49
|
+
ui.ok(`dashboard ${url}`);
|
|
50
|
+
void runProcess('/usr/bin/open', [url], { timeoutMs: 5000, maxOutputBytes: 4096 }).catch(() => undefined);
|
|
51
|
+
return new Promise(() => undefined);
|
|
52
|
+
}
|
|
53
|
+
export async function collectUiState(root, missionInput = 'latest') {
|
|
54
|
+
const missionId = missionInput === 'latest' ? await findLatestMission(root) : missionInput;
|
|
55
|
+
const snapshot = missionId ? await readZellijSlotTelemetrySnapshot(root, missionId).catch(() => null) : null;
|
|
56
|
+
const gates = missionId ? await readLatestGateSummaries(root, missionId) : [];
|
|
57
|
+
const events = missionId ? await tailJsonl(path.join(missionDir(root, missionId), 'events.jsonl'), 30) : [];
|
|
58
|
+
const mission = missionId ? await readJson(path.join(missionDir(root, missionId), 'mission.json'), null).catch(() => null) : null;
|
|
59
|
+
return sanitizeForUi({
|
|
60
|
+
schema: 'sks.ui-state.v1',
|
|
61
|
+
ok: true,
|
|
62
|
+
ts: nowIso(),
|
|
63
|
+
mission_id: missionId,
|
|
64
|
+
route: mission?.mode || mission?.route || null,
|
|
65
|
+
snapshot,
|
|
66
|
+
gates,
|
|
67
|
+
events
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async function sseStream(res, root, mission) {
|
|
71
|
+
res.writeHead(200, {
|
|
72
|
+
'content-type': 'text/event-stream',
|
|
73
|
+
'cache-control': 'no-cache, no-store',
|
|
74
|
+
connection: 'keep-alive'
|
|
75
|
+
});
|
|
76
|
+
const tick = async () => {
|
|
77
|
+
const state = await collectUiState(root, mission).catch((err) => ({ ok: false, ts: nowIso(), error: sanitizeText(err?.message || String(err)) }));
|
|
78
|
+
res.write(`data: ${JSON.stringify(state)}\n\n`);
|
|
79
|
+
};
|
|
80
|
+
await tick();
|
|
81
|
+
const timer = setInterval(tick, 1000);
|
|
82
|
+
res.on('close', () => clearInterval(timer));
|
|
83
|
+
}
|
|
84
|
+
async function readLatestGateSummaries(root, missionId) {
|
|
85
|
+
const dir = missionDir(root, missionId);
|
|
86
|
+
const files = ['stop-gate.json', 'naruto-gate.json', 'team-gate.json', 'qa-gate.json', 'reflection-gate.json', 'completion-proof.json'];
|
|
87
|
+
const rows = [];
|
|
88
|
+
for (const file of files) {
|
|
89
|
+
const gate = await readJson(path.join(dir, file), null).catch(() => null);
|
|
90
|
+
if (!gate)
|
|
91
|
+
continue;
|
|
92
|
+
rows.push({
|
|
93
|
+
id: file,
|
|
94
|
+
ok: gate.passed === true || gate.ok === true || gate.status === 'passed',
|
|
95
|
+
missing: Array.isArray(gate.missing) ? gate.missing : Array.isArray(gate.blockers) ? gate.blockers : [],
|
|
96
|
+
source: `.sneakoscope/missions/${missionId}/${file}`
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return rows;
|
|
100
|
+
}
|
|
101
|
+
async function tailJsonl(file, limit) {
|
|
102
|
+
const text = await readText(file, '').catch(() => '');
|
|
103
|
+
return String(text || '').split(/\r?\n/).filter(Boolean).slice(-limit).map((line) => {
|
|
104
|
+
try {
|
|
105
|
+
return JSON.parse(line);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return { ts: null, type: 'raw', text: line.slice(0, 500) };
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async function listenLocal(server, startPort) {
|
|
113
|
+
for (let offset = 0; offset < 20; offset += 1) {
|
|
114
|
+
const port = startPort + offset;
|
|
115
|
+
const result = await new Promise((resolve) => {
|
|
116
|
+
const onError = (err) => {
|
|
117
|
+
server.off('listening', onListen);
|
|
118
|
+
resolve({ ok: false, code: err.code || 'listen_failed' });
|
|
119
|
+
};
|
|
120
|
+
const onListen = () => {
|
|
121
|
+
server.off('error', onError);
|
|
122
|
+
resolve({ ok: true });
|
|
123
|
+
};
|
|
124
|
+
server.once('error', onError);
|
|
125
|
+
server.once('listening', onListen);
|
|
126
|
+
server.listen(port, '127.0.0.1');
|
|
127
|
+
});
|
|
128
|
+
if (result.ok)
|
|
129
|
+
return port;
|
|
130
|
+
if (result.code !== 'EADDRINUSE')
|
|
131
|
+
throw new Error(`dashboard listen failed: ${result.code}`);
|
|
132
|
+
}
|
|
133
|
+
throw new Error('dashboard listen failed: no available localhost port');
|
|
134
|
+
}
|
|
135
|
+
function sanitizeForUi(value) {
|
|
136
|
+
if (Array.isArray(value))
|
|
137
|
+
return value.map((item) => sanitizeForUi(item));
|
|
138
|
+
if (!value || typeof value !== 'object')
|
|
139
|
+
return typeof value === 'string' ? sanitizeText(value) : value;
|
|
140
|
+
const out = {};
|
|
141
|
+
for (const [key, child] of Object.entries(value)) {
|
|
142
|
+
if (/(?:key|token|secret|password|credential|cookie|auth)/i.test(key))
|
|
143
|
+
continue;
|
|
144
|
+
out[key] = sanitizeForUi(child);
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
function sanitizeText(value) {
|
|
149
|
+
return String(value || '')
|
|
150
|
+
.replace(/sk-[A-Za-z0-9_-]{12,}/g, '[redacted]')
|
|
151
|
+
.replace(/(?:api[_-]?key|secret|token|password|credential)/ig, '[redacted-field]')
|
|
152
|
+
.slice(0, 2000);
|
|
153
|
+
}
|
|
154
|
+
function readOption(args = [], name, fallback = null) {
|
|
155
|
+
const index = args.indexOf(name);
|
|
156
|
+
if (index >= 0 && args[index + 1] && !String(args[index + 1]).startsWith('--'))
|
|
157
|
+
return args[index + 1];
|
|
158
|
+
const prefixed = args.find((arg) => String(arg).startsWith(`${name}=`));
|
|
159
|
+
return prefixed ? prefixed.slice(name.length + 1) : fallback;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=ui-command.js.map
|