sneakoscope 7.0.2 → 7.0.3

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.
Files changed (468) hide show
  1. package/README.md +7 -5
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/dist/bin/sks-dispatch.js +0 -3
  5. package/dist/cli/command-registry.js +0 -2
  6. package/dist/cli/install-helpers-codex-lb-chain.js +24 -2
  7. package/dist/cli/install-helpers-codex-lb-config.js +0 -7
  8. package/dist/cli/install-helpers-codex-lb-selftest-chain.js +0 -3
  9. package/dist/cli/install-helpers-codex-lb-selftest.js +0 -17
  10. package/dist/cli/install-helpers.js +81 -96
  11. package/dist/cli/router.js +0 -22
  12. package/dist/commands/codex-lb.js +176 -22
  13. package/dist/commands/codex.js +3 -8
  14. package/dist/commands/doctor.js +4 -14
  15. package/dist/commands/perf.js +5 -1
  16. package/dist/commands/zellij-slot-column-anchor.js +0 -2
  17. package/dist/commands/zellij-slot-pane.js +0 -7
  18. package/dist/commands/zellij.js +0 -2
  19. package/dist/config/skills-manifest.json +52 -52
  20. package/dist/core/agent-bridge/agent-manifest.js +192 -1
  21. package/dist/core/agent-bridge/agent-mode.js +0 -5
  22. package/dist/core/agent-bridge/host-capability-policy.js +189 -0
  23. package/dist/core/agent-bridge/host-capability-runtime.js +1395 -0
  24. package/dist/core/agent-bridge/mcp-server.js +1 -11
  25. package/dist/core/agents/agent-effort-policy.js +0 -3
  26. package/dist/core/agents/agent-orchestrator.js +0 -4
  27. package/dist/core/agents/agent-proof-evidence.js +0 -2
  28. package/dist/core/agents/agent-runner-ollama.js +0 -3
  29. package/dist/core/agents/agent-scheduler.js +0 -5
  30. package/dist/core/agents/native-cli-worker-runtime.js +5 -17
  31. package/dist/core/agents/work-partition/repo-inventory.js +0 -2
  32. package/dist/core/auto-review.js +0 -13
  33. package/dist/core/bench.js +0 -14
  34. package/dist/core/code-structure.js +0 -3
  35. package/dist/core/codex/agent-config-file-repair.js +0 -8
  36. package/dist/core/codex/codex-cli-update.js +122 -20
  37. package/dist/core/codex/codex-config-eperm-repair.js +0 -4
  38. package/dist/core/codex/codex-config-guard.js +0 -3
  39. package/dist/core/codex/codex-config-readability.js +0 -13
  40. package/dist/core/codex/codex-project-config-policy.js +0 -33
  41. package/dist/core/codex/official-goal-mode.js +0 -2
  42. package/dist/core/codex-app/codex-app-fast-ui-repair.js +5 -7
  43. package/dist/core/codex-app/codex-app-ui-state-snapshot.js +44 -7
  44. package/dist/core/codex-app/sks-menubar.js +0 -1
  45. package/dist/core/codex-app.js +0 -9
  46. package/dist/core/codex-compat/codex-hook-output-builders.js +9 -1
  47. package/dist/core/codex-compat/codex-hook-output-normalizer.js +1 -1
  48. package/dist/core/codex-compat/codex-hook-semantic-validator.js +3 -2
  49. package/dist/core/codex-compat/codex-hook-warning-detector.js +10 -2
  50. package/dist/core/codex-control/codex-lb-launch-recovery.js +0 -3
  51. package/dist/core/codex-control/codex-reliability-shield.js +0 -8
  52. package/dist/core/codex-control/codex-sdk-adapter.js +0 -3
  53. package/dist/core/codex-control/codex-sdk-config-policy.js +0 -2
  54. package/dist/core/codex-control/codex-sdk-env-policy.js +61 -16
  55. package/dist/core/codex-control/codex-task-runner.js +0 -7
  56. package/dist/core/codex-control/codex-thread-registry.js +0 -4
  57. package/dist/core/codex-lb/codex-lb-env.js +118 -20
  58. package/dist/core/codex-lb/codex-lb-tool-catalog.js +0 -4
  59. package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +1 -1
  60. package/dist/core/codex-model-guard.js +0 -14
  61. package/dist/core/codex-native/codex-native-feature-broker.js +67 -22
  62. package/dist/core/codex-native/codex-native-interop-policy.js +81 -9
  63. package/dist/core/codex-native/confined-report-writer.js +21 -0
  64. package/dist/core/codex-native/core-skill-integrity.js +169 -20
  65. package/dist/core/codex-native/project-skill-dedupe.js +55 -13
  66. package/dist/core/codex-native/skill-registry-ledger.js +137 -16
  67. package/dist/core/codex-native/sks-skill-paths.js +185 -0
  68. package/dist/core/codex-runtime/codex-desktop-config-policy.js +0 -2
  69. package/dist/core/commands/agent-bridge-command.js +28 -8
  70. package/dist/core/commands/basic-cli.js +67 -26
  71. package/dist/core/commands/bench-command.js +5 -1
  72. package/dist/core/commands/command-utils.js +0 -5
  73. package/dist/core/commands/image-ux-review-command.js +0 -9
  74. package/dist/core/commands/mad-sks-command.js +0 -38
  75. package/dist/core/commands/naruto-command.js +46 -12
  76. package/dist/core/commands/ppt-command.js +0 -9
  77. package/dist/core/commands/run-command.js +8 -2
  78. package/dist/core/commands/seo-command.js +0 -6
  79. package/dist/core/commands/wiki-command.js +0 -14
  80. package/dist/core/computer-use-live-evidence.js +0 -5
  81. package/dist/core/config/secret-preservation.js +0 -11
  82. package/dist/core/daemon/sksd-hook-daemon-entrypoint.js +0 -2
  83. package/dist/core/daemon/sksd-hook-daemon.js +1 -29
  84. package/dist/core/daemon/sksd-hook-dispatch.js +0 -17
  85. package/dist/core/db-safety.js +0 -7
  86. package/dist/core/doctor/browser-use-repair.js +0 -2
  87. package/dist/core/doctor/doctor-codex-startup-repair.js +0 -3
  88. package/dist/core/doctor/doctor-readiness-matrix.js +12 -0
  89. package/dist/core/doctor/doctor-skill-reconcile.js +32 -0
  90. package/dist/core/doctor/imagegen-repair.js +0 -2
  91. package/dist/core/doctor/mcp-transport-collision-repair.js +0 -3
  92. package/dist/core/doctor/retired-managed-residue-private.js +0 -1
  93. package/dist/core/doctor/supabase-mcp-repair.js +0 -11
  94. package/dist/core/feature-fixture-executor.js +0 -48
  95. package/dist/core/feature-fixtures.js +0 -5
  96. package/dist/core/fsx.js +11 -12
  97. package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +0 -5
  98. package/dist/core/hooks-runtime/hook-context.js +202 -0
  99. package/dist/core/hooks-runtime/hook-io.js +1 -12
  100. package/dist/core/hooks-runtime/light-turn.js +0 -2
  101. package/dist/core/hooks-runtime/naruto-decision-gate.js +4 -1
  102. package/dist/core/hooks-runtime/naruto-terminal-finalization.js +91 -0
  103. package/dist/core/hooks-runtime/official-subagent-lifecycle.js +370 -0
  104. package/dist/core/hooks-runtime/standalone-parent-host-capability.js +98 -0
  105. package/dist/core/hooks-runtime/subagent-context.js +59 -0
  106. package/dist/core/hooks-runtime/subagent-skill-availability-contract.js +29 -0
  107. package/dist/core/hooks-runtime/subagent-skill-availability-evidence.js +195 -0
  108. package/dist/core/hooks-runtime/subagent-skill-availability-guards.js +316 -0
  109. package/dist/core/hooks-runtime/subagent-skill-availability.js +217 -0
  110. package/dist/core/hooks-runtime.js +259 -535
  111. package/dist/core/image-ux-review/codex-app-generated-image-discovery.js +0 -17
  112. package/dist/core/image-ux-review/imagegen-adapter.js +0 -14
  113. package/dist/core/imagegen/imagegen-auth-readiness.js +0 -9
  114. package/dist/core/imagegen/imagegen-capability.js +0 -3
  115. package/dist/core/init/managed-skill-install.js +42 -0
  116. package/dist/core/init/skills.js +247 -74
  117. package/dist/core/init.js +15 -40
  118. package/dist/core/lean-engineering-policy.js +0 -2
  119. package/dist/core/locks/file-lock.js +0 -21
  120. package/dist/core/loops/loop-planner.js +0 -6
  121. package/dist/core/loops/loop-runtime.js +0 -1
  122. package/dist/core/loops/loop-worker-runtime.js +0 -19
  123. package/dist/core/mad-sks/executors/db-write-executor.js +0 -4
  124. package/dist/core/mad-sks/executors/executor-base.js +0 -10
  125. package/dist/core/mad-sks/immutable-harness-guard.js +0 -5
  126. package/dist/core/mad-sks/sql-plane/coordinator.js +0 -5
  127. package/dist/core/mad-sks/sql-plane/ledger.js +0 -4
  128. package/dist/core/mad-sks/sql-plane/lock.js +0 -4
  129. package/dist/core/mad-sks/sql-plane/mcp-executor.js +0 -9
  130. package/dist/core/mad-sks/sql-plane/policy-resolver.js +0 -2
  131. package/dist/core/mad-sks/sql-plane/postconditions.js +0 -4
  132. package/dist/core/mad-sks/sql-plane/recovery.js +0 -2
  133. package/dist/core/mad-sks/sql-plane/runtime-profile.js +0 -8
  134. package/dist/core/managed-assets/managed-assets-manifest.js +1 -7
  135. package/dist/core/mcp-config/health-check.js +10 -3
  136. package/dist/core/migration/migration-transaction-journal.js +0 -8
  137. package/dist/core/mission.js +0 -2
  138. package/dist/core/naruto/naruto-active-pool.js +0 -2
  139. package/dist/core/naruto/naruto-concurrency-governor.js +0 -1
  140. package/dist/core/naruto/naruto-real-write-proof.js +0 -4
  141. package/dist/core/naruto/naruto-write-e2e.js +0 -1
  142. package/dist/core/perf/perf-budget.js +0 -5
  143. package/dist/core/permission-gates.js +0 -2
  144. package/dist/core/pipeline-internals/runtime-core.js +15 -5
  145. package/dist/core/pipeline-internals/runtime-gates.js +0 -12
  146. package/dist/core/preflight/parallel-preflight-engine.js +0 -11
  147. package/dist/core/proof/evidence-collector.js +0 -2
  148. package/dist/core/proof/route-finalizer.js +0 -1
  149. package/dist/core/proof/selftest-proof-fixtures.js +0 -5
  150. package/dist/core/providers/glm/bench/glm-benchmark-runner.js +0 -2
  151. package/dist/core/providers/glm/glm-request-cache.js +0 -3
  152. package/dist/core/providers/glm/naruto/glm-naruto-command.js +0 -1
  153. package/dist/core/providers/glm/naruto/glm-naruto-decomposer.js +0 -1
  154. package/dist/core/providers/glm/naruto/glm-naruto-orchestrator.js +0 -6
  155. package/dist/core/providers/glm/naruto/glm-naruto-trace.js +0 -1
  156. package/dist/core/providers/glm/naruto/glm-naruto-worker-pool.js +0 -1
  157. package/dist/core/providers/glm/naruto/glm-naruto-worktree.js +0 -1
  158. package/dist/core/providers/openrouter/openrouter-secret-store.js +0 -1
  159. package/dist/core/providers/openrouter/openrouter-stream.js +0 -2
  160. package/dist/core/questions.js +3 -3
  161. package/dist/core/release/gate-manifest.js +0 -5
  162. package/dist/core/release/package-size-budget.js +1 -1
  163. package/dist/core/release/release-gate-batch-runner.js +11 -2
  164. package/dist/core/release/release-gate-cache-v2.js +0 -4
  165. package/dist/core/release/release-gate-hermetic-env.js +0 -5
  166. package/dist/core/release-parallel-full-coverage.js +0 -2
  167. package/dist/core/remote/ssh-worker-client.js +0 -3
  168. package/dist/core/research/research-adversarial-review.js +6 -2
  169. package/dist/core/responses-retry-policy.js +0 -10
  170. package/dist/core/retention.js +0 -7
  171. package/dist/core/routes/constants.js +0 -3
  172. package/dist/core/routes.js +89 -15
  173. package/dist/core/safety/command-contract/contracts.js +2 -0
  174. package/dist/core/safety/mutation-guard.js +0 -25
  175. package/dist/core/safety/mutation-ledger.js +0 -9
  176. package/dist/core/safety/requested-scope-contract.js +0 -0
  177. package/dist/core/security/high-risk-contracts.js +0 -1
  178. package/dist/core/skills/core-skill-card.js +0 -0
  179. package/dist/core/skills/core-skill-deployment.js +0 -13
  180. package/dist/core/skills/core-skill-epoch.js +0 -11
  181. package/dist/core/skills/core-skill-meta-update.js +0 -6
  182. package/dist/core/skills/core-skill-patch-apply.js +0 -7
  183. package/dist/core/skills/core-skill-patch.js +0 -8
  184. package/dist/core/skills/core-skill-reflection.js +0 -16
  185. package/dist/core/skills/core-skill-runtime.js +0 -6
  186. package/dist/core/skills/core-skill-scorer.js +0 -7
  187. package/dist/core/skills/core-skill-trainer.js +0 -11
  188. package/dist/core/skills/core-skill-types.js +0 -9
  189. package/dist/core/skills/core-skill-validation.js +0 -5
  190. package/dist/core/skills/rejected-skill-patch-buffer.js +0 -2
  191. package/dist/core/stop-gate/stop-gate-check.js +0 -8
  192. package/dist/core/stop-gate/stop-gate-resolver.js +0 -7
  193. package/dist/core/stop-gate/stop-gate-writer.js +0 -5
  194. package/dist/core/subagents/model-policy.js +0 -7
  195. package/dist/core/subagents/naruto-help-contract.js +1 -1
  196. package/dist/core/subagents/naruto-proof-projection.js +580 -12
  197. package/dist/core/subagents/official-subagent-config.js +0 -8
  198. package/dist/core/subagents/official-subagent-preparation.js +6 -5
  199. package/dist/core/subagents/official-subagent-prompt.js +29 -0
  200. package/dist/core/subagents/official-subagent-runner.js +343 -37
  201. package/dist/core/subagents/subagent-evidence.js +378 -9
  202. package/dist/core/subagents/thread-budget.js +5 -2
  203. package/dist/core/subagents/triwiki-attention.js +0 -4
  204. package/dist/core/subagents/wave-parent-guidance.js +54 -9
  205. package/dist/core/telegram/runtime.js +0 -1
  206. package/dist/core/triwiki/code-index-scanner.js +0 -3
  207. package/dist/core/triwiki/code-pack-head-freshness.js +0 -10
  208. package/dist/core/triwiki/code-pack.js +0 -2
  209. package/dist/core/triwiki/triwiki-cache-key.js +0 -1
  210. package/dist/core/triwiki/triwiki-proof-bank.js +0 -1
  211. package/dist/core/triwiki-attention.js +0 -10
  212. package/dist/core/triwiki-provenance.js +0 -5
  213. package/dist/core/triwiki-runtime.js +0 -12
  214. package/dist/core/triwiki-wrongness/wrongness-ledger.js +0 -7
  215. package/dist/core/triwiki-wrongness/wrongness-schema.js +0 -3
  216. package/dist/core/trust-kernel/trust-report.js +0 -7
  217. package/dist/core/update/update-migration-state.js +21 -39
  218. package/dist/core/update-check.js +2 -14
  219. package/dist/core/version-manager.js +2 -0
  220. package/dist/core/version.js +1 -1
  221. package/dist/core/work-order-ledger.js +0 -17
  222. package/dist/core/zellij/zellij-clipboard-config.js +0 -18
  223. package/dist/core/zellij/zellij-lane-renderer.js +5 -46
  224. package/dist/core/zellij/zellij-lane-runtime.js +0 -1
  225. package/dist/core/zellij/zellij-launcher.js +0 -26
  226. package/dist/core/zellij/zellij-official-subagent-activity.js +0 -5
  227. package/dist/core/zellij/zellij-official-subagent-telemetry.js +0 -5
  228. package/dist/core/zellij/zellij-screen-proof.js +0 -7
  229. package/dist/core/zellij/zellij-slot-column-anchor.js +0 -1
  230. package/dist/core/zellij/zellij-slot-pane-renderer.js +0 -9
  231. package/dist/core/zellij/zellij-slot-telemetry.js +0 -12
  232. package/dist/core/zellij/zellij-ui-mode.js +0 -7
  233. package/dist/core/zellij/zellij-update.js +0 -29
  234. package/dist/core/zellij/zellij-worker-pane-manager.js +0 -39
  235. package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +213 -27
  236. package/dist/native/sks-menubar/Sources/UpdatesViewController.swift +95 -12
  237. package/dist/scripts/agent-message-bus-reader-check.js +0 -1
  238. package/dist/scripts/all-feature-deep-completion-check.js +0 -1
  239. package/dist/scripts/appshots-thread-attachment-discovery-check.js +0 -1
  240. package/dist/scripts/architecture-guard-check.js +0 -1
  241. package/dist/scripts/build-dist.js +0 -1
  242. package/dist/scripts/build-once-runner-check.js +0 -1
  243. package/dist/scripts/canonical-test-runner.js +0 -2
  244. package/dist/scripts/certificate-sla-check.js +0 -1
  245. package/dist/scripts/changelog-check.js +0 -1
  246. package/dist/scripts/check-cli-entrypoint.js +0 -1
  247. package/dist/scripts/check-command-module-budget.js +0 -7
  248. package/dist/scripts/check-feature-quality.js +0 -1
  249. package/dist/scripts/check-legacy-free.js +0 -1
  250. package/dist/scripts/check-pipeline-runtime.js +0 -1
  251. package/dist/scripts/check-runtime-schemas.js +0 -1
  252. package/dist/scripts/codex-0-134-runner-truth-check.js +0 -1
  253. package/dist/scripts/codex-0-137-compat-check.js +0 -1
  254. package/dist/scripts/codex-0138-capability-artifact-check.js +0 -1
  255. package/dist/scripts/codex-0138-capability-check.js +0 -1
  256. package/dist/scripts/codex-0138-doctor-check.js +0 -1
  257. package/dist/scripts/codex-0138-feature-probes-check.js +0 -1
  258. package/dist/scripts/codex-0144-core-real-probes-check.js +0 -1
  259. package/dist/scripts/codex-app-handoff-check.js +0 -1
  260. package/dist/scripts/codex-app-handoff-launch-check.js +0 -1
  261. package/dist/scripts/codex-config-load-probe.js +0 -5
  262. package/dist/scripts/codex-control-all-pipelines-check.js +0 -1
  263. package/dist/scripts/codex-control-event-stream-ledger-check.js +0 -1
  264. package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +0 -1
  265. package/dist/scripts/codex-permission-profiles-check.js +0 -1
  266. package/dist/scripts/codex-plugin-app-template-policy-check.js +0 -1
  267. package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -1
  268. package/dist/scripts/codex-sdk-all-pipelines-check.js +0 -1
  269. package/dist/scripts/codex-sdk-backend-router-check.js +0 -1
  270. package/dist/scripts/codex-sdk-capability-check.js +0 -1
  271. package/dist/scripts/codex-sdk-event-stream-ledger-check.js +0 -1
  272. package/dist/scripts/codex-sdk-real-smoke-check.js +0 -1
  273. package/dist/scripts/concurrent-session-collision-check.js +9 -0
  274. package/dist/scripts/context7-evidence-dedupe-check.js +0 -1
  275. package/dist/scripts/core-skill-card-schema-check.js +0 -11
  276. package/dist/scripts/core-skill-deployment-snapshot-check.js +0 -10
  277. package/dist/scripts/core-skill-heldout-validation-check.js +0 -11
  278. package/dist/scripts/core-skill-no-inference-optimizer-check.js +0 -11
  279. package/dist/scripts/core-skill-patch-check.js +0 -11
  280. package/dist/scripts/core-skill-route-runtime-integration-check.js +0 -11
  281. package/dist/scripts/current-surface-update-e2e-check.js +0 -4
  282. package/dist/scripts/current-upgrade-matrix-check.js +0 -1
  283. package/dist/scripts/dfix-fixture-check.js +0 -1
  284. package/dist/scripts/dfix-patch-handoff-check.js +0 -1
  285. package/dist/scripts/dfix-verification-check.js +0 -1
  286. package/dist/scripts/dfix-verification-recommendation-check.js +0 -1
  287. package/dist/scripts/docs-truthfulness-check.js +3 -3
  288. package/dist/scripts/doctor-fastpath-check.js +0 -1
  289. package/dist/scripts/doctor-fix-proves-codex-read-check.js +0 -11
  290. package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +0 -4
  291. package/dist/scripts/doctor-idempotence-check.js +0 -1
  292. package/dist/scripts/doctor-ops-semantics-check.js +0 -1
  293. package/dist/scripts/ensure-bin-executable.js +0 -1
  294. package/dist/scripts/evidence-flagship-coverage-check.js +0 -1
  295. package/dist/scripts/fast-codex-service-tier-proof-check.js +0 -1
  296. package/dist/scripts/fixtures/fake-codex-config-loader.js +0 -5
  297. package/dist/scripts/fsx-hotpath-check.js +0 -1
  298. package/dist/scripts/gate-policy-audit-check.js +1 -1
  299. package/dist/scripts/geo-claim-evidence-check.js +0 -1
  300. package/dist/scripts/geo-cli-blackbox-check.js +0 -1
  301. package/dist/scripts/geo-crawler-policy-check.js +0 -1
  302. package/dist/scripts/git-worktree-diff-envelope-check.js +0 -1
  303. package/dist/scripts/git-worktree-dirty-lock-check.js +0 -1
  304. package/dist/scripts/git-worktree-dirty-main-detection-check.js +0 -1
  305. package/dist/scripts/git-worktree-integration-primary-check.js +0 -1
  306. package/dist/scripts/git-worktree-manifest-append-check.js +0 -1
  307. package/dist/scripts/git-worktree-untracked-diff-check.js +0 -1
  308. package/dist/scripts/high-risk-contracts-check.js +0 -1
  309. package/dist/scripts/hook-latency-budget-check.js +0 -1
  310. package/dist/scripts/hook-latency-quantum-check.js +0 -1
  311. package/dist/scripts/image-artifact-path-contract-check.js +0 -1
  312. package/dist/scripts/imagegen-real-smoke-check.js +0 -1
  313. package/dist/scripts/import-graph-budget-check.js +0 -1
  314. package/dist/scripts/installed-package-smoke-check.js +0 -1
  315. package/dist/scripts/legacy-gate-purge-check.js +0 -1
  316. package/dist/scripts/lib/codex-sdk-gate-lib.js +0 -3
  317. package/dist/scripts/lib/ensure-dist-fresh.js +0 -1
  318. package/dist/scripts/lib/valid-png-fixture.js +0 -1
  319. package/dist/scripts/local-collab-all-pipelines-final-gpt-check.js +0 -1
  320. package/dist/scripts/loop-directive-check-lib.js +0 -1
  321. package/dist/scripts/loop-worker-fixture-child.js +0 -1
  322. package/dist/scripts/mad-preflight-blocks-unreadable-config-check.js +0 -10
  323. package/dist/scripts/mad-sks-sql-plane-lifecycle-hook-decision-check.js +0 -1
  324. package/dist/scripts/mad-sks-sql-plane-result-lifecycle-check.js +0 -1
  325. package/dist/scripts/mcp-plugin-inventory-check.js +0 -1
  326. package/dist/scripts/mcp-tool-naming-parity-check.js +0 -1
  327. package/dist/scripts/model-call-concurrency-check.js +0 -1
  328. package/dist/scripts/mutation-callsite-coverage-check.js +0 -5
  329. package/dist/scripts/naruto-codex-e2e-check.js +0 -1
  330. package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -1
  331. package/dist/scripts/official-subagent-workflow-check.js +3 -1
  332. package/dist/scripts/ops-diagnostics-bundle-check.js +0 -1
  333. package/dist/scripts/packlist-performance-check.js +1 -3
  334. package/dist/scripts/perf-budget-check.js +0 -1
  335. package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -1
  336. package/dist/scripts/ppt-real-export-adapter-check.js +0 -1
  337. package/dist/scripts/ppt-real-imagegen-smoke-check.js +0 -1
  338. package/dist/scripts/ppt-real-imagegen-wiring-check.js +0 -1
  339. package/dist/scripts/ppt-reexport-rereview-check.js +0 -1
  340. package/dist/scripts/prepublish-fast-check.js +0 -23
  341. package/dist/scripts/prepublish-release-check-or-fast.js +0 -7
  342. package/dist/scripts/probe-memoization-check.js +0 -1
  343. package/dist/scripts/product-design-plugin-routing-check.js +0 -1
  344. package/dist/scripts/project-skill-dedupe-blackbox.js +36 -9
  345. package/dist/scripts/prompt-placeholder-guard-check.js +0 -1
  346. package/dist/scripts/python-codex-sdk-all-pipelines-check.js +0 -3
  347. package/dist/scripts/qa-loop-app-handoff-capability-check.js +0 -1
  348. package/dist/scripts/qa-loop-app-handoff-check.js +0 -1
  349. package/dist/scripts/qa-loop-app-handoff-cli-check.js +0 -1
  350. package/dist/scripts/qa-loop-app-handoff-confirmation-check.js +0 -1
  351. package/dist/scripts/qa-loop-app-handoff-gate-lifecycle-check.js +0 -1
  352. package/dist/scripts/qa-loop-app-handoff-launch-check.js +0 -1
  353. package/dist/scripts/qa-loop-app-handoff-status-lifecycle-check.js +0 -1
  354. package/dist/scripts/qa-loop-budget-policy-check.js +0 -1
  355. package/dist/scripts/qa-loop-effort-escalation-check.js +0 -1
  356. package/dist/scripts/qa-loop-image-path-exposure-check.js +0 -1
  357. package/dist/scripts/qa-loop-image-path-prompt-injection-check.js +0 -1
  358. package/dist/scripts/release-cache-glob-hashing-check.js +0 -1
  359. package/dist/scripts/release-cache-input-classifier-check.js +0 -1
  360. package/dist/scripts/release-cache-neutralization-report-check.js +0 -1
  361. package/dist/scripts/release-cache-version-neutral-fixture-check.js +0 -1
  362. package/dist/scripts/release-check-stamp.js +0 -4
  363. package/dist/scripts/release-dist-freshness-check.js +0 -1
  364. package/dist/scripts/release-full-parallelism-blackbox.js +3 -3
  365. package/dist/scripts/release-gate-batch-runner-check.js +22 -0
  366. package/dist/scripts/release-gate-budget-check.js +0 -6
  367. package/dist/scripts/release-gate-dag-runner-check.js +0 -1
  368. package/dist/scripts/release-latency-slo-check.js +0 -1
  369. package/dist/scripts/release-metadata-1-19-check.js +0 -1
  370. package/dist/scripts/release-metadata-check.js +0 -3
  371. package/dist/scripts/release-parallel-speed-budget-check.js +0 -5
  372. package/dist/scripts/release-proof-truth-check.js +0 -1
  373. package/dist/scripts/release-provenance-check.js +0 -1
  374. package/dist/scripts/release-real-check.js +0 -1
  375. package/dist/scripts/release-runtime-truth-matrix-check.js +0 -1
  376. package/dist/scripts/release-version-truth-check.js +0 -1
  377. package/dist/scripts/research-blueprint-densifier-check.js +0 -1
  378. package/dist/scripts/research-claim-builder-check.js +0 -1
  379. package/dist/scripts/research-complete-package-fixture-check.js +0 -1
  380. package/dist/scripts/research-final-reviewer-blackbox.js +0 -1
  381. package/dist/scripts/responses-retry-policy-centralized-check.js +0 -1
  382. package/dist/scripts/retention-apply-smoke-check.js +0 -1
  383. package/dist/scripts/retention-budget-check.js +0 -1
  384. package/dist/scripts/retention-dry-run-check.js +0 -1
  385. package/dist/scripts/rollback-recovery-smoke-check.js +0 -1
  386. package/dist/scripts/route-intent-regression-check.js +0 -1
  387. package/dist/scripts/runtime-current-terminal-check.js +0 -1
  388. package/dist/scripts/runtime-dist-parity-check.js +0 -1
  389. package/dist/scripts/runtime-no-src-mjs-check.js +0 -1
  390. package/dist/scripts/runtime-proof-summary-check.js +0 -1
  391. package/dist/scripts/runtime-ts-rust-boundary-check.js +0 -15
  392. package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -1
  393. package/dist/scripts/scheduler-batch-dispatch-check.js +0 -1
  394. package/dist/scripts/scheduler-parallel-proof-consistency-check.js +0 -1
  395. package/dist/scripts/scheduler-utilization-integral-check.js +0 -1
  396. package/dist/scripts/search-visibility-gate-lib.js +0 -1
  397. package/dist/scripts/seo-audit-fixture-check.js +0 -1
  398. package/dist/scripts/seo-cli-blackbox-check.js +0 -1
  399. package/dist/scripts/seo-geo-geo-disambiguation-check.js +0 -1
  400. package/dist/scripts/seo-geo-route-identity-check.js +0 -1
  401. package/dist/scripts/seo-geo-skill-rich-content-check.js +0 -1
  402. package/dist/scripts/seo-marketing-truthfulness-check.js +0 -1
  403. package/dist/scripts/seo-metadata-sync-check.js +0 -1
  404. package/dist/scripts/seo-no-mutation-by-default-check.js +0 -1
  405. package/dist/scripts/shared-memory-fixture-check.js +0 -1
  406. package/dist/scripts/side-effect-runtime-report-check.js +0 -1
  407. package/dist/scripts/sizecheck.js +0 -1
  408. package/dist/scripts/sks-1-11-gate-lib.js +0 -1
  409. package/dist/scripts/sks-1-12-real-execution-check-lib.js +0 -1
  410. package/dist/scripts/sks-1-18-gate-lib.js +0 -1
  411. package/dist/scripts/sks-menubar-install-check.js +0 -3
  412. package/dist/scripts/sksd-daemon-check.js +0 -1
  413. package/dist/scripts/super-search-live-smoke-check.js +0 -1
  414. package/dist/scripts/super-search-local-http-smoke-check.js +0 -1
  415. package/dist/scripts/super-search-offline-contract-check.js +0 -1
  416. package/dist/scripts/super-search-provider-interface-check.js +0 -1
  417. package/dist/scripts/triwiki-cache-key-check.js +0 -1
  418. package/dist/scripts/triwiki-proof-bank-blackbox.js +0 -1
  419. package/dist/scripts/triwiki-proof-bank-check.js +0 -1
  420. package/dist/scripts/triwiki-proof-card-check.js +0 -1
  421. package/dist/scripts/trust-fixture-check.js +0 -1
  422. package/dist/scripts/ultra-router-auto-router-check.js +0 -1
  423. package/dist/scripts/update-fastpath-check.js +0 -1
  424. package/dist/scripts/upgrade-migration-matrix-check.js +0 -1
  425. package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +0 -1
  426. package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -1
  427. package/dist/scripts/ux-review-patch-diff-recheck-check.js +0 -1
  428. package/dist/scripts/ux-review-real-imagegen-smoke-check.js +0 -1
  429. package/dist/scripts/ux-review-run-wires-imagegen-check.js +0 -1
  430. package/dist/scripts/write-build-manifest.js +0 -1
  431. package/dist/scripts/wrongness-fixture-check.js +0 -1
  432. package/dist/scripts/zellij-capability-check.js +0 -1
  433. package/dist/scripts/zellij-developer-controls-check.js +0 -1
  434. package/dist/scripts/zellij-doctor-readiness-check.js +0 -13
  435. package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +0 -1
  436. package/dist/scripts/zellij-fake-adapter-check.js +0 -1
  437. package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -1
  438. package/dist/scripts/zellij-lane-renderer-check.js +0 -1
  439. package/dist/scripts/zellij-launch-command-truth-check.js +0 -12
  440. package/dist/scripts/zellij-layout-valid-check.js +0 -1
  441. package/dist/scripts/zellij-pane-creation-lock-metrics-check.js +0 -1
  442. package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -1
  443. package/dist/scripts/zellij-pane-lock-does-not-block-worker-check.js +0 -1
  444. package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -1
  445. package/dist/scripts/zellij-pane-proof-check.js +0 -1
  446. package/dist/scripts/zellij-qa-app-handoff-status-check.js +0 -1
  447. package/dist/scripts/zellij-real-session-cleanup-check.js +0 -1
  448. package/dist/scripts/zellij-real-session-launch-check.js +0 -1
  449. package/dist/scripts/zellij-right-column-geometry-proof.js +0 -1
  450. package/dist/scripts/zellij-right-column-headless-overflow-check.js +0 -1
  451. package/dist/scripts/zellij-right-column-manager-check.js +0 -1
  452. package/dist/scripts/zellij-screen-proof-check.js +0 -1
  453. package/dist/scripts/zellij-slot-only-ui-check.js +0 -1
  454. package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -1
  455. package/dist/scripts/zellij-slot-pane-stale-detection-check.js +0 -7
  456. package/dist/scripts/zellij-slot-telemetry-incremental-check.js +0 -1
  457. package/dist/scripts/zellij-slot-telemetry-live-flush-check.js +0 -1
  458. package/dist/scripts/zellij-slot-telemetry-performance-check.js +0 -1
  459. package/dist/scripts/zellij-stacked-capability-routing-check.js +0 -1
  460. package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -1
  461. package/dist/scripts/zellij-stacked-version-matrix-check.js +0 -1
  462. package/dist/scripts/zellij-stacked-version-parser-check.js +0 -1
  463. package/dist/scripts/zellij-ui-design-check.js +0 -12
  464. package/dist/scripts/zellij-update-prompt-matrix-check.js +0 -1
  465. package/dist/scripts/zellij-update-prompt-mode-check.js +0 -1
  466. package/dist/scripts/zellij-update-prompt-safety-check.js +0 -1
  467. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -2
  468. package/package.json +1 -1
