sneakoscope 6.0.3 → 6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/README.md +29 -12
  2. package/config/codex-releases/{rust-v0.142.0.json → rust-v0.144.1.json} +6 -6
  3. package/crates/sks-core/Cargo.lock +1 -1
  4. package/crates/sks-core/Cargo.toml +1 -1
  5. package/dist/bin/fast-inline.js +18 -14
  6. package/dist/bin/sks-dispatch.js +2 -4
  7. package/dist/cli/args.js +2 -0
  8. package/dist/cli/command-manifest-lite.js +2 -3
  9. package/dist/cli/command-registry.js +3 -4
  10. package/dist/cli/help-fast.js +1 -1
  11. package/dist/cli/install-helpers.js +348 -763
  12. package/dist/cli/install-tool-helpers.js +287 -0
  13. package/dist/cli/router.js +91 -6
  14. package/dist/commands/codex-lb.js +188 -53
  15. package/dist/commands/codex.js +44 -5
  16. package/dist/commands/doctor.js +302 -46
  17. package/dist/commands/tmux.js +5 -1
  18. package/dist/commands/versioning.js +7 -0
  19. package/dist/commands/zellij-monitor-pane.js +2 -0
  20. package/dist/commands/zellij-viewport-pane.js +3 -1
  21. package/dist/commands/zellij.js +1 -1
  22. package/dist/config/skills-manifest.json +59 -59
  23. package/dist/core/agent-bridge/agent-manifest.js +48 -0
  24. package/dist/core/agents/agent-central-ledger.js +9 -0
  25. package/dist/core/agents/agent-cleanup-executor.js +334 -41
  26. package/dist/core/agents/agent-cleanup.js +20 -1
  27. package/dist/core/agents/agent-command-surface.js +3 -1
  28. package/dist/core/agents/agent-effort-policy.js +30 -38
  29. package/dist/core/agents/agent-janitor.js +9 -10
  30. package/dist/core/agents/agent-namespace-safety.js +56 -0
  31. package/dist/core/agents/agent-orchestrator.js +25 -3
  32. package/dist/core/agents/agent-output-validator.js +1 -1
  33. package/dist/core/agents/agent-plan.js +100 -21
  34. package/dist/core/agents/agent-role-config.js +43 -49
  35. package/dist/core/agents/agent-runner-codex-exec.js +18 -3
  36. package/dist/core/agents/agent-runner-process.js +1 -0
  37. package/dist/core/agents/agent-schema.js +3 -2
  38. package/dist/core/agents/fast-mode-policy.js +3 -5
  39. package/dist/core/agents/native-cli-session-swarm.js +1 -1
  40. package/dist/core/agents/native-worker-backend-router.js +2 -1
  41. package/dist/core/agents/work-partition/repo-inventory.js +68 -7
  42. package/dist/core/agents/zellij-right-lane-cockpit.js +2 -2
  43. package/dist/core/code-structure.js +5 -4
  44. package/dist/core/codex/agent-config-file-repair.js +94 -193
  45. package/dist/core/codex/codex-cli-update.js +723 -0
  46. package/dist/core/codex/codex-config-guard.js +38 -11
  47. package/dist/core/codex/codex-project-config-policy.js +3 -6
  48. package/dist/core/codex/codex-startup-config-postcheck.js +52 -42
  49. package/dist/core/codex-adapter.js +35 -22
  50. package/dist/core/codex-app/codex-agent-role-sync.js +13 -54
  51. package/dist/core/codex-app/codex-app-fast-ui-repair.js +51 -20
  52. package/dist/core/codex-app/codex-app-launcher.js +48 -17
  53. package/dist/core/codex-app/codex-app-restart.js +23 -2
  54. package/dist/core/codex-app/codex-app-ui-state-snapshot.js +11 -3
  55. package/dist/core/codex-app/sks-menubar.js +136 -5
  56. package/dist/core/codex-app.js +35 -14
  57. package/dist/core/codex-compat/codex-hook-warning-detector.js +10 -1
  58. package/dist/core/codex-compat/codex-release-manifest.js +6 -6
  59. package/dist/core/codex-control/codex-0139-doctor-real-probe.js +7 -1
  60. package/dist/core/codex-control/codex-0139-image-path-real-probe.js +29 -12
  61. package/dist/core/codex-control/codex-0139-probe-runner.js +103 -28
  62. package/dist/core/codex-control/codex-0139-real-probe-summary.js +7 -3
  63. package/dist/core/codex-control/codex-0139-real-probes.js +21 -6
  64. package/dist/core/codex-control/codex-0139-sandbox-real-probe.js +39 -13
  65. package/dist/core/codex-control/codex-0139-web-search-probe.js +28 -14
  66. package/dist/core/codex-control/{codex-0142-capability.js → codex-0144-capability.js} +22 -22
  67. package/dist/core/codex-control/codex-0144-collab-agent-real-probe.js +63 -0
  68. package/dist/core/codex-control/codex-lb-launch-recovery.js +278 -0
  69. package/dist/core/codex-control/codex-multi-agent-event-normalizer.js +5 -1
  70. package/dist/core/codex-control/codex-reliability-shield.js +93 -30
  71. package/dist/core/codex-control/codex-sdk-adapter.js +96 -13
  72. package/dist/core/codex-control/codex-sdk-config-policy.js +2 -1
  73. package/dist/core/codex-control/codex-sdk-sandbox-policy.js +6 -3
  74. package/dist/core/codex-control/codex-task-runner.js +62 -9
  75. package/dist/core/codex-control/python-codex-sdk-adapter.js +30 -3
  76. package/dist/core/codex-exec-output-schema.js +35 -6
  77. package/dist/core/codex-lb/codex-lb-env.js +30 -1
  78. package/dist/core/codex-lb/codex-lb-tool-catalog.js +478 -0
  79. package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +291 -0
  80. package/dist/core/codex-native/codex-native-feature-broker.js +31 -38
  81. package/dist/core/codex-native/codex-native-feature-matrix.js +2 -2
  82. package/dist/core/codex-native/codex-native-repair-transaction.js +1 -1
  83. package/dist/core/codex-native/core-skill-manifest.js +8 -4
  84. package/dist/core/codex-native/native-capability-postcheck.js +16 -8
  85. package/dist/core/codex-native/native-capability-repair-matrix.js +76 -27
  86. package/dist/core/codex-plugins/codex-plugin-json.js +67 -21
  87. package/dist/core/codex-plugins/codex-plugin-repair.js +118 -0
  88. package/dist/core/codex-runtime/codex-desktop-config-policy.js +305 -0
  89. package/dist/core/commands/agent-bridge-command.js +23 -2
  90. package/dist/core/commands/agent-command.js +38 -5
  91. package/dist/core/commands/basic-cli.js +77 -30
  92. package/dist/core/commands/command-utils.js +1 -1
  93. package/dist/core/commands/gc-command.js +27 -4
  94. package/dist/core/commands/image-ux-review-command.js +55 -24
  95. package/dist/core/commands/mad-sks-command.js +182 -137
  96. package/dist/core/commands/naruto-command.js +643 -1153
  97. package/dist/core/commands/pipeline-command.js +1 -0
  98. package/dist/core/commands/research-command.js +293 -231
  99. package/dist/core/commands/run-command.js +100 -23
  100. package/dist/core/commands/team-command.js +2 -3
  101. package/dist/core/commands/team-legacy-observe-command.js +94 -359
  102. package/dist/core/commands/wiki-command.js +179 -83
  103. package/dist/core/computer-use-live-evidence.js +166 -3
  104. package/dist/core/computer-use-status.js +5 -2
  105. package/dist/core/daemon/sksd-hook-daemon-entrypoint.js +2 -2
  106. package/dist/core/daemon/sksd-hook-daemon.js +171 -28
  107. package/dist/core/daemon/sksd-hook-dispatch.js +2 -2
  108. package/dist/core/db-safety.js +2 -2
  109. package/dist/core/decision-lattice.js +6 -6
  110. package/dist/core/dfix/verification-selector.js +6 -4
  111. package/dist/core/doctor/browser-use-repair.js +54 -13
  112. package/dist/core/doctor/codex-0139-doctor.js +3 -2
  113. package/dist/core/doctor/codex-startup-config-repair.js +8 -3
  114. package/dist/core/doctor/computer-use-repair.js +28 -39
  115. package/dist/core/doctor/doctor-codex-startup-repair.js +24 -149
  116. package/dist/core/doctor/doctor-context7-repair.js +1 -1
  117. package/dist/core/doctor/doctor-dirty-planner.js +1 -1
  118. package/dist/core/doctor/doctor-native-capability-repair.js +74 -3
  119. package/dist/core/doctor/imagegen-repair.js +47 -12
  120. package/dist/core/doctor/legacy-global-hook-cleanup.js +179 -0
  121. package/dist/core/feature-fixture-executor.js +71 -7
  122. package/dist/core/feature-fixture-runner.js +53 -12
  123. package/dist/core/feature-fixtures.js +47 -14
  124. package/dist/core/feature-registry.js +53 -58
  125. package/dist/core/fsx.js +54 -6
  126. package/dist/core/harness-conflicts.js +19 -10
  127. package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +5 -4
  128. package/dist/core/hooks-runtime/hook-invocation-dedupe.js +147 -0
  129. package/dist/core/hooks-runtime/hook-io.js +14 -4
  130. package/dist/core/hooks-runtime/light-turn.js +70 -0
  131. package/dist/core/hooks-runtime/payload-signals.js +270 -0
  132. package/dist/core/hooks-runtime/team-digest.js +0 -1
  133. package/dist/core/hooks-runtime/tool-output-quarantine.js +93 -0
  134. package/dist/core/hooks-runtime.js +418 -250
  135. package/dist/core/image/image-artifact-path-contract.js +8 -6
  136. package/dist/core/image/image-artifact-registry.js +5 -1
  137. package/dist/core/image-ux-review/imagegen-adapter.js +5 -2
  138. package/dist/core/imagegen/imagegen-capability.js +10 -13
  139. package/dist/core/imagegen/require-imagegen.js +37 -11
  140. package/dist/core/init/skills.js +16 -30
  141. package/dist/core/init.js +144 -36
  142. package/dist/core/managed-assets/managed-assets-manifest.js +417 -14
  143. package/dist/core/mission.js +24 -1
  144. package/dist/core/naruto/naruto-work-graph.js +70 -4
  145. package/dist/core/ops/reporting.js +3 -0
  146. package/dist/core/pipeline-internals/runtime-core.js +578 -180
  147. package/dist/core/pipeline-internals/runtime-gates.js +191 -49
  148. package/dist/core/ppt/style-tokens.js +1 -1
  149. package/dist/core/ppt-review/index.js +1 -1
  150. package/dist/core/ppt-review/slide-exporter.js +23 -17
  151. package/dist/core/ppt-review/slide-imagegen-review.js +1 -1
  152. package/dist/core/ppt-review/slide-issue-extraction.js +4 -2
  153. package/dist/core/preflight/parallel-preflight-engine.js +50 -1
  154. package/dist/core/product-design-plugin.js +2 -2
  155. package/dist/core/proof/route-finalizer.js +1 -1
  156. package/dist/core/proof/route-proof-gate.js +7 -2
  157. package/dist/core/proof-field.js +3 -3
  158. package/dist/core/provider/model-router.js +38 -32
  159. package/dist/core/recallpulse/policy.js +12 -28
  160. package/dist/core/recallpulse.js +11 -6
  161. package/dist/core/release/gate-manifest.js +18 -12
  162. package/dist/core/release/gate-pack-manifest.js +1 -1
  163. package/dist/core/release/npm-pack-proof.js +247 -0
  164. package/dist/core/release/package-dist-snapshot.js +151 -0
  165. package/dist/core/release/package-size-budget.js +5 -0
  166. package/dist/core/release/release-authorization-snapshot.js +115 -0
  167. package/dist/core/release/release-gate-affected-selector.js +15 -3
  168. package/dist/core/release/release-gate-cache-v2.js +30 -0
  169. package/dist/core/release/release-gate-contract.js +161 -0
  170. package/dist/core/release/release-gate-dag.js +44 -3
  171. package/dist/core/release/release-gate-hermetic-env.js +28 -17
  172. package/dist/core/release/release-real-contract.js +496 -0
  173. package/dist/core/release-parallel-full-coverage.js +31 -143
  174. package/dist/core/research/claim-evidence-matrix.js +41 -6
  175. package/dist/core/research/experiment-plan.js +14 -10
  176. package/dist/core/research/falsification.js +9 -2
  177. package/dist/core/research/implementation-blueprint-densifier.js +82 -60
  178. package/dist/core/research/implementation-blueprint.js +32 -26
  179. package/dist/core/research/mock-result.js +122 -11
  180. package/dist/core/research/replication-pack.js +15 -8
  181. package/dist/core/research/research-adversarial-review.js +1068 -0
  182. package/dist/core/research/research-claim-builder.js +69 -17
  183. package/dist/core/research/research-claim-synthesizer.js +343 -0
  184. package/dist/core/research/research-cycle-runner.js +53 -3
  185. package/dist/core/research/research-falsification-runner.js +176 -0
  186. package/dist/core/research/research-final-reviewer.js +44 -125
  187. package/dist/core/research/research-realistic-report.js +14 -6
  188. package/dist/core/research/research-review-artifact-digest.js +66 -0
  189. package/dist/core/research/research-source-evidence.js +144 -0
  190. package/dist/core/research/research-source-layer-catalog.js +68 -0
  191. package/dist/core/research/research-source-ledger-merge.js +250 -12
  192. package/dist/core/research/research-source-shards.js +26 -70
  193. package/dist/core/research/research-stage-runner.js +237 -247
  194. package/dist/core/research/research-super-search.js +184 -0
  195. package/dist/core/research/research-synthesis-prompt.js +20 -1
  196. package/dist/core/research/research-synthesis-writer.js +86 -5
  197. package/dist/core/research/research-work-graph.js +25 -18
  198. package/dist/core/research/source-quality-report.js +21 -0
  199. package/dist/core/research.js +429 -280
  200. package/dist/core/retention/retention-budget.js +25 -6
  201. package/dist/core/retention.js +980 -101
  202. package/dist/core/routes/constants.js +1 -1
  203. package/dist/core/routes/dollar-manifest-lite.js +11 -11
  204. package/dist/core/routes/evidence.js +4 -4
  205. package/dist/core/routes/ppt-policy.js +1 -1
  206. package/dist/core/routes.js +92 -64
  207. package/dist/core/runtime/task-profile.js +66 -0
  208. package/dist/core/runtime/verification-budget.js +12 -0
  209. package/dist/core/secret-redaction.js +4 -0
  210. package/dist/core/security/high-risk-contracts.js +6 -6
  211. package/dist/core/stop-gate/stop-gate-check.js +49 -12
  212. package/dist/core/subagents/agent-catalog.js +215 -0
  213. package/dist/core/subagents/model-policy.js +118 -0
  214. package/dist/core/subagents/naruto-help-contract.js +40 -0
  215. package/dist/core/subagents/official-subagent-config.js +488 -0
  216. package/dist/core/subagents/official-subagent-preparation.js +251 -0
  217. package/dist/core/subagents/official-subagent-prompt.js +137 -0
  218. package/dist/core/subagents/official-subagent-runner.js +129 -0
  219. package/dist/core/subagents/subagent-evidence.js +663 -0
  220. package/dist/core/subagents/terminology.js +16 -0
  221. package/dist/core/subagents/thread-budget.js +21 -0
  222. package/dist/core/subagents/triwiki-attention.js +65 -0
  223. package/dist/core/super-search/runtime-helpers.js +173 -19
  224. package/dist/core/super-search/runtime.js +140 -15
  225. package/dist/core/super-search/source-records.js +49 -8
  226. package/dist/core/team-review-policy.js +15 -0
  227. package/dist/core/triwiki/code-pack.js +8 -2
  228. package/dist/core/triwiki/triwiki-cache-key.js +108 -29
  229. package/dist/core/triwiki/triwiki-module-card.js +1 -1
  230. package/dist/core/triwiki-attention.js +13 -6
  231. package/dist/core/triwiki-provenance.js +274 -0
  232. package/dist/core/triwiki-runtime.js +21 -7
  233. package/dist/core/triwiki-wrongness/wrongness-ledger.js +187 -61
  234. package/dist/core/triwiki-wrongness/wrongness-retrieval.js +11 -2
  235. package/dist/core/triwiki-wrongness/wrongness-trust-policy.js +2 -0
  236. package/dist/core/update-check.js +23 -15
  237. package/dist/core/version-manager.js +51 -1
  238. package/dist/core/version.js +1 -1
  239. package/dist/core/wiki-coordinate.js +128 -12
  240. package/dist/core/work-order-ledger.js +208 -10
  241. package/dist/core/zellij/zellij-command.js +12 -1
  242. package/dist/core/zellij/zellij-dashboard-pane.js +3 -3
  243. package/dist/core/zellij/zellij-fake-adapter.js +3 -1
  244. package/dist/core/zellij/zellij-launcher.js +51 -21
  245. package/dist/core/zellij/zellij-layout-builder.js +14 -5
  246. package/dist/core/zellij/zellij-official-subagent-activity.js +477 -0
  247. package/dist/core/zellij/zellij-official-subagent-telemetry.js +264 -0
  248. package/dist/core/zellij/zellij-pane-proof.js +32 -6
  249. package/dist/core/zellij/zellij-slot-pane-renderer.js +17 -5
  250. package/dist/core/zellij/zellij-slot-telemetry.js +15 -3
  251. package/dist/core/zellij/zellij-ui-mode.js +1 -1
  252. package/dist/core/zellij/zellij-viewport-binder.js +3 -0
  253. package/dist/core/zellij/zellij-worker-pane-manager.js +5 -3
  254. package/dist/scripts/agent-fast-mode-default-check.js +48 -29
  255. package/dist/scripts/agent-role-config-repair-check.js +34 -15
  256. package/dist/scripts/agent-wiki-context-proof-check.js +16 -2
  257. package/dist/scripts/all-feature-deep-completion-check.js +14 -4
  258. package/dist/scripts/architecture-guard-check.js +8 -1
  259. package/dist/scripts/build-dist.js +17 -5
  260. package/dist/scripts/canonical-test-runner.js +188 -0
  261. package/dist/scripts/check-command-module-budget.js +38 -16
  262. package/dist/scripts/check-legacy-free.js +1 -1
  263. package/dist/scripts/check-route-modularity.js +0 -1
  264. package/dist/scripts/check-ts-contracts.js +1 -1
  265. package/dist/scripts/codex-0139-interrupt-agent-check.js +5 -1
  266. package/dist/scripts/{codex-0142-app-server-v2-check.js → codex-0144-app-server-v2-check.js} +11 -10
  267. package/dist/scripts/{codex-0142-binary-identity-check.js → codex-0144-binary-identity-check.js} +4 -4
  268. package/dist/scripts/codex-0144-capability-check.js +21 -0
  269. package/dist/scripts/{codex-0139-real-probes-check.js → codex-0144-core-real-probes-check.js} +19 -5
  270. package/dist/scripts/{codex-0142-doctor-wiring-check.js → codex-0144-doctor-wiring-check.js} +6 -6
  271. package/dist/scripts/{codex-0142-manifest-check.js → codex-0144-manifest-check.js} +11 -3
  272. package/dist/scripts/{codex-0142-policy-check.js → codex-0144-policy-check.js} +2 -2
  273. package/dist/scripts/{codex-0142-thread-store-check.js → codex-0144-thread-store-check.js} +3 -3
  274. package/dist/scripts/codex-app-provider-model-ui-check.js +53 -19
  275. package/dist/scripts/codex-app-ui-preservation-check.js +35 -4
  276. package/dist/scripts/codex-control-all-pipelines-check.js +7 -3
  277. package/dist/scripts/codex-control-side-effect-scope-check.js +2 -2
  278. package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +27 -0
  279. package/dist/scripts/codex-effort-auto-discovery-check.js +1 -1
  280. package/dist/scripts/codex-lb-fast-mode-truth-check.js +1 -0
  281. package/dist/scripts/{codex-lb-gpt55-fast-profile-check.js → codex-lb-gpt56-fast-profile-check.js} +56 -5
  282. package/dist/scripts/codex-model-metadata-check.js +1 -1
  283. package/dist/scripts/codex-native-agent-role-content-check.js +15 -7
  284. package/dist/scripts/codex-native-repair-transaction-check.js +3 -1
  285. package/dist/scripts/codex-sdk-all-pipelines-check.js +7 -4
  286. package/dist/scripts/codex-sdk-research-pipeline-check.js +30 -8
  287. package/dist/scripts/codex-sdk-sandbox-policy-check.js +5 -1
  288. package/dist/scripts/codex-sdk-version-compat-check.js +2 -1
  289. package/dist/scripts/db-route-materialization-check.js +33 -0
  290. package/dist/scripts/dfix-fixture-check.js +1 -1
  291. package/dist/scripts/docs-truthfulness-check.js +4 -2
  292. package/dist/scripts/doctor-codex-startup-repair-check.js +47 -25
  293. package/dist/scripts/doctor-context7-repair-check.js +2 -1
  294. package/dist/scripts/doctor-fix-production-blackbox.js +12 -2
  295. package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +34 -7
  296. package/dist/scripts/doctor-imagegen-repair-check.js +14 -4
  297. package/dist/scripts/doctor-startup-config-repair-blackbox.js +9 -3
  298. package/dist/scripts/doctor-startup-config-repair-check.js +13 -3
  299. package/dist/scripts/install-update-preserves-config-check.js +7 -2
  300. package/dist/scripts/legacy-gate-inventory-check.js +7 -5
  301. package/dist/scripts/legacy-strong-inventory-check.js +7 -5
  302. package/dist/scripts/legacy-upgrade-matrix-check.js +4 -4
  303. package/dist/scripts/lib/native-cli-session-swarm-check-lib.js +173 -13
  304. package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +165 -6
  305. package/dist/scripts/managed-role-manifest-parity-check.js +5 -4
  306. package/dist/scripts/mutation-callsite-coverage-check.js +0 -11
  307. package/dist/scripts/naruto-codex-e2e-check.js +14 -7
  308. package/dist/scripts/naruto-shadow-clone-swarm-check.js +4 -201
  309. package/dist/scripts/npm-publish-performance-check.js +20 -12
  310. package/dist/scripts/official-subagent-workflow-check.js +145 -0
  311. package/dist/scripts/package-published-contract-check.js +6 -20
  312. package/dist/scripts/packlist-performance-check.js +17 -3
  313. package/dist/scripts/parallel-verification-engine-check.js +2 -2
  314. package/dist/scripts/postinstall-safe-side-effects-check.js +8 -3
  315. package/dist/scripts/ppt-no-mock-as-real-check.js +3 -1
  316. package/dist/scripts/prepublish-release-check-or-fast.js +23 -86
  317. package/dist/scripts/product-design-plugin-routing-check.js +1 -1
  318. package/dist/scripts/release-affected-selector-check.js +74 -1
  319. package/dist/scripts/release-check-stamp.js +324 -239
  320. package/dist/scripts/release-dag-full-coverage-check.js +7 -15
  321. package/dist/scripts/release-dynamic-presets-check.js +10 -1
  322. package/dist/scripts/release-gate-dag-runner-check.js +3 -3
  323. package/dist/scripts/release-gate-dag-runner.js +35 -11
  324. package/dist/scripts/release-gate-existence-audit.js +1 -2
  325. package/dist/scripts/release-gate-script-parity-check.js +1 -1
  326. package/dist/scripts/release-parallel-full-coverage-check.js +12 -6
  327. package/dist/scripts/release-parallel-speed-budget-check.js +18 -2
  328. package/dist/scripts/release-real-check.js +390 -157
  329. package/dist/scripts/release-registry-check.js +61 -16
  330. package/dist/scripts/release-runtime-truth-matrix-check.js +22 -0
  331. package/dist/scripts/research-blueprint-densifier-check.js +2 -2
  332. package/dist/scripts/research-real-cycle-no-legacy-final-md-check.js +11 -7
  333. package/dist/scripts/route-proof-artifact-structure-check.js +1 -0
  334. package/dist/scripts/search-visibility-gate-lib.js +1 -1
  335. package/dist/scripts/seo-geo-route-identity-check.js +30 -4
  336. package/dist/scripts/sizecheck.js +4 -4
  337. package/dist/scripts/sks-1-11-gate-lib.js +53 -6
  338. package/dist/scripts/sks-3-1-4-directive-check-lib.js +8 -2
  339. package/dist/scripts/sks-3-1-5-directive-check-lib.js +3 -2
  340. package/dist/scripts/sks-3-1-6-directive-check-lib.js +5 -3
  341. package/dist/scripts/sks-menubar-install-check.js +8 -0
  342. package/dist/scripts/sks-uninstall-regression-check.js +1 -1
  343. package/dist/scripts/sksd-daemon-check.js +16 -6
  344. package/dist/scripts/trust-fixture-check.js +32 -10
  345. package/dist/scripts/write-build-manifest.js +2 -1
  346. package/dist/scripts/wrongness-fixture-check.js +1 -1
  347. package/dist/scripts/zellij-layout-valid-check.js +36 -11
  348. package/dist/scripts/zellij-pane-proof-check.js +33 -2
  349. package/dist/scripts/zellij-real-session-cleanup-check.js +122 -2
  350. package/dist/scripts/zellij-real-session-launch-check.js +76 -5
  351. package/dist/scripts/zellij-slot-pane-renderer-check.js +4 -4
  352. package/dist/scripts/zellij-spawn-on-demand-layout-check.js +3 -3
  353. package/docs/demo.tape +1 -1
  354. package/infra-harness-gates.json +1486 -0
  355. package/package.json +32 -19
  356. package/release-gates.v2.json +4060 -0
  357. package/runtime-required-scripts.json +9 -0
  358. package/schemas/codex/{app-server-0.142 → app-server-0.144}/codex_app_server_protocol.v2.schemas.json +1146 -781
  359. package/schemas/codex/codex-0139-real-probe-result.schema.json +39 -5
  360. package/schemas/codex/ppt-slide-issue-ledger.schema.json +2 -1
  361. package/dist/commands/db.js +0 -6
  362. package/dist/core/codex-control/codex-0139-multi-agent-real-probe.js +0 -107
  363. package/dist/core/commands/db-command.js +0 -146
  364. package/dist/core/research/prompt.js +0 -15
  365. package/dist/scripts/agent-native-release-gate.js +0 -274
  366. package/dist/scripts/codex-0142-capability-check.js +0 -21
  367. package/dist/scripts/codex-control-tool-call-sequence-repair-check.js +0 -14
  368. package/dist/scripts/command-performance-scorecard-check.js +0 -204
  369. package/dist/scripts/config-managed-merge-callsite-coverage-check.js +0 -212
  370. package/dist/scripts/dollar-performance-scorecard-check.js +0 -257
  371. package/dist/scripts/gate-timing-check.js +0 -16
  372. package/dist/scripts/ops-maturity-scorecard-check.js +0 -12
  373. package/dist/scripts/performance-baseline-check.js +0 -12
  374. package/dist/scripts/performance-improvement-report-check.js +0 -58
  375. package/dist/scripts/release-parallel-check.js +0 -389
  376. package/dist/scripts/release-runner-efficiency-check.js +0 -15
  377. package/dist/scripts/retention-long-run-smoke-check.js +0 -299
  378. package/docs/assets/sneakoscope-architecture-pipeline.jpg +0 -0
