sneakoscope 7.0.2 → 7.0.5

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 (598) hide show
  1. package/README.md +9 -7
  2. package/config/codex-releases/{rust-v0.144.5.json → rust-v0.145.0.json} +14 -8
  3. package/crates/sks-core/Cargo.lock +1 -1
  4. package/crates/sks-core/Cargo.toml +1 -1
  5. package/dist/bin/sks-dispatch.js +0 -3
  6. package/dist/cli/command-manifest-lite.js +1 -2
  7. package/dist/cli/command-registry.js +0 -4
  8. package/dist/cli/global-mode-router.js +5 -12
  9. package/dist/cli/install-helpers-codex-lb-chain.js +24 -2
  10. package/dist/cli/install-helpers-codex-lb-config.js +10 -25
  11. package/dist/cli/install-helpers-codex-lb-selftest-chain.js +0 -3
  12. package/dist/cli/install-helpers-codex-lb-selftest.js +0 -17
  13. package/dist/cli/install-helpers-install-support.js +1 -2
  14. package/dist/cli/install-helpers.js +83 -99
  15. package/dist/cli/router.js +22 -31
  16. package/dist/commands/codex-app.js +20 -2
  17. package/dist/commands/codex-lb.js +176 -22
  18. package/dist/commands/codex.js +3 -8
  19. package/dist/commands/conflicts.js +26 -3
  20. package/dist/commands/doctor.js +26 -31
  21. package/dist/commands/perf.js +5 -1
  22. package/dist/commands/zellij-slot-column-anchor.js +0 -2
  23. package/dist/commands/zellij-slot-pane.js +0 -7
  24. package/dist/commands/zellij.js +0 -2
  25. package/dist/config/skills-manifest.json +52 -52
  26. package/dist/core/agent-bridge/agent-manifest.js +192 -1
  27. package/dist/core/agent-bridge/agent-mode.js +0 -5
  28. package/dist/core/agent-bridge/host-capability-policy.js +189 -0
  29. package/dist/core/agent-bridge/host-capability-runtime.js +1395 -0
  30. package/dist/core/agent-bridge/mcp-server.js +1 -11
  31. package/dist/core/agents/agent-effort-policy.js +7 -10
  32. package/dist/core/agents/agent-orchestrator.js +0 -4
  33. package/dist/core/agents/agent-proof-evidence.js +0 -2
  34. package/dist/core/agents/agent-roster.js +6 -5
  35. package/dist/core/agents/agent-runner-ollama.js +0 -3
  36. package/dist/core/agents/agent-scheduler.js +7 -10
  37. package/dist/core/agents/agent-schema.js +3 -1
  38. package/dist/core/agents/agent-task-graph.js +4 -1
  39. package/dist/core/agents/agent-work-partition.js +4 -2
  40. package/dist/core/agents/native-cli-worker-runtime.js +5 -17
  41. package/dist/core/agents/work-partition/repo-inventory.js +0 -2
  42. package/dist/core/auto-review.js +8 -14
  43. package/dist/core/bench.js +0 -14
  44. package/dist/core/code-structure.js +0 -3
  45. package/dist/core/codex/agent-config-file-repair.js +0 -8
  46. package/dist/core/codex/codex-cli-update.js +122 -20
  47. package/dist/core/codex/codex-config-eperm-repair.js +0 -4
  48. package/dist/core/codex/codex-config-guard.js +0 -3
  49. package/dist/core/codex/codex-config-readability.js +0 -13
  50. package/dist/core/codex/codex-project-config-policy.js +0 -33
  51. package/dist/core/codex/codex-startup-config-postcheck.js +5 -0
  52. package/dist/core/codex/official-goal-mode.js +0 -2
  53. package/dist/core/codex-app/codex-agent-type-probe.js +31 -24
  54. package/dist/core/codex-app/codex-app-fast-ui-repair.js +5 -7
  55. package/dist/core/codex-app/codex-app-ui-state-snapshot.js +44 -7
  56. package/dist/core/codex-app/glm-model-profile.js +1 -1
  57. package/dist/core/codex-app/glm-profile-installer.js +40 -41
  58. package/dist/core/codex-app/glm-profile-schema.js +7 -11
  59. package/dist/core/codex-app/menubar/constants.js +1 -0
  60. package/dist/core/codex-app/menubar/launch-agent.js +37 -1
  61. package/dist/core/codex-app/openrouter-activate.js +152 -0
  62. package/dist/core/codex-app/openrouter-provider.js +82 -0
  63. package/dist/core/codex-app/sks-menubar.js +0 -1
  64. package/dist/core/codex-app.js +14 -32
  65. package/dist/core/codex-compat/codex-capability-matrix.js +208 -0
  66. package/dist/core/codex-compat/codex-hook-output-builders.js +9 -1
  67. package/dist/core/codex-compat/codex-hook-output-normalizer.js +1 -1
  68. package/dist/core/codex-compat/codex-hook-semantic-validator.js +3 -2
  69. package/dist/core/codex-compat/codex-hook-warning-detector.js +10 -2
  70. package/dist/core/codex-compat/codex-release-manifest.js +15 -8
  71. package/dist/core/codex-compat/codex-version-policy.js +77 -15
  72. package/dist/core/codex-control/codex-0144-capability.js +1 -1
  73. package/dist/core/codex-control/codex-lb-launch-recovery.js +0 -3
  74. package/dist/core/codex-control/codex-reliability-shield.js +0 -8
  75. package/dist/core/codex-control/codex-sdk-adapter.js +0 -3
  76. package/dist/core/codex-control/codex-sdk-config-policy.js +0 -2
  77. package/dist/core/codex-control/codex-sdk-env-policy.js +61 -16
  78. package/dist/core/codex-control/codex-task-runner.js +0 -7
  79. package/dist/core/codex-control/codex-thread-registry.js +0 -4
  80. package/dist/core/codex-lb/codex-lb-env.js +133 -24
  81. package/dist/core/codex-lb/codex-lb-tool-catalog.js +0 -4
  82. package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +1 -1
  83. package/dist/core/codex-model-guard.js +0 -14
  84. package/dist/core/codex-native/codex-native-feature-broker.js +67 -22
  85. package/dist/core/codex-native/codex-native-interop-policy.js +81 -9
  86. package/dist/core/codex-native/confined-report-writer.js +21 -0
  87. package/dist/core/codex-native/core-skill-integrity.js +169 -20
  88. package/dist/core/codex-native/project-skill-dedupe.js +55 -13
  89. package/dist/core/codex-native/skill-registry-ledger.js +137 -16
  90. package/dist/core/codex-native/sks-skill-paths.js +185 -0
  91. package/dist/core/codex-runtime/codex-desktop-config-policy.js +3 -3
  92. package/dist/core/commands/agent-bridge-command.js +28 -8
  93. package/dist/core/commands/basic-cli.js +89 -42
  94. package/dist/core/commands/bench-command.js +5 -1
  95. package/dist/core/commands/command-utils.js +0 -5
  96. package/dist/core/commands/image-ux-review-command.js +0 -9
  97. package/dist/core/commands/mad-sks-command.js +55 -208
  98. package/dist/core/commands/naruto-command.js +55 -21
  99. package/dist/core/commands/ppt-command.js +0 -9
  100. package/dist/core/commands/run-command.js +8 -2
  101. package/dist/core/commands/seo-command.js +0 -6
  102. package/dist/core/commands/wiki-command.js +0 -14
  103. package/dist/core/computer-use-live-evidence.js +0 -5
  104. package/dist/core/config/secret-preservation.js +0 -11
  105. package/dist/core/daemon/sksd-hook-daemon-entrypoint.js +0 -2
  106. package/dist/core/daemon/sksd-hook-daemon.js +1 -29
  107. package/dist/core/daemon/sksd-hook-dispatch.js +0 -17
  108. package/dist/core/db-safety.js +0 -7
  109. package/dist/core/doctor/browser-use-repair.js +0 -2
  110. package/dist/core/doctor/command-alias-cleanup.js +37 -9
  111. package/dist/core/doctor/current-project-guidance.js +6 -3
  112. package/dist/core/doctor/doctor-codex-startup-repair.js +0 -3
  113. package/dist/core/doctor/doctor-dirty-planner.js +1 -1
  114. package/dist/core/doctor/doctor-readiness-matrix.js +12 -0
  115. package/dist/core/doctor/doctor-skill-reconcile.js +32 -0
  116. package/dist/core/doctor/imagegen-repair.js +0 -2
  117. package/dist/core/doctor/mcp-transport-collision-repair.js +0 -3
  118. package/dist/core/doctor/retired-auto-review-config.js +9 -1
  119. package/dist/core/doctor/retired-managed-residue-private.js +5 -4
  120. package/dist/core/doctor/retired-managed-residue-runtime.js +9 -1
  121. package/dist/core/doctor/skill-legacy-surface.js +351 -0
  122. package/dist/core/doctor/supabase-mcp-repair.js +0 -11
  123. package/dist/core/evaluation.js +3 -0
  124. package/dist/core/feature-fixture-executor.js +0 -48
  125. package/dist/core/feature-fixtures.js +0 -6
  126. package/dist/core/fsx.js +11 -12
  127. package/dist/core/harness-conflicts.js +177 -18
  128. package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +0 -5
  129. package/dist/core/hooks-runtime/hook-context.js +202 -0
  130. package/dist/core/hooks-runtime/hook-io.js +1 -12
  131. package/dist/core/hooks-runtime/light-turn.js +0 -2
  132. package/dist/core/hooks-runtime/naruto-decision-gate.js +4 -1
  133. package/dist/core/hooks-runtime/naruto-terminal-finalization.js +91 -0
  134. package/dist/core/hooks-runtime/official-subagent-lifecycle.js +369 -0
  135. package/dist/core/hooks-runtime/standalone-parent-host-capability.js +98 -0
  136. package/dist/core/hooks-runtime/subagent-context.js +59 -0
  137. package/dist/core/hooks-runtime/subagent-skill-availability-contract.js +29 -0
  138. package/dist/core/hooks-runtime/subagent-skill-availability-evidence.js +195 -0
  139. package/dist/core/hooks-runtime/subagent-skill-availability-guards.js +316 -0
  140. package/dist/core/hooks-runtime/subagent-skill-availability.js +217 -0
  141. package/dist/core/hooks-runtime.js +275 -540
  142. package/dist/core/image-ux-review/codex-app-generated-image-discovery.js +0 -17
  143. package/dist/core/image-ux-review/imagegen-adapter.js +0 -14
  144. package/dist/core/imagegen/imagegen-auth-readiness.js +0 -9
  145. package/dist/core/imagegen/imagegen-capability.js +0 -3
  146. package/dist/core/init/managed-skill-install.js +42 -0
  147. package/dist/core/init/skills.js +248 -75
  148. package/dist/core/init.js +19 -45
  149. package/dist/core/lean-engineering-policy.js +0 -2
  150. package/dist/core/locks/file-lock.js +0 -21
  151. package/dist/core/loops/loop-planner.js +0 -6
  152. package/dist/core/loops/loop-runtime.js +0 -1
  153. package/dist/core/loops/loop-worker-runtime.js +0 -19
  154. package/dist/core/mad-sks/executors/db-write-executor.js +0 -4
  155. package/dist/core/mad-sks/executors/executor-base.js +0 -10
  156. package/dist/core/mad-sks/immutable-harness-guard.js +0 -5
  157. package/dist/core/mad-sks/sql-plane/coordinator.js +0 -5
  158. package/dist/core/mad-sks/sql-plane/ledger.js +0 -4
  159. package/dist/core/mad-sks/sql-plane/lock.js +0 -4
  160. package/dist/core/mad-sks/sql-plane/mcp-executor.js +0 -9
  161. package/dist/core/mad-sks/sql-plane/policy-resolver.js +0 -2
  162. package/dist/core/mad-sks/sql-plane/postconditions.js +0 -4
  163. package/dist/core/mad-sks/sql-plane/recovery.js +0 -2
  164. package/dist/core/mad-sks/sql-plane/runtime-profile.js +0 -8
  165. package/dist/core/managed-assets/managed-assets-manifest.js +1 -7
  166. package/dist/core/mcp-config/health-check.js +10 -3
  167. package/dist/core/migration/migration-transaction-journal.js +0 -8
  168. package/dist/core/mission.js +0 -2
  169. package/dist/core/naruto/naruto-active-pool.js +0 -2
  170. package/dist/core/naruto/naruto-concurrency-governor.js +18 -11
  171. package/dist/core/naruto/naruto-real-write-proof.js +0 -4
  172. package/dist/core/naruto/naruto-write-e2e.js +0 -1
  173. package/dist/core/perf/perf-budget.js +0 -5
  174. package/dist/core/permission-gates.js +0 -2
  175. package/dist/core/pipeline-internals/runtime-core.js +15 -5
  176. package/dist/core/pipeline-internals/runtime-gates.js +7 -19
  177. package/dist/core/preflight/parallel-preflight-engine.js +1 -12
  178. package/dist/core/proof/evidence-collector.js +0 -2
  179. package/dist/core/proof/route-finalizer.js +0 -1
  180. package/dist/core/proof/selftest-proof-fixtures.js +0 -5
  181. package/dist/core/providers/openrouter/openrouter-client.js +2 -2
  182. package/dist/core/providers/openrouter/openrouter-provider-health.js +1 -1
  183. package/dist/core/providers/{glm/glm-request-cache.js → openrouter/openrouter-request-cache.js} +5 -6
  184. package/dist/core/providers/openrouter/openrouter-secret-store.js +0 -1
  185. package/dist/core/providers/openrouter/openrouter-stream.js +2 -4
  186. package/dist/core/questions.js +3 -3
  187. package/dist/core/release/gate-manifest.js +0 -5
  188. package/dist/core/release/package-size-budget.js +2 -2
  189. package/dist/core/release/release-gate-batch-runner.js +11 -2
  190. package/dist/core/release/release-gate-cache-v2.js +0 -4
  191. package/dist/core/release/release-gate-contract.js +0 -7
  192. package/dist/core/release/release-gate-hermetic-env.js +0 -5
  193. package/dist/core/release/release-pack-receipt.js +1 -0
  194. package/dist/core/release-parallel-full-coverage.js +0 -2
  195. package/dist/core/remote/ssh-worker-client.js +0 -3
  196. package/dist/core/research/research-adversarial-review.js +6 -2
  197. package/dist/core/responses-retry-policy.js +0 -10
  198. package/dist/core/retention.js +0 -7
  199. package/dist/core/routes/constants.js +0 -3
  200. package/dist/core/routes/model-mode-router.js +10 -19
  201. package/dist/core/routes.js +91 -17
  202. package/dist/core/safety/command-contract/contracts.js +2 -0
  203. package/dist/core/safety/mutation-guard.js +0 -25
  204. package/dist/core/safety/mutation-ledger.js +0 -9
  205. package/dist/core/safety/requested-scope-contract.js +0 -0
  206. package/dist/core/security/high-risk-contracts.js +0 -1
  207. package/dist/core/skills/core-skill-card.js +0 -0
  208. package/dist/core/skills/core-skill-deployment.js +0 -13
  209. package/dist/core/skills/core-skill-epoch.js +0 -11
  210. package/dist/core/skills/core-skill-meta-update.js +0 -6
  211. package/dist/core/skills/core-skill-patch-apply.js +0 -7
  212. package/dist/core/skills/core-skill-patch.js +0 -8
  213. package/dist/core/skills/core-skill-reflection.js +0 -16
  214. package/dist/core/skills/core-skill-runtime.js +0 -6
  215. package/dist/core/skills/core-skill-scorer.js +0 -7
  216. package/dist/core/skills/core-skill-trainer.js +0 -11
  217. package/dist/core/skills/core-skill-types.js +0 -9
  218. package/dist/core/skills/core-skill-validation.js +0 -5
  219. package/dist/core/skills/rejected-skill-patch-buffer.js +0 -2
  220. package/dist/core/stop-gate/stop-gate-check.js +0 -8
  221. package/dist/core/stop-gate/stop-gate-resolver.js +0 -7
  222. package/dist/core/stop-gate/stop-gate-writer.js +0 -5
  223. package/dist/core/subagents/model-policy.js +0 -7
  224. package/dist/core/subagents/naruto-help-contract.js +3 -2
  225. package/dist/core/subagents/naruto-proof-projection.js +580 -12
  226. package/dist/core/subagents/official-subagent-config.js +256 -40
  227. package/dist/core/subagents/official-subagent-preparation.js +11 -7
  228. package/dist/core/subagents/official-subagent-prompt.js +29 -0
  229. package/dist/core/subagents/official-subagent-runner.js +379 -39
  230. package/dist/core/subagents/subagent-evidence.js +378 -9
  231. package/dist/core/subagents/terminology.js +11 -6
  232. package/dist/core/subagents/thread-budget.js +6 -3
  233. package/dist/core/subagents/triwiki-attention.js +0 -4
  234. package/dist/core/subagents/wave-parent-guidance.js +54 -9
  235. package/dist/core/telegram/runtime.js +0 -1
  236. package/dist/core/triwiki/code-index-scanner.js +0 -3
  237. package/dist/core/triwiki/code-pack-head-freshness.js +0 -10
  238. package/dist/core/triwiki/code-pack.js +0 -2
  239. package/dist/core/triwiki/triwiki-cache-key.js +0 -1
  240. package/dist/core/triwiki/triwiki-proof-bank.js +0 -1
  241. package/dist/core/triwiki-attention.js +0 -10
  242. package/dist/core/triwiki-provenance.js +0 -5
  243. package/dist/core/triwiki-runtime.js +0 -12
  244. package/dist/core/triwiki-wrongness/wrongness-ledger.js +0 -7
  245. package/dist/core/triwiki-wrongness/wrongness-schema.js +0 -3
  246. package/dist/core/trust-kernel/trust-report.js +0 -7
  247. package/dist/core/update/update-migration-state.js +113 -61
  248. package/dist/core/update-check.js +2 -14
  249. package/dist/core/version-manager.js +43 -4
  250. package/dist/core/version.js +1 -1
  251. package/dist/core/work-order-ledger.js +0 -17
  252. package/dist/core/zellij/zellij-clipboard-config.js +0 -18
  253. package/dist/core/zellij/zellij-fake-adapter.js +16 -0
  254. package/dist/core/zellij/zellij-lane-renderer.js +5 -46
  255. package/dist/core/zellij/zellij-lane-runtime.js +0 -1
  256. package/dist/core/zellij/zellij-launcher.js +35 -35
  257. package/dist/core/zellij/zellij-official-subagent-activity.js +0 -5
  258. package/dist/core/zellij/zellij-official-subagent-telemetry.js +0 -5
  259. package/dist/core/zellij/zellij-pane-proof.js +3 -3
  260. package/dist/core/zellij/zellij-screen-proof.js +0 -7
  261. package/dist/core/zellij/zellij-slot-column-anchor.js +0 -1
  262. package/dist/core/zellij/zellij-slot-pane-renderer.js +0 -9
  263. package/dist/core/zellij/zellij-slot-telemetry.js +6 -16
  264. package/dist/core/zellij/zellij-ui-mode.js +0 -7
  265. package/dist/core/zellij/zellij-update.js +0 -29
  266. package/dist/core/zellij/zellij-worker-pane-manager.js +0 -39
  267. package/dist/native/sks-menubar/Sources/DiagnosticsViewController.swift +61 -2
  268. package/dist/native/sks-menubar/Sources/MCPServersViewController.swift +10 -3
  269. package/dist/native/sks-menubar/Sources/OverviewViewController.swift +55 -3
  270. package/dist/native/sks-menubar/Sources/ProvidersOpenRouter.swift +76 -0
  271. package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +273 -54
  272. package/dist/native/sks-menubar/Sources/RemoteTelegramViewController.swift +5 -1
  273. package/dist/native/sks-menubar/Sources/SettingsViewController.swift +2 -2
  274. package/dist/native/sks-menubar/Sources/StatusItemController.swift +28 -2
  275. package/dist/native/sks-menubar/Sources/UpdatesViewController.swift +96 -13
  276. package/dist/scripts/agent-message-bus-reader-check.js +0 -1
  277. package/dist/scripts/all-feature-deep-completion-check.js +0 -1
  278. package/dist/scripts/appshots-thread-attachment-discovery-check.js +0 -1
  279. package/dist/scripts/architecture-guard-check.js +0 -1
  280. package/dist/scripts/build-dist.js +0 -1
  281. package/dist/scripts/build-once-runner-check.js +0 -1
  282. package/dist/scripts/canonical-test-runner.js +0 -2
  283. package/dist/scripts/certificate-sla-check.js +0 -1
  284. package/dist/scripts/changelog-check.js +0 -1
  285. package/dist/scripts/check-cli-entrypoint.js +0 -1
  286. package/dist/scripts/check-command-module-budget.js +0 -7
  287. package/dist/scripts/check-feature-quality.js +0 -1
  288. package/dist/scripts/check-legacy-free.js +0 -1
  289. package/dist/scripts/check-pipeline-runtime.js +0 -1
  290. package/dist/scripts/check-runtime-schemas.js +0 -1
  291. package/dist/scripts/codex-0-134-runner-truth-check.js +0 -1
  292. package/dist/scripts/codex-0-137-compat-check.js +0 -1
  293. package/dist/scripts/codex-0138-capability-artifact-check.js +0 -1
  294. package/dist/scripts/codex-0138-capability-check.js +0 -1
  295. package/dist/scripts/codex-0138-doctor-check.js +0 -1
  296. package/dist/scripts/codex-0138-feature-probes-check.js +0 -1
  297. package/dist/scripts/codex-0144-app-server-v2-check.js +5 -5
  298. package/dist/scripts/codex-0144-core-real-probes-check.js +0 -1
  299. package/dist/scripts/codex-app-handoff-check.js +0 -1
  300. package/dist/scripts/codex-app-handoff-launch-check.js +0 -1
  301. package/dist/scripts/codex-config-load-probe.js +0 -5
  302. package/dist/scripts/codex-control-all-pipelines-check.js +0 -1
  303. package/dist/scripts/codex-control-event-stream-ledger-check.js +0 -1
  304. package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +0 -1
  305. package/dist/scripts/codex-permission-profiles-check.js +0 -1
  306. package/dist/scripts/codex-plugin-app-template-policy-check.js +0 -1
  307. package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -1
  308. package/dist/scripts/codex-sdk-all-pipelines-check.js +0 -1
  309. package/dist/scripts/codex-sdk-backend-router-check.js +0 -1
  310. package/dist/scripts/codex-sdk-capability-check.js +0 -1
  311. package/dist/scripts/codex-sdk-event-stream-ledger-check.js +0 -1
  312. package/dist/scripts/codex-sdk-real-smoke-check.js +0 -1
  313. package/dist/scripts/concurrent-session-collision-check.js +9 -0
  314. package/dist/scripts/context7-evidence-dedupe-check.js +0 -1
  315. package/dist/scripts/core-skill-card-schema-check.js +0 -11
  316. package/dist/scripts/core-skill-deployment-snapshot-check.js +0 -10
  317. package/dist/scripts/core-skill-heldout-validation-check.js +0 -11
  318. package/dist/scripts/core-skill-no-inference-optimizer-check.js +0 -11
  319. package/dist/scripts/core-skill-patch-check.js +0 -11
  320. package/dist/scripts/core-skill-route-runtime-integration-check.js +0 -11
  321. package/dist/scripts/current-command-surface-check.js +1 -1
  322. package/dist/scripts/current-surface-update-e2e-check.js +2 -4
  323. package/dist/scripts/current-upgrade-matrix-check.js +0 -1
  324. package/dist/scripts/dfix-fixture-check.js +0 -1
  325. package/dist/scripts/dfix-patch-handoff-check.js +0 -1
  326. package/dist/scripts/dfix-verification-check.js +0 -1
  327. package/dist/scripts/dfix-verification-recommendation-check.js +0 -1
  328. package/dist/scripts/docs-truthfulness-check.js +7 -7
  329. package/dist/scripts/doctor-fastpath-check.js +0 -1
  330. package/dist/scripts/doctor-fix-production-blackbox.js +1 -1
  331. package/dist/scripts/doctor-fix-proves-codex-read-check.js +0 -11
  332. package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +0 -4
  333. package/dist/scripts/doctor-idempotence-check.js +0 -1
  334. package/dist/scripts/doctor-ops-semantics-check.js +0 -1
  335. package/dist/scripts/doctor-startup-config-repair-blackbox.js +1 -1
  336. package/dist/scripts/ensure-bin-executable.js +0 -1
  337. package/dist/scripts/evidence-flagship-coverage-check.js +0 -1
  338. package/dist/scripts/fast-codex-service-tier-proof-check.js +0 -1
  339. package/dist/scripts/fixtures/fake-codex-config-loader.js +0 -5
  340. package/dist/scripts/fsx-hotpath-check.js +0 -1
  341. package/dist/scripts/gate-policy-audit-check.js +1 -1
  342. package/dist/scripts/geo-claim-evidence-check.js +0 -1
  343. package/dist/scripts/geo-cli-blackbox-check.js +0 -1
  344. package/dist/scripts/geo-crawler-policy-check.js +0 -1
  345. package/dist/scripts/git-worktree-diff-envelope-check.js +0 -1
  346. package/dist/scripts/git-worktree-dirty-lock-check.js +0 -1
  347. package/dist/scripts/git-worktree-dirty-main-detection-check.js +0 -1
  348. package/dist/scripts/git-worktree-integration-primary-check.js +0 -1
  349. package/dist/scripts/git-worktree-manifest-append-check.js +0 -1
  350. package/dist/scripts/git-worktree-untracked-diff-check.js +0 -1
  351. package/dist/scripts/high-risk-contracts-check.js +0 -1
  352. package/dist/scripts/hook-latency-budget-check.js +0 -1
  353. package/dist/scripts/hook-latency-quantum-check.js +0 -1
  354. package/dist/scripts/image-artifact-path-contract-check.js +0 -1
  355. package/dist/scripts/imagegen-real-smoke-check.js +0 -1
  356. package/dist/scripts/import-graph-budget-check.js +0 -1
  357. package/dist/scripts/installed-package-smoke-check.js +0 -1
  358. package/dist/scripts/legacy-gate-purge-check.js +0 -1
  359. package/dist/scripts/lib/codex-sdk-gate-lib.js +0 -3
  360. package/dist/scripts/lib/ensure-dist-fresh.js +0 -1
  361. package/dist/scripts/lib/valid-png-fixture.js +0 -1
  362. package/dist/scripts/local-collab-all-pipelines-final-gpt-check.js +0 -1
  363. package/dist/scripts/loop-directive-check-lib.js +0 -1
  364. package/dist/scripts/loop-worker-fixture-child.js +0 -1
  365. package/dist/scripts/mad-preflight-blocks-unreadable-config-check.js +0 -10
  366. package/dist/scripts/mad-sks-sql-plane-lifecycle-hook-decision-check.js +0 -1
  367. package/dist/scripts/mad-sks-sql-plane-result-lifecycle-check.js +0 -1
  368. package/dist/scripts/mcp-plugin-inventory-check.js +0 -1
  369. package/dist/scripts/mcp-tool-naming-parity-check.js +0 -1
  370. package/dist/scripts/model-call-concurrency-check.js +0 -1
  371. package/dist/scripts/mutation-callsite-coverage-check.js +0 -5
  372. package/dist/scripts/naruto-codex-e2e-check.js +0 -1
  373. package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -1
  374. package/dist/scripts/official-subagent-workflow-check.js +4 -2
  375. package/dist/scripts/ops-diagnostics-bundle-check.js +0 -1
  376. package/dist/scripts/packlist-performance-check.js +1 -3
  377. package/dist/scripts/perf-budget-check.js +0 -1
  378. package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -1
  379. package/dist/scripts/ppt-real-export-adapter-check.js +0 -1
  380. package/dist/scripts/ppt-real-imagegen-smoke-check.js +0 -1
  381. package/dist/scripts/ppt-real-imagegen-wiring-check.js +0 -1
  382. package/dist/scripts/ppt-reexport-rereview-check.js +0 -1
  383. package/dist/scripts/prepublish-fast-check.js +0 -23
  384. package/dist/scripts/prepublish-release-check-or-fast.js +0 -7
  385. package/dist/scripts/probe-memoization-check.js +0 -1
  386. package/dist/scripts/product-design-plugin-routing-check.js +0 -1
  387. package/dist/scripts/project-skill-dedupe-blackbox.js +36 -9
  388. package/dist/scripts/prompt-placeholder-guard-check.js +0 -1
  389. package/dist/scripts/python-codex-sdk-all-pipelines-check.js +0 -3
  390. package/dist/scripts/qa-loop-app-handoff-capability-check.js +0 -1
  391. package/dist/scripts/qa-loop-app-handoff-check.js +0 -1
  392. package/dist/scripts/qa-loop-app-handoff-cli-check.js +0 -1
  393. package/dist/scripts/qa-loop-app-handoff-confirmation-check.js +0 -1
  394. package/dist/scripts/qa-loop-app-handoff-gate-lifecycle-check.js +0 -1
  395. package/dist/scripts/qa-loop-app-handoff-launch-check.js +0 -1
  396. package/dist/scripts/qa-loop-app-handoff-status-lifecycle-check.js +0 -1
  397. package/dist/scripts/qa-loop-budget-policy-check.js +0 -1
  398. package/dist/scripts/qa-loop-effort-escalation-check.js +0 -1
  399. package/dist/scripts/qa-loop-image-path-exposure-check.js +0 -1
  400. package/dist/scripts/qa-loop-image-path-prompt-injection-check.js +0 -1
  401. package/dist/scripts/release-cache-glob-hashing-check.js +0 -1
  402. package/dist/scripts/release-cache-input-classifier-check.js +0 -1
  403. package/dist/scripts/release-cache-neutralization-report-check.js +0 -1
  404. package/dist/scripts/release-cache-version-neutral-fixture-check.js +0 -1
  405. package/dist/scripts/release-check-stamp.js +0 -4
  406. package/dist/scripts/release-dist-freshness-check.js +0 -1
  407. package/dist/scripts/release-full-parallelism-blackbox.js +3 -3
  408. package/dist/scripts/release-gate-batch-runner-check.js +22 -0
  409. package/dist/scripts/release-gate-budget-check.js +0 -6
  410. package/dist/scripts/release-gate-dag-runner-check.js +0 -1
  411. package/dist/scripts/release-latency-slo-check.js +0 -1
  412. package/dist/scripts/release-metadata-1-19-check.js +0 -2
  413. package/dist/scripts/release-metadata-check.js +0 -3
  414. package/dist/scripts/release-parallel-speed-budget-check.js +0 -5
  415. package/dist/scripts/release-proof-truth-check.js +0 -1
  416. package/dist/scripts/release-provenance-check.js +0 -1
  417. package/dist/scripts/release-real-check.js +0 -1
  418. package/dist/scripts/release-runtime-truth-matrix-check.js +0 -1
  419. package/dist/scripts/release-version-truth-check.js +0 -1
  420. package/dist/scripts/research-blueprint-densifier-check.js +0 -1
  421. package/dist/scripts/research-claim-builder-check.js +0 -1
  422. package/dist/scripts/research-complete-package-fixture-check.js +0 -1
  423. package/dist/scripts/research-final-reviewer-blackbox.js +0 -1
  424. package/dist/scripts/responses-retry-policy-centralized-check.js +0 -1
  425. package/dist/scripts/retention-apply-smoke-check.js +0 -1
  426. package/dist/scripts/retention-budget-check.js +0 -1
  427. package/dist/scripts/retention-dry-run-check.js +0 -1
  428. package/dist/scripts/rollback-recovery-smoke-check.js +0 -1
  429. package/dist/scripts/route-intent-regression-check.js +0 -1
  430. package/dist/scripts/runtime-current-terminal-check.js +0 -1
  431. package/dist/scripts/runtime-dist-parity-check.js +0 -1
  432. package/dist/scripts/runtime-no-src-mjs-check.js +0 -1
  433. package/dist/scripts/runtime-proof-summary-check.js +0 -1
  434. package/dist/scripts/runtime-ts-rust-boundary-check.js +0 -15
  435. package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -1
  436. package/dist/scripts/scheduler-batch-dispatch-check.js +0 -1
  437. package/dist/scripts/scheduler-parallel-proof-consistency-check.js +0 -1
  438. package/dist/scripts/scheduler-utilization-integral-check.js +0 -1
  439. package/dist/scripts/search-visibility-gate-lib.js +0 -1
  440. package/dist/scripts/seo-audit-fixture-check.js +0 -1
  441. package/dist/scripts/seo-cli-blackbox-check.js +0 -1
  442. package/dist/scripts/seo-geo-geo-disambiguation-check.js +0 -1
  443. package/dist/scripts/seo-geo-route-identity-check.js +0 -1
  444. package/dist/scripts/seo-geo-skill-rich-content-check.js +0 -1
  445. package/dist/scripts/seo-marketing-truthfulness-check.js +0 -1
  446. package/dist/scripts/seo-metadata-sync-check.js +0 -1
  447. package/dist/scripts/seo-no-mutation-by-default-check.js +0 -1
  448. package/dist/scripts/shared-memory-fixture-check.js +0 -1
  449. package/dist/scripts/side-effect-runtime-report-check.js +0 -1
  450. package/dist/scripts/sizecheck.js +2 -3
  451. package/dist/scripts/sks-1-11-gate-lib.js +0 -1
  452. package/dist/scripts/sks-1-12-real-execution-check-lib.js +0 -1
  453. package/dist/scripts/sks-1-18-gate-lib.js +0 -1
  454. package/dist/scripts/sks-menubar-install-check.js +0 -3
  455. package/dist/scripts/sksd-daemon-check.js +0 -1
  456. package/dist/scripts/super-search-live-smoke-check.js +0 -1
  457. package/dist/scripts/super-search-local-http-smoke-check.js +0 -1
  458. package/dist/scripts/super-search-offline-contract-check.js +0 -1
  459. package/dist/scripts/super-search-provider-interface-check.js +0 -1
  460. package/dist/scripts/triwiki-cache-key-check.js +0 -1
  461. package/dist/scripts/triwiki-proof-bank-blackbox.js +0 -1
  462. package/dist/scripts/triwiki-proof-bank-check.js +0 -1
  463. package/dist/scripts/triwiki-proof-card-check.js +0 -1
  464. package/dist/scripts/trust-fixture-check.js +0 -1
  465. package/dist/scripts/ultra-router-auto-router-check.js +0 -1
  466. package/dist/scripts/update-fastpath-check.js +0 -1
  467. package/dist/scripts/upgrade-migration-matrix-check.js +0 -1
  468. package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +0 -1
  469. package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -1
  470. package/dist/scripts/ux-review-patch-diff-recheck-check.js +0 -1
  471. package/dist/scripts/ux-review-real-imagegen-smoke-check.js +0 -1
  472. package/dist/scripts/ux-review-run-wires-imagegen-check.js +0 -1
  473. package/dist/scripts/write-build-manifest.js +0 -1
  474. package/dist/scripts/wrongness-fixture-check.js +0 -1
  475. package/dist/scripts/zellij-capability-check.js +0 -1
  476. package/dist/scripts/zellij-developer-controls-check.js +0 -1
  477. package/dist/scripts/zellij-doctor-readiness-check.js +0 -13
  478. package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +0 -1
  479. package/dist/scripts/zellij-fake-adapter-check.js +0 -1
  480. package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -1
  481. package/dist/scripts/zellij-lane-renderer-check.js +0 -1
  482. package/dist/scripts/zellij-launch-command-truth-check.js +0 -12
  483. package/dist/scripts/zellij-layout-valid-check.js +0 -1
  484. package/dist/scripts/zellij-pane-creation-lock-metrics-check.js +0 -1
  485. package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -1
  486. package/dist/scripts/zellij-pane-lock-does-not-block-worker-check.js +0 -1
  487. package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -1
  488. package/dist/scripts/zellij-pane-proof-check.js +0 -1
  489. package/dist/scripts/zellij-qa-app-handoff-status-check.js +0 -1
  490. package/dist/scripts/zellij-real-session-cleanup-check.js +0 -1
  491. package/dist/scripts/zellij-real-session-launch-check.js +0 -1
  492. package/dist/scripts/zellij-right-column-geometry-proof.js +0 -1
  493. package/dist/scripts/zellij-right-column-headless-overflow-check.js +0 -1
  494. package/dist/scripts/zellij-right-column-manager-check.js +0 -1
  495. package/dist/scripts/zellij-screen-proof-check.js +0 -1
  496. package/dist/scripts/zellij-slot-only-ui-check.js +0 -1
  497. package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -1
  498. package/dist/scripts/zellij-slot-pane-stale-detection-check.js +0 -7
  499. package/dist/scripts/zellij-slot-telemetry-incremental-check.js +0 -1
  500. package/dist/scripts/zellij-slot-telemetry-live-flush-check.js +0 -1
  501. package/dist/scripts/zellij-slot-telemetry-performance-check.js +0 -1
  502. package/dist/scripts/zellij-stacked-capability-routing-check.js +0 -1
  503. package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -1
  504. package/dist/scripts/zellij-stacked-version-matrix-check.js +0 -1
  505. package/dist/scripts/zellij-stacked-version-parser-check.js +0 -1
  506. package/dist/scripts/zellij-ui-design-check.js +0 -12
  507. package/dist/scripts/zellij-update-prompt-matrix-check.js +0 -1
  508. package/dist/scripts/zellij-update-prompt-mode-check.js +0 -1
  509. package/dist/scripts/zellij-update-prompt-safety-check.js +0 -1
  510. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -2
  511. package/package.json +6 -7
  512. package/release-gates.v2.json +426 -93
  513. package/schemas/codex/app-server-0.145/codex_app_server_protocol.v2.schemas.json +19611 -0
  514. package/dist/core/commands/glm-command.js +0 -93
  515. package/dist/core/providers/glm/bench/glm-bench-comparison.js +0 -47
  516. package/dist/core/providers/glm/bench/glm-bench-fixture.js +0 -64
  517. package/dist/core/providers/glm/bench/glm-bench-model-lock-proof.js +0 -52
  518. package/dist/core/providers/glm/bench/glm-bench-report.js +0 -74
  519. package/dist/core/providers/glm/bench/glm-benchmark-runner.js +0 -243
  520. package/dist/core/providers/glm/bench/glm-benchmark-types.js +0 -1
  521. package/dist/core/providers/glm/bench/glm-direct-bench-runner.js +0 -72
  522. package/dist/core/providers/glm/glm-52-profile.js +0 -82
  523. package/dist/core/providers/glm/glm-52-request.js +0 -73
  524. package/dist/core/providers/glm/glm-52-response-guard.js +0 -32
  525. package/dist/core/providers/glm/glm-52-settings.js +0 -67
  526. package/dist/core/providers/glm/glm-context-budget.js +0 -14
  527. package/dist/core/providers/glm/glm-context-cache.js +0 -8
  528. package/dist/core/providers/glm/glm-direct-run.js +0 -140
  529. package/dist/core/providers/glm/glm-interactive-launch.js +0 -4
  530. package/dist/core/providers/glm/glm-latency-trace.js +0 -39
  531. package/dist/core/providers/glm/glm-loop-guard.js +0 -30
  532. package/dist/core/providers/glm/glm-mad-launch.js +0 -128
  533. package/dist/core/providers/glm/glm-mad-mode.js +0 -269
  534. package/dist/core/providers/glm/glm-model-meta-cache.js +0 -18
  535. package/dist/core/providers/glm/glm-patch-apply.js +0 -72
  536. package/dist/core/providers/glm/glm-patch-parser.js +0 -18
  537. package/dist/core/providers/glm/glm-profile-resolver.js +0 -168
  538. package/dist/core/providers/glm/glm-readiness.js +0 -4
  539. package/dist/core/providers/glm/glm-reasoning-policy.js +0 -14
  540. package/dist/core/providers/glm/glm-run-controller.js +0 -65
  541. package/dist/core/providers/glm/glm-run-state.js +0 -10
  542. package/dist/core/providers/glm/glm-run-timeout.js +0 -30
  543. package/dist/core/providers/glm/glm-speed-context.js +0 -81
  544. package/dist/core/providers/glm/glm-speed-gate.js +0 -39
  545. package/dist/core/providers/glm/glm-speed-output-parser.js +0 -39
  546. package/dist/core/providers/glm/glm-tool-schema-cache.js +0 -18
  547. package/dist/core/providers/glm/naruto/glm-naruto-apply-transaction.js +0 -135
  548. package/dist/core/providers/glm/naruto/glm-naruto-artifacts.js +0 -1
  549. package/dist/core/providers/glm/naruto/glm-naruto-bench.js +0 -6
  550. package/dist/core/providers/glm/naruto/glm-naruto-budget.js +0 -44
  551. package/dist/core/providers/glm/naruto/glm-naruto-combined-patch.js +0 -48
  552. package/dist/core/providers/glm/naruto/glm-naruto-command.js +0 -101
  553. package/dist/core/providers/glm/naruto/glm-naruto-concurrency-governor.js +0 -37
  554. package/dist/core/providers/glm/naruto/glm-naruto-conflict-graph.js +0 -79
  555. package/dist/core/providers/glm/naruto/glm-naruto-critical-path.js +0 -50
  556. package/dist/core/providers/glm/naruto/glm-naruto-decomposer.js +0 -148
  557. package/dist/core/providers/glm/naruto/glm-naruto-file-lease.js +0 -22
  558. package/dist/core/providers/glm/naruto/glm-naruto-final-seal.js +0 -81
  559. package/dist/core/providers/glm/naruto/glm-naruto-finalizer.js +0 -22
  560. package/dist/core/providers/glm/naruto/glm-naruto-hunk-conflict.js +0 -15
  561. package/dist/core/providers/glm/naruto/glm-naruto-hunk-parser.js +0 -35
  562. package/dist/core/providers/glm/naruto/glm-naruto-isolation-policy.js +0 -37
  563. package/dist/core/providers/glm/naruto/glm-naruto-judge.js +0 -83
  564. package/dist/core/providers/glm/naruto/glm-naruto-merge-planner.js +0 -61
  565. package/dist/core/providers/glm/naruto/glm-naruto-metrics.js +0 -33
  566. package/dist/core/providers/glm/naruto/glm-naruto-orchestrator.js +0 -486
  567. package/dist/core/providers/glm/naruto/glm-naruto-parallelism-summary.js +0 -54
  568. package/dist/core/providers/glm/naruto/glm-naruto-patch-candidate-gate.js +0 -41
  569. package/dist/core/providers/glm/naruto/glm-naruto-patch-candidate-parser.js +0 -61
  570. package/dist/core/providers/glm/naruto/glm-naruto-patch-envelope.js +0 -54
  571. package/dist/core/providers/glm/naruto/glm-naruto-quorum.js +0 -36
  572. package/dist/core/providers/glm/naruto/glm-naruto-rate-limiter.js +0 -17
  573. package/dist/core/providers/glm/naruto/glm-naruto-repair-wave.js +0 -20
  574. package/dist/core/providers/glm/naruto/glm-naruto-requirement-coverage.js +0 -108
  575. package/dist/core/providers/glm/naruto/glm-naruto-requirement-ledger.js +0 -57
  576. package/dist/core/providers/glm/naruto/glm-naruto-scoreboard.js +0 -74
  577. package/dist/core/providers/glm/naruto/glm-naruto-secret-audit.js +0 -90
  578. package/dist/core/providers/glm/naruto/glm-naruto-session-id.js +0 -9
  579. package/dist/core/providers/glm/naruto/glm-naruto-shard-planner.js +0 -31
  580. package/dist/core/providers/glm/naruto/glm-naruto-stage-scheduler.js +0 -84
  581. package/dist/core/providers/glm/naruto/glm-naruto-targeted-checks.js +0 -75
  582. package/dist/core/providers/glm/naruto/glm-naruto-task-size-classifier.js +0 -11
  583. package/dist/core/providers/glm/naruto/glm-naruto-terminal.js +0 -43
  584. package/dist/core/providers/glm/naruto/glm-naruto-trace.js +0 -173
  585. package/dist/core/providers/glm/naruto/glm-naruto-types.js +0 -36
  586. package/dist/core/providers/glm/naruto/glm-naruto-usage-extractor.js +0 -30
  587. package/dist/core/providers/glm/naruto/glm-naruto-verifier-output.js +0 -30
  588. package/dist/core/providers/glm/naruto/glm-naruto-work-graph.js +0 -1
  589. package/dist/core/providers/glm/naruto/glm-naruto-worker-artifacts.js +0 -55
  590. package/dist/core/providers/glm/naruto/glm-naruto-worker-pool.js +0 -275
  591. package/dist/core/providers/glm/naruto/glm-naruto-worker-runtime.js +0 -421
  592. package/dist/core/providers/glm/naruto/glm-naruto-worker-scheduler.js +0 -177
  593. package/dist/core/providers/glm/naruto/glm-naruto-worker.js +0 -1
  594. package/dist/core/providers/glm/naruto/glm-naruto-worktree-cleanup.js +0 -19
  595. package/dist/core/providers/glm/naruto/glm-naruto-worktree-manager.js +0 -71
  596. package/dist/core/providers/glm/naruto/glm-naruto-worktree-worker.js +0 -73
  597. package/dist/core/providers/glm/naruto/glm-naruto-worktree.js +0 -62
  598. package/schemas/codex/app-server-0.144/codex_app_server_protocol.v2.schemas.json +0 -1