@@ -4,25 +4,10 @@ import { spawnSync } from 'node:child_process';
4
4
  import { resolveExpectedArtifactPath } from './feature-fixture-runner.js';
5
5
  import { findLatestMission } from './mission.js';
6
6
  const FIXTURE_COMMAND_TIMEOUT_MS = 60_000;
7
- /** Per-fixture override, set via the fixture()'s `extra.timeout_ms` for commands
8
- * that are legitimately slower than the 60s default (real agent/runtime orchestration,
9
- * multi-step pipelines) rather than actually hung. */
10
7
  function fixtureTimeoutMs(fixture) {
11
8
  const override = Number(fixture?.timeout_ms);
12
9
  return Number.isFinite(override) && override > 0 ? override : FIXTURE_COMMAND_TIMEOUT_MS;
13
10
  }
14
- /**
15
- * Actually spawns a feature fixture's declared `command` string (safely tokenized,
16
- * no shell interpolation) for `execute` / `execute_and_validate_artifacts` fixtures,
17
- * checks the real exit code, validates any expected_artifacts that were declared
18
- * (string path or { path, schema } object form), and derives a real pass/fail status
19
- * from what actually happened rather than trusting fixture.status.
20
- *
21
- * This is distinct from runFeatureFixture() in feature-fixture-runner.ts, which only
22
- * executes fixtures present in an explicit safe-args allowlist. This function executes
23
- * whatever the fixture itself declares as its command, so it must tokenize defensively
24
- * and never hand a raw string to a shell.
25
- */
26
11
  export async function runFeatureFixture(feature, { root = process.cwd() } = {}) {
27
12
  const id = feature?.id || feature?.featureId || 'unknown';
28
13
  const fixture = feature?.fixture || feature || {};
@@ -75,14 +60,6 @@ export async function runFeatureFixture(feature, { root = process.cwd() } = {})
75
60
  });
