sneakoscope 7.1.0 → 7.3.0
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 +9 -1
- package/config/architecture-budgets.v1.json +1 -8
- package/crates/sks-core/Cargo.lock +225 -1
- package/crates/sks-core/Cargo.toml +8 -1
- package/crates/sks-core/src/main.rs +7 -1
- package/crates/sks-core/src/search/files.rs +114 -0
- package/crates/sks-core/src/search/mod.rs +274 -0
- package/crates/sks-core/src/search/text.rs +175 -0
- package/dist/bin/sks-dispatch.js +4 -3
- package/dist/cli/command-manifest-lite.js +177 -6
- package/dist/cli/command-registry.js +42 -8
- package/dist/cli/help.js +30 -0
- package/dist/cli/install-helpers-codex-lb-config.js +9 -6
- package/dist/cli/install-helpers-codex-lb-selftest-chain.js +1 -1
- package/dist/cli/install-helpers-install-support.js +1 -1
- package/dist/cli/install-helpers.js +19 -9
- package/dist/cli/router.js +16 -3
- package/dist/commands/codex-app.js +40 -5
- package/dist/commands/doctor-profile.js +78 -0
- package/dist/commands/doctor.js +29 -69
- package/dist/commands/search.js +4 -0
- package/dist/config/skills-manifest.json +53 -60
- package/dist/core/agent-bridge/agent-manifest.js +22 -26
- package/dist/core/agent-bridge/host-capability-policy.js +109 -8
- package/dist/core/agent-bridge/host-capability-runtime.js +178 -50
- package/dist/core/agent-guidance/directive-registry.js +123 -0
- package/dist/core/agents/agent-effort-policy.js +45 -6
- package/dist/core/agents/agent-worker-pipeline.js +1 -3
- package/dist/core/agents/native-worker-backend-router.js +43 -19
- package/dist/core/auto-review.js +1 -3
- package/dist/core/code-structure.js +282 -19
- package/dist/core/codex/codex-config-guard.js +14 -4
- package/dist/core/codex/codex-config-toml.js +1 -3
- package/dist/core/codex-app/codex-agent-role-sync.js +1 -3
- package/dist/core/codex-app/codex-app-fast-ui-repair.js +14 -1
- package/dist/core/codex-app/codex-app-types.js +2 -3
- package/dist/core/codex-app/codex-desktop-routing-ownership.js +91 -0
- package/dist/core/codex-app/codex-hook-approval-probe.js +1 -3
- package/dist/core/codex-app/codex-hook-lifecycle.js +1 -3
- package/dist/core/codex-app/codex-init-deep.js +22 -10
- package/dist/core/codex-app/codex-model-catalog.js +384 -0
- package/dist/core/codex-app/codex-models-cache.js +160 -0
- package/dist/core/codex-app/desktop-routing-snapshot.js +233 -0
- package/dist/core/codex-app/glm-profile-installer.js +1 -3
- package/dist/core/codex-app/mcp-manager.js +1 -3
- package/dist/core/codex-app/menubar/constants.js +3 -0
- package/dist/core/codex-app/menubar/installer.js +11 -1
- package/dist/core/codex-app/multi-provider-router-support.js +202 -0
- package/dist/core/codex-app/multi-provider-router.js +379 -0
- package/dist/core/codex-app/openrouter-activate.js +189 -26
- package/dist/core/codex-app/openrouter-base-instructions.js +1 -0
- package/dist/core/codex-app/openrouter-model-catalog.js +217 -0
- package/dist/core/codex-app/role-model-catalog-priority.js +61 -0
- package/dist/core/codex-app.js +30 -6
- package/dist/core/codex-compat/codex-hook-semantic-validator.js +1 -3
- package/dist/core/codex-control/codex-app-server-v2-client.js +39 -2
- package/dist/core/codex-lb/codex-lb-env.js +1 -3
- package/dist/core/codex-lb/codex-lb-tool-catalog.js +6 -1
- package/dist/core/codex-native/codex-native-feature-broker.js +2 -6
- package/dist/core/codex-native/codex-native-interop-policy.js +1 -3
- package/dist/core/codex-native/codex-native-reference-cache.js +1 -3
- package/dist/core/codex-native/codex-native-reference-source.js +1 -3
- package/dist/core/codex-native/codex-native-repair-transaction.js +1 -3
- package/dist/core/codex-native/core-skill-manifest.js +3 -2
- package/dist/core/codex-native/native-capability-repair-matrix.js +1 -3
- package/dist/core/codex-plugins/codex-plugin-repair.js +1 -3
- package/dist/core/codex-runtime/codex-desktop-config-policy.js +4 -4
- package/dist/core/commands/agent-bridge-command.js +24 -3
- package/dist/core/commands/image-ux-review-command.js +5 -11
- package/dist/core/commands/menubar-command.js +1 -1
- package/dist/core/commands/naruto-command.js +40 -13
- package/dist/core/commands/pipeline-command.js +5 -2
- package/dist/core/commands/release-command.js +63 -1
- package/dist/core/commands/remote-command.js +18 -0
- package/dist/core/commands/search-command.js +151 -0
- package/dist/core/commands/telegram-command.js +251 -108
- package/dist/core/commands/uninstall-command.js +1 -1
- package/dist/core/config/secret-preservation.js +1 -3
- package/dist/core/context7-client.js +2 -1
- package/dist/core/db-review.js +704 -0
- package/dist/core/db-safety.js +17 -23
- package/dist/core/doctor/browser-use-repair.js +1 -3
- package/dist/core/doctor/codex-startup-config-repair.js +1 -3
- package/dist/core/doctor/computer-use-repair.js +1 -3
- package/dist/core/doctor/context7-mcp-repair.js +1 -3
- package/dist/core/doctor/current-project-guidance.js +1 -3
- package/dist/core/doctor/doctor-codex-startup-repair.js +1 -3
- package/dist/core/doctor/doctor-dirty-planner.js +2 -2
- package/dist/core/doctor/doctor-native-capability-repair.js +1 -3
- package/dist/core/doctor/doctor-transaction.js +1 -3
- package/dist/core/doctor/imagegen-repair.js +1 -3
- package/dist/core/doctor/legacy-global-hook-cleanup.js +1 -3
- package/dist/core/doctor/mcp-transport-collision-repair.js +1 -3
- package/dist/core/doctor/retired-managed-residue-private.js +1 -3
- package/dist/core/doctor/supabase-mcp-repair.js +1 -3
- package/dist/core/engineering-sanity-review.js +186 -0
- package/dist/core/errors/message.js +3 -0
- package/dist/core/evidence/evidence-schema.js +1 -3
- package/dist/core/feature-fixtures.js +1 -0
- package/dist/core/feature-registry.js +1 -3
- package/dist/core/fsx.js +13 -0
- package/dist/core/git-hygiene/shared-memory-publish.js +1 -3
- package/dist/core/git-hygiene/validators.js +1 -3
- package/dist/core/harness-guard.js +21 -3
- package/dist/core/hooks-runtime/hook-context.js +2 -2
- package/dist/core/image-ux-review/imagegen-adapter.js +52 -56
- package/dist/core/image-ux-review/real-callout-extractor.js +6 -1
- package/dist/core/image-ux-review.js +3 -5
- package/dist/core/imagegen/codex-lb-imagegen-target.js +70 -0
- package/dist/core/imagegen/imagegen-capability.js +11 -11
- package/dist/core/imagegen/imagegen-evidence.js +32 -0
- package/dist/core/init/skills.js +9 -11
- package/dist/core/init.js +4 -6
- package/dist/core/json/records.js +9 -0
- package/dist/core/json-schema-validator.js +1 -3
- package/dist/core/lean-engineering-policy.js +54 -0
- package/dist/core/loops/loop-continuation-enforcer.js +1 -3
- package/dist/core/mad-sks/sql-plane/mcp-executor.js +2 -1
- package/dist/core/mad-sks/sql-plane/policy.js +2 -1
- package/dist/core/managed-assets/managed-assets-manifest.js +4 -3
- package/dist/core/mcp-config/codex-cli-adapter.js +1 -3
- package/dist/core/mcp-config/config-reader.js +2 -3
- package/dist/core/mcp-config/guarded-patch.js +1 -1
- package/dist/core/mcp-config/health-check.js +2 -1
- package/dist/core/mcp-config/mutation.js +1 -1
- package/dist/core/mcp-config/restore.js +1 -1
- package/dist/core/mcp-config/secret-policy.js +1 -3
- package/dist/core/migration/migration-transaction-journal.js +3 -3
- package/dist/core/naruto/naruto-concurrency-governor.js +2 -2
- package/dist/core/perf/import-graph-budget.js +91 -1
- package/dist/core/pipeline/pipeline-plan-writer.js +1 -1
- package/dist/core/pipeline-internals/runtime-core.js +121 -23
- package/dist/core/pipeline-internals/runtime-gates.js +193 -4
- package/dist/core/pipeline.js +1 -1
- package/dist/core/ppt-review/slide-imagegen-review.js +7 -7
- package/dist/core/ppt.js +3 -3
- package/dist/core/product-design-app-server.js +2 -1
- package/dist/core/proof/fake-real-proof-policy.js +1 -3
- package/dist/core/proof/root-cause-policy.js +1 -3
- package/dist/core/proof/validation.js +1 -3
- package/dist/core/provider/model-router.js +4 -0
- package/dist/core/provider/provider-context.js +1 -3
- package/dist/core/providers/openrouter/openrouter-account.js +1 -3
- package/dist/core/quality/helper-dedup.js +0 -0
- package/dist/core/recallpulse.js +1 -1
- package/dist/core/release/file-ownership.js +26 -17
- package/dist/core/release/macos-menubar-proof.js +59 -1
- package/dist/core/release/main-push-guard.js +288 -24
- package/dist/core/release/main-push-receipt.js +10 -45
- package/dist/core/release/package-size-budget.js +1 -1
- package/dist/core/release/release-gate-contract.js +2 -0
- package/dist/core/release/release-pack-receipt.js +1 -1
- package/dist/core/release/release-proof-io.js +33 -0
- package/dist/core/release/release-upgrade-baseline.js +9 -0
- package/dist/core/release/runtime-script-pack-closure.js +153 -4
- package/dist/core/release/stage-publish.js +194 -0
- package/dist/core/remote/index.js +2 -0
- package/dist/core/remote/local-worker-client.js +35 -0
- package/dist/core/remote/machine-registry.js +18 -13
- package/dist/core/remote/owner-proof.js +1 -3
- package/dist/core/remote/protocol.js +1 -3
- package/dist/core/remote/readiness.js +1 -3
- package/dist/core/remote/session-binding.js +153 -0
- package/dist/core/remote/session-index.js +1 -3
- package/dist/core/remote/types.js +1 -0
- package/dist/core/remote/worker.js +228 -14
- package/dist/core/responses-stream.js +151 -0
- package/dist/core/routes/dollar-manifest-lite.js +1 -1
- package/dist/core/routes.js +8 -8
- package/dist/core/rust-accelerator.js +12 -2
- package/dist/core/safety/ssot-guard.js +1 -3
- package/dist/core/search/benchmark.js +358 -0
- package/dist/core/search/cache.js +65 -0
- package/dist/core/search/context.js +144 -0
- package/dist/core/search/doctor.js +74 -0
- package/dist/core/search/files.js +192 -0
- package/dist/core/search/index.js +5 -0
- package/dist/core/search/ipc.js +64 -0
- package/dist/core/search/provider.js +142 -0
- package/dist/core/search/rust-bridge.js +24 -0
- package/dist/core/search/structure.js +230 -0
- package/dist/core/search/symbol.js +272 -0
- package/dist/core/search/text.js +146 -0
- package/dist/core/search/types.js +22 -0
- package/dist/core/search/typescript-ls.js +215 -0
- package/dist/core/search-visibility/discovery.js +1 -3
- package/dist/core/skill-forge.js +1 -1
- package/dist/core/stop-gate/gate-evaluator.js +3 -3
- package/dist/core/stop-gate/stop-gate-check.js +1 -3
- package/dist/core/structured-output-adapter.js +62 -2
- package/dist/core/subagents/agent-catalog.js +56 -43
- package/dist/core/subagents/model-policy.js +17 -7
- package/dist/core/subagents/naruto-proof-projection.js +2 -6
- package/dist/core/subagents/official-subagent-config.js +1 -3
- package/dist/core/subagents/official-subagent-preparation.js +73 -10
- package/dist/core/subagents/official-subagent-prompt.js +85 -18
- package/dist/core/subagents/official-subagent-runner.js +10 -5
- package/dist/core/subagents/role-model-preferences.js +202 -44
- package/dist/core/subagents/subagent-evidence.js +1 -3
- package/dist/core/subagents/thread-budget.js +1 -1
- package/dist/core/subagents/triwiki-attention.js +1 -5
- package/dist/core/telegram/config.js +29 -12
- package/dist/core/telegram/hub.js +8 -2
- package/dist/core/telegram/index.js +2 -0
- package/dist/core/telegram/messages.js +8 -2
- package/dist/core/telegram/runtime-projection.js +8 -5
- package/dist/core/telegram/runtime.js +19 -9
- package/dist/core/telegram/service.js +181 -0
- package/dist/core/telegram/setup.js +220 -0
- package/dist/core/text/regex.js +3 -0
- package/dist/core/text/strings.js +6 -0
- package/dist/core/triwiki-wrongness/image-wrongness.js +1 -3
- package/dist/core/triwiki-wrongness/wrongness-ledger.js +1 -3
- package/dist/core/triwiki-wrongness/wrongness-proof-linker.js +1 -3
- package/dist/core/triwiki-wrongness/wrongness-retrieval.js +1 -3
- package/dist/core/triwiki-wrongness/wrongness-schema.js +1 -3
- package/dist/core/triwiki-wrongness/wrongness-trust-policy.js +1 -3
- package/dist/core/trust-kernel/completion-contract.js +1 -3
- package/dist/core/trust-kernel/route-contract.js +1 -3
- package/dist/core/update/update-migration-state.js +1 -3
- package/dist/core/update-check.js +20 -6
- package/dist/core/verification/diff-quality.js +3 -4
- package/dist/core/verification/impact-scan.js +36 -89
- package/dist/core/verification/mistake-rule-compiler.js +17 -4
- package/dist/core/version-manager.js +3 -20
- package/dist/core/version.js +1 -1
- package/dist/native/sks-menubar/Sources/ControlCenterWindowController.swift +23 -3
- package/dist/native/sks-menubar/Sources/ControlKit.swift +102 -0
- package/dist/native/sks-menubar/Sources/DiagnosticsViewController.swift +23 -11
- package/dist/native/sks-menubar/Sources/MCPServersViewController.swift +7 -3
- package/dist/native/sks-menubar/Sources/OperationCoordinator.swift +17 -1
- package/dist/native/sks-menubar/Sources/OverviewViewController.swift +22 -15
- package/dist/native/sks-menubar/Sources/ProcessClient.swift +15 -5
- package/dist/native/sks-menubar/Sources/ProvidersMultiProvider.swift +324 -0
- package/dist/native/sks-menubar/Sources/ProvidersOpenRouter.swift +154 -214
- package/dist/native/sks-menubar/Sources/ProvidersRoleModels.swift +252 -0
- package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +77 -71
- package/dist/native/sks-menubar/Sources/RemoteTelegramViewController.swift +167 -51
- package/dist/native/sks-menubar/Sources/SettingsViewController.swift +14 -5
- package/dist/native/sks-menubar/Sources/SidebarItem.swift +15 -1
- package/dist/native/sks-menubar/Sources/StatusItemController.swift +2 -2
- package/dist/native/sks-menubar/Sources/UpdatesViewController.swift +16 -12
- package/dist/scripts/agent-guidance-dedup-check.js +23 -0
- package/dist/scripts/agent-message-bus-reader-check.js +1 -1
- package/dist/scripts/all-feature-deep-completion-check.js +1 -1
- package/dist/scripts/appshots-thread-attachment-discovery-check.js +1 -1
- package/dist/scripts/architecture-guard-check.js +1 -2
- package/dist/scripts/certificate-sla-check.js +1 -1
- package/dist/scripts/cli-output-consistency-check.js +1 -1
- package/dist/scripts/codex-0-134-runner-truth-check.js +1 -1
- package/dist/scripts/codex-0138-capability-artifact-check.js +1 -1
- package/dist/scripts/codex-0138-capability-check.js +1 -1
- package/dist/scripts/codex-0138-doctor-check.js +1 -1
- package/dist/scripts/codex-0138-feature-probes-check.js +1 -1
- package/dist/scripts/codex-0144-app-server-v2-check.js +1 -1
- package/dist/scripts/codex-0144-binary-identity-check.js +1 -1
- package/dist/scripts/codex-0144-capability-check.js +1 -1
- package/dist/scripts/codex-0144-core-real-probes-check.js +1 -1
- package/dist/scripts/codex-0144-manifest-check.js +1 -1
- package/dist/scripts/codex-0144-policy-check.js +1 -1
- package/dist/scripts/codex-0144-thread-store-check.js +1 -1
- package/dist/scripts/codex-agent-role-rich-content-check.js +2 -2
- package/dist/scripts/codex-agent-role-sync-check.js +2 -2
- package/dist/scripts/codex-agent-type-routing-check.js +2 -2
- package/dist/scripts/codex-app-execution-profile-check.js +2 -2
- package/dist/scripts/codex-app-handoff-check.js +1 -1
- package/dist/scripts/codex-app-handoff-launch-check.js +1 -1
- package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +1 -1
- package/dist/scripts/codex-lb-fast-ui-preservation-check.js +1 -3
- package/dist/scripts/codex-native-feature-broker-blackbox.js +2 -2
- package/dist/scripts/codex-native-feature-broker-check.js +2 -2
- package/dist/scripts/{sks-3-1-6-directive-check-lib.js → codex-native-gate-lib.js} +5 -5
- package/dist/scripts/codex-native-harness-compat-check.js +2 -2
- package/dist/scripts/codex-native-hook-lifecycle-proof-check.js +2 -2
- package/dist/scripts/codex-plugin-app-template-policy-check.js +1 -1
- package/dist/scripts/codex-sdk-backend-router-check.js +1 -1
- package/dist/scripts/codex-sdk-capability-check.js +1 -1
- package/dist/scripts/context7-evidence-dedupe-check.js +1 -1
- package/dist/scripts/core-skill-card-schema-check.js +1 -1
- package/dist/scripts/core-skill-deployment-snapshot-check.js +1 -1
- package/dist/scripts/core-skill-heldout-validation-check.js +1 -1
- package/dist/scripts/core-skill-no-inference-optimizer-check.js +1 -1
- package/dist/scripts/core-skill-patch-check.js +1 -1
- package/dist/scripts/core-skill-route-runtime-integration-check.js +1 -1
- package/dist/scripts/current-command-surface-check.js +1 -1
- package/dist/scripts/current-surface-update-e2e-check.js +4 -1
- package/dist/scripts/current-upgrade-matrix-check.js +1 -1
- package/dist/scripts/dfix-fixture-check.js +1 -1
- package/dist/scripts/dfix-patch-handoff-check.js +1 -1
- package/dist/scripts/dfix-verification-check.js +1 -1
- package/dist/scripts/dfix-verification-recommendation-check.js +1 -1
- package/dist/scripts/docs-truthfulness-check.js +16 -3
- package/dist/scripts/doctor-codex-app-harness-check.js +2 -2
- package/dist/scripts/evidence-flagship-coverage-check.js +1 -1
- package/dist/scripts/{sks-1-18-gate-lib.js → gate-lib.js} +1 -1
- package/dist/scripts/gate-policy-audit-check.js +4 -1
- package/dist/scripts/git-worktree-checkpoint-check.js +1 -1
- package/dist/scripts/git-worktree-cross-rebase-check.js +1 -1
- package/dist/scripts/git-worktree-diff-envelope-check.js +1 -1
- package/dist/scripts/git-worktree-dirty-lock-check.js +1 -1
- package/dist/scripts/git-worktree-dirty-main-detection-check.js +1 -1
- package/dist/scripts/git-worktree-integration-primary-check.js +1 -1
- package/dist/scripts/git-worktree-manifest-append-check.js +1 -1
- package/dist/scripts/git-worktree-untracked-diff-check.js +1 -1
- package/dist/scripts/harness-benchmark-check.js +1 -1
- package/dist/scripts/helper-dedup-check.js +62 -0
- package/dist/scripts/hook-latency-budget-check.js +1 -1
- package/dist/scripts/image-artifact-path-contract-check.js +1 -1
- package/dist/scripts/imagegen-real-smoke-check.js +2 -5
- package/dist/scripts/installed-package-smoke-check.js +1 -1
- package/dist/scripts/legacy-gate-inventory-check.js +1 -1
- package/dist/scripts/legacy-gate-purge-check.js +1 -1
- package/dist/scripts/legacy-strong-inventory-check.js +1 -1
- package/dist/scripts/lib/codex-sdk-gate-lib.js +1 -1
- package/dist/scripts/mad-sks-launch-sql-plane-boundary-check.js +1 -1
- package/dist/scripts/mad-sks-sql-plane-capability-check.js +1 -1
- package/dist/scripts/mad-sks-sql-plane-lifecycle-hook-decision-check.js +1 -1
- package/dist/scripts/mad-sks-sql-plane-result-lifecycle-check.js +1 -1
- package/dist/scripts/managed-config-merge-check.js +1 -1
- package/dist/scripts/mcp-plugin-inventory-check.js +1 -1
- package/dist/scripts/model-call-concurrency-check.js +1 -1
- package/dist/scripts/mutation-callsite-coverage-check.js +1 -1
- package/dist/scripts/naruto-ssot-gate-aliases-check.js +1 -1
- package/dist/scripts/naruto-ssot-pipeline-default-check.js +1 -1
- package/dist/scripts/naruto-ssot-route-normalization-check.js +1 -1
- package/dist/scripts/naruto-ssot-routing-check.js +1 -1
- package/dist/scripts/naruto-worktree-coding-blackbox.js +1 -1
- package/dist/scripts/native-capability-repair-matrix-check.js +1 -1
- package/dist/scripts/native-image-generation-repair-check.js +1 -1
- package/dist/scripts/official-subagent-workflow-check.js +3 -3
- package/dist/scripts/package-published-contract-check.js +37 -4
- package/dist/scripts/packlist-performance-check.js +17 -1
- package/dist/scripts/pipeline-codex-native-doctor-mad-routing-real-blackbox.js +1 -3
- package/dist/scripts/ppt-real-export-adapter-check.js +1 -1
- package/dist/scripts/ppt-real-imagegen-wiring-check.js +1 -1
- package/dist/scripts/ppt-reexport-rereview-check.js +1 -1
- package/dist/scripts/prepublish-fast-check.js +1 -1
- package/dist/scripts/probe-memoization-check.js +2 -2
- package/dist/scripts/prompt-placeholder-guard-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-capability-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-cli-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-confirmation-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-gate-lifecycle-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-launch-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-status-lifecycle-check.js +1 -1
- package/dist/scripts/qa-loop-budget-policy-check.js +1 -1
- package/dist/scripts/qa-loop-effort-escalation-check.js +1 -1
- package/dist/scripts/qa-loop-execution-profile-routing-check.js +2 -2
- package/dist/scripts/qa-loop-image-path-exposure-check.js +1 -1
- package/dist/scripts/qa-loop-image-path-prompt-injection-check.js +1 -1
- package/dist/scripts/{sks-1-12-real-execution-check-lib.js → real-execution-check-lib.js} +1 -1
- package/dist/scripts/release-affected-selector-check.js +1 -1
- package/dist/scripts/release-aggressive-resource-governor-check.js +1 -1
- package/dist/scripts/release-cache-glob-hashing-check.js +1 -1
- package/dist/scripts/release-cache-input-classifier-check.js +1 -1
- package/dist/scripts/release-cache-neutralization-report-check.js +1 -1
- package/dist/scripts/release-cache-version-neutral-fixture-check.js +1 -1
- package/dist/scripts/release-dynamic-presets-check.js +2 -2
- package/dist/scripts/release-full-parallelism-blackbox.js +1 -1
- package/dist/scripts/release-gate-batch-runner-check.js +1 -1
- package/dist/scripts/release-gate-budget-check.js +1 -1
- package/dist/scripts/release-gate-dag-runner-check.js +1 -1
- package/dist/scripts/release-latency-slo-check.js +1 -1
- package/dist/scripts/release-metadata-check.js +256 -2
- package/dist/scripts/release-parallel-speed-budget-check.js +1 -1
- package/dist/scripts/release-proof-truth-check.js +1 -1
- package/dist/scripts/release-provenance-check.js +4 -2
- package/dist/scripts/release-runtime-truth-matrix-check.js +1 -1
- package/dist/scripts/research-blueprint-densifier-check.js +1 -1
- package/dist/scripts/research-claim-builder-check.js +1 -1
- package/dist/scripts/research-complete-package-fixture-check.js +1 -1
- package/dist/scripts/research-execution-profile-routing-check.js +2 -2
- package/dist/scripts/research-final-reviewer-blackbox.js +1 -1
- package/dist/scripts/{sks-3-1-4-directive-check-lib.js → runtime-domain-gate-lib.js} +2 -2
- package/dist/scripts/runtime-proof-summary-check.js +1 -1
- package/dist/scripts/runtime-script-pack-closure-check.js +7 -1
- package/dist/scripts/scheduler-batch-dispatch-check.js +1 -1
- package/dist/scripts/scheduler-parallel-proof-consistency-check.js +1 -1
- package/dist/scripts/scheduler-utilization-integral-check.js +1 -1
- package/dist/scripts/search-visibility-gate-lib.js +1 -1
- package/dist/scripts/secret-preservation-check.js +1 -1
- package/dist/scripts/seo-geo-geo-disambiguation-check.js +1 -1
- package/dist/scripts/seo-geo-skill-rich-content-check.js +1 -1
- package/dist/scripts/side-effect-runtime-report-check.js +1 -1
- package/dist/scripts/{sks-3-1-8-check-lib.js → skill-fixture-check-lib.js} +1 -1
- package/dist/scripts/skill-name-canonicalizer-check.js +1 -1
- package/dist/scripts/skills-manifest-continuity-check.js +1 -1
- package/dist/scripts/sks-uninstall-regression-check.js +1 -1
- package/dist/scripts/sksd-daemon-check.js +1 -1
- package/dist/scripts/super-search-provider-interface-check.js +1 -1
- package/dist/scripts/triwiki-cache-key-check.js +1 -1
- package/dist/scripts/triwiki-proof-bank-blackbox.js +2 -2
- package/dist/scripts/triwiki-proof-bank-check.js +1 -1
- package/dist/scripts/triwiki-proof-card-check.js +1 -1
- package/dist/scripts/type-surface-codex-app-check.js +2 -2
- package/dist/scripts/{sks-3-1-5-directive-check-lib.js → typed-routing-gate-lib.js} +2 -2
- package/dist/scripts/ultra-router-auto-router-check.js +1 -1
- package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +1 -1
- package/dist/scripts/ux-review-patch-diff-recheck-check.js +1 -1
- package/dist/scripts/ux-review-run-wires-imagegen-check.js +9 -2
- package/package.json +5 -7
- package/release-gates.v2.json +66 -11
- package/runtime-required-scripts.json +138 -14
- package/config/bench-baseline.json +0 -7
- package/dist/core/codex-app/sks-menubar.js +0 -1
- package/dist/core/release/release-closure-contract.js +0 -30
- package/dist/core/release/release-closure-helpers.js +0 -293
- package/dist/core/release/release-closure-validation.js +0 -284
- package/dist/core/release/release-closure.js +0 -163
- package/dist/scripts/build-dist.js +0 -124
- package/dist/scripts/build-once-runner-check.js +0 -6
- package/dist/scripts/canonical-test-runner.js +0 -234
- package/dist/scripts/changelog-check.js +0 -45
- package/dist/scripts/check-architecture.js +0 -295
- package/dist/scripts/check-cli-entrypoint.js +0 -41
- package/dist/scripts/check-command-module-budget.js +0 -77
- package/dist/scripts/check-feature-quality.js +0 -51
- package/dist/scripts/check-legacy-free.js +0 -64
- package/dist/scripts/check-pipeline-budget.js +0 -49
- package/dist/scripts/check-pipeline-runtime.js +0 -16
- package/dist/scripts/check-publish-tag.js +0 -56
- package/dist/scripts/check-route-modularity.js +0 -72
- package/dist/scripts/codex-0140-capability-check.js +0 -14
- package/dist/scripts/codex-0140-feature-probes-check.js +0 -23
- package/dist/scripts/codex-permission-profiles-check.js +0 -34
- package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -49
- package/dist/scripts/competitor-scorecard-check.js +0 -24
- package/dist/scripts/core-skill-no-drift-check.js +0 -23
- package/dist/scripts/db-route-materialization-check.js +0 -32
- package/dist/scripts/doctor-context7-mcp-repair-blackbox.js +0 -15
- package/dist/scripts/doctor-fastpath-check.js +0 -25
- package/dist/scripts/doctor-fix-production-blackbox.js +0 -35
- package/dist/scripts/doctor-idempotence-check.js +0 -6
- package/dist/scripts/doctor-ops-semantics-check.js +0 -83
- package/dist/scripts/doctor-startup-config-repair-blackbox.js +0 -18
- package/dist/scripts/doctor-supabase-mcp-repair-blackbox.js +0 -13
- package/dist/scripts/ensure-bin-executable.js +0 -16
- package/dist/scripts/fsx-hotpath-check.js +0 -9
- package/dist/scripts/high-risk-contracts-check.js +0 -183
- package/dist/scripts/hook-latency-quantum-check.js +0 -120
- package/dist/scripts/import-graph-budget-check.js +0 -9
- package/dist/scripts/mcp-tool-naming-parity-check.js +0 -14
- package/dist/scripts/naruto-codex-e2e-check.js +0 -105
- package/dist/scripts/naruto-write-e2e-check.js +0 -31
- package/dist/scripts/native-capability-postcheck-check.js +0 -16
- package/dist/scripts/ops-diagnostics-bundle-check.js +0 -11
- package/dist/scripts/parallel-production-smoke-check.js +0 -20
- package/dist/scripts/perf-budget-check.js +0 -12
- package/dist/scripts/project-skill-dedupe-blackbox.js +0 -62
- package/dist/scripts/release-dag-full-coverage-check.js +0 -98
- package/dist/scripts/release-dist-freshness-check.js +0 -6
- package/dist/scripts/release-file-ownership-check.js +0 -35
- package/dist/scripts/release-gate-script-parity-check.js +0 -148
- package/dist/scripts/release-macos-menubar-proof.js +0 -167
- package/dist/scripts/release-main-push-guard.js +0 -37
- package/dist/scripts/release-main-push-receipt.js +0 -43
- package/dist/scripts/release-metadata-1-19-check.js +0 -257
- package/dist/scripts/release-version-truth-check.js +0 -138
- package/dist/scripts/retention-apply-smoke-check.js +0 -19
- package/dist/scripts/retention-budget-check.js +0 -6
- package/dist/scripts/retention-dry-run-check.js +0 -8
- package/dist/scripts/rollback-recovery-smoke-check.js +0 -70
- package/dist/scripts/route-intent-regression-check.js +0 -42
- package/dist/scripts/runtime-current-terminal-check.js +0 -108
- package/dist/scripts/runtime-dist-parity-check.js +0 -76
- package/dist/scripts/runtime-no-src-mjs-check.js +0 -30
- package/dist/scripts/runtime-ts-rust-boundary-check.js +0 -58
- package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -53
- package/dist/scripts/secret-preservation-guard-check.js +0 -36
- package/dist/scripts/seo-marketing-truthfulness-check.js +0 -98
- package/dist/scripts/seo-metadata-sync-check.js +0 -60
- package/dist/scripts/sizecheck.js +0 -148
- package/dist/scripts/sks-menubar-install-check.js +0 -333
- package/dist/scripts/supabase-secret-preservation-blackbox.js +0 -28
- package/dist/scripts/super-search-live-smoke-check.js +0 -115
- package/dist/scripts/super-search-local-http-smoke-check.js +0 -16
- package/dist/scripts/super-search-offline-contract-check.js +0 -43
- package/dist/scripts/update-fastpath-check.js +0 -28
- package/dist/scripts/update-preserves-supabase-keys-blackbox.js +0 -26
- package/dist/scripts/upgrade-migration-matrix-check.js +0 -351
- package/dist/scripts/write-build-manifest.js +0 -70
- package/dist/scripts/zellij-capability-check.js +0 -13
- package/dist/scripts/zellij-developer-controls-check.js +0 -16
- package/dist/scripts/zellij-doctor-readiness-check.js +0 -49
- package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +0 -19
- package/dist/scripts/zellij-fake-adapter-check.js +0 -31
- package/dist/scripts/zellij-first-slot-down-stack-check.js +0 -20
- package/dist/scripts/zellij-first-slot-down-stack-real-check.js +0 -348
- package/dist/scripts/zellij-homebrew-policy-check.js +0 -3
- package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -21
- package/dist/scripts/zellij-lane-renderer-check.js +0 -78
- package/dist/scripts/zellij-launch-command-truth-check.js +0 -62
- package/dist/scripts/zellij-layout-valid-check.js +0 -120
- package/dist/scripts/zellij-pane-creation-lock-metrics-check.js +0 -10
- package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -78
- package/dist/scripts/zellij-pane-lock-does-not-block-worker-check.js +0 -12
- package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -134
- package/dist/scripts/zellij-qa-app-handoff-status-check.js +0 -7
- package/dist/scripts/zellij-right-column-geometry-proof.js +0 -158
- package/dist/scripts/zellij-right-column-headless-overflow-check.js +0 -20
- package/dist/scripts/zellij-right-column-manager-check.js +0 -24
- package/dist/scripts/zellij-self-heal-check.js +0 -3
- package/dist/scripts/zellij-self-heal-dry-run-check.js +0 -3
- package/dist/scripts/zellij-self-heal-status-contract-check.js +0 -3
- package/dist/scripts/zellij-self-heal-typed-blackbox.js +0 -3
- package/dist/scripts/zellij-slot-column-anchor-check.js +0 -65
- package/dist/scripts/zellij-slot-column-anchor-telemetry-check.js +0 -8
- package/dist/scripts/zellij-slot-only-ui-check.js +0 -29
- package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -149
- package/dist/scripts/zellij-slot-pane-stale-detection-check.js +0 -65
- package/dist/scripts/zellij-slot-pane-telemetry-renderer-check.js +0 -11
- package/dist/scripts/zellij-slot-renderer-proof-semantics-check.js +0 -58
- package/dist/scripts/zellij-slot-telemetry-check.js +0 -38
- package/dist/scripts/zellij-slot-telemetry-incremental-check.js +0 -46
- package/dist/scripts/zellij-slot-telemetry-live-flush-check.js +0 -55
- package/dist/scripts/zellij-slot-telemetry-performance-check.js +0 -32
- package/dist/scripts/zellij-slot-telemetry-real-blackbox.js +0 -19
- package/dist/scripts/zellij-slot-telemetry-renderer-check.js +0 -11
- package/dist/scripts/zellij-slot-telemetry-runtime-check.js +0 -23
- package/dist/scripts/zellij-spawn-on-demand-layout-check.js +0 -45
- package/dist/scripts/zellij-stacked-capability-routing-check.js +0 -9
- package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -78
- package/dist/scripts/zellij-stacked-version-matrix-check.js +0 -29
- package/dist/scripts/zellij-stacked-version-parser-check.js +0 -19
- package/dist/scripts/zellij-ui-design-check.js +0 -92
- package/dist/scripts/zellij-update-missing-self-heal-check.js +0 -3
- package/dist/scripts/zellij-update-prompt-matrix-check.js +0 -16
- package/dist/scripts/zellij-update-prompt-mode-check.js +0 -18
- package/dist/scripts/zellij-update-prompt-safety-check.js +0 -8
- package/dist/scripts/zellij-worker-pane-manager-check.js +0 -108
- package/dist/scripts/zellij-worker-pane-manager-single-owner-check.js +0 -47
- package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -199
- /package/dist/scripts/{sks-1-11-gate-lib.js → sks-cli-gate-lib.js} +0 -0
|
@@ -5,8 +5,10 @@ import { createMission, getOrCreateSessionMission, missionDir, sessionStateKey,
|
|
|
5
5
|
import { buildQuestionSchemaForRoute, buildRequestIntake, REQUEST_INTAKE_ARTIFACT, writeQuestions } from '../questions.js';
|
|
6
6
|
import { sealContract } from '../decision-contract.js';
|
|
7
7
|
import { scanDbSafety } from '../db-safety.js';
|
|
8
|
+
import { createDbAccessReviewSeed, createDbReviewSeed, DB_ACCESS_CANDIDATES_ARTIFACT, DB_ACCESS_REVIEW_ARTIFACT, DB_MANUAL_MIGRATION_ARTIFACT, DB_REVIEW_ARTIFACT, scanDbAccessCandidates } from '../db-review.js';
|
|
9
|
+
import { createEngineeringSanityReviewSeed, ENGINEERING_SANITY_CODE_STRUCTURE_REPORT, ENGINEERING_SANITY_REVIEW_ARTIFACT } from '../engineering-sanity-review.js';
|
|
8
10
|
import { createAndWriteWorkOrderLedgerForPrompt } from '../work-order-ledger.js';
|
|
9
|
-
import { writeCodeStructureReport } from '../code-structure.js';
|
|
11
|
+
import { resolveChangedScopeBase, writeCodeStructureReport } from '../code-structure.js';
|
|
10
12
|
import { writeMemorySweepReport } from '../memory-governor.js';
|
|
11
13
|
import { writeMistakeMemoryReport } from '../mistake-memory.js';
|
|
12
14
|
import { MISTAKE_RECALL_ARTIFACT, mistakeRecallGateStatus } from '../mistake-recall.js';
|
|
@@ -25,8 +27,8 @@ import { prepareMadSksSqlPlaneMission } from '../mad-sks/sql-plane/coordinator.j
|
|
|
25
27
|
import { MAD_SKS_SQL_PLANE_CAPABILITY_FILE, madSksSqlPlaneRelativePath } from '../mad-sks/sql-plane/paths.js';
|
|
26
28
|
import { OFFICIAL_SUBAGENT_EXECUTION_STAGE_ID } from '../agents/agent-schema.js';
|
|
27
29
|
import { normalizeOfficialSubagentPolicy, officialSubagentPipelineStage } from '../agents/agent-plan.js';
|
|
28
|
-
import { CODEX_APP_IMAGE_GENERATION_DOC_URL, CODEX_COMPUTER_USE_EVIDENCE_SOURCE, CODEX_COMPUTER_USE_ONLY_POLICY, CODEX_IMAGEGEN_REQUIRED_POLICY, CODEX_WEB_VERIFICATION_POLICY, FROM_CHAT_IMG_CHECKLIST_ARTIFACT, FROM_CHAT_IMG_COVERAGE_ARTIFACT, FROM_CHAT_IMG_QA_LOOP_ARTIFACT, FROM_CHAT_IMG_TEMP_TRIWIKI_ARTIFACT, FROM_CHAT_IMG_TEMP_TRIWIKI_SESSIONS, chatCaptureIntakeText, context7RequirementText, dollarCommand, evidenceMentionsForbiddenBrowserAutomation, explicitManagedSkillNames, hasFromChatImgSignal, hasMadSksSignal, imageUxReviewPipelinePolicyText, managedSkillNamesForPrompt, pptPipelineAllowlistPolicyText, reflectionRequiredForRoute, reasoningInstruction, routeNeedsContext7, routePrompt, routeReasoning, routeRequiresSubagents, stripDollarCommand, stripMadSksSignal, stripVisibleDecisionAnswerBlocks, subagentExecutionPolicyText, stackCurrentDocsPolicyText, triwikiContextTracking } from '../routes.js';
|
|
29
|
-
import { coreEngineeringDirectiveReferenceText } from '../lean-engineering-policy.js';
|
|
30
|
+
import { CODEX_APP_IMAGE_GENERATION_DOC_URL, CODEX_COMPUTER_USE_EVIDENCE_SOURCE, CODEX_COMPUTER_USE_ONLY_POLICY, CODEX_IMAGEGEN_REQUIRED_POLICY, CODEX_WEB_VERIFICATION_POLICY, FROM_CHAT_IMG_CHECKLIST_ARTIFACT, FROM_CHAT_IMG_COVERAGE_ARTIFACT, FROM_CHAT_IMG_QA_LOOP_ARTIFACT, FROM_CHAT_IMG_TEMP_TRIWIKI_ARTIFACT, FROM_CHAT_IMG_TEMP_TRIWIKI_SESSIONS, chatCaptureIntakeText, context7RequirementText, dollarCommand, evidenceMentionsForbiddenBrowserAutomation, explicitManagedSkillNames, hasFromChatImgSignal, hasMadSksSignal, imageUxReviewPipelinePolicyText, looksLikeCodeChangingWork, managedSkillNamesForPrompt, pptPipelineAllowlistPolicyText, reflectionRequiredForRoute, reasoningInstruction, routeNeedsContext7, routePrompt, routeReasoning, routeRequiresSubagents, stripDollarCommand, stripMadSksSignal, stripVisibleDecisionAnswerBlocks, subagentExecutionPolicyText, stackCurrentDocsPolicyText, triwikiContextTracking } from '../routes.js';
|
|
31
|
+
import { coreEngineeringDirectiveReferenceText, engineeringSanityPolicyText } from '../lean-engineering-policy.js';
|
|
30
32
|
import { classifyTaskProfile, gateProfileForTask } from '../runtime/task-profile.js';
|
|
31
33
|
import { chooseVerificationBudget } from '../runtime/verification-budget.js';
|
|
32
34
|
import { NARUTO_PARENT_MODEL } from '../subagents/model-policy.js';
|
|
@@ -77,6 +79,7 @@ const STAGE_BLOCKING_GATE = Object.freeze({
|
|
|
77
79
|
parent_integration: 'ownership',
|
|
78
80
|
route_materialization: 'ownership',
|
|
79
81
|
work_order_coverage: 'ownership',
|
|
82
|
+
engineering_sanity_check: 'verification',
|
|
80
83
|
listed_verification: 'verification',
|
|
81
84
|
triwiki_validate_before_final: 'verification',
|
|
82
85
|
completion_proof: 'verification',
|
|
@@ -121,7 +124,7 @@ export function buildPipelinePlan(input = {}) {
|
|
|
121
124
|
changedFiles: Array.isArray(input.changedFiles) ? input.changedFiles : []
|
|
122
125
|
});
|
|
123
126
|
const stages = buildPipelineStages(route, task, taskProfile, gateProfile, ambiguity, lane, Boolean(input.required), officialSubagentPolicy);
|
|
124
|
-
const verification = planVerification(route, proof, verificationBudget);
|
|
127
|
+
const verification = planVerification(route, task, proof, verificationBudget);
|
|
125
128
|
const skipped = stages.filter((stage) => stage.status === 'skipped').map((stage) => stage.id);
|
|
126
129
|
const kept = stages.filter((stage) => stage.status !== 'skipped' && stage.status !== 'not_applicable').map((stage) => stage.id);
|
|
127
130
|
const routeEconomy = routeEconomyPlan(proof);
|
|
@@ -175,6 +178,7 @@ export function buildPipelinePlan(input = {}) {
|
|
|
175
178
|
kept_stages: kept,
|
|
176
179
|
verification_budget: verificationBudget,
|
|
177
180
|
verification,
|
|
181
|
+
engineering_sanity_review: null,
|
|
178
182
|
invariants,
|
|
179
183
|
proof_field: proof,
|
|
180
184
|
ssot_guard: buildSsotGuard({ route: route?.id || 'SKS', mode: route?.mode || 'SKS', task }),
|
|
@@ -204,9 +208,42 @@ export async function writePipelinePlan(dir, input = {}) {
|
|
|
204
208
|
}
|
|
205
209
|
const requestIntake = input.requestIntake || await writeRequestIntakeArtifact(dir, input);
|
|
206
210
|
const plan = buildPipelinePlan({ ...input, taskProfile, requestIntake });
|
|
211
|
+
const root = input.root || rootFromMissionDir(dir);
|
|
212
|
+
if (planStagesEngineeringSanityReview(plan)) {
|
|
213
|
+
plan.engineering_sanity_review = {
|
|
214
|
+
artifact: ENGINEERING_SANITY_REVIEW_ARTIFACT,
|
|
215
|
+
code_structure_report: ENGINEERING_SANITY_CODE_STRUCTURE_REPORT,
|
|
216
|
+
changed_scope_base: resolveChangedScopeBase(root)
|
|
217
|
+
};
|
|
218
|
+
}
|
|
207
219
|
await writeJsonAtomic(path.join(dir, PIPELINE_PLAN_ARTIFACT), plan);
|
|
220
|
+
if (plan.engineering_sanity_review) {
|
|
221
|
+
const report = await writeCodeStructureReport(root, dir, {
|
|
222
|
+
missionId: input.missionId || null,
|
|
223
|
+
changedSince: plan.engineering_sanity_review.changed_scope_base,
|
|
224
|
+
includeOk: true
|
|
225
|
+
});
|
|
226
|
+
const reportText = await readText(path.join(dir, ENGINEERING_SANITY_CODE_STRUCTURE_REPORT), '');
|
|
227
|
+
const reviewFile = path.join(dir, ENGINEERING_SANITY_REVIEW_ARTIFACT);
|
|
228
|
+
if (!(await exists(reviewFile))) {
|
|
229
|
+
await writeJsonAtomic(reviewFile, createEngineeringSanityReviewSeed(plan.route?.command || plan.route?.id || null, report, reportText));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
208
232
|
return plan;
|
|
209
233
|
}
|
|
234
|
+
function planStagesEngineeringSanityReview(plan) {
|
|
235
|
+
return Array.isArray(plan?.stages) && plan.stages.some((stage) => (String(stage?.id || '') === 'engineering_sanity_check'
|
|
236
|
+
&& !['skipped', 'not_applicable'].includes(String(stage?.status || ''))));
|
|
237
|
+
}
|
|
238
|
+
export function pipelinePlanState(plan) {
|
|
239
|
+
const sanity = plan?.engineering_sanity_review || null;
|
|
240
|
+
return {
|
|
241
|
+
pipeline_plan_ready: validatePipelinePlan(plan).ok,
|
|
242
|
+
pipeline_plan_path: PIPELINE_PLAN_ARTIFACT,
|
|
243
|
+
engineering_sanity_required: Boolean(sanity),
|
|
244
|
+
engineering_sanity_scope_base: sanity?.changed_scope_base || null
|
|
245
|
+
};
|
|
246
|
+
}
|
|
210
247
|
export async function writeRequestIntakeArtifact(dir, input = {}) {
|
|
211
248
|
const file = path.join(dir, REQUEST_INTAKE_ARTIFACT);
|
|
212
249
|
if (!input.requestIntake && !input.forceRequestIntakeRewrite) {
|
|
@@ -488,6 +525,8 @@ function buildPipelineStages(route, task, taskProfile, gateProfile, ambiguity, l
|
|
|
488
525
|
if ((gateProfile === 'scoped' || gateProfile === 'full') && !LIGHTWEIGHT_ROUTES.has(route?.id)) {
|
|
489
526
|
ids.push('triwiki_use_first', 'triwiki_validate_before_final', 'mistake_recall', 'work_order_coverage');
|
|
490
527
|
}
|
|
528
|
+
if (routeNeedsEngineeringSanityReview(route, task))
|
|
529
|
+
ids.push('engineering_sanity_check');
|
|
491
530
|
if (routeRequiresSubagents(route, task, taskProfile))
|
|
492
531
|
ids.push('subagent_plan', 'official_subagent_execution', 'parent_integration');
|
|
493
532
|
if (specializedRoute)
|
|
@@ -505,6 +544,22 @@ function buildPipelineStages(route, task, taskProfile, gateProfile, ambiguity, l
|
|
|
505
544
|
const metadata = { blocking, blocking_gate: blocking ? blockingGate : null };
|
|
506
545
|
if (id === OFFICIAL_SUBAGENT_EXECUTION_STAGE_ID)
|
|
507
546
|
return { ...officialSubagentPipelineStage(officialSubagentPolicy), status: 'required', reason: officialSubagentPolicy.reason, ...metadata };
|
|
547
|
+
if (id === 'engineering_sanity_check') {
|
|
548
|
+
return {
|
|
549
|
+
id,
|
|
550
|
+
status: 'keep',
|
|
551
|
+
reason: 'required_for_code_and_database_quality',
|
|
552
|
+
checks: [
|
|
553
|
+
'trace actual callers and preserve basic SOLID responsibility and dependency boundaries',
|
|
554
|
+
'inspect loops, collections, resolvers, and serializers for N+1 or repeated I/O',
|
|
555
|
+
'prove render, recursion, event, retry, and polling loops are bounded and cancellable',
|
|
556
|
+
'reject disabled checks, swallowed errors, placeholder success, and verification bypasses',
|
|
557
|
+
'for DB work, verify the existing canonical adapter and connection/pool lifecycle before changes',
|
|
558
|
+
'for sensitive or multi-step DB work, verify transaction rollback, error propagation, idempotency, and post-commit invariants'
|
|
559
|
+
],
|
|
560
|
+
...metadata
|
|
561
|
+
};
|
|
562
|
+
}
|
|
508
563
|
if (id === 'ambiguity_gate' && ambiguity?.required === false)
|
|
509
564
|
return { id, status: 'not_applicable', reason: 'ambiguity_gate_not_required_for_entrypoint', ...metadata };
|
|
510
565
|
if (id === 'ambiguity_gate' && ambiguity?.passed)
|
|
@@ -512,7 +567,7 @@ function buildPipelineStages(route, task, taskProfile, gateProfile, ambiguity, l
|
|
|
512
567
|
return { id, status: 'keep', reason: lane.fast_lane_allowed ? 'task_profile_minimal_lane' : 'required_by_task_and_route_profile', ...metadata };
|
|
513
568
|
});
|
|
514
569
|
}
|
|
515
|
-
function planVerification(route, proof, budget) {
|
|
570
|
+
function planVerification(route, task, proof, budget) {
|
|
516
571
|
if (budget === 'none')
|
|
517
572
|
return [];
|
|
518
573
|
const out = new Set(proof.verification || []);
|
|
@@ -530,12 +585,20 @@ function planVerification(route, proof, budget) {
|
|
|
530
585
|
}
|
|
531
586
|
if (route?.id === 'Naruto')
|
|
532
587
|
out.add('validate official subagent evidence and the parent integration summary');
|
|
588
|
+
if (routeNeedsEngineeringSanityReview(route, task)) {
|
|
589
|
+
out.add('complete the engineering sanity review for SOLID boundaries, N+1/repeated I/O, bounded loops, and verification bypasses');
|
|
590
|
+
}
|
|
591
|
+
if (route?.id === 'DB' || route?.id === 'MadSKS') {
|
|
592
|
+
out.add('verify existing canonical DB access, pool lifecycle, and transaction integrity for sensitive or multi-step mutations');
|
|
593
|
+
}
|
|
533
594
|
if (reflectionRequiredForRoute(route))
|
|
534
595
|
out.add('sks wiki validate .sneakoscope/wiki/context-pack.json');
|
|
535
596
|
return [...out];
|
|
536
597
|
}
|
|
537
598
|
function pipelineInvariants(input) {
|
|
538
599
|
const out = ['no_unrequested_fallback_code'];
|
|
600
|
+
if (input.stages.some((stage) => stage.id === 'engineering_sanity_check'))
|
|
601
|
+
out.push('engineering_sanity_check');
|
|
539
602
|
if (input.verificationBudget !== 'none')
|
|
540
603
|
out.push('listed_verification');
|
|
541
604
|
if (input.stages.some((stage) => stage.id === 'ssot_guard' && stage.status !== 'not_applicable'))
|
|
@@ -586,6 +649,7 @@ export function promptPipelineContext(prompt, route = null) {
|
|
|
586
649
|
reasoningInstruction(reasoning),
|
|
587
650
|
responseLanguageInstruction(cleanPrompt),
|
|
588
651
|
coreEngineeringDirectiveReferenceText(),
|
|
652
|
+
engineeringSanityPolicyText(),
|
|
589
653
|
'Load only the selected route skills and route-specific instructions; do not inject unrelated route policy.',
|
|
590
654
|
'Codex native /goal is the only persisted goal owner. Goal persistence must not replace or skip the selected route gates.',
|
|
591
655
|
`When a mission exists, read ${REQUEST_INTAKE_ARTIFACT} as a structured projection of the current request. Preserve the literal request and current code as authority; never let generic intake heuristics replace an explicit requirement.`,
|
|
@@ -622,6 +686,7 @@ export function dfixQuickContext(prompt, route = routePrompt(prompt)) {
|
|
|
622
686
|
return [
|
|
623
687
|
`DFix ultralight pipeline active. Route: ${routeLabel} (Direct Fix: tiny copy/config/docs/labels/spacing/translation/simple mechanical edits).`,
|
|
624
688
|
responseLanguageInstruction(task),
|
|
689
|
+
engineeringSanityPolicyText(),
|
|
625
690
|
'Bypass: do not enter the general SKS prompt pipeline, mission creation, ambiguity gate, TriWiki refresh, Context7 routing, native-session orchestration, Goal, Research, eval, or broad planning.',
|
|
626
691
|
`Task: ${task}`,
|
|
627
692
|
'Task list:',
|
|
@@ -702,6 +767,20 @@ export async function prepareRoute(root, prompt, state = {}, opts = {}) {
|
|
|
702
767
|
return finish(await prepareImageUxReview(root, route, task, required, { sessionKey }));
|
|
703
768
|
if (route.id === 'MadSKS')
|
|
704
769
|
return finish(await prepareMadSksSqlPlane(root, route, task, required, { sessionKey }));
|
|
770
|
+
if (route.id === 'DB' && madSksAuthorization) {
|
|
771
|
+
const madRouteBase = routePrompt('$MAD-SKS');
|
|
772
|
+
if (!madRouteBase)
|
|
773
|
+
throw new Error('mad_sks_route_missing');
|
|
774
|
+
const madRoute = {
|
|
775
|
+
...madRouteBase,
|
|
776
|
+
requiredSkills: Array.from(new Set([
|
|
777
|
+
...(route.requiredSkills || []),
|
|
778
|
+
...(madRouteBase.requiredSkills || [])
|
|
779
|
+
]))
|
|
780
|
+
};
|
|
781
|
+
const prepared = await prepareMadSksSqlPlane(root, madRoute, task, routeNeedsContext7(madRoute, cleanPrompt), { sessionKey });
|
|
782
|
+
return withSkillDreamContext(prepared, dreamContext);
|
|
783
|
+
}
|
|
705
784
|
if (QUESTION_GATE_ROUTES.has(route.id))
|
|
706
785
|
return finish(await prepareClarificationGate(root, route, task, required, { madSksAuthorization, sessionKey }));
|
|
707
786
|
if (route.id === 'Naruto' && subagentsRequired)
|
|
@@ -857,8 +936,7 @@ async function prepareImageUxReview(root, route, task, required, opts = {}) {
|
|
|
857
936
|
stop_gate: route.stopGate,
|
|
858
937
|
image_ux_review_gate_ready: true,
|
|
859
938
|
image_ux_review_policy_ready: true,
|
|
860
|
-
|
|
861
|
-
pipeline_plan_path: PIPELINE_PLAN_ARTIFACT
|
|
939
|
+
...pipelinePlanState(pipelinePlan)
|
|
862
940
|
}), { sessionKey: opts.sessionKey });
|
|
863
941
|
return routeContext(route, id, task, required, `Capture or attach source UI screenshots, run Codex App $imagegen/gpt-image-2 to generate annotated review images, extract those generated images into ${IMAGE_UX_REVIEW_ISSUE_LEDGER_ARTIFACT}, then update ${IMAGE_UX_REVIEW_GATE_ARTIFACT}. ${CODEX_IMAGEGEN_REQUIRED_POLICY} Initial gate blockers: ${(artifacts.gate.blockers || []).join(', ') || 'none'}.`);
|
|
864
942
|
}
|
|
@@ -962,8 +1040,7 @@ async function prepareClarificationGate(root, route, task, required, opts = {})
|
|
|
962
1040
|
clarification_passed: result.ok,
|
|
963
1041
|
ambiguity_gate_required: true,
|
|
964
1042
|
ambiguity_gate_passed: result.ok,
|
|
965
|
-
|
|
966
|
-
pipeline_plan_path: PIPELINE_PLAN_ARTIFACT,
|
|
1043
|
+
...pipelinePlanState(plan),
|
|
967
1044
|
original_stop_gate: route.stopGate,
|
|
968
1045
|
stop_gate: route.stopGate,
|
|
969
1046
|
...(materialized.state || {})
|
|
@@ -1108,7 +1185,7 @@ async function prepareResearch(root, route, task, required, opts = {}) {
|
|
|
1108
1185
|
const { id, dir } = await createMission(root, { mode: 'research', prompt: task, sessionKey: opts.sessionKey });
|
|
1109
1186
|
const researchPlan = await writeResearchPlan(dir, task, {});
|
|
1110
1187
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'direct_route' } });
|
|
1111
|
-
await setCurrent(root, routeState(id, route, 'RESEARCH_PREPARED', required, { prompt: task,
|
|
1188
|
+
await setCurrent(root, routeState(id, route, 'RESEARCH_PREPARED', required, { prompt: task, ...pipelinePlanState(pipelinePlan) }), { sessionKey: opts.sessionKey });
|
|
1112
1189
|
return routeContext(route, id, task, required, `Run sks research run latest as a real long-running source-gathering pass, never an automatic mock fallback; do not modify repository source code. Run layered Super Search first and allow only correlated verified-content rows to support real claims. Then run exactly three independent official research_reviewer threads on GPT-5.6 Sol Max. Any objection requires a mission-local research_synthesizer revision and a fresh three-thread review cycle; do not launch a custom scheduler or debate pool. Keep subagent-plan.json, subagent-events.jsonl, subagent-parent-summary.json, and subagent-evidence.json current, write research-report.md and ${researchPaperArtifactForPlan(researchPlan)}, and pass the adversarial convergence, Honest Mode, and research-gate.json checks.`);
|
|
1113
1190
|
}
|
|
1114
1191
|
async function prepareAutoResearch(root, route, task, required, opts = {}) {
|
|
@@ -1117,21 +1194,35 @@ async function prepareAutoResearch(root, route, task, required, opts = {}) {
|
|
|
1117
1194
|
await writeJsonAtomic(path.join(dir, 'experiment-ledger.json'), { schema_version: 1, entries: [] });
|
|
1118
1195
|
await writeJsonAtomic(path.join(dir, 'autoresearch-gate.json'), { passed: false, experiment_ledger_present: true, metric_present: false, keep_or_discard_decision: false, falsification_present: false, honest_conclusion: false, context7_evidence: false });
|
|
1119
1196
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'direct_route' } });
|
|
1120
|
-
await setCurrent(root, routeState(id, route, 'AUTORESEARCH_EXPERIMENT_LOOP', required, { prompt: task,
|
|
1197
|
+
await setCurrent(root, routeState(id, route, 'AUTORESEARCH_EXPERIMENT_LOOP', required, { prompt: task, ...pipelinePlanState(pipelinePlan) }), { sessionKey: opts.sessionKey });
|
|
1121
1198
|
return routeContext(route, id, task, required, 'Run the smallest useful experiment loop, update experiment-ledger.json, falsify the result, and pass autoresearch-gate.json.');
|
|
1122
1199
|
}
|
|
1123
1200
|
async function prepareDb(root, route, task, required, opts = {}) {
|
|
1124
1201
|
const { id, dir } = await createMission(root, { mode: 'db', prompt: task, sessionKey: opts.sessionKey });
|
|
1125
|
-
const scan = await
|
|
1202
|
+
const [scan, accessCandidates] = await Promise.all([
|
|
1203
|
+
scanDbSafety(root, { includeMigrations: true }).catch((err) => ({ ok: false, findings: [{ id: 'db_scan_failed', severity: 'high', reason: err.message }] })),
|
|
1204
|
+
scanDbAccessCandidates(root)
|
|
1205
|
+
]);
|
|
1126
1206
|
await writeJsonAtomic(path.join(dir, 'db-safety-scan.json'), scan);
|
|
1127
|
-
await writeJsonAtomic(path.join(dir,
|
|
1207
|
+
await writeJsonAtomic(path.join(dir, DB_ACCESS_CANDIDATES_ARTIFACT), accessCandidates);
|
|
1208
|
+
await writeJsonAtomic(path.join(dir, DB_REVIEW_ARTIFACT), createDbReviewSeed(scan.ok));
|
|
1209
|
+
await writeJsonAtomic(path.join(dir, DB_ACCESS_REVIEW_ARTIFACT), createDbAccessReviewSeed(accessCandidates));
|
|
1128
1210
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'direct_route' } });
|
|
1129
|
-
await setCurrent(root, routeState(id, route, 'DB_REVIEW_REQUIRED', required, {
|
|
1130
|
-
|
|
1211
|
+
await setCurrent(root, routeState(id, route, 'DB_REVIEW_REQUIRED', required, {
|
|
1212
|
+
prompt: task,
|
|
1213
|
+
db_access_review_required: true,
|
|
1214
|
+
...pipelinePlanState(pipelinePlan)
|
|
1215
|
+
}), { sessionKey: opts.sessionKey });
|
|
1216
|
+
return routeContext(route, id, task, required, `Inspect the real DB entry points and callers first, then complete ${DB_ACCESS_REVIEW_ARTIFACT} for canonical adapter/query-helper reuse, pool ownership/acquire/release/shutdown/exhaustion, N+1/repeated I/O, and sensitive transaction integrity. Outside MAD-SKS, do not mutate any database: when a migration is required, finish with exactly one mission-local ${DB_MANUAL_MIGRATION_ARTIFACT} containing active forward SQL and a complete rollback section that remains commented out, record its SHA-256 and manual-apply notice in ${DB_REVIEW_ARTIFACT}, and tell the user to apply it directly. Only an active capability-v2 MAD-SKS SQL-plane may execute through MCP, with independent read-back and final read-only restoration.`);
|
|
1131
1217
|
}
|
|
1132
1218
|
async function prepareMadSksSqlPlane(root, route, task, required, opts = {}) {
|
|
1133
1219
|
const prepared = await prepareMadSksSqlPlaneMission({ root, task, verifyTools: false, sessionKey: opts.sessionKey, route: 'MadSKS', routeCommand: '$MAD-SKS' });
|
|
1134
1220
|
const dir = missionDir(root, prepared.mission_id);
|
|
1221
|
+
const accessCandidates = await scanDbAccessCandidates(root);
|
|
1222
|
+
await writeJsonAtomic(path.join(dir, DB_ACCESS_CANDIDATES_ARTIFACT), accessCandidates);
|
|
1223
|
+
if (!(await exists(path.join(dir, DB_ACCESS_REVIEW_ARTIFACT)))) {
|
|
1224
|
+
await writeJsonAtomic(path.join(dir, DB_ACCESS_REVIEW_ARTIFACT), createDbAccessReviewSeed(accessCandidates));
|
|
1225
|
+
}
|
|
1135
1226
|
const pipelinePlan = await writePipelinePlan(dir, {
|
|
1136
1227
|
missionId: prepared.mission_id,
|
|
1137
1228
|
route,
|
|
@@ -1159,24 +1250,24 @@ async function prepareMadSksSqlPlane(root, route, task, required, opts = {}) {
|
|
|
1159
1250
|
mad_sks_sql_plane_capability_mission_id: prepared.mission_id,
|
|
1160
1251
|
mad_sks_sql_plane_capability_file: madSksSqlPlaneRelativePath(MAD_SKS_SQL_PLANE_CAPABILITY_FILE),
|
|
1161
1252
|
mad_sks_gate_file: 'mad-sks-gate.json',
|
|
1253
|
+
db_access_review_required: true,
|
|
1162
1254
|
stop_gate: 'mad-sks-gate.json',
|
|
1163
|
-
|
|
1164
|
-
pipeline_plan_path: PIPELINE_PLAN_ARTIFACT
|
|
1255
|
+
...pipelinePlanState(pipelinePlan)
|
|
1165
1256
|
}), { sessionKey: opts.sessionKey });
|
|
1166
|
-
return routeContext(route, prepared.mission_id, task, required, `MAD-SKS SQL-plane mission/capability/profile were created atomically for cycle ${prepared.cycle_id}.
|
|
1257
|
+
return routeContext(route, prepared.mission_id, task, required, `MAD-SKS SQL-plane mission/capability/profile were created atomically for cycle ${prepared.cycle_id}. Inspect the existing canonical DB access and complete ${DB_ACCESS_REVIEW_ARTIFACT} before mutation. Then verify Supabase MCP tool inventory exposes execute_sql and apply_migration, execute the requested SQL immediately through the bound MCP SQL-plane rather than generating a manual migration file, independently read back the postconditions, and finally close the profile/capability and prove normal read-only restoration.`);
|
|
1167
1258
|
}
|
|
1168
1259
|
async function prepareGx(root, route, task, required, opts = {}) {
|
|
1169
1260
|
const { id, dir } = await createMission(root, { mode: 'gx', prompt: task, sessionKey: opts.sessionKey });
|
|
1170
1261
|
await writeJsonAtomic(path.join(dir, 'gx-gate.json'), { passed: false, vgraph_beta_render: false, validation: false, drift_snapshot: false, context7_evidence: false });
|
|
1171
1262
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'direct_route' } });
|
|
1172
|
-
await setCurrent(root, routeState(id, route, 'GX_VALIDATE_REQUIRED', required, { prompt: task,
|
|
1263
|
+
await setCurrent(root, routeState(id, route, 'GX_VALIDATE_REQUIRED', required, { prompt: task, ...pipelinePlanState(pipelinePlan) }), { sessionKey: opts.sessionKey });
|
|
1173
1264
|
return routeContext(route, id, task, required, 'Run sks gx init/render/validate/drift/snapshot, then pass gx-gate.json.');
|
|
1174
1265
|
}
|
|
1175
1266
|
async function prepareLightRoute(root, route, task, required, opts = {}) {
|
|
1176
1267
|
const { id, dir } = await createMission(root, { mode: route.id.toLowerCase(), prompt: task, sessionKey: opts.sessionKey });
|
|
1177
1268
|
await writeJsonAtomic(path.join(dir, 'route-context.json'), { route: route.id, command: route.command, task, required_skills: route.requiredSkills, context7_required: required, context_tracking: triwikiContextTracking(), stop_gate: 'honest_mode' });
|
|
1178
1269
|
const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task, required, ambiguity: { required: false, status: 'light_route' } });
|
|
1179
|
-
await setCurrent(root, routeState(id, route, 'ROUTE_CONTEXT_READY', required, { prompt: task, stop_gate: 'none',
|
|
1270
|
+
await setCurrent(root, routeState(id, route, 'ROUTE_CONTEXT_READY', required, { prompt: task, stop_gate: 'none', ...pipelinePlanState(pipelinePlan) }), { sessionKey: opts.sessionKey });
|
|
1180
1271
|
return routeContext(route, id, task, required, 'Load the route skill context, execute the smallest matching action, and finish with Honest Mode.');
|
|
1181
1272
|
}
|
|
1182
1273
|
async function materializeOfficialSubagentOverlay(root, prepared, route, task, opts = {}) {
|
|
@@ -1339,8 +1430,7 @@ async function prepareNaruto(root, route, task, required, opts = {}) {
|
|
|
1339
1430
|
parent_model_match: parentModelMatch,
|
|
1340
1431
|
from_chat_img_required: fromChatImgRequired,
|
|
1341
1432
|
naruto_gate_file: NARUTO_GATE_FILENAME,
|
|
1342
|
-
|
|
1343
|
-
pipeline_plan_path: PIPELINE_PLAN_ARTIFACT
|
|
1433
|
+
...pipelinePlanState(pipelinePlan)
|
|
1344
1434
|
}), { sessionKey: opts.sessionKey });
|
|
1345
1435
|
return routeContext(route, id, cleanTask, required, `Use the delegation context below in the current Codex parent session. First replace parent_required with a defensible independent/disjoint decomposition, then spawn and wait for every requested agent thread. Record official events and integrate the parent summary before passing ${NARUTO_GATE_FILENAME}.\n\n${delegationPrompt}`);
|
|
1346
1436
|
}
|
|
@@ -1355,7 +1445,15 @@ function requestedSubagentsFromTask(task) {
|
|
|
1355
1445
|
function routeState(id, route, phase, context7Required, extra = {}) {
|
|
1356
1446
|
const reasoning = routeReasoning(route, extra.prompt || '');
|
|
1357
1447
|
const subagentsRequired = routeRequiresSubagents(route, extra.prompt || '');
|
|
1358
|
-
return { mission_id: id, route: route.id, route_command: route.command, mode: route.mode, phase, context7_required: context7Required, context7_verified: false, subagents_required: subagentsRequired, subagents_verified: !subagentsRequired, native_sessions_required: false, native_sessions_verified: false, reflection_required: reflectionRequiredForRoute(route), visible_progress_required: true, context_tracking: 'triwiki', required_skills: route.requiredSkills, stop_gate: route.stopGate, reasoning_effort: reasoning.effort, reasoning_profile: reasoning.profile, reasoning_temporary: true, goal_continuation: ambientGoalContinuation(), ...extra };
|
|
1448
|
+
return { mission_id: id, route: route.id, route_command: route.command, mode: route.mode, phase, context7_required: context7Required, context7_verified: false, subagents_required: subagentsRequired, subagents_verified: !subagentsRequired, native_sessions_required: false, native_sessions_verified: false, reflection_required: reflectionRequiredForRoute(route), engineering_sanity_required: false, engineering_sanity_scope_base: null, visible_progress_required: true, context_tracking: 'triwiki', required_skills: route.requiredSkills, stop_gate: route.stopGate, reasoning_effort: reasoning.effort, reasoning_profile: reasoning.profile, reasoning_temporary: true, goal_continuation: ambientGoalContinuation(), ...extra };
|
|
1449
|
+
}
|
|
1450
|
+
function routeNeedsEngineeringSanityReview(route, task) {
|
|
1451
|
+
const id = String(route?.id || '');
|
|
1452
|
+
if (['DB', 'MadSKS'].includes(id))
|
|
1453
|
+
return true;
|
|
1454
|
+
if (['Answer', 'Help', 'Wiki', 'Goal', 'Research', 'AutoResearch', 'PPT', 'ImageUXReview', 'ComputerUse', 'GX'].includes(id))
|
|
1455
|
+
return false;
|
|
1456
|
+
return looksLikeCodeChangingWork(String(task || ''));
|
|
1359
1457
|
}
|
|
1360
1458
|
function routeContext(route, id, task, required, next) {
|
|
1361
1459
|
const visibleTask = stripVisibleDecisionAnswerBlocks(task);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import
|
|
2
|
+
import fsp from 'node:fs/promises';
|
|
3
|
+
import { appendJsonl, exists, nowIso, readJson, readText, sha256, writeJsonAtomic } from '../fsx.js';
|
|
3
4
|
import { containsUserQuestion, noQuestionContinuationReason } from '../no-question-guard.js';
|
|
4
5
|
import { missionDir, setCurrent } from '../mission.js';
|
|
5
6
|
import { evaluateResearchGate } from '../research.js';
|
|
@@ -14,7 +15,9 @@ import { MISTAKE_RECALL_ARTIFACT, mistakeRecallGateStatus } from '../mistake-rec
|
|
|
14
15
|
import { SSOT_GUARD_ARTIFACT, validateSsotGuardArtifact } from '../safety/ssot-guard.js';
|
|
15
16
|
import { checkStopGate } from '../stop-gate/stop-gate-check.js';
|
|
16
17
|
import { readWorkOrderLedger, evaluateWorkOrderCoverage } from '../work-order-ledger.js';
|
|
17
|
-
import {
|
|
18
|
+
import { DB_ACCESS_REVIEW_ARTIFACT, DB_REVIEW_ARTIFACT, validateDbAccessReviewArtifact, validateDbReview, validateMadSksSqlPlaneCompletion } from '../db-review.js';
|
|
19
|
+
import { ENGINEERING_SANITY_REVIEW_ARTIFACT, validateEngineeringSanityReviewArtifact } from '../engineering-sanity-review.js';
|
|
20
|
+
import { clarificationStopReason, context7Evidence, hasContext7DocsEvidence, hasSubagentEvidence, subagentEvidence, PIPELINE_PLAN_ARTIFACT, } from './runtime-core.js';
|
|
18
21
|
import { projectTriwikiToAgentsMd } from '../triwiki/agents-md-projector.js';
|
|
19
22
|
import { effectiveSubagentTarget, normalizeLegacySubagentCountFields, subagentCountContractBlockers } from '../subagents/wave-lifecycle.js';
|
|
20
23
|
const REFLECTION_ARTIFACT = 'reflection.md';
|
|
@@ -85,6 +88,33 @@ async function workOrderCoverageGateStatus(root, state = {}) {
|
|
|
85
88
|
const coverage = evaluateWorkOrderCoverage(ledger);
|
|
86
89
|
return { ok: coverage.ok, blockers: coverage.blockers };
|
|
87
90
|
}
|
|
91
|
+
async function dbAccessReviewGateStatus(root, state = {}, jsonCache) {
|
|
92
|
+
if (state?.db_access_review_required !== true)
|
|
93
|
+
return { ok: true, blockers: [] };
|
|
94
|
+
const id = state?.mission_id;
|
|
95
|
+
if (!id)
|
|
96
|
+
return { ok: false, blockers: ['mission_id'] };
|
|
97
|
+
const review = await readJsonCached(jsonCache, path.join(missionDir(root, id), DB_ACCESS_REVIEW_ARTIFACT), null);
|
|
98
|
+
return validateDbAccessReviewArtifact(root, id, review);
|
|
99
|
+
}
|
|
100
|
+
async function engineeringSanityGateStatus(root, state = {}, jsonCache) {
|
|
101
|
+
if (state?.engineering_sanity_required !== true)
|
|
102
|
+
return { ok: true, blockers: [] };
|
|
103
|
+
const id = state?.mission_id;
|
|
104
|
+
if (!id)
|
|
105
|
+
return { ok: false, blockers: ['mission_id'] };
|
|
106
|
+
const dir = missionDir(root, id);
|
|
107
|
+
const reviewFile = path.join(dir, ENGINEERING_SANITY_REVIEW_ARTIFACT);
|
|
108
|
+
if (!(await exists(reviewFile))) {
|
|
109
|
+
const plan = await readJsonCached(jsonCache, path.join(dir, PIPELINE_PLAN_ARTIFACT), null);
|
|
110
|
+
if (!plan?.engineering_sanity_review)
|
|
111
|
+
return { ok: true, blockers: [], not_applicable: true };
|
|
112
|
+
}
|
|
113
|
+
const review = await readJsonCached(jsonCache, reviewFile, null);
|
|
114
|
+
return validateEngineeringSanityReviewArtifact(root, id, review, {
|
|
115
|
+
base: typeof state?.engineering_sanity_scope_base === 'string' ? state.engineering_sanity_scope_base : null
|
|
116
|
+
});
|
|
117
|
+
}
|
|
88
118
|
async function staleReflectionReasons(root, state = {}, gate = {}) {
|
|
89
119
|
const created = Date.parse(gate.created_at || gate.updated_at || '');
|
|
90
120
|
if (!Number.isFinite(created))
|
|
@@ -119,6 +149,24 @@ export async function projectGateStatus(root, state = {}) {
|
|
|
119
149
|
source: id ? `.sneakoscope/missions/${id}/questions.md` : null
|
|
120
150
|
});
|
|
121
151
|
}
|
|
152
|
+
if (state?.db_access_review_required === true) {
|
|
153
|
+
const dbAccess = await dbAccessReviewGateStatus(root, state);
|
|
154
|
+
gates.push({
|
|
155
|
+
id: DB_ACCESS_REVIEW_ARTIFACT,
|
|
156
|
+
ok: dbAccess.ok,
|
|
157
|
+
missing: dbAccess.blockers || [],
|
|
158
|
+
source: id ? `.sneakoscope/missions/${id}/${DB_ACCESS_REVIEW_ARTIFACT}` : null
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
if (state?.engineering_sanity_required === true) {
|
|
162
|
+
const sanity = await engineeringSanityGateStatus(root, state);
|
|
163
|
+
gates.push({
|
|
164
|
+
id: ENGINEERING_SANITY_REVIEW_ARTIFACT,
|
|
165
|
+
ok: sanity.ok,
|
|
166
|
+
missing: sanity.blockers || [],
|
|
167
|
+
source: id ? `.sneakoscope/missions/${id}/${ENGINEERING_SANITY_REVIEW_ARTIFACT}` : null
|
|
168
|
+
});
|
|
169
|
+
}
|
|
122
170
|
if (state?.context7_required) {
|
|
123
171
|
const evidence = await context7Evidence(root, state);
|
|
124
172
|
gates.push({
|
|
@@ -200,21 +248,44 @@ export async function evaluateStop(root, state, payload, opts = {}) {
|
|
|
200
248
|
const stopGate = String(state?.stop_gate || '');
|
|
201
249
|
const completionProofRequired = state.proof_required === true || routeRequiresCompletionProof(route);
|
|
202
250
|
const reflectionRequired = reflectionRequiredForState(state);
|
|
203
|
-
if (!opts.noQuestion
|
|
251
|
+
if (!opts.noQuestion
|
|
252
|
+
&& (stopGate === 'none' || stopGate === 'honest_mode')
|
|
253
|
+
&& !state?.context7_required
|
|
254
|
+
&& !state?.subagents_required
|
|
255
|
+
&& !completionProofRequired
|
|
256
|
+
&& !reflectionRequired
|
|
257
|
+
&& state?.engineering_sanity_required !== true
|
|
258
|
+
&& state?.db_access_review_required !== true) {
|
|
204
259
|
return null;
|
|
205
260
|
}
|
|
206
261
|
const activeGatePreview = state?.subagents_required
|
|
207
262
|
? await passedActiveGate(root, state, jsonCache)
|
|
208
263
|
: null;
|
|
209
264
|
const activeGateNotApplicable = activeGatePreview?.not_applicable === true;
|
|
265
|
+
const dbAccessPromise = dbAccessReviewGateStatus(root, state, jsonCache);
|
|
266
|
+
const engineeringSanityPromise = engineeringSanityGateStatus(root, state, jsonCache);
|
|
210
267
|
const context7Promise = state?.context7_required ? hasContext7DocsEvidence(root, state) : Promise.resolve(true);
|
|
211
268
|
const subagentPromise = state?.subagents_required && !activeGateNotApplicable ? hasSubagentEvidence(root, state) : Promise.resolve(true);
|
|
212
269
|
const mistakeRecallPromise = mistakeRecallGateStatus(root, state);
|
|
213
|
-
const [context7Ok, subagentOk, mistakeRecall] = await Promise.all([
|
|
270
|
+
const [dbAccess, engineeringSanity, context7Ok, subagentOk, mistakeRecall] = await Promise.all([
|
|
271
|
+
dbAccessPromise,
|
|
272
|
+
engineeringSanityPromise,
|
|
214
273
|
context7Promise,
|
|
215
274
|
subagentPromise,
|
|
216
275
|
mistakeRecallPromise
|
|
217
276
|
]);
|
|
277
|
+
await resolveRecoveredComplianceBlocker(root, state, {
|
|
278
|
+
[DB_ACCESS_REVIEW_ARTIFACT]: dbAccess.ok,
|
|
279
|
+
[ENGINEERING_SANITY_REVIEW_ARTIFACT]: engineeringSanity.ok,
|
|
280
|
+
'context7-evidence': context7Ok,
|
|
281
|
+
'official-subagent-evidence': subagentOk
|
|
282
|
+
});
|
|
283
|
+
if (!dbAccess.ok) {
|
|
284
|
+
return complianceBlock(root, state, `SKS ${state.route_command || state.mode || 'route'} must verify the existing canonical DB access path before completion. Complete ${DB_ACCESS_REVIEW_ARTIFACT} with actual entry points/callers, canonical adapter or query helper, pool ownership/acquire/release/shutdown/exhaustion evidence, N+1 review, and transaction integrity for sensitive or multi-step mutations. Missing: ${(dbAccess.blockers || []).join(', ')}.`, { gate: DB_ACCESS_REVIEW_ARTIFACT, missing: dbAccess.blockers });
|
|
285
|
+
}
|
|
286
|
+
if (!engineeringSanity.ok) {
|
|
287
|
+
return complianceBlock(root, state, `SKS ${state.route_command || state.mode || 'route'} must complete the engineering sanity review before completion. Static candidates are advisory only; inspect added hunks and real callers for SOLID boundaries, N+1/repeated I/O, bounded render/recursion/event/retry/polling behavior, and verification bypasses. Missing: ${(engineeringSanity.blockers || []).join(', ')}.`, { gate: ENGINEERING_SANITY_REVIEW_ARTIFACT, missing: engineeringSanity.blockers });
|
|
288
|
+
}
|
|
218
289
|
if (state?.context7_required && !context7Ok) {
|
|
219
290
|
return complianceBlock(root, state, `SKS ${state.route_command || state.mode || 'route'} requires Context7 evidence before completion. Use Context7 resolve-library-id, then query-docs, so SKS can record context7-evidence.jsonl.`, { gate: 'context7-evidence' });
|
|
220
291
|
}
|
|
@@ -458,6 +529,95 @@ function normalizeComplianceReason(reason = '') {
|
|
|
458
529
|
.trim()
|
|
459
530
|
.slice(0, 1200);
|
|
460
531
|
}
|
|
532
|
+
async function resolveRecoveredComplianceBlocker(root, state = {}, recovered) {
|
|
533
|
+
if (!state?.mission_id)
|
|
534
|
+
return false;
|
|
535
|
+
const dir = missionDir(root, state.mission_id);
|
|
536
|
+
const blockerFile = path.join(dir, HARD_BLOCKER_ARTIFACT);
|
|
537
|
+
const guardFile = path.join(dir, COMPLIANCE_LOOP_GUARD_ARTIFACT);
|
|
538
|
+
const [blockerText, guardText] = await Promise.all([
|
|
539
|
+
readText(blockerFile, ''),
|
|
540
|
+
readText(guardFile, '')
|
|
541
|
+
]);
|
|
542
|
+
if (!blockerText || !guardText)
|
|
543
|
+
return false;
|
|
544
|
+
let blocker;
|
|
545
|
+
let guard;
|
|
546
|
+
try {
|
|
547
|
+
blocker = JSON.parse(blockerText);
|
|
548
|
+
guard = JSON.parse(guardText);
|
|
549
|
+
}
|
|
550
|
+
catch {
|
|
551
|
+
return false;
|
|
552
|
+
}
|
|
553
|
+
const gate = String(blocker?.gate || guard?.gate || '');
|
|
554
|
+
if (blocker?.schema !== 'sks.hard-blocker.v1'
|
|
555
|
+
|| blocker?.status !== 'hard_blocked'
|
|
556
|
+
|| blocker?.reason !== 'compliance_loop_guard_tripped'
|
|
557
|
+
|| guard?.schema_version !== 1
|
|
558
|
+
|| guard?.mission_id !== state.mission_id
|
|
559
|
+
|| guard?.tripped !== true
|
|
560
|
+
|| guard?.gate !== gate
|
|
561
|
+
|| recovered[gate] !== true)
|
|
562
|
+
return false;
|
|
563
|
+
const artifactName = gate === 'context7-evidence'
|
|
564
|
+
? 'context7-evidence.jsonl'
|
|
565
|
+
: gate === 'official-subagent-evidence'
|
|
566
|
+
? 'subagent-evidence.json'
|
|
567
|
+
: gate;
|
|
568
|
+
if (!artifactName || path.isAbsolute(artifactName) || artifactName.includes('..'))
|
|
569
|
+
return false;
|
|
570
|
+
const artifactFile = path.join(dir, artifactName);
|
|
571
|
+
const artifactStat = await fsp.stat(artifactFile).catch(() => null);
|
|
572
|
+
const blockerAt = Date.parse(String(blocker.created_at || ''));
|
|
573
|
+
const guardAt = Date.parse(String(guard.updated_at || ''));
|
|
574
|
+
if (!artifactStat?.isFile()
|
|
575
|
+
|| !Number.isFinite(blockerAt)
|
|
576
|
+
|| !Number.isFinite(guardAt)
|
|
577
|
+
|| artifactStat.mtimeMs <= Math.max(blockerAt, guardAt))
|
|
578
|
+
return false;
|
|
579
|
+
const blockerSha256 = `sha256:${sha256(blockerText)}`;
|
|
580
|
+
const guardSha256 = `sha256:${sha256(guardText)}`;
|
|
581
|
+
await writeJsonAtomic(path.join(dir, 'hard-blocker.resolved.json'), {
|
|
582
|
+
schema: 'sks.hard-blocker-resolution.v1',
|
|
583
|
+
status: 'resolved',
|
|
584
|
+
passed: true,
|
|
585
|
+
mission_id: state.mission_id,
|
|
586
|
+
resolved_at: nowIso(),
|
|
587
|
+
resolution_reason: `newer_${gate}_evidence_resolved_compliance_loop`,
|
|
588
|
+
hard_blocker_sha256: blockerSha256,
|
|
589
|
+
compliance_loop_guard_sha256: guardSha256,
|
|
590
|
+
recovery_artifact: artifactName,
|
|
591
|
+
recovery_artifact_mtime: artifactStat.mtime.toISOString(),
|
|
592
|
+
original_hard_blocker: blocker,
|
|
593
|
+
original_compliance_loop_guard: guard
|
|
594
|
+
});
|
|
595
|
+
const [currentBlockerText, currentGuardText] = await Promise.all([
|
|
596
|
+
readText(blockerFile, ''),
|
|
597
|
+
readText(guardFile, '')
|
|
598
|
+
]);
|
|
599
|
+
if (currentBlockerText !== blockerText || currentGuardText !== guardText)
|
|
600
|
+
return false;
|
|
601
|
+
await Promise.all([
|
|
602
|
+
fsp.unlink(blockerFile).catch((err) => {
|
|
603
|
+
if (err?.code !== 'ENOENT')
|
|
604
|
+
throw err;
|
|
605
|
+
}),
|
|
606
|
+
fsp.unlink(guardFile).catch((err) => {
|
|
607
|
+
if (err?.code !== 'ENOENT')
|
|
608
|
+
throw err;
|
|
609
|
+
})
|
|
610
|
+
]);
|
|
611
|
+
await appendJsonl(path.join(dir, 'events.jsonl'), {
|
|
612
|
+
ts: nowIso(),
|
|
613
|
+
type: 'pipeline.compliance_loop_guard.resolved',
|
|
614
|
+
gate,
|
|
615
|
+
recovery_artifact: artifactName,
|
|
616
|
+
hard_blocker_sha256: blockerSha256,
|
|
617
|
+
compliance_loop_guard_sha256: guardSha256
|
|
618
|
+
});
|
|
619
|
+
return true;
|
|
620
|
+
}
|
|
461
621
|
function readJsonCached(cache, file, fallback) {
|
|
462
622
|
if (!cache)
|
|
463
623
|
return readJson(file, fallback);
|
|
@@ -571,6 +731,35 @@ function missingRequiredGateFields(file, state, gate = {}) {
|
|
|
571
731
|
}
|
|
572
732
|
async function missingRequiredGateArtifacts(root, file, state, gate = {}) {
|
|
573
733
|
const mode = String(state?.mode || '').toUpperCase();
|
|
734
|
+
if (file === DB_REVIEW_ARTIFACT || mode === 'DB') {
|
|
735
|
+
const evaluated = await validateDbReview(root, String(state.mission_id || ''), gate);
|
|
736
|
+
if (evaluated.ok)
|
|
737
|
+
return [];
|
|
738
|
+
return evaluated.blockers.map((reason) => `${DB_REVIEW_ARTIFACT}:${reason}`);
|
|
739
|
+
}
|
|
740
|
+
if (file === 'mad-sks-gate.json' || mode === 'MADSKS') {
|
|
741
|
+
const evaluated = await validateMadSksSqlPlaneCompletion(root, String(state.mission_id || ''), {
|
|
742
|
+
capability_schema: 'sks.mad-sks-sql-plane-capability.v2',
|
|
743
|
+
result_file: 'mad-sks/sql-plane/result.json',
|
|
744
|
+
cycle_id: gate?.cycle_id || gate?.sql_plane?.cycle_id || null,
|
|
745
|
+
read_back_passed: gate?.sql_plane?.read_back_passed === true,
|
|
746
|
+
capability_closed: gate?.sql_plane?.profile_closed === true,
|
|
747
|
+
read_only_restored: gate?.read_only_restoration?.ok === true
|
|
748
|
+
});
|
|
749
|
+
const missing = [];
|
|
750
|
+
if (gate?.permissions_deactivated !== true)
|
|
751
|
+
missing.push('permissions_deactivated');
|
|
752
|
+
if (gate?.mad_sks_permission_active !== false)
|
|
753
|
+
missing.push('mad_sks_permission_active_false');
|
|
754
|
+
if (gate?.sql_plane?.requested !== true)
|
|
755
|
+
missing.push('sql_plane_requested');
|
|
756
|
+
if (gate?.control_plane_denied !== true)
|
|
757
|
+
missing.push('control_plane_denied');
|
|
758
|
+
if (!Array.isArray(gate?.blockers) || gate.blockers.length > 0)
|
|
759
|
+
missing.push('blockers_empty');
|
|
760
|
+
missing.push(...evaluated.blockers);
|
|
761
|
+
return [...new Set(missing.map((reason) => `mad-sks-gate:${reason}`))];
|
|
762
|
+
}
|
|
574
763
|
if (file === 'research-gate.json' || mode === 'RESEARCH') {
|
|
575
764
|
const evaluated = await evaluateResearchGate(missionDir(root, state.mission_id));
|
|
576
765
|
if (evaluated.passed === true)
|
package/dist/core/pipeline.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { PIPELINE_PLAN_ARTIFACT, PIPELINE_PLAN_SCHEMA_VERSION, routePrompt, buildPipelinePlan, writePipelinePlan, validatePipelinePlan } from './pipeline/pipeline-plan-writer.js';
|
|
1
|
+
export { PIPELINE_PLAN_ARTIFACT, PIPELINE_PLAN_SCHEMA_VERSION, routePrompt, buildPipelinePlan, writePipelinePlan, validatePipelinePlan, pipelinePlanState } from './pipeline/pipeline-plan-writer.js';
|
|
2
2
|
export { promptPipelineContext, dfixQuickContext, answerOnlyContext, computerUseFastContext } from './pipeline/prompt-context.js';
|
|
3
3
|
export { prepareRoute } from './pipeline/route-prep.js';
|
|
4
4
|
export { activeRouteContext } from './pipeline/active-context.js';
|
|
@@ -4,6 +4,7 @@ import { nowIso, readJson } from '../fsx.js';
|
|
|
4
4
|
import { CODEX_APP_IMAGE_GENERATION_DOC_URL, CODEX_IMAGEGEN_REQUIRED_POLICY } from '../routes.js';
|
|
5
5
|
import { sha256File, imageDimensions } from '../wiki-image/image-hash.js';
|
|
6
6
|
import { generateGptImage2CalloutReview } from '../image-ux-review/imagegen-adapter.js';
|
|
7
|
+
import { imagegenEvidenceClassBlockers, isFullImagegenEvidenceClass, isFullImagegenOutputSource } from '../imagegen/imagegen-evidence.js';
|
|
7
8
|
export const PPT_SLIDE_CALLOUT_LEDGER_ARTIFACT = 'ppt-slide-callout-ledger.json';
|
|
8
9
|
export const PPT_SLIDE_IMAGEGEN_REQUEST_ARTIFACT = 'ppt-slide-imagegen-request.json';
|
|
9
10
|
export const PPT_SLIDE_IMAGEGEN_RESPONSE_ARTIFACT = 'ppt-slide-imagegen-response.json';
|
|
@@ -98,9 +99,8 @@ export async function generateSlideCalloutReviews({ root, dir, slideExportLedger
|
|
|
98
99
|
const response = generated.response_artifact ? await readJson(generated.response_artifact, null).catch(() => null) : null;
|
|
99
100
|
const evidenceClass = String(response?.evidence_class || '');
|
|
100
101
|
const fakeGenerated = evidenceClass === 'mock_fixture' || generated.provider === 'fake_imagegen_adapter';
|
|
101
|
-
const codexGenerated = evidenceClass
|
|
102
|
-
|
|
103
|
-
blockers.push(evidenceClass === 'non_codex_api_fallback' ? 'ppt_imagegen_non_codex_api_fallback_not_full_evidence' : fakeGenerated ? 'ppt_imagegen_mock_fixture_not_full_evidence' : 'ppt_imagegen_evidence_class_missing');
|
|
102
|
+
const codexGenerated = isFullImagegenEvidenceClass(evidenceClass);
|
|
103
|
+
blockers.push(...imagegenEvidenceClassBlockers('ppt_imagegen', evidenceClass));
|
|
104
104
|
generatedReviewImages.push({
|
|
105
105
|
...await generatedSlideMetadata(root, generated.generated_image_path, slide, {
|
|
106
106
|
mock: fakeGenerated,
|
|
@@ -189,9 +189,8 @@ export function buildSlideImagegenEvidence(calloutLedger = {}) {
|
|
|
189
189
|
const evidenceClass = String(image.evidence_class || '');
|
|
190
190
|
const outputSource = String(image.output_source || '');
|
|
191
191
|
const outputSha = String(image.output_sha256 || '');
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
if (!['manual_attach', 'auto_discovered_generated_images'].includes(outputSource))
|
|
192
|
+
blockers.push(...imagegenEvidenceClassBlockers('ppt_slide_imagegen', evidenceClass));
|
|
193
|
+
if (!isFullImagegenOutputSource(outputSource))
|
|
195
194
|
blockers.push(`ppt_slide_imagegen_output_source_invalid:${outputSource || 'missing'}`);
|
|
196
195
|
if (!outputSha)
|
|
197
196
|
blockers.push('ppt_slide_imagegen_output_sha256_missing');
|
|
@@ -249,7 +248,8 @@ async function generatedSlideMetadata(root, relPath, slide, opts = {}) {
|
|
|
249
248
|
height: dims.height,
|
|
250
249
|
format: dims.format,
|
|
251
250
|
provider_surface: opts.mock ? 'mock_fixture' : (opts.providerSurface || 'Codex App $imagegen'),
|
|
252
|
-
real_generated: opts.realGenerated === true
|
|
251
|
+
real_generated: opts.realGenerated === true
|
|
252
|
+
&& isFullImagegenEvidenceClass(opts.evidenceClass || (opts.mock ? 'mock_fixture' : 'codex_app_imagegen')),
|
|
253
253
|
mock: opts.mock === true,
|
|
254
254
|
local_only: true
|
|
255
255
|
};
|