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,34 +1,39 @@
1
+ import fs from 'node:fs';
1
2
  import fsp from 'node:fs/promises';
2
3
  import path from 'node:path';
3
4
  import { ensureDir, exists, nowIso, readJson, writeJsonAtomic, writeTextAtomic } from '../fsx.js';
4
- import { findLatestMission, missionDir, missionsDir } from '../mission.js';
5
+ import { withFileLock } from '../locks/file-lock.js';
6
+ import { findLatestMission, missionsDir } from '../mission.js';
5
7
  import { codexSchemaPath, runCodexExecResumeWithOutputSchema } from '../codex-exec-output-schema.js';
6
8
  import { WRONGNESS_INDEX_SCHEMA, WRONGNESS_LEDGER_SCHEMA, createWrongnessRecord, deterministicWrongnessId, emptyWrongnessLedger, normalizeRootCauseKind, normalizeSeverity, normalizeWrongnessKind, severityForRecord, validateWrongnessLedger } from './wrongness-schema.js';
9
+ const CANONICAL_MISSION_ID_RE = /^M-[A-Za-z0-9][A-Za-z0-9._-]*$/;
7
10
  export function projectWrongnessLedgerPath(root) {
8
- return path.join(root, '.sneakoscope', 'wiki', 'wrongness-ledger.json');
11
+ return path.join(safeWrongnessWikiDir(root), 'wrongness-ledger.json');
9
12
  }
10
13
  export function wrongnessIndexPath(root) {
11
- return path.join(root, '.sneakoscope', 'wiki', 'wrongness-index.json');
14
+ return path.join(safeWrongnessWikiDir(root), 'wrongness-index.json');
12
15
  }
13
16
  export function wrongnessSummaryPath(root) {
14
- return path.join(root, '.sneakoscope', 'wiki', 'wrongness-summary.md');
17
+ return path.join(safeWrongnessWikiDir(root), 'wrongness-summary.md');
15
18
  }
16
19
  export function missionWrongnessLedgerPath(root, missionId) {
17
- return path.join(missionDir(root, missionId), 'wrongness-ledger.json');
20
+ return path.join(safeWrongnessMissionDir(root, missionId), 'wrongness-ledger.json');
18
21
  }
19
22
  export function missionWrongnessSummaryPath(root, missionId) {
20
- return path.join(missionDir(root, missionId), 'wrongness-summary.md');
23
+ return path.join(safeWrongnessMissionDir(root, missionId), 'wrongness-summary.md');
21
24
  }
22
25
  export function missionWrongnessLinksPath(root, missionId) {
23
- return path.join(missionDir(root, missionId), 'wrongness-triwiki-links.json');
26
+ return path.join(safeWrongnessMissionDir(root, missionId), 'wrongness-triwiki-links.json');
24
27
  }
25
28
  export async function resolveWrongnessMissionId(root, missionArg = null) {
26
29
  const raw = typeof missionArg === 'string' && missionArg.trim() ? missionArg.trim() : null;
27
30
  if (!raw || raw === 'project')
28
31
  return null;
29
- if (raw === 'latest')
30
- return findLatestMission(root);
31
- return raw;
32
+ const resolved = raw === 'latest' ? await findLatestMission(root) : raw;
33
+ if (!resolved)
34
+ return null;
35
+ assertCanonicalMissionId(resolved);
36
+ return resolved;
32
37
  }