76
61
  const timedOut = spawnResult.error?.code === 'ETIMEDOUT';
77
62
  const exitOk = !timedOut && spawnResult.status === 0;
78
- // Most fixture commands create a fresh, uniquely-IDed mission and write their
79
- // expected artifacts (completion-proof.json, <route>-gate.json, ...) inside that
80
- // mission's own directory, not at the project root. Without a mission id,
81
- // resolveExpectedArtifactPath() falls back to root-relative resolution and every
82
- // such artifact is reported "missing" even when the command succeeded. Prefer the
83
- // mission id the command itself printed in its --json stdout (unambiguous, immune
84
- // to races with unrelated concurrent sessions on a shared machine); only fall back
85
- // to a filesystem mtime scan if the command's own output didn't carry one.
86
63
  const missionIdFromOutput = extractMissionId(spawnResult.stdout);
87
64
  const latestMissionId = missionIdFromOutput
88
65
  ?? (kind === 'execute_and_validate_artifacts' ? await findLatestMission(root).catch(() => null) : null);
@@ -99,16 +76,6 @@ export async function runFeatureFixture(feature, { root = process.cwd() } = {})
99
76
  blockers.push(...artifactFailures);
100
77
  const ok = blockers.length === 0;
101
78
  const actualStatus = ok ? 'pass' : 'blocked';
