sneakoscope 4.8.7 → 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 +15 -4
- package/dist/cli/help-fast.js +18 -8
- package/dist/cli/insane-search-command.js +36 -8
- package/dist/cli/install-helpers.js +32 -0
- package/dist/commands/codex-lb.js +2 -0
- package/dist/commands/doctor.js +62 -6
- package/dist/commands/proof.js +6 -3
- package/dist/config/skills-manifest.json +82 -54
- 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-orchestrator.js +268 -62
- package/dist/core/agents/agent-output-validator.js +14 -3
- package/dist/core/agents/agent-patch-queue-store.js +95 -2
- package/dist/core/agents/agent-patch-queue.js +6 -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-worker-pipeline.js +36 -2
- package/dist/core/agents/codex-exec-worker-adapter.js +2 -0
- package/dist/core/agents/native-worker-backend-router.js +58 -1
- package/dist/core/codex-app/sks-menubar.js +18 -5
- package/dist/core/codex-app.js +1 -0
- 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/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/commands/basic-cli.js +21 -2
- package/dist/core/commands/check-command.js +37 -5
- 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 +3 -0
- 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 +230 -29
- package/dist/core/commands/menubar-command.js +22 -1
- package/dist/core/commands/naruto-command.js +64 -10
- 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-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/ui-command.js +161 -0
- package/dist/core/commands/uninstall-command.js +15 -1
- package/dist/core/db-safety.js +2 -2
- package/dist/core/doctor/doctor-transaction.js +8 -0
- package/dist/core/doctor/doctor-zellij-repair.js +1 -0
- package/dist/core/doctor/imagegen-repair.js +161 -0
- package/dist/core/feature-fixture-runner.js +2 -2
- package/dist/core/feature-fixtures.js +58 -37
- package/dist/core/feature-registry.js +102 -2
- package/dist/core/fsx.js +39 -6
- 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 +10 -5
- package/dist/core/mad-db/mad-db-coordinator.js +94 -18
- 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/naruto/naruto-active-pool.js +15 -4
- package/dist/core/naruto/naruto-real-worker-child.js +10 -0
- 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/solution-tournament.js +101 -0
- package/dist/core/permission-gates.js +30 -0
- package/dist/core/pipeline-internals/runtime-core.js +11 -3
- package/dist/core/pipeline-internals/runtime-gates.js +27 -0
- 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/release/release-gate-node.js +3 -0
- package/dist/core/release/release-gate-resource-governor.js +1 -0
- package/dist/core/routes/constants.js +1 -1
- package/dist/core/routes.js +65 -18
- package/dist/core/safety/mutation-guard.js +5 -1
- package/dist/core/stop-gate/gate-evaluator.js +102 -0
- package/dist/core/stop-gate/stop-gate-check.js +16 -1
- package/dist/core/stop-gate/stop-gate-writer.js +4 -0
- 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 +366 -15
- package/dist/core/update-check.js +178 -81
- 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-self-heal.js +9 -6
- package/dist/scripts/check-feature-quality.js +2 -2
- package/dist/scripts/cli-output-consistency-check.js +57 -0
- package/dist/scripts/coding-bench-check.js +136 -0
- package/dist/scripts/doctor-imagegen-repair-check.js +62 -0
- package/dist/scripts/ensure-bin-executable.js +11 -3
- package/dist/scripts/harness-benchmark-check.js +104 -0
- package/dist/scripts/legacy-update-e2e-check.js +228 -0
- package/dist/scripts/mad-db-command-check.js +11 -8
- 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/ppt-real-imagegen-wiring-check.js +5 -1
- package/dist/scripts/proof-root-cause-policy-check.js +2 -0
- package/dist/scripts/release-dag-full-coverage-check.js +13 -4
- package/dist/scripts/release-gate-dag-runner.js +14 -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/seo-geo-feature-fixture-quality-check.js +1 -1
- package/dist/scripts/sks-1-11-gate-lib.js +8 -6
- 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/docs/assets/sneakoscope-architecture-pipeline.jpg +0 -0
- package/docs/demo.tape +28 -0
- package/package.json +67 -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 -32
- package/dist/scripts/dfix-fast-blackbox-check.js +0 -37
- package/dist/scripts/dfix-parallel-write-blackbox.js +0 -48
- package/dist/scripts/dfix-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/doctor-context7-mcp-repair-blackbox.js +0 -16
- package/dist/scripts/doctor-dirty-repair-blackbox.js +0 -22
- package/dist/scripts/doctor-dirty-semantic-blackbox.js +0 -8
- package/dist/scripts/doctor-fix-production-blackbox.js +0 -26
- package/dist/scripts/doctor-native-capability-repair-blackbox.js +0 -39
- package/dist/scripts/doctor-startup-config-repair-blackbox.js +0 -13
- package/dist/scripts/doctor-supabase-mcp-repair-blackbox.js +0 -14
- package/dist/scripts/doctor-transaction-engine-blackbox.js +0 -28
- package/dist/scripts/doctor-zellij-fix-blackbox.js +0 -4
- package/dist/scripts/doctor-zellij-no-homebrew-blackbox.js +0 -4
- package/dist/scripts/doctor-zellij-upgrade-blackbox.js +0 -4
- package/dist/scripts/gate-pack-runner-blackbox.js +0 -27
- package/dist/scripts/gate-pack-v2-blackbox.js +0 -18
- package/dist/scripts/geo-cli-blackbox-check.js +0 -18
- package/dist/scripts/loop-collision-blackbox.js +0 -3
- package/dist/scripts/loop-concurrency-oversubscription-blackbox.js +0 -3
- package/dist/scripts/loop-fixture-production-misuse-blackbox.js +0 -3
- package/dist/scripts/loop-kill-interrupt-real-blackbox.js +0 -3
- package/dist/scripts/loop-merge-strategy-blackbox.js +0 -3
- package/dist/scripts/loop-mesh-production-e2e-blackbox.js +0 -3
- package/dist/scripts/loop-side-effect-blackbox.js +0 -3
- package/dist/scripts/mad-db-operation-lifecycle-blackbox.js +0 -29
- package/dist/scripts/mad-sks-actual-executor-blackbox.js +0 -5
- package/dist/scripts/mad-zellij-headless-fallback-blackbox.js +0 -4
- package/dist/scripts/mad-zellij-self-heal-blackbox.js +0 -4
- package/dist/scripts/naruto-loop-mesh-blackbox.js +0 -3
- package/dist/scripts/naruto-real-parallelism-blackbox.js +0 -307
- package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -29
- package/dist/scripts/parallel-runtime-real-blackbox.js +0 -44
- package/dist/scripts/pipeline-codex-native-doctor-mad-routing-real-blackbox.js +0 -77
- package/dist/scripts/pipeline-codex-native-e2e-blackbox.js +0 -13
- package/dist/scripts/pipeline-codex-native-image-routing-real-blackbox.js +0 -50
- package/dist/scripts/pipeline-codex-native-loop-routing-real-blackbox.js +0 -74
- package/dist/scripts/pipeline-codex-native-qa-routing-real-blackbox.js +0 -51
- package/dist/scripts/pipeline-codex-native-research-routing-real-blackbox.js +0 -45
- package/dist/scripts/pipeline-execution-profile-routing-blackbox.js +0 -4
- package/dist/scripts/postinstall-global-doctor-blackbox.js +0 -12
- package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -109
- package/dist/scripts/ppt-imagegen-blackbox-check.js +0 -46
- package/dist/scripts/project-skill-dedupe-blackbox.js +0 -36
- package/dist/scripts/qa-backfill-route-blackbox.js +0 -5
- package/dist/scripts/qa-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/release-full-parallelism-blackbox.js +0 -41
- package/dist/scripts/release-triwiki-first-runner-blackbox.js +0 -48
- package/dist/scripts/release-wiring-3110-blackbox.js +0 -27
- package/dist/scripts/release-wiring-3112-blackbox.js +0 -17
- package/dist/scripts/release-wiring-3113-blackbox.js +0 -17
- package/dist/scripts/research-backfill-route-blackbox.js +0 -5
- package/dist/scripts/research-final-reviewer-blackbox.js +0 -70
- package/dist/scripts/research-stage-cycle-runtime-blackbox.js +0 -40
- package/dist/scripts/research-synthesis-writer-blackbox.js +0 -24
- package/dist/scripts/route-blackbox-realism-check.js +0 -21
- package/dist/scripts/scheduler-resource-claim-blackbox.js +0 -24
- package/dist/scripts/seo-cli-blackbox-check.js +0 -18
- package/dist/scripts/sks-3110-all-feature-regression-blackbox.js +0 -116
- package/dist/scripts/sks-3112-all-feature-regression-blackbox.js +0 -29
- package/dist/scripts/sks-3113-all-feature-regression-blackbox.js +0 -17
- package/dist/scripts/sks-400-all-feature-regression-blackbox.js +0 -21
- package/dist/scripts/sks-400-extreme-parallel-blackbox.js +0 -8
- package/dist/scripts/sks-400-five-minute-blackbox.js +0 -9
- package/dist/scripts/sks-400-legacy-purge-blackbox.js +0 -8
- package/dist/scripts/sks-401-all-feature-regression-blackbox.js +0 -46
- package/dist/scripts/sks-401-five-minute-actual-blackbox.js +0 -23
- package/dist/scripts/sks-402-all-feature-regression-blackbox.js +0 -9
- package/dist/scripts/sks-402-five-minute-real-blackbox.js +0 -22
- package/dist/scripts/sksd-warm-cache-blackbox.js +0 -12
- package/dist/scripts/supabase-secret-preservation-blackbox.js +0 -29
- package/dist/scripts/team-backfill-route-blackbox.js +0 -5
- package/dist/scripts/team-parallel-write-blackbox.js +0 -55
- package/dist/scripts/team-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/triwiki-affected-graph-blackbox.js +0 -28
- package/dist/scripts/triwiki-proof-bank-blackbox.js +0 -30
- package/dist/scripts/triwiki-proof-bank-lock-blackbox.js +0 -7
- package/dist/scripts/update-preserves-supabase-keys-blackbox.js +0 -27
- package/dist/scripts/ux-patch-swarm-route-blackbox.js +0 -10
- package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -67
- package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -28
- package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -80
- package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -137
- package/dist/scripts/zellij-self-heal-typed-blackbox.js +0 -4
- package/dist/scripts/zellij-slot-telemetry-real-blackbox.js +0 -20
- package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -81
- package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -202
package/dist/core/routes.js
CHANGED
|
@@ -140,7 +140,7 @@ export const ROUTES = [
|
|
|
140
140
|
lifecycle: ['micro_task_list', 'targeted_inspection', 'listed_edits_only', 'cheap_verification'],
|
|
141
141
|
context7Policy: 'optional',
|
|
142
142
|
reasoningPolicy: 'medium',
|
|
143
|
-
stopGate: '
|
|
143
|
+
stopGate: 'dfix-gate.json',
|
|
144
144
|
cliEntrypoint: 'sks dfix',
|
|
145
145
|
examples: ['$DFix 글자 색 바꿔줘', '$DFix README 오타 고쳐줘']
|
|
146
146
|
},
|
|
@@ -172,6 +172,34 @@ export const ROUTES = [
|
|
|
172
172
|
cliEntrypoint: 'sks commands',
|
|
173
173
|
examples: ['$SKS show me available workflows']
|
|
174
174
|
},
|
|
175
|
+
{
|
|
176
|
+
id: 'Planner',
|
|
177
|
+
command: '$Plan',
|
|
178
|
+
mode: 'PLAN',
|
|
179
|
+
route: 'planning-only frontdoor',
|
|
180
|
+
description: 'Decision-complete planning only. Writes .sneakoscope/plans/<slug>.md and keeps implementation disallowed until $Work runs the plan.',
|
|
181
|
+
requiredSkills: ['plan', 'honest-mode'],
|
|
182
|
+
lifecycle: ['plan_intake', 'scope_and_acceptance', 'write_plan_artifact', 'implementation_allowed_false', 'honest_mode'],
|
|
183
|
+
context7Policy: 'if_external_docs',
|
|
184
|
+
reasoningPolicy: 'high',
|
|
185
|
+
stopGate: 'plan-only',
|
|
186
|
+
cliEntrypoint: 'Codex App prompt route only: $Plan "task"',
|
|
187
|
+
examples: ['$Plan "결제 모듈 리팩터"', '$Plan "dashboard polish without editing code"']
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: 'Review',
|
|
191
|
+
command: '$Review',
|
|
192
|
+
mode: 'REVIEW',
|
|
193
|
+
route: 'machine-first diff review',
|
|
194
|
+
description: 'Review staged or selected diffs with machine evidence sorted above LLM opinion.',
|
|
195
|
+
requiredSkills: ['review', 'honest-mode'],
|
|
196
|
+
lifecycle: ['diff_collection', 'machine_checks', 'read_only_review_lenses', 'dedupe_findings', 'optional_one_fix_attempt', 'review_report'],
|
|
197
|
+
context7Policy: 'optional',
|
|
198
|
+
reasoningPolicy: 'high',
|
|
199
|
+
stopGate: 'review-report.json',
|
|
200
|
+
cliEntrypoint: 'sks review [--staged|--diff <ref>] [--fix] [--json]',
|
|
201
|
+
examples: ['$Review', 'sks review --staged']
|
|
202
|
+
},
|
|
175
203
|
{
|
|
176
204
|
id: 'FastMode',
|
|
177
205
|
command: '$Fast-Mode',
|
|
@@ -231,14 +259,14 @@ export const ROUTES = [
|
|
|
231
259
|
route: 'hardware-safe massive parallel work swarm',
|
|
232
260
|
description: '$Naruto mode launches a hardware-safe massive parallel work swarm. Clones may implement, modify, verify, test, research, document, and resolve conflicts according to role and lease policy; write-capable output is accepted only through patch envelopes, verification DAG, mutation guard, and GPT final arbiter.',
|
|
233
261
|
requiredSkills: ['naruto', 'pipeline-runner', 'prompt-pipeline', 'honest-mode'],
|
|
234
|
-
dollarAliases: ['$ShadowClone', '$Kagebunshin'],
|
|
235
|
-
appSkillAliases: ['shadow-clone', 'kage-bunshin'],
|
|
262
|
+
dollarAliases: ['$ShadowClone', '$Kagebunshin', '$Work', '$Swarm'],
|
|
263
|
+
appSkillAliases: ['shadow-clone', 'kage-bunshin', 'work', 'swarm'],
|
|
236
264
|
lifecycle: ['clone_roster_build', 'massive_work_graph', 'hardware_safe_governor', 'dynamic_active_pool', 'lease_based_write_swarm', 'parallel_verification_dag', 'gpt_final_arbiter_pack', 'per_clone_proof', 'session_cleanup', 'honest_mode'],
|
|
237
265
|
context7Policy: 'optional',
|
|
238
266
|
reasoningPolicy: 'high',
|
|
239
267
|
stopGate: 'naruto-gate.json',
|
|
240
268
|
cliEntrypoint: 'sks naruto run "task" [--clones N] [--backend codex-sdk|fake|ollama] [--parallel-write] | sks naruto status',
|
|
241
|
-
examples: ['$Naruto run sweep the codebase for TODO comments with 50 clones', '$
|
|
269
|
+
examples: ['$Naruto run sweep the codebase for TODO comments with 50 clones', '$Work', '$Swarm "fix all lint errors"']
|
|
242
270
|
},
|
|
243
271
|
{
|
|
244
272
|
id: 'ReleaseReview',
|
|
@@ -310,7 +338,7 @@ export const ROUTES = [
|
|
|
310
338
|
lifecycle: ['fast_intake', 'focused_computer_use_steps', 'evidence_summary', 'final_triwiki_refresh_validate', 'honest_mode'],
|
|
311
339
|
context7Policy: 'optional',
|
|
312
340
|
reasoningPolicy: 'low',
|
|
313
|
-
stopGate: '
|
|
341
|
+
stopGate: 'computer-use-gate.json',
|
|
314
342
|
cliEntrypoint: 'Codex App prompt route only: $Computer-Use <target/task>',
|
|
315
343
|
examples: ['$Computer-Use inspect this native Mac settings dialog', '$CU set up the local desktop app permission prompt']
|
|
316
344
|
},
|
|
@@ -324,7 +352,7 @@ export const ROUTES = [
|
|
|
324
352
|
lifecycle: ['goal_bridge_artifact', 'native_goal_create_or_control', 'selected_sks_route_continuation', 'honest_mode'],
|
|
325
353
|
context7Policy: 'if_external_docs',
|
|
326
354
|
reasoningPolicy: 'medium',
|
|
327
|
-
stopGate: '
|
|
355
|
+
stopGate: 'loop-graph-proof.json',
|
|
328
356
|
cliEntrypoint: 'sks goal create|pause|resume|clear|status',
|
|
329
357
|
examples: ['$Goal persist this migration workflow with native /goal continuation']
|
|
330
358
|
},
|
|
@@ -409,7 +437,7 @@ export const ROUTES = [
|
|
|
409
437
|
lifecycle: ['experiment_ledger', 'metric', 'keep_or_discard', 'falsification', 'post_route_reflection', 'honest_conclusion'],
|
|
410
438
|
context7Policy: 'required',
|
|
411
439
|
reasoningPolicy: 'xhigh',
|
|
412
|
-
stopGate: '
|
|
440
|
+
stopGate: 'research-gate.json',
|
|
413
441
|
cliEntrypoint: 'sks pipeline status',
|
|
414
442
|
examples: ['$AutoResearch improve this workflow with experiments']
|
|
415
443
|
},
|
|
@@ -431,29 +459,34 @@ export const ROUTES = [
|
|
|
431
459
|
id: 'MadDB',
|
|
432
460
|
command: '$MAD-DB',
|
|
433
461
|
mode: 'MADDB',
|
|
434
|
-
route: '
|
|
435
|
-
description: '
|
|
436
|
-
|
|
462
|
+
route: 'deprecated alias to MAD-SKS SQL-plane executor',
|
|
463
|
+
description: 'Deprecated compatibility alias. $MAD-DB is merged into $MAD-SKS; SQL-plane execution now runs as the MAD-SKS sql-plane executor with the same read-back and control-plane safeguards.',
|
|
464
|
+
deprecated: true,
|
|
465
|
+
hidden: true,
|
|
466
|
+
aliasTo: '$MAD-SKS',
|
|
467
|
+
deprecationMessage: '$MAD-DB is merged into $MAD-SKS. SQL-plane execution now runs as the MAD-SKS sql-plane executor with the same read-back and control-plane safeguards.',
|
|
468
|
+
requiredSkills: ['mad-sks', 'db-safety-guard', 'pipeline-runner', 'context7-docs', REFLECTION_SKILL_NAME, 'honest-mode'],
|
|
437
469
|
appSkillAliases: ['mad-db'],
|
|
438
|
-
lifecycle: ['
|
|
470
|
+
lifecycle: ['deprecated_alias_redirect', 'mad_sks_gate', 'honest_mode'],
|
|
439
471
|
context7Policy: 'required',
|
|
440
472
|
reasoningPolicy: 'xhigh',
|
|
441
|
-
stopGate: 'mad-
|
|
442
|
-
cliEntrypoint: 'sks mad-db run|exec|apply-migration|status|close|revoke|doctor',
|
|
473
|
+
stopGate: 'mad-sks-gate.json',
|
|
474
|
+
cliEntrypoint: 'sks mad-db run|exec|apply-migration|status|close|revoke|doctor (deprecated; redirects to sks mad-sks sql|apply-migration)',
|
|
443
475
|
examples: ['$MAD-DB public.users legacy_code 컬럼 삭제', '$MAD-DB truncate public.staging_events']
|
|
444
476
|
},
|
|
445
477
|
{
|
|
446
478
|
id: 'MadSKS',
|
|
447
479
|
command: '$MAD-SKS',
|
|
448
480
|
mode: 'MADSKS',
|
|
449
|
-
route: 'explicit scoped permission-widening modifier',
|
|
450
|
-
description: 'Explicit high-risk authorization modifier that can be combined with other $ commands to temporarily open approved target-project scopes such as files, shell, package installs, services, network, Computer Use/browser workflows, generated assets, file permissions, migrations, Supabase MCP DB writes, direct execute SQL, schema cleanup, and normal targeted DB writes for the active invocation,
|
|
481
|
+
route: 'explicit scoped permission-widening modifier plus SQL-plane execution',
|
|
482
|
+
description: 'Explicit high-risk authorization modifier that can be combined with other $ commands to temporarily open approved target-project scopes such as files, shell, package installs, services, network, Computer Use/browser workflows, generated assets, file permissions, migrations, Supabase MCP DB writes, direct execute SQL, schema cleanup, and normal targeted DB writes for the active invocation. It also includes the merged MadDB SQL-plane executor: CREATE, ALTER, table/schema DROP, column add/drop/rename, INSERT, UPDATE, DELETE including all-row mutations, TRUNCATE, execute_sql, and apply_migration are authorized only for the bound Supabase project, must keep Supabase project/account/billing/credential control-plane actions denied, and must finish with tool-result plus read-back proof and read-only restoration.',
|
|
451
483
|
requiredSkills: ['mad-sks', 'db-safety-guard', 'pipeline-runner', 'context7-docs', REFLECTION_SKILL_NAME, 'honest-mode'],
|
|
452
|
-
|
|
484
|
+
appSkillAliases: ['mad-sks'],
|
|
485
|
+
lifecycle: ['explicit_invocation', 'auto_sealed_permission_scope', 'single_mission_capability_v2', 'ephemeral_write_profile', 'tool_inventory', 'scoped_permission_override', 'catastrophic_guard', 'execute_sql_or_apply_migration', 'read_back_verification', 'close_and_read_only_restore', 'permission_deactivation', 'post_route_reflection', 'honest_mode'],
|
|
453
486
|
context7Policy: 'required',
|
|
454
487
|
reasoningPolicy: 'xhigh',
|
|
455
488
|
stopGate: 'mad-sks-gate.json',
|
|
456
|
-
cliEntrypoint: '
|
|
489
|
+
cliEntrypoint: 'sks mad-sks plan|run|apply|sql|apply-migration|status|close|rollback-apply',
|
|
457
490
|
examples: ['$MAD-SKS $Team target project maintenance with package/service/file and DB scopes', '$DB Supabase 점검 $MAD-SKS']
|
|
458
491
|
},
|
|
459
492
|
{
|
|
@@ -524,7 +557,10 @@ export const COMMAND_CATALOG = [
|
|
|
524
557
|
{ name: 'triwiki', usage: 'sks triwiki index|affected|proof-bank [--json]', description: 'Inspect TriWiki module cards, gate impact maps, affected graphs, and proof bank status.' },
|
|
525
558
|
{ name: 'daemon', usage: 'sks daemon status|warm|stop [--json]', description: 'Inspect or warm the local SKS daemon cache state for build/proof reuse.' },
|
|
526
559
|
{ name: 'run', usage: 'sks run "task" [--visual|--research|--db] [--json]', description: 'Classify a plain-language task, materialize a mission, and route it through the SKS trust kernel.' },
|
|
560
|
+
{ name: 'plan', usage: 'sks plan "task" [--json]', description: 'Write a planning-only artifact under .sneakoscope/plans without editing code.' },
|
|
527
561
|
{ name: 'status', usage: 'sks status [--json]', description: 'Show the active mission, route, phase, proof, trust, native agent, image voxel, DB safety, and next action.' },
|
|
562
|
+
{ name: 'review', usage: 'sks review [--staged|--diff <ref>] [--fix] [--json]', description: 'Review a diff with machine-evidence findings sorted above LLM review notes.' },
|
|
563
|
+
{ name: 'ui', usage: 'sks ui [--port 4477] [--mission latest] [--once] [--json]', description: 'Open the localhost SKS dashboard with live swarm slots, events, and gate status.' },
|
|
528
564
|
{ name: 'usage', usage: `sks usage [${USAGE_TOPICS}]`, description: 'Print copy-ready workflows for common tasks.' },
|
|
529
565
|
{ name: 'quickstart', usage: 'sks quickstart', description: 'Show the shortest safe setup and verification flow.' },
|
|
530
566
|
{ name: 'bootstrap', usage: 'sks bootstrap [--install-scope global|project] [--local-only] [--json]', description: 'Initialize the current project, install SKS Codex App files/skills, check Context7/Codex App/Zellij, and print ready true/false.' },
|
|
@@ -539,7 +575,7 @@ export const COMMAND_CATALOG = [
|
|
|
539
575
|
{ name: 'codex-lb', usage: 'sks codex-lb status|health|metrics|doctor|circuit|repair|setup ...', description: 'Configure, health-check, repair, and record circuit evidence for codex-lb provider auth without confusing ChatGPT OAuth and proxy keys.' },
|
|
540
576
|
{ name: 'zellij', usage: 'sks zellij status|repair [--json] | sks naruto dashboard latest | sks --mad', description: 'Inspect Zellij runtime status, explain repair (no auto-install), and open the SKS Zellij runtime used by MAD and Naruto lane UI.' },
|
|
541
577
|
{ name: 'tmux', usage: 'removed-runtime migration notice (replacement: zellij)', description: 'Show the removed-runtime migration notice and point operators to Zellij.' },
|
|
542
|
-
{ name: 'mad-sks', usage: 'sks mad-sks plan|run|status|
|
|
578
|
+
{ name: 'mad-sks', usage: 'sks mad-sks plan|run|apply|sql|apply-migration|status|close|rollback-apply ... | sks --mad [--high]', description: 'Open or inspect MAD-SKS scoped permission workflows, merged SQL-plane execution, and the Zellij permission launcher.' },
|
|
543
579
|
{ name: 'auto-review', usage: 'sks auto-review status|enable|start [--high] | sks --Auto-review --high', description: 'Enable Codex automatic approval review and launch SKS Zellij with the auto-review profile.' },
|
|
544
580
|
{ name: 'dollar-commands', usage: 'sks dollar-commands [--json]', description: 'List Codex App $ commands such as $DFix and $Naruto.' },
|
|
545
581
|
{ name: 'fast-mode', usage: 'sks fast-mode on|off|status|clear [--project] [--json]', description: 'Toggle the global Codex Desktop GPT 5.5 Fast default used by $Fast-On/$Fast-Off and keep project worker preference in sync; pass --project for project-local only.' },
|
|
@@ -588,6 +624,7 @@ export const COMMAND_CATALOG = [
|
|
|
588
624
|
{ name: 'rust', usage: 'sks rust status|smoke [--json] [--require-native]', description: 'Inspect optional Rust accelerator availability and verify JS fallback parity for image hash, voxel validation, and secret scanning.' },
|
|
589
625
|
{ name: 'validate-artifacts', usage: 'sks validate-artifacts [mission-id|latest] [--json]', description: 'Validate schema-backed mission artifacts for work orders, effort decisions, visual maps, dogfood reports, skills, mistake memory, Team dashboard state, and Honest Mode.' },
|
|
590
626
|
{ name: 'wiki', usage: 'sks wiki coords|pack|refresh|publish|rebuild-index|validate|validate-shared|wrongness ...', description: 'Build, refresh, publish shared shards, rebuild ignored indexes, validate, and attach wrongness-memory context to RGBA/trig LLM Wiki packs with attention.use_first and attention.hydrate_first for compact recall plus source hydration.' },
|
|
627
|
+
{ name: 'memory', usage: 'sks memory build [--json] | sks memory gc [--dry-run]', description: 'Project TriWiki context-pack memory into managed AGENTS.md blocks or run bounded memory cleanup.' },
|
|
591
628
|
{ name: 'hproof', usage: 'sks hproof check [mission-id|latest]', description: 'Evaluate the H-Proof done gate for a mission.' },
|
|
592
629
|
{ name: 'agent', usage: 'sks agent run|status|close|cleanup <mission-id|latest> [--agents N] [--work-items N] [--target-active-slots N] [--mock] [--apply|--dry-run] [--drain] [--stale-ms N] [--json] | sks agent rollback-patches [mission-id|latest] [--patch-entry-id id] [--dry-run|--apply] [--json]', description: 'Run, inspect, close, clean, or rollback native multi-session agent missions with agents as target active slots, work items as the route queue size, cleanup executor proof for stale runtime resources, and patch rollback proof for applied patch entries.' },
|
|
593
630
|
{ name: 'team', usage: 'sks team \"task\" | sks team log|tail|watch|lane|status|dashboard|event|message|open-zellij|attach-zellij|cleanup-zellij ...', description: 'Deprecated compatibility command: new tasks redirect to Naruto; observation subcommands remain for old Team missions.' },
|
|
@@ -613,6 +650,10 @@ export function routeByDollarCommand(commandName) {
|
|
|
613
650
|
const key = String(commandName || '').replace(/^\$/, '').toLowerCase();
|
|
614
651
|
if (key === 'team' || key === 'from-chat-img')
|
|
615
652
|
return routeById('Naruto');
|
|
653
|
+
if (key === 'work' || key === 'swarm')
|
|
654
|
+
return routeById('Naruto');
|
|
655
|
+
if (key === 'plan')
|
|
656
|
+
return routeById('Planner');
|
|
616
657
|
return ROUTES.find((route) => [
|
|
617
658
|
dollarSkillName(route.command),
|
|
618
659
|
...(route.dollarAliases || []).map((alias) => dollarSkillName(alias)),
|
|
@@ -737,6 +778,12 @@ export function looksLikeUltraSearchRequest(prompt = '') {
|
|
|
737
778
|
}
|
|
738
779
|
export function routePrompt(prompt) {
|
|
739
780
|
const text = stripVisibleDecisionAnswerBlocks(prompt);
|
|
781
|
+
if (/^\$?plan\b/i.test(text))
|
|
782
|
+
return routeById('Planner');
|
|
783
|
+
if (/^\$?work\b/i.test(text))
|
|
784
|
+
return routeById('Naruto');
|
|
785
|
+
if (/^\$?swarm\b/i.test(text))
|
|
786
|
+
return routeById('Naruto');
|
|
740
787
|
const command = dollarCommand(text);
|
|
741
788
|
if (command) {
|
|
742
789
|
if (command === 'MAD-SKS') {
|
|
@@ -168,8 +168,12 @@ export async function guardedPackageInstall(ctx, spec, opts) {
|
|
|
168
168
|
runOpts.env = opts.env;
|
|
169
169
|
if (opts.maxOutputBytes !== undefined)
|
|
170
170
|
runOpts.maxOutputBytes = opts.maxOutputBytes;
|
|
171
|
+
if (opts.onStdout !== undefined)
|
|
172
|
+
runOpts.onStdout = opts.onStdout;
|
|
173
|
+
if (opts.onStderr !== undefined)
|
|
174
|
+
runOpts.onStderr = opts.onStderr;
|
|
171
175
|
const result = await runProcess(opts.command, opts.args, runOpts);
|
|
172
|
-
return { code: result.code, stdout: result.stdout, stderr: result.stderr };
|
|
176
|
+
return { code: result.code, stdout: result.stdout, stderr: result.stderr, timedOut: result.timedOut === true };
|
|
173
177
|
});
|
|
174
178
|
}
|
|
175
179
|
export async function guardedSkillSnapshotPromotion(ctx, skillTarget, opts, apply) {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { exists, readJson } from '../fsx.js';
|
|
3
|
+
import { imageDimensions, sha256File } from '../wiki-image/image-hash.js';
|
|
4
|
+
export async function evaluateGate(root, missionId, gateFile) {
|
|
5
|
+
const gatePath = path.isAbsolute(gateFile)
|
|
6
|
+
? gateFile
|
|
7
|
+
: path.join(root, '.sneakoscope', 'missions', missionId, gateFile);
|
|
8
|
+
if (!(await exists(gatePath))) {
|
|
9
|
+
return { pass: false, verdict: 'missing', reasons: ['gate_file_missing'], gate_path: gatePath, gate: null };
|
|
10
|
+
}
|
|
11
|
+
const gate = await readJson(gatePath, null);
|
|
12
|
+
if (!gate || typeof gate !== 'object' || Array.isArray(gate)) {
|
|
13
|
+
return { pass: false, verdict: 'invalid', reasons: ['gate_json_invalid'], gate_path: gatePath, gate: null };
|
|
14
|
+
}
|
|
15
|
+
const blockers = Array.isArray(gate.blockers) ? gate.blockers : null;
|
|
16
|
+
const reasons = [];
|
|
17
|
+
if (gate.execution_class === 'mock_fixture') {
|
|
18
|
+
if (gate.passed !== true)
|
|
19
|
+
reasons.push('gate_not_passed');
|
|
20
|
+
if (gate.ok === false)
|
|
21
|
+
reasons.push('gate_ok_false');
|
|
22
|
+
if (!blockers)
|
|
23
|
+
reasons.push('gate_blockers_not_array');
|
|
24
|
+
else if (blockers.length > 0)
|
|
25
|
+
reasons.push('gate_blockers_present');
|
|
26
|
+
return { pass: false, verdict: 'mock_only', reasons: reasons.length ? reasons : ['gate_execution_class_mock_fixture'], gate_path: gatePath, gate };
|
|
27
|
+
}
|
|
28
|
+
if (gate.passed !== true)
|
|
29
|
+
reasons.push('gate_not_passed');
|
|
30
|
+
if (gate.ok === false)
|
|
31
|
+
reasons.push('gate_ok_false');
|
|
32
|
+
if (!blockers)
|
|
33
|
+
reasons.push('gate_blockers_not_array');
|
|
34
|
+
else if (blockers.length > 0)
|
|
35
|
+
reasons.push('gate_blockers_present');
|
|
36
|
+
if (gateFile === 'mad-sks-gate.json' || /mad-sks-gate\.json$/.test(gatePath)) {
|
|
37
|
+
const sqlPlane = gate.sql_plane;
|
|
38
|
+
if (sqlPlane?.requested === true) {
|
|
39
|
+
if (sqlPlane.read_back_passed !== true)
|
|
40
|
+
reasons.push('mad_sks_sql_plane_read_back_not_passed');
|
|
41
|
+
if (sqlPlane.profile_closed !== true)
|
|
42
|
+
reasons.push('mad_sks_sql_plane_profile_not_closed');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (gateFile === 'image-ux-review-gate.json' || /image-ux-review-gate\.json$/.test(gatePath)) {
|
|
46
|
+
const needsFullImagegenEvidence = gate.full_review_passed === true
|
|
47
|
+
|| gate.gpt_image_2_callout_generated === true
|
|
48
|
+
|| (gate.passed === true && gate.reference_only !== true);
|
|
49
|
+
if (needsFullImagegenEvidence) {
|
|
50
|
+
reasons.push(...await imagegenResponseGateReasons(root, path.dirname(gatePath)));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (gateFile === 'ppt-gate.json' || /ppt-gate\.json$/.test(gatePath)) {
|
|
54
|
+
const imagegenEvidence = gate.imagegen_evidence;
|
|
55
|
+
if (imagegenEvidence?.required === true && imagegenEvidence.passed !== true) {
|
|
56
|
+
reasons.push('ppt_imagegen_evidence_not_passed');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (reasons.length > 0) {
|
|
60
|
+
return { pass: false, verdict: 'fail', reasons, gate_path: gatePath, gate };
|
|
61
|
+
}
|
|
62
|
+
return { pass: true, verdict: 'pass', reasons: [], gate_path: gatePath, gate };
|
|
63
|
+
}
|
|
64
|
+
async function imagegenResponseGateReasons(root, missionDir) {
|
|
65
|
+
const reasons = [];
|
|
66
|
+
const response = await readJson(path.join(missionDir, 'image-ux-gpt-image-2-response.json'), null);
|
|
67
|
+
if (!response || typeof response !== 'object')
|
|
68
|
+
return ['imagegen_response_artifact_missing'];
|
|
69
|
+
if (response.schema !== 'sks.image-ux-gpt-image-2-response.v1')
|
|
70
|
+
reasons.push('imagegen_response_schema_invalid');
|
|
71
|
+
if (response.ok !== true || response.status !== 'generated')
|
|
72
|
+
reasons.push(response.blocker || 'imagegen_response_not_generated');
|
|
73
|
+
const evidenceClass = String(response.evidence_class || '');
|
|
74
|
+
if (evidenceClass !== 'codex_app_imagegen')
|
|
75
|
+
reasons.push(evidenceClass ? `imagegen_response_evidence_class_not_codex_app:${evidenceClass}` : 'imagegen_response_evidence_class_missing');
|
|
76
|
+
const outputSource = String(response.output_source || '');
|
|
77
|
+
if (!['manual_attach', 'auto_discovered_generated_images'].includes(outputSource))
|
|
78
|
+
reasons.push('imagegen_response_output_source_invalid');
|
|
79
|
+
const outputPath = String(response.output_image_path || '');
|
|
80
|
+
const expectedSha = String(response.output_sha256 || response.output_image_sha256 || '');
|
|
81
|
+
if (!outputPath)
|
|
82
|
+
reasons.push('imagegen_response_output_path_missing');
|
|
83
|
+
if (!expectedSha)
|
|
84
|
+
reasons.push('imagegen_response_output_sha256_missing');
|
|
85
|
+
if (outputPath) {
|
|
86
|
+
const absolute = path.isAbsolute(outputPath) ? outputPath : path.resolve(root, outputPath);
|
|
87
|
+
try {
|
|
88
|
+
const actualSha = await sha256File(absolute);
|
|
89
|
+
if (expectedSha && actualSha !== expectedSha)
|
|
90
|
+
reasons.push('imagegen_response_output_sha256_mismatch');
|
|
91
|
+
const dims = await imageDimensions(absolute);
|
|
92
|
+
if (!Number.isFinite(Number(dims.width)) || !Number.isFinite(Number(dims.height)) || Number(dims.width) <= 0 || Number(dims.height) <= 0) {
|
|
93
|
+
reasons.push('imagegen_response_output_dimensions_invalid');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
reasons.push('imagegen_response_output_file_unreadable');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return [...new Set(reasons)];
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=gate-evaluator.js.map
|
|
@@ -140,10 +140,16 @@ export async function checkStopGate(input) {
|
|
|
140
140
|
missingFields.push('blockers');
|
|
141
141
|
if (normalizedGate.missing_fields.length > 0)
|
|
142
142
|
missingFields.push(...normalizedGate.missing_fields.map((field) => `missing_fields:${field}`));
|
|
143
|
+
const bugfixMission = await missionHasBugfixWork(root, missionId, normalizedGate);
|
|
144
|
+
if (bugfixMission && normalizedGate.evidence.regression_test_added !== true)
|
|
145
|
+
missingFields.push('regression_test_added');
|
|
146
|
+
if (bugfixMission && normalizedGate.evidence.regression_test_failed_before_fix !== true)
|
|
147
|
+
missingFields.push('regression_test_failed_before_fix');
|
|
143
148
|
if (normalizedGate.status === 'passed'
|
|
144
149
|
&& normalizedGate.passed === true
|
|
145
150
|
&& normalizedGate.blockers.length === 0
|
|
146
|
-
&& normalizedGate.missing_fields.length === 0
|
|
151
|
+
&& normalizedGate.missing_fields.length === 0
|
|
152
|
+
&& missingFields.length === 0) {
|
|
147
153
|
const action = 'allow_stop';
|
|
148
154
|
const diagnostics = {
|
|
149
155
|
schema: 'sks.stop-gate-diagnostics.v1',
|
|
@@ -205,6 +211,15 @@ export async function checkStopGate(input) {
|
|
|
205
211
|
feedback: `Stop blocked: gate not passed. Selected: ${resolution.gate_path}. Missing fields: ${missingFields.join(', ') || 'none'}. Checked: ${resolution.checked_paths.join(', ')}`,
|
|
206
212
|
};
|
|
207
213
|
}
|
|
214
|
+
async function missionHasBugfixWork(root, missionId, gate) {
|
|
215
|
+
const evidence = gate.evidence;
|
|
216
|
+
if (evidence.regression_test_added !== undefined || evidence.regression_test_failed_before_fix !== undefined)
|
|
217
|
+
return true;
|
|
218
|
+
if (!missionId)
|
|
219
|
+
return false;
|
|
220
|
+
const graph = await readJson(path.join(missionDir(root, missionId), 'agents', 'naruto-work-graph.json'), null);
|
|
221
|
+
return Array.isArray(graph?.work_items) && graph.work_items.some((item) => String(item?.kind || '') === 'bugfix');
|
|
222
|
+
}
|
|
208
223
|
async function writeDiagnostics(root, missionId, diagnostics) {
|
|
209
224
|
// Global report
|
|
210
225
|
const reportsDir = path.join(root, '.sneakoscope', 'reports');
|
|
@@ -136,6 +136,10 @@ function evidenceMissingBlockers(evidence) {
|
|
|
136
136
|
blockers.push('proof_not_passed');
|
|
137
137
|
if (evidence.reflection_required === true && evidence.reflection_passed !== true && evidence.reflection_passed !== 'not_required')
|
|
138
138
|
blockers.push('reflection_not_passed');
|
|
139
|
+
if (evidence.regression_test_added === false)
|
|
140
|
+
blockers.push('regression_test_not_added');
|
|
141
|
+
if (evidence.regression_test_failed_before_fix === false)
|
|
142
|
+
blockers.push('regression_test_failed_before_fix_missing');
|
|
139
143
|
return blockers;
|
|
140
144
|
}
|
|
141
145
|
//# sourceMappingURL=stop-gate-writer.js.map
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fsp from 'node:fs/promises';
|
|
3
|
+
import { ensureDir, nowIso, readJson, readText, writeTextAtomic } from '../fsx.js';
|
|
4
|
+
const BEGIN = '<!-- BEGIN SKS PROJECT MEMORY (auto) -->';
|
|
5
|
+
const END = '<!-- END SKS PROJECT MEMORY -->';
|
|
6
|
+
export async function projectTriwikiToAgentsMd(root, opts = {}) {
|
|
7
|
+
const pack = await readJson(path.join(root, '.sneakoscope', 'wiki', 'context-pack.json'), null);
|
|
8
|
+
if (!pack)
|
|
9
|
+
return { ok: false, reason: 'no_context_pack', written: [] };
|
|
10
|
+
const written = [];
|
|
11
|
+
const rootContent = buildRootSections(pack);
|
|
12
|
+
written.push(await upsertManagedBlock(path.join(root, 'AGENTS.md'), rootContent));
|
|
13
|
+
const hotDirs = await scoreComplexDirs(root, pack, opts.maxLocalFiles ?? 8);
|
|
14
|
+
for (const dir of hotDirs) {
|
|
15
|
+
written.push(await upsertManagedBlock(path.join(root, dir.path, 'AGENTS.md'), buildLocalSection(pack, dir)));
|
|
16
|
+
}
|
|
17
|
+
return { ok: true, reason: null, written, hot_dirs: hotDirs };
|
|
18
|
+
}
|
|
19
|
+
export async function removeTriwikiAgentsMdBlocks(root) {
|
|
20
|
+
const files = await collectAgentsMdFiles(root);
|
|
21
|
+
const changed = [];
|
|
22
|
+
for (const file of files) {
|
|
23
|
+
const prev = await readText(file, '');
|
|
24
|
+
const next = removeManagedBlock(String(prev || '')).trim();
|
|
25
|
+
if (next !== String(prev || '').trim()) {
|
|
26
|
+
await writeTextAtomic(file, next ? `${next}\n` : '');
|
|
27
|
+
changed.push(file);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return changed;
|
|
31
|
+
}
|
|
32
|
+
async function upsertManagedBlock(file, content) {
|
|
33
|
+
const prev = await readText(file, '');
|
|
34
|
+
const block = `${BEGIN}\n${content.trim()}\n${END}`;
|
|
35
|
+
const next = String(prev || '').includes(BEGIN)
|
|
36
|
+
? String(prev || '').replace(new RegExp(`${escapeRe(BEGIN)}[\\s\\S]*?${escapeRe(END)}`), block)
|
|
37
|
+
: `${String(prev || '').trim()}\n\n${block}\n`;
|
|
38
|
+
if (next !== prev) {
|
|
39
|
+
await ensureDir(path.dirname(file));
|
|
40
|
+
await writeTextAtomic(file, next.trimStart());
|
|
41
|
+
}
|
|
42
|
+
return file;
|
|
43
|
+
}
|
|
44
|
+
function removeManagedBlock(text) {
|
|
45
|
+
return text.replace(new RegExp(`\\n?${escapeRe(BEGIN)}[\\s\\S]*?${escapeRe(END)}\\n?`, 'g'), '\n').replace(/\n{3,}/g, '\n\n');
|
|
46
|
+
}
|
|
47
|
+
function buildRootSections(pack) {
|
|
48
|
+
const claims = compactClaims(pack).slice(0, 8);
|
|
49
|
+
const modules = compactModules(pack).slice(0, 8);
|
|
50
|
+
const wrongness = compactWrongness(pack).slice(0, 5);
|
|
51
|
+
return [
|
|
52
|
+
`# SKS Project Memory`,
|
|
53
|
+
``,
|
|
54
|
+
`Generated: ${nowIso()}`,
|
|
55
|
+
`Source: .sneakoscope/wiki/context-pack.json`,
|
|
56
|
+
``,
|
|
57
|
+
`## Architecture Summary`,
|
|
58
|
+
claims.length ? claims.map((claim) => `- ${claim}`).join('\n') : '- No high-trust TriWiki claims available yet.',
|
|
59
|
+
``,
|
|
60
|
+
`## Core Modules`,
|
|
61
|
+
modules.length ? modules.map((item) => `- ${item}`).join('\n') : '- No module map entries available yet.',
|
|
62
|
+
``,
|
|
63
|
+
`## Recent Lessons`,
|
|
64
|
+
wrongness.length ? wrongness.map((item) => `- ${item}`).join('\n') : '- No wrongness-ledger lessons available yet.'
|
|
65
|
+
].join('\n');
|
|
66
|
+
}
|
|
67
|
+
function buildLocalSection(pack, dir) {
|
|
68
|
+
const claims = compactClaims(pack)
|
|
69
|
+
.filter((claim) => claim.includes(dir.path))
|
|
70
|
+
.slice(0, 6);
|
|
71
|
+
return [
|
|
72
|
+
`# SKS Local Project Memory: ${dir.path}`,
|
|
73
|
+
``,
|
|
74
|
+
`Generated: ${nowIso()}`,
|
|
75
|
+
``,
|
|
76
|
+
`## Local Anchors`,
|
|
77
|
+
dir.files.slice(0, 8).map((file) => `- ${file}`).join('\n') || '- No file anchors available.',
|
|
78
|
+
``,
|
|
79
|
+
`## TriWiki Notes`,
|
|
80
|
+
claims.length ? claims.map((claim) => `- ${claim}`).join('\n') : '- Use root AGENTS.md SKS Project Memory plus nearby source files as authority.'
|
|
81
|
+
].join('\n');
|
|
82
|
+
}
|
|
83
|
+
async function scoreComplexDirs(root, pack, maxLocalFiles) {
|
|
84
|
+
const sourcePaths = extractSourcePaths(pack).filter((file) => !file.includes('node_modules') && !file.startsWith('.git/'));
|
|
85
|
+
const scores = new Map();
|
|
86
|
+
for (const file of sourcePaths) {
|
|
87
|
+
const dir = firstInterestingDir(file);
|
|
88
|
+
if (!dir)
|
|
89
|
+
continue;
|
|
90
|
+
const row = scores.get(dir) || { path: dir, score: 0, files: new Set() };
|
|
91
|
+
row.score += 2;
|
|
92
|
+
row.files.add(file);
|
|
93
|
+
scores.set(dir, row);
|
|
94
|
+
}
|
|
95
|
+
for (const dir of ['src/core', 'src/commands', 'src/scripts', 'src/cli']) {
|
|
96
|
+
const count = await countFiles(path.join(root, dir)).catch(() => 0);
|
|
97
|
+
if (!count)
|
|
98
|
+
continue;
|
|
99
|
+
const row = scores.get(dir) || { path: dir, score: 0, files: new Set() };
|
|
100
|
+
row.score += count;
|
|
101
|
+
scores.set(dir, row);
|
|
102
|
+
}
|
|
103
|
+
return [...scores.values()]
|
|
104
|
+
.filter((row) => row.path.split('/').length <= 3)
|
|
105
|
+
.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path))
|
|
106
|
+
.slice(0, Math.max(0, maxLocalFiles))
|
|
107
|
+
.map((row) => ({ path: row.path, score: row.score, files: [...row.files].slice(0, 12) }));
|
|
108
|
+
}
|
|
109
|
+
function compactClaims(pack) {
|
|
110
|
+
const rows = flattenRecords(pack).filter((row) => typeof row.claim === 'string' || typeof row.text === 'string' || typeof row.summary === 'string');
|
|
111
|
+
return rows
|
|
112
|
+
.map((row) => sanitizeLine(row.claim || row.text || row.summary))
|
|
113
|
+
.filter(Boolean)
|
|
114
|
+
.slice(0, 40);
|
|
115
|
+
}
|
|
116
|
+
function compactModules(pack) {
|
|
117
|
+
const rows = flattenRecords(pack).filter((row) => row.path || row.source_path || row.file);
|
|
118
|
+
return rows
|
|
119
|
+
.map((row) => sanitizeLine(`${row.path || row.source_path || row.file}${row.summary ? ` - ${row.summary}` : ''}`))
|
|
120
|
+
.filter(Boolean)
|
|
121
|
+
.slice(0, 40);
|
|
122
|
+
}
|
|
123
|
+
function compactWrongness(pack) {
|
|
124
|
+
const rows = flattenRecords(pack).filter((row) => /wrong|lesson|mistake|stale|failure/i.test(String(row.kind || row.type || row.id || '')));
|
|
125
|
+
return rows.map((row) => sanitizeLine(row.lesson || row.summary || row.text || row.claim || row.id)).filter(Boolean).slice(0, 20);
|
|
126
|
+
}
|
|
127
|
+
function extractSourcePaths(pack) {
|
|
128
|
+
return [...new Set(flattenRecords(pack).flatMap((row) => [row.path, row.source_path, row.file, row.rel, row.relative_path]).map((value) => String(value || '').replace(/^\.\//, '')).filter((value) => value.includes('/')))];
|
|
129
|
+
}
|
|
130
|
+
function flattenRecords(value, depth = 0) {
|
|
131
|
+
if (depth > 5 || value == null)
|
|
132
|
+
return [];
|
|
133
|
+
if (Array.isArray(value))
|
|
134
|
+
return value.flatMap((item) => flattenRecords(item, depth + 1));
|
|
135
|
+
if (typeof value !== 'object')
|
|
136
|
+
return [];
|
|
137
|
+
const own = value;
|
|
138
|
+
return [own, ...Object.values(own).flatMap((child) => flattenRecords(child, depth + 1))];
|
|
139
|
+
}
|
|
140
|
+
function firstInterestingDir(file) {
|
|
141
|
+
const parts = file.split('/').filter(Boolean);
|
|
142
|
+
if (parts.length < 2)
|
|
143
|
+
return null;
|
|
144
|
+
if (parts[0] === 'src' && parts.length >= 3)
|
|
145
|
+
return `${parts[0]}/${parts[1]}`;
|
|
146
|
+
return parts[0] || null;
|
|
147
|
+
}
|
|
148
|
+
async function countFiles(dir) {
|
|
149
|
+
const rows = await fsp.readdir(dir, { withFileTypes: true });
|
|
150
|
+
let total = 0;
|
|
151
|
+
for (const row of rows) {
|
|
152
|
+
if (row.name === 'node_modules' || row.name === '.git' || row.name === 'dist')
|
|
153
|
+
continue;
|
|
154
|
+
const file = path.join(dir, row.name);
|
|
155
|
+
total += row.isDirectory() ? await countFiles(file) : row.isFile() ? 1 : 0;
|
|
156
|
+
}
|
|
157
|
+
return total;
|
|
158
|
+
}
|
|
159
|
+
async function collectAgentsMdFiles(root) {
|
|
160
|
+
const files = [];
|
|
161
|
+
async function walk(dir, depth) {
|
|
162
|
+
if (depth > 4)
|
|
163
|
+
return;
|
|
164
|
+
const rows = await fsp.readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
165
|
+
for (const row of rows) {
|
|
166
|
+
if (['.git', 'node_modules', 'dist'].includes(row.name))
|
|
167
|
+
continue;
|
|
168
|
+
const file = path.join(dir, row.name);
|
|
169
|
+
if (row.isFile() && row.name === 'AGENTS.md')
|
|
170
|
+
files.push(file);
|
|
171
|
+
else if (row.isDirectory())
|
|
172
|
+
await walk(file, depth + 1);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
await walk(root, 0);
|
|
176
|
+
return files;
|
|
177
|
+
}
|
|
178
|
+
function sanitizeLine(value) {
|
|
179
|
+
return String(value || '').replace(/\s+/g, ' ').trim().slice(0, 220);
|
|
180
|
+
}
|
|
181
|
+
function escapeRe(value) {
|
|
182
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=agents-md-projector.js.map
|
|
@@ -140,7 +140,9 @@ export function createWrongnessRecord(input = {}) {
|
|
|
140
140
|
corrective_action: normalizeCorrectiveAction(row.corrective_action),
|
|
141
141
|
avoidance_rule: normalizeAvoidanceRule(row.avoidance_rule, kind, avoidanceText, severity),
|
|
142
142
|
correction: normalizeCorrection(row.correction ?? row.corrected_anchor),
|
|
143
|
-
links: normalizeLinks(row.links)
|
|
143
|
+
links: normalizeLinks(row.links),
|
|
144
|
+
...(row.rule_compiled === undefined ? {} : { rule_compiled: Boolean(row.rule_compiled) }),
|
|
145
|
+
...(row.compiled_rule_id === undefined ? {} : { compiled_rule_id: stringOrNull(row.compiled_rule_id) })
|
|
144
146
|
};
|
|
145
147
|
}
|
|
146
148
|
export function emptyWrongnessLedger(scope = 'project', missionId = null) {
|
|
@@ -102,7 +102,7 @@ export function buildTrustReport({ proof = {}, evidenceIndex = {}, contract = {}
|
|
|
102
102
|
return {
|
|
103
103
|
schema: TRUST_REPORT_SCHEMA,
|
|
104
104
|
...trustKernelMetadata(),
|
|
105
|
-
ok: issues.length === 0 && !['blocked', 'failed', 'not_verified'].includes(finalStatus),
|
|
105
|
+
ok: issues.length === 0 && !['blocked', 'failed', 'not_verified', 'mock_only'].includes(finalStatus),
|
|
106
106
|
mission_id: proof.mission_id || contract.mission_id || null,
|
|
107
107
|
route: proof.route || contract.route || null,
|
|
108
108
|
status: finalStatus,
|
|
@@ -7,6 +7,8 @@ export function combineTrustStatus(statuses = []) {
|
|
|
7
7
|
return 'blocked';
|
|
8
8
|
if (values.includes('not_verified'))
|
|
9
9
|
return 'not_verified';
|
|
10
|
+
if (values.includes('mock_only'))
|
|
11
|
+
return 'mock_only';
|
|
10
12
|
if (values.includes('verified_partial'))
|
|
11
13
|
return 'verified_partial';
|
|
12
14
|
return values.length ? 'verified' : 'not_verified';
|