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
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import crypto from 'node:crypto';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { spawnSync } from 'node:child_process';
|
|
6
|
-
import { DELETION_COUNTING_SEMANTICS, REQUIRED_ARTIFACTS, SLICE_HASH_SEMANTICS } from './release-closure-contract.js';
|
|
7
|
-
export function attachmentTruth(ledger) {
|
|
8
|
-
const blockers = [];
|
|
9
|
-
const sourcePath = resolveSourcePath(ledger?.source_path);
|
|
10
|
-
const sourceHash = sourcePath ? fileSha256(sourcePath) : null;
|
|
11
|
-
const lines = sourcePath ? readSourceLines(sourcePath) : null;
|
|
12
|
-
if (!sourcePath || !sourceHash || !lines)
|
|
13
|
-
blockers.push('work_order_attachment_file_missing');
|
|
14
|
-
if (sourceHash && sourceHash !== ledger?.source_sha256)
|
|
15
|
-
blockers.push('work_order_attachment_sha_mismatch');
|
|
16
|
-
if (lines && lines.length !== ledger?.source_line_count)
|
|
17
|
-
blockers.push(`work_order_attachment_line_count_mismatch:${lines.length}/${String(ledger?.source_line_count)}`);
|
|
18
|
-
const attachmentItems = (ledger?.items || []).filter((item) => item?.source?.type === 'attachment')
|
|
19
|
-
.sort((a, b) => Number(a?.source?.line_start) - Number(b?.source?.line_start));
|
|
20
|
-
const chatItems = (ledger?.items || []).filter((item) => item?.source?.type === 'chat_text');
|
|
21
|
-
if (attachmentItems.length !== 26)
|
|
22
|
-
blockers.push(`work_order_attachment_range_count_mismatch:${attachmentItems.length}/26`);
|
|
23
|
-
if (chatItems.length !== 2 || chatItems.some((item) => !text(item?.source?.verbatim)))
|
|
24
|
-
blockers.push('work_order_chat_sources_invalid');
|
|
25
|
-
const slices = [];
|
|
26
|
-
let next = 1;
|
|
27
|
-
for (const item of attachmentItems) {
|
|
28
|
-
const start = Number(item?.source?.line_start);
|
|
29
|
-
const end = Number(item?.source?.line_end);
|
|
30
|
-
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start !== next || end < start) {
|
|
31
|
-
blockers.push('work_order_coverage_invalid');
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
const calculated = lines ? sliceSha256(lines, start, end) : null;
|
|
35
|
-
if (!calculated || item?.source?.slice_sha256 !== calculated)
|
|
36
|
-
blockers.push(`work_order_slice_hash_mismatch:${item?.id || 'missing'}`);
|
|
37
|
-
slices.push({ id: item?.id, line_start: start, line_end: end, sha256: calculated });
|
|
38
|
-
next = end + 1;
|
|
39
|
-
}
|
|
40
|
-
if (attachmentItems.length === 26 && lines && next !== lines.length + 1)
|
|
41
|
-
blockers.push('work_order_coverage_incomplete');
|
|
42
|
-
return {
|
|
43
|
-
ok: blockers.length === 0,
|
|
44
|
-
blockers,
|
|
45
|
-
manifest: {
|
|
46
|
-
path: ledger?.source_path || null,
|
|
47
|
-
sha256: sourceHash,
|
|
48
|
-
line_count: lines?.length ?? null,
|
|
49
|
-
slice_hash_semantics: SLICE_HASH_SEMANTICS,
|
|
50
|
-
slices
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export function deletionTruth(root, baseline, head) {
|
|
55
|
-
if (!sha40(baseline) || !sha40(head))
|
|
56
|
-
return { ok: false, modules: [], pureDeletionLines: 0, totalDeletions: 0, pathManifestSha256: '', manifest: null };
|
|
57
|
-
const names = git(root, ['diff', '--find-renames', '--name-only', '--diff-filter=D', baseline, head]);
|
|
58
|
-
const deletedStats = git(root, ['diff', '--find-renames', '--numstat', '--diff-filter=D', baseline, head]);
|
|
59
|
-
const allStats = git(root, ['diff', '--find-renames', '--numstat', baseline, head]);
|
|
60
|
-
const modules = names.stdout.split(/\r?\n/).filter(Boolean).sort();
|
|
61
|
-
const pureDeletionLines = numstatDeletions(deletedStats.stdout);
|
|
62
|
-
const totalDeletions = numstatDeletions(allStats.stdout);
|
|
63
|
-
const pathManifestSha256 = hashText(modules.length ? `${modules.join('\n')}\n` : '');
|
|
64
|
-
const ok = names.ok && deletedStats.ok && allStats.ok;
|
|
65
|
-
return {
|
|
66
|
-
ok,
|
|
67
|
-
modules,
|
|
68
|
-
pureDeletionLines,
|
|
69
|
-
totalDeletions,
|
|
70
|
-
pathManifestSha256,
|
|
71
|
-
manifest: ok ? {
|
|
72
|
-
counting_semantics: DELETION_COUNTING_SEMANTICS,
|
|
73
|
-
removed_file_count: modules.length,
|
|
74
|
-
removed_lines: pureDeletionLines,
|
|
75
|
-
total_diff_deletions: totalDeletions,
|
|
76
|
-
removed_path_manifest_sha256: pathManifestSha256
|
|
77
|
-
} : null
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
export function flattenFindingProofs(findings) {
|
|
81
|
-
return (findings?.findings || []).flatMap((row) => (row?.closure?.proof || []).map((entry) => ({
|
|
82
|
-
finding_id: row?.id,
|
|
83
|
-
path: entry?.path,
|
|
84
|
-
sha256: entry?.sha256,
|
|
85
|
-
line_count: entry?.line_count
|
|
86
|
-
}))).sort((a, b) => findingProofKey(a).localeCompare(findingProofKey(b)));
|
|
87
|
-
}
|
|
88
|
-
export function flattenWorkOrderEvidence(ledger) {
|
|
89
|
-
return (ledger?.items || []).flatMap((item) => [
|
|
90
|
-
...(item?.implementation_evidence || []).map((entry) => ({
|
|
91
|
-
work_order_id: item?.id, kind: 'implementation', path: entry?.path, sha256: entry?.sha256, line_count: entry?.line_count
|
|
92
|
-
})),
|
|
93
|
-
...(item?.verification_evidence || []).map((entry) => ({
|
|
94
|
-
work_order_id: item?.id, kind: 'verification', path: entry?.path, sha256: entry?.sha256, line_count: entry?.line_count
|
|
95
|
-
}))
|
|
96
|
-
]).sort((a, b) => workOrderEvidenceKey(a).localeCompare(workOrderEvidenceKey(b)));
|
|
97
|
-
}
|
|
98
|
-
export function requiredArtifactPaths(version, missionId) {
|
|
99
|
-
return Object.fromEntries(Object.entries(REQUIRED_ARTIFACTS).map(([key, value]) => [key, {
|
|
100
|
-
path: value.path(version, missionId),
|
|
101
|
-
schema: value.schema
|
|
102
|
-
}]));
|
|
103
|
-
}
|
|
104
|
-
export function sourceCommitBound(root, value, baseline, head) {
|
|
105
|
-
return sha40(value) && value !== baseline && value !== head && gitOk(root, ['merge-base', '--is-ancestor', baseline, value])
|
|
106
|
-
&& gitOk(root, ['merge-base', '--is-ancestor', value, head]);
|
|
107
|
-
}
|
|
108
|
-
export function validatePostSourceCommitDiff(root, sourceCommit, head, version, blockers) {
|
|
109
|
-
if (!sha40(sourceCommit) || !sha40(head) || sourceCommit === head)
|
|
110
|
-
return;
|
|
111
|
-
const diff = git(root, ['diff', '--name-only', `${sourceCommit}..${head}`, '--']);
|
|
112
|
-
if (!diff.ok) {
|
|
113
|
-
blockers.push('closure_post_source_diff_unavailable');
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
const allowedPrefix = `.sneakoscope/release/${version}/`;
|
|
117
|
-
for (const changedPath of diff.stdout.split(/\r?\n/).filter(Boolean)) {
|
|
118
|
-
if (!changedPath.startsWith(allowedPrefix))
|
|
119
|
-
blockers.push(`closure_post_source_change_forbidden:${changedPath}`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
export function trackedBlobMatches(root, head, relativePath, expectedSha) {
|
|
123
|
-
if (!sha40(head) || !sha256(expectedSha) || !gitOk(root, ['ls-files', '--error-unmatch', '--', relativePath]))
|
|
124
|
-
return false;
|
|
125
|
-
const result = spawnSync('git', ['show', `${head}:${relativePath}`], { cwd: root, encoding: null, maxBuffer: 32 * 1024 * 1024 });
|
|
126
|
-
return result.status === 0 && hashBuffer(Buffer.from(result.stdout || [])) === expectedSha;
|
|
127
|
-
}
|
|
128
|
-
export function safeRootFile(root, relativePath) {
|
|
129
|
-
const base = `${path.resolve(root)}${path.sep}`;
|
|
130
|
-
const resolved = path.resolve(root, relativePath);
|
|
131
|
-
if (!resolved.startsWith(base))
|
|
132
|
-
return null;
|
|
133
|
-
try {
|
|
134
|
-
return fs.lstatSync(resolved).isFile() ? resolved : null;
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
export function trustedRolloutPath(root, value) {
|
|
141
|
-
const resolved = path.resolve(value);
|
|
142
|
-
const candidates = [
|
|
143
|
-
path.resolve(root, '.codex', 'sessions'),
|
|
144
|
-
path.resolve(process.env.CODEX_HOME || path.join(os.homedir(), '.codex'), 'sessions')
|
|
145
|
-
];
|
|
146
|
-
if (!candidates.some((base) => resolved === base || resolved.startsWith(`${base}${path.sep}`)))
|
|
147
|
-
return null;
|
|
148
|
-
try {
|
|
149
|
-
return fs.lstatSync(resolved).isFile() ? resolved : null;
|
|
150
|
-
}
|
|
151
|
-
catch {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
export function rolloutLineProof(file, lineNumber) {
|
|
156
|
-
const value = fs.readFileSync(file, 'utf8');
|
|
157
|
-
const lines = value.split('\n');
|
|
158
|
-
if (lineNumber < 1 || lineNumber > lines.length)
|
|
159
|
-
return null;
|
|
160
|
-
const line = lines[lineNumber - 1] || '';
|
|
161
|
-
const terminal = lineNumber < lines.length ? '\n' : '';
|
|
162
|
-
const prefix = `${lines.slice(0, lineNumber).join('\n')}${terminal}`;
|
|
163
|
-
return { text: line, lineSha256: hashText(line), prefixSha256: hashText(prefix) };
|
|
164
|
-
}
|
|
165
|
-
export function acceptedRiskComplete(value) {
|
|
166
|
-
return ['owner', 'expires_version', 'reproduction', 'user_impact', 'why_safe_for_6_3_0', 'removal_plan'].every((key) => text(value?.[key]));
|
|
167
|
-
}
|
|
168
|
-
export function sameJsonSet(left, right, key) {
|
|
169
|
-
const a = left.map(key).sort();
|
|
170
|
-
const b = right.map(key).sort();
|
|
171
|
-
return a.length === b.length && a.every((value, index) => value === b[index]);
|
|
172
|
-
}
|
|
173
|
-
export function findingProofKey(value) {
|
|
174
|
-
return `${String(value?.finding_id || '')}:${String(value?.path || '')}:${String(value?.sha256 || '')}:${String(value?.line_count || '')}`;
|
|
175
|
-
}
|
|
176
|
-
export function workOrderEvidenceKey(value) {
|
|
177
|
-
return `${String(value?.work_order_id || '')}:${String(value?.kind || '')}:${String(value?.path || '')}:${String(value?.sha256 || '')}:${String(value?.line_count || '')}`;
|
|
178
|
-
}
|
|
179
|
-
export function sameSet(left, right) {
|
|
180
|
-
const values = strings(left);
|
|
181
|
-
return values.length === right.length && new Set(values).size === values.length && right.every((value) => values.includes(value));
|
|
182
|
-
}
|
|
183
|
-
export function strings(value) {
|
|
184
|
-
return Array.isArray(value) ? value.filter((entry) => typeof entry === 'string' && entry.trim()).map((entry) => entry.trim()) : [];
|
|
185
|
-
}
|
|
186
|
-
export function unique(values) {
|
|
187
|
-
return [...new Set(values)];
|
|
188
|
-
}
|
|
189
|
-
export function relative(root, file) {
|
|
190
|
-
return path.relative(root, file).split(path.sep).join('/');
|
|
191
|
-
}
|
|
192
|
-
export function text(value) {
|
|
193
|
-
return typeof value === 'string' && value.trim().length > 0;
|
|
194
|
-
}
|
|
195
|
-
export function sha40(value) {
|
|
196
|
-
return /^[a-f0-9]{40}$/i.test(String(value || ''));
|
|
197
|
-
}
|
|
198
|
-
export function sha256(value) {
|
|
199
|
-
return /^[a-f0-9]{64}$/i.test(String(value || ''));
|
|
200
|
-
}
|
|
201
|
-
export function positiveLineCount(value) {
|
|
202
|
-
return Number.isSafeInteger(value) && value > 0;
|
|
203
|
-
}
|
|
204
|
-
export function fileSha256(file) {
|
|
205
|
-
try {
|
|
206
|
-
return hashBuffer(fs.readFileSync(file));
|
|
207
|
-
}
|
|
208
|
-
catch {
|
|
209
|
-
return null;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
export function fileLineCount(file) {
|
|
213
|
-
try {
|
|
214
|
-
const value = fs.readFileSync(file, 'utf8').replace(/\r\n/g, '\n');
|
|
215
|
-
if (!value)
|
|
216
|
-
return 0;
|
|
217
|
-
return value.endsWith('\n') ? value.slice(0, -1).split('\n').length : value.split('\n').length;
|
|
218
|
-
}
|
|
219
|
-
catch {
|
|
220
|
-
return null;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
export function parseJson(value) {
|
|
224
|
-
try {
|
|
225
|
-
return JSON.parse(value);
|
|
226
|
-
}
|
|
227
|
-
catch {
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
export function readJson(file) {
|
|
232
|
-
try {
|
|
233
|
-
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
234
|
-
}
|
|
235
|
-
catch {
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
export function readJsonl(file) {
|
|
240
|
-
try {
|
|
241
|
-
const lines = fs.readFileSync(file, 'utf8').split(/\r?\n/).filter((line) => line.trim());
|
|
242
|
-
return lines.length ? lines.map((line) => JSON.parse(line)) : null;
|
|
243
|
-
}
|
|
244
|
-
catch {
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
export function gitText(root, args) {
|
|
249
|
-
const result = spawnSync('git', args, { cwd: root, encoding: 'utf8' });
|
|
250
|
-
return result.status === 0 ? String(result.stdout || '').trim() : '';
|
|
251
|
-
}
|
|
252
|
-
export function gitOk(root, args) {
|
|
253
|
-
return spawnSync('git', args, { cwd: root, stdio: 'ignore' }).status === 0;
|
|
254
|
-
}
|
|
255
|
-
function resolveSourcePath(value) {
|
|
256
|
-
if (!text(value))
|
|
257
|
-
return null;
|
|
258
|
-
const resolved = path.resolve(value);
|
|
259
|
-
try {
|
|
260
|
-
return fs.lstatSync(resolved).isFile() ? resolved : null;
|
|
261
|
-
}
|
|
262
|
-
catch {
|
|
263
|
-
return null;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
function readSourceLines(file) {
|
|
267
|
-
const value = fs.readFileSync(file, 'utf8').replace(/\r\n/g, '\n');
|
|
268
|
-
if (!value)
|
|
269
|
-
return [];
|
|
270
|
-
return (value.endsWith('\n') ? value.slice(0, -1) : value).split('\n');
|
|
271
|
-
}
|
|
272
|
-
function sliceSha256(lines, start, end) {
|
|
273
|
-
return hashText(`${lines.slice(start - 1, end).join('\n')}\n`);
|
|
274
|
-
}
|
|
275
|
-
function numstatDeletions(value) {
|
|
276
|
-
let count = 0;
|
|
277
|
-
for (const row of value.split(/\r?\n/)) {
|
|
278
|
-
const deleted = row.split('\t')[1];
|
|
279
|
-
if (deleted && /^\d+$/.test(deleted))
|
|
280
|
-
count += Number(deleted);
|
|
281
|
-
}
|
|
282
|
-
return count;
|
|
283
|
-
}
|
|
284
|
-
function hashText(value) {
|
|
285
|
-
return crypto.createHash('sha256').update(value).digest('hex');
|
|
286
|
-
}
|
|
287
|
-
function hashBuffer(value) {
|
|
288
|
-
return crypto.createHash('sha256').update(value).digest('hex');
|
|
289
|
-
}
|
|
290
|
-
function git(root, args) {
|
|
291
|
-
const result = spawnSync('git', args, { cwd: root, encoding: 'utf8', maxBuffer: 32 * 1024 * 1024 });
|
|
292
|
-
return { ok: result.status === 0, stdout: result.status === 0 ? String(result.stdout || '').trim() : '' };
|
|
293
|
-
}
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { validateWorkOrderLedger } from '../artifact-schemas.js';
|
|
3
|
-
import { evaluateOfficialSubagentExecutionProof } from '../proof/fake-real-proof-policy.js';
|
|
4
|
-
import { validateSsotGuardArtifact } from '../safety/ssot-guard.js';
|
|
5
|
-
import { buildSubagentEvidence } from '../subagents/subagent-evidence.js';
|
|
6
|
-
import { normalizeLegacySubagentCountFields } from '../subagents/wave-lifecycle.js';
|
|
7
|
-
import { DELETION_COUNTING_SEMANTICS, FINDING_IDS, FINDING_PROOF_SCHEMA, FINDING_STATUSES, LIFECYCLE_PROVENANCE_SCHEMA, P0, P0_FINDING_STATUSES, P2, POST_MAIN_WORK_ORDERS, WORK_ORDER_IDS } from './release-closure-contract.js';
|
|
8
|
-
import { acceptedRiskComplete, attachmentTruth, deletionTruth, fileLineCount, fileSha256, findingProofKey, parseJson, readJson, rolloutLineProof, safeRootFile, sameJsonSet, sameSet, sha256, strings, text, trustedRolloutPath, workOrderEvidenceKey } from './release-closure-helpers.js';
|
|
9
|
-
export function validateFindings(root, findings, manifest, sourceCommit, missionId, baseline, blockers) {
|
|
10
|
-
if (!findings || findings.schema !== 'sks.release-findings.v1' || findings.captured_before_product_implementation !== true)
|
|
11
|
-
blockers.push('findings_missing_or_invalid');
|
|
12
|
-
if (findings?.baseline !== baseline)
|
|
13
|
-
blockers.push('findings_baseline_mismatch');
|
|
14
|
-
if (findings?.source_commit !== sourceCommit)
|
|
15
|
-
blockers.push('findings_source_commit_mismatch');
|
|
16
|
-
if (findings?.mission_id !== missionId)
|
|
17
|
-
blockers.push('findings_mission_id_mismatch');
|
|
18
|
-
if (!sameSet(findings?.allowed_terminal_statuses, FINDING_STATUSES))
|
|
19
|
-
blockers.push('finding_status_contract_invalid');
|
|
20
|
-
const rows = Array.isArray(findings?.findings) ? findings.findings : [];
|
|
21
|
-
if (rows.length !== 28)
|
|
22
|
-
blockers.push(`finding_count_mismatch:${rows.length}/28`);
|
|
23
|
-
if (!sameSet(rows.map((row) => row?.id), FINDING_IDS))
|
|
24
|
-
blockers.push('finding_ids_invalid');
|
|
25
|
-
const manifestProofs = Array.isArray(manifest?.finding_proofs) ? manifest.finding_proofs : [];
|
|
26
|
-
const observedProofs = [];
|
|
27
|
-
for (const row of rows) {
|
|
28
|
-
const id = String(row?.id || '');
|
|
29
|
-
const severity = P0.has(id) ? 'P0' : P2.has(id) ? 'P2' : 'P1';
|
|
30
|
-
if (row?.severity !== severity)
|
|
31
|
-
blockers.push(`finding_severity_mismatch:${id}`);
|
|
32
|
-
if (!FINDING_STATUSES.includes(row?.status))
|
|
33
|
-
blockers.push(`finding_not_terminal:${id}`);
|
|
34
|
-
if (severity === 'P0' && !P0_FINDING_STATUSES.has(row?.status))
|
|
35
|
-
blockers.push(`p0_terminal_status_forbidden:${id}`);
|
|
36
|
-
if (row?.status === 'accepted_risk_with_expiry' && !acceptedRiskComplete(row?.accepted_risk))
|
|
37
|
-
blockers.push(`accepted_risk_incomplete:${id}`);
|
|
38
|
-
if (row?.closure?.commit !== sourceCommit)
|
|
39
|
-
blockers.push(`finding_commit_unbound:${id}`);
|
|
40
|
-
const proofEntries = Array.isArray(row?.closure?.proof) ? row.closure.proof : [];
|
|
41
|
-
if (!proofEntries.length)
|
|
42
|
-
blockers.push(`finding_proof_invalid:${id}`);
|
|
43
|
-
for (const entry of proofEntries) {
|
|
44
|
-
observedProofs.push({ finding_id: id, path: entry?.path, sha256: entry?.sha256, line_count: entry?.line_count });
|
|
45
|
-
validateEvidenceFile(root, entry, {
|
|
46
|
-
schema: FINDING_PROOF_SCHEMA,
|
|
47
|
-
sourceCommit,
|
|
48
|
-
missionId,
|
|
49
|
-
findingId: id,
|
|
50
|
-
findingStatus: row?.status
|
|
51
|
-
}, `finding_proof:${id}`, blockers);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (!sameJsonSet(observedProofs, manifestProofs, findingProofKey))
|
|
55
|
-
blockers.push('finding_proof_manifest_mismatch');
|
|
56
|
-
}
|
|
57
|
-
export function validateMission(mission, sourceCommit, missionId, blockers) {
|
|
58
|
-
if (!mission || mission.id !== missionId || String(mission.mode || '').toLowerCase() !== 'naruto')
|
|
59
|
-
blockers.push('mission_identity_invalid');
|
|
60
|
-
if (mission?.implementation_allowed !== true)
|
|
61
|
-
blockers.push('mission_implementation_not_allowed');
|
|
62
|
-
if (mission?.phase !== 'NARUTO_COMPLETE')
|
|
63
|
-
blockers.push('mission_not_complete');
|
|
64
|
-
if (mission?.completion?.status !== 'completed' || mission?.completion?.mission_id !== missionId || mission?.completion?.source_commit !== sourceCommit) {
|
|
65
|
-
blockers.push('mission_completion_binding_invalid');
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
export function validateOfficialThreads(root, value, blockers) {
|
|
69
|
-
const { plan, rawEvents, parent, evidence, summary, gate, ssot, missionId } = value;
|
|
70
|
-
const normalizedEvidence = normalizeLegacySubagentCountFields(evidence, plan);
|
|
71
|
-
const normalizedSummary = normalizeLegacySubagentCountFields(summary, plan);
|
|
72
|
-
const normalizedGate = normalizeLegacySubagentCountFields(gate, plan);
|
|
73
|
-
const runId = String(plan?.workflow_run_id || '');
|
|
74
|
-
const slices = Array.isArray(plan?.slices) ? plan.slices : [];
|
|
75
|
-
if (plan?.schema !== 'sks.subagent-plan.v1' || plan?.mission_id !== missionId || plan?.route !== '$Naruto'
|
|
76
|
-
|| plan?.workflow !== 'official_codex_subagent' || plan?.requested_subagents !== 3 || plan?.max_depth !== 1)
|
|
77
|
-
blockers.push('subagent_plan_invalid');
|
|
78
|
-
if (slices.length !== 3 || new Set(slices.map((slice) => slice?.id)).size !== 3)
|
|
79
|
-
blockers.push('subagent_plan_slices_invalid');
|
|
80
|
-
if (slices.some((slice) => !text(slice?.id) || !text(slice?.title) || !text(slice?.description) || !text(slice?.agent)
|
|
81
|
-
|| !text(slice?.thread_id) || !text(slice?.agent_path) || !plan?.agents?.[slice.agent]))
|
|
82
|
-
blockers.push('subagent_plan_roles_invalid');
|
|
83
|
-
if (plan?.parent_model_match !== true || !text(plan?.observed_parent_model))
|
|
84
|
-
blockers.push('subagent_parent_model_unproven');
|
|
85
|
-
const events = Array.isArray(rawEvents) ? rawEvents : [];
|
|
86
|
-
if (events.length !== 6)
|
|
87
|
-
blockers.push(`subagent_event_count_invalid:${events.length}/6`);
|
|
88
|
-
const starts = events.filter((event) => event?.event_name === 'SubagentStart');
|
|
89
|
-
const stops = events.filter((event) => event?.event_name === 'SubagentStop');
|
|
90
|
-
const startIds = strings(starts.map((event) => event?.thread_id)).sort();
|
|
91
|
-
const stopIds = strings(stops.map((event) => event?.thread_id)).sort();
|
|
92
|
-
if (starts.length !== 3 || stops.length !== 3 || !sameSet(startIds, stopIds) || new Set(startIds).size !== 3)
|
|
93
|
-
blockers.push('subagent_lifecycle_pairing_invalid');
|
|
94
|
-
const sliceThreadIds = strings(slices.map((slice) => slice?.thread_id)).sort();
|
|
95
|
-
if (!sameSet(startIds, sliceThreadIds))
|
|
96
|
-
blockers.push('subagent_plan_thread_ids_mismatch');
|
|
97
|
-
const startPathByThread = new Map(starts.map((event) => [event?.thread_id, event?.provenance?.agent_path]));
|
|
98
|
-
for (const event of events) {
|
|
99
|
-
if (event?.schema !== 'sks.subagent-event.v1' || event?.run_id !== runId || !text(event?.thread_id) || !text(event?.occurred_at)) {
|
|
100
|
-
blockers.push(`subagent_event_invalid:${String(event?.thread_id || 'missing')}`);
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
const expectedPath = event?.event_name === 'SubagentStop' ? startPathByThread.get(event.thread_id) : event?.provenance?.agent_path;
|
|
104
|
-
validateRolloutProvenance(root, event, expectedPath, blockers);
|
|
105
|
-
}
|
|
106
|
-
for (const slice of slices) {
|
|
107
|
-
if (startPathByThread.get(slice.thread_id) !== slice.agent_path)
|
|
108
|
-
blockers.push(`subagent_plan_agent_path_mismatch:${slice.id}`);
|
|
109
|
-
}
|
|
110
|
-
const official = evaluateOfficialSubagentExecutionProof({
|
|
111
|
-
subagent_plan: plan,
|
|
112
|
-
subagent_evidence: normalizedEvidence,
|
|
113
|
-
naruto_summary: normalizedSummary,
|
|
114
|
-
naruto_gate: normalizedGate
|
|
115
|
-
}, { required: true });
|
|
116
|
-
if (official.proof_level !== 'proven')
|
|
117
|
-
blockers.push(...official.blockers.map((item) => `naruto:${item}`));
|
|
118
|
-
const rebuilt = buildSubagentEvidence({
|
|
119
|
-
requestedSubagents: 3,
|
|
120
|
-
countPolicy: 'exact',
|
|
121
|
-
targetSubagents: 3,
|
|
122
|
-
events,
|
|
123
|
-
parentSummary: parent,
|
|
124
|
-
parentSummaryPresent: Boolean(parent),
|
|
125
|
-
workflowStatus: 'completed',
|
|
126
|
-
preparationOnly: false,
|
|
127
|
-
runId
|
|
128
|
-
});
|
|
129
|
-
const evidenceKeys = [
|
|
130
|
-
'ok', 'status', 'preparation_only', 'requested_subagents', 'count_policy', 'target_subagents', 'started_threads', 'completed_threads', 'failed_threads',
|
|
131
|
-
'started_thread_ids', 'completed_thread_ids', 'failed_thread_ids', 'open_thread_ids', 'unmatched_stop_thread_ids',
|
|
132
|
-
'ambiguous_stop_thread_ids', 'event_sources', 'parent_summary_present', 'parent_summary_trustworthy',
|
|
133
|
-
'parent_summary_status', 'run_id', 'blockers'
|
|
134
|
-
];
|
|
135
|
-
if (!rebuilt.ok || evidenceKeys.some((key) => JSON.stringify(rebuilt[key]) !== JSON.stringify(normalizedEvidence?.[key])))
|
|
136
|
-
blockers.push('subagent_evidence_recompute_mismatch');
|
|
137
|
-
const parentIds = strings((parent?.thread_outcomes || []).map((row) => row?.thread_id)).sort();
|
|
138
|
-
if (parent?.schema !== 'sks.subagent-parent-summary.v1' || parent?.status !== 'completed' || parent?.run_id !== runId
|
|
139
|
-
|| !parent?.changed_files?.length || !parent?.verification?.length || (parent?.blockers || []).length
|
|
140
|
-
|| parent?.thread_outcomes?.length !== 3 || !sameSet(parentIds, startIds)
|
|
141
|
-
|| parent.thread_outcomes.some((row) => row?.status !== 'completed' || !text(row?.summary)))
|
|
142
|
-
blockers.push('parent_summary_invalid');
|
|
143
|
-
if (normalizedSummary?.mission_id !== missionId || normalizedSummary?.workflow_run_id !== runId || normalizedSummary?.requested_subagents !== 3
|
|
144
|
-
|| normalizedSummary?.count_policy !== 'exact' || normalizedSummary?.target_subagents !== 3
|
|
145
|
-
|| normalizedSummary?.ok !== true || normalizedSummary?.completion_evidence !== true || normalizedSummary?.status !== 'completed'
|
|
146
|
-
|| normalizedSummary?.parent_summary_present !== true || !sameSet(strings((normalizedSummary?.parent_thread_outcomes || []).map((row) => row?.thread_id)), startIds))
|
|
147
|
-
blockers.push('naruto_summary_inconsistent');
|
|
148
|
-
if (normalizedGate?.mission_id !== missionId || normalizedGate?.workflow_run_id !== runId || normalizedGate?.requested_subagents !== 3
|
|
149
|
-
|| normalizedGate?.count_policy !== 'exact' || normalizedGate?.target_subagents !== 3
|
|
150
|
-
|| normalizedGate?.started_subagents !== 3 || normalizedGate?.completed_subagents !== 3 || normalizedGate?.failed_subagents !== 0
|
|
151
|
-
|| normalizedGate?.passed !== true || normalizedGate?.terminal !== true || normalizedGate?.terminal_state !== 'completed'
|
|
152
|
-
|| normalizedGate?.official_subagent_evidence !== true || normalizedGate?.subagent_evidence_ready !== true
|
|
153
|
-
|| normalizedGate?.parent_summary_present !== true || normalizedGate?.session_cleanup !== true || normalizedGate?.ssot_guard !== true
|
|
154
|
-
|| (normalizedGate?.blockers || []).length)
|
|
155
|
-
blockers.push('naruto_gate_inconsistent');
|
|
156
|
-
if (!validateSsotGuardArtifact(ssot).ok)
|
|
157
|
-
blockers.push('ssot_guard_invalid');
|
|
158
|
-
}
|
|
159
|
-
export function validateReleaseLedger(root, ledger, manifest, sourceCommit, missionId, expectedSha, blockers) {
|
|
160
|
-
const items = Array.isArray(ledger?.items) ? ledger.items : [];
|
|
161
|
-
const hasBlockedItems = items.some((item) => item?.status === 'blocked');
|
|
162
|
-
if (!validateWorkOrderLedger(ledger || {}).ok || ledger?.schema_version !== 1 || ledger?.mission_id !== missionId
|
|
163
|
-
|| String(ledger?.route || '').replace(/^\$/, '').toLowerCase() !== 'naruto'
|
|
164
|
-
|| ledger?.source_sha256 !== expectedSha || ledger?.source_line_count !== 3021 || ledger?.source_commit !== sourceCommit
|
|
165
|
-
|| ledger?.source_inventory_complete !== true || ledger?.all_customer_requests_preserved !== true
|
|
166
|
-
|| ledger?.all_customer_requests_mapped !== true || ledger?.all_work_items_resolved !== true
|
|
167
|
-
|| ledger?.all_work_items_verified !== !hasBlockedItems)
|
|
168
|
-
blockers.push('work_order_header_invalid');
|
|
169
|
-
if (items.length !== 28)
|
|
170
|
-
blockers.push(`work_order_count_mismatch:${items.length}/28`);
|
|
171
|
-
if (!sameSet(items.map((item) => item?.id), WORK_ORDER_IDS))
|
|
172
|
-
blockers.push('work_order_ids_invalid');
|
|
173
|
-
const observedEvidence = [];
|
|
174
|
-
for (const item of items) {
|
|
175
|
-
const id = String(item?.id || 'missing');
|
|
176
|
-
const blocked = item?.status === 'blocked' && POST_MAIN_WORK_ORDERS.has(id) && item?.blocker?.blocked === true
|
|
177
|
-
&& item?.blocker?.kind === 'external_authority' && item?.blocker?.phase === 'post_main'
|
|
178
|
-
&& text(item?.blocker?.reason) && text(item?.blocker?.needed_to_unblock);
|
|
179
|
-
if (item?.status !== 'verified' && !blocked)
|
|
180
|
-
blockers.push(`work_order_item_invalid:${id}`);
|
|
181
|
-
const implementation = Array.isArray(item?.implementation_evidence) ? item.implementation_evidence : [];
|
|
182
|
-
const verification = Array.isArray(item?.verification_evidence) ? item.verification_evidence : [];
|
|
183
|
-
if (!implementation.length)
|
|
184
|
-
blockers.push(`work_order_implementation_evidence_missing:${id}`);
|
|
185
|
-
if (item?.status === 'verified' && !verification.length)
|
|
186
|
-
blockers.push(`work_order_verification_evidence_missing:${id}`);
|
|
187
|
-
for (const [kind, entries] of [['implementation', implementation], ['verification', verification]]) {
|
|
188
|
-
for (const entry of entries) {
|
|
189
|
-
observedEvidence.push({ work_order_id: id, kind, path: entry?.path, sha256: entry?.sha256, line_count: entry?.line_count });
|
|
190
|
-
validateEvidenceFile(root, entry, { sourceCommit, missionId, workOrderId: id, evidenceKind: kind }, `work_order_${kind}:${id}`, blockers);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
if (!sameJsonSet(observedEvidence, manifest?.work_order_evidence || [], workOrderEvidenceKey))
|
|
195
|
-
blockers.push('work_order_evidence_manifest_mismatch');
|
|
196
|
-
const attachment = attachmentTruth(ledger);
|
|
197
|
-
if (!attachment.ok)
|
|
198
|
-
blockers.push(...attachment.blockers);
|
|
199
|
-
else {
|
|
200
|
-
if (attachment.manifest.sha256 !== expectedSha || attachment.manifest.line_count !== 3021)
|
|
201
|
-
blockers.push('work_order_attachment_identity_mismatch');
|
|
202
|
-
if (JSON.stringify(attachment.manifest) !== JSON.stringify(manifest?.source_attachment))
|
|
203
|
-
blockers.push('work_order_attachment_manifest_mismatch');
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
export function validateDeletion(root, deletion, manifest, sourceCommit, baseline, blockers) {
|
|
207
|
-
const truth = deletionTruth(root, baseline, sourceCommit);
|
|
208
|
-
if (!deletion || deletion.schema !== 'sks.release-overengineering-deletions.v1' || deletion.baseline !== baseline
|
|
209
|
-
|| deletion.source_commit !== sourceCommit || deletion.counting_semantics !== DELETION_COUNTING_SEMANTICS
|
|
210
|
-
|| !Array.isArray(deletion.removed_modules) || !Number.isSafeInteger(deletion.removed_file_count)
|
|
211
|
-
|| !Number.isSafeInteger(deletion.removed_lines) || !Number.isSafeInteger(deletion.total_diff_deletions)
|
|
212
|
-
|| !sha256(deletion.removed_path_manifest_sha256))
|
|
213
|
-
blockers.push('deletion_evidence_invalid');
|
|
214
|
-
if (!truth.ok)
|
|
215
|
-
blockers.push('deletion_truth_unavailable');
|
|
216
|
-
else {
|
|
217
|
-
if (!sameSet(strings(deletion?.removed_modules), truth.modules))
|
|
218
|
-
blockers.push('removed_modules_mismatch');
|
|
219
|
-
if (deletion?.removed_file_count !== truth.modules.length)
|
|
220
|
-
blockers.push('removed_file_count_mismatch');
|
|
221
|
-
if (deletion?.removed_lines !== truth.pureDeletionLines)
|
|
222
|
-
blockers.push('removed_lines_mismatch');
|
|
223
|
-
if (deletion?.total_diff_deletions !== truth.totalDeletions)
|
|
224
|
-
blockers.push('total_diff_deletions_mismatch');
|
|
225
|
-
if (deletion?.removed_path_manifest_sha256 !== truth.pathManifestSha256)
|
|
226
|
-
blockers.push('removed_path_manifest_hash_mismatch');
|
|
227
|
-
if (JSON.stringify(manifest?.deletion_truth) !== JSON.stringify(truth.manifest))
|
|
228
|
-
blockers.push('deletion_manifest_mismatch');
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
function validateEvidenceFile(root, entry, expected, label, blockers) {
|
|
232
|
-
if (!entry || !text(entry.path) || path.isAbsolute(entry.path) || !sha256(entry.sha256) || !text(entry.schema)
|
|
233
|
-
|| !Number.isSafeInteger(entry.line_count) || entry.line_count < 1
|
|
234
|
-
|| entry.source_commit !== expected.sourceCommit || entry.mission_id !== expected.missionId) {
|
|
235
|
-
blockers.push(`${label}:reference_invalid`);
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
const file = safeRootFile(root, entry.path);
|
|
239
|
-
if (!file || fileSha256(file) !== entry.sha256 || fileLineCount(file) !== entry.line_count) {
|
|
240
|
-
blockers.push(`${label}:hash_mismatch`);
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
const proof = readJson(file);
|
|
244
|
-
if (!proof || proof.schema !== entry.schema || proof.schema !== (expected.schema || entry.schema)
|
|
245
|
-
|| proof.source_commit !== expected.sourceCommit || proof.mission_id !== expected.missionId
|
|
246
|
-
|| proof.ok !== true || (Array.isArray(proof.blockers) && proof.blockers.length))
|
|
247
|
-
blockers.push(`${label}:content_invalid`);
|
|
248
|
-
if (expected.findingId && (proof.finding_id !== expected.findingId || proof.status !== expected.findingStatus))
|
|
249
|
-
blockers.push(`${label}:finding_binding_invalid`);
|
|
250
|
-
if (expected.workOrderId && (proof.work_order_id !== expected.workOrderId
|
|
251
|
-
|| !['both', expected.evidenceKind].includes(String(proof.evidence_kind || ''))))
|
|
252
|
-
blockers.push(`${label}:work_order_binding_invalid`);
|
|
253
|
-
}
|
|
254
|
-
function validateRolloutProvenance(root, event, expectedAgentPath, blockers) {
|
|
255
|
-
const proof = event?.provenance;
|
|
256
|
-
const id = String(event?.thread_id || 'missing');
|
|
257
|
-
if (!proof || proof.schema !== LIFECYCLE_PROVENANCE_SCHEMA || !text(proof.rollout_path)
|
|
258
|
-
|| !Number.isSafeInteger(proof.line) || proof.line < 1 || !sha256(proof.line_sha256)
|
|
259
|
-
|| !sha256(proof.rollout_prefix_sha256) || !text(proof.agent_path) || proof.agent_path !== expectedAgentPath) {
|
|
260
|
-
blockers.push(`subagent_rollout_provenance_invalid:${id}`);
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
const rollout = trustedRolloutPath(root, proof.rollout_path);
|
|
264
|
-
const line = rollout ? rolloutLineProof(rollout, proof.line) : null;
|
|
265
|
-
if (!line || line.lineSha256 !== proof.line_sha256 || line.prefixSha256 !== proof.rollout_prefix_sha256) {
|
|
266
|
-
blockers.push(`subagent_rollout_hash_mismatch:${id}`);
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
const row = parseJson(line.text);
|
|
270
|
-
if (event.event_name === 'SubagentStart') {
|
|
271
|
-
const payload = row?.payload;
|
|
272
|
-
if (row?.type !== 'event_msg' || payload?.type !== 'sub_agent_activity' || payload?.kind !== 'started'
|
|
273
|
-
|| payload?.agent_thread_id !== id || payload?.agent_path !== proof.agent_path
|
|
274
|
-
|| payload?.event_id !== proof.event_id || row?.timestamp !== event.occurred_at)
|
|
275
|
-
blockers.push(`subagent_rollout_start_mismatch:${id}`);
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
const payload = row?.payload;
|
|
279
|
-
const content = JSON.stringify(payload?.content || []);
|
|
280
|
-
if (row?.type !== 'response_item' || payload?.type !== 'agent_message' || payload?.author !== proof.agent_path
|
|
281
|
-
|| !content.includes('FINAL_ANSWER') || row?.timestamp !== event.occurred_at)
|
|
282
|
-
blockers.push(`subagent_rollout_stop_mismatch:${id}`);
|
|
283
|
-
}
|
|
284
|
-
}
|