33
38
  export async function readWrongnessLedger(root, missionId = null) {
34
39
  const ledger = await readBaseWrongnessLedger(root, missionId);
@@ -48,6 +53,9 @@ async function readBaseWrongnessLedger(root, missionId = null) {
48
53
  return normalizeWrongnessLedger(raw, missionId ? 'mission' : 'project', missionId);
49
54
  }
50
55
  export async function writeWrongnessLedger(root, ledger) {
56
+ return withWrongnessMutationLock(root, () => writeWrongnessLedgerUnlocked(root, ledger));
57
+ }
58
+ async function writeWrongnessLedgerUnlocked(root, ledger) {
51
59
  const file = ledger.mission_id ? missionWrongnessLedgerPath(root, ledger.mission_id) : projectWrongnessLedgerPath(root);
52
60
  const normalized = normalizeWrongnessLedger({ ...ledger, generated_at: nowIso() }, ledger.scope, ledger.mission_id);
53
61
  await ensureDir(path.dirname(file));
@@ -57,7 +65,14 @@ export async function writeWrongnessLedger(root, ledger) {
57
65
  export async function readCombinedWrongnessRecords(root, missionId = null) {
58
66
  const project = await readWrongnessLedger(root, null);
59
67
  const mission = missionId ? await readWrongnessLedger(root, missionId) : emptyWrongnessLedger('mission', missionId);
60
- return dedupeRecords([...project.records, ...mission.records]);
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
+ const projectRecords = missionId
73
+ ? project.records.filter((record) => !record.mission_id || record.mission_id === missionId)
74
+ : project.records;
75
+ return dedupeRecords([...projectRecords, ...mission.records]);
61
76
  }
62
77
  export async function addWrongnessRecord(root, input = {}, opts = {}) {
63
78
  const row = asRecord(input);
@@ -66,11 +81,15 @@ export async function addWrongnessRecord(root, input = {}, opts = {}) {
66
81
  : typeof row.mission_id === 'string'
67
82
  ? row.mission_id
68
83
  : null;
84
+ if (missionId)
85
+ assertCanonicalMissionId(missionId);
69
86
  const record = createWrongnessRecord({ ...row, mission_id: missionId });
70
- const project = await upsertIntoScope(root, null, record);
71
- const mission = missionId ? await upsertIntoScope(root, missionId, record) : null;
72
- await writeWrongnessSummaries(root, missionId);
73
- return { record, project, mission };
87
+ return withWrongnessMutationLock(root, async () => {
88
+ const project = await upsertIntoScopeUnlocked(root, null, record);
89
+ const mission = missionId ? await upsertIntoScopeUnlocked(root, missionId, record) : null;
90
+ await writeWrongnessSummariesUnlocked(root, missionId);
91
+ return { record, project, mission };
92
+ });
74
93
  }
75
94
  export async function extractWrongnessWithOutputSchema(root, { sessionId, prompt, outputFile = null } = {}) {
76
95
  if (!sessionId) {
@@ -90,36 +109,47 @@ export async function extractWrongnessWithOutputSchema(root, { sessionId, prompt
90
109
  }, { cwd: root });
91
110
  }
92
111
  export async function resolveWrongnessRecord(root, id, reason = 'Resolved after corrective action', status = 'resolved') {
93
- const scopes = await discoverWrongnessScopes(root);
94
- const updatedRecords = [];
95
- let updated = 0;
96
- for (const missionId of scopes) {
97
- const ledger = await readWrongnessLedger(root, missionId);
98
- let changed = false;
99
- const records = ledger.records.map((record) => {
100
- if (record.id !== id)
101
- return record;
102
- changed = true;
103
- updated += 1;
104
- const next = {
105
- ...record,
106
- updated_at: nowIso(),
107
- status,
108
- truth_status: status === 'false_alarm' ? 'uncertain' : 'corrected',
109
- corrective_action: {
110
- ...record.corrective_action,
111
- patch_status: status,
112
- summary: reason || record.corrective_action.summary
113
- }
114
- };
115
- updatedRecords.push(next);
116
- return next;
117
- });
118
- if (changed)
119
- await writeWrongnessLedger(root, { ...ledger, records });
120
- }
121
- await writeWrongnessSummaries(root, null);
122
- return { updated, records: updatedRecords };
112
+ return withWrongnessMutationLock(root, async () => {
113
+ const scopes = await discoverWrongnessScopes(root);
114
+ const updatedRecords = [];
115
+ const changedMissions = new Set();
116
+ let updated = 0;
117
+ 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
+ const ledger = await readBaseWrongnessLedger(root, missionId);
122
+ let changed = false;
123
+ const records = ledger.records.map((record) => {
124
+ if (record.id !== id)
125
+ return record;
126
+ changed = true;
127
+ updated += 1;
128
+ const next = {
129
+ ...record,
130
+ updated_at: nowIso(),
131
+ status,
132
+ truth_status: status === 'false_alarm' ? 'uncertain' : 'corrected',
133
+ corrective_action: {
134
+ ...record.corrective_action,
135
+ patch_status: status,
136
+ summary: reason || record.corrective_action.summary
137
+ }
138
+ };
139
+ updatedRecords.push(next);
140
+ return next;
141
+ });
142
+ if (changed) {
143
+ await writeWrongnessLedgerUnlocked(root, { ...ledger, records });
144
+ if (missionId)
145
+ changedMissions.add(missionId);
146
+ }
147
+ }
148
+ await writeWrongnessSummariesUnlocked(root, null);
149
+ for (const missionId of changedMissions)
150
+ await writeMissionWrongnessSummaryUnlocked(root, missionId);
151
+ return { updated, records: updatedRecords };
152
+ });
123
153
  }
124
154
  export async function findWrongnessRecord(root, id) {
125
155
  for (const missionId of await discoverWrongnessScopes(root)) {
@@ -169,20 +199,25 @@ export function summarizeWrongnessRecords(records) {
169
199
  };
170
200
  }
171
201
  export async function writeWrongnessSummaries(root, missionId = null) {
202
+ return withWrongnessMutationLock(root, () => writeWrongnessSummariesUnlocked(root, missionId));
203
+ }
204
+ async function writeWrongnessSummariesUnlocked(root, missionId = null) {
172
205
  await writeProjectWrongnessIndex(root);
173
206
  await writeTextAtomic(wrongnessSummaryPath(root), renderWrongnessSummaryMarkdown(await readWrongnessLedger(root, null), 'Project Wrongness Memory'));
174
- if (missionId) {
175
- const ledger = await readWrongnessLedger(root, missionId);
176
- await writeTextAtomic(missionWrongnessSummaryPath(root, missionId), renderWrongnessSummaryMarkdown(ledger, `Mission ${missionId} Wrongness Memory`));
177
- await writeJsonAtomic(missionWrongnessLinksPath(root, missionId), {
178
- schema: 'sks.triwiki-wrongness-links.v1',
179
- generated_at: nowIso(),
180
- mission_id: missionId,
181
- project_ledger: '.sneakoscope/wiki/wrongness-ledger.json',
182
- mission_ledger: `.sneakoscope/missions/${missionId}/wrongness-ledger.json`,
183
- active_ids: ledger.records.filter((record) => record.status === 'active').map((record) => record.id)
184
- });
185
- }
207
+ if (missionId)
208
+ await writeMissionWrongnessSummaryUnlocked(root, missionId);
209
+ }
210
+ async function writeMissionWrongnessSummaryUnlocked(root, missionId) {
211
+ const ledger = await readBaseWrongnessLedger(root, missionId);
212
+ await writeTextAtomic(missionWrongnessSummaryPath(root, missionId), renderWrongnessSummaryMarkdown(ledger, `Mission ${missionId} Wrongness Memory`));
213
+ await writeJsonAtomic(missionWrongnessLinksPath(root, missionId), {
214
+ schema: 'sks.triwiki-wrongness-links.v1',
215
+ generated_at: nowIso(),
216
+ mission_id: missionId,
217
+ project_ledger: '.sneakoscope/wiki/wrongness-ledger.json',
218
+ mission_ledger: `.sneakoscope/missions/${missionId}/wrongness-ledger.json`,
219
+ active_ids: ledger.records.filter((record) => record.status === 'active').map((record) => record.id)
220
+ });
186
221
  }
187
222
  export async function recordWrongnessFromTrustReport(root, report) {
188
223
  const row = asRecord(report);
@@ -263,7 +298,7 @@ export async function recordDbSafetyMismatchWrongness(root, input = {}) {
263
298
  wrongness_kind: kind,
264
299
  severity: kind === 'db_safety_false_negative' ? 'high' : 'medium',
265
300
  claim: { text: `DB safety expected ${expected} but classified ${actual}.` },
266
- detected_by: { source: 'db_safety_check', command: typeof row.command === 'string' ? row.command : 'sks db check', artifact: typeof row.artifact === 'string' ? row.artifact : null, detail: typeof row.sql === 'string' ? row.sql : null },
301
+ detected_by: { source: 'db_safety_check', command: typeof row.command === 'string' ? row.command : '$DB internal safety check', artifact: typeof row.artifact === 'string' ? row.artifact : null, detail: typeof row.sql === 'string' ? row.sql : null },
267
302
  root_cause: { category: 'missing_db_policy', explanation: 'A DB safety expectation did not match the current classifier output.' },
268
303
  corrective_action: { summary: 'Adjust the policy/classifier or fixture expectation, then rerun DB safety validation.', required_evidence: ['db-operation-report.json'], patch_status: 'pending' },
269
304
  links: { artifacts: typeof row.artifact === 'string' ? [row.artifact] : [] }
@@ -319,10 +354,18 @@ function normalizeWrongnessLedger(value, scope, missionId) {
319
354
  records
320
355
  };
321
356
  }
322
- async function upsertIntoScope(root, missionId, record) {
357
+ async function upsertIntoScopeUnlocked(root, missionId, record) {
323
358
  const ledger = await readBaseWrongnessLedger(root, missionId);
324
359
  const nextRecords = upsertRecord(ledger.records, record);
325
- return writeWrongnessLedger(root, { ...ledger, records: nextRecords });
360
+ return writeWrongnessLedgerUnlocked(root, { ...ledger, records: nextRecords });
361
+ }
362
+ function withWrongnessMutationLock(root, fn) {
363
+ const lockDir = safeWrongnessLockDir(root);
364
+ return withFileLock({
365
+ lockPath: path.join(lockDir, 'triwiki-wrongness.lock'),
366
+ timeoutMs: 60_000,
367
+ staleMs: 120_000
368
+ }, fn);
326
369
  }
327
370
  function upsertRecord(records, record) {
328
371
  const seen = new Set();
@@ -355,13 +398,96 @@ async function discoverWrongnessScopes(root) {
355
398
  return scopes;
356
399
  }
357
400
  for (const name of entries) {
358
- if (!name.startsWith('M-'))
401
+ if (!CANONICAL_MISSION_ID_RE.test(name))
359
402
  continue;
360
403
  if (await exists(missionWrongnessLedgerPath(root, name)))
361
404
  scopes.push(name);
362
405
  }
363
406
  return scopes;
364
407
  }
408
+ function assertCanonicalMissionId(missionId) {
409
+ if (!CANONICAL_MISSION_ID_RE.test(String(missionId || '')))
410
+ throw new Error(`invalid_mission_id:${missionId}`);
411
+ }
412
+ function safeWrongnessMissionDir(root, missionId) {
413
+ assertCanonicalMissionId(missionId);
414
+ const resolvedRoot = path.resolve(root);
415
+ const stateRoot = assertSafeSneakoscopeRoot(resolvedRoot);
416
+ const base = path.resolve(missionsDir(resolvedRoot));
417
+ const candidate = path.resolve(base, missionId);
418
+ const relative = path.relative(base, candidate);
419
+ if (relative.startsWith('..') || path.isAbsolute(relative))
420
+ throw new Error(`mission_path_outside_root:${missionId}`);
421
+ const baseStat = lstatIfPresent(base);
422
+ if (baseStat && (!baseStat.isDirectory() || baseStat.isSymbolicLink()))
423
+ throw new Error('unsafe_missions_root_symlink');
424
+ const candidateStat = lstatIfPresent(candidate);
425
+ if (candidateStat && (!candidateStat.isDirectory() || candidateStat.isSymbolicLink()))
426
+ throw new Error(`unsafe_mission_directory:${missionId}`);
427
+ if (baseStat && candidateStat) {
428
+ const realBase = fs.realpathSync(base);
429
+ const realCandidate = fs.realpathSync(candidate);
430
+ const realRelative = path.relative(realBase, realCandidate);
431
+ if (realRelative.startsWith('..') || path.isAbsolute(realRelative))
432
+ throw new Error(`mission_realpath_outside_root:${missionId}`);
433
+ }
434
+ return candidate;
435
+ }
436
+ function safeWrongnessWikiDir(root) {
437
+ const stateRoot = assertSafeSneakoscopeRoot(root);
438
+ const wiki = path.join(stateRoot, 'wiki');
439
+ const wikiStat = lstatIfPresent(wiki);
440
+ if (wikiStat && (!wikiStat.isDirectory() || wikiStat.isSymbolicLink()))
441
+ throw new Error('unsafe_wrongness_wiki_symlink');
442
+ if (wikiStat) {
443
+ const realState = fs.realpathSync(stateRoot);
444
+ const realWiki = fs.realpathSync(wiki);
445
+ const relative = path.relative(realState, realWiki);
446
+ if (relative.startsWith('..') || path.isAbsolute(relative))
447
+ throw new Error('wrongness_wiki_realpath_outside_root');
448
+ }
449
+ return wiki;
450
+ }
451
+ function safeWrongnessLockDir(root) {
452
+ const stateRoot = assertSafeSneakoscopeRoot(root);
453
+ const locks = path.join(stateRoot, 'locks');
454
+ const lockStat = lstatIfPresent(locks);
455
+ if (lockStat && (!lockStat.isDirectory() || lockStat.isSymbolicLink()))
456
+ throw new Error('unsafe_wrongness_lock_symlink');
457
+ if (lockStat) {
458
+ const realState = fs.realpathSync(stateRoot);
459
+ const realLocks = fs.realpathSync(locks);
460
+ const relative = path.relative(realState, realLocks);
461
+ if (relative.startsWith('..') || path.isAbsolute(relative))
462
+ throw new Error('wrongness_lock_realpath_outside_root');
463
+ }
464
+ return locks;
465
+ }
466
+ function assertSafeSneakoscopeRoot(root) {
467
+ const resolvedRoot = path.resolve(root);
468
+ const stateRoot = path.join(resolvedRoot, '.sneakoscope');
469
+ const stateStat = lstatIfPresent(stateRoot);
470
+ if (stateStat && (!stateStat.isDirectory() || stateStat.isSymbolicLink()))
471
+ throw new Error('unsafe_sneakoscope_root_symlink');
472
+ if (stateStat) {
473
+ const realRoot = fs.realpathSync(resolvedRoot);
474
+ const realState = fs.realpathSync(stateRoot);
475
+ const relative = path.relative(realRoot, realState);
476
+ if (relative.startsWith('..') || path.isAbsolute(relative))
477
+ throw new Error('sneakoscope_realpath_outside_root');
478
+ }
479
+ return stateRoot;
480
+ }
481
+ function lstatIfPresent(file) {
482
+ try {
483
+ return fs.lstatSync(file);
484
+ }
485
+ catch (error) {
486
+ if (error?.code === 'ENOENT')
487
+ return null;
488
+ throw error;
489
+ }
490
+ }
365
491
  function dedupeRecords(records) {
366
492
  const byId = new Map();
367
493
  for (const record of records)
@@ -8,15 +8,24 @@ export async function wrongnessContextForRoute(root, opts = {}) {
8
8
  const records = await readCombinedWrongnessRecords(root, missionId);
9
9
  const active = records.filter((record) => record.status === 'active');
10
10
  const routeRelevant = active.filter((record) => !route || !record.route || record.route === route || record.avoidance_rule.applies_to.includes(route));
11
- const selected = [...routeRelevant, ...active.filter((record) => !routeRelevant.some((candidate) => candidate.id === record.id))]
11
+ const routeRelevantIds = new Set(routeRelevant.map((record) => record.id));
12
+ const selected = [...routeRelevant, ...active.filter((record) => !routeRelevantIds.has(record.id))]
12
13
  .sort(sortWrongnessForRecall)
13
14
  .slice(0, limit);
15
+ const summary = summarizeWrongnessRecords(records);
14
16
  return {
15
17
  schema: WRONGNESS_CONTEXT_SCHEMA,
16
18
  generated_at: nowIso(),
17
19
  mission_id: missionId,
18
20
  route,
19
- summary: summarizeWrongnessRecords(records),
21
+ summary: {
22
+ ...summary,
23
+ active_ids: selected.map((record) => record.id),
24
+ avoidance_rules: selected.map((record) => record.avoidance_rule).filter((rule) => rule.text),
25
+ context_limit: limit,
26
+ omitted_active_records: Math.max(0, Number(summary.active || 0) - selected.length),
27
+ bounded: true
28
+ },
20
29
  active_records: selected.map(recordToContextRow),
21
30
  active_avoidance_rules: selected.map((record) => record.avoidance_rule),
22
31
  retrieval_policy: 'negative_evidence_first_for_related_claims; do not let active wrongness upgrade trust without correction evidence'
@@ -47,6 +47,8 @@ export function applyWrongnessTrustStatus(base, impact) {
47
47
  return 'failed';
48
48
  if (base === 'not_verified' || impactStatus === 'not_verified')
49
49
  return 'not_verified';
50
+ if (base === 'mock_only' || impactStatus === 'mock_only')
51
+ return 'mock_only';
50
52
  if (base === 'verified_partial' || impactStatus === 'verified_partial' || (impact.issues || []).length)
51
53
  return 'verified_partial';
52
54
  return 'verified';
@@ -29,7 +29,7 @@ export async function runSksUpdateCheck(options = {}) {
29
29
  effectiveOptions.maxOutputBytes = options.maxOutputBytes;
30
30
  const override = env[versionOverrideEnvName(packageName)];
31
31
  const effectivePromise = detectEffectiveSksVersion(effectiveOptions);
32
- const latestCache = !override ? await readUpdateLatestCache(packageName, registry).catch(() => null) : null;
32
+ const latestCache = !override ? await readUpdateLatestCache(packageName, registry, env).catch(() => null) : null;
33
33
  const latestPromise = !override && npmBin
34
34
  ? runProcess(npmBin, ['view', packageName, 'version', '--silent', '--registry', registry], {
35
35
  env,
@@ -92,7 +92,7 @@ export async function runSksUpdateCheck(options = {}) {
92
92
  }
93
93
  const latest = String(result.stdout || '').trim().split(/\s+/).pop() || null;
94
94
  if (latest)
95
- await writeUpdateLatestCache(packageName, registry, latest).catch(() => undefined);
95
+ await writeUpdateLatestCache(packageName, registry, latest, env).catch(() => undefined);
96
96
  return buildResult({
97
97
  packageName,
98
98
  current,
@@ -107,7 +107,7 @@ export async function runSksUpdateNow(options = {}) {
107
107
  const registry = options.registry || DEFAULT_REGISTRY;
108
108
  const env = options.env || process.env;
109
109
  const npmBin = options.npmBin === undefined ? await which('npm') : options.npmBin;
110
- const cwd = os.homedir();
110
+ const cwd = env.HOME || os.homedir();
111
111
  const check = await runSksUpdateCheck({
112
112
  ...options,
113
113
  packageName,
@@ -226,7 +226,7 @@ export async function runSksUpdateNow(options = {}) {
226
226
  const sksMenuBar = migrationCurrent
227
227
  ? await installUpdateSksMenuBar({ root: projectReceiptRoot, env, stage, quiet: machineOutput })
228
228
  : null;
229
- await runUpdateGlobalSkillsReconcile(stage, { quiet: machineOutput });
229
+ await runUpdateGlobalSkillsReconcile(stage, { quiet: machineOutput, env });
230
230
  return buildUpdateNowResult({
231
231
  packageName,
232
232
  from: check.current,
@@ -337,9 +337,9 @@ export async function runSksUpdateNow(options = {}) {
337
337
  stage('new_version_probe', Boolean(newVersion), newVersion ? 'version_detected' : 'failed', { new_version: newVersion, code: versionProbe.code });
338
338
  stageStart('new_version_global_doctor', 'running migration doctor on updated install');
339
339
  newVersionDoctor = await updateHeartbeat(machineOutput, 'new-version doctor', runPackageLocalDoctor({
340
- root: globalSksRootPath(),
340
+ root: globalSksRootPath(env),
341
341
  entrypoint: newBinary,
342
- args: ['doctor', '--fix', '--yes', '--profile', 'migration', '--machine-only', '--report-file', path.join(globalSksRootPath(), 'update', 'new-version-doctor.json')],
342
+ args: ['doctor', '--fix', '--yes', '--profile', 'migration', '--machine-only', '--report-file', path.join(globalSksRootPath(env), 'update', 'new-version-doctor.json')],
343
343
  env,
344
344
  timeoutMs: updateDoctorTimeoutMs(env),
345
345
  maxOutputBytes: 32 * 1024
@@ -370,10 +370,12 @@ export async function runSksUpdateNow(options = {}) {
370
370
  sksMenuBar = await installUpdateSksMenuBar({ root: projectReceiptRoot, env, stage, quiet: machineOutput, entrypoint: newBinary });
371
371
  await runUpdateGlobalSkillsReconcile(stage, {
372
372
  quiet: machineOutput,
373
+ env,
373
374
  newPackageRoot: newBinary ? path.resolve(path.dirname(newBinary), '..', '..') : null
374
375
  });
375
376
  await runUpdateNativeCapabilitySetup(stage, {
376
377
  quiet: machineOutput,
378
+ env,
377
379
  newPackageRoot: newBinary ? path.resolve(path.dirname(newBinary), '..', '..') : null,
378
380
  root: projectReceiptRoot
379
381
  });
@@ -417,7 +419,7 @@ export async function runSksUpdateNow(options = {}) {
417
419
  });
418
420
  }
419
421
  async function runUpdateGlobalSkillsReconcile(stage, opts = {}) {
420
- const targetDir = path.join(os.homedir(), '.agents', 'skills');
422
+ const targetDir = path.join(opts.env?.HOME || os.homedir(), '.agents', 'skills');
421
423
  // reconcileSkills stamps ~/.agents/skills/.sks-generated.json with the
422
424
  // PACKAGE_VERSION compiled into whichever module runs it. This function
423
425
  // executes inside the OLD (driver) binary, so after a real version install
@@ -433,6 +435,7 @@ async function runUpdateGlobalSkillsReconcile(stage, opts = {}) {
433
435
  'if (r && (r.ok === false || r.error)) process.exit(1);'
434
436
  ].join('\n');
435
437
  const work = runProcess(process.execPath, ['--input-type=module', '-e', script], {
438
+ env: opts.env || process.env,
436
439
  timeoutMs: 120_000,
437
440
  maxOutputBytes: 1024 * 1024
438
441
  }).catch((err) => ({ code: 1, stdout: '', stderr: err?.message || String(err) }));
@@ -489,6 +492,7 @@ async function runUpdateNativeCapabilitySetup(stage, opts) {
489
492
  'console.log(JSON.stringify({ imagegen, computer_use: computerUse, browser_use: browserUse }));'
490
493
  ].join('\n');
491
494
  const work = runProcess(process.execPath, ['--input-type=module', '-e', script], {
495
+ env: opts.env || process.env,
492
496
  timeoutMs: 180_000,
493
497
  maxOutputBytes: 1024 * 1024
494
498
  }).catch((err) => ({ code: 1, stdout: '', stderr: err?.message || String(err) }));
@@ -654,8 +658,8 @@ function buildResult(input) {
654
658
  error: input.error || null
655
659
  };
656
660
  }
657
- async function readUpdateLatestCache(packageName, registry) {
658
- const file = updateLatestCachePath(packageName, registry);
661
+ async function readUpdateLatestCache(packageName, registry, env) {
662
+ const file = updateLatestCachePath(packageName, registry, env);
659
663
  const text = await fs.readFile(file, 'utf8');
660
664
  const parsed = JSON.parse(text);
661
665
  if (parsed?.package !== packageName || parsed?.registry !== registry || !parsed?.latest || !parsed?.generated_at)
@@ -665,8 +669,8 @@ async function readUpdateLatestCache(packageName, registry) {
665
669
  return null;
666
670
  return { latest: String(parsed.latest) };
667
671
  }
668
- async function writeUpdateLatestCache(packageName, registry, latest) {
669
- const file = updateLatestCachePath(packageName, registry);
672
+ async function writeUpdateLatestCache(packageName, registry, latest, env) {
673
+ const file = updateLatestCachePath(packageName, registry, env);
670
674
  await fs.mkdir(path.dirname(file), { recursive: true });
671
675
  await fs.writeFile(file, `${JSON.stringify({
672
676
  schema: 'sks.update-check-cache.v1',
@@ -676,9 +680,11 @@ async function writeUpdateLatestCache(packageName, registry, latest) {
676
680
  latest
677
681
  }, null, 2)}\n`, 'utf8');
678
682
  }
679
- function updateLatestCachePath(packageName, registry) {
683
+ function updateLatestCachePath(packageName, registry, env) {
680
684
  const safe = `${packageName}-${registry}`.replace(/[^a-z0-9._-]+/gi, '_').slice(0, 120);
681
- return path.join(os.tmpdir(), 'sks-update-check-cache', `${safe}.json`);
685
+ const configuredRoot = String(env.SKS_UPDATE_CHECK_CACHE_ROOT || '').trim();
686
+ const cacheRoot = configuredRoot ? path.resolve(configuredRoot) : path.join(os.tmpdir(), 'sks-update-check-cache');
687
+ return path.join(cacheRoot, `${safe}.json`);
682
688
  }
683
689
  function buildUpdateNowResult(input) {
684
690
  return {
@@ -794,8 +800,10 @@ function parseVersionText(text) {
794
800
  const match = String(text || '').match(/\b\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?\b/);
795
801
  return match ? match[0] : null;
796
802
  }
797
- function globalSksRootPath() {
798
- return path.join(process.env.HOME || os.homedir(), '.sneakoscope-global');
803
+ function globalSksRootPath(env = process.env) {
804
+ if (env.SKS_GLOBAL_ROOT)
805
+ return path.resolve(env.SKS_GLOBAL_ROOT);
806
+ return path.join(env.HOME || os.homedir(), '.sneakoscope-global');
799
807
  }
800
808
  function updateDoctorTimeoutMs(env) {
801
809
  const override = Number.parseInt(env.SKS_UPDATE_NEW_DOCTOR_TIMEOUT_MS || env.SKS_MIGRATION_DOCTOR_TIMEOUT_MS || '', 10);
@@ -329,6 +329,14 @@ async function syncSourcePackageVersion(root, version) {
329
329
  rel: 'src/bin/sks.ts',
330
330
  replace: (text) => text.replace(/const FAST_PACKAGE_VERSION = ['"][^'"]+['"];/, `const FAST_PACKAGE_VERSION = '${version}';`)
331
331
  },
332
+ {
333
+ rel: 'src/core/managed-assets/managed-assets-manifest.ts',
334
+ replace: (text) => text.replace(/export const MANAGED_ASSET_VERSION = ['"][^'"]+['"]/, `export const MANAGED_ASSET_VERSION = '${version}'`)
335
+ },
336
+ {
337
+ rel: 'test/unit/agent-role-config.test.mjs',
338
+ replace: (text) => text.replace(/assert\.equal\(manifest\.MANAGED_ASSET_VERSION, ['"][^'"]+['"]\)/, `assert.equal(manifest.MANAGED_ASSET_VERSION, '${version}')`)
339
+ },
332
340
  {
333
341
  rel: 'crates/sks-core/Cargo.toml',
334
342
  replace: (text) => text.replace(/^version\s*=\s*"[^"]+"/m, `version = "${version}"`)
@@ -343,7 +351,49 @@ async function syncSourcePackageVersion(root, version) {
343
351
  },
344
352
  {
345
353
  rel: 'README.md',
346
- replace: (text) => text.replace(/SKS \*\*\d+\.\d+\.\d+\*\*/, `SKS **${version}**`)
354
+ replace: (text) => text
355
+ .replace(/SKS \*\*\d+\.\d+\.\d+\*\*/, `SKS **${version}**`)
356
+ .replace(/^## Naruto In \d+\.\d+\.\d+$/m, `## Naruto In ${version}`)
357
+ },
358
+ {
359
+ rel: 'docs/release-readiness.md',
360
+ replace: (text) => text
361
+ .replace(/^SKS \d+\.\d+\.\d+ is ready/m, `SKS ${version} is ready`)
362
+ .replace(/^Codex 0\.142 references later in this document are historical release records and cannot authorize the \d+\.\d+\.\d+ release\./m, `Codex 0.142 references later in this document are historical release records and cannot authorize the ${version} release.`)
363
+ .replace(/^\d+\.\d+\.\d+ release readiness requires/m, `${version} release readiness requires`)
364
+ .replace(/^## Current publish authorization policy \(\d+\.\d+\.\d+\)$/m, `## Current publish authorization policy (${version})`)
365
+ .replace(/^The \d+\.\d+\.\d+ implementation handoff uses this bounded verification sequence:/m, `The ${version} implementation handoff uses this bounded verification sequence:`)
366
+ .replace(/^the \d+\.\d+\.\d+ command surface;/m, `the ${version} command surface;`)
367
+ .replace(/^not the \d+\.\d+\.\d+ release procedure\./m, `not the ${version} release procedure.`)
368
+ .replace(/do not satisfy the \d+\.\d+\.\d+ official-subagent gate\. Current \d+\.\d+\.\d+ proof/g, `do not satisfy the ${version} official-subagent gate. Current ${version} proof`)
369
+ .replace(/not represented as current \d+\.\d+\.\d+ completion proof\./g, `not represented as current ${version} completion proof.`)
370
+ .replace(/^For \d+\.\d+\.\d+, a selected codex-lb/m, `For ${version}, a selected codex-lb`)
371
+ .replace(/^The \d+\.\d+\.\d+ SKS menu bar/m, `The ${version} SKS menu bar`)
372
+ },
373
+ {
374
+ rel: 'docs/release-proof-truth.md',
375
+ replace: (text) => text
376
+ .replace(/^SKS \d+\.\d+\.\d+ release proof truth/m, `SKS ${version} release proof truth`)
377
+ .replace(/^SKS \d+\.\d+\.\d+ must not claim/m, `SKS ${version} must not claim`)
378
+ .replace(/cannot serve as \d+\.\d+\.\d+ evidence\./m, `cannot serve as ${version} evidence.`)
379
+ },
380
+ {
381
+ rel: 'docs/official-docs-compat.md',
382
+ replace: (text) => text
383
+ .replace(/^SKS \d+\.\d+\.\d+ keeps release-gated behavior/m, `SKS ${version} keeps release-gated behavior`)
384
+ .replace(/official-docs-compat-\d+\.\d+\.\d+\.(json|md)/g, `official-docs-compat-${version}.$1`)
385
+ },
386
+ {
387
+ rel: 'docs/codex-0.139-compat.md',
388
+ replace: (text) => text.replace(/^SKS \d+\.\d+\.\d+ keeps the historical/m, `SKS ${version} keeps the historical`)
389
+ },
390
+ {
391
+ rel: 'docs/codex-cli-compat.md',
392
+ replace: (text) => text.replace(/^SKS \d+\.\d+\.\d+ targets/m, `SKS ${version} targets`)
393
+ },
394
+ {
395
+ rel: 'docs/codex-app.md',
396
+ replace: (text) => text.replace(/^SKS \d+\.\d+\.\d+ targets/m, `SKS ${version} targets`)
347
397
  }
348
398
  ];
349
399
  for (const { rel, replace } of replacements) {
@@ -1,2 +1,2 @@
1
- export const PACKAGE_VERSION = '6.0.3';
1
+ export const PACKAGE_VERSION = '6.1.2';
2
2
  //# sourceMappingURL=version.js.map