102
- // "ok" (the ultimate pass/fail signal selftest --real counts) must mean "the
103
- // registry's claimed status matches reality" - NOT "the underlying command exited
104
- // 0" - those are different questions. Several fixtures intentionally run a
105
- // command that always exits non-zero by design (an honest mock/blocked
106
- // demonstration, per the execution_class:'mock_fixture' hardening elsewhere in
107
- // this codebase); such a fixture correctly declaring claimed_status:'blocked' is
108
- // a PASSING self-consistency check, not a failure, even though blockers still
109
- // faithfully records the real command_exit_N/artifact issues for anyone auditing
110
- // what actually happened. Only an actual mismatch between claim and reality is a
111
- // real fixture-registry defect worth failing selftest --real over.
112
79
  const statusMatches = !claimedStatus || claimedStatus === actualStatus;
113
80
  if (!statusMatches) {
114
81
  blockers.push(`${id}:fixture_status_claim_mismatch:claimed=${claimedStatus}:actual=${actualStatus}`);
@@ -141,13 +108,6 @@ export async function runFeatureFixture(feature, { root = process.cwd() } = {})
141
108
  resolved_mission_id: latestMissionId
142
109
  };
143
110
  }
144
- /**
145
- * Pulls a mission id out of a command's JSON stdout. Handles the common field
146
- * names/shapes used across sks commands (`mission_id`, `missionId`, a top-level
147
- * `id` that matches the `M-<timestamp>-<suffix>` pattern, or a nested `mission.id`),
148
- * and tolerates stdout that has trailing non-JSON log lines by scanning for the
149
- * last parseable JSON object.
150
- */
151
111
  function extractMissionId(stdout) {
152
112
  if (!stdout)
153
113
  return null;
@@ -160,15 +120,12 @@ function extractMissionId(stdout) {
160
120
  candidates.push(JSON.parse(trimmed));
161
121
  }
162
122
  catch {
163
- // not a standalone JSON line; the payload may still be a multi-line pretty-printed
164
- // object, handled by the whole-stdout attempt below.
165
123
  }
166
124
  }