@@ -17,19 +17,11 @@ export async function inspectCodePackHeadFreshness(root, packShaInput, opts = {}
17
17
  return staleWithCurrentHead(root, null, timeoutMs, fastHead, false, 'invalid_pack_sha');
18
18
  if (fastHead === packSha)
19
19
  return freshness(true, true, 'exact_head', fastHead, packSha, false, []);
20
- // Only the non-blocking hook consumes this cache. Authoritative wiki
21
- // validation always replays Git history and never trusts advisory state.
22
20
  if (opts.advisoryCache && fastHead) {
23
21
  const cached = await readAdvisoryCache(root, packSha, fastHead);
24
22
  if (cached)
25
23
  return cached;
26
24
  }
27
- // One common-path Git process returns HEAD plus every committed path after
28
- // the pack was generated. Excluding all parents of packSha keeps packSha in
29
- // the walk (including a root commit), so its presence proves ancestry. We
30
- // keep scanning after the pack marker because a later merge can introduce
31
- // sibling-branch commits that Git orders after packSha. `-m` exposes merge
32
- // resolution paths and `--no-renames` makes touched paths auditable.
33
25
  const history = await runProcess('git', [
34
26
  '-c',
35
27
  'core.quotepath=true',
@@ -106,8 +98,6 @@ function parseHistory(stdout, packSha) {
106
98
  }
107
99
  if (activeCommit === packSha)
108
100
  continue;
109
- // Do not trim Git paths: leading/trailing whitespace is meaningful and
110
- // must never be normalized into an allowlisted metadata path.
111
101
  for (const changedPath of pathText.split('\t')) {
112
102
  if (!changedPath || seenPaths.has(changedPath))
113
103
  continue;
@@ -41,7 +41,6 @@ export function buildCodePack(root, index, tokenBudget = DEFAULT_CODE_PACK_TOKEN
41
41
  }
42
42
  function buildEntryForModule(card) {
43
43
  const citations = collectCitations(card);
44
- // openwiki principle: an entry with no real repository citation is worse than no entry at all
45
44
  if (!citations.length)
46
45
  return null;
47
46
  const text = summarizeModule(card);
@@ -102,7 +101,6 @@ function summarizeDependencies(dependencyEdges) {
102
101
  return `Depends on: ${preview.join(', ')}${suffix}.`;
103
102
  }
104
103
  function computeTrustScore(card) {
105
- // more citable surface (entry points, real exports) correlates with a more reliably summarizable module
106
104
  let score = 0.5;
107
105
  if (card.entry_points.length > 0)
108
106
  score += 0.2;
@@ -191,7 +191,6 @@ function listFiles(root, start) {
191
191
  entries = fs.readdirSync(dir, { withFileTypes: true });
192
192
  }
193
193
  catch (error) {
194
- // dir can vanish or become unreadable between stack push and pop (TOCTOU) — contribute zero files, not a crash
195
194
  if (isMissingOrInaccessible(error))
196
195
  continue;
197
196
  throw error;
@@ -117,7 +117,6 @@ function atomicWriteJson(file, value) {
117
117
  fs.fsyncSync(fd);
118
118
  }
119
119
  catch {
120
- // fsync can be unavailable on some virtual filesystems; rename remains atomic.
121
120
  }
122
121
  }
123
122
  finally {
@@ -237,20 +237,10 @@ function uniqueAttentionRows(rows = [], max = 4) {
237
237
  }
238
238
  return out;
239
239
  }
240
- /** Ranks code-pack entries (LLM-consumable, source-cited codebase summaries — see
241
- * src/core/triwiki/code-pack.ts) by trust_score into a dedicated attention sub-budget,
242
- * independent of the policy-claim RGBA/geometric selection above: code entries carry
243
- * no meaningful mission-coordinate proximity, so competing them against policy claims
244
- * for the same fixed slot budget would make their appearance arbitrary. Each surviving
245
- * high-trust, clean entry becomes a use_first row (bare id, no fabricated RGBA).
246
- * Lower-trust or wrongness-linked entries are hydrate-only so negative evidence can
247
- * never be promoted into the high-trust fast path. Citation-backed hydrate rows tell
248
- * consumers which real files must be read before relying on a summary. */
249
240
  function codePackAttentionRows(codePackEntries = [], tokenBudget = 2000, wrongnessByModule = {}) {
250
241
  const moduleWrongness = (entryId) => Number(wrongnessByModule[String(entryId || '').replace(/^code:/, '')] || 0);
251
242
  const sorted = [...(codePackEntries || [])]
252
243
  .filter((entry) => entry && typeof entry.id === 'string')
253
- // Modules SKS has been wrong about before are worth re-reading first, then rank by trust.
254
244
  .sort((a, b) => (moduleWrongness(b.id) - moduleWrongness(a.id)) || (Number(b.trust_score || 0) - Number(a.trust_score || 0)));
255
245
  const useFirst = [];
256
246
  const hydrateFirst = [];
@@ -56,11 +56,6 @@ function authoritativeCitations(pack) {
56
56
  .map((value) => value.trim());
57
57
  return [...new Set(normalized)].sort((a, b) => a.localeCompare(b));
58
58
  }
59
- /**
60
- * Bounded byte manifest for the exact local hydration citations carried by a
61
- * context pack. Runtime/generated state is intentionally excluded so ordinary
62
- * mission/report churn cannot invalidate otherwise-current source memory.
63
- */
64
59
  export function buildTriWikiSourceManifest(pack, root) {
65
60
  const citations = authoritativeCitations(pack);
66
61
  const includedCitations = [];
@@ -2,10 +2,6 @@ import path from 'node:path';
2
2
  import { ensureDir, readJson, writeJsonAtomic } from './fsx.js';
3
3
  import { validateWikiCoordinateIndex } from './wiki-coordinate.js';
4
4
  import { validateTriWikiContextPackProvenance } from './triwiki-provenance.js';
5
- // Inference-path TriWiki consumption. Routes/the agent kernel READ the deployed
6
- // context pack written by `sks wiki refresh|pack` (the SSOT); they never rebuild
7
- // it on the hot path. This is the seam that turns the TriWiki engine from an
8
- // advisory prompt note into an actually-consulted, proof-referenced context source.
9
5
  export const TRIWIKI_CONTEXT_PACK_REL = '.sneakoscope/wiki/context-pack.json';
10
6
  export const TRIWIKI_RUNTIME_SCHEMA = 'sks.triwiki-runtime-context.v1';
11
7
  function emptyContext(file, warning = 'no_triwiki_context_pack (run `sks wiki refresh` to populate the project memory pack)') {
@@ -23,11 +19,6 @@ function emptyContext(file, warning = 'no_triwiki_context_pack (run `sks wiki re
23
19
  warning
24
20
  };
25
21
  }
26
- /**
27
- * Load the deployed TriWiki context pack for a project root. Read-only; tolerant
28
- * of an absent/corrupt pack (returns present:false + a warning so the route still
29
- * runs as a graceful fallback). Never invokes pack rebuild or any model call.
30
- */
31
22
  export async function loadTriWikiRuntimeContext(root) {
32
23
  const file = path.join(path.resolve(root), TRIWIKI_CONTEXT_PACK_REL);
33
24
  let pack = null;
@@ -69,7 +60,6 @@ export async function loadTriWikiRuntimeContext(root) {
69
60
  warning: null
70
61
  };
71
62
  }
72
- /** Compact instruction block injected into read-only agents / route additionalContext. */
73
63
  export function triWikiContextBlock(ctx) {
74
64
  if (!ctx.present)
75
65
  return `TriWiki unavailable: ${ctx.warning || 'context pack missing or invalid'}; do not rely on cached project memory.`;
@@ -82,7 +72,6 @@ export function triWikiContextBlock(ctx) {
82
72
  hyd.length ? `hydrate_first (verify source before risky/user-visible actions): ${hyd.join(', ')}` : 'hydrate_first: none'
83
73
  ].join('\n');
84
74
  }
85
- /** Proof fields recorded by the kernel/route so its proof references the wiki it acted on. */
86
75
  export function triWikiProofRecord(ctx) {
87
76
  return {
88
77
  triwiki_context_consulted: ctx.present,
@@ -95,7 +84,6 @@ export function triWikiProofRecord(ctx) {
95
84
  warning: ctx.warning
96
85
  };
97
86
  }
98
- /** Persist the consulted TriWiki context as a per-mission proof artifact. */
99
87
  export async function writeTriWikiContextArtifact(ledgerRoot, ctx) {
100
88
  const file = path.join(path.resolve(ledgerRoot), 'agent-triwiki-context.json');
101
89
  await ensureDir(path.dirname(file));
@@ -65,10 +65,6 @@ async function writeWrongnessLedgerUnlocked(root, ledger) {
65
65
  export async function readCombinedWrongnessRecords(root, missionId = null) {
66
66
  const project = await readWrongnessLedger(root, null);
67
67
  const mission = missionId ? await readWrongnessLedger(root, missionId) : emptyWrongnessLedger('mission', missionId);
68
- // The project ledger is also the cross-mission index, so it contains copies
69
- // of mission-scoped records. A mission proof must inherit only truly global
70
- // project records plus rows owned by that mission; otherwise unrelated old
71
- // missions can block every future route forever.
72
68
  const projectRecords = missionId
73
69
  ? project.records.filter((record) => !record.mission_id || record.mission_id === missionId)
74
70
  : project.records;
@@ -115,9 +111,6 @@ export async function resolveWrongnessRecord(root, id, reason = 'Resolved after
115
111
  const changedMissions = new Set();
116
112
  let updated = 0;
117
113
  for (const missionId of scopes) {
118
- // Mutations must start from the writable base ledger. The project reader also
119
- // overlays shared shards, and writing that combined view would duplicate every
120
- // shared record into the project ledger.
121
114
  const ledger = await readBaseWrongnessLedger(root, missionId);
122
115
  let changed = false;
123
116
  const records = ledger.records.map((record) => {
@@ -149,9 +149,6 @@ export function createWrongnessRecord(input = {}) {
149
149
  ...(row.compiled_rule_id === undefined ? {} : { compiled_rule_id: stringOrNull(row.compiled_rule_id) })
150
150
  };
151
151
  }
152
- /** Best-effort module attribution from the wrongness's linked files. Excludes the
153
- * 'unknown' sentinel moduleIdsForPath returns for unmapped paths, so a record only
154
- * carries module_ids when at least one file maps to a real TriWiki module. */
155
152
  function moduleIdsForWrongness(files) {
156
153
  const ids = new Set();
157
154
  for (const file of files) {
@@ -54,13 +54,6 @@ export async function latestTrustReport(root, missionArg = 'latest') {
54
54
  return staleTrustReport(report, temporalIssues);
55
55
  }
56
56
  if (!proof) {
57
- // Persist this computed report even though it's a blocked result: `trust report`
58
- // is expected to leave a durable trust-report.json behind for anyone (a human or
59
- // a later `sks trust report <mission>` call) to inspect, the same way the
60
- // completion-proof-present path below does via writeTrustArtifactsForProof(). An
61
- // in-memory-only "blocked" result that vanishes after this call returns is
62
- // surprising and was the reason `sks trust report latest --json` could exit 0
63
- // with a blocked status yet leave no artifact on disk.
64
57
  const report = {
65
58
  schema: TRUST_REPORT_SCHEMA,
66
59
  ...trustKernelMetadata(),
@@ -1,7 +1,7 @@
1
1
  import fsp from 'node:fs/promises';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
- import { ensureDir, exists, globalSksRoot, nowIso, packageRoot, PACKAGE_VERSION, projectRoot, readJson, readText, runProcess, sha256, which, writeJsonAtomic, writeReceiptRotated, writeTextAtomic } from '../fsx.js';
4
+ import { ensureDir, exists, globalSksRoot, nowIso, packageRoot, PACKAGE_VERSION, projectRoot, readJson, readText, runProcess, sameFilesystemPath, sha256, which, writeJsonAtomic, writeReceiptRotated, writeTextAtomic } from '../fsx.js';
5
5
  import { MANAGED_ASSET_VERSION } from '../managed-assets/managed-assets-manifest.js';
6
6
  import { enforceRetention } from '../retention.js';
7
7
  import { COMMANDS } from '../../cli/command-registry.js';
@@ -83,8 +83,6 @@ export async function writePendingUpdateMigration(input) {
83
83
  return receipt;
84
84
  }
85
85
  export async function clearPendingUpdateMigration() {
86
- // v2 keeps a persistent installation epoch; project receipts are compared
87
- // independently and one project must not consume global migration state.
88
86
  }
89
87
  export async function writeProjectUpdateMigrationReceipt(input) {
90
88
  const receiptPath = projectUpdateMigrationReceiptPath(input.root);
@@ -197,6 +195,11 @@ export async function runUpdateRetentionCleanup(root, source = 'update-migration
197
195
  }
198
196
  }
199
197
  const UPDATE_MIGRATION_STAGES = [
198
+ {
199
+ id: 'other-harness-cleanup',
200
+ min_from_version: '0.0.0',
201
+ run: runOtherHarnessCleanupStage
202
+ },
200
203
  {
201
204
  id: 'current-public-surface-reconcile',
202
205
  min_from_version: '0.0.0',
@@ -233,20 +236,53 @@ const UPDATE_MIGRATION_STAGES = [
233
236
  run: runReceiptRotationStage
234
237
  }
235
238
  ];
239
+ async function runOtherHarnessCleanupStage(root) {
240
+ const { cleanupOtherHarnessConflicts } = await import('../harness-conflicts.js');
241
+ const cleanup = await cleanupOtherHarnessConflicts(root);
242
+ const blockers = cleanup.ok
243
+ ? []
244
+ : [
245
+ ...(cleanup.errors || []).map((row) => `other_harness_cleanup_error:${row.path}`),
246
+ ...((cleanup.remaining || []).map((row) => `other_harness_remaining:${row.path}`))
247
+ ];
248
+ return {
249
+ ok: blockers.length === 0,
250
+ status: blockers.length ? 'failed' : (cleanup.cleaned.length ? 'ok' : 'ok'),
251
+ actions: cleanup.cleaned.length ? ['quarantined_other_harness_conflicts'] : ['other_harness_surface_clean'],
252
+ blockers,
253
+ warnings: [],
254
+ detail: {
255
+ cleaned_count: cleanup.cleaned.length,
256
+ remaining_count: (cleanup.remaining || []).length,
257
+ error_count: (cleanup.errors || []).length,
258
+ run_id: cleanup.run_id
259
+ }
260
+ };
261
+ }
236
262
  async function runCurrentPublicSurfaceReconcileStage(root) {
237
- const [{ runDoctorCommandAliasCleanup }, { reconcileRetiredAgentRoleResidue }] = await Promise.all([
263
+ const [{ runDoctorCommandAliasCleanup }, { reconcileRetiredAgentRoleResidue }, { migrateSksProfilesToPerFile }] = await Promise.all([
238
264
  import('../doctor/command-alias-cleanup.js'),
239
- import('../agents/agent-role-config.js')
265
+ import('../agents/agent-role-config.js'),
266
+ import('../auto-review.js')
240
267
  ]);
241
268
  const home = path.resolve(process.env.HOME || os.homedir());
242
269
  const globalRuntimeRoot = path.resolve(process.env.SKS_GLOBAL_ROOT || path.join(home, '.sneakoscope-global'));
243
- const [publicSurface, retiredRoles] = await Promise.all([
244
- runDoctorCommandAliasCleanup({ root, home, globalRuntimeRoot, fix: true }),
245
- reconcileRetiredAgentRoleResidue({ root, home, globalRuntimeRoot, fix: true })
246
- ]);
270
+ const publicSurface = await runDoctorCommandAliasCleanup({ root, home, globalRuntimeRoot, fix: true });
271
+ const retiredRoles = await reconcileRetiredAgentRoleResidue({ root, home, globalRuntimeRoot, fix: true });
272
+ const profileMigration = await migrateSksProfilesToPerFile({ env: process.env }).catch((err) => ({
273
+ error: err?.message || String(err),
274
+ retired_profile_table_count: 0,
275
+ retired_profile_file_removed_count: 0
276
+ }));
277
+ const remainingCount = Number(publicSurface.cleanup?.remaining_count || 0)
278
+ + Number(publicSurface.cleanup?.managed_runtime?.remaining_managed_artifact_count || 0)
279
+ + Number(publicSurface.cleanup?.project_guidance?.remaining_count || 0)
280
+ + retiredRoles.remaining_count;
247
281
  const blockers = [
248
282
  ...(publicSurface.ok === true ? [] : ['public_surface_reconcile_failed']),
249
- ...(retiredRoles.ok === true ? [] : ['retired_agent_role_reconcile_failed'])
283
+ ...(retiredRoles.ok === true ? [] : ['retired_agent_role_reconcile_failed']),
284
+ ...(profileMigration.error ? [`retired_profile_migration_failed:${profileMigration.error}`] : []),
285
+ ...(remainingCount > 0 ? [`public_surface_remaining:${remainingCount}`] : [])
250
286
  ];
251
287
  return {
252
288
  ok: blockers.length === 0,
@@ -263,10 +299,9 @@ async function runCurrentPublicSurfaceReconcileStage(root) {
263
299
  quarantined_guidance_collision_count: Number(publicSurface.cleanup?.project_guidance?.preserved_user_file_count || 0),
264
300
  removed_retired_role_count: retiredRoles.removed_count,
265
301
  quarantined_retired_role_collision_count: retiredRoles.quarantined_user_collision_count,
266
- remaining_count: Number(publicSurface.cleanup?.remaining_count || 0)
267
- + Number(publicSurface.cleanup?.managed_runtime?.remaining_managed_artifact_count || 0)
268
- + Number(publicSurface.cleanup?.project_guidance?.remaining_count || 0)
269
- + retiredRoles.remaining_count
302
+ retired_profile_table_count: Number(profileMigration.retired_profile_table_count || 0),
303
+ retired_profile_file_removed_count: Number(profileMigration.retired_profile_file_removed_count || 0),
304
+ remaining_count: remainingCount
270
305
  }
271
306
  };
272
307
  }
@@ -341,10 +376,23 @@ async function runSessionStateSplitStage(root) {
341
376
  }
342
377
  async function runSkillsReconcileStage(root) {
343
378
  const home = path.resolve(process.env.HOME || os.homedir());
344
- const global = await reconcileSkills({ targetDir: path.join(home, '.agents', 'skills'), scope: 'global', fix: true })
345
- .catch((err) => ({ ok: false, error: err?.message || String(err) }));
346
- const project = await reconcileSkills({ targetDir: path.join(root, '.agents', 'skills'), scope: 'project', fix: true })
379
+ const globalTarget = path.resolve(home, '.agents', 'skills');
380
+ const projectTarget = path.resolve(root, '.agents', 'skills');
381
+ const global = await reconcileSkills({ targetDir: globalTarget, scope: 'global', fix: true })
347
382
  .catch((err) => ({ ok: false, error: err?.message || String(err) }));
383
+ const sameSkillRoot = await sameFilesystemPath(projectTarget, globalTarget);
384
+ const project = sameSkillRoot
385
+ ? {
386
+ schema: 'sks.skill-reconcile.v1',
387
+ ok: true,
388
+ scope: 'project',
389
+ target_dir: projectTarget,
390
+ fix: true,
391
+ skipped: true,
392
+ reason: 'same_as_authoritative_global_skill_root'
393
+ }
394
+ : await reconcileSkills({ targetDir: projectTarget, scope: 'project', fix: true })
395
+ .catch((err) => ({ ok: false, error: err?.message || String(err) }));
348
396
  const globalRemaining = Number(global.retired_residue?.remaining_count || 0);
349
397
  const projectRemaining = Number(project.retired_residue?.remaining_count || 0);
350
398
  const blockers = [
@@ -356,7 +404,10 @@ async function runSkillsReconcileStage(root) {
356
404
  return {
357
405
  ok: blockers.length === 0,
358
406
  status: blockers.length ? 'failed' : 'ok',
359
- actions: ['reconciled_global_skills', 'reconciled_project_skills'],
407
+ actions: [
408
+ 'reconciled_global_skills',
409
+ sameSkillRoot ? 'skipped_project_skills_same_as_global' : 'reconciled_project_skills'
410
+ ],
360
411
  blockers,
361
412
  warnings: [],
362
413
  detail: {
@@ -370,19 +421,27 @@ async function runSkillsReconcileStage(root) {
370
421
  };
371
422
  }
372
423
  async function runMenubarRetargetStage(root) {
373
- const actionScript = path.join(os.homedir(), '.codex', 'sks-menubar', 'sks-menubar-action.sh');
424
+ const installDir = path.join(os.homedir(), '.codex', 'sks-menubar');
425
+ const actionScript = path.join(installDir, 'sks-menubar-action.sh');
426
+ const buildStamp = path.join(installDir, 'build-stamp.json');
374
427
  const text = await readText(actionScript, null);
375
428
  if (typeof text !== 'string')
376
429
  return { ok: true, status: 'ok', actions: ['menubar_action_script_absent'], blockers: [], warnings: [] };
377
430
  const desired = path.join(packageRoot(), 'dist', 'bin', 'sks.js');
378
431
  const line = `SKS_ENTRY='${desired.replace(/'/g, `'\\''`)}'`;
379
432
  const actions = [];
433
+ const stampedGeneration = await exists(buildStamp);
380
434
  const next = /^\s*SKS_ENTRY\s*=.*$/m.test(text)
381
435
  ? text.replace(/^\s*SKS_ENTRY\s*=.*$/m, line)
382
436
  : `${line}\n${text}`;
383
437
  if (next !== text) {
384
- await writeTextAtomic(actionScript, next);
385
- actions.push('retargeted_menubar_action_script');
438
+ if (stampedGeneration) {
439
+ actions.push('deferred_menubar_retarget_to_transactional_rebuild');
440
+ }
441
+ else {
442
+ await writeTextAtomic(actionScript, next);
443
+ actions.push('retargeted_legacy_menubar_action_script');
444
+ }
386
445
  }
387
446
  const stat = await fsp.stat(actionScript).catch(() => null);
388
447
  if (!stat || (stat.mode & 0o111) === 0) {
@@ -395,30 +454,45 @@ async function runMenubarRetargetStage(root) {
395
454
  actions: actions.length ? actions : ['menubar_action_script_current'],
396
455
  blockers: [],
397
456
  warnings: [],
398
- detail: { action_script: actionScript }
457
+ detail: {
458
+ action_script: actionScript,
459
+ build_stamp_present: stampedGeneration,
460
+ retarget_deferred: stampedGeneration && next !== text
461
+ }
399
462
  };
400
463
  }
401
464
  async function runConfigFastModeNormalizeStage() {
465
+ const { reconcileRetiredSksConfigText } = await import('../auto-review.js');
402
466
  const configPath = path.join(os.homedir(), '.codex', 'config.toml');
403
467
  const text = await readText(configPath, null);
404
468
  if (typeof text !== 'string')
405
469
  return { ok: true, status: 'ok', actions: ['codex_config_absent'], blockers: [], warnings: [] };
406
470
  const normalized = normalizeLegacyFastModeConfigForUpdate(text);
407
- if (normalized.text === ensureTrailingNewline(text)) {
471
+ const retired = reconcileRetiredSksConfigText(normalized.text);
472
+ const nextText = ensureTrailingNewline(retired.text);
473
+ const actions = [
474
+ ...normalized.actions,
475
+ ...(retired.detected_count > 0 ? ['stripped_retired_sks_config_profiles_and_policies'] : [])
476
+ ];
477
+ if (nextText === ensureTrailingNewline(text)) {
408
478
  return {
409
479
  ok: true,
410
480
  status: 'ok',
411
- actions: ['fastmode_config_current'],
481
+ actions: actions.length ? actions : ['fastmode_config_current'],
412
482
  blockers: [],
413
483
  warnings: [],
414
- detail: { config_path: configPath, default_profile: normalized.defaultProfile }
484
+ detail: {
485
+ config_path: configPath,
486
+ default_profile: normalized.defaultProfile,
487
+ retired_config_detected_count: retired.detected_count
488
+ }
415
489
  };
416
490
  }
417
491
  let guardResult = null;
418
492
  guardResult = await writeCodexConfigGuarded({
419
493
  configPath,
420
494
  before: text,
421
- mutate: () => normalized.text,
495
+ mutate: () => nextText,
422
496
  cause: 'project-update-fastmode-normalize',
423
497
  backupTag: 'project-update-fastmode-normalize',
424
498
  preserveFastUiKeys: true
@@ -430,16 +504,26 @@ async function runConfigFastModeNormalizeStage() {
430
504
  actions: ['normalize_fastmode_config_blocked'],
431
505
  blockers: [`codex_config_guard:${guardResult.status}`],
432
506
  warnings: [],
433
- detail: { config_path: configPath, default_profile: normalized.defaultProfile, guard: guardResult }
507
+ detail: {
508
+ config_path: configPath,
509
+ default_profile: normalized.defaultProfile,
510
+ retired_config_detected_count: retired.detected_count,
511
+ guard: guardResult
512
+ }
434
513
  };
435
514
  }
436
515
  return {
437
516
  ok: true,
438
517
  status: 'ok',
439
- actions: normalized.actions.length ? normalized.actions : ['fastmode_config_current'],
518
+ actions: actions.length ? actions : ['fastmode_config_current'],
440
519
  blockers: [],
441
520
  warnings: [],
442
- detail: { config_path: configPath, default_profile: normalized.defaultProfile, guard: guardResult }
521
+ detail: {
522
+ config_path: configPath,
523
+ default_profile: normalized.defaultProfile,
524
+ retired_config_detected_count: retired.detected_count,
525
+ guard: guardResult
526
+ }
443
527
  };
444
528
  }
445
529
  async function runHookTrustRefreshStage(root) {
@@ -500,11 +584,6 @@ function insertTopLevelTomlKey(text, line) {
500
584
  return `${raw.slice(0, firstTable).trimEnd()}\n${line}\n\n${raw.slice(firstTable).trimStart()}`.trim() + '\n';
501
585
  }
502
586
  function normalizeLegacyFastModeConfigForUpdate(text) {
503
- // 2026-07 ChatGPT desktop merge: default_profile, [user.fast_mode], and
504
- // [profiles.<name>] tables left the Codex config schema. This migration now
505
- // STRIPS the stamps older SKS versions wrote instead of normalizing them, and
506
- // preserves a legacy "fast default" semantically by writing the documented
507
- // top-level service_tier = "fast" in their place.
508
587
  let next = String(text || '');
509
588
  const actions = [];
510
589
  const misplaced = tomlTableString(next, 'user.fast_mode', 'default_profile');
@@ -652,17 +731,9 @@ export async function ensureCurrentMigrationBeforeCommand(input) {
652
731
  if (input.skipMigrationGate === true || commandSkipsMigrationGate(command)) {
653
732
  return { ...empty, ok: true, status: 'skipped', receipt: null, doctor: null, failed_stage_id: null, blockers: [], warnings: [`skip_migration_gate_command:${command}`] };
654
733
  }
655
- // projectRoot() falls back to the raw cwd when no project marker is found.
656
- // launchd-spawned callers (the SKS menu bar app) run with cwd=/ — there is
657
- // no project to migrate there, and proceeding would mkdir /.sneakoscope and
658
- // crash the whole command before it starts.
659
734
  if (root === path.parse(root).root) {
660
735
  return { ...empty, ok: true, status: 'skipped', receipt: null, doctor: null, failed_stage_id: null, blockers: [], warnings: ['no_project_workspace_at_filesystem_root'] };
661
736
  }
662
- // A git repository is not automatically an SKS project. Global Codex skills
663
- // (including DFix) may run in ordinary repositories, and route-local state or
664
- // a stale failed migration receipt can leave a partial `.sneakoscope` folder
665
- // behind. Only strong installed-project markers authorize project migration.
666
737
  if (!(await hasSksProjectMigrationMarker(root))) {
667
738
  return { ...empty, ok: true, status: 'skipped', receipt: null, doctor: null, failed_stage_id: null, blockers: [], warnings: ['non_sks_workspace_migration_gate_skipped'] };
668
739
  }
@@ -970,10 +1041,6 @@ export async function resolveInstalledSksEntrypoint(input = {}) {
970
1041
  }
971
1042
  return which('sks');
972
1043
  }
973
- // 20차 P2-2: was 20s — --help now bypasses this gate entirely (cli/router.ts),
974
- // so this timeout only affects commands that genuinely need the migration
975
- // gate; 5s is enough to cooperate with a sibling in-flight migration without
976
- // making every gated command absorb a 20s worst case.
977
1044
  const MIGRATION_LOCK_WAIT_MS = 5_000;
978
1045
  const MIGRATION_LOCK_POLL_MS = 150;
979
1046
  const MIGRATION_LOCK_PROGRESS_INTERVAL_MS = 1_000;
@@ -986,8 +1053,6 @@ async function withUpdateMigrationLock(root, base, fn, options = {}) {
986
1053
  await ensureDir(path.dirname(lockPath));
987
1054
  }
988
1055
  catch (err) {
989
- // An unwritable root (read-only mount, cwd outside any workspace) must fail
990
- // the gate with a reportable blocker, not crash the whole CLI dispatch.
991
1056
  return { ...base, ok: false, status: 'blocked', receipt: null, doctor: null, failed_stage_id: 'migration-lock', blockers: [`update_migration_lock_dir_unwritable:${err?.message || String(err)}`], warnings: [] };
992
1057
  }
993
1058
  const recheck = options.recheck ?? null;
@@ -1004,19 +1069,15 @@ async function withUpdateMigrationLock(root, base, fn, options = {}) {
1004
1069
  if (err?.code !== 'EEXIST') {
1005
1070
  return { ...base, ok: false, status: 'blocked', receipt: null, doctor: null, failed_stage_id: 'migration-lock', blockers: [`update_migration_lock_error:${err?.message || String(err)}`], warnings: [] };
1006
1071
  }
1007
- // The lock is held by a concurrent process. Cooperate instead of failing fast:
1008
- // 1) a sibling may have already completed the migration we need.
1009
1072
  if (recheck) {
1010
1073
  const done = await recheck();
1011
1074
  if (done)
1012
1075
  return done;
1013
1076
  }
1014
- // 2) reap a genuinely stale lock (dead holder or older than the stale threshold).
1015
1077
  if (!reapedStale && await removeStaleMigrationLock(lockPath)) {
1016
1078
  reapedStale = true;
1017
1079
  continue;
1018
1080
  }
1019
- // 3) wait for the in-flight holder to finish, then retry acquisition.
1020
1081
  if (Date.now() < deadline) {
1021
1082
  const now = Date.now();
1022
1083
  if (now - lastProgressAt >= MIGRATION_LOCK_PROGRESS_INTERVAL_MS) {
@@ -1026,7 +1087,6 @@ async function withUpdateMigrationLock(root, base, fn, options = {}) {
1026
1087
  await delay(MIGRATION_LOCK_POLL_MS);
1027
1088
  continue;
1028
1089
  }
1029
- // 4) gave up waiting on a live holder.
1030
1090
  return { ...base, ok: false, status: 'blocked', receipt: null, doctor: null, failed_stage_id: 'migration-lock', blockers: ['update_migration_lock_held'], warnings: [] };
1031
1091
  }
1032
1092
  try {
@@ -1044,14 +1104,6 @@ async function withUpdateMigrationLock(root, base, fn, options = {}) {
1044
1104
  }
1045
1105
  const DOCTOR_MIGRATION_REPORT_KEEP_COUNT = 10;
1046
1106
  const DOCTOR_MIGRATION_REPORT_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
1047
- // A now-unused legacy naming scheme (doctor-migration-<epoch>.json per run,
1048
- // one per migration-gate doctor invocation) left ~80 files/several MB of
1049
- // dead weight in .sneakoscope/update/ with nothing ever removing them
1050
- // (20차 P2-5c) — the current code writes a single fixed doctor-migration.json
1051
- // instead, but any leftovers from before that change, or from any other
1052
- // path that reintroduces per-run naming, are pruned here: keep the most
1053
- // recent DOCTOR_MIGRATION_REPORT_KEEP_COUNT, and nothing older than
1054
- // DOCTOR_MIGRATION_REPORT_MAX_AGE_MS regardless of count.
1055
1107
  async function pruneLegacyDoctorMigrationReports(root) {
1056
1108
  const dir = path.join(root, '.sneakoscope', 'update');
1057
1109
  const entries = await fsp.readdir(dir, { withFileTypes: true }).catch(() => []);
@@ -784,12 +784,6 @@ export function menuBarInstallIsTerminalUncertain(result) {
784
784
  }
785
785
  async function runUpdateGlobalSkillsReconcile(stage, opts = {}) {
786
786
  const targetDir = path.join(opts.env?.HOME || os.homedir(), '.agents', 'skills');
787
- // reconcileSkills stamps ~/.agents/skills/.sks-generated.json with the
788
- // PACKAGE_VERSION compiled into whichever module runs it. This function
789
- // executes inside the OLD (driver) binary, so after a real version install
790
- // an in-process reconcile would overwrite the manifest the new binary's
791
- // migration doctor just wrote and make final self-verification report
792
- // skills_manifest stale forever. Delegate to the freshly installed package.
793
787
  if (opts.newPackageRoot) {
794
788
  const moduleHref = pathToFileURL(path.join(opts.newPackageRoot, 'dist', 'core', 'init', 'skills.js')).href;
795
789
  const script = [
@@ -810,7 +804,7 @@ async function runUpdateGlobalSkillsReconcile(stage, opts = {}) {
810
804
  parsed = JSON.parse(line);
811
805
  break;
812
806
  }
813
- catch { /* not the JSON result line */ }
807
+ catch { }
814
808
  }
815
809
  const ok = run.code === 0 && parsed?.ok !== false && !parsed?.error;
816
810
  stage('global_skills_reconcile', ok, ok ? 'reconciled' : 'failed', {
@@ -844,9 +838,6 @@ async function runUpdateNativeCapabilitySetup(stage, opts) {
844
838
  }
845
839
  const root = opts.root;
846
840
  const moduleHref = (rel) => pathToFileURL(path.join(opts.newPackageRoot, 'dist', 'core', 'doctor', rel)).href;
847
- // Same as global_skills_reconcile above: run the newly installed package's own
848
- // modules in a subprocess rather than in-process, so an old (pre-update) driver
849
- // binary never runs post-update repair logic with stale compiled-in behavior.
850
841
  const script = [
851
842
  `const [{ repairCodexImagegen }, { repairComputerUse }, { repairBrowserUse }] = await Promise.all([import(${JSON.stringify(moduleHref('imagegen-repair.js'))}), import(${JSON.stringify(moduleHref('computer-use-repair.js'))}), import(${JSON.stringify(moduleHref('browser-use-repair.js'))})]);`,
852
843
  `const root = ${JSON.stringify(root)};`,
@@ -867,13 +858,10 @@ async function runUpdateNativeCapabilitySetup(stage, opts) {
867
858
  parsed = JSON.parse(line);
868
859
  break;
869
860
  }
870
- catch { /* not the JSON result line */ }
861
+ catch { }
871
862
  }
872
863
  const summarize = (r) => (r?.recovered === true || r?.ok === true ? 'ok' : r?.attempted ? 'blocked' : 'not-needed');
873
864
  const ok = run.code === 0 && Boolean(parsed);
874
- // A repair reporting 'blocked' (e.g. no verified CLI subcommand for a plugin
875
- // install) is a valid, honest terminal state for this stage, not a stage
876
- // failure — the update itself must not be blocked on a manual-only step.
877
865
  stage('native_capability_setup', ok, ok ? 'completed' : 'failed', {
878
866
  via: 'new_package_binary',
879
867
  summary: ok