@@ -1,7 +1,9 @@
1
1
  import path from 'node:path';
2
2
  import { CODEX_APP_DOCS_URL } from '../codex-app.js';
3
+ import { ensureCodexPlugins } from '../codex-plugins/codex-plugin-repair.js';
3
4
  import { computerUseStatusReport } from '../computer-use-status.js';
4
5
  import { ensureDir, nowIso, runProcess, which, writeJsonAtomic } from '../fsx.js';
6
+ import { redactString } from '../secret-redaction.js';
5
7
  export const DOCTOR_COMPUTER_USE_REPAIR_SCHEMA = 'sks.doctor-computer-use-repair.v1';
6
8
  export async function repairComputerUse(input) {
7
9
  const root = path.resolve(input.root || process.cwd());
@@ -69,36 +71,23 @@ export async function repairComputerUse(input) {
69
71
  : 'computer_use_capability_missing_not_feature_flag_shaped'
70
72
  });
71
73
  }
72
- // codex plugin install subcommand syntax is not documented anywhere in this repo or the
73
- // Codex CLI docs snapshot; a real `codex plugin --help` lookup was attempted but the
74
- // binary was unavailable/unverified in this environment, so no install command is guessed.
74
+ const repairPlugins = input.pluginRepair || ensureCodexPlugins;
75
+ const pluginRepair = beforeReady
76
+ ? null
77
+ : await repairPlugins({
78
+ pluginIds: ['computer-use@openai-bundled'],
79
+ apply,
80
+ codexBin,
81
+ timeoutMs: input.timeoutMs || 30_000
82
+ }).catch((err) => ({ ok: false, changed: false, installs: [], blockers: [messageOf(err)], next_actions: [] }));
75
83
  const pluginInstallStep = {
76
- id: 'computer_use_plugin_install_lookup',
77
- ok: false,
78
- attempted: false,
79
- command: codexBin ? `${codexBin} plugin --help` : 'codex plugin --help',
80
- blocker: 'codex_plugin_install_subcommand_unverified'
84
+ id: 'computer_use_plugin_repair',
85
+ ok: beforeReady || pluginRepair?.ok === true,
86
+ attempted: Boolean(pluginRepair?.installs?.length),
87
+ command: codexBin ? `${codexBin} plugin add computer-use@openai-bundled --json` : 'codex plugin add computer-use@openai-bundled --json',
88
+ status: beforeReady ? 'already_ready' : pluginRepair?.ok ? 'ready' : 'blocked',
89
+ blocker: beforeReady || pluginRepair?.ok === true ? null : pluginRepair?.blockers?.[0] || 'computer_use_plugin_not_ready'
81
90
  };