167
125
  try {
168
126
  candidates.push(JSON.parse(stdout));
169
127
  }
170
128
  catch {
171
- // pretty-printed JSON mixed with other stdout; ignore.
172
129
  }
173
130
  const missionIdPattern = /^M-\d{8}-\d{6}-[a-z0-9]+$/i;
174
131
  for (const parsed of candidates.reverse()) {
@@ -282,11 +239,6 @@ function resolveSksEntrypoint(root) {
282
239
  const found = candidates.find((candidate) => fs.existsSync(candidate));
283
240
  return found ?? candidates[0] ?? path.resolve('dist', 'bin', 'sks.js');
284
241
  }
285
- /**
286
- * Minimal, defensive command-line tokenizer: splits on whitespace while respecting
287
- * single and double quotes. Never passed to a shell — used purely to build a spawnSync
288
- * argv array, so shell metacharacters inside tokens are inert.
289
- */
290
242
  export function tokenizeCommand(command) {
291
243
  const tokens = [];
292
244
  let current = '';
@@ -51,11 +51,6 @@ const FIXTURES = Object.freeze({
51
51
  'cli-versioning': fixture('execute', 'sks versioning status --json', [], 'pass'),
52
52
  'cli-aliases': fixture('execute', 'sks aliases', [], 'pass'),
53
53
  'cli-fix-path': fixture('execute', 'sks fix-path --json', [], 'pass'),
54
- // selftest --real executes this fixture directly against this real repo (no
55
- // hermetic isolation for execute/execute_and_validate_artifacts fixtures - see
56
- // feature-fixture-executor.ts), so a real full scan (~79 modules) needs a
57
- // realistic budget; the 8000 default is sized for smaller/typical repos, not
58
- // this one, so pass an explicit larger budget rather than lowering the gate.
59
54
  'cli-wiki-code': fixture('execute_and_validate_artifacts', 'sks wiki refresh --code --token-budget 20000 --json', [{ path: '.sneakoscope/wiki/code-pack.json', schema: 'sks.code-pack.v1', optional: true }], 'pass'),
60
55
  'cli-agent-bridge': fixture('execute_and_validate_artifacts', 'sks agent-bridge setup --json', [{ path: '.sneakoscope/agent-bridge/manifest.json', schema: 'sks.agent-manifest.v1', optional: true }], 'pass'),
61
56
  'cli-mcp-server': fixture('execute', 'sks mcp-server --probe', [], 'pass'),
package/dist/core/fsx.js CHANGED
@@ -61,6 +61,17 @@ export async function exists(p) {
61
61
  return false;
62
62
  }
63
63
  }
64
+ export async function canonicalFilesystemPath(p) {
65
+ const resolved = path.resolve(p);
66
+ return fsp.realpath(resolved).catch(() => resolved);
67
+ }
68
+ export async function sameFilesystemPath(left, right) {
69
+ const [leftCanonical, rightCanonical] = await Promise.all([
70
+ canonicalFilesystemPath(left),
71
+ canonicalFilesystemPath(right)
72
+ ]);
73
+ return leftCanonical === rightCanonical;
74
+ }
64
75
  export async function ensureDir(p) {
65
76
  await fsp.mkdir(p, { recursive: true });
66
77
  }
@@ -85,8 +96,6 @@ export async function writeTextAtomic(p, text, opts = {}) {
85
96
  await fsp.chmod(p, opts.mode & 0o777);
86
97
  return;
87
98
  }
88
- // Replace symlink or non-regular targets atomically below. Never chmod
89
- // through a link merely because its current contents happen to match.
90
99
  }
91
100
  }
92
101
  catch { }
@@ -125,14 +134,6 @@ export async function writeTextAtomic(p, text, opts = {}) {
125
134
  }
126
135
  }
127
136
  }
128
- // A non-atomic direct write is only justified when the atomic rename itself
129
- // is physically impossible (EXDEV: tmp and target span different devices,
130
- // e.g. an unusual bind-mount) — the rename already fsync'd the tmp file's
131
- // contents, so a direct write there just relocates already-durable bytes.
132
- // The other codes previously here (EACCES/EEXIST/ENOENT/ENOTEMPTY/EPERM)
133
- // have nothing to do with cross-device limits and used to quietly downgrade
134
- // every one of those failures to a non-atomic write, risking a partially
135
- // written file on crash (20차 P1-6) — they now propagate instead.
136
137
  function canFallbackToDirectWrite(err) {
137
138
  return errorCode(err) === 'EXDEV';
138
139
  }
@@ -469,8 +470,6 @@ function installProcessGroupLifecycleHandlers() {
469
470
  return;
470
471
  processGroupLifecycleHandlersInstalled = true;
471
472
  process.on('exit', terminateRegisteredProcessGroups);
472
- // Run before existing once listeners remove themselves so rawListeners still
473
- // reflects whether Node's default signal termination was already suppressed.
474
473
  process.prependListener('SIGHUP', handleParentSighup);
475
474
  process.prependListener('SIGINT', handleParentSigint);
476
475
  process.prependListener('SIGTERM', handleParentSigterm);
@@ -1,9 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { exists, readJson } from '../fsx.js';
3
3
  import { inspectCodePackHeadFreshness } from '../triwiki/code-pack-head-freshness.js';
4
- /** Returns a bounded, non-blocking stale-code-pack note for user-prompt-submit.
5
- * It stays silent when no pack exists or freshness is inconclusive, never regenerates
6
- * the pack, and treats metadata-only follow-up commits as fresh. */
7
4
  export async function codePackFreshnessNote(root, opts = {}) {
8
5
  const budgetMs = Math.max(1, opts.budgetMs ?? 750);
9
6
  const gitTimeoutMs = Math.max(1, budgetMs - 50);
@@ -15,8 +12,6 @@ async function computeNote(root, gitTimeoutMs) {
15
12
  return null;
16
13
  const pack = await readJson(packPath, null).catch(() => null);
17
14
  const packSha = pack?.git_head_sha || null;
18
- // A pack with no recorded sha (non-git build) can't be compared; stay silent
19
- // rather than nag with a comparison we can't actually make.
20
15
  if (!packSha)
21
16
  return null;
22
17
  const freshness = await inspectCodePackHeadFreshness(root, packSha, {
@@ -0,0 +1,202 @@
1
+ import path from 'node:path';
2
+ import { readJson } from '../fsx.js';
3
+ import { missionDir, validateExternallyReservedMissionId } from '../mission.js';
4
+ import { routePrompt } from '../pipeline.js';
5
+ import { allowlistedManagedRouteSkillNames, dollarCommand, INVALID_EXPLICIT_MANAGED_SKILL_NAME, managedSkillNamesForPrompt, routeRequiresSubagents, stripVisibleDecisionAnswerBlocks } from '../routes.js';
6
+ import { inspectConfinedPath } from '../managed-path-safety.js';
7
+ import { renderAuthoritativeSksSkillContext, resolveAuthoritativeSksSkillSources } from '../codex-native/sks-skill-paths.js';
8
+ import { looksLikeActiveContinuationPrompt } from './naruto-decision-gate.js';
9
+ import { extractUserPrompt, looksLikeCodexGitAction, looksLikeCodexUiSettingsEvent } from './payload-signals.js';
10
+ const STANDALONE_PARENT_BASE_SKILLS = [
11
+ 'sks-naruto',
12
+ 'sks-pipeline-runner',
13
+ 'sks-prompt-pipeline',
14
+ 'sks-honest-mode'
15
+ ];
16
+ export async function attachAuthoritativeSksSkillContext(root, state, payload, result) {
17
+ if (result?.decision === 'block' || result?.sksTaskProfile === 'passthrough')
18
+ return result;
19
+ if (looksLikeCodexGitAction(payload) || looksLikeCodexUiSettingsEvent(payload))
20
+ return result;
21
+ const prompt = stripVisibleDecisionAnswerBlocks(extractUserPrompt(payload));
22
+ if (!dollarCommand(prompt) && routeIsGitOnly(routePrompt(prompt)))
23
+ return result;
24
+ const skillNames = result?.attached_parent_mission_id
25
+ ? await standaloneParentManagedSkillNames(root, result.attached_parent_mission_id, state)
26
+ : selectedSksSkillNamesForTurn(state, prompt, result);
27
+ if (!skillNames.length)
28
+ return result;
29
+ const admission = await authoritativeSksSkillAdmission(root, skillNames);
30
+ if (admission.blocked)
31
+ return { ...result, ...admission.blocked };
32
+ const resolution = admission.resolution;
33
+ if (!resolution)
34
+ return result;
35
+ const skillContext = renderAuthoritativeSksSkillContext(resolution);
36
+ if (!skillContext)
37
+ return result;
38
+ return {
39
+ ...result,
40
+ additionalContext: [result?.additionalContext, skillContext].filter(Boolean).join('\n\n')
41
+ };
42
+ }
43
+ export async function standaloneParentManagedSkillNames(root, missionId, state = {}) {
44
+ const boundedMissionId = String(missionId || '').trim();
45
+ if (!boundedMissionId)
46
+ return [...STANDALONE_PARENT_BASE_SKILLS];
47
+ const validatedMissionId = validateExternallyReservedMissionId(boundedMissionId);
48
+ if (!validatedMissionId.ok) {
49
+ return [...STANDALONE_PARENT_BASE_SKILLS, INVALID_EXPLICIT_MANAGED_SKILL_NAME];
50
+ }
51
+ const canonicalMissionId = validatedMissionId.id;
52
+ const stateSkills = String(state?.mission_id || '') === canonicalMissionId
53
+ ? allowlistedManagedRouteSkillNames(state?.required_skills)
54
+ : [];
55
+ const routeContext = await readStandaloneParentRouteContext(root, canonicalMissionId);
56
+ const contextSkills = allowlistedManagedRouteSkillNames(routeContext?.required_skills);
57
+ return Array.from(new Set([
58
+ ...stateSkills,
59
+ ...contextSkills,
60
+ ...STANDALONE_PARENT_BASE_SKILLS
61
+ ]));
62
+ }
63
+ async function readStandaloneParentRouteContext(root, missionId) {
64
+ const file = path.join(missionDir(root, missionId), 'route-context.json');
65
+ try {
66
+ const inspection = await inspectConfinedPath(path.resolve(root), path.resolve(file));
67
+ if (!inspection.exists || inspection.leafSymlink || !inspection.stat?.isFile())
68
+ return null;
69
+ return await readJson(file, null).catch(() => null);
70
+ }
71
+ catch {
72
+ return null;
73
+ }
74
+ }
75
+ export async function authoritativeSksSkillAdmission(root, skillNames) {
76
+ const resolution = await resolveAuthoritativeSksSkillSources({ root, skillNames }).catch(() => null);
77
+ if (!resolution) {
78
+ return {
79
+ resolution: null,
80
+ blocked: {
81
+ decision: 'block',
82
+ reason: 'SKS managed skill resolution failed. Repair the global SKS installation, then retry.',
83
+ systemMessage: 'SKS: managed skill availability check blocked this turn.'
84
+ }
85
+ };
86
+ }
87
+ if (resolution.unresolved.length || resolution.blockers.length) {
88
+ const details = [
89
+ resolution.unresolved.length ? `unavailable=${resolution.unresolved.join(',')}` : '',
90
+ resolution.blockers.length ? `rejected=${resolution.blockers.join(',')}` : ''
91
+ ].filter(Boolean).join('; ');
92
+ return {
93
+ resolution,
94
+ blocked: {
95
+ decision: 'block',
96
+ reason: `SKS managed skill availability check failed (${details}). Repair the global SKS installation, then retry.`,
97
+ systemMessage: 'SKS: managed skill availability check blocked this turn.'
98
+ }
99
+ };
100
+ }
101
+ return { resolution, blocked: null };
102
+ }
103
+ function selectedSksSkillNamesForTurn(state, prompt, result) {
104
+ if (result?.attached_parent_mission_id)
105
+ return [...STANDALONE_PARENT_BASE_SKILLS];
106
+ const active = state?.mission_id && state?.route_closed !== true
107
+ && (looksLikeActiveContinuationPrompt(prompt) || isBlockingClarificationAwaiting(state));
108
+ if (active) {
109
+ const activeSkills = selectedSksSkillNamesForActiveState(state);
110
+ if (activeSkills.length)
111
+ return activeSkills;
112
+ }
113
+ const selectedRoute = routePrompt(prompt);
114
+ const selectedSkills = managedSkillNamesForPrompt(selectedRoute, prompt);
115
+ if (selectedSkills.length)
116
+ return selectedSkills;
117
+ return result?.sksTaskProfile === 'answer' ? ['answer', 'honest-mode'] : [];
118
+ }
119
+ export function selectedSksSkillNamesForActiveState(state) {
120
+ const persisted = Array.isArray(state?.required_skills) ? state.required_skills : [];
121
+ if (persisted.length)
122
+ return persisted.map(String);
123
+ const activeRoute = routePrompt(String(state?.route_command || state?.route || state?.mode || ''));
124
+ return activeRoute?.requiredSkills?.length ? activeRoute.requiredSkills.map(String) : [];
125
+ }
126
+ function activeSksSkillNames(state) {
127
+ if (!state?.mission_id || state?.route_closed === true)
128
+ return [];
129
+ return selectedSksSkillNamesForActiveState(state);
130
+ }
131
+ export async function activeAuthoritativeSksSkillRefresh(root, state) {
132
+ const skillNames = activeSksSkillNames(state);
133
+ if (!skillNames.length)
134
+ return { context: '', blocked: null };
135
+ const admission = await authoritativeSksSkillAdmission(root, skillNames);
136
+ if (admission.blocked)
137
+ return { context: '', blocked: admission.blocked };
138
+ return {
139
+ context: admission.resolution ? renderAuthoritativeSksSkillContext(admission.resolution) : '',
140
+ blocked: null
141
+ };
142
+ }
143
+ export async function hookActiveSkillContextRefresh(root, state, name) {
144
+ if (name !== 'session-start') {
145
+ if (!activeSksSkillNames(state).length)
146
+ return { continue: true };
147
+ return {
148
+ continue: true,
149
+ systemMessage: 'SKS will refresh active managed-skill paths from the current installation on compact resume and reverify them before the next tool call.'
150
+ };
151
+ }
152
+ const refresh = await activeAuthoritativeSksSkillRefresh(root, state);
153
+ if (refresh.blocked) {
154
+ return {
155
+ continue: true,
156
+ systemMessage: 'SKS managed skill refresh could not verify the current installation. Do not use a stale skill location; the next active tool call will be denied until the installation is repaired.'
157
+ };
158
+ }
159
+ if (!refresh.context)
160
+ return { continue: true };
161
+ return { continue: true, additionalContext: refresh.context, silent: true };
162
+ }
163
+ export function routeBypassesActiveContext(route = null) {
164
+ return ['DFix', 'Answer', 'Commit', 'CommitAndPush', 'Wiki', 'ComputerUse'].includes(String(route?.id || ''));
165
+ }
166
+ export function routeIsGitOnly(route = null) {
167
+ return ['Commit', 'CommitAndPush'].includes(String(route?.id || ''));
168
+ }
169
+ export function shouldPrepareFreshRouteOnActivePrompt(prompt, route = null, opts = {}) {
170
+ if (!route || opts.command || opts.bypassActiveRoute || opts.goalOverlay)
171
+ return false;
172
+ if (looksLikeActiveContinuationPrompt(prompt))
173
+ return false;
174
+ return routeRequiresSubagents(route, prompt);
175
+ }
176
+ function isClarificationAwaiting(state = {}) {
177
+ const phase = String(state.phase || '');
178
+ const stopGate = String(state.stop_gate || '');
179
+ const gateAwaiting = phase.includes('CLARIFICATION_AWAITING_ANSWERS') || stopGate === 'clarification-gate';
180
+ if (!gateAwaiting || !state?.mission_id)
181
+ return false;
182
+ if (state.ambiguity_gate_required !== true || state.ambiguity_gate_passed === true)
183
+ return false;
184
+ return Boolean(state.clarification_required || state.implementation_allowed === false);
185
+ }
186
+ export function isBlockingClarificationAwaiting(state = {}) {
187
+ return isClarificationAwaiting(state);
188
+ }
189
+ export function looksLikeClarificationCancel(prompt = '') {
190
+ return /^(cancel|reset|restart|new mission|새로|취소|중단|리셋|다시 시작)\b/i.test(String(prompt || '').trim());
191
+ }
192
+ export function activeGoalOverlayContext(state = {}, route = null) {
193
+ if (state.mode !== 'GOAL' || !state.mission_id)
194
+ return '';
195
+ if (!route || route.id === 'Goal' || route.id === 'DFix' || route.id === 'Answer')
196
+ return '';
197
+ return [
198
+ `Legacy SKS Goal state ${state.mission_id} is non-authoritative and must not be updated.`,
199
+ `Do not let it hijack this new ${route.command || '$SKS'} prompt. The newly prepared route mission and gate are authoritative for this turn.`,
200
+ 'Codex native Goal is the only persisted Goal owner; use native controls only when the user explicitly returns to Goal.'
201
+ ].join('\n');
202
+ }
@@ -1,10 +1,3 @@
1
- // Deliberately minimal dependency surface (just fsx.js + the lightweight
2
- // codex-compat output builders) — hooks-runtime.ts re-exports these, but
3
- // the daemon-accelerated hook dispatch (sksd-hook-dispatch.ts) imports
4
- // straight from here so a daemon-warm hook call never pays the cost of
5
- // loading hooks-runtime.ts's full ~20-module dependency graph (pipeline,
6
- // mission, db-safety, harness-guard, ...) just to read stdin and shape the
7
- // response (20차 P2-1).
8
1
  import { readStdin } from '../fsx.js';
9
2
  import { buildCompactContinue, buildPermissionRequestAllow, buildPermissionRequestDeny, buildPostToolUseBlock, buildPostToolUseContinue, buildPreToolUseContinue, buildPreToolUseDeny, buildSessionStartContinue, buildStopBlock, buildStopContinue, buildSubagentStartContinue, buildSubagentStopBlock, buildSubagentStopContinue, buildUserPromptSubmitBlock, buildUserPromptSubmitContinue } from '../codex-compat/codex-hook-output-builders.js';
10
3
  export async function loadHookPayload() {
@@ -19,10 +12,6 @@ export async function loadHookPayload() {
19
12
  export function normalizeHookResult(name, result = {}) {
20
13
  const eventName = codexHookEventName(name);
21
14
  const out = { ...result };
22
- // Project and legacy user-level SKS hooks can briefly coexist during an
23
- // upgrade. The runtime owner performs the work once; duplicate invocations
24
- // must be silent so Codex does not inject the same route or Stop feedback
25
- // twice into one turn.
26
15
  if (out.suppressedDuplicate === true)
27
16
  return { continue: true };
28
17
  const systemMessage = out.silent === true
@@ -43,7 +32,7 @@ export function normalizeHookResult(name, result = {}) {
43
32
  if (out.decision === 'block' || out.permissionDecision === 'deny' || out.decision === 'deny') {
44
33
  return buildPreToolUseDeny(reason, { systemMessage });
45
34
  }
46
- return buildPreToolUseContinue({ systemMessage });
35
+ return buildPreToolUseContinue({ additionalContext: out.additionalContext, systemMessage });
47
36
  }
48
37
  if (eventName === 'PermissionRequest') {
49
38
  if (out.decision === 'deny' || out.permissionDecision === 'deny') {
@@ -24,8 +24,6 @@ export async function consumeLightTurnStopBypass(root, input) {
24
24
  const receipt = await readJson(file, null).catch(() => null);
25
25
  if (!receipt)
26
26
  return { accepted: false, receipt: null, reason: 'receipt_missing' };
27
- // A light receipt is single-use. Remove it before evaluating stale route
28
- // state so it can never become durable completion evidence or be replayed.
29
27
  await fsp.rm(file, { force: true }).catch(() => null);
30
28
  if (receipt.schema !== 'sks.light-turn.v1')
31
29
  return { accepted: false, receipt, reason: 'schema_mismatch' };
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { appendJsonlBounded, nowIso, sha256 } from '../fsx.js';
3
+ import { ensureConfinedDirectory } from '../managed-path-safety.js';
3
4
  import { codexHookEventName } from '../codex-compat/codex-hook-events.js';
4
5
  import { narutoDecisionForRoute, routeByDollarCommand, routeById, routePrompt, stripVisibleDecisionAnswerBlocks } from '../routes.js';
5
6
  import { classifyTaskProfile, isTaskProfile } from '../runtime/task-profile.js';
@@ -32,7 +33,9 @@ export async function evaluateHookNarutoDecisionGate(input) {
32
33
  };
33
34
  let recorded = true;
34
35
  try {
35
- await appendJsonlBounded(hookNarutoDecisionLogPath(input.root), row, HOOK_NARUTO_DECISION_LOG_MAX_BYTES);
36
+ const logPath = hookNarutoDecisionLogPath(input.root);
37
+ await ensureConfinedDirectory(path.resolve(input.root), path.dirname(logPath));
38
+ await appendJsonlBounded(logPath, row, HOOK_NARUTO_DECISION_LOG_MAX_BYTES);
36
39
  }
37
40
  catch {
38
41
  recorded = false;
@@ -0,0 +1,91 @@
1
+ import path from 'node:path';
2
+ import { nowIso, readJson, readText, sha256 } from '../fsx.js';
3
+ import { withFileLock } from '../locks/file-lock.js';
4
+ import { updateCurrentIfMissionAndRun } from '../mission.js';
5
+ import { maybeFinalizeRoute } from '../proof/auto-finalize.js';
6
+ import { validateRouteCompletionProof } from '../proof/route-proof-gate.js';
7
+ import { officialSubagentPreparationInProgress, withOfficialSubagentLifecycleLock } from '../subagents/official-subagent-preparation.js';
8
+ import { SUBAGENT_EVIDENCE_FILENAME, SUBAGENT_PARENT_SUMMARY_FILENAME } from '../subagents/subagent-evidence.js';
9
+ import { closeWorkOrderLedgerForRouteResult } from '../work-order-ledger.js';
10
+ export async function finalizeNarutoTerminalProof(root, state, sessionKey, dir, terminal) {
11
+ await withFileLock({
12
+ lockPath: path.join(dir, '.naruto-finalize.lock'),
13
+ timeoutMs: 5_000,
14
+ staleMs: 30_000
15
+ }, () => withOfficialSubagentLifecycleLock(dir, async () => {
16
+ if (await officialSubagentPreparationInProgress(dir))
17
+ return;
18
+ const [currentPlan, currentGate] = await Promise.all([
19
+ readJson(path.join(dir, 'subagent-plan.json'), null).catch(() => null),
20
+ readJson(path.join(dir, 'naruto-gate.json'), null).catch(() => null)
21
+ ]);
22
+ if (String(currentPlan?.workflow_run_id || '').trim() !== terminal.workflowRunId
23
+ || String(currentGate?.workflow_run_id || '').trim() !== terminal.workflowRunId
24
+ || currentGate?.passed !== true
25
+ || currentGate?.terminal !== true)
26
+ return;
27
+ let proofStatus = await currentNarutoProofStatus(root, terminal.missionId, terminal.workflowRunId, state);
28
+ if (!proofStatus.valid) {
29
+ const finalized = await maybeFinalizeRoute(root, {
30
+ missionId: terminal.missionId,
31
+ route: '$Naruto',
32
+ gateFile: 'naruto-gate.json',
33
+ gate: currentGate,
34
+ artifacts: [
35
+ { path: 'subagent-plan.json', kind: 'agent', source: 'real', ignoreStale: true },
36
+ { path: 'subagent-events.jsonl', kind: 'agent', source: 'real', ignoreStale: true },
37
+ { path: SUBAGENT_PARENT_SUMMARY_FILENAME, kind: 'agent', source: 'real', ignoreStale: true },
38
+ { path: SUBAGENT_EVIDENCE_FILENAME, kind: 'agent', source: 'real', ignoreStale: true },
39
+ { path: 'naruto-summary.json', kind: 'agent', source: 'real', ignoreStale: true },
40
+ { path: 'naruto-gate.json', kind: 'agent', source: 'real', ignoreStale: true }
41
+ ],
42
+ claims: [{ id: 'naruto-official-subagent-completion', status: 'supported', evidence: 'naruto-gate.json' }],
43
+ agents: true
44
+ });
45
+ if (finalized?.ok !== true) {
46
+ throw new Error(`naruto_terminal_proof_finalize_failed:${String(finalized?.validation?.issues?.join(',') || finalized?.status || 'unknown')}`);
47
+ }
48
+ proofStatus = await currentNarutoProofStatus(root, terminal.missionId, terminal.workflowRunId, state);
49
+ }
50
+ if (!proofStatus.valid)
51
+ throw new Error('naruto_terminal_proof_invalid_after_finalize');
52
+ await closeWorkOrderLedgerForRouteResult(dir, { ok: true });
53
+ await invalidateReflectionForNarutoProofOnce(root, state, sessionKey, terminal.workflowRunId, proofStatus.digest);
54
+ }));
55
+ }
56
+ async function currentNarutoProofStatus(root, missionId, workflowRunId, state) {
57
+ const validation = await validateRouteCompletionProof(root, {
58
+ missionId,
59
+ route: '$Naruto',
60
+ state: {
61
+ ...state,
62
+ mission_id: missionId,
63
+ subagents_required: true,
64
+ official_subagent_run_id: workflowRunId
65
+ }
66
+ }).catch(() => null);
67
+ const proofRunId = String(validation?.proof?.evidence?.route_gate?.workflow_run_id || '').trim();
68
+ const proofText = await readText(path.join(root, '.sneakoscope', 'missions', missionId, 'completion-proof.json'), '').catch(() => '');
69
+ return {
70
+ valid: validation?.ok === true && proofRunId === workflowRunId,
71
+ proof: validation?.proof || null,
72
+ digest: proofText ? `sha256:${sha256(proofText)}` : null
73
+ };
74
+ }
75
+ async function invalidateReflectionForNarutoProofOnce(root, state, sessionKey, workflowRunId, proofDigest) {
76
+ if (!workflowRunId || !proofDigest)
77
+ return;
78
+ const resolvedSessionKey = sessionKey || state?._session_key;
79
+ await updateCurrentIfMissionAndRun(root, state?.mission_id, workflowRunId, (current) => {
80
+ if (current?.reflection_invalidated_for_workflow_run_id === workflowRunId
81
+ && current?.reflection_invalidated_for_proof_digest === proofDigest)
82
+ return null;
83
+ return {
84
+ reflection_invalidation_required: true,
85
+ reflection_invalidated_at: nowIso(),
86
+ reflection_invalidation_reason: 'naruto_terminal_proof_committed',
87
+ reflection_invalidated_for_workflow_run_id: workflowRunId,
88
+ reflection_invalidated_for_proof_digest: proofDigest
89
+ };
90
+ }, { sessionKey: resolvedSessionKey });
91
+ }