82
- let pluginHelpRaw = null;
83
- if (codexBin && before?.status === 'codex_app_missing' && apply) {
84
- const help = await runProcess(codexBin, ['plugin', '--help'], {
85
- timeoutMs: input.timeoutMs || 8000,
86
- maxOutputBytes: 32 * 1024
87
- }).catch((err) => ({ code: 1, stdout: '', stderr: messageOf(err) }));
88
- pluginHelpRaw = tail(help.stdout || help.stderr, 4000);
89
- pluginInstallStep.attempted = true;
90
- pluginInstallStep.exit_code = help.code;
91
- pluginInstallStep.stdout_tail = tail(help.stdout);
92
- pluginInstallStep.stderr_tail = tail(help.stderr);
93
- const installSubcommand = extractPluginInstallSubcommand(help.stdout || help.stderr || '');
94
- if (installSubcommand) {
95
- pluginInstallStep.ok = false;
96
- pluginInstallStep.blocker = 'codex_plugin_install_subcommand_found_but_not_auto_run';
97
- }
98
- else {
99
- pluginInstallStep.blocker = 'codex_plugin_help_did_not_reveal_install_subcommand';
100
- }
101
- }
102
91
  steps.push(pluginInstallStep);
103
92
  const after = await probe({ root, codexBin: codexBin || undefined, forceMacos: true })
104
93
  .catch((err) => ({ ok: false, status: 'unknown', blockers: [messageOf(err)] }));
@@ -106,22 +95,24 @@ export async function repairComputerUse(input) {
106
95
  id: 'computer_use_status_redetect',
107
96
  ok: after?.status === 'available',
108
97
  attempted: true,
109
- command: 'codex features list --json',
98
+ command: 'codex features list',
110
99
  blocker: after?.status === 'available' ? null : String(after?.status || 'unknown')
111
100
  });
112
101
  const recovered = after?.status === 'available';
113
102
  const blockers = recovered ? [] : [
114
103
  ...new Set([
115
104
  String(after?.status || 'computer_use_unavailable'),
116
- ...(pluginInstallStep.attempted && !recovered ? [pluginInstallStep.blocker] : [])
105
+ ...(pluginInstallStep.blocker && !recovered ? [pluginInstallStep.blocker] : [])
117
106
  ].filter(Boolean).map(String))
118
107
  ];
119
- const nextActions = recovered ? [] : [
108
+ const refreshActions = pluginRepair?.changed ? pluginRepair.next_actions || [] : [];
109
+ const nextActions = recovered ? refreshActions : [
110
+ ...refreshActions,
120
111
  'Install/update Codex CLI if missing: npm i -g @openai/codex@latest',
121
112
  'Open Codex App settings and enable Computer Use, or run: codex features enable computer_use',
122
113
  after?.status === 'codex_app_missing'
123
- ? 'A live `codex plugin --help` (or equivalent) lookup is required to find the real plugin install subcommand before SKS can auto-install a Computer Use plugin; this was not guessed. A human should run `codex plugin --help` (or check Codex App settings) and report the exact install subcommand back so it can be wired into this repair function.'
124
- : 'Verify with: codex features list --json',
114
+ ? 'Open the ChatGPT/Codex desktop app after plugin installation, enable the Computer Use server and skill toggles, and grant Screen Recording/Accessibility when prompted.'
115
+ : 'Verify with: codex features list',
125
116
  `Docs: ${CODEX_APP_DOCS_URL}`
126
117
  ];
127
118
  let report = {
@@ -134,9 +125,11 @@ export async function repairComputerUse(input) {
134
125
  before,
135
126
  after,
136
127
  steps,
128
+ plugin_repair: pluginRepair,
129
+ current_task_tool_manifest_verified: false,
130
+ requires_new_task: pluginRepair?.requires_new_task === true,
137
131
  blockers,
138
132
  next_actions: nextActions,
139
- plugin_help_raw: pluginHelpRaw,
140
133
  docs_url: CODEX_APP_DOCS_URL
141
134
  };
142
135
  if (input.reportPath !== null) {
@@ -152,12 +145,8 @@ export async function repairComputerUse(input) {
152
145
  }
153
146
  return report;
154
147
  }
155
- function extractPluginInstallSubcommand(helpText) {
156
- const match = String(helpText || '').match(/^\s*install\s+/m);
157
- return match ? 'install' : null;
158
- }
159
148
  function tail(value, max = 2000) {
160
- const text = String(value || '');
149
+ const text = redactString(String(value || ''));
161
150
  return text.length > max ? text.slice(-max) : text;
162
151
  }
163
152
  function messageOf(err) {
@@ -1,32 +1,16 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import os from 'node:os';
4
- import { ensureDir, exists, nowIso, readText, writeJsonAtomic, writeTextAtomic } from '../fsx.js';
4
+ import { exists, nowIso, readText, writeJsonAtomic } from '../fsx.js';
5
5
  import { isUnmanagedProjectCodexConfig, writeCodexConfigGuarded } from '../codex/codex-config-guard.js';
6
6
  export const DOCTOR_CODEX_STARTUP_REPAIR_SCHEMA = 'sks.doctor-codex-startup-repair.v1';
7
- const AGENT_ROLE_FILES = new Map([
8
- ['analysis_scout', { file: 'analysis-scout.toml', description: 'SKS scout with bounded write capability.', sandbox: 'workspace-write', nicknames: ['Scout', 'Mapper'] }],
9
- ['native_agent', { file: 'native-agent-intake.toml', description: 'SKS native agent with bounded write capability.', sandbox: 'workspace-write', nicknames: ['Analysis', 'Mapper'] }],
10
- ['team_consensus', { file: 'team-consensus.toml', description: 'SKS planning/debate agent with bounded write capability.', sandbox: 'workspace-write', nicknames: ['Consensus', 'Atlas'] }],
11
- ['implementation_worker', { file: 'implementation-worker.toml', description: 'SKS bounded implementation worker.', sandbox: 'workspace-write', nicknames: ['Builder', 'Mason'] }],
12
- ['db_safety_reviewer', { file: 'db-safety-reviewer.toml', description: 'DB safety reviewer with bounded write capability.', sandbox: 'workspace-write', nicknames: ['Sentinel', 'Ledger'] }],
13
- ['qa_reviewer', { file: 'qa-reviewer.toml', description: 'QA reviewer with bounded write capability.', sandbox: 'workspace-write', nicknames: ['Verifier', 'Reviewer'] }]
14
- ]);
15
- const DIRECTIVE_ROLE_FILES = [
16
- 'sks-explorer.toml',
17
- 'sks-planner.toml',
18
- 'sks-implementer.toml',
19
- 'sks-checker.toml',
20
- 'sks-release-verifier.toml',
21
- 'sks-zellij-ui-verifier.toml',
22
- 'sks-codex-probe-verifier.toml'
23
- ];
24
7
  export async function runDoctorCodexStartupRepair(input) {
25
8
  const root = path.resolve(input.root || process.cwd());
26
9
  const codexHome = input.codexHome || process.env.CODEX_HOME || path.join(process.env.HOME || os.homedir(), '.codex');
27
- const roleFiles = input.fix
28
- ? await repairAgentRoleFiles(root, codexHome)
29
- : await inspectAgentRoleFiles(root, codexHome);
10
+ // Project-scoped official custom-agent installation is owned by repairAgentRoleConfigs.
11
+ // This startup repair remains structural/MCP-only and never touches legacy
12
+ // or user agent TOMLs in project or global directories.
13
+ const roleFiles = { sanitized: [], created: [], blockers: [] };
30
14
  const configs = [];
31
15
  for (const candidate of [
32
16
  { scope: 'project', path: path.join(root, '.codex', 'config.toml'), agentDir: path.join(root, '.codex', 'agents') },
@@ -117,38 +101,6 @@ async function inspectOrRepairConfig(root, candidate, fix, nodeReplCommandCandid
117
101
  next = duplicateRepair.text;
118
102
  duplicateTomlBlocksRemoved.push(...duplicateRepair.removed);
119
103
  warnings.push(...duplicateRepair.warnings);
120
- for (const [tableName, role] of AGENT_ROLE_FILES) {
121
- const target = path.join(candidate.agentDir, role.file);
122
- let table = tomlBlock(next, `agents.${tableName}`);
123
- if (!table)
124
- continue;
125
- const currentDescription = stringValue(table.text, 'description');
126
- if (currentDescription !== role.description) {
127
- if (!fix)
128
- warnings.push(`agent_description_stale:${tableName}`);
129
- else {
130
- next = replaceOrInsertKey(next, table, 'description', `"${escapeToml(role.description)}"`);
131
- table = tomlBlock(next, `agents.${tableName}`);
132
- if (!table)
133
- continue;
134
- }
135
- }
136
- const current = stringValue(table.text, 'config_file');
137
- const targetExists = await exists(target);
138
- const currentValid = Boolean(current && path.isAbsolute(current) && await exists(current));
139
- if (currentValid && current === target)
140
- continue;
141
- if (!fix) {
142
- warnings.push(`agent_config_file_stale:${tableName}`);
143
- continue;
144
- }
145
- if (!targetExists) {
146
- await ensureDir(path.dirname(target));
147
- await writeTextAtomic(target, roleConfigToml(tableName, role.description, role.sandbox));
148
- }
149
- next = replaceOrInsertKey(next, table, 'config_file', `"${escapeToml(target)}"`);
150
- agentConfigFilesRepaired.push(target);
151
- }
152
104
  const nodeReplRepair = await inspectOrRepairNodeRepl(next, fix, nodeReplCommandCandidates, includeDefaultNodeReplCandidates);
153
105
  next = nodeReplRepair.text;
154
106
  warnings.push(...nodeReplRepair.warnings);
@@ -165,29 +117,39 @@ async function inspectOrRepairConfig(root, candidate, fix, nodeReplCommandCandid
165
117
  const codexApps = tomlBlock(next, 'mcp_servers.codex_apps');
166
118
  if (codexApps && /token_expired|expired/i.test(codexApps.text))
167
119
  blockers.push('codex_apps_token_expired');
168
- const changed = next !== text;
169
- const backupPath = changed && fix ? await backupConfig(candidate.path, text, 'startup') : null;
170
- if (changed && fix)
171
- await writeCodexConfigGuarded({
120
+ const plannedChanged = next !== text;
121
+ let changed = plannedChanged;
122
+ let backupPath = null;
123
+ let writeApplied = true;
124
+ if (plannedChanged && fix) {
125
+ const guarded = await writeCodexConfigGuarded({
172
126
  root,
173
127
  configPath: candidate.path,
174
128
  before: text,
175
129
  cause: 'doctor-codex-startup-repair',
176
130
  mutate: () => next.replace(/\n{3,}/g, '\n\n').replace(/\s*$/, '\n')
177
131
  });
132
+ writeApplied = guarded.ok;
133
+ changed = guarded.ok && guarded.changed;
134
+ backupPath = guarded.backup_path;
135
+ if (!guarded.ok) {
136
+ blockers.push(`config_write_guard:${guarded.status}`);
137
+ warnings.push(`config_preserved:${guarded.status}`);
138
+ }
139
+ }
178
140
  return {
179
141
  scope: candidate.scope,
180
142
  path: candidate.path,
181
143
  present: true,
182
144
  changed,
183
145
  backup_path: backupPath,
184
- agent_config_files_repaired: agentConfigFilesRepaired,
185
- stale_mcp_blocks_removed: staleMcpBlocksRemoved,
186
- mcp_blocks_repaired: mcpBlocksRepaired,
146
+ agent_config_files_repaired: writeApplied ? agentConfigFilesRepaired : [],
147
+ stale_mcp_blocks_removed: writeApplied ? staleMcpBlocksRemoved : [],
148
+ mcp_blocks_repaired: writeApplied ? mcpBlocksRepaired : [],
187
149
  optional_mcp_blocks_ignored: optionalMcpBlocksIgnored,
188
150
  blockers,
189
151
  warnings,
190
- duplicate_toml_blocks_removed: duplicateTomlBlocksRemoved
152
+ duplicate_toml_blocks_removed: writeApplied ? duplicateTomlBlocksRemoved : []
191
153
  };
192
154
  }
193
155
  function inspectOrRepairDuplicateTomlBlocks(text, candidate, fix) {
@@ -234,20 +196,7 @@ function tomlBlocks(text) {
234
196
  });
235
197
  }
236
198
  function selectDuplicateTomlBlockToKeep(header, rows, candidate) {
237
- const agentName = header.startsWith('agents.') ? header.slice('agents.'.length) : '';
238
- const role = agentName ? AGENT_ROLE_FILES.get(agentName) : undefined;
239
- if (role) {
240
- const target = path.join(candidate.agentDir, role.file);
241
- return maxIndexBy(rows, (block, index) => {
242
- const configFile = stringValue(block.text, 'config_file');
243
- const description = stringValue(block.text, 'description');
244
- return ((configFile === target ? 100 : 0) +
245
- (configFile && path.isAbsolute(configFile) ? 20 : 0) +
246
- (description === role.description ? 30 : 0) +
247
- assignmentCount(block.text) -
248
- index / 1000);
249
- });
250
- }
199
+ void candidate;
251
200
  if (header.startsWith('mcp_servers.'))
252
201
  return 0;
253
202
  return maxIndexBy(rows, (block, index) => assignmentCount(block.text) - index / 1000);
@@ -315,55 +264,6 @@ async function inspectOrRepairNodeRepl(text, fix, extraCandidates, includeDefaul
315
264
  repaired: []
316
265
  };
317
266
  }
318
- async function inspectAgentRoleFiles(root, codexHome) {
319
- const dirs = [path.join(root, '.codex', 'agents'), path.join(codexHome, 'agents')];
320
- const sanitized = [];
321
- for (const dir of dirs) {
322
- for (const file of DIRECTIVE_ROLE_FILES) {
323
- const full = path.join(dir, file);
324
- const text = await readText(full, null);
325
- if (typeof text === 'string' && /\bmessage_role_prefix\s*=/.test(text) && /SKS managed 3\.1\./.test(text))
326
- sanitized.push(full);
327
- }
328
- }
329
- return { sanitized, created: [], blockers: [] };
330
- }
331
- async function repairAgentRoleFiles(root, codexHome) {
332
- const dirs = [path.join(root, '.codex', 'agents'), path.join(codexHome, 'agents')];
333
- const sanitized = [];
334
- const created = [];
335
- const blockers = [];
336
- for (const dir of dirs) {
337
- for (const [name, role] of AGENT_ROLE_FILES) {
338
- const file = path.join(dir, role.file);
339
- const text = await readText(file, null);
340
- if (text == null) {
341
- await ensureDir(dir);
342
- await writeTextAtomic(file, roleConfigToml(name, role.description, role.sandbox));
343
- created.push(file);
344
- continue;
345
- }
346
- if (!text.includes(`sandbox_mode = "${role.sandbox}"`) || text.includes('Do not edit files.')) {
347
- await backupConfig(file, text, 'role-write-capable');
348
- await writeTextAtomic(file, roleConfigToml(name, role.description, role.sandbox));
349
- sanitized.push(file);
350
- }
351
- }
352
- for (const file of DIRECTIVE_ROLE_FILES) {
353
- const full = path.join(dir, file);
354
- const text = await readText(full, null);
355
- if (typeof text !== 'string')
356
- continue;
357
- if (!/\bmessage_role_prefix\s*=/.test(text) || !/SKS managed 3\.1\./.test(text))
358
- continue;
359
- const next = text.split('\n').filter((line) => !/^\s*message_role_prefix\s*=/.test(line)).join('\n');
360
- await backupConfig(full, text, 'role');
361
- await writeTextAtomic(full, next.replace(/\s*$/, '\n'));
362
- sanitized.push(full);
363
- }
364
- }
365
- return { sanitized, created, blockers };
366
- }
367
267
  function tomlBlock(text, table) {
368
268
  const header = new RegExp(`(^|\\n)\\s*\\[${escapeRegExp(table)}\\]\\s*(?:#.*)?(?:\\n|$)`, 'g');
369
269
  const match = header.exec(text);
@@ -470,31 +370,6 @@ function stringValues(text, key) {
470
370
  const re = new RegExp(`^\\s*${escapeRegExp(key)}\\s*=\\s*"([^"]*)"`, 'gm');
471
371
  return [...text.matchAll(re)].map((match) => String(match[1] || '')).filter(Boolean);
472
372
  }
473
- async function backupConfig(configPath, text, label) {
474
- try {
475
- const backupPath = `${configPath}.sks-${label}-${Date.now().toString(36)}.bak`;
476
- await ensureDir(path.dirname(backupPath));
477
- await writeTextAtomic(backupPath, text);
478
- return backupPath;
479
- }
480
- catch {
481
- return null;
482
- }
483
- }
484
- function roleConfigToml(name, description, sandbox) {
485
- return [
486
- `name = "${name}"`,
487
- `description = "${description}"`,
488
- `sandbox_mode = "${sandbox}"`,
489
- 'approval_policy = "never"',
490
- 'developer_instructions = """',
491
- `You are the SKS ${name} role.`,
492
- sandbox === 'read-only' ? 'Do not edit files.' : 'Only edit the bounded files assigned by the parent orchestrator.',
493
- 'Return concise source-backed findings and LIVE_EVENT lines when applicable.',
494
- '"""',
495
- ''
496
- ].join('\n');
497
- }
498
373
  function escapeToml(value) {
499
374
  return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
500
375
  }
@@ -154,7 +154,7 @@ async function backupConfig(configPath, text) {
154
154
  try {
155
155
  const backupPath = `${configPath}.sks-context7-${Date.now().toString(36)}.bak`;
156
156
  await ensureDir(path.dirname(backupPath));
157
- await writeTextAtomic(backupPath, text);
157
+ await writeTextAtomic(backupPath, text, { mode: 0o600 });
158
158
  return backupPath;
159
159
  }
160
160
  catch {
@@ -123,7 +123,7 @@ function phaseInputFiles(id) {
123
123
  return ['src/core/codex-native', 'src/scripts/native-capability-postcheck-check.ts'];
124
124
  if (id.includes('secret'))
125
125
  return ['safety-mutation-allowlist.json', 'src/scripts/secret-preservation-check.ts'];
126
- return ['package.json', 'config/codex-releases/rust-v0.142.0.json'];
126
+ return ['package.json', 'config/codex-releases/rust-v0.144.1.json'];
127
127
  }
128
128
  function packageIdentity() {
129
129
  const root = packageRoot();
@@ -1,11 +1,16 @@
1
+ import fs from 'node:fs/promises';
1
2
  import path from 'node:path';
2
- import { nowIso, writeJsonAtomic } from '../fsx.js';
3
+ import { nowIso, readText, writeJsonAtomic } from '../fsx.js';
3
4
  import { syncCoreSkillsIntegrity } from '../codex-native/core-skill-integrity.js';
4
5
  import { dedupeProjectSkills } from '../codex-native/project-skill-dedupe.js';
5
6
  import { repairNativeCapabilities } from '../codex-native/native-capability-repair.js';
6
7
  import { withSecretPreservationGuard } from '../config/config-migration-journal.js';
8
+ import { ensureProductDesignPluginInstalled } from '../product-design-app-server.js';
9
+ import { cleanupLegacyGlobalSksHooks } from './legacy-global-hook-cleanup.js';
10
+ import { redactSecrets } from '../secret-redaction.js';
7
11
  export async function runDoctorNativeCapabilityRepair(input) {
8
12
  const root = path.resolve(input.root);
13
+ const fixRequested = input.fix || (input.flags || []).includes('--fix');
9
14
  const operation = async () => {
10
15
  const coreSkills = await syncCoreSkillsIntegrity({ root, apply: input.fix });
11
16
  const skillDedupe = await dedupeProjectSkills({
@@ -22,6 +27,30 @@ export async function runDoctorNativeCapabilityRepair(input) {
22
27
  yes: input.yes,
23
28
  allowManualInstructions: true
24
29
  });
30
+ const probeArtifactCleanup = await cleanupNativeCapabilityProbeArtifacts(root, { apply: fixRequested });
31
+ const legacyGlobalHooks = await cleanupLegacyGlobalSksHooks({
32
+ root,
33
+ ...(input.home ? { home: input.home } : {}),
34
+ apply: fixRequested
35
+ });
36
+ const productDesignRaw = input.fix
37
+ ? await ensureProductDesignPluginInstalled({
38
+ cwd: root,
39
+ autoInstallProductDesign: true,
40
+ timeoutMs: 12_000
41
+ }).catch((err) => ({ ok: false, status: 'app_server_unavailable', blockers: [messageOf(err)] }))
42
+ : { ok: true, skipped: true, status: 'deferred_to_explicit_native_capability_repair', blockers: [] };
43
+ const productDesignWithActions = productDesignRaw?.install_attempted === true ? {
44
+ ...productDesignRaw,
45
+ current_task_tool_manifest_verified: false,
46
+ requires_new_task: true,
47
+ restart_app_if_stale: true,
48
+ next_actions: [
49
+ 'Start a new Codex/Work task so Product Design skills and tools are attached to a fresh task manifest.',
50
+ 'If Product Design is still missing, restart the ChatGPT/Codex desktop app and rerun the native capability doctor.'
51
+ ]
52
+ } : productDesignRaw;
53
+ const productDesign = redactSecrets(productDesignWithActions);
25
54
  const blockers = [
26
55
  ...(coreSkills.blockers || []),
27
56
  ...(skillDedupe.blockers || []),
@@ -31,7 +60,10 @@ export async function runDoctorNativeCapabilityRepair(input) {
31
60
  const optionalManualRequired = nativeCapabilities.optional_manual_required || [];
32
61
  const optionalWarnings = [
33
62
  ...(nativeCapabilities.warnings || []),
34
- ...optionalManualRequired.map((id) => `${id}_manual_required`)
63
+ ...optionalManualRequired.map((id) => `${id}_manual_required`),
64
+ ...(legacyGlobalHooks.blockers || []).map((blocker) => `legacy_global_hooks:${blocker}`),
65
+ ...(legacyGlobalHooks.warnings || []),
66
+ ...(productDesign.ok === false ? (productDesign.blockers || ['product_design_not_ready']).map((blocker) => `product_design:${blocker}`) : [])
35
67
  ];
36
68
  let report = {
37
69
  schema: 'sks.doctor-native-capability-repair.v1',
@@ -43,6 +75,9 @@ export async function runDoctorNativeCapabilityRepair(input) {
43
75
  core_skills: coreSkills,
44
76
  skill_dedupe: skillDedupe,
45
77
  native_capabilities: nativeCapabilities,
78
+ product_design: productDesign,
79
+ legacy_global_hooks: legacyGlobalHooks,
80
+ probe_artifact_cleanup: probeArtifactCleanup,
46
81
  secret_preservation_guard: '.sneakoscope/reports/secret-preservation-guard.json',
47
82
  core_blockers: blockers,
48
83
  route_blockers: routeBlockers,
@@ -60,10 +95,46 @@ export async function runDoctorNativeCapabilityRepair(input) {
60
95
  }
61
96
  return report;
62
97
  };
63
- if (!input.fix)
98
+ if (!fixRequested)
64
99
  return operation();
65
100
  return withSecretPreservationGuard(root, 'doctor-native-capability-repair', operation);
66
101
  }
102
+ export async function cleanupNativeCapabilityProbeArtifacts(root, opts = { apply: true }) {
103
+ const sentinel = 'sks-native-capability-postcheck\n';
104
+ const candidates = [
105
+ path.join(root, '.sneakoscope', 'image-artifacts', 'postcheck-followup-sample.txt'),
106
+ path.join(root, '.sneakoscope', 'app-screenshots', 'postcheck-screenshot-sample.txt'),
107
+ path.join(root, '.sneakoscope', 'image-artifacts', 'postcheck-contract-image.txt'),
108
+ path.join(root, '.sneakoscope', 'app-screenshots', 'postcheck-contract-screenshot.txt')
109
+ ];
110
+ const removed = [];
111
+ const planned = [];
112
+ const preserved = [];
113
+ for (const file of candidates) {
114
+ const text = await readText(file, '');
115
+ if (!text)
116
+ continue;
117
+ if (text !== sentinel) {
118
+ preserved.push(file);
119
+ continue;
120
+ }
121
+ if (opts.apply !== false) {
122
+ await fs.rm(file, { force: true });
123
+ removed.push(file);
124
+ }
125
+ else {
126
+ planned.push(file);
127
+ }
128
+ }
129
+ return {
130
+ schema: 'sks.native-capability-probe-artifact-cleanup.v1',
131
+ ok: true,
132
+ apply: opts.apply !== false,
133
+ removed,
134
+ planned,
135
+ preserved_non_probe_files: preserved
136
+ };
137
+ }
67
138
  function messageOf(err) {
68
139
  return err instanceof Error ? err.message : String(err);
69
140
  }
@@ -2,6 +2,7 @@ import path from 'node:path';
2
2
  import { CODEX_APP_IMAGE_GENERATION_DOC_URL } from '../routes.js';
3
3
  import { detectImagegenCapability } from '../imagegen/imagegen-capability.js';
4
4
  import { ensureDir, nowIso, runProcess, which, writeJsonAtomic } from '../fsx.js';
5
+ import { redactString } from '../secret-redaction.js';
5
6
  export const DOCTOR_IMAGEGEN_REPAIR_SCHEMA = 'sks.doctor-imagegen-repair.v1';
6
7
  export async function repairCodexImagegen(input) {
7
8
  const root = path.resolve(input.root || process.cwd());
@@ -108,22 +109,45 @@ export async function repairCodexImagegen(input) {
108
109
  id: 'imagegen_capability_redetect',
109
110
  ok: after?.core_ready === true,
110
111
  attempted: true,
111
- command: 'codex features list --json',
112
+ command: 'codex features list',
113
+ status: after?.core_ready === true ? 'configuration_ready_output_unverified' : 'configuration_missing',
114
+ evidence_level: 'configuration',
112
115
  blocker: after?.core_ready === true ? null : 'codex_app_builtin_imagegen_capability_missing'
113
116
  });
114
- // No real generation round-trip primitive exists in imagegen-capability.ts today; this only re-confirms the feature flag, not actual output.
117
+ const capabilityReady = after?.core_ready === true;
118
+ const realGenerationVerified = capabilityReady
119
+ && after?.real_generation_available === true
120
+ && after?.real_output_verified_by_capability_check === true;
121
+ // No real generation round-trip primitive exists in imagegen-capability.ts today.
122
+ // Keep configuration detection separate from route/output proof.
115
123
  const communicationTest = {
116
- level: 'flag_level',
117
- ok: after?.core_ready === true,
118
- checked: 'codex features list --json (feature-flag/plugin metadata only)',
119
- real_generation_round_trip_performed: false,
120
- blocker: after?.core_ready === true ? null : 'codex_app_builtin_imagegen_capability_missing'
124
+ level: realGenerationVerified ? 'real_output' : 'flag_level',
125
+ ok: realGenerationVerified,
126
+ checked: realGenerationVerified
127
+ ? 'real Codex App $imagegen generated-output evidence'
128
+ : 'codex features list (feature-flag/plugin metadata only)',
129
+ real_generation_round_trip_performed: realGenerationVerified,
130
+ configuration_ready: capabilityReady,
131
+ blocker: realGenerationVerified
132
+ ? null
133
+ : capabilityReady
134
+ ? 'codex_imagegen_real_output_unverified'
135
+ : 'codex_app_builtin_imagegen_capability_missing'
121
136
  };
122
- const recovered = after?.core_ready === true;
137
+ const recovered = realGenerationVerified;
138
+ const featureEnableStep = steps.find((step) => step.id === 'image_generation_feature_enable');
139
+ const configurationRecovered = before?.core_ready !== true && capabilityReady && featureEnableStep?.attempted === true && featureEnableStep.ok === true;
140
+ const requiresNewTask = !recovered;
141
+ const refreshActions = requiresNewTask ? [
142
+ 'Start a new Codex/Work task so the repaired $imagegen tool is attached to a fresh task manifest.',
143
+ 'Invoke Codex App $imagegen with gpt-image-2 and bind the selected raster output path to the route evidence.',
144
+ 'If $imagegen is missing in the new task, restart the ChatGPT/Codex desktop app and rerun `sks doctor --fix --repair-native-capabilities --yes`.'
145
+ ] : [];
123
146
  const blockers = recovered ? [] : [
124
147
  ...new Set([
125
148
  ...(after?.core_blockers || []),
126
149
  ...(after?.blockers || []),
150
+ ...(capabilityReady ? ['codex_imagegen_real_output_unverified'] : []),
127
151
  'codex_imagegen_unavailable'
128
152
  ].map(String))
129
153
  ];
@@ -134,15 +158,26 @@ export async function repairCodexImagegen(input) {
134
158
  attempted: before?.core_ready !== true,
135
159
  apply,
136
160
  recovered,
161
+ capability_ready: capabilityReady,
162
+ configuration_ready: capabilityReady,
163
+ configuration_recovered: configurationRecovered,
164
+ route_ready: recovered,
165
+ real_generation_verified: realGenerationVerified,
166
+ evidence_level: realGenerationVerified ? 'real-output' : capabilityReady ? 'configuration' : 'none',
137
167
  before,
138
168
  after,
139
169
  steps,
140
170
  communication_test: communicationTest,
171
+ current_task_tool_manifest_verified: false,
172
+ requires_new_task: requiresNewTask,
141
173
  blockers,
142
174
  manual_actions: recovered ? [] : [
143
- `Install/update Codex CLI if missing: npm i -g @openai/codex@latest`,
144
- `Open Codex App settings and enable image_generation / $imagegen.`,
145
- `Verify with: codex features list --json`,
175
+ ...refreshActions,
176
+ ...(!capabilityReady ? [
177
+ `Install/update Codex CLI if missing: npm i -g @openai/codex@latest`,
178
+ `Open Codex App settings and enable image_generation / $imagegen.`,
179
+ `Verify configuration with: codex features list`
180
+ ] : []),
146
181
  `Docs: ${CODEX_APP_IMAGE_GENERATION_DOC_URL}`
147
182
  ],
148
183
  docs_url: CODEX_APP_IMAGE_GENERATION_DOC_URL
@@ -161,7 +196,7 @@ export async function repairCodexImagegen(input) {
161
196
  return report;
162
197
  }
163
198
  function tail(value, max = 2000) {
164
- const text = String(value || '');
199
+ const text = redactString(String(value || ''));
165
200
  return text.length > max ? text.slice(-max) : text;
166
201
  }
167
202
  function messageOf(err) {