sneakoscope 6.2.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2105) hide show
  1. package/README.md +11 -13
  2. package/config/architecture-budgets.v1.json +70 -0
  3. package/config/perf-budgets.v1.json +9 -1
  4. package/crates/sks-core/Cargo.lock +1 -1
  5. package/crates/sks-core/Cargo.toml +1 -1
  6. package/dist/bin/fast-inline.js +4 -5
  7. package/dist/bin/install.js +2 -3
  8. package/dist/bin/sks-dispatch.js +2 -7
  9. package/dist/bin/sks.js +1 -1
  10. package/dist/cli/args.js +0 -3
  11. package/dist/cli/cli-theme.js +0 -1
  12. package/dist/cli/codex-app-command.js +0 -1
  13. package/dist/cli/command-manifest-lite.js +10 -16
  14. package/dist/cli/command-registry.js +109 -19
  15. package/dist/cli/commands-fast.js +0 -1
  16. package/dist/cli/context7-command.js +0 -1
  17. package/dist/cli/feature-commands.js +0 -1
  18. package/dist/cli/global-mode-router.js +31 -1
  19. package/dist/cli/help-fast.js +2 -4
  20. package/dist/cli/install-helpers-codex-lb-chain.js +274 -0
  21. package/dist/cli/install-helpers-codex-lb-config.js +191 -0
  22. package/dist/cli/install-helpers-codex-lb-selftest-chain.js +115 -0
  23. package/dist/cli/install-helpers-codex-lb-selftest.js +501 -0
  24. package/dist/cli/install-helpers-codex-lb-shared.js +52 -0
  25. package/dist/cli/install-helpers-install-support.js +343 -0
  26. package/dist/cli/install-helpers.js +23 -1400
  27. package/dist/cli/install-tool-helpers.js +0 -1
  28. package/dist/cli/main.js +0 -1
  29. package/dist/cli/output.js +0 -1
  30. package/dist/cli/recallpulse-command.js +0 -1
  31. package/dist/cli/root-fast.js +0 -1
  32. package/dist/cli/router.js +2 -12
  33. package/dist/cli/super-search-command.js +0 -1
  34. package/dist/commands/aliases.js +0 -1
  35. package/dist/commands/all-features.js +0 -1
  36. package/dist/commands/auto-review.js +0 -1
  37. package/dist/commands/autoresearch.js +0 -1
  38. package/dist/commands/bench.js +0 -1
  39. package/dist/commands/bootstrap.js +0 -1
  40. package/dist/commands/code-structure.js +0 -1
  41. package/dist/commands/codex-app.js +0 -1
  42. package/dist/commands/codex-lb.js +9 -10
  43. package/dist/commands/codex-native.js +0 -1
  44. package/dist/commands/codex.js +0 -1
  45. package/dist/commands/commands.js +0 -1
  46. package/dist/commands/commit-and-push.js +0 -1
  47. package/dist/commands/commit.js +0 -1
  48. package/dist/commands/computer-use.js +0 -1
  49. package/dist/commands/conflicts.js +0 -1
  50. package/dist/commands/context7.js +0 -1
  51. package/dist/commands/deps.js +0 -1
  52. package/dist/commands/dfix.js +0 -1
  53. package/dist/commands/doctor.js +27 -32
  54. package/dist/commands/dollar-commands.js +0 -1
  55. package/dist/commands/eval.js +0 -1
  56. package/dist/commands/features.js +0 -1
  57. package/dist/commands/fix-path.js +0 -1
  58. package/dist/commands/gc.js +0 -1
  59. package/dist/commands/git.js +0 -1
  60. package/dist/commands/goal.js +0 -1
  61. package/dist/commands/guard.js +0 -1
  62. package/dist/commands/gx.js +0 -1
  63. package/dist/commands/harness.js +0 -1
  64. package/dist/commands/help.js +0 -1
  65. package/dist/commands/hook.js +0 -1
  66. package/dist/commands/hooks.js +0 -1
  67. package/dist/commands/hproof.js +0 -1
  68. package/dist/commands/image-ux-review.js +0 -1
  69. package/dist/commands/init.js +0 -1
  70. package/dist/commands/mad-sks.js +0 -1
  71. package/dist/commands/memory.js +0 -1
  72. package/dist/commands/paths.js +0 -1
  73. package/dist/commands/perf.js +0 -1
  74. package/dist/commands/pipeline.js +0 -1
  75. package/dist/commands/postinstall.js +0 -1
  76. package/dist/commands/ppt.js +0 -1
  77. package/dist/commands/profile.js +0 -1
  78. package/dist/commands/proof-field.js +0 -1
  79. package/dist/commands/proof.js +0 -1
  80. package/dist/commands/qa-loop.js +0 -1
  81. package/dist/commands/quickstart.js +0 -1
  82. package/dist/commands/reasoning.js +0 -1
  83. package/dist/commands/recallpulse.js +0 -1
  84. package/dist/commands/research.js +0 -1
  85. package/dist/commands/rollback.js +0 -1
  86. package/dist/commands/root.js +0 -1
  87. package/dist/commands/run.js +0 -1
  88. package/dist/commands/rust.js +0 -1
  89. package/dist/commands/selftest.js +0 -1
  90. package/dist/commands/setup.js +0 -1
  91. package/dist/commands/skill-dream.js +0 -1
  92. package/dist/commands/stats.js +0 -1
  93. package/dist/commands/status.js +0 -1
  94. package/dist/commands/trust.js +0 -1
  95. package/dist/commands/update-check.js +0 -1
  96. package/dist/commands/usage.js +0 -1
  97. package/dist/commands/validate-artifacts.js +0 -1
  98. package/dist/commands/version.js +0 -1
  99. package/dist/commands/versioning.js +0 -1
  100. package/dist/commands/wiki.js +0 -1
  101. package/dist/commands/zellij-lane.js +0 -1
  102. package/dist/commands/zellij-monitor-pane.js +0 -1
  103. package/dist/commands/zellij-slot-column-anchor.js +0 -1
  104. package/dist/commands/zellij-slot-pane.js +0 -1
  105. package/dist/commands/zellij-viewport-pane.js +0 -1
  106. package/dist/commands/zellij.js +2 -3
  107. package/dist/config/skills-manifest.json +130 -183
  108. package/dist/core/agent-bridge/agent-manifest.js +30 -45
  109. package/dist/core/agent-bridge/agent-mode.js +0 -1
  110. package/dist/core/agent-bridge/mcp-server.js +51 -20
  111. package/dist/core/agents/agent-central-ledger.js +0 -1
  112. package/dist/core/agents/agent-cleanup.js +0 -1
  113. package/dist/core/agents/agent-codex-cockpit.js +6 -7
  114. package/dist/core/agents/agent-conflict-graph.js +0 -1
  115. package/dist/core/agents/agent-consensus.js +0 -1
  116. package/dist/core/agents/agent-effort-policy.js +1 -5
  117. package/dist/core/agents/agent-follow-up-work-items.js +1 -2
  118. package/dist/core/agents/agent-heartbeat.js +0 -1
  119. package/dist/core/agents/agent-janitor.js +0 -1
  120. package/dist/core/agents/agent-lease.js +0 -1
  121. package/dist/core/agents/agent-lifecycle.js +0 -1
  122. package/dist/core/agents/agent-merge-coordinator.js +0 -1
  123. package/dist/core/agents/agent-message-bus.js +0 -1
  124. package/dist/core/agents/agent-namespace-safety.js +0 -1
  125. package/dist/core/agents/agent-orchestrator.js +54 -230
  126. package/dist/core/agents/agent-output-validator.js +1 -2
  127. package/dist/core/agents/agent-patch-apply-worker.js +0 -1
  128. package/dist/core/agents/agent-patch-conflict-rebase.js +0 -1
  129. package/dist/core/agents/agent-patch-proof.js +0 -1
  130. package/dist/core/agents/agent-patch-queue-store.js +0 -1
  131. package/dist/core/agents/agent-patch-queue.js +0 -1
  132. package/dist/core/agents/agent-patch-schema.js +0 -1
  133. package/dist/core/agents/agent-patch-transaction-journal.js +0 -1
  134. package/dist/core/agents/agent-persona.js +1 -2
  135. package/dist/core/agents/agent-plan.js +38 -28
  136. package/dist/core/agents/agent-proof-evidence.js +34 -37
  137. package/dist/core/agents/agent-recursion-guard.js +5 -8
  138. package/dist/core/agents/agent-role-config.js +168 -35
  139. package/dist/core/agents/agent-roster.js +2 -154
  140. package/dist/core/agents/agent-runner-codex-exec.js +0 -1
  141. package/dist/core/agents/agent-runner-fake.js +1 -2
  142. package/dist/core/agents/agent-runner-ollama.js +2 -3
  143. package/dist/core/agents/agent-runner-process.js +0 -1
  144. package/dist/core/agents/agent-runner-zellij.js +1 -2
  145. package/dist/core/agents/agent-scheduler.js +0 -1
  146. package/dist/core/agents/agent-schema.js +2 -7
  147. package/dist/core/agents/agent-session-generation.js +0 -1
  148. package/dist/core/agents/agent-session-rows.js +0 -1
  149. package/dist/core/agents/agent-slot-pane-binding-proof.js +1 -2
  150. package/dist/core/agents/agent-task-graph.js +3 -4
  151. package/dist/core/agents/agent-task-slicer.js +0 -1
  152. package/dist/core/agents/agent-terminal-session.js +0 -1
  153. package/dist/core/agents/agent-trust-report.js +23 -17
  154. package/dist/core/agents/agent-work-partition.js +2 -3
  155. package/dist/core/agents/agent-work-queue.js +0 -1
  156. package/dist/core/agents/agent-worker-pipeline.js +0 -1
  157. package/dist/core/agents/agent-worker-slot.js +0 -1
  158. package/dist/core/agents/agent-wrongness.js +2 -4
  159. package/dist/core/agents/fast-mode-policy.js +0 -1
  160. package/dist/core/agents/intelligent-work-graph.js +2 -3
  161. package/dist/core/agents/native-cli-worker-entry.js +6 -0
  162. package/dist/core/agents/{native-cli-session-proof.js → native-cli-worker-runtime-proof.js} +25 -26
  163. package/dist/core/agents/{native-cli-session-swarm.js → native-cli-worker-runtime.js} +62 -110
  164. package/dist/core/agents/native-cli-worker.js +0 -2
  165. package/dist/core/agents/native-worker-backend-router.js +5 -9
  166. package/dist/core/agents/no-subagent-scaling-policy.js +8 -9
  167. package/dist/core/agents/official-subagent-helper-policy.js +2 -3
  168. package/dist/core/agents/ollama-worker-config.js +0 -1
  169. package/dist/core/agents/parallel-runtime-proof.js +0 -1
  170. package/dist/core/agents/parallel-write-fixture.js +0 -1
  171. package/dist/core/agents/real-codex-parallel-proof.js +11 -7
  172. package/dist/core/agents/route-collaboration-ledger.js +9 -17
  173. package/dist/core/agents/runtime-proof-summary.js +5 -6
  174. package/dist/core/agents/scout-policy.js +0 -1
  175. package/dist/core/agents/work-partition/conflict-detector.js +0 -1
  176. package/dist/core/agents/work-partition/dependency-graph.js +0 -1
  177. package/dist/core/agents/work-partition/lease-planner.js +0 -1
  178. package/dist/core/agents/work-partition/no-overlap-proof.js +0 -1
  179. package/dist/core/agents/work-partition/repo-inventory.js +0 -1
  180. package/dist/core/agents/work-partition/semantic-domain-graph.js +1 -2
  181. package/dist/core/agents/work-partition/task-slicer.js +1 -2
  182. package/dist/core/agents/worker-pane-communication-contract.js +1 -2
  183. package/dist/core/agents/zellij-lane-supervisor.js +0 -1
  184. package/dist/core/agents/zellij-right-lane-cockpit.js +1 -2
  185. package/dist/core/artifact-schemas.js +27 -36
  186. package/dist/core/auto-review.js +94 -5
  187. package/dist/core/bench.js +7 -8
  188. package/dist/core/build/build-once-runner.js +0 -1
  189. package/dist/core/code-structure.js +1 -2
  190. package/dist/core/codex/agent-config-file-repair.js +0 -1
  191. package/dist/core/codex/app-mentions.js +0 -1
  192. package/dist/core/codex/appshots-detector.js +0 -1
  193. package/dist/core/codex/appshots-operator-policy.js +0 -1
  194. package/dist/core/codex/codex-0-134-compat.js +0 -1
  195. package/dist/core/codex/codex-0-135-compat.js +0 -1
  196. package/dist/core/codex/codex-0-136-compat.js +0 -1
  197. package/dist/core/codex/codex-0-137-compat.js +0 -1
  198. package/dist/core/codex/codex-cli-syntax-builder.js +0 -1
  199. package/dist/core/codex/codex-cli-update.js +0 -1
  200. package/dist/core/codex/codex-config-eperm-repair.js +0 -1
  201. package/dist/core/codex/codex-config-guard.js +0 -1
  202. package/dist/core/codex/codex-config-readability.js +0 -1
  203. package/dist/core/codex/codex-config-toml.js +0 -1
  204. package/dist/core/codex/codex-permission-profiles.js +0 -1
  205. package/dist/core/codex/codex-project-config-policy.js +0 -1
  206. package/dist/core/codex/codex-resume-inventory.js +0 -1
  207. package/dist/core/codex/codex-startup-config-postcheck.js +0 -1
  208. package/dist/core/codex/codex-web-search-adapter.js +0 -1
  209. package/dist/core/codex/managed-proxy-env.js +0 -1
  210. package/dist/core/codex/official-goal-mode.js +0 -1
  211. package/dist/core/codex-adapter.js +0 -1
  212. package/dist/core/codex-app/codex-agent-role-sync.js +0 -1
  213. package/dist/core/codex-app/codex-agent-type-probe.js +0 -1
  214. package/dist/core/codex-app/codex-app-execution-profile.js +0 -1
  215. package/dist/core/codex-app/codex-app-fast-ui-preservation.js +0 -1
  216. package/dist/core/codex-app/codex-app-fast-ui-repair.js +0 -1
  217. package/dist/core/codex-app/codex-app-handoff.js +0 -1
  218. package/dist/core/codex-app/codex-app-harness-matrix.js +0 -1
  219. package/dist/core/codex-app/codex-app-launcher.js +0 -1
  220. package/dist/core/codex-app/codex-app-provider-badge.js +0 -1
  221. package/dist/core/codex-app/codex-app-restart.js +0 -1
  222. package/dist/core/codex-app/codex-app-types.js +0 -1
  223. package/dist/core/codex-app/codex-app-ui-clobber-guard.js +0 -1
  224. package/dist/core/codex-app/codex-app-ui-state-snapshot.js +0 -1
  225. package/dist/core/codex-app/codex-hook-approval-probe.js +0 -1
  226. package/dist/core/codex-app/codex-hook-lifecycle.js +1 -2
  227. package/dist/core/codex-app/codex-init-deep.js +0 -1
  228. package/dist/core/codex-app/codex-skill-sync.js +0 -1
  229. package/dist/core/codex-app/glm-model-profile.js +0 -1
  230. package/dist/core/codex-app/glm-profile-installer.js +0 -1
  231. package/dist/core/codex-app/glm-profile-schema.js +0 -1
  232. package/dist/core/codex-app/mcp-manager.js +42 -647
  233. package/dist/core/codex-app/menubar/action-runner.js +68 -0
  234. package/dist/core/codex-app/menubar/app-bundle.js +55 -0
  235. package/dist/core/codex-app/menubar/build-stamp.js +25 -0
  236. package/dist/core/codex-app/menubar/config.js +52 -0
  237. package/dist/core/codex-app/menubar/constants.js +39 -0
  238. package/dist/core/codex-app/menubar/generation-transaction-journal.js +111 -0
  239. package/dist/core/codex-app/menubar/generation-transaction.js +258 -0
  240. package/dist/core/codex-app/menubar/index.js +10 -0
  241. package/dist/core/codex-app/menubar/installer.js +367 -0
  242. package/dist/core/codex-app/menubar/launch-agent.js +226 -0
  243. package/dist/core/codex-app/menubar/migration.js +32 -0
  244. package/dist/core/codex-app/menubar/paths.js +43 -0
  245. package/dist/core/codex-app/menubar/resources.js +112 -0
  246. package/dist/core/codex-app/menubar/rollback.js +341 -0
  247. package/dist/core/codex-app/menubar/signature.js +21 -0
  248. package/dist/core/codex-app/menubar/status.js +146 -0
  249. package/dist/core/codex-app/menubar/types.js +1 -0
  250. package/dist/core/codex-app/sks-menubar.js +2 -2288
  251. package/dist/core/codex-app.js +0 -1
  252. package/dist/core/codex-compat/codex-0-132.js +0 -1
  253. package/dist/core/codex-compat/codex-0-133.js +0 -1
  254. package/dist/core/codex-compat/codex-compat-report.js +0 -1
  255. package/dist/core/codex-compat/codex-config-policy.js +0 -1
  256. package/dist/core/codex-compat/codex-hook-events.js +0 -1
  257. package/dist/core/codex-compat/codex-hook-issues.js +0 -1
  258. package/dist/core/codex-compat/codex-hook-output-builders.js +0 -1
  259. package/dist/core/codex-compat/codex-hook-output-normalizer.js +0 -1
  260. package/dist/core/codex-compat/codex-hook-schema.js +0 -1
  261. package/dist/core/codex-compat/codex-hook-semantic-validator.js +0 -1
  262. package/dist/core/codex-compat/codex-hook-warning-detector.js +0 -1
  263. package/dist/core/codex-compat/codex-release-manifest.js +0 -1
  264. package/dist/core/codex-compat/codex-schema-snapshot.js +0 -1
  265. package/dist/core/codex-compat/codex-version-policy.js +0 -1
  266. package/dist/core/codex-compat/codex-version.js +0 -1
  267. package/dist/core/codex-control/codex-0138-capability.js +0 -1
  268. package/dist/core/codex-control/codex-0139-capability.js +0 -1
  269. package/dist/core/codex-control/codex-0139-doctor-real-probe.js +0 -1
  270. package/dist/core/codex-control/codex-0139-image-path-real-probe.js +0 -1
  271. package/dist/core/codex-control/codex-0139-plugin-real-probes.js +0 -1
  272. package/dist/core/codex-control/codex-0139-probe-runner.js +0 -1
  273. package/dist/core/codex-control/codex-0139-real-probe-summary.js +0 -1
  274. package/dist/core/codex-control/codex-0139-real-probes.js +0 -1
  275. package/dist/core/codex-control/codex-0139-rich-schema-real-probe.js +0 -1
  276. package/dist/core/codex-control/codex-0139-sandbox-real-probe.js +0 -1
  277. package/dist/core/codex-control/codex-0139-web-search-probe.js +0 -1
  278. package/dist/core/codex-control/codex-0140-capability.js +0 -1
  279. package/dist/core/codex-control/codex-0140-feature-probes.js +0 -1
  280. package/dist/core/codex-control/codex-0140-probe-runner.js +0 -1
  281. package/dist/core/codex-control/codex-0140-real-probe-summary.js +0 -1
  282. package/dist/core/codex-control/codex-0140-real-probes.js +0 -1
  283. package/dist/core/codex-control/codex-0140-usage-parser.js +0 -1
  284. package/dist/core/codex-control/codex-0141-capability.js +0 -1
  285. package/dist/core/codex-control/codex-0144-capability.js +0 -1
  286. package/dist/core/codex-control/codex-0144-collab-agent-real-probe.js +0 -1
  287. package/dist/core/codex-control/codex-app-server-v2-client.js +0 -1
  288. package/dist/core/codex-control/codex-control-plane.js +0 -1
  289. package/dist/core/codex-control/codex-control-proof.js +0 -1
  290. package/dist/core/codex-control/codex-event-translator.js +0 -1
  291. package/dist/core/codex-control/codex-fake-sdk-adapter.js +0 -1
  292. package/dist/core/codex-control/codex-lb-launch-recovery.js +0 -1
  293. package/dist/core/codex-control/codex-model-capabilities.js +0 -1
  294. package/dist/core/codex-control/codex-model-metadata.js +0 -1
  295. package/dist/core/codex-control/codex-multi-agent-event-normalizer.js +0 -1
  296. package/dist/core/codex-control/codex-output-schemas.js +0 -1
  297. package/dist/core/codex-control/codex-reliability-shield.js +0 -1
  298. package/dist/core/codex-control/codex-sdk-adapter.js +0 -1
  299. package/dist/core/codex-control/codex-sdk-capability.js +0 -1
  300. package/dist/core/codex-control/codex-sdk-config-policy.js +0 -1
  301. package/dist/core/codex-control/codex-sdk-env-policy.js +0 -1
  302. package/dist/core/codex-control/codex-sdk-sandbox-policy.js +0 -1
  303. package/dist/core/codex-control/codex-task-runner.js +0 -1
  304. package/dist/core/codex-control/codex-thread-registry.js +0 -1
  305. package/dist/core/codex-control/codex-tool-schema-fixtures.js +0 -1
  306. package/dist/core/codex-control/gpt-final-arbiter.js +0 -1
  307. package/dist/core/codex-control/gpt-final-context-compressor.js +0 -1
  308. package/dist/core/codex-control/gpt-final-proof-pack.js +0 -1
  309. package/dist/core/codex-control/gpt-final-review-schema.js +0 -1
  310. package/dist/core/codex-control/model-call-concurrency.js +0 -1
  311. package/dist/core/codex-control/python-codex-sdk-adapter.js +0 -1
  312. package/dist/core/codex-control/python-codex-sdk-event-translator.js +0 -1
  313. package/dist/core/codex-control/schemas/agent-worker-result.schema.js +0 -1
  314. package/dist/core/codex-exec-output-schema.js +0 -1
  315. package/dist/core/codex-hooks/codex-hook-actual-discovery.js +0 -1
  316. package/dist/core/codex-hooks/codex-hook-config-writer.js +0 -1
  317. package/dist/core/codex-hooks/codex-hook-hash.js +0 -1
  318. package/dist/core/codex-hooks/codex-hook-managed-install.js +0 -1
  319. package/dist/core/codex-hooks/codex-hook-official-hash-oracle.js +0 -1
  320. package/dist/core/codex-hooks/codex-hook-official-parity.js +0 -1
  321. package/dist/core/codex-hooks/codex-hook-state-writer.js +0 -1
  322. package/dist/core/codex-hooks/codex-hook-trust-doctor.js +0 -1
  323. package/dist/core/codex-hooks/codex-hook-trust-state.js +0 -1
  324. package/dist/core/codex-lb/codex-lb-env.js +16 -7
  325. package/dist/core/codex-lb/codex-lb-setup.js +1 -2
  326. package/dist/core/codex-lb/codex-lb-tool-catalog.js +0 -1
  327. package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +0 -1
  328. package/dist/core/codex-lb-circuit.js +0 -1
  329. package/dist/core/codex-model-guard.js +0 -1
  330. package/dist/core/codex-native/codex-native-capability-cache.js +0 -1
  331. package/dist/core/codex-native/codex-native-feature-broker.js +0 -1
  332. package/dist/core/codex-native/codex-native-feature-matrix.js +0 -1
  333. package/dist/core/codex-native/codex-native-harness-compat.js +0 -1
  334. package/dist/core/codex-native/codex-native-interop-policy.js +0 -1
  335. package/dist/core/codex-native/codex-native-invocation-router.js +0 -1
  336. package/dist/core/codex-native/codex-native-pattern-analysis.js +0 -1
  337. package/dist/core/codex-native/codex-native-reference-cache.js +0 -1
  338. package/dist/core/codex-native/codex-native-reference-evidence.js +0 -1
  339. package/dist/core/codex-native/codex-native-reference-source.js +0 -1
  340. package/dist/core/codex-native/codex-native-rename-map.js +0 -1
  341. package/dist/core/codex-native/codex-native-repair-transaction.js +0 -1
  342. package/dist/core/codex-native/core-skill-integrity.js +2 -3
  343. package/dist/core/codex-native/core-skill-manifest.js +36 -9
  344. package/dist/core/codex-native/native-capability-postcheck.js +0 -1
  345. package/dist/core/codex-native/native-capability-repair-matrix.js +0 -1
  346. package/dist/core/codex-native/native-capability-repair.js +0 -1
  347. package/dist/core/codex-native/native-media-computer-repair.js +0 -1
  348. package/dist/core/codex-native/project-skill-dedupe.js +0 -1
  349. package/dist/core/codex-native/skill-name-canonicalizer.js +0 -1
  350. package/dist/core/codex-native/skill-registry-ledger.js +0 -1
  351. package/dist/core/codex-plugins/codex-plugin-cache.js +0 -1
  352. package/dist/core/codex-plugins/codex-plugin-diff.js +0 -1
  353. package/dist/core/codex-plugins/codex-plugin-json.js +0 -1
  354. package/dist/core/codex-plugins/codex-plugin-repair.js +0 -1
  355. package/dist/core/codex-runtime/codex-desktop-config-policy.js +0 -1
  356. package/dist/core/codex-runtime/resolve-codex-runtime.js +0 -1
  357. package/dist/core/commands/agent-bridge-command.js +0 -1
  358. package/dist/core/commands/autoresearch-command.js +0 -1
  359. package/dist/core/commands/basic-cli.js +105 -51
  360. package/dist/core/commands/bench-command.js +0 -1
  361. package/dist/core/commands/check-command.js +0 -1
  362. package/dist/core/commands/code-structure-command.js +0 -1
  363. package/dist/core/commands/command-suggestions.js +0 -1
  364. package/dist/core/commands/command-utils.js +3 -4
  365. package/dist/core/commands/computer-use-command.js +0 -1
  366. package/dist/core/commands/daemon-command.js +0 -1
  367. package/dist/core/commands/dfix-command.js +0 -1
  368. package/dist/core/commands/eval-command.js +0 -1
  369. package/dist/core/commands/fast-mode-command.js +0 -1
  370. package/dist/core/commands/gate-result-contract.js +0 -1
  371. package/dist/core/commands/gates-command.js +0 -1
  372. package/dist/core/commands/gc-command.js +0 -1
  373. package/dist/core/commands/git-command.js +3 -4
  374. package/dist/core/commands/glm-command.js +28 -4
  375. package/dist/core/commands/goal-command.js +0 -1
  376. package/dist/core/commands/gx-command.js +0 -1
  377. package/dist/core/commands/harness-command.js +0 -1
  378. package/dist/core/commands/hproof-command.js +0 -1
  379. package/dist/core/commands/image-ux-review-command.js +0 -1
  380. package/dist/core/commands/local-model-command.js +0 -1
  381. package/dist/core/commands/loop-command.js +0 -1
  382. package/dist/core/commands/mad-sks-command.js +47 -243
  383. package/dist/core/commands/mcp-config-command.js +212 -0
  384. package/dist/core/commands/mcp-server-command.js +0 -1
  385. package/dist/core/commands/menubar-command.js +60 -99
  386. package/dist/core/commands/naruto-command.js +39 -99
  387. package/dist/core/commands/paths-command.js +0 -1
  388. package/dist/core/commands/perf-command.js +0 -1
  389. package/dist/core/commands/pipeline-command.js +1 -2
  390. package/dist/core/commands/plan-command.js +0 -1
  391. package/dist/core/commands/ppt-command.js +0 -1
  392. package/dist/core/commands/profile-command.js +0 -1
  393. package/dist/core/commands/proof-field-command.js +0 -1
  394. package/dist/core/commands/qa-loop-command.js +0 -1
  395. package/dist/core/commands/recallpulse-command.js +0 -1
  396. package/dist/core/commands/release-command.js +0 -1
  397. package/dist/core/commands/remote-command.js +100 -0
  398. package/dist/core/commands/research-command.js +2 -3
  399. package/dist/core/commands/review-command.js +0 -1
  400. package/dist/core/commands/rollback-command.js +0 -1
  401. package/dist/core/commands/route-command.js +0 -1
  402. package/dist/core/commands/route-success-helpers.js +0 -1
  403. package/dist/core/commands/run-command.js +4 -24
  404. package/dist/core/commands/rust-command.js +0 -1
  405. package/dist/core/commands/seo-command.js +0 -1
  406. package/dist/core/commands/skill-dream-command.js +0 -1
  407. package/dist/core/commands/status-command.js +1 -2
  408. package/dist/core/commands/stop-gate-command.js +0 -1
  409. package/dist/core/commands/task-command.js +0 -1
  410. package/dist/core/commands/telegram-command.js +143 -0
  411. package/dist/core/commands/triwiki-command.js +0 -1
  412. package/dist/core/commands/trust-command.js +0 -1
  413. package/dist/core/commands/ui-command.js +1 -2
  414. package/dist/core/commands/uninstall-command.js +0 -1
  415. package/dist/core/commands/validate-artifacts-command.js +0 -1
  416. package/dist/core/commands/wiki-command.js +4 -5
  417. package/dist/core/commands/wrongness-command.js +0 -1
  418. package/dist/core/computer-use-live-evidence.js +0 -1
  419. package/dist/core/computer-use-status.js +0 -1
  420. package/dist/core/config/config-migration-journal.js +0 -1
  421. package/dist/core/config/managed-config-merge.js +0 -1
  422. package/dist/core/config/secret-preservation.js +0 -1
  423. package/dist/core/config/supabase-secret-preservation.js +0 -1
  424. package/dist/core/context7-client.js +0 -1
  425. package/dist/core/daemon/sksd-client.js +0 -1
  426. package/dist/core/daemon/sksd-hook-daemon-entrypoint.js +0 -1
  427. package/dist/core/daemon/sksd-hook-daemon.js +0 -1
  428. package/dist/core/daemon/sksd-hook-dispatch.js +0 -1
  429. package/dist/core/daemon/sksd-ipc.js +0 -1
  430. package/dist/core/daemon/sksd.js +0 -1
  431. package/dist/core/db-safety.js +32 -32
  432. package/dist/core/decision-contract.js +0 -1
  433. package/dist/core/decision-lattice.js +5 -6
  434. package/dist/core/dfix/codex-handoff.js +0 -1
  435. package/dist/core/dfix/dfix-cache.js +0 -1
  436. package/dist/core/dfix/error-signature.js +0 -1
  437. package/dist/core/dfix/patch-runner.js +0 -1
  438. package/dist/core/dfix/patch-templates.js +0 -1
  439. package/dist/core/dfix/path-decision.js +0 -1
  440. package/dist/core/dfix/performance.js +0 -1
  441. package/dist/core/dfix/root-cause-ranking.js +0 -1
  442. package/dist/core/dfix/verification-runner.js +0 -1
  443. package/dist/core/dfix/verification-selector.js +0 -1
  444. package/dist/core/dfix.js +0 -1
  445. package/dist/core/doctor/browser-use-repair.js +0 -1
  446. package/dist/core/doctor/codex-0138-doctor.js +0 -1
  447. package/dist/core/doctor/codex-0139-doctor.js +0 -1
  448. package/dist/core/doctor/codex-doctor-bridge.js +0 -1
  449. package/dist/core/doctor/codex-startup-config-repair.js +3 -2
  450. package/dist/core/doctor/command-alias-cleanup.js +157 -24
  451. package/dist/core/doctor/computer-use-repair.js +0 -1
  452. package/dist/core/doctor/confirm-repair.js +0 -1
  453. package/dist/core/doctor/context7-mcp-repair.js +1 -2
  454. package/dist/core/doctor/current-project-guidance-nested.js +76 -0
  455. package/dist/core/doctor/current-project-guidance.js +343 -0
  456. package/dist/core/doctor/doctor-codex-startup-repair.js +0 -1
  457. package/dist/core/doctor/doctor-context7-repair.js +0 -1
  458. package/dist/core/doctor/doctor-dirty-planner.js +0 -1
  459. package/dist/core/doctor/doctor-idempotence.js +0 -1
  460. package/dist/core/doctor/doctor-native-capability-repair.js +0 -1
  461. package/dist/core/doctor/doctor-readiness-matrix.js +0 -6
  462. package/dist/core/doctor/doctor-repair-postcheck.js +0 -1
  463. package/dist/core/doctor/doctor-transaction.js +0 -1
  464. package/dist/core/doctor/doctor-zellij-repair.js +0 -1
  465. package/dist/core/doctor/global-sks-install-cleanup.js +0 -1
  466. package/dist/core/doctor/imagegen-repair.js +0 -1
  467. package/dist/core/doctor/legacy-global-hook-cleanup.js +0 -1
  468. package/dist/core/doctor/macos-tcc-diagnostic.js +0 -1
  469. package/dist/core/doctor/mcp-transport-collision-repair.js +0 -1
  470. package/dist/core/doctor/retired-auto-review-config.js +5 -0
  471. package/dist/core/doctor/retired-managed-projection-residue.js +195 -0
  472. package/dist/core/doctor/retired-managed-residue-artifact-helpers.js +135 -0
  473. package/dist/core/doctor/retired-managed-residue-artifacts.js +33 -0
  474. package/dist/core/doctor/retired-managed-residue-missions.js +393 -0
  475. package/dist/core/doctor/retired-managed-residue-private.js +73 -0
  476. package/dist/core/doctor/retired-managed-residue-runtime.js +133 -0
  477. package/dist/core/doctor/retired-managed-residue-state.js +270 -0
  478. package/dist/core/doctor/retired-managed-residue.js +40 -0
  479. package/dist/core/doctor/supabase-mcp-repair.js +2 -3
  480. package/dist/core/dogfood-loop.js +0 -1
  481. package/dist/core/effort-orchestrator.js +0 -1
  482. package/dist/core/errors/blocker-humanizer.js +0 -1
  483. package/dist/core/errors/next-action-map.js +0 -1
  484. package/dist/core/evaluation.js +4 -5
  485. package/dist/core/evidence/evidence-dedupe.js +0 -1
  486. package/dist/core/evidence/evidence-freshness.js +0 -1
  487. package/dist/core/evidence/evidence-proof-linker.js +0 -1
  488. package/dist/core/evidence/evidence-redaction.js +0 -1
  489. package/dist/core/evidence/evidence-router.js +0 -1
  490. package/dist/core/evidence/evidence-schema.js +0 -1
  491. package/dist/core/evidence/evidence-store.js +0 -1
  492. package/dist/core/feature-fixture-executor.js +1 -2
  493. package/dist/core/feature-fixture-runner.js +0 -1
  494. package/dist/core/feature-fixtures.js +12 -30
  495. package/dist/core/feature-registry.js +66 -61
  496. package/dist/core/features/feature-completion.js +0 -1
  497. package/dist/core/features/feature-fixtures.js +0 -1
  498. package/dist/core/features/feature-registry.js +0 -1
  499. package/dist/core/from-chat-img-forensics.js +0 -1
  500. package/dist/core/fsx.js +5 -9
  501. package/dist/core/git/git-integration-worktree.js +0 -1
  502. package/dist/core/git/git-repo-detection.js +0 -1
  503. package/dist/core/git/git-worktree-cache-policy.js +0 -1
  504. package/dist/core/git/git-worktree-capability.js +0 -1
  505. package/dist/core/git/git-worktree-checkpoint.js +0 -1
  506. package/dist/core/git/git-worktree-cleanup.js +0 -1
  507. package/dist/core/git/git-worktree-conflict-resolver.js +0 -1
  508. package/dist/core/git/git-worktree-cross-rebase.js +0 -1
  509. package/dist/core/git/git-worktree-diff.js +0 -1
  510. package/dist/core/git/git-worktree-manager.js +0 -1
  511. package/dist/core/git/git-worktree-merge-queue.js +0 -1
  512. package/dist/core/git/git-worktree-patch-envelope.js +0 -1
  513. package/dist/core/git/git-worktree-pool.js +0 -1
  514. package/dist/core/git/git-worktree-root.js +0 -1
  515. package/dist/core/git/git-worktree-runner.js +0 -1
  516. package/dist/core/git-hygiene/collaboration-trust.js +0 -1
  517. package/dist/core/git-hygiene/git-doctor.js +1 -2
  518. package/dist/core/git-hygiene/git-policy.js +6 -7
  519. package/dist/core/git-hygiene/git-precommit.js +1 -2
  520. package/dist/core/git-hygiene/git-status.js +0 -1
  521. package/dist/core/git-hygiene/gitattributes-writer.js +0 -1
  522. package/dist/core/git-hygiene/gitignore-writer.js +0 -1
  523. package/dist/core/git-hygiene/shared-memory-manifest.js +0 -1
  524. package/dist/core/git-hygiene/shared-memory-publish.js +0 -1
  525. package/dist/core/git-hygiene/shared-memory-security.js +0 -1
  526. package/dist/core/git-hygiene/validators.js +1 -2
  527. package/dist/core/git-simple.js +0 -1
  528. package/dist/core/goal-workflow.js +0 -3
  529. package/dist/core/gx-renderer.js +0 -1
  530. package/dist/core/harness-conflicts.js +0 -1
  531. package/dist/core/harness-guard.js +0 -1
  532. package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +3 -14
  533. package/dist/core/hooks-runtime/hook-invocation-dedupe.js +0 -1
  534. package/dist/core/hooks-runtime/hook-io.js +0 -3
  535. package/dist/core/hooks-runtime/light-turn.js +0 -1
  536. package/dist/core/hooks-runtime/naruto-decision-gate.js +3 -3
  537. package/dist/core/hooks-runtime/payload-signals.js +0 -1
  538. package/dist/core/hooks-runtime/skill-reconcile-preflight.js +2 -3
  539. package/dist/core/hooks-runtime/stop-repeat-guard.js +0 -1
  540. package/dist/core/hooks-runtime/tool-output-quarantine.js +0 -1
  541. package/dist/core/hooks-runtime.js +36 -75
  542. package/dist/core/hproof.js +0 -1
  543. package/dist/core/image/image-artifact-path-contract.js +0 -1
  544. package/dist/core/image/image-artifact-registry.js +0 -1
  545. package/dist/core/image-ux-review/callout-extraction.js +0 -1
  546. package/dist/core/image-ux-review/codex-app-generated-image-discovery.js +0 -1
  547. package/dist/core/image-ux-review/fix-loop.js +0 -1
  548. package/dist/core/image-ux-review/fix-task-planner.js +0 -1
  549. package/dist/core/image-ux-review/imagegen-adapter.js +0 -1
  550. package/dist/core/image-ux-review/patch-handoff.js +0 -1
  551. package/dist/core/image-ux-review/real-callout-extractor.js +0 -1
  552. package/dist/core/image-ux-review/recapture.js +0 -1
  553. package/dist/core/image-ux-review.js +0 -1
  554. package/dist/core/imagegen/gpt-image-2-request-validator.js +0 -1
  555. package/dist/core/imagegen/imagegen-auth-readiness.js +0 -1
  556. package/dist/core/imagegen/imagegen-capability.js +0 -1
  557. package/dist/core/imagegen/require-imagegen.js +0 -1
  558. package/dist/core/init/skills.js +664 -85
  559. package/dist/core/init.js +51 -34
  560. package/dist/core/install/installed-package-smoke.js +340 -34
  561. package/dist/core/json-schema-validator.js +0 -1
  562. package/dist/core/language-preference.js +0 -1
  563. package/dist/core/lean-engineering-policy.js +0 -1
  564. package/dist/core/local-llm/local-collaboration-policy.js +0 -1
  565. package/dist/core/local-llm/local-llm-backpressure.js +0 -1
  566. package/dist/core/local-llm/local-llm-capability.js +0 -1
  567. package/dist/core/local-llm/local-llm-client.js +0 -1
  568. package/dist/core/local-llm/local-llm-config.js +0 -1
  569. package/dist/core/local-llm/local-llm-context-cache.js +0 -1
  570. package/dist/core/local-llm/local-llm-control-adapter.js +0 -1
  571. package/dist/core/local-llm/local-llm-json-repair.js +0 -1
  572. package/dist/core/local-llm/local-llm-metrics.js +0 -1
  573. package/dist/core/local-llm/local-llm-ollama-client.js +0 -1
  574. package/dist/core/local-llm/local-llm-openai-compatible-client.js +0 -1
  575. package/dist/core/local-llm/local-llm-prompt-cache.js +0 -1
  576. package/dist/core/local-llm/local-llm-scheduler.js +0 -1
  577. package/dist/core/local-llm/local-llm-schema-enforcer.js +0 -1
  578. package/dist/core/local-llm/local-llm-smoke.js +0 -1
  579. package/dist/core/local-llm/local-llm-warmup.js +0 -1
  580. package/dist/core/local-llm/local-worker-eligibility.js +0 -1
  581. package/dist/core/locks/file-lock.js +0 -1
  582. package/dist/core/loop-blocker.js +0 -1
  583. package/dist/core/loops/goal-to-loop-compat.js +0 -1
  584. package/dist/core/loops/loop-artifacts.js +0 -1
  585. package/dist/core/loops/loop-checkpoint.js +0 -1
  586. package/dist/core/loops/loop-concurrency-budget.js +0 -1
  587. package/dist/core/loops/loop-continuation-enforcer.js +0 -1
  588. package/dist/core/loops/loop-decomposer.js +1 -2
  589. package/dist/core/loops/loop-final-arbiter-contract.js +0 -1
  590. package/dist/core/loops/loop-finalizer.js +0 -1
  591. package/dist/core/loops/loop-fixture-policy.js +0 -1
  592. package/dist/core/loops/loop-gate-ladder.js +0 -1
  593. package/dist/core/loops/loop-gate-registry.js +0 -1
  594. package/dist/core/loops/loop-gate-runner.js +0 -1
  595. package/dist/core/loops/loop-gate-selector.js +3 -4
  596. package/dist/core/loops/loop-gpt-final-arbiter.js +0 -1
  597. package/dist/core/loops/loop-integration-merge.js +0 -1
  598. package/dist/core/loops/loop-interrupt-registry.js +0 -1
  599. package/dist/core/loops/loop-iteration-runner.js +0 -1
  600. package/dist/core/loops/loop-lease.js +0 -1
  601. package/dist/core/loops/loop-merge-strategy.js +0 -1
  602. package/dist/core/loops/loop-mutation-ledger.js +0 -1
  603. package/dist/core/loops/loop-observability.js +0 -1
  604. package/dist/core/loops/loop-owner-inference.js +0 -1
  605. package/dist/core/loops/loop-owner-ledger.js +0 -1
  606. package/dist/core/loops/loop-planner.js +0 -1
  607. package/dist/core/loops/loop-proof-summary.js +0 -1
  608. package/dist/core/loops/loop-proof.js +0 -1
  609. package/dist/core/loops/loop-risk-classifier.js +2 -3
  610. package/dist/core/loops/loop-runtime-control.js +0 -1
  611. package/dist/core/loops/loop-runtime.js +0 -1
  612. package/dist/core/loops/loop-scheduler.js +0 -1
  613. package/dist/core/loops/loop-schema.js +0 -1
  614. package/dist/core/loops/loop-side-effect-scanner.js +0 -1
  615. package/dist/core/loops/loop-state.js +0 -1
  616. package/dist/core/loops/loop-worker-prompts.js +0 -1
  617. package/dist/core/loops/loop-worker-runtime.js +1 -3
  618. package/dist/core/loops/loop-worktree-runtime.js +0 -1
  619. package/dist/core/mad-sks/audit-ledger.js +0 -1
  620. package/dist/core/mad-sks/authorization-manifest.js +0 -1
  621. package/dist/core/mad-sks/executors/computer-use-executor.js +0 -1
  622. package/dist/core/mad-sks/executors/db-write-executor.js +1 -2
  623. package/dist/core/mad-sks/executors/executor-base.js +0 -1
  624. package/dist/core/mad-sks/executors/file-write-executor.js +0 -1
  625. package/dist/core/mad-sks/executors/index.js +0 -1
  626. package/dist/core/mad-sks/executors/package-install-executor.js +0 -1
  627. package/dist/core/mad-sks/executors/service-control-executor.js +0 -1
  628. package/dist/core/mad-sks/executors/shell-command-executor.js +0 -1
  629. package/dist/core/mad-sks/executors/sql-plane-executor.js +12 -13
  630. package/dist/core/mad-sks/guard-middleware.js +0 -1
  631. package/dist/core/mad-sks/immutable-harness-guard.js +0 -1
  632. package/dist/core/mad-sks/permission-model.js +0 -1
  633. package/dist/core/mad-sks/proof-evidence.js +0 -1
  634. package/dist/core/mad-sks/rollback-apply.js +0 -1
  635. package/dist/core/mad-sks/rollback-plan.js +0 -1
  636. package/dist/core/mad-sks/shell-argv-classifier.js +0 -1
  637. package/dist/core/mad-sks/sql-plane/capability.js +202 -0
  638. package/dist/core/{mad-db/mad-db-coordinator.js → mad-sks/sql-plane/coordinator.js} +88 -87
  639. package/dist/core/mad-sks/sql-plane/ledger.js +36 -0
  640. package/dist/core/{mad-db/mad-db-lock.js → mad-sks/sql-plane/lock.js} +5 -6
  641. package/dist/core/{mad-db/mad-db-executor.js → mad-sks/sql-plane/mcp-executor.js} +24 -25
  642. package/dist/core/{mad-db/mad-db-operation-store.js → mad-sks/sql-plane/operation-store.js} +18 -19
  643. package/dist/core/mad-sks/sql-plane/paths.js +16 -0
  644. package/dist/core/mad-sks/sql-plane/policy-resolver.js +127 -0
  645. package/dist/core/{mad-db/mad-db-policy.js → mad-sks/sql-plane/policy.js} +29 -32
  646. package/dist/core/{mad-db/mad-db-postconditions.js → mad-sks/sql-plane/postconditions.js} +4 -5
  647. package/dist/core/{mad-db/mad-db-recovery.js → mad-sks/sql-plane/recovery.js} +8 -8
  648. package/dist/core/{mad-db/mad-db-result-lifecycle.js → mad-sks/sql-plane/result-lifecycle.js} +13 -14
  649. package/dist/core/{mad-db/mad-db-runtime-profile.js → mad-sks/sql-plane/runtime-profile.js} +16 -16
  650. package/dist/core/{mad-db/mad-db-target.js → mad-sks/sql-plane/target.js} +12 -13
  651. package/dist/core/mad-sks/write-guard.js +0 -1
  652. package/dist/core/managed-assets/managed-assets-manifest.js +8 -8
  653. package/dist/core/managed-path-safety.js +287 -0
  654. package/dist/core/managed-paths.js +0 -1
  655. package/dist/core/mcp/mcp-0-134-policy.js +0 -1
  656. package/dist/core/mcp/mcp-config-preservation.js +0 -1
  657. package/dist/core/mcp/mcp-plugin-inventory.js +0 -1
  658. package/dist/core/mcp/mcp-server-policy.js +2 -3
  659. package/dist/core/mcp/mcp-tool-name-normalizer.js +0 -1
  660. package/dist/core/mcp-config/backup.js +102 -0
  661. package/dist/core/mcp-config/codex-cli-adapter.js +165 -0
  662. package/dist/core/mcp-config/config-reader.js +148 -0
  663. package/dist/core/mcp-config/effective-merge.js +24 -0
  664. package/dist/core/mcp-config/guarded-patch.js +259 -0
  665. package/dist/core/mcp-config/health-check.js +324 -0
  666. package/dist/core/mcp-config/index.js +14 -0
  667. package/dist/core/mcp-config/inventory.js +82 -0
  668. package/dist/core/mcp-config/mutation.js +366 -0
  669. package/dist/core/mcp-config/oauth.js +44 -0
  670. package/dist/core/mcp-config/redaction.js +84 -0
  671. package/dist/core/mcp-config/restore.js +106 -0
  672. package/dist/core/mcp-config/scope.js +69 -0
  673. package/dist/core/mcp-config/secret-policy.js +196 -0
  674. package/dist/core/mcp-config/types.js +8 -0
  675. package/dist/core/memory-governor.js +0 -1
  676. package/dist/core/memory-summary.js +0 -1
  677. package/dist/core/migration/migration-transaction-journal.js +0 -1
  678. package/dist/core/mission.js +0 -1
  679. package/dist/core/mistake-memory.js +0 -1
  680. package/dist/core/mistake-recall.js +0 -1
  681. package/dist/core/naruto/hardware-capacity-probe.js +0 -1
  682. package/dist/core/naruto/naruto-active-pool.js +0 -1
  683. package/dist/core/naruto/naruto-allocation-policy.js +0 -1
  684. package/dist/core/naruto/naruto-backpressure.js +0 -1
  685. package/dist/core/naruto/naruto-concurrency-governor.js +14 -15
  686. package/dist/core/naruto/naruto-finalizer.js +0 -1
  687. package/dist/core/naruto/naruto-generation-scheduler.js +0 -1
  688. package/dist/core/naruto/naruto-gpt-final-pack.js +0 -1
  689. package/dist/core/naruto/naruto-loop-mesh.js +0 -1
  690. package/dist/core/naruto/naruto-loop-worker-router.js +0 -1
  691. package/dist/core/naruto/naruto-parallel-patch-apply.js +0 -1
  692. package/dist/core/naruto/naruto-patch-transaction-batch.js +0 -1
  693. package/dist/core/naruto/naruto-real-worker-child.js +0 -1
  694. package/dist/core/naruto/naruto-real-worker-runtime.js +1 -2
  695. package/dist/core/naruto/naruto-real-write-proof.js +1 -2
  696. package/dist/core/naruto/naruto-rebalance-policy.js +0 -1
  697. package/dist/core/naruto/naruto-role-policy.js +0 -1
  698. package/dist/core/naruto/naruto-task-hints.js +0 -1
  699. package/dist/core/naruto/naruto-verification-dag.js +0 -1
  700. package/dist/core/naruto/naruto-verification-pool.js +0 -1
  701. package/dist/core/naruto/naruto-work-graph.js +6 -7
  702. package/dist/core/naruto/naruto-work-item.js +0 -1
  703. package/dist/core/naruto/naruto-write-e2e.js +1 -2
  704. package/dist/core/naruto/normalize-worker-prompt-text.js +0 -1
  705. package/dist/core/naruto/resource-pressure-monitor.js +0 -1
  706. package/dist/core/naruto/solution-tournament.js +0 -1
  707. package/dist/core/no-question-guard.js +0 -1
  708. package/dist/core/official-subagent-review-policy.js +17 -0
  709. package/dist/core/ops/diagnostics-bundle.js +0 -1
  710. package/dist/core/ops/ops-maturity-scorecard.js +0 -1
  711. package/dist/core/ops/reporting.js +0 -1
  712. package/dist/core/ops/upgrade-migration-fixtures.js +1 -2
  713. package/dist/core/perf/fsx-hotpath.js +0 -1
  714. package/dist/core/perf/import-graph-budget.js +0 -1
  715. package/dist/core/perf/lru-cache.js +0 -1
  716. package/dist/core/perf/perf-budget.js +0 -1
  717. package/dist/core/perf/performance-profiler.js +0 -1
  718. package/dist/core/perf/release-latency-slo.js +317 -0
  719. package/dist/core/perf-bench.js +1 -2
  720. package/dist/core/performance-budgets.json +6 -6
  721. package/dist/core/permission-gates.js +0 -1
  722. package/dist/core/pipeline/active-context.js +0 -1
  723. package/dist/core/pipeline/agent-stage-policy.js +0 -1
  724. package/dist/core/pipeline/final-gpt-patch-stage.js +0 -1
  725. package/dist/core/pipeline/final-gpt-review-stage.js +0 -1
  726. package/dist/core/pipeline/finalize-pipeline-result.js +0 -1
  727. package/dist/core/pipeline/gpt-final-required.js +0 -1
  728. package/dist/core/pipeline/pipeline-plan-writer.js +0 -1
  729. package/dist/core/pipeline/plan-schema.js +0 -1
  730. package/dist/core/pipeline/prompt-context-answer.js +0 -1
  731. package/dist/core/pipeline/prompt-context-computer-use.js +0 -1
  732. package/dist/core/pipeline/prompt-context-dfix.js +0 -1
  733. package/dist/core/pipeline/prompt-context.js +0 -1
  734. package/dist/core/pipeline/route-prep-db.js +0 -1
  735. package/dist/core/pipeline/route-prep-gx.js +0 -1
  736. package/dist/core/pipeline/route-prep-image-ux.js +0 -1
  737. package/dist/core/pipeline/route-prep-ppt.js +0 -1
  738. package/dist/core/pipeline/route-prep-qa.js +0 -1
  739. package/dist/core/pipeline/route-prep-research.js +0 -1
  740. package/dist/core/pipeline/route-prep.js +0 -1
  741. package/dist/core/pipeline/stage-policy.js +0 -1
  742. package/dist/core/pipeline/stop-gate-context7.js +0 -1
  743. package/dist/core/pipeline/stop-gate-proof.js +0 -1
  744. package/dist/core/pipeline/stop-gate-subagents.js +0 -1
  745. package/dist/core/pipeline/stop-gate.js +0 -1
  746. package/dist/core/pipeline/validation.js +0 -1
  747. package/dist/core/pipeline-internals/runtime-core.js +66 -144
  748. package/dist/core/pipeline-internals/runtime-gates.js +14 -139
  749. package/dist/core/pipeline.js +0 -1
  750. package/dist/core/ppt/artifacts.js +0 -1
  751. package/dist/core/ppt/html.js +0 -1
  752. package/dist/core/ppt/style-tokens.js +0 -1
  753. package/dist/core/ppt-imagegen-review.js +0 -1
  754. package/dist/core/ppt-review/deck-issue-ledger.js +0 -1
  755. package/dist/core/ppt-review/index.js +0 -1
  756. package/dist/core/ppt-review/ppt-fix-task-planner.js +0 -1
  757. package/dist/core/ppt-review/ppt-patch-handoff.js +0 -1
  758. package/dist/core/ppt-review/reexport-rereview.js +0 -1
  759. package/dist/core/ppt-review/slide-exporter.js +0 -1
  760. package/dist/core/ppt-review/slide-imagegen-review.js +0 -1
  761. package/dist/core/ppt-review/slide-issue-extraction.js +0 -1
  762. package/dist/core/ppt.js +2 -3
  763. package/dist/core/preflight/parallel-preflight-engine.js +0 -1
  764. package/dist/core/probes/probe-memoization.js +0 -1
  765. package/dist/core/product-design-app-server.js +0 -1
  766. package/dist/core/product-design-plugin.js +9 -10
  767. package/dist/core/prompt/prompt-placeholder-guard.js +0 -1
  768. package/dist/core/prompt-context-builder.js +0 -1
  769. package/dist/core/proof/auto-finalize.js +3 -74
  770. package/dist/core/proof/claim-ledger.js +0 -1
  771. package/dist/core/proof/command-ledger.js +0 -1
  772. package/dist/core/proof/evidence-collector.js +0 -1
  773. package/dist/core/proof/fake-real-proof-policy.js +208 -60
  774. package/dist/core/proof/file-change-ledger.js +0 -1
  775. package/dist/core/proof/proof-reader.js +0 -1
  776. package/dist/core/proof/proof-redaction.test-helper.js +0 -1
  777. package/dist/core/proof/proof-schema.js +0 -1
  778. package/dist/core/proof/proof-writer.js +0 -1
  779. package/dist/core/proof/root-cause-policy.js +0 -1
  780. package/dist/core/proof/route-adapter.js +8 -5
  781. package/dist/core/proof/route-finalizer-fixtures.js +1 -2
  782. package/dist/core/proof/route-finalizer-policy.js +0 -1
  783. package/dist/core/proof/route-finalizer.js +0 -1
  784. package/dist/core/proof/route-proof-gate.js +14 -31
  785. package/dist/core/proof/route-proof-policy.js +8 -10
  786. package/dist/core/proof/runtime-truth-matrix.js +44 -66
  787. package/dist/core/proof/selftest-proof-fixtures.js +9 -10
  788. package/dist/core/proof/validation.js +0 -1
  789. package/dist/core/proof-field.js +17 -18
  790. package/dist/core/provider/model-router.js +0 -1
  791. package/dist/core/provider/provider-badge.js +0 -1
  792. package/dist/core/provider/provider-context.js +1 -2
  793. package/dist/core/provider/provider-self-heal.js +0 -1
  794. package/dist/core/providers/glm/bench/glm-bench-comparison.js +0 -1
  795. package/dist/core/providers/glm/bench/glm-bench-fixture.js +0 -1
  796. package/dist/core/providers/glm/bench/glm-bench-model-lock-proof.js +0 -1
  797. package/dist/core/providers/glm/bench/glm-bench-report.js +0 -1
  798. package/dist/core/providers/glm/bench/glm-benchmark-runner.js +0 -1
  799. package/dist/core/providers/glm/bench/glm-benchmark-types.js +0 -1
  800. package/dist/core/providers/glm/bench/glm-direct-bench-runner.js +0 -1
  801. package/dist/core/providers/glm/glm-52-profile.js +0 -1
  802. package/dist/core/providers/glm/glm-52-request.js +0 -1
  803. package/dist/core/providers/glm/glm-52-response-guard.js +0 -1
  804. package/dist/core/providers/glm/glm-52-settings.js +0 -1
  805. package/dist/core/providers/glm/glm-context-budget.js +0 -1
  806. package/dist/core/providers/glm/glm-context-cache.js +0 -1
  807. package/dist/core/providers/glm/glm-direct-run.js +0 -1
  808. package/dist/core/providers/glm/glm-interactive-launch.js +1 -2
  809. package/dist/core/providers/glm/glm-latency-trace.js +0 -1
  810. package/dist/core/providers/glm/glm-loop-guard.js +0 -1
  811. package/dist/core/providers/glm/glm-mad-launch.js +0 -1
  812. package/dist/core/providers/glm/glm-mad-mode.js +0 -1
  813. package/dist/core/providers/glm/glm-model-meta-cache.js +0 -1
  814. package/dist/core/providers/glm/glm-patch-apply.js +16 -2
  815. package/dist/core/providers/glm/glm-patch-parser.js +0 -1
  816. package/dist/core/providers/glm/glm-profile-resolver.js +0 -1
  817. package/dist/core/providers/glm/glm-readiness.js +0 -1
  818. package/dist/core/providers/glm/glm-reasoning-policy.js +0 -1
  819. package/dist/core/providers/glm/glm-request-cache.js +0 -1
  820. package/dist/core/providers/glm/glm-run-controller.js +0 -1
  821. package/dist/core/providers/glm/glm-run-state.js +0 -1
  822. package/dist/core/providers/glm/glm-run-timeout.js +0 -1
  823. package/dist/core/providers/glm/glm-speed-context.js +0 -1
  824. package/dist/core/providers/glm/glm-speed-gate.js +0 -1
  825. package/dist/core/providers/glm/glm-speed-output-parser.js +0 -1
  826. package/dist/core/providers/glm/glm-tool-schema-cache.js +0 -1
  827. package/dist/core/providers/glm/naruto/glm-naruto-apply-transaction.js +0 -1
  828. package/dist/core/providers/glm/naruto/glm-naruto-artifacts.js +0 -1
  829. package/dist/core/providers/glm/naruto/glm-naruto-bench.js +0 -1
  830. package/dist/core/providers/glm/naruto/glm-naruto-budget.js +0 -1
  831. package/dist/core/providers/glm/naruto/glm-naruto-combined-patch.js +0 -1
  832. package/dist/core/providers/glm/naruto/glm-naruto-command.js +2 -3
  833. package/dist/core/providers/glm/naruto/glm-naruto-concurrency-governor.js +2 -3
  834. package/dist/core/providers/glm/naruto/glm-naruto-conflict-graph.js +0 -1
  835. package/dist/core/providers/glm/naruto/glm-naruto-critical-path.js +0 -1
  836. package/dist/core/providers/glm/naruto/glm-naruto-decomposer.js +0 -1
  837. package/dist/core/providers/glm/naruto/glm-naruto-file-lease.js +0 -1
  838. package/dist/core/providers/glm/naruto/glm-naruto-final-seal.js +0 -1
  839. package/dist/core/providers/glm/naruto/glm-naruto-finalizer.js +0 -1
  840. package/dist/core/providers/glm/naruto/glm-naruto-hunk-conflict.js +0 -1
  841. package/dist/core/providers/glm/naruto/glm-naruto-hunk-parser.js +0 -1
  842. package/dist/core/providers/glm/naruto/glm-naruto-isolation-policy.js +0 -1
  843. package/dist/core/providers/glm/naruto/glm-naruto-judge.js +0 -1
  844. package/dist/core/providers/glm/naruto/glm-naruto-merge-planner.js +0 -1
  845. package/dist/core/providers/glm/naruto/glm-naruto-metrics.js +0 -1
  846. package/dist/core/providers/glm/naruto/glm-naruto-orchestrator.js +0 -1
  847. package/dist/core/providers/glm/naruto/glm-naruto-parallelism-summary.js +0 -1
  848. package/dist/core/providers/glm/naruto/glm-naruto-patch-candidate-gate.js +0 -1
  849. package/dist/core/providers/glm/naruto/glm-naruto-patch-candidate-parser.js +0 -1
  850. package/dist/core/providers/glm/naruto/glm-naruto-patch-envelope.js +0 -1
  851. package/dist/core/providers/glm/naruto/glm-naruto-quorum.js +0 -1
  852. package/dist/core/providers/glm/naruto/glm-naruto-rate-limiter.js +0 -1
  853. package/dist/core/providers/glm/naruto/glm-naruto-repair-wave.js +0 -1
  854. package/dist/core/providers/glm/naruto/glm-naruto-requirement-coverage.js +0 -1
  855. package/dist/core/providers/glm/naruto/glm-naruto-requirement-ledger.js +0 -1
  856. package/dist/core/providers/glm/naruto/glm-naruto-scoreboard.js +0 -1
  857. package/dist/core/providers/glm/naruto/glm-naruto-secret-audit.js +0 -1
  858. package/dist/core/providers/glm/naruto/glm-naruto-session-id.js +0 -1
  859. package/dist/core/providers/glm/naruto/glm-naruto-shard-planner.js +0 -1
  860. package/dist/core/providers/glm/naruto/glm-naruto-stage-scheduler.js +0 -1
  861. package/dist/core/providers/glm/naruto/glm-naruto-targeted-checks.js +0 -1
  862. package/dist/core/providers/glm/naruto/glm-naruto-task-size-classifier.js +0 -1
  863. package/dist/core/providers/glm/naruto/glm-naruto-terminal.js +0 -1
  864. package/dist/core/providers/glm/naruto/glm-naruto-trace.js +0 -1
  865. package/dist/core/providers/glm/naruto/glm-naruto-types.js +2 -3
  866. package/dist/core/providers/glm/naruto/glm-naruto-usage-extractor.js +0 -1
  867. package/dist/core/providers/glm/naruto/glm-naruto-verifier-output.js +0 -1
  868. package/dist/core/providers/glm/naruto/glm-naruto-work-graph.js +0 -1
  869. package/dist/core/providers/glm/naruto/glm-naruto-worker-artifacts.js +0 -1
  870. package/dist/core/providers/glm/naruto/glm-naruto-worker-pool.js +1 -2
  871. package/dist/core/providers/glm/naruto/glm-naruto-worker-runtime.js +0 -1
  872. package/dist/core/providers/glm/naruto/glm-naruto-worker-scheduler.js +1 -2
  873. package/dist/core/providers/glm/naruto/glm-naruto-worker.js +0 -1
  874. package/dist/core/providers/glm/naruto/glm-naruto-worktree-cleanup.js +0 -1
  875. package/dist/core/providers/glm/naruto/glm-naruto-worktree-manager.js +16 -2
  876. package/dist/core/providers/glm/naruto/glm-naruto-worktree-worker.js +0 -1
  877. package/dist/core/providers/glm/naruto/glm-naruto-worktree.js +16 -2
  878. package/dist/core/providers/openrouter/openrouter-client.js +0 -1
  879. package/dist/core/providers/openrouter/openrouter-error.js +0 -1
  880. package/dist/core/providers/openrouter/openrouter-provider-health.js +0 -1
  881. package/dist/core/providers/openrouter/openrouter-secret-store.js +0 -1
  882. package/dist/core/providers/openrouter/openrouter-stream.js +0 -1
  883. package/dist/core/providers/openrouter/openrouter-types.js +0 -1
  884. package/dist/core/python-tools/python-tool-runner.js +0 -1
  885. package/dist/core/qa-loop/qa-app-server-driver.js +0 -1
  886. package/dist/core/qa-loop/qa-contract.js +0 -1
  887. package/dist/core/qa-loop/qa-gate.js +0 -1
  888. package/dist/core/qa-loop/qa-loop-app-handoff-confirmation.js +0 -1
  889. package/dist/core/qa-loop/qa-loop-budget-policy.js +0 -1
  890. package/dist/core/qa-loop/qa-runtime-artifacts.js +0 -1
  891. package/dist/core/qa-loop/qa-surface-router.js +0 -1
  892. package/dist/core/qa-loop/qa-types.js +0 -1
  893. package/dist/core/qa-loop.js +2 -3
  894. package/dist/core/quality/competitor-scorecard.js +0 -1
  895. package/dist/core/questions.js +3 -4
  896. package/dist/core/recallpulse/policy.js +1 -2
  897. package/dist/core/recallpulse.js +6 -7
  898. package/dist/core/release/critical-path-ledger.js +0 -1
  899. package/dist/core/release/extreme-parallel-scheduler.js +0 -1
  900. package/dist/core/release/file-ownership.js +153 -0
  901. package/dist/core/release/gate-cache.js +0 -1
  902. package/dist/core/release/gate-manifest.js +8 -8
  903. package/dist/core/release/gate-pack-assertion.js +0 -1
  904. package/dist/core/release/gate-pack-fixture-cache.js +0 -1
  905. package/dist/core/release/gate-pack-manifest.js +0 -1
  906. package/dist/core/release/gate-pack-runner.js +0 -1
  907. package/dist/core/release/gate-timing.js +0 -1
  908. package/dist/core/release/macos-menubar-proof.js +167 -0
  909. package/dist/core/release/main-push-guard.js +135 -0
  910. package/dist/core/release/main-push-receipt.js +147 -0
  911. package/dist/core/release/npm-pack-proof.js +41 -16
  912. package/dist/core/release/package-dist-snapshot.js +0 -1
  913. package/dist/core/release/package-size-budget.js +1 -4
  914. package/dist/core/release/release-authorization-snapshot.js +0 -1
  915. package/dist/core/release/release-cache-key.js +0 -1
  916. package/dist/core/release/release-closure-contract.js +29 -0
  917. package/dist/core/release/release-closure-helpers.js +293 -0
  918. package/dist/core/release/release-closure-validation.js +271 -0
  919. package/dist/core/release/release-closure.js +134 -0
  920. package/dist/core/release/release-gate-affected-selector.js +2 -3
  921. package/dist/core/release/release-gate-batch-runner.js +0 -1
  922. package/dist/core/release/release-gate-cache-v2.js +2 -12
  923. package/dist/core/release/release-gate-contract.js +9 -8
  924. package/dist/core/release/release-gate-dag.js +34 -10
  925. package/dist/core/release/release-gate-hermetic-env.js +1 -2
  926. package/dist/core/release/release-gate-node.js +0 -1
  927. package/dist/core/release/release-gate-report.js +0 -1
  928. package/dist/core/release/release-gate-resource-governor.js +0 -1
  929. package/dist/core/release/release-gate-scheduler.js +0 -1
  930. package/dist/core/release/release-origin.js +29 -0
  931. package/dist/core/release/release-pack-content-scanner.js +98 -0
  932. package/dist/core/release/release-pack-contract.js +2 -0
  933. package/dist/core/release/release-pack-receipt.js +330 -0
  934. package/dist/core/release/release-pack-tarball.js +64 -0
  935. package/dist/core/release/release-proof-truth.js +0 -1
  936. package/dist/core/release/release-real-contract.js +1 -3
  937. package/dist/core/release/release-stamp-proof.js +127 -0
  938. package/dist/core/release/resource-class-budget.js +0 -1
  939. package/dist/core/release/runtime-script-pack-closure.js +344 -0
  940. package/dist/core/release/sla-scheduler.js +0 -1
  941. package/dist/core/release-parallel-full-coverage.js +0 -1
  942. package/dist/core/remote/audit-idempotency.js +209 -0
  943. package/dist/core/remote/index.js +10 -0
  944. package/dist/core/remote/machine-registry.js +162 -0
  945. package/dist/core/remote/owner-proof.js +224 -0
  946. package/dist/core/remote/protocol.js +263 -0
  947. package/dist/core/remote/readiness.js +158 -0
  948. package/dist/core/remote/session-index.js +76 -0
  949. package/dist/core/remote/session-snapshot.js +197 -0
  950. package/dist/core/remote/ssh-worker-client.js +377 -0
  951. package/dist/core/remote/types.js +10 -0
  952. package/dist/core/remote/worker.js +343 -0
  953. package/dist/core/reporting/markdown-table.js +0 -1
  954. package/dist/core/research/claim-evidence-matrix.js +0 -1
  955. package/dist/core/research/experiment-plan.js +0 -1
  956. package/dist/core/research/falsification.js +0 -1
  957. package/dist/core/research/implementation-blueprint-densifier.js +0 -1
  958. package/dist/core/research/implementation-blueprint-markdown.js +0 -1
  959. package/dist/core/research/implementation-blueprint.js +0 -1
  960. package/dist/core/research/mock-result.js +0 -1
  961. package/dist/core/research/replication-pack.js +0 -1
  962. package/dist/core/research/research-adversarial-review.js +1 -3
  963. package/dist/core/research/research-claim-builder.js +0 -1
  964. package/dist/core/research/research-claim-synthesizer.js +0 -1
  965. package/dist/core/research/research-cycle-runner.js +0 -1
  966. package/dist/core/research/research-falsification-runner.js +0 -1
  967. package/dist/core/research/research-final-reviewer.js +0 -1
  968. package/dist/core/research/research-handoff.js +3 -4
  969. package/dist/core/research/research-plan-markdown.js +0 -1
  970. package/dist/core/research/research-prompt-contract.js +0 -1
  971. package/dist/core/research/research-quality-contract.js +0 -1
  972. package/dist/core/research/research-realistic-report.js +2 -3
  973. package/dist/core/research/research-repetition-detector.js +0 -1
  974. package/dist/core/research/research-report-quality.js +0 -1
  975. package/dist/core/research/research-review-artifact-digest.js +0 -1
  976. package/dist/core/research/research-source-evidence.js +0 -1
  977. package/dist/core/research/research-source-layer-catalog.js +0 -1
  978. package/dist/core/research/research-source-ledger-merge.js +0 -1
  979. package/dist/core/research/research-source-shards.js +0 -1
  980. package/dist/core/research/research-stage-runner.js +1 -2
  981. package/dist/core/research/research-super-search.js +0 -1
  982. package/dist/core/research/research-synthesis-prompt.js +0 -1
  983. package/dist/core/research/research-synthesis-writer.js +0 -1
  984. package/dist/core/research/research-work-graph.js +3 -5
  985. package/dist/core/research/source-quality-report.js +0 -1
  986. package/dist/core/research.js +1 -2
  987. package/dist/core/responses-retry-policy.js +0 -1
  988. package/dist/core/results.js +0 -1
  989. package/dist/core/retention/retention-budget.js +0 -1
  990. package/dist/core/retention.js +0 -1
  991. package/dist/core/router/capability-card.js +0 -1
  992. package/dist/core/router/route-cache.js +0 -1
  993. package/dist/core/router/router-proof.js +0 -1
  994. package/dist/core/router/task-classifier.js +0 -1
  995. package/dist/core/router/ultra-router.js +0 -1
  996. package/dist/core/routes/constants.js +18 -19
  997. package/dist/core/routes/design-policy.js +0 -1
  998. package/dist/core/routes/diagnostic-allowlist.js +0 -1
  999. package/dist/core/routes/dollar-manifest-lite.js +19 -13
  1000. package/dist/core/routes/dollar-prefix.js +25 -0
  1001. package/dist/core/routes/evidence.js +0 -1
  1002. package/dist/core/routes/model-mode-router.js +1 -2
  1003. package/dist/core/routes/ppt-policy.js +6 -8
  1004. package/dist/core/routes.js +81 -101
  1005. package/dist/core/runtime/task-profile.js +20 -3
  1006. package/dist/core/runtime/verification-budget.js +0 -1
  1007. package/dist/core/rust-accelerator.js +1 -2
  1008. package/dist/core/safety/command-contract/contracts.js +210 -0
  1009. package/dist/core/safety/command-contract/index.js +3 -0
  1010. package/dist/core/safety/command-contract/json-schema.js +91 -0
  1011. package/dist/core/safety/command-contract/types.js +1 -0
  1012. package/dist/core/safety/mutation-guard.js +0 -1
  1013. package/dist/core/safety/mutation-ledger.js +0 -1
  1014. package/dist/core/safety/requested-scope-contract.js +0 -0
  1015. package/dist/core/safety/side-effect-runtime-report.js +0 -1
  1016. package/dist/core/safety/ssot-guard.js +7 -8
  1017. package/dist/core/search-visibility/adapter-registry.js +0 -1
  1018. package/dist/core/search-visibility/adapters/next-app.js +0 -1
  1019. package/dist/core/search-visibility/adapters/next-pages.js +0 -1
  1020. package/dist/core/search-visibility/adapters/static-site.js +0 -1
  1021. package/dist/core/search-visibility/analyzers.js +0 -1
  1022. package/dist/core/search-visibility/artifacts.js +0 -1
  1023. package/dist/core/search-visibility/discovery.js +0 -1
  1024. package/dist/core/search-visibility/index.js +0 -1
  1025. package/dist/core/search-visibility/marketing-truthfulness.js +2 -3
  1026. package/dist/core/search-visibility/marketing.js +1 -2
  1027. package/dist/core/search-visibility/mission.js +0 -1
  1028. package/dist/core/search-visibility/mutation.js +0 -1
  1029. package/dist/core/search-visibility/types.js +0 -1
  1030. package/dist/core/search-visibility/verifier.js +0 -1
  1031. package/dist/core/secret-redaction.js +0 -1
  1032. package/dist/core/security/high-risk-contracts.js +0 -1
  1033. package/dist/core/security/redact-secrets.js +0 -1
  1034. package/dist/core/session/project-namespace.js +1 -2
  1035. package/dist/core/skill-forge.js +5 -6
  1036. package/dist/core/skills/core-rollout-trace.js +0 -1
  1037. package/dist/core/skills/core-skill-card.js +0 -0
  1038. package/dist/core/skills/core-skill-deployment.js +0 -1
  1039. package/dist/core/skills/core-skill-epoch.js +0 -1
  1040. package/dist/core/skills/core-skill-meta-update.js +0 -1
  1041. package/dist/core/skills/core-skill-patch-apply.js +0 -1
  1042. package/dist/core/skills/core-skill-patch.js +0 -1
  1043. package/dist/core/skills/core-skill-reflection.js +0 -1
  1044. package/dist/core/skills/core-skill-runtime.js +0 -1
  1045. package/dist/core/skills/core-skill-scorer.js +0 -1
  1046. package/dist/core/skills/core-skill-trainer.js +0 -1
  1047. package/dist/core/skills/core-skill-types.js +0 -1
  1048. package/dist/core/skills/core-skill-validation.js +0 -1
  1049. package/dist/core/skills/rejected-skill-patch-buffer.js +0 -1
  1050. package/dist/core/source-intelligence/appshots-evidence.js +0 -1
  1051. package/dist/core/source-intelligence/codex-history-search.js +0 -1
  1052. package/dist/core/source-intelligence/source-intelligence-policy.js +0 -1
  1053. package/dist/core/source-intelligence/source-intelligence-proof.js +0 -1
  1054. package/dist/core/source-intelligence/source-intelligence-runner.js +0 -1
  1055. package/dist/core/stop-gate/gate-evaluator.js +0 -1
  1056. package/dist/core/stop-gate/stop-gate-check.js +0 -1
  1057. package/dist/core/stop-gate/stop-gate-diagnostics.js +0 -1
  1058. package/dist/core/stop-gate/stop-gate-resolver.js +0 -1
  1059. package/dist/core/stop-gate/stop-gate-types.js +0 -1
  1060. package/dist/core/stop-gate/stop-gate-writer.js +0 -1
  1061. package/dist/core/strategy/adhd-orchestrating-gate.js +0 -1
  1062. package/dist/core/strategy/strategy-compiler.js +1 -2
  1063. package/dist/core/strategy/strategy-gate.js +0 -1
  1064. package/dist/core/structured-output-adapter.js +0 -1
  1065. package/dist/core/subagents/agent-catalog.js +62 -13
  1066. package/dist/core/subagents/model-policy.js +0 -1
  1067. package/dist/core/subagents/naruto-help-contract.js +5 -10
  1068. package/dist/core/subagents/official-subagent-config.js +43 -28
  1069. package/dist/core/subagents/official-subagent-preparation.js +77 -24
  1070. package/dist/core/subagents/official-subagent-prompt.js +138 -9
  1071. package/dist/core/subagents/official-subagent-runner.js +1 -3
  1072. package/dist/core/subagents/subagent-evidence.js +0 -1
  1073. package/dist/core/subagents/terminology.js +0 -1
  1074. package/dist/core/subagents/thread-budget.js +51 -4
  1075. package/dist/core/subagents/triwiki-attention.js +0 -1
  1076. package/dist/core/super-search/doctor.js +1 -2
  1077. package/dist/core/super-search/index.js +0 -1
  1078. package/dist/core/super-search/local-http-smoke.js +0 -1
  1079. package/dist/core/super-search/runtime-helpers.js +0 -1
  1080. package/dist/core/super-search/runtime.js +0 -1
  1081. package/dist/core/super-search/source-records.js +0 -1
  1082. package/dist/core/super-search/types.js +0 -1
  1083. package/dist/core/telegram/bot-api.js +99 -0
  1084. package/dist/core/telegram/config.js +88 -0
  1085. package/dist/core/telegram/hub.js +241 -0
  1086. package/dist/core/telegram/index.js +8 -0
  1087. package/dist/core/telegram/ledgers.js +207 -0
  1088. package/dist/core/telegram/messages.js +292 -0
  1089. package/dist/core/telegram/owner-lock.js +134 -0
  1090. package/dist/core/telegram/runtime-projection.js +88 -0
  1091. package/dist/core/telegram/runtime.js +369 -0
  1092. package/dist/core/telegram/types.js +1 -0
  1093. package/dist/core/triwiki/agents-md-projector.js +0 -1
  1094. package/dist/core/triwiki/code-index-scanner.js +0 -1
  1095. package/dist/core/triwiki/code-pack-head-freshness.js +0 -1
  1096. package/dist/core/triwiki/code-pack.js +0 -1
  1097. package/dist/core/triwiki/triwiki-affected-graph.js +0 -1
  1098. package/dist/core/triwiki/triwiki-cache-key.js +0 -1
  1099. package/dist/core/triwiki/triwiki-gate-impact-map.js +0 -1
  1100. package/dist/core/triwiki/triwiki-invalidation.js +0 -1
  1101. package/dist/core/triwiki/triwiki-module-card.js +1 -2
  1102. package/dist/core/triwiki/triwiki-proof-bank.js +0 -1
  1103. package/dist/core/triwiki/triwiki-proof-card.js +0 -1
  1104. package/dist/core/triwiki/triwiki-sla-certificate.js +0 -1
  1105. package/dist/core/triwiki-attention.js +20 -6
  1106. package/dist/core/triwiki-provenance.js +0 -1
  1107. package/dist/core/triwiki-runtime.js +0 -1
  1108. package/dist/core/triwiki-wrongness/avoidance-rules.js +0 -1
  1109. package/dist/core/triwiki-wrongness/image-wrongness.js +0 -1
  1110. package/dist/core/triwiki-wrongness/validators.js +0 -1
  1111. package/dist/core/triwiki-wrongness/wrongness-cli.js +0 -1
  1112. package/dist/core/triwiki-wrongness/wrongness-ledger.js +2 -3
  1113. package/dist/core/triwiki-wrongness/wrongness-proof-linker.js +0 -1
  1114. package/dist/core/triwiki-wrongness/wrongness-retrieval.js +0 -1
  1115. package/dist/core/triwiki-wrongness/wrongness-schema.js +0 -1
  1116. package/dist/core/triwiki-wrongness/wrongness-trust-policy.js +0 -1
  1117. package/dist/core/trust-kernel/completion-contract.js +1 -2
  1118. package/dist/core/trust-kernel/evidence-router.js +0 -1
  1119. package/dist/core/trust-kernel/route-contract.js +0 -1
  1120. package/dist/core/trust-kernel/route-state-machine.js +0 -1
  1121. package/dist/core/trust-kernel/trust-kernel-schema.js +0 -1
  1122. package/dist/core/trust-kernel/trust-report.js +0 -1
  1123. package/dist/core/trust-kernel/trust-status.js +0 -1
  1124. package/dist/core/ui/dashboard-html.js +0 -1
  1125. package/dist/core/update/semver.js +66 -0
  1126. package/dist/core/update/temporary-install-smoke.js +95 -0
  1127. package/dist/core/update/update-migration-state.js +136 -56
  1128. package/dist/core/update/update-notice.js +49 -132
  1129. package/dist/core/update/update-operation.js +220 -0
  1130. package/dist/core/update/update-status.js +299 -0
  1131. package/dist/core/update-check.js +569 -107
  1132. package/dist/core/usage/codex-account-usage.js +0 -1
  1133. package/dist/core/validators/completion-proof-validator.js +0 -1
  1134. package/dist/core/validators/evidence-validator.js +0 -1
  1135. package/dist/core/validators/feature-fixture-validator.js +0 -1
  1136. package/dist/core/validators/image-voxel-validator.js +0 -1
  1137. package/dist/core/validators/route-contract-validator.js +0 -1
  1138. package/dist/core/validators/trust-report-validator.js +0 -1
  1139. package/dist/core/validators/validation-error.js +0 -1
  1140. package/dist/core/verification/diff-quality.js +0 -1
  1141. package/dist/core/verification/impact-scan.js +0 -1
  1142. package/dist/core/verification/machine-feedback.js +0 -1
  1143. package/dist/core/verification/mistake-rule-compiler.js +0 -1
  1144. package/dist/core/verification/real-evidence-policy.js +0 -1
  1145. package/dist/core/verification/verification-artifact-lock.js +0 -1
  1146. package/dist/core/verification/verification-dag.js +0 -1
  1147. package/dist/core/verification/verification-proof.js +0 -1
  1148. package/dist/core/verification/verification-result.js +0 -1
  1149. package/dist/core/verification/verification-worker-pool.js +0 -1
  1150. package/dist/core/version-manager.js +0 -1
  1151. package/dist/core/version.js +1 -2
  1152. package/dist/core/wiki-coordinate.js +1 -2
  1153. package/dist/core/wiki-image/bbox.js +0 -1
  1154. package/dist/core/wiki-image/before-after-relation.js +0 -1
  1155. package/dist/core/wiki-image/callout-parser.js +0 -1
  1156. package/dist/core/wiki-image/computer-use-evidence.js +0 -1
  1157. package/dist/core/wiki-image/computer-use-ledger.js +0 -1
  1158. package/dist/core/wiki-image/generated-review-parser.js +0 -1
  1159. package/dist/core/wiki-image/image-hash.js +0 -1
  1160. package/dist/core/wiki-image/image-relation.js +0 -1
  1161. package/dist/core/wiki-image/image-ux-evidence.js +0 -1
  1162. package/dist/core/wiki-image/image-voxel-ledger.js +0 -1
  1163. package/dist/core/wiki-image/image-voxel-schema.js +0 -1
  1164. package/dist/core/wiki-image/ppt-image-evidence.js +0 -1
  1165. package/dist/core/wiki-image/proof-linker.js +0 -1
  1166. package/dist/core/wiki-image/route-image-evidence.js +0 -1
  1167. package/dist/core/wiki-image/validation.js +0 -1
  1168. package/dist/core/wiki-image/visual-anchor.js +0 -1
  1169. package/dist/core/work-order-ledger.js +32 -9
  1170. package/dist/core/zellij/homebrew-policy.js +0 -1
  1171. package/dist/core/zellij/zellij-capability.js +0 -1
  1172. package/dist/core/zellij/zellij-clipboard-config.js +0 -1
  1173. package/dist/core/zellij/zellij-command.js +0 -1
  1174. package/dist/core/zellij/zellij-dashboard-pane.js +0 -1
  1175. package/dist/core/zellij/zellij-dashboard-renderer.js +0 -1
  1176. package/dist/core/zellij/zellij-fake-adapter.js +0 -1
  1177. package/dist/core/zellij/zellij-lane-renderer.js +23 -24
  1178. package/dist/core/zellij/zellij-lane-runtime.js +0 -1
  1179. package/dist/core/zellij/zellij-launcher.js +3 -11
  1180. package/dist/core/zellij/zellij-layout-builder.js +3 -4
  1181. package/dist/core/zellij/zellij-monitor-renderer.js +0 -1
  1182. package/dist/core/zellij/zellij-naruto-dashboard.js +0 -1
  1183. package/dist/core/zellij/zellij-official-subagent-activity.js +0 -1
  1184. package/dist/core/zellij/zellij-official-subagent-telemetry.js +0 -1
  1185. package/dist/core/zellij/zellij-pane-proof.js +0 -1
  1186. package/dist/core/zellij/zellij-right-column-manager.js +0 -1
  1187. package/dist/core/zellij/zellij-screen-proof.js +0 -1
  1188. package/dist/core/zellij/zellij-self-heal-types.js +0 -1
  1189. package/dist/core/zellij/zellij-self-heal.js +0 -1
  1190. package/dist/core/zellij/zellij-slot-column-anchor.js +19 -20
  1191. package/dist/core/zellij/zellij-slot-pane-renderer.js +0 -1
  1192. package/dist/core/zellij/zellij-slot-telemetry.js +0 -1
  1193. package/dist/core/zellij/zellij-theme.js +0 -1
  1194. package/dist/core/zellij/zellij-ui-mode.js +0 -1
  1195. package/dist/core/zellij/zellij-update.js +0 -1
  1196. package/dist/core/zellij/zellij-viewport-binder.js +0 -1
  1197. package/dist/core/zellij/zellij-worker-pane-manager.js +3 -4
  1198. package/dist/core/zellij/zellij-worker-pane-summary.js +0 -1
  1199. package/dist/native/sks-menubar/Info.plist.template +24 -0
  1200. package/dist/native/sks-menubar/Resources/AppIcon.icns +0 -0
  1201. package/dist/native/sks-menubar/Resources/Localizable.strings +4 -0
  1202. package/dist/native/sks-menubar/Resources/SKSStatusAttentionTemplate.pdf +0 -0
  1203. package/dist/native/sks-menubar/Resources/SKSStatusTemplate.pdf +0 -0
  1204. package/dist/native/sks-menubar/Resources/SKSStatusUpdateTemplate.pdf +0 -0
  1205. package/dist/native/sks-menubar/Resources/SKSStatusWarningTemplate.pdf +0 -0
  1206. package/dist/native/sks-menubar/Sources/AlertFactory.swift +61 -0
  1207. package/dist/native/sks-menubar/Sources/AppDelegate.swift +47 -0
  1208. package/dist/native/sks-menubar/Sources/AppIdentity.swift +20 -0
  1209. package/dist/native/sks-menubar/Sources/ControlCenterWindowController.swift +108 -0
  1210. package/dist/native/sks-menubar/Sources/DiagnosticsViewController.swift +29 -0
  1211. package/dist/native/sks-menubar/Sources/MCPServersViewController.swift +418 -0
  1212. package/dist/native/sks-menubar/Sources/NotificationCoordinator.swift +119 -0
  1213. package/dist/native/sks-menubar/Sources/OperationCoordinator.swift +230 -0
  1214. package/dist/native/sks-menubar/Sources/OverviewViewController.swift +135 -0
  1215. package/dist/native/sks-menubar/Sources/ProcessClient.swift +110 -0
  1216. package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +64 -0
  1217. package/dist/native/sks-menubar/Sources/RemoteTelegramViewController.swift +66 -0
  1218. package/dist/native/sks-menubar/Sources/SettingsViewController.swift +39 -0
  1219. package/dist/native/sks-menubar/Sources/SidebarItem.swift +11 -0
  1220. package/dist/native/sks-menubar/Sources/StatusItemController.swift +233 -0
  1221. package/dist/native/sks-menubar/Sources/UpdatesViewController.swift +237 -0
  1222. package/dist/native/sks-menubar/Sources/main.swift +18 -0
  1223. package/dist/scripts/agent-message-bus-reader-check.js +0 -1
  1224. package/dist/scripts/all-feature-deep-completion-check.js +0 -1
  1225. package/dist/scripts/appshots-thread-attachment-discovery-check.js +0 -1
  1226. package/dist/scripts/architecture-guard-check.js +31 -3
  1227. package/dist/scripts/build-dist.js +9 -2
  1228. package/dist/scripts/build-once-runner-check.js +0 -1
  1229. package/dist/scripts/canonical-test-runner.js +0 -1
  1230. package/dist/scripts/certificate-sla-check.js +0 -1
  1231. package/dist/scripts/changelog-check.js +0 -1
  1232. package/dist/scripts/check-architecture.js +209 -91
  1233. package/dist/scripts/check-cli-entrypoint.js +0 -1
  1234. package/dist/scripts/check-command-module-budget.js +0 -1
  1235. package/dist/scripts/check-feature-quality.js +0 -1
  1236. package/dist/scripts/check-legacy-free.js +0 -1
  1237. package/dist/scripts/check-pipeline-budget.js +0 -1
  1238. package/dist/scripts/check-pipeline-runtime.js +0 -1
  1239. package/dist/scripts/check-publish-tag.js +0 -1
  1240. package/dist/scripts/check-route-modularity.js +3 -4
  1241. package/dist/scripts/check-runtime-schemas.js +19 -2
  1242. package/dist/scripts/cli-output-consistency-check.js +0 -1
  1243. package/dist/scripts/codex-0-134-runner-truth-check.js +0 -1
  1244. package/dist/scripts/codex-0-137-compat-check.js +0 -1
  1245. package/dist/scripts/codex-0138-capability-artifact-check.js +0 -1
  1246. package/dist/scripts/codex-0138-capability-check.js +0 -1
  1247. package/dist/scripts/codex-0138-doctor-check.js +0 -1
  1248. package/dist/scripts/codex-0138-feature-probes-check.js +0 -1
  1249. package/dist/scripts/codex-0140-capability-check.js +0 -1
  1250. package/dist/scripts/codex-0140-feature-probes-check.js +0 -1
  1251. package/dist/scripts/codex-0144-app-server-v2-check.js +0 -1
  1252. package/dist/scripts/codex-0144-binary-identity-check.js +0 -1
  1253. package/dist/scripts/codex-0144-capability-check.js +0 -1
  1254. package/dist/scripts/codex-0144-core-real-probes-check.js +0 -1
  1255. package/dist/scripts/codex-0144-manifest-check.js +0 -1
  1256. package/dist/scripts/codex-0144-policy-check.js +0 -1
  1257. package/dist/scripts/codex-0144-thread-store-check.js +0 -1
  1258. package/dist/scripts/codex-agent-role-rich-content-check.js +0 -1
  1259. package/dist/scripts/codex-agent-role-sync-check.js +0 -1
  1260. package/dist/scripts/codex-agent-type-routing-check.js +0 -1
  1261. package/dist/scripts/codex-app-execution-profile-check.js +0 -1
  1262. package/dist/scripts/codex-app-fast-ui-preservation-check.js +0 -1
  1263. package/dist/scripts/codex-app-handoff-check.js +0 -1
  1264. package/dist/scripts/codex-app-handoff-launch-check.js +0 -1
  1265. package/dist/scripts/codex-config-load-probe.js +0 -1
  1266. package/dist/scripts/codex-control-all-pipelines-check.js +0 -4
  1267. package/dist/scripts/codex-control-event-stream-ledger-check.js +0 -1
  1268. package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +0 -1
  1269. package/dist/scripts/codex-lb-fast-mode-truth-check.js +0 -1
  1270. package/dist/scripts/codex-lb-fast-ui-preservation-check.js +0 -1
  1271. package/dist/scripts/codex-lb-gpt56-fast-profile-check.js +1 -2
  1272. package/dist/scripts/codex-native-agent-role-content-check.js +0 -1
  1273. package/dist/scripts/codex-native-feature-broker-blackbox.js +3 -0
  1274. package/dist/scripts/codex-native-feature-broker-check.js +0 -1
  1275. package/dist/scripts/codex-native-harness-compat-check.js +0 -1
  1276. package/dist/scripts/codex-native-hook-lifecycle-proof-check.js +0 -1
  1277. package/dist/scripts/codex-native-runtime-e2e-fixture.js +0 -1
  1278. package/dist/scripts/codex-permission-profiles-check.js +0 -1
  1279. package/dist/scripts/codex-plugin-app-template-policy-check.js +0 -1
  1280. package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -1
  1281. package/dist/scripts/codex-sdk-all-pipelines-check.js +0 -4
  1282. package/dist/scripts/codex-sdk-backend-router-check.js +11 -2
  1283. package/dist/scripts/codex-sdk-capability-check.js +0 -1
  1284. package/dist/scripts/codex-sdk-event-stream-ledger-check.js +0 -1
  1285. package/dist/scripts/codex-sdk-real-smoke-check.js +1 -2
  1286. package/dist/scripts/competitor-scorecard-check.js +0 -1
  1287. package/dist/scripts/concurrent-session-collision-check.js +0 -1
  1288. package/dist/scripts/context7-evidence-dedupe-check.js +0 -1
  1289. package/dist/scripts/core-skill-card-schema-check.js +0 -1
  1290. package/dist/scripts/core-skill-deployment-snapshot-check.js +0 -1
  1291. package/dist/scripts/core-skill-heldout-validation-check.js +0 -1
  1292. package/dist/scripts/core-skill-no-drift-check.js +2 -3
  1293. package/dist/scripts/core-skill-no-inference-optimizer-check.js +0 -1
  1294. package/dist/scripts/core-skill-patch-check.js +0 -1
  1295. package/dist/scripts/core-skill-route-runtime-integration-check.js +1 -2
  1296. package/dist/scripts/current-command-surface-check.js +76 -0
  1297. package/dist/scripts/current-surface-update-e2e-check.js +488 -0
  1298. package/dist/scripts/{legacy-upgrade-matrix-check.js → current-upgrade-matrix-check.js} +18 -69
  1299. package/dist/scripts/db-route-materialization-check.js +0 -1
  1300. package/dist/scripts/dfix-fixture-check.js +0 -1
  1301. package/dist/scripts/dfix-patch-handoff-check.js +0 -1
  1302. package/dist/scripts/dfix-verification-check.js +0 -1
  1303. package/dist/scripts/dfix-verification-recommendation-check.js +0 -1
  1304. package/dist/scripts/docs-truthfulness-check.js +52 -2
  1305. package/dist/scripts/doctor-codex-app-harness-check.js +0 -1
  1306. package/dist/scripts/doctor-context7-mcp-repair-blackbox.js +0 -1
  1307. package/dist/scripts/doctor-fastpath-check.js +0 -1
  1308. package/dist/scripts/doctor-fix-production-blackbox.js +0 -1
  1309. package/dist/scripts/doctor-fix-proves-codex-read-check.js +0 -1
  1310. package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +0 -1
  1311. package/dist/scripts/doctor-idempotence-check.js +0 -1
  1312. package/dist/scripts/doctor-ops-semantics-check.js +0 -1
  1313. package/dist/scripts/doctor-startup-config-repair-blackbox.js +0 -1
  1314. package/dist/scripts/doctor-supabase-mcp-repair-blackbox.js +0 -1
  1315. package/dist/scripts/ensure-bin-executable.js +0 -1
  1316. package/dist/scripts/evidence-flagship-coverage-check.js +0 -1
  1317. package/dist/scripts/fast-codex-service-tier-proof-check.js +0 -1
  1318. package/dist/scripts/fixtures/fake-codex-config-loader.js +0 -1
  1319. package/dist/scripts/fsx-hotpath-check.js +0 -1
  1320. package/dist/scripts/gate-policy-audit-check.js +35 -8
  1321. package/dist/scripts/geo-claim-evidence-check.js +0 -1
  1322. package/dist/scripts/geo-cli-blackbox-check.js +17 -0
  1323. package/dist/scripts/geo-crawler-policy-check.js +0 -1
  1324. package/dist/scripts/git-worktree-checkpoint-check.js +0 -1
  1325. package/dist/scripts/git-worktree-cross-rebase-check.js +0 -1
  1326. package/dist/scripts/git-worktree-diff-envelope-check.js +0 -1
  1327. package/dist/scripts/git-worktree-dirty-lock-check.js +0 -1
  1328. package/dist/scripts/git-worktree-dirty-main-detection-check.js +0 -1
  1329. package/dist/scripts/git-worktree-integration-primary-check.js +0 -1
  1330. package/dist/scripts/git-worktree-manifest-append-check.js +0 -1
  1331. package/dist/scripts/git-worktree-untracked-diff-check.js +0 -1
  1332. package/dist/scripts/goal-artifact-compat-check.js +0 -1
  1333. package/dist/scripts/harness-benchmark-check.js +4 -5
  1334. package/dist/scripts/high-risk-contracts-check.js +0 -1
  1335. package/dist/scripts/hook-latency-budget-check.js +0 -1
  1336. package/dist/scripts/hook-latency-quantum-check.js +1 -2
  1337. package/dist/scripts/image-artifact-path-contract-check.js +0 -1
  1338. package/dist/scripts/imagegen-real-smoke-check.js +0 -1
  1339. package/dist/scripts/import-graph-budget-check.js +0 -1
  1340. package/dist/scripts/init-deep-backup-retention-check.js +0 -1
  1341. package/dist/scripts/installed-package-smoke-check.js +14 -3
  1342. package/dist/scripts/legacy-gate-inventory-check.js +0 -1
  1343. package/dist/scripts/legacy-gate-purge-check.js +36 -5
  1344. package/dist/scripts/legacy-strong-inventory-check.js +0 -1
  1345. package/dist/scripts/lib/codex-sdk-gate-lib.js +2 -3
  1346. package/dist/scripts/lib/ensure-dist-fresh.js +0 -1
  1347. package/dist/scripts/lib/git-worktree-fixture.js +0 -1
  1348. package/dist/scripts/lib/valid-png-fixture.js +0 -1
  1349. package/dist/scripts/local-collab-all-pipelines-final-gpt-check.js +1 -2
  1350. package/dist/scripts/loop-directive-check-lib.js +0 -1
  1351. package/dist/scripts/loop-integration-finalizer-check.js +2 -0
  1352. package/dist/scripts/loop-worker-fixture-child.js +0 -1
  1353. package/dist/scripts/mad-preflight-blocks-unreadable-config-check.js +0 -1
  1354. package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +1 -5
  1355. package/dist/scripts/{mad-db-mad-command-check.js → mad-sks-launch-sql-plane-boundary-check.js} +13 -25
  1356. package/dist/scripts/mad-sks-sql-plane-capability-check.js +25 -0
  1357. package/dist/scripts/mad-sks-sql-plane-lifecycle-hook-decision-check.js +17 -0
  1358. package/dist/scripts/{mad-db-mcp-result-lifecycle-check.js → mad-sks-sql-plane-result-lifecycle-check.js} +11 -12
  1359. package/dist/scripts/managed-config-merge-check.js +0 -1
  1360. package/dist/scripts/mcp-plugin-inventory-check.js +0 -1
  1361. package/dist/scripts/mcp-tool-naming-parity-check.js +0 -1
  1362. package/dist/scripts/model-call-concurrency-check.js +0 -1
  1363. package/dist/scripts/mutation-callsite-coverage-check.js +0 -1
  1364. package/dist/scripts/naruto-codex-e2e-check.js +0 -1
  1365. package/dist/scripts/naruto-worktree-coding-blackbox.js +28 -0
  1366. package/dist/scripts/naruto-write-e2e-check.js +0 -1
  1367. package/dist/scripts/native-capability-postcheck-check.js +0 -1
  1368. package/dist/scripts/native-capability-repair-matrix-check.js +0 -1
  1369. package/dist/scripts/native-image-generation-repair-check.js +0 -1
  1370. package/dist/scripts/official-subagent-workflow-check.js +3 -3
  1371. package/dist/scripts/ops-diagnostics-bundle-check.js +0 -1
  1372. package/dist/scripts/package-published-contract-check.js +0 -1
  1373. package/dist/scripts/packlist-performance-check.js +33 -11
  1374. package/dist/scripts/parallel-production-smoke-check.js +0 -1
  1375. package/dist/scripts/perf-budget-check.js +0 -1
  1376. package/dist/scripts/pipeline-codex-native-doctor-mad-routing-check.js +0 -1
  1377. package/dist/scripts/pipeline-codex-native-doctor-mad-routing-real-blackbox.js +76 -0
  1378. package/dist/scripts/pipeline-codex-native-image-routing-check.js +0 -1
  1379. package/dist/scripts/pipeline-codex-native-image-routing-real-blackbox.js +49 -0
  1380. package/dist/scripts/pipeline-codex-native-loop-routing-check.js +0 -1
  1381. package/dist/scripts/pipeline-codex-native-loop-routing-real-blackbox.js +73 -0
  1382. package/dist/scripts/pipeline-codex-native-qa-routing-check.js +0 -1
  1383. package/dist/scripts/pipeline-codex-native-qa-routing-real-blackbox.js +50 -0
  1384. package/dist/scripts/pipeline-codex-native-research-routing-check.js +0 -1
  1385. package/dist/scripts/pipeline-codex-native-research-routing-real-blackbox.js +44 -0
  1386. package/dist/scripts/ppt-full-e2e-blackbox-check.js +147 -0
  1387. package/dist/scripts/ppt-real-export-adapter-check.js +0 -1
  1388. package/dist/scripts/ppt-real-imagegen-smoke-check.js +0 -1
  1389. package/dist/scripts/ppt-real-imagegen-wiring-check.js +0 -1
  1390. package/dist/scripts/ppt-reexport-rereview-check.js +0 -1
  1391. package/dist/scripts/prepublish-fast-check.js +0 -1
  1392. package/dist/scripts/prepublish-release-check-or-fast.js +25 -16
  1393. package/dist/scripts/probe-memoization-check.js +0 -1
  1394. package/dist/scripts/product-design-plugin-routing-check.js +0 -1
  1395. package/dist/scripts/project-skill-dedupe-blackbox.js +0 -1
  1396. package/dist/scripts/prompt-placeholder-guard-check.js +0 -1
  1397. package/dist/scripts/proof-root-cause-policy-check.js +0 -1
  1398. package/dist/scripts/provider-badge-context-check.js +2 -3
  1399. package/dist/scripts/python-codex-sdk-all-pipelines-check.js +1 -2
  1400. package/dist/scripts/qa-loop-app-handoff-capability-check.js +0 -1
  1401. package/dist/scripts/qa-loop-app-handoff-check.js +0 -1
  1402. package/dist/scripts/qa-loop-app-handoff-cli-check.js +0 -1
  1403. package/dist/scripts/qa-loop-app-handoff-confirmation-check.js +0 -1
  1404. package/dist/scripts/qa-loop-app-handoff-gate-lifecycle-check.js +0 -1
  1405. package/dist/scripts/qa-loop-app-handoff-launch-check.js +0 -1
  1406. package/dist/scripts/qa-loop-app-handoff-status-lifecycle-check.js +0 -1
  1407. package/dist/scripts/qa-loop-budget-policy-check.js +0 -1
  1408. package/dist/scripts/qa-loop-effort-escalation-check.js +0 -1
  1409. package/dist/scripts/qa-loop-execution-profile-routing-check.js +0 -1
  1410. package/dist/scripts/qa-loop-image-path-exposure-check.js +0 -1
  1411. package/dist/scripts/qa-loop-image-path-prompt-injection-check.js +0 -1
  1412. package/dist/scripts/release-affected-selector-check.js +1 -2
  1413. package/dist/scripts/release-aggressive-resource-governor-check.js +0 -1
  1414. package/dist/scripts/release-cache-glob-hashing-check.js +0 -1
  1415. package/dist/scripts/release-cache-input-classifier-check.js +0 -1
  1416. package/dist/scripts/release-cache-neutralization-report-check.js +0 -1
  1417. package/dist/scripts/release-cache-version-neutral-fixture-check.js +0 -1
  1418. package/dist/scripts/release-check-stamp.js +1 -2
  1419. package/dist/scripts/release-dag-full-coverage-check.js +0 -1
  1420. package/dist/scripts/release-dist-freshness-check.js +0 -1
  1421. package/dist/scripts/release-dynamic-presets-check.js +0 -1
  1422. package/dist/scripts/release-file-ownership-check.js +35 -0
  1423. package/dist/scripts/release-full-parallelism-blackbox.js +41 -0
  1424. package/dist/scripts/release-gate-batch-runner-check.js +0 -1
  1425. package/dist/scripts/release-gate-budget-check.js +0 -1
  1426. package/dist/scripts/release-gate-dag-runner-check.js +3 -2
  1427. package/dist/scripts/release-gate-dag-runner.js +0 -1
  1428. package/dist/scripts/release-gate-script-parity-check.js +8 -5
  1429. package/dist/scripts/release-latency-slo-check.js +23 -0
  1430. package/dist/scripts/release-macos-menubar-proof.js +167 -0
  1431. package/dist/scripts/release-main-push-guard.js +37 -0
  1432. package/dist/scripts/release-main-push-receipt.js +43 -0
  1433. package/dist/scripts/release-metadata-1-19-check.js +255 -0
  1434. package/dist/scripts/release-metadata-check.js +0 -1
  1435. package/dist/scripts/release-pack-receipt.js +144 -0
  1436. package/dist/scripts/release-parallel-speed-budget-check.js +0 -1
  1437. package/dist/scripts/release-proof-truth-check.js +0 -1
  1438. package/dist/scripts/release-provenance-check.js +0 -1
  1439. package/dist/scripts/release-real-check.js +1 -3
  1440. package/dist/scripts/release-runtime-truth-matrix-check.js +0 -1
  1441. package/dist/scripts/release-speed-summary.js +0 -1
  1442. package/dist/scripts/release-version-truth-check.js +0 -1
  1443. package/dist/scripts/research-blueprint-densifier-check.js +1 -2
  1444. package/dist/scripts/research-claim-builder-check.js +0 -1
  1445. package/dist/scripts/research-complete-package-fixture-check.js +0 -1
  1446. package/dist/scripts/research-execution-profile-routing-check.js +0 -1
  1447. package/dist/scripts/research-final-reviewer-blackbox.js +69 -0
  1448. package/dist/scripts/responses-retry-policy-centralized-check.js +0 -1
  1449. package/dist/scripts/retention-apply-smoke-check.js +0 -1
  1450. package/dist/scripts/retention-budget-check.js +0 -1
  1451. package/dist/scripts/retention-dry-run-check.js +0 -1
  1452. package/dist/scripts/rollback-recovery-smoke-check.js +0 -1
  1453. package/dist/scripts/route-intent-regression-check.js +0 -1
  1454. package/dist/scripts/{runtime-no-tmux-check.js → runtime-current-terminal-check.js} +6 -11
  1455. package/dist/scripts/runtime-dist-parity-check.js +0 -1
  1456. package/dist/scripts/runtime-no-src-mjs-check.js +0 -1
  1457. package/dist/scripts/runtime-proof-summary-check.js +1 -2
  1458. package/dist/scripts/runtime-script-pack-closure-check.js +89 -0
  1459. package/dist/scripts/runtime-ts-rust-boundary-check.js +1 -2
  1460. package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -1
  1461. package/dist/scripts/scheduler-batch-dispatch-check.js +0 -1
  1462. package/dist/scripts/scheduler-parallel-proof-consistency-check.js +0 -1
  1463. package/dist/scripts/scheduler-utilization-integral-check.js +0 -1
  1464. package/dist/scripts/search-visibility-gate-lib.js +0 -1
  1465. package/dist/scripts/secret-preservation-check.js +0 -1
  1466. package/dist/scripts/secret-preservation-guard-check.js +0 -1
  1467. package/dist/scripts/seo-audit-fixture-check.js +1 -2
  1468. package/dist/scripts/seo-cli-blackbox-check.js +17 -0
  1469. package/dist/scripts/seo-geo-geo-disambiguation-check.js +0 -1
  1470. package/dist/scripts/seo-geo-route-identity-check.js +0 -1
  1471. package/dist/scripts/seo-geo-skill-rich-content-check.js +2 -3
  1472. package/dist/scripts/seo-marketing-truthfulness-check.js +0 -1
  1473. package/dist/scripts/seo-metadata-sync-check.js +1 -2
  1474. package/dist/scripts/seo-no-mutation-by-default-check.js +0 -1
  1475. package/dist/scripts/shared-memory-fixture-check.js +0 -1
  1476. package/dist/scripts/side-effect-runtime-report-check.js +0 -1
  1477. package/dist/scripts/sizecheck.js +0 -5
  1478. package/dist/scripts/skill-name-canonicalizer-check.js +0 -1
  1479. package/dist/scripts/skills-manifest-continuity-check.js +5 -5
  1480. package/dist/scripts/sks-1-11-gate-lib.js +0 -1
  1481. package/dist/scripts/sks-1-12-real-execution-check-lib.js +0 -1
  1482. package/dist/scripts/sks-1-18-gate-lib.js +0 -1
  1483. package/dist/scripts/sks-3-1-4-directive-check-lib.js +0 -1
  1484. package/dist/scripts/sks-3-1-5-directive-check-lib.js +1 -2
  1485. package/dist/scripts/sks-3-1-6-directive-check-lib.js +1 -2
  1486. package/dist/scripts/sks-3-1-8-check-lib.js +0 -1
  1487. package/dist/scripts/sks-menubar-install-check.js +306 -306
  1488. package/dist/scripts/sks-uninstall-regression-check.js +0 -1
  1489. package/dist/scripts/sksd-daemon-check.js +0 -1
  1490. package/dist/scripts/supabase-secret-preservation-blackbox.js +0 -1
  1491. package/dist/scripts/super-search-live-smoke-check.js +0 -1
  1492. package/dist/scripts/super-search-local-http-smoke-check.js +0 -1
  1493. package/dist/scripts/super-search-offline-contract-check.js +0 -1
  1494. package/dist/scripts/super-search-provider-interface-check.js +0 -1
  1495. package/dist/scripts/triwiki-cache-key-check.js +0 -1
  1496. package/dist/scripts/triwiki-proof-bank-blackbox.js +29 -0
  1497. package/dist/scripts/triwiki-proof-bank-check.js +0 -1
  1498. package/dist/scripts/triwiki-proof-card-check.js +0 -1
  1499. package/dist/scripts/trust-fixture-check.js +0 -1
  1500. package/dist/scripts/type-surface-codex-app-check.js +0 -1
  1501. package/dist/scripts/ultra-router-auto-router-check.js +1 -2
  1502. package/dist/scripts/uninstall-inventory-check.js +2 -0
  1503. package/dist/scripts/update-fastpath-check.js +0 -1
  1504. package/dist/scripts/update-preserves-supabase-keys-blackbox.js +0 -1
  1505. package/dist/scripts/upgrade-migration-matrix-check.js +0 -1
  1506. package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +0 -1
  1507. package/dist/scripts/ux-review-imagegen-blackbox-check.js +71 -0
  1508. package/dist/scripts/ux-review-patch-diff-recheck-check.js +0 -1
  1509. package/dist/scripts/ux-review-real-imagegen-smoke-check.js +0 -1
  1510. package/dist/scripts/ux-review-run-wires-imagegen-check.js +0 -1
  1511. package/dist/scripts/write-build-manifest.js +0 -1
  1512. package/dist/scripts/wrongness-fixture-check.js +1 -2
  1513. package/dist/scripts/zellij-capability-check.js +0 -1
  1514. package/dist/scripts/zellij-dashboard-pane-check.js +0 -1
  1515. package/dist/scripts/zellij-dashboard-watch.js +0 -1
  1516. package/dist/scripts/zellij-developer-controls-check.js +2 -3
  1517. package/dist/scripts/zellij-doctor-readiness-check.js +3 -4
  1518. package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +2 -3
  1519. package/dist/scripts/zellij-fake-adapter-check.js +0 -1
  1520. package/dist/scripts/zellij-first-slot-down-stack-check.js +0 -1
  1521. package/dist/scripts/zellij-first-slot-down-stack-real-check.js +0 -1
  1522. package/dist/scripts/zellij-homebrew-policy-check.js +0 -1
  1523. package/dist/scripts/zellij-initial-main-only-blackbox.js +27 -0
  1524. package/dist/scripts/zellij-lane-renderer-check.js +2 -3
  1525. package/dist/scripts/zellij-launch-command-truth-check.js +0 -1
  1526. package/dist/scripts/zellij-layout-valid-check.js +1 -2
  1527. package/dist/scripts/zellij-pane-creation-lock-metrics-check.js +0 -1
  1528. package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +79 -0
  1529. package/dist/scripts/zellij-pane-lock-does-not-block-worker-check.js +4 -5
  1530. package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +136 -0
  1531. package/dist/scripts/zellij-pane-proof-check.js +0 -1
  1532. package/dist/scripts/zellij-qa-app-handoff-status-check.js +0 -1
  1533. package/dist/scripts/zellij-real-session-cleanup-check.js +0 -1
  1534. package/dist/scripts/zellij-real-session-launch-check.js +0 -1
  1535. package/dist/scripts/zellij-right-column-geometry-proof.js +0 -1
  1536. package/dist/scripts/zellij-right-column-headless-overflow-check.js +3 -4
  1537. package/dist/scripts/zellij-right-column-manager-check.js +0 -1
  1538. package/dist/scripts/zellij-screen-proof-check.js +0 -1
  1539. package/dist/scripts/zellij-self-heal-check.js +0 -1
  1540. package/dist/scripts/zellij-self-heal-dry-run-check.js +0 -1
  1541. package/dist/scripts/zellij-self-heal-status-contract-check.js +0 -1
  1542. package/dist/scripts/zellij-self-heal-typed-blackbox.js +3 -0
  1543. package/dist/scripts/zellij-slot-column-anchor-check.js +0 -1
  1544. package/dist/scripts/zellij-slot-column-anchor-telemetry-check.js +1 -2
  1545. package/dist/scripts/zellij-slot-only-ui-check.js +4 -5
  1546. package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -1
  1547. package/dist/scripts/zellij-slot-pane-stale-detection-check.js +0 -1
  1548. package/dist/scripts/zellij-slot-pane-telemetry-renderer-check.js +0 -1
  1549. package/dist/scripts/zellij-slot-renderer-proof-semantics-check.js +5 -6
  1550. package/dist/scripts/zellij-slot-telemetry-check.js +0 -1
  1551. package/dist/scripts/zellij-slot-telemetry-incremental-check.js +0 -1
  1552. package/dist/scripts/zellij-slot-telemetry-live-flush-check.js +0 -1
  1553. package/dist/scripts/zellij-slot-telemetry-performance-check.js +0 -1
  1554. package/dist/scripts/zellij-slot-telemetry-real-blackbox.js +19 -0
  1555. package/dist/scripts/zellij-slot-telemetry-renderer-check.js +1 -2
  1556. package/dist/scripts/zellij-slot-telemetry-runtime-check.js +3 -4
  1557. package/dist/scripts/zellij-spawn-on-demand-layout-check.js +1 -2
  1558. package/dist/scripts/zellij-stacked-capability-routing-check.js +0 -1
  1559. package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +80 -0
  1560. package/dist/scripts/zellij-stacked-version-matrix-check.js +0 -1
  1561. package/dist/scripts/zellij-stacked-version-parser-check.js +0 -1
  1562. package/dist/scripts/zellij-ui-design-check.js +2 -3
  1563. package/dist/scripts/zellij-update-missing-self-heal-check.js +0 -1
  1564. package/dist/scripts/zellij-update-prompt-matrix-check.js +0 -1
  1565. package/dist/scripts/zellij-update-prompt-mode-check.js +0 -1
  1566. package/dist/scripts/zellij-update-prompt-safety-check.js +0 -1
  1567. package/dist/scripts/zellij-worker-pane-manager-check.js +1 -2
  1568. package/dist/scripts/zellij-worker-pane-manager-single-owner-check.js +5 -5
  1569. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +201 -0
  1570. package/infra-harness-gates.json +6 -6
  1571. package/package.json +25 -45
  1572. package/release-gates.v2.json +146 -60
  1573. package/runtime-required-scripts.json +38 -0
  1574. package/schemas/codex/agent-result.schema.json +473 -191
  1575. package/schemas/{mad-db/mad-db-capability.schema.json → mad-sks/sql-plane/capability.schema.json} +3 -3
  1576. package/schemas/{mad-db/mad-db-ledger.schema.json → mad-sks/sql-plane/ledger.schema.json} +2 -2
  1577. package/schemas/naruto/naruto-concurrency-governor.schema.json +2 -2
  1578. package/schemas/naruto/naruto-work-graph.schema.json +2 -2
  1579. package/dist/cli/xai-command.js +0 -35
  1580. package/dist/commands/mad-db.js +0 -5
  1581. package/dist/commands/team.js +0 -3
  1582. package/dist/commands/tmux.js +0 -25
  1583. package/dist/core/agents/agent-cleanup-executor.js +0 -733
  1584. package/dist/core/agents/agent-command-surface.js +0 -108
  1585. package/dist/core/agents/agent-gate.js +0 -70
  1586. package/dist/core/agents/agent-ledger-schemas.js +0 -194
  1587. package/dist/core/agents/codex-exec-worker-adapter.js +0 -147
  1588. package/dist/core/commands/agent-command.js +0 -250
  1589. package/dist/core/commands/mad-db-command.js +0 -110
  1590. package/dist/core/commands/team-command.js +0 -94
  1591. package/dist/core/commands/team-legacy-observe-command.js +0 -135
  1592. package/dist/core/evidence/flagship-proof-graph-validator.js +0 -320
  1593. package/dist/core/hooks-runtime/team-digest.js +0 -85
  1594. package/dist/core/mad-db/mad-db-capability.js +0 -253
  1595. package/dist/core/mad-db/mad-db-ledger.js +0 -37
  1596. package/dist/core/mad-db/mad-db-policy-resolver.js +0 -128
  1597. package/dist/core/pipeline/route-prep-team.js +0 -2
  1598. package/dist/core/team-dag.js +0 -58
  1599. package/dist/core/team-dashboard-renderer.js +0 -23
  1600. package/dist/core/team-live.js +0 -167
  1601. package/dist/core/team-review-policy.js +0 -62
  1602. package/dist/scripts/agent-ast-aware-work-graph-check.js +0 -25
  1603. package/dist/scripts/agent-backfill-replenishment-check.js +0 -13
  1604. package/dist/scripts/agent-background-terminals-check.js +0 -16
  1605. package/dist/scripts/agent-cleanup-command-ux-check.js +0 -12
  1606. package/dist/scripts/agent-cleanup-executor-check.js +0 -53
  1607. package/dist/scripts/agent-cleanup-executor-v2-check.js +0 -39
  1608. package/dist/scripts/agent-cli-options-to-task-graph-check.js +0 -5
  1609. package/dist/scripts/agent-codex-app-cockpit-check.js +0 -91
  1610. package/dist/scripts/agent-dynamic-cockpit-check.js +0 -10
  1611. package/dist/scripts/agent-dynamic-pool-check.js +0 -13
  1612. package/dist/scripts/agent-dynamic-pool-fixture.js +0 -80
  1613. package/dist/scripts/agent-fast-mode-default-check.js +0 -107
  1614. package/dist/scripts/agent-fast-mode-worker-propagation-check.js +0 -7
  1615. package/dist/scripts/agent-follow-up-work-schema-check.js +0 -80
  1616. package/dist/scripts/agent-goal-mode-propagation-check.js +0 -9
  1617. package/dist/scripts/agent-intelligent-work-graph-check.js +0 -29
  1618. package/dist/scripts/agent-janitor-check.js +0 -79
  1619. package/dist/scripts/agent-main-no-scout-check.js +0 -11
  1620. package/dist/scripts/agent-multi-project-isolation-check.js +0 -86
  1621. package/dist/scripts/agent-native-cli-session-swarm-10-check.js +0 -7
  1622. package/dist/scripts/agent-native-cli-session-swarm-20-check.js +0 -7
  1623. package/dist/scripts/agent-native-cli-session-swarm-check.js +0 -7
  1624. package/dist/scripts/agent-official-subagent-helper-policy-check.js +0 -71
  1625. package/dist/scripts/agent-parallel-write-kernel-check.js +0 -103
  1626. package/dist/scripts/agent-patch-conflict-rebase-check.js +0 -198
  1627. package/dist/scripts/agent-patch-envelope-extraction-check.js +0 -17
  1628. package/dist/scripts/agent-patch-proof-check.js +0 -41
  1629. package/dist/scripts/agent-patch-proof-runtime-check.js +0 -63
  1630. package/dist/scripts/agent-patch-queue-runtime-check.js +0 -36
  1631. package/dist/scripts/agent-patch-rollback-check.js +0 -38
  1632. package/dist/scripts/agent-patch-rollback-dag-check.js +0 -14
  1633. package/dist/scripts/agent-patch-swarm-gate-lib.js +0 -113
  1634. package/dist/scripts/agent-patch-swarm-runtime-check.js +0 -10
  1635. package/dist/scripts/agent-patch-swarm-runtime-truth-check.js +0 -76
  1636. package/dist/scripts/agent-patch-transaction-journal-check.js +0 -57
  1637. package/dist/scripts/agent-patch-verification-dag-check.js +0 -14
  1638. package/dist/scripts/agent-proof-contract-reconciled-check.js +0 -5
  1639. package/dist/scripts/agent-real-codex-dynamic-smoke-check.js +0 -166
  1640. package/dist/scripts/agent-real-codex-dynamic-smoke-v2-check.js +0 -14
  1641. package/dist/scripts/agent-real-codex-in-zellij-worker-pane-check.js +0 -227
  1642. package/dist/scripts/agent-real-codex-parallel-workers-10-check.js +0 -5
  1643. package/dist/scripts/agent-real-codex-parallel-workers-20-check.js +0 -5
  1644. package/dist/scripts/agent-real-codex-parallel-workers-5-check.js +0 -5
  1645. package/dist/scripts/agent-real-codex-parallel-workers-check.js +0 -5
  1646. package/dist/scripts/agent-real-codex-patch-envelope-smoke.js +0 -126
  1647. package/dist/scripts/agent-role-config-repair-check.js +0 -60
  1648. package/dist/scripts/agent-rollback-command-check.js +0 -86
  1649. package/dist/scripts/agent-route-truth-backfill-check.js +0 -5
  1650. package/dist/scripts/agent-scheduler-proof-check.js +0 -13
  1651. package/dist/scripts/agent-scheduler-proof-hardening-check.js +0 -22
  1652. package/dist/scripts/agent-session-generation-check.js +0 -21
  1653. package/dist/scripts/agent-slot-pane-binding-proof-check.js +0 -64
  1654. package/dist/scripts/agent-slot-telemetry-wiring-check.js +0 -11
  1655. package/dist/scripts/agent-source-intelligence-propagation-check.js +0 -9
  1656. package/dist/scripts/agent-strategy-to-lease-wiring-check.js +0 -32
  1657. package/dist/scripts/agent-strategy-to-patch-strict-check.js +0 -54
  1658. package/dist/scripts/agent-task-graph-expansion-check.js +0 -14
  1659. package/dist/scripts/agent-terminal-generations-check.js +0 -23
  1660. package/dist/scripts/agent-visual-consistency-check.js +0 -9
  1661. package/dist/scripts/agent-wiki-context-proof-check.js +0 -76
  1662. package/dist/scripts/agent-worker-backend-router-check.js +0 -63
  1663. package/dist/scripts/agent-worker-scout-limited-check.js +0 -17
  1664. package/dist/scripts/agent-zellij-dynamic-backfill-panes-check.js +0 -34
  1665. package/dist/scripts/agent-zellij-runtime-check.js +0 -85
  1666. package/dist/scripts/appshots-capability-check.js +0 -18
  1667. package/dist/scripts/appshots-evidence-check.js +0 -48
  1668. package/dist/scripts/appshots-operator-policy-check.js +0 -25
  1669. package/dist/scripts/appshots-privacy-safety-check.js +0 -48
  1670. package/dist/scripts/appshots-source-intelligence-check.js +0 -53
  1671. package/dist/scripts/appshots-triwiki-voxel-check.js +0 -46
  1672. package/dist/scripts/brand-neutrality-generated-artifacts-check.js +0 -161
  1673. package/dist/scripts/brand-neutrality-zero-leakage-check.js +0 -4
  1674. package/dist/scripts/check-dist-runtime.js +0 -101
  1675. package/dist/scripts/check-package-boundary.js +0 -108
  1676. package/dist/scripts/check-ts-contracts.js +0 -69
  1677. package/dist/scripts/check-ts-suppressions.js +0 -58
  1678. package/dist/scripts/clean-dist.js +0 -8
  1679. package/dist/scripts/cli-five-minute-task-check.js +0 -6
  1680. package/dist/scripts/codex-0-133-official-compat-report.js +0 -53
  1681. package/dist/scripts/codex-0-135-compat-check.js +0 -57
  1682. package/dist/scripts/codex-0-136-compat-check.js +0 -30
  1683. package/dist/scripts/codex-0139-capability-check.js +0 -26
  1684. package/dist/scripts/codex-0139-code-mode-web-search-real-check.js +0 -10
  1685. package/dist/scripts/codex-0139-doctor-env-real-check.js +0 -10
  1686. package/dist/scripts/codex-0139-doctor-env-redaction-check.js +0 -18
  1687. package/dist/scripts/codex-0139-image-path-real-check.js +0 -10
  1688. package/dist/scripts/codex-0139-interrupt-agent-check.js +0 -18
  1689. package/dist/scripts/codex-0139-interrupt-agent-real-check.js +0 -8
  1690. package/dist/scripts/codex-0139-plugin-cache-real-check.js +0 -10
  1691. package/dist/scripts/codex-0139-plugin-marketplace-real-check.js +0 -10
  1692. package/dist/scripts/codex-0139-real-probe-summary-check.js +0 -14
  1693. package/dist/scripts/codex-0139-rich-tool-schema-check.js +0 -12
  1694. package/dist/scripts/codex-0139-rich-tool-schema-real-check.js +0 -10
  1695. package/dist/scripts/codex-0139-sandbox-profile-alias-check.js +0 -13
  1696. package/dist/scripts/codex-0139-sandbox-profile-alias-real-check.js +0 -10
  1697. package/dist/scripts/codex-0139-sandbox-proxy-real-check.js +0 -10
  1698. package/dist/scripts/codex-0140-bedrock-managed-auth-check.js +0 -4
  1699. package/dist/scripts/codex-0140-deep-probes-check.js +0 -40
  1700. package/dist/scripts/codex-0140-feature-gate-lib.js +0 -14
  1701. package/dist/scripts/codex-0140-goal-attachment-preservation-check.js +0 -8
  1702. package/dist/scripts/codex-0140-goal-attachment-roundtrip-check.js +0 -9
  1703. package/dist/scripts/codex-0140-import-check.js +0 -4
  1704. package/dist/scripts/codex-0140-large-repo-performance-check.js +0 -4
  1705. package/dist/scripts/codex-0140-mcp-reliability-check.js +0 -4
  1706. package/dist/scripts/codex-0140-non-tty-interrupt-check.js +0 -4
  1707. package/dist/scripts/codex-0140-real-probes-check.js +0 -9
  1708. package/dist/scripts/codex-0140-session-delete-check.js +0 -4
  1709. package/dist/scripts/codex-0140-sqlite-recovery-check.js +0 -4
  1710. package/dist/scripts/codex-0140-unified-mentions-check.js +0 -4
  1711. package/dist/scripts/codex-0140-usage-check.js +0 -4
  1712. package/dist/scripts/codex-0140-usage-real-parser-check.js +0 -17
  1713. package/dist/scripts/codex-0141-capability-check.js +0 -17
  1714. package/dist/scripts/codex-0144-doctor-wiring-check.js +0 -21
  1715. package/dist/scripts/codex-account-usage-autodiscovery-check.js +0 -22
  1716. package/dist/scripts/codex-account-usage-check.js +0 -9
  1717. package/dist/scripts/codex-app-harness-matrix-check.js +0 -4
  1718. package/dist/scripts/codex-app-launcher-check.js +0 -17
  1719. package/dist/scripts/codex-app-provider-badge-check.js +0 -37
  1720. package/dist/scripts/codex-app-provider-model-ui-check.js +0 -163
  1721. package/dist/scripts/codex-app-type-safety-check.js +0 -4
  1722. package/dist/scripts/codex-app-ui-clobber-guard-check.js +0 -22
  1723. package/dist/scripts/codex-app-ui-preservation-check.js +0 -137
  1724. package/dist/scripts/codex-config-eperm-fixture.js +0 -32
  1725. package/dist/scripts/codex-control-capability-check.js +0 -10
  1726. package/dist/scripts/codex-control-empty-result-retry-check.js +0 -43
  1727. package/dist/scripts/codex-control-keepalive-no-cot-leak-check.js +0 -14
  1728. package/dist/scripts/codex-control-model-capacity-fallback-check.js +0 -53
  1729. package/dist/scripts/codex-control-no-legacy-fallback-check.js +0 -31
  1730. package/dist/scripts/codex-control-side-effect-scope-check.js +0 -26
  1731. package/dist/scripts/codex-control-stream-idle-watchdog-check.js +0 -34
  1732. package/dist/scripts/codex-control-structured-output-check.js +0 -11
  1733. package/dist/scripts/codex-control-thread-registry-check.js +0 -11
  1734. package/dist/scripts/codex-effort-auto-discovery-check.js +0 -17
  1735. package/dist/scripts/codex-effort-order-check.js +0 -9
  1736. package/dist/scripts/codex-environment-scoped-approvals-check.js +0 -10
  1737. package/dist/scripts/codex-exec-output-schema-actual-syntax-check.js +0 -33
  1738. package/dist/scripts/codex-fast-mode-profile-propagation-check.js +0 -14
  1739. package/dist/scripts/codex-history-search-check.js +0 -19
  1740. package/dist/scripts/codex-hook-approval-matrix-check.js +0 -4
  1741. package/dist/scripts/codex-hook-approval-probe-check.js +0 -4
  1742. package/dist/scripts/codex-hook-lifecycle-check.js +0 -4
  1743. package/dist/scripts/codex-hook-semantic-check.js +0 -15
  1744. package/dist/scripts/codex-hook-strict-subset-check.js +0 -61
  1745. package/dist/scripts/codex-init-deep-check.js +0 -4
  1746. package/dist/scripts/codex-init-deep-managed-agents-check.js +0 -4
  1747. package/dist/scripts/codex-lb-config-toml-safety-check.js +0 -85
  1748. package/dist/scripts/codex-lb-missing-env-regression.js +0 -39
  1749. package/dist/scripts/codex-lb-persistence-truth-check.js +0 -96
  1750. package/dist/scripts/codex-lb-setup-fixture-check.js +0 -91
  1751. package/dist/scripts/codex-lb-setup-truthfulness-check.js +0 -89
  1752. package/dist/scripts/codex-legacy-profile-consumers-removed-check.js +0 -24
  1753. package/dist/scripts/codex-managed-proxy-env-check.js +0 -17
  1754. package/dist/scripts/codex-model-metadata-check.js +0 -10
  1755. package/dist/scripts/codex-native-broker-read-only-check.js +0 -44
  1756. package/dist/scripts/codex-native-invocation-defaults-check.js +0 -4
  1757. package/dist/scripts/codex-native-invocation-router-check.js +0 -4
  1758. package/dist/scripts/codex-native-pattern-analysis-check.js +0 -4
  1759. package/dist/scripts/codex-native-reference-cache-check.js +0 -30
  1760. package/dist/scripts/codex-native-reference-evidence-check.js +0 -4
  1761. package/dist/scripts/codex-native-repair-transaction-check.js +0 -47
  1762. package/dist/scripts/codex-native-route-map-check.js +0 -4
  1763. package/dist/scripts/codex-native-skill-content-check.js +0 -24
  1764. package/dist/scripts/codex-output-schema-fixture-check.js +0 -25
  1765. package/dist/scripts/codex-plugin-cache-check.js +0 -15
  1766. package/dist/scripts/codex-plugin-diff-check.js +0 -16
  1767. package/dist/scripts/codex-plugin-inventory-check.js +0 -15
  1768. package/dist/scripts/codex-plugin-json-check.js +0 -10
  1769. package/dist/scripts/codex-plugin-list-json-check.js +0 -8
  1770. package/dist/scripts/codex-plugin-parallel-detail-fetch-check.js +0 -12
  1771. package/dist/scripts/codex-profile-primary-check.js +0 -13
  1772. package/dist/scripts/codex-project-config-policy-merge-regression.js +0 -92
  1773. package/dist/scripts/codex-resume-cwd-truth-check.js +0 -17
  1774. package/dist/scripts/codex-sdk-no-legacy-fallback-check.js +0 -33
  1775. package/dist/scripts/codex-sdk-qa-pipeline-check.js +0 -8
  1776. package/dist/scripts/codex-sdk-release-review-pipeline-check.js +0 -13
  1777. package/dist/scripts/codex-sdk-research-pipeline-check.js +0 -69
  1778. package/dist/scripts/codex-sdk-sandbox-policy-check.js +0 -25
  1779. package/dist/scripts/codex-sdk-structured-output-check.js +0 -10
  1780. package/dist/scripts/codex-sdk-team-naruto-agent-pipeline-check.js +0 -12
  1781. package/dist/scripts/codex-sdk-thread-registry-check.js +0 -11
  1782. package/dist/scripts/codex-sdk-ux-ppt-review-pipeline-check.js +0 -9
  1783. package/dist/scripts/codex-sdk-version-compat-check.js +0 -11
  1784. package/dist/scripts/codex-sdk-zellij-pane-binding-check.js +0 -13
  1785. package/dist/scripts/codex-skill-rich-content-check.js +0 -4
  1786. package/dist/scripts/codex-skill-sync-check.js +0 -4
  1787. package/dist/scripts/codex-thread-runtime-choice-check.js +0 -10
  1788. package/dist/scripts/codex-web-adapter-check.js +0 -12
  1789. package/dist/scripts/coding-bench-check.js +0 -142
  1790. package/dist/scripts/computer-use-live-evidence-check.js +0 -55
  1791. package/dist/scripts/computer-use-live-optional-check.js +0 -32
  1792. package/dist/scripts/computer-use-policy-check.js +0 -69
  1793. package/dist/scripts/computer-use-visual-route-fixture-check.js +0 -37
  1794. package/dist/scripts/core-skill-immutable-sync-check.js +0 -19
  1795. package/dist/scripts/core-skill-manifest-check.js +0 -20
  1796. package/dist/scripts/core-skill-promotion-side-effect-ledger-check.js +0 -64
  1797. package/dist/scripts/core-skill-rollout-scoring-check.js +0 -72
  1798. package/dist/scripts/core-skill-trainer-check.js +0 -116
  1799. package/dist/scripts/dfix-fast-kernel-check.js +0 -26
  1800. package/dist/scripts/dfix-performance-check.js +0 -15
  1801. package/dist/scripts/docs-codex-0139-wording-check.js +0 -21
  1802. package/dist/scripts/docs-loop-productionization-check.js +0 -3
  1803. package/dist/scripts/docs-loop-runtime-check.js +0 -3
  1804. package/dist/scripts/doctor-codex-startup-repair-check.js +0 -146
  1805. package/dist/scripts/doctor-context7-mcp-repair-check.js +0 -11
  1806. package/dist/scripts/doctor-context7-repair-check.js +0 -48
  1807. package/dist/scripts/doctor-dirty-plan-check.js +0 -9
  1808. package/dist/scripts/doctor-dirty-repair-check.js +0 -8
  1809. package/dist/scripts/doctor-dirty-semantic-check.js +0 -7
  1810. package/dist/scripts/doctor-fix-recovers-corrupted-config-check.js +0 -122
  1811. package/dist/scripts/doctor-imagegen-repair-check.js +0 -77
  1812. package/dist/scripts/doctor-native-capability-repair-check.js +0 -10
  1813. package/dist/scripts/doctor-native-repair-output-check.js +0 -18
  1814. package/dist/scripts/doctor-plain-fix-native-assets-check.js +0 -12
  1815. package/dist/scripts/doctor-post-repair-authoritative-check.js +0 -39
  1816. package/dist/scripts/doctor-startup-config-repair-check.js +0 -20
  1817. package/dist/scripts/doctor-supabase-mcp-repair-check.js +0 -12
  1818. package/dist/scripts/doctor-transaction-engine-check.js +0 -32
  1819. package/dist/scripts/doctor-transaction-owns-mutations-check.js +0 -14
  1820. package/dist/scripts/doctor-warning-only-not-blocker-check.js +0 -56
  1821. package/dist/scripts/doctor-zellij-fix-output-check.js +0 -4
  1822. package/dist/scripts/doctor-zellij-repair-check.js +0 -4
  1823. package/dist/scripts/evidence-fixture-check.js +0 -26
  1824. package/dist/scripts/fake-real-proof-policy-v2-check.js +0 -27
  1825. package/dist/scripts/fake-vs-real-proof-policy-check.js +0 -14
  1826. package/dist/scripts/flagship-proof-graph-v2-check.js +0 -48
  1827. package/dist/scripts/flagship-proof-graph-v3-check.js +0 -67
  1828. package/dist/scripts/flagship-proof-graph-v4-check.js +0 -61
  1829. package/dist/scripts/gate-pack-fixture-cache-check.js +0 -9
  1830. package/dist/scripts/gate-pack-runner-check.js +0 -6
  1831. package/dist/scripts/geo-llms-txt-optional-check.js +0 -19
  1832. package/dist/scripts/git-precommit-fixture-check.js +0 -41
  1833. package/dist/scripts/git-worktree-cache-performance-check.js +0 -25
  1834. package/dist/scripts/git-worktree-capability-check.js +0 -27
  1835. package/dist/scripts/git-worktree-cleanup-check.js +0 -27
  1836. package/dist/scripts/git-worktree-diff-export-check.js +0 -43
  1837. package/dist/scripts/git-worktree-integration-primary-runtime-check.js +0 -20
  1838. package/dist/scripts/git-worktree-manager-check.js +0 -37
  1839. package/dist/scripts/git-worktree-merge-queue-check.js +0 -31
  1840. package/dist/scripts/git-worktree-pool-performance-check.js +0 -20
  1841. package/dist/scripts/git-worktree-prewarm-runtime-check.js +0 -7
  1842. package/dist/scripts/goal-legacy-runtime-escape-check.js +0 -3
  1843. package/dist/scripts/goal-loop-compat-check.js +0 -3
  1844. package/dist/scripts/goal-loop-runtime-default-check.js +0 -3
  1845. package/dist/scripts/goal-mode-official-default-check.js +0 -12
  1846. package/dist/scripts/gpt-final-arbiter-check.js +0 -66
  1847. package/dist/scripts/gpt-final-arbiter-performance-check.js +0 -36
  1848. package/dist/scripts/gpt-image-2-request-validator-check.js +0 -35
  1849. package/dist/scripts/hooks-0.134-context-parity-check.js +0 -20
  1850. package/dist/scripts/hooks-actual-parity-check.js +0 -17
  1851. package/dist/scripts/hooks-actual-parity-v2-check.js +0 -21
  1852. package/dist/scripts/hooks-latest-schema-check.js +0 -20
  1853. package/dist/scripts/hooks-managed-install-fixture-check.js +0 -21
  1854. package/dist/scripts/hooks-no-unsupported-handlers.js +0 -15
  1855. package/dist/scripts/hooks-official-hash-oracle-check.js +0 -35
  1856. package/dist/scripts/hooks-official-hash-parity-check.js +0 -17
  1857. package/dist/scripts/hooks-runtime-replay-warning-zero-v2.js +0 -26
  1858. package/dist/scripts/hooks-runtime-replay-warning-zero.js +0 -10
  1859. package/dist/scripts/hooks-subagent-events-check.js +0 -17
  1860. package/dist/scripts/hooks-trust-state-check.js +0 -14
  1861. package/dist/scripts/hooks-trust-warning-zero.js +0 -14
  1862. package/dist/scripts/image-artifact-registry-check.js +0 -14
  1863. package/dist/scripts/image-fidelity-fixture-check.js +0 -24
  1864. package/dist/scripts/image-followup-edit-path-check.js +0 -14
  1865. package/dist/scripts/image-generation-path-handoff-check.js +0 -8
  1866. package/dist/scripts/image-global-path-contract-check.js +0 -38
  1867. package/dist/scripts/imagegen-capability-check.js +0 -30
  1868. package/dist/scripts/init-deep-memory-scope-safety-check.js +0 -23
  1869. package/dist/scripts/install-update-preserves-config-check.js +0 -182
  1870. package/dist/scripts/json-schema-recursive-check.js +0 -78
  1871. package/dist/scripts/legacy-multiagent-removal-check.js +0 -85
  1872. package/dist/scripts/legacy-purge-final-check.js +0 -5
  1873. package/dist/scripts/legacy-update-e2e-check.js +0 -228
  1874. package/dist/scripts/lib/mad-sks-actual-executor-check-lib.js +0 -255
  1875. package/dist/scripts/lib/native-cli-session-swarm-check-lib.js +0 -242
  1876. package/dist/scripts/lib/real-codex-parallel-gate.js +0 -94
  1877. package/dist/scripts/lib/real-codex-parallel-proof-fixture.js +0 -55
  1878. package/dist/scripts/local-collab-gpt-final-availability-check.js +0 -58
  1879. package/dist/scripts/local-collab-no-local-only-final-check.js +0 -27
  1880. package/dist/scripts/local-collab-policy-check.js +0 -17
  1881. package/dist/scripts/local-collab-worktree-gpt-final-apply-policy-check.js +0 -63
  1882. package/dist/scripts/local-llm-cache-performance-check.js +0 -10
  1883. package/dist/scripts/local-llm-capability-check.js +0 -14
  1884. package/dist/scripts/local-llm-smoke-check.js +0 -32
  1885. package/dist/scripts/local-llm-structured-output-check.js +0 -11
  1886. package/dist/scripts/local-llm-throughput-check.js +0 -10
  1887. package/dist/scripts/local-llm-tool-call-repair-check.js +0 -10
  1888. package/dist/scripts/local-llm-warmup-check.js +0 -11
  1889. package/dist/scripts/loop-hardening-check-lib.js +0 -289
  1890. package/dist/scripts/machine-local-evidence-zero-check.js +0 -22
  1891. package/dist/scripts/mad-db-capability-check.js +0 -26
  1892. package/dist/scripts/mad-db-command-check.js +0 -18
  1893. package/dist/scripts/mad-db-direct-apply-migration-hook-check.js +0 -73
  1894. package/dist/scripts/mad-db-hook-idempotency-check.js +0 -21
  1895. package/dist/scripts/mad-db-lifecycle-hook-decision-check.js +0 -18
  1896. package/dist/scripts/mad-db-one-cycle-bounded-check.js +0 -24
  1897. package/dist/scripts/mad-db-one-cycle-consumption-check.js +0 -16
  1898. package/dist/scripts/mad-db-operation-lifecycle-ledger-check.js +0 -17
  1899. package/dist/scripts/mad-db-parallel-lifecycle-check.js +0 -24
  1900. package/dist/scripts/mad-db-policy-v2-check.js +0 -20
  1901. package/dist/scripts/mad-db-priority-resolver-check.js +0 -20
  1902. package/dist/scripts/mad-db-real-supabase-e2e.js +0 -166
  1903. package/dist/scripts/mad-db-route-identity-check.js +0 -30
  1904. package/dist/scripts/mad-db-runtime-profile-lifecycle-check.js +0 -24
  1905. package/dist/scripts/mad-db-safety-conflict-matrix-check.js +0 -45
  1906. package/dist/scripts/mad-db-skill-policy-snapshot-check.js +0 -18
  1907. package/dist/scripts/mad-db-supabase-transport-diagnostics-check.js +0 -47
  1908. package/dist/scripts/mad-sks-audit-proof-check.js +0 -34
  1909. package/dist/scripts/mad-sks-db-executor-check.js +0 -5
  1910. package/dist/scripts/mad-sks-executor-proof-graph-check.js +0 -5
  1911. package/dist/scripts/mad-sks-fast-mode-propagation-check.js +0 -24
  1912. package/dist/scripts/mad-sks-file-write-executor-check.js +0 -5
  1913. package/dist/scripts/mad-sks-immutable-harness-check.js +0 -36
  1914. package/dist/scripts/mad-sks-live-protected-core-smoke.js +0 -5
  1915. package/dist/scripts/mad-sks-no-harness-modification-check.js +0 -25
  1916. package/dist/scripts/mad-sks-package-executor-check.js +0 -5
  1917. package/dist/scripts/mad-sks-permission-model-check.js +0 -22
  1918. package/dist/scripts/mad-sks-rollback-apply-check.js +0 -5
  1919. package/dist/scripts/mad-sks-service-executor-check.js +0 -5
  1920. package/dist/scripts/mad-sks-shell-executor-check.js +0 -5
  1921. package/dist/scripts/mad-sks-write-guard-check.js +0 -28
  1922. package/dist/scripts/mad-sks-zellij-default-pane-worker-check.js +0 -38
  1923. package/dist/scripts/mad-sks-zellij-launch-check.js +0 -108
  1924. package/dist/scripts/mad-zellij-no-contradictory-output-check.js +0 -4
  1925. package/dist/scripts/mad-zellij-self-heal-check.js +0 -4
  1926. package/dist/scripts/managed-role-manifest-parity-check.js +0 -24
  1927. package/dist/scripts/mcp-0-134-modernization-check.js +0 -55
  1928. package/dist/scripts/mcp-readonly-concurrency-check.js +0 -17
  1929. package/dist/scripts/mcp-readonly-runtime-scheduler-check.js +0 -20
  1930. package/dist/scripts/memory-summary-rebuild-check.js +0 -22
  1931. package/dist/scripts/naruto-active-pool-check.js +0 -39
  1932. package/dist/scripts/naruto-actual-worker-control-plane-check.js +0 -56
  1933. package/dist/scripts/naruto-allocation-policy-check.js +0 -33
  1934. package/dist/scripts/naruto-allocation-runtime-wiring-check.js +0 -92
  1935. package/dist/scripts/naruto-concurrency-governor-check.js +0 -53
  1936. package/dist/scripts/naruto-extreme-parallelism-check.js +0 -22
  1937. package/dist/scripts/naruto-extreme-parallelism-real-check.js +0 -45
  1938. package/dist/scripts/naruto-gpt-final-pack-check.js +0 -34
  1939. package/dist/scripts/naruto-loop-maker-checker-check.js +0 -3
  1940. package/dist/scripts/naruto-loop-mesh-check.js +0 -3
  1941. package/dist/scripts/naruto-loop-worker-router-check.js +0 -3
  1942. package/dist/scripts/naruto-orchestrator-runtime-source-check.js +0 -70
  1943. package/dist/scripts/naruto-parallel-gate-consistency-check.js +0 -8
  1944. package/dist/scripts/naruto-parallel-patch-apply-check.js +0 -41
  1945. package/dist/scripts/naruto-parallel-runtime-proof-check.js +0 -9
  1946. package/dist/scripts/naruto-parallelism-mode-check.js +0 -13
  1947. package/dist/scripts/naruto-parallelism-ux-check.js +0 -8
  1948. package/dist/scripts/naruto-proof-message-summary-check.js +0 -9
  1949. package/dist/scripts/naruto-proof-zellij-stacked-summary-check.js +0 -47
  1950. package/dist/scripts/naruto-readonly-routing-check.js +0 -119
  1951. package/dist/scripts/naruto-real-active-pool-check.js +0 -39
  1952. package/dist/scripts/naruto-real-active-pool-runtime-check.js +0 -85
  1953. package/dist/scripts/naruto-real-local-gpt-final-smoke.js +0 -25
  1954. package/dist/scripts/naruto-rebalance-policy-check.js +0 -41
  1955. package/dist/scripts/naruto-role-distribution-check.js +0 -23
  1956. package/dist/scripts/naruto-shadow-clone-swarm-check.js +0 -6
  1957. package/dist/scripts/naruto-ssot-default-check.js +0 -9
  1958. package/dist/scripts/naruto-ssot-gate-aliases-check.js +0 -10
  1959. package/dist/scripts/naruto-ssot-pipeline-default-check.js +0 -11
  1960. package/dist/scripts/naruto-ssot-route-normalization-check.js +0 -9
  1961. package/dist/scripts/naruto-ssot-routing-check.js +0 -13
  1962. package/dist/scripts/naruto-verification-pool-check.js +0 -36
  1963. package/dist/scripts/naruto-visible-vs-active-workers-check.js +0 -10
  1964. package/dist/scripts/naruto-work-graph-check.js +0 -24
  1965. package/dist/scripts/naruto-worktree-coding-check.js +0 -44
  1966. package/dist/scripts/naruto-worktree-gpt-final-check.js +0 -45
  1967. package/dist/scripts/naruto-worktree-zellij-ui-check.js +0 -28
  1968. package/dist/scripts/naruto-zellij-dynamic-right-column-check.js +0 -48
  1969. package/dist/scripts/naruto-zellij-massive-ui-check.js +0 -23
  1970. package/dist/scripts/native-app-screenshot-repair-check.js +0 -11
  1971. package/dist/scripts/native-capability-repair-check.js +0 -15
  1972. package/dist/scripts/native-chrome-web-review-repair-check.js +0 -11
  1973. package/dist/scripts/native-computer-use-repair-check.js +0 -11
  1974. package/dist/scripts/native-swarm-process-spawn-proof-check.js +0 -7
  1975. package/dist/scripts/native-swarm-zellij-does-not-block-workers-check.js +0 -11
  1976. package/dist/scripts/no-ts-nocheck-release-scripts-check.js +0 -4
  1977. package/dist/scripts/non-recursive-pipeline-check.js +0 -68
  1978. package/dist/scripts/npm-publish-performance-check.js +0 -74
  1979. package/dist/scripts/orphan-strong-detection-check.js +0 -12
  1980. package/dist/scripts/parallel-missing-pid-rejection-check.js +0 -55
  1981. package/dist/scripts/parallel-runtime-proof-check.js +0 -23
  1982. package/dist/scripts/parallel-runtime-proof-events-check.js +0 -13
  1983. package/dist/scripts/parallel-strict-pid-proof-check.js +0 -54
  1984. package/dist/scripts/parallel-verification-engine-check.js +0 -85
  1985. package/dist/scripts/perf-gate.js +0 -39
  1986. package/dist/scripts/pipeline-codex-0140-integration-check.js +0 -30
  1987. package/dist/scripts/pipeline-five-minute-sla-check.js +0 -7
  1988. package/dist/scripts/postinstall-safe-side-effects-check.js +0 -71
  1989. package/dist/scripts/ppt-full-e2e-artifact-graph-check.js +0 -40
  1990. package/dist/scripts/ppt-image-voxel-relations-check.js +0 -9
  1991. package/dist/scripts/ppt-imagegen-review-fixture-check.js +0 -6
  1992. package/dist/scripts/ppt-issue-extraction-fixture-check.js +0 -7
  1993. package/dist/scripts/ppt-no-mock-as-real-check.js +0 -10
  1994. package/dist/scripts/ppt-no-text-fallback-check.js +0 -7
  1995. package/dist/scripts/ppt-proof-trust-fixture-check.js +0 -10
  1996. package/dist/scripts/ppt-slide-export-fixture-check.js +0 -7
  1997. package/dist/scripts/priority-full-closure-check.js +0 -12
  1998. package/dist/scripts/product-design-auto-install-check.js +0 -119
  1999. package/dist/scripts/project-skill-dedupe-check.js +0 -34
  2000. package/dist/scripts/provider-context-config-toml-check.js +0 -63
  2001. package/dist/scripts/python-codex-sdk-capability-check.js +0 -75
  2002. package/dist/scripts/python-codex-sdk-sandbox-policy-check.js +0 -10
  2003. package/dist/scripts/python-codex-sdk-stream-bridge-check.js +0 -12
  2004. package/dist/scripts/python-tools-smoke-check.js +0 -71
  2005. package/dist/scripts/qa-actual-route-backfill-check.js +0 -5
  2006. package/dist/scripts/qa-loop-app-server-driver-check.js +0 -74
  2007. package/dist/scripts/qa-loop-surface-router-check.js +0 -49
  2008. package/dist/scripts/quantum-baseline-report.js +0 -38
  2009. package/dist/scripts/release-3112-required-gates.js +0 -30
  2010. package/dist/scripts/release-3113-required-gates.js +0 -25
  2011. package/dist/scripts/release-4000-required-gates.js +0 -36
  2012. package/dist/scripts/release-4001-required-gates.js +0 -13
  2013. package/dist/scripts/release-4002-required-gates.js +0 -14
  2014. package/dist/scripts/release-cache-bridge-check.js +0 -23
  2015. package/dist/scripts/release-check-dynamic-execute.js +0 -256
  2016. package/dist/scripts/release-check-dynamic.js +0 -98
  2017. package/dist/scripts/release-dynamic-performance-check.js +0 -109
  2018. package/dist/scripts/release-gate-existence-audit.js +0 -78
  2019. package/dist/scripts/release-gate-worker.js +0 -10
  2020. package/dist/scripts/release-metadata-1-11-check.js +0 -37
  2021. package/dist/scripts/release-metadata-1-12-check.js +0 -48
  2022. package/dist/scripts/release-metadata-1-13-check.js +0 -53
  2023. package/dist/scripts/release-metadata-1-14-check.js +0 -63
  2024. package/dist/scripts/release-native-agent-fixture-check.js +0 -41
  2025. package/dist/scripts/release-parallel-full-coverage-check.js +0 -19
  2026. package/dist/scripts/release-registry-check.js +0 -417
  2027. package/dist/scripts/release-script-type-safety-check.js +0 -4
  2028. package/dist/scripts/release-speed-summary-check.js +0 -20
  2029. package/dist/scripts/release-stability-report-check.js +0 -103
  2030. package/dist/scripts/release-triwiki-first-runner-check.js +0 -9
  2031. package/dist/scripts/repo-audit.js +0 -83
  2032. package/dist/scripts/research-actual-route-backfill-check.js +0 -5
  2033. package/dist/scripts/research-handoff-consumability-check.js +0 -23
  2034. package/dist/scripts/research-parallel-source-shards-check.js +0 -22
  2035. package/dist/scripts/research-real-cycle-no-legacy-final-md-check.js +0 -18
  2036. package/dist/scripts/research-real-synthesis-no-deterministic-renderer-check.js +0 -14
  2037. package/dist/scripts/research-repetition-detector-check.js +0 -19
  2038. package/dist/scripts/research-short-report-rejection-check.js +0 -46
  2039. package/dist/scripts/research-source-ledger-merge-check.js +0 -26
  2040. package/dist/scripts/research-synthesis-prompt-contract-check.js +0 -36
  2041. package/dist/scripts/research-synthesis-writer-check.js +0 -26
  2042. package/dist/scripts/research-template-report-rejection-check.js +0 -56
  2043. package/dist/scripts/research-ultra-stability-report.js +0 -45
  2044. package/dist/scripts/retention-cleanup-safety-check.js +0 -174
  2045. package/dist/scripts/route-proof-artifact-structure-check.js +0 -146
  2046. package/dist/scripts/runtime-proof-summary-cli-check.js +0 -51
  2047. package/dist/scripts/runtime-proof-summary-messages-check.js +0 -37
  2048. package/dist/scripts/runtime-proof-zellij-stacked-summary-check.js +0 -58
  2049. package/dist/scripts/runtime-ts-python-boundary-check.js +0 -59
  2050. package/dist/scripts/rust-smoke.js +0 -5
  2051. package/dist/scripts/safety-check.js +0 -23
  2052. package/dist/scripts/scheduler-critical-path-check.js +0 -9
  2053. package/dist/scripts/scheduler-extreme-parallel-check.js +0 -7
  2054. package/dist/scripts/scheduler-resource-budget-check.js +0 -7
  2055. package/dist/scripts/scheduler-utilization-proof-check.js +0 -8
  2056. package/dist/scripts/secret-line-rollback-check.js +0 -35
  2057. package/dist/scripts/seo-canonical-locale-check.js +0 -19
  2058. package/dist/scripts/seo-geo-feature-fixture-quality-check.js +0 -18
  2059. package/dist/scripts/seo-geo-no-unsupported-ranking-claims-check.js +0 -18
  2060. package/dist/scripts/seo-mutation-rollback-check.js +0 -23
  2061. package/dist/scripts/seo-structured-data-visible-content-check.js +0 -19
  2062. package/dist/scripts/side-effect-zero-gate-check.js +0 -226
  2063. package/dist/scripts/skill-registry-ledger-check.js +0 -14
  2064. package/dist/scripts/skill-sync-atomic-check.js +0 -35
  2065. package/dist/scripts/sks-1-11-fixture-check.js +0 -130
  2066. package/dist/scripts/sks-3-1-7-directive-check-lib.js +0 -58
  2067. package/dist/scripts/source-intelligence-all-modes-check.js +0 -22
  2068. package/dist/scripts/source-intelligence-policy-check.js +0 -13
  2069. package/dist/scripts/strategy-adhd-orchestrating-gate-check.js +0 -22
  2070. package/dist/scripts/strategy-file-ownership-plan-check.js +0 -18
  2071. package/dist/scripts/strategy-parallel-modification-plan-check.js +0 -19
  2072. package/dist/scripts/strategy-verification-rollback-dag-check.js +0 -19
  2073. package/dist/scripts/super-search-name-guard-check.js +0 -98
  2074. package/dist/scripts/team-actual-route-backfill-check.js +0 -5
  2075. package/dist/scripts/team-legacy-create-removed-check.js +0 -12
  2076. package/dist/scripts/terminal-tui-output-stability-check.js +0 -35
  2077. package/dist/scripts/tmux-removal-inventory.js +0 -36
  2078. package/dist/scripts/triwiki-affected-graph-check.js +0 -10
  2079. package/dist/scripts/triwiki-gate-impact-map-check.js +0 -8
  2080. package/dist/scripts/triwiki-module-card-check.js +0 -7
  2081. package/dist/scripts/triwiki-stale-proof-rejection-check.js +0 -25
  2082. package/dist/scripts/typescript-migration-report.js +0 -78
  2083. package/dist/scripts/ultra-router-classification-check.js +0 -28
  2084. package/dist/scripts/update-concurrent-lock-check.js +0 -11
  2085. package/dist/scripts/update-default-command-check.js +0 -30
  2086. package/dist/scripts/update-doctor-lifecycle-check.js +0 -13
  2087. package/dist/scripts/update-first-command-migration-check.js +0 -15
  2088. package/dist/scripts/update-mad-zellij-notice-check.js +0 -9
  2089. package/dist/scripts/update-new-binary-reexec-check.js +0 -12
  2090. package/dist/scripts/update-notice-check.js +0 -10
  2091. package/dist/scripts/update-secret-migration-journal-check.js +0 -8
  2092. package/dist/scripts/update-secret-preservation-guard-check.js +0 -10
  2093. package/dist/scripts/ux-ppt-structured-extraction-check.js +0 -21
  2094. package/dist/scripts/ux-review-extract-real-callouts-fixture-check.js +0 -8
  2095. package/dist/scripts/ux-review-generate-callouts-fixture-check.js +0 -9
  2096. package/dist/scripts/ux-review-image-voxel-relations-check.js +0 -31
  2097. package/dist/scripts/ux-review-no-fake-callouts-check.js +0 -8
  2098. package/dist/scripts/ux-review-no-text-fallback-check.js +0 -25
  2099. package/dist/scripts/ux-review-patch-handoff-fixture-check.js +0 -8
  2100. package/dist/scripts/ux-review-real-loop-fixture-check.js +0 -29
  2101. package/dist/scripts/ux-review-recapture-recheck-fixture-check.js +0 -8
  2102. package/dist/scripts/worker-pane-communication-contract-check.js +0 -53
  2103. package/dist/scripts/zellij-real-session-heartbeat-check.js +0 -49
  2104. package/dist/scripts/zellij-viewport-binder-check.js +0 -9
  2105. package/dist/scripts/zellij-worker-pane-spawn-order-check.js +0 -35
@@ -26,11 +26,10 @@ import { ensureGlobalCodexFastModeDuringInstall, ensureTrailingNewline, normaliz
26
26
  import { runPostinstallGlobalDoctorAndMarkPending } from '../core/update/update-migration-state.js';
27
27
  import { repairCodexImagegen } from '../core/doctor/imagegen-repair.js';
28
28
  import { canAskYesNo, compareVersions, hasCodexUnstableFeatureWarningSuppression, hasDeprecatedCodexHooksFeatureFlag, hasTopLevelCodexModeLock, isProjectSetupCandidate } from './install-tool-helpers.js';
29
- export { checkContext7, ensureCodexCliTool, ensureMadLaunchDependencies, ensureRelatedCliTools, ensureZellijCliTool, formatMadLaunchDependencyAction, maybePromptCodexUpdateForLaunch, maybePromptSksUpdateForLaunch, shouldAutoApproveInstall } from './install-tool-helpers.js';
30
- export { codexFastModeDesktopStatus, ensureGlobalCodexFastModeDuringInstall, normalizeCodexFastModeUiConfig, safeWriteCodexConfigToml } from '../core/codex-runtime/codex-desktop-config-policy.js';
31
- const CODEX_LB_PROVIDER_NAME = 'openai';
32
- const CODEX_LB_PROVIDER_ENV_KEY = 'CODEX_LB_API_KEY';
33
- const CODEX_LB_CANONICAL_FAST_SERVICE_TIER = 'priority';
29
+ import { checkCodexLbResponseChain } from './install-helpers-codex-lb-chain.js';
30
+ import { CODEX_LB_CANONICAL_FAST_SERVICE_TIER, CODEX_LB_PROVIDER_ENV_KEY, CODEX_LB_PROVIDER_NAME, askPostinstallQuestion, codexAuthChatgptBackupPath, codexAuthPath, codexLbConfigPath, codexLbEnvPath, hasTopLevelCodexLbSelected, normalizeCodexLbBaseUrl, parseCodexLbEnvKey, redactSecretText } from './install-helpers-codex-lb-shared.js';
31
+ import { appliedCodexLbPersistenceModes, captureCodexLbSetupWriteState, detectCodexLbSetupDrift, ensureGlobalCodexAppGlmProfile, parseCodexLbEnvBaseUrl, parseCodexSharedLoginApiKey, sha256Text, shellSingleQuote, upsertCodexAppGlmConfig, upsertCodexLbConfig } from './install-helpers-codex-lb-config.js';
32
+ import { ensureCodexImagegenDuringInstall, ensureGlobalCodexSkillsDuringInstall, ensureGlobalContext7DuringInstall, ensureGlobalGetdesignSkillDuringInstall, ensureSksCommandDuringInstall } from './install-helpers-install-support.js';
34
33
  function packagedSksEntrypoint() {
35
34
  return path.join(packageRoot(), 'dist', 'bin', 'sks.js');
36
35
  }
@@ -87,10 +86,6 @@ export async function postinstall({ bootstrap, args = [] }) {
87
86
  console.log(`Context7 MCP: skipped (${context7Install.reason}).`);
88
87
  else if (context7Install.status === 'failed')
89
88
  console.log(`Context7 MCP: auto setup failed. Run \`sks context7 setup --scope global\` or \`sks setup\`. ${context7Install.error || ''}`.trim());
90
- // xAI/Grok web search is an optional source-intelligence provider. It needs a
91
- // user-chosen MCP server + XAI_API_KEY, so we never auto-configure it — just make
92
- // it discoverable (the integration the operator otherwise can't find at install).
93
- console.log('xAI/Grok search (optional): add Grok Live Search with `sks xai setup` (then `export XAI_API_KEY=...`); see `sks xai docs`.');
94
89
  const fastModeRepair = await ensureGlobalCodexFastModeDuringInstall();
95
90
  if (fastModeRepair.status === 'updated')
96
91
  console.log(`Codex App Fast mode: updated ${fastModeRepair.config_path}${fastModeRepair.backup_path ? ` (backup ${fastModeRepair.backup_path})` : ''}.`);
@@ -228,9 +223,9 @@ async function reportPostinstallCodexLbAuth() {
228
223
  else if (codexLbAuth.status === 'skipped')
229
224
  console.log(`codex-lb auth: skipped (${codexLbAuth.reason}).`);
230
225
  else if (codexLbAuth.status === 'missing_env_key')
231
- console.log('codex-lb auth: stored key missing. Run `sks codex-lb setup --host <domain> --api-key <key>` to repair.');
226
+ console.log('codex-lb auth: stored key missing. Run `sks codex-lb setup --host <domain> --api-key-stdin` to repair.');
232
227
  else if (codexLbAuth.status === 'missing_base_url')
233
- console.log('codex-lb auth: stored key has no recoverable base URL. Run `sks codex-lb reconfigure --host <domain> --api-key <key>` once.');
228
+ console.log('codex-lb auth: stored key has no recoverable base URL. Run `sks codex-lb reconfigure --host <domain> --api-key-stdin` once.');
234
229
  else if (codexLbAuth.status === 'not_configured')
235
230
  console.log('codex-lb (optional multi-account load balancer): not configured — opt in anytime with `sks codex-lb setup` (your choice; never applied automatically, never edits your Codex config without it). Swap key later: `sks codex-lb set-key`; switch auth: `sks codex-lb use-oauth` / `use-codex-lb`.');
236
231
  else if (codexLbAuth.status && codexLbAuth.status !== 'not_configured')
@@ -325,27 +320,6 @@ async function runPostinstallBootstrap(root, bootstrap) {
325
320
  process.chdir(previousCwd);
326
321
  }
327
322
  }
328
- export async function askPostinstallQuestion(question) {
329
- const rl = readline.createInterface({ input, output });
330
- try {
331
- return await rl.question(question);
332
- }
333
- finally {
334
- rl.close();
335
- }
336
- }
337
- export function codexLbConfigPath(home = process.env.HOME || os.homedir()) {
338
- return path.join(home, '.codex', 'config.toml');
339
- }
340
- export function codexLbEnvPath(home = process.env.HOME || os.homedir()) {
341
- return path.join(home, '.codex', 'sks-codex-lb.env');
342
- }
343
- function codexAuthPath(home = process.env.HOME || os.homedir()) {
344
- return path.join(home, '.codex', 'auth.json');
345
- }
346
- function codexAuthChatgptBackupPath(home = process.env.HOME || os.homedir()) {
347
- return path.join(home, '.codex', 'auth.chatgpt-backup.json');
348
- }
349
323
  async function capturePostinstallCodexLbConfigSnapshot(home = process.env.HOME || os.homedir()) {
350
324
  const configPath = codexLbConfigPath(home);
351
325
  const envPath = codexLbEnvPath(home);
@@ -404,15 +378,6 @@ async function restorePostinstallCodexLbConfigSnapshot(snapshot) {
404
378
  auth_restored: authRestored
405
379
  };
406
380
  }
407
- export function normalizeCodexLbBaseUrl(input = '') {
408
- let host = String(input || '').trim();
409
- if (!host)
410
- return '';
411
- if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(host))
412
- host = `https://${host}`;
413
- host = host.replace(/\/+$/, '');
414
- return /\/backend-api\/codex$/i.test(host) ? host : `${host}/backend-api/codex`;
415
- }
416
381
  async function ensureCodexLbToolCatalogSelection(input, opts = {}) {
417
382
  const codexHome = opts.codexHome || path.join(input.home, '.codex');
418
383
  const catalogPath = codexLbToolCatalogPath(codexHome);
@@ -494,7 +459,7 @@ export async function configureCodexLb(opts = {}) {
494
459
  const shellProfile = opts.shellProfile || 'skip';
495
460
  const setupAnswers = {
496
461
  host_or_base_url: rawHost,
497
- api_key_source: opts.apiKeySource || 'cli_option',
462
+ api_key_source: opts.apiKeySource || 'stdin',
498
463
  use_as_default_provider: useDefaultProvider,
499
464
  write_env_file: writeEnvFile,
500
465
  store_keychain: storeKeychain,
@@ -632,9 +597,14 @@ export async function configureCodexLb(opts = {}) {
632
597
  ...persistence.warnings,
633
598
  ...(toolCatalog.required !== false && toolCatalog.ok !== true ? ['codex_lb_gpt56_tool_catalog_not_ready'] : [])
634
599
  ];
600
+ const failureStatus = codexEnvironment.ok !== true
601
+ ? (codexEnvironment.status || 'environment_failed')
602
+ : codexLogin.ok !== true
603
+ ? (codexLogin.status || 'login_failed')
604
+ : null;
635
605
  return {
636
606
  ok: ok && drift.length === 0,
637
- status: ok && drift.length === 0 ? 'configured' : drift.length ? 'setup_choice_drift' : (codexEnvironment.status || codexLogin.status),
607
+ status: ok && drift.length === 0 ? 'configured' : failureStatus || (drift.length ? 'setup_choice_drift' : 'configuration_failed'),
638
608
  plan: plan,
639
609
  applied_actions: appliedActions,
640
610
  drift,
@@ -786,7 +756,7 @@ export function formatCodexLbStatusText(status = {}, opts = {}) {
786
756
  else if (!status.ok && status.base_url && status.env_key_configured)
787
757
  lines.push('', 'Run: sks codex-lb repair to restore the upstream codex-lb provider block.');
788
758
  else if (!status.ok)
789
- lines.push('', 'Run: sks codex-lb setup --host <domain> --api-key <key>');
759
+ lines.push('', 'Run: sks codex-lb setup --host <domain> --api-key-stdin');
790
760
  if (backupPresent)
791
761
  lines.push('Switch fully away from codex-lb: sks codex-lb release');
792
762
  return `${lines.join('\n')}\n`;
@@ -805,278 +775,6 @@ export function formatCodexLbRepairResultText(result = {}) {
805
775
  lines.push('Codex App auth: codex-lb API-key auth.json is active.');
806
776
  return `${lines.join('\n')}\n`;
807
777
  }
808
- function codexLbResponsesEndpoint(baseUrl = '') {
809
- const base = String(baseUrl || '').trim().replace(/\/+$/, '');
810
- if (!base)
811
- return '';
812
- return /\/responses$/i.test(base) ? base : `${base}/responses`;
813
- }
814
- function codexLbChainCheckEnabled(env = process.env) {
815
- return env.SKS_CODEX_LB_CHAIN_CHECK !== '0' && env.SKS_SKIP_CODEX_LB_CHAIN_CHECK !== '1';
816
- }
817
- function codexLbChainCachePath(home = process.env.HOME || os.homedir()) {
818
- return path.join(home, '.codex', 'sks-codex-lb-chain-health.json');
819
- }
820
- function codexLbChainCacheTtlMs(status = '', env = process.env) {
821
- const hardFailure = Boolean(status && !['chain_ok', 'previous_response_not_found'].includes(status));
822
- const key = hardFailure ? 'SKS_CODEX_LB_CHAIN_CHECK_FAILURE_CACHE_TTL_MS' : 'SKS_CODEX_LB_CHAIN_CHECK_CACHE_TTL_MS';
823
- const fallback = hardFailure ? 30 * 1000 : 5 * 60 * 1000;
824
- const raw = env[key] ?? env.SKS_CODEX_LB_CHAIN_CHECK_CACHE_TTL_MS;
825
- if (raw === undefined || raw === '')
826
- return fallback;
827
- const parsed = Number(raw);
828
- return Number.isFinite(parsed) ? Math.max(0, parsed) : fallback;
829
- }
830
- function codexLbChainCacheEnabled(opts = {}, env = process.env) {
831
- if (opts.force || opts.cache === false)
832
- return false;
833
- if (opts.fetch)
834
- return false;
835
- if (env.SKS_CODEX_LB_CHAIN_CHECK_CACHE === '0')
836
- return false;
837
- return true;
838
- }
839
- async function readCodexLbChainCache({ endpoint, home, opts = {}, env = process.env } = {}) {
840
- if (!endpoint || !codexLbChainCacheEnabled(opts, env))
841
- return null;
842
- const cachePath = opts.cachePath || codexLbChainCachePath(home || env.HOME || os.homedir());
843
- const text = await readText(cachePath, '');
844
- if (!text.trim())
845
- return null;
846
- try {
847
- const parsed = JSON.parse(text);
848
- if (parsed?.schema !== 'sks.codex-lb-chain-health.v1' || parsed.endpoint !== endpoint || !parsed.result?.status)
849
- return null;
850
- const now = typeof opts.now === 'function' ? opts.now() : Date.now();
851
- const checkedAt = Number(parsed.checked_at_ms || 0);
852
- const ttlMs = codexLbChainCacheTtlMs(parsed.result.status, env);
853
- if (!checkedAt || ttlMs <= 0 || now - checkedAt > ttlMs)
854
- return null;
855
- return {
856
- ...parsed.result,
857
- endpoint,
858
- cached: true,
859
- cache_path: cachePath,
860
- cache_age_ms: Math.max(0, now - checkedAt)
861
- };
862
- }
863
- catch {
864
- return null;
865
- }
866
- }
867
- async function writeCodexLbChainCache(result = {}, { endpoint, home, opts = {}, env = process.env } = {}) {
868
- if (!endpoint || !result.status || !codexLbChainCacheEnabled(opts, env))
869
- return result;
870
- const cachePath = opts.cachePath || codexLbChainCachePath(home || env.HOME || os.homedir());
871
- const now = typeof opts.now === 'function' ? opts.now() : Date.now();
872
- const cacheResult = {
873
- ok: Boolean(result.ok),
874
- status: result.status,
875
- chain_unhealthy: result.chain_unhealthy === true,
876
- http_status: result.http_status || null,
877
- error: result.error || null
878
- };
879
- try {
880
- await ensureDir(path.dirname(cachePath));
881
- await writeTextAtomic(cachePath, `${JSON.stringify({
882
- schema: 'sks.codex-lb-chain-health.v1',
883
- endpoint,
884
- checked_at_ms: now,
885
- result: cacheResult
886
- }, null, 2)}\n`);
887
- await fsp.chmod(cachePath, 0o600).catch(() => { });
888
- }
889
- catch {
890
- // Cache writes are a launch optimization only; never block codex-lb startup.
891
- }
892
- return result;
893
- }
894
- function isPreviousResponseNotFound(payload = {}) {
895
- const error = payload?.error || payload?.response?.error || payload;
896
- const text = typeof error === 'string'
897
- ? error
898
- : [error?.type, error?.code, error?.message, error?.param, JSON.stringify(error || {})].filter(Boolean).join(' ');
899
- return /previous_response_not_found|previous_response_id.*not found|previous_response_id/i.test(text);
900
- }
901
- function parseCodexLbSseEvents(text = '') {
902
- const events = [];
903
- for (const line of String(text || '').split(/\r?\n/)) {
904
- if (!line.startsWith('data:'))
905
- continue;
906
- const data = line.slice(5).trim();
907
- if (!data || data === '[DONE]')
908
- continue;
909
- try {
910
- events.push(JSON.parse(data));
911
- }
912
- catch { }
913
- }
914
- return events;
915
- }
916
- function codexLbResponseId(payload = {}) {
917
- if (typeof payload?.id === 'string' && payload.id)
918
- return payload.id;
919
- if (typeof payload?.response?.id === 'string' && payload.response.id)
920
- return payload.response.id;
921
- if (typeof payload?.data?.id === 'string' && payload.data.id)
922
- return payload.data.id;
923
- if (typeof payload?.data?.response?.id === 'string' && payload.data.response.id)
924
- return payload.data.response.id;
925
- return null;
926
- }
927
- function codexLbResponseError(json, events = []) {
928
- if (json?.error)
929
- return json;
930
- for (const event of events) {
931
- if (event?.error || event?.response?.error || event?.type === 'response.failed' || event?.type === 'error')
932
- return event;
933
- }
934
- return null;
935
- }
936
- function codexLbServiceTierEvidence(...responses) {
937
- const values = [];
938
- const visit = (value) => {
939
- if (!value || typeof value !== 'object')
940
- return;
941
- values.push(value);
942
- if (Array.isArray(value)) {
943
- for (const item of value)
944
- visit(item);
945
- return;
946
- }
947
- for (const child of Object.values(value))
948
- visit(child);
949
- };
950
- for (const response of responses) {
951
- visit(response?.json);
952
- visit(response?.events);
953
- }
954
- const firstString = (...keys) => {
955
- for (const row of values) {
956
- for (const key of keys) {
957
- const value = row?.[key];
958
- if (typeof value === 'string' && value.trim())
959
- return value.trim().toLowerCase();
960
- }
961
- }
962
- return null;
963
- };
964
- const requested = firstString('requestedServiceTier', 'requested_service_tier', 'requested_serviceTier');
965
- const actual = firstString('actualServiceTier', 'actual_service_tier', 'actual_serviceTier');
966
- const effective = firstString('serviceTier', 'service_tier');
967
- return {
968
- requested_service_tier: requested,
969
- actual_service_tier: actual,
970
- effective_service_tier: effective,
971
- fast_requested: requested === CODEX_LB_CANONICAL_FAST_SERVICE_TIER || effective === CODEX_LB_CANONICAL_FAST_SERVICE_TIER,
972
- fast_actual: actual === CODEX_LB_CANONICAL_FAST_SERVICE_TIER || effective === CODEX_LB_CANONICAL_FAST_SERVICE_TIER
973
- };
974
- }
975
- async function fetchCodexLbResponse(fetchImpl, endpoint, apiKey, body, timeoutMs) {
976
- const controller = new AbortController();
977
- const timer = setTimeout(() => controller.abort(), timeoutMs).unref?.();
978
- try {
979
- const response = await fetchImpl(endpoint, {
980
- method: 'POST',
981
- headers: {
982
- authorization: `Bearer ${apiKey}`,
983
- 'content-type': 'application/json'
984
- },
985
- body: JSON.stringify(body),
986
- signal: controller.signal
987
- });
988
- const text = await response.text();
989
- let json = null;
990
- try {
991
- json = text ? JSON.parse(text) : null;
992
- }
993
- catch { }
994
- const events = json ? [] : parseCodexLbSseEvents(text);
995
- const responseId = codexLbResponseId(json) || events.map((event) => codexLbResponseId(event)).find(Boolean) || null;
996
- const errorPayload = codexLbResponseError(json, events);
997
- return { ok: response.ok && !errorPayload, status: response.status, json, text, events, response_id: responseId, error_payload: errorPayload };
998
- }
999
- catch (err) {
1000
- return { ok: false, status: 0, json: null, text: err.name === 'AbortError' ? 'request timed out' : err.message, events: [], response_id: null, error_payload: null };
1001
- }
1002
- finally {
1003
- clearTimeout(timer);
1004
- }
1005
- }
1006
- export async function checkCodexLbResponseChain(status = {}, opts = {}) {
1007
- const env = opts.env || process.env;
1008
- if (!codexLbChainCheckEnabled(env) && !opts.force)
1009
- return { ok: true, status: 'skipped', skipped: true, reason: 'SKS_CODEX_LB_CHAIN_CHECK=0' };
1010
- const endpoint = codexLbResponsesEndpoint(opts.baseUrl || status.base_url);
1011
- if (!endpoint)
1012
- return recordCodexLbChainHealth({ ok: false, status: 'missing_base_url', chain_unhealthy: true }, opts);
1013
- const home = opts.home || env.HOME || os.homedir();
1014
- const apiKey = opts.apiKey || parseCodexLbEnvKey(await readText(opts.envPath || status.env_path || codexLbEnvPath(home), ''));
1015
- if (!apiKey)
1016
- return recordCodexLbChainHealth({ ok: false, status: 'missing_env_key', chain_unhealthy: true }, opts);
1017
- const cached = await readCodexLbChainCache({ endpoint, home, opts, env });
1018
- if (cached)
1019
- return cached;
1020
- const fetchImpl = opts.fetch || globalThis.fetch;
1021
- if (typeof fetchImpl !== 'function')
1022
- return { ok: true, status: 'skipped', skipped: true, reason: 'fetch unavailable' };
1023
- const model = String(opts.model || env.SKS_CODEX_MODEL || env.CODEX_MODEL || '').trim();
1024
- if (!model)
1025
- return { ok: true, status: 'skipped', skipped: true, reason: 'model_unselected_use_explicit_model_or_codex_catalog' };
1026
- const timeoutMs = Number(opts.timeoutMs || env.SKS_CODEX_LB_CHAIN_CHECK_TIMEOUT_MS || 8000);
1027
- const serviceTier = opts.fastMode === true || opts.serviceTier === 'fast' || opts.serviceTier === CODEX_LB_CANONICAL_FAST_SERVICE_TIER
1028
- ? CODEX_LB_CANONICAL_FAST_SERVICE_TIER
1029
- : null;
1030
- const baseBody = {
1031
- model,
1032
- instructions: 'You are running a short SKS codex-lb response-chain health check.',
1033
- input: 'SKS codex-lb response-chain health check. Reply with OK.',
1034
- ...(serviceTier ? { service_tier: serviceTier } : {}),
1035
- stream: true,
1036
- store: true,
1037
- parallel_tool_calls: false,
1038
- tool_choice: 'auto',
1039
- reasoning: { effort: 'low' }
1040
- };
1041
- const first = await fetchCodexLbResponse(fetchImpl, endpoint, apiKey, baseBody, timeoutMs);
1042
- if (!first.ok || !first.response_id) {
1043
- return recordCodexLbChainHealth(await writeCodexLbChainCache({
1044
- ok: false,
1045
- status: first.ok ? 'missing_response_id' : 'first_request_failed',
1046
- chain_unhealthy: true,
1047
- endpoint,
1048
- http_status: first.status,
1049
- requested_service_tier: serviceTier,
1050
- service_tier_evidence: codexLbServiceTierEvidence(first),
1051
- error: redactSecretText(first.error_payload?.error?.message || first.error_payload?.response?.error?.message || first.text || 'codex-lb first Responses request failed', [apiKey])
1052
- }, { endpoint, home, opts, env }), opts);
1053
- }
1054
- const second = await fetchCodexLbResponse(fetchImpl, endpoint, apiKey, { ...baseBody, previous_response_id: first.response_id }, timeoutMs);
1055
- if (second.ok)
1056
- return recordCodexLbChainHealth(await writeCodexLbChainCache({ ok: true, status: 'chain_ok', endpoint, response_id: first.response_id, chained_response_id: second.response_id || null, http_status: second.status, requested_service_tier: serviceTier, service_tier_evidence: codexLbServiceTierEvidence(first, second) }, { endpoint, home, opts, env }), opts);
1057
- const previousMissing = isPreviousResponseNotFound(second.error_payload || second.json || second.text);
1058
- return recordCodexLbChainHealth(await writeCodexLbChainCache({
1059
- ok: false,
1060
- status: previousMissing ? 'previous_response_not_found' : 'second_request_failed',
1061
- chain_unhealthy: true,
1062
- endpoint,
1063
- response_id: first.response_id,
1064
- http_status: second.status,
1065
- requested_service_tier: serviceTier,
1066
- service_tier_evidence: codexLbServiceTierEvidence(first, second),
1067
- error: redactSecretText(second.error_payload?.error?.message || second.error_payload?.response?.error?.message || second.text || 'codex-lb chained Responses request failed', [apiKey])
1068
- }, { endpoint, home, opts, env }), opts);
1069
- }
1070
- async function recordCodexLbChainHealth(result, opts = {}) {
1071
- if (!result || result.skipped || opts.recordCircuit === false)
1072
- return result;
1073
- await recordCodexLbHealthEvent(opts.root || packageRoot(), result).catch(() => null);
1074
- return result;
1075
- }
1076
- function hasTopLevelCodexLbSelected(text = '') {
1077
- const topLevel = String(text || '').split(/\n\s*\[/)[0] || '';
1078
- return /(^|\n)\s*model_provider\s*=\s*"codex-lb"\s*(?:#.*)?(?=\n|$)/.test(topLevel);
1079
- }
1080
778
  function codexLbProviderBaseUrl(text = '') {
1081
779
  const block = String(text || '').match(/(^|\n)\[model_providers\.codex-lb\]([\s\S]*?)(?=\n\[[^\]]+\]|\s*$)/)?.[2] || '';
1082
780
  return block.match(/(^|\n)\s*base_url\s*=\s*"([^"]+)"/)?.[2] || '';
@@ -1382,7 +1080,8 @@ export async function reconcileCodexLbAuthConflict(opts = {}) {
1382
1080
  const authExists = await exists(authPath);
1383
1081
  const authText = authExists ? await readText(authPath, '') : '';
1384
1082
  const envText = await readText(status.env_path, '');
1385
- const apiKey = parseCodexLbEnvKey(envText);
1083
+ const apiKey = parseCodexLbEnvKey(envText)
1084
+ || String(opts.apiKey || (opts.env || process.env).CODEX_LB_API_KEY || '').trim();
1386
1085
  if (!apiKey) {
1387
1086
  return { status: 'skipped', reason: 'missing_env_key', auth_path: authPath };
1388
1087
  }
@@ -1985,1089 +1684,13 @@ async function syncCodexApiKeyLogin(apiKey, opts = {}) {
1985
1684
  return { ok: true, status: 'synced' };
1986
1685
  return { ok: false, status: 'login_failed', error: redactSecretText(login.stderr || login.stdout || 'codex login failed', [apiKey]).trim() };
1987
1686
  }
1988
- export function upsertCodexLbConfig(text = '', baseUrl, selectDefault = true) {
1989
- let next = selectDefault
1990
- ? upsertTopLevelTomlString(text, 'model_provider', 'codex-lb')
1991
- : removeTopLevelTomlKeyIfValue(text, 'model_provider', 'codex-lb');
1992
- const block = [
1993
- '[model_providers.codex-lb]',
1994
- 'name = "openai"',
1995
- `base_url = "${baseUrl}"`,
1996
- 'wire_api = "responses"',
1997
- 'env_key = "CODEX_LB_API_KEY"',
1998
- 'supports_websockets = true',
1999
- 'requires_openai_auth = true'
2000
- ].join('\n');
2001
- next = upsertTomlTable(next, 'model_providers.codex-lb', block);
2002
- return `${next.trim()}\n`;
2003
- }
2004
- export function upsertCodexAppGlmConfig(text = '') {
2005
- let next = String(text || '');
2006
- const providerBlock = [
2007
- `[model_providers.${GLM_CODEX_CONFIG_PROVIDER_ID}]`,
2008
- 'name = "OpenRouter"',
2009
- 'base_url = "https://openrouter.ai/api/v1"',
2010
- 'wire_api = "responses"',
2011
- 'env_key = "OPENROUTER_API_KEY"',
2012
- 'requires_openai_auth = false'
2013
- ].join('\n');
2014
- next = upsertTomlTable(next, `model_providers.${GLM_CODEX_CONFIG_PROVIDER_ID}`, providerBlock);
2015
- for (const profile of GLM_CODEX_CONFIG_REASONING_PROFILES) {
2016
- const profileBlock = [
2017
- `[profiles.${profile.id}]`,
2018
- `model_provider = "${GLM_CODEX_CONFIG_PROVIDER_ID}"`,
2019
- `model = "${GLM_52_OPENROUTER_MODEL}"`,
2020
- `model_reasoning_effort = "${profile.reasoning_effort}"`,
2021
- 'service_tier = "default"',
2022
- 'approval_policy = "on-request"'
2023
- ].join('\n');
2024
- next = upsertTomlTable(next, `profiles.${profile.id}`, profileBlock);
2025
- }
2026
- return `${next.trim()}\n`;
2027
- }
2028
- export async function ensureGlobalCodexAppGlmProfile(opts = {}) {
2029
- if (process.env.SKS_SKIP_CODEX_GLM_PROFILE_REPAIR === '1' && opts.force !== true) {
2030
- return { ok: true, status: 'skipped', reason: 'SKS_SKIP_CODEX_GLM_PROFILE_REPAIR=1' };
2031
- }
2032
- const home = opts.home || process.env.HOME || os.homedir();
2033
- const configPath = opts.configPath || codexLbConfigPath(home);
2034
- try {
2035
- await ensureDir(path.dirname(configPath));
2036
- const current = await readText(configPath, '');
2037
- const next = upsertCodexAppGlmConfig(current);
2038
- const safeWrite = await safeWriteCodexConfigToml(configPath, current, next, 'glm-profile');
2039
- return {
2040
- ...safeWrite,
2041
- status: safeWrite.status === 'written' ? 'updated' : safeWrite.status,
2042
- provider: GLM_CODEX_CONFIG_PROVIDER_ID,
2043
- model: GLM_52_OPENROUTER_MODEL,
2044
- codex_config_profile: GLM_CODEX_CONFIG_PROFILE_ID,
2045
- reasoning_profiles: GLM_CODEX_CONFIG_REASONING_PROFILES.map((profile) => profile.id)
2046
- };
2047
- }
2048
- catch (err) {
2049
- return {
2050
- ok: false,
2051
- status: 'failed',
2052
- config_path: configPath,
2053
- error: err.message,
2054
- provider: GLM_CODEX_CONFIG_PROVIDER_ID,
2055
- model: GLM_52_OPENROUTER_MODEL,
2056
- codex_config_profile: GLM_CODEX_CONFIG_PROFILE_ID,
2057
- reasoning_profiles: GLM_CODEX_CONFIG_REASONING_PROFILES.map((profile) => profile.id)
2058
- };
2059
- }
2060
- }
2061
- function detectCodexLbSetupDrift(state = {}) {
2062
- const drift = [];
2063
- if (state.useDefaultProvider && state.selected !== true)
2064
- drift.push('default_provider_not_selected');
2065
- if (!state.useDefaultProvider && state.selected === true)
2066
- drift.push('default_provider_selected_despite_no_default_provider');
2067
- if (state.writeEnvFile && state.envFile !== true)
2068
- drift.push('env_file_not_written');
2069
- if (!state.writeEnvFile && state.beforeState && state.afterState && state.beforeState.envHash !== state.afterState.envHash)
2070
- drift.push('env_file_changed_despite_no_env_file');
2071
- if (!state.writeEnvFile && !state.beforeState && state.envFile === true)
2072
- drift.push('env_file_written_despite_no_env_file');
2073
- if (!state.storeKeychain && state.keychain?.status && state.keychain.status !== 'skipped')
2074
- drift.push('keychain_touched_despite_no_keychain');
2075
- if (!state.syncLaunchctl && state.codexEnvironment?.launch_environment?.status === 'synced')
2076
- drift.push('launchctl_base_url_synced_despite_no_launchctl');
2077
- if (state.codexEnvironment?.launch_environment?.secret_env_cleanup?.status === 'partial')
2078
- drift.push('launchctl_secret_env_cleanup_incomplete');
2079
- if (state.shellProfile === 'skip' && state.shellProfileResult?.status === 'installed')
2080
- drift.push('shell_profile_written_despite_skip');
2081
- if (state.shellProfile === 'skip' && state.beforeState && state.afterState && state.beforeState.profileHash !== state.afterState.profileHash)
2082
- drift.push('shell_profile_changed_despite_skip');
2083
- return drift;
2084
- }
2085
- async function captureCodexLbSetupWriteState({ home, configPath, envPath, shellProfile } = {}) {
2086
- const profileFiles = profileFilesForDrift(home, shellProfile);
2087
- return {
2088
- configHash: await fileHashOrMissing(configPath),
2089
- envHash: await fileHashOrMissing(envPath),
2090
- profileHash: (await Promise.all(profileFiles.map((file) => fileHashOrMissing(file)))).join('|')
2091
- };
2092
- }
2093
- async function fileHashOrMissing(file) {
2094
- const text = await readText(file, null).catch(() => null);
2095
- return text === null ? 'missing' : await sha256Text(String(text));
2096
- }
2097
- function profileFilesForDrift(home, shellProfile) {
2098
- const targets = {
2099
- zsh: path.join(home, '.zshrc'),
2100
- bash: path.join(home, '.bashrc'),
2101
- fish: path.join(home, '.config', 'fish', 'config.fish')
2102
- };
2103
- if (shellProfile === 'zsh')
2104
- return [targets.zsh];
2105
- if (shellProfile === 'bash')
2106
- return [targets.bash];
2107
- if (shellProfile === 'fish')
2108
- return [targets.fish];
2109
- if (shellProfile === 'all')
2110
- return [targets.zsh, targets.bash, targets.fish];
2111
- return [targets.zsh, targets.bash, targets.fish];
2112
- }
2113
- function appliedCodexLbPersistenceModes(state = {}) {
2114
- const modes = [];
2115
- if (state.writeEnvFile && state.envFile === true)
2116
- modes.push('durable_env_file');
2117
- if (state.storeKeychain && state.keychain?.ok === true)
2118
- modes.push('durable_keychain');
2119
- if (state.syncLaunchctl && state.codexEnvironment?.launch_environment?.status === 'synced')
2120
- modes.push('process_only_ephemeral');
2121
- if (state.shellProfile !== 'skip' && state.shellProfileResult?.status === 'installed')
2122
- modes.push('shell_profile');
2123
- if (!modes.length && state.apiKeySource === 'process.env')
2124
- modes.push('process_only_ephemeral');
2125
- if (!modes.length)
2126
- modes.push('none');
2127
- return modes;
2128
- }
2129
- function shellSingleQuote(value) {
2130
- return `'${String(value).replace(/'/g, `'\\''`)}'`;
2131
- }
2132
- function parseCodexLbEnvKey(text = '') {
2133
- return parseShellEnvValue(text, 'CODEX_LB_API_KEY');
2134
- }
2135
- function parseCodexLbEnvBaseUrl(text = '') {
2136
- const value = parseShellEnvValue(text, 'CODEX_LB_BASE_URL');
2137
- return value ? normalizeCodexLbBaseUrl(value) : '';
2138
- }
2139
- function parseCodexSharedLoginApiKey(text = '') {
2140
- try {
2141
- const parsed = JSON.parse(String(text || ''));
2142
- const authMode = String(parsed?.auth_mode || parsed?.authMode || parsed?.mode || '').toLowerCase();
2143
- const key = parsed?.key || parsed?.api_key || parsed?.apiKey || parsed?.openai_api_key || parsed?.OPENAI_API_KEY;
2144
- if (!key || typeof key !== 'string')
2145
- return '';
2146
- if (authMode && !/api[-_]?key|apikey/.test(authMode))
2147
- return '';
2148
- return key.trim();
2149
- }
2150
- catch {
2151
- return '';
2152
- }
2153
- }
2154
- function parseShellEnvValue(text = '', key = '') {
2155
- const re = new RegExp(`^\\s*(?:export\\s+)?${escapeRegExp(key)}\\s*=\\s*(.+?)\\s*$`, 'm');
2156
- const envMatch = String(text || '').match(re);
2157
- const raw = envMatch?.[1]?.trim() || '';
2158
- if (!raw)
2159
- return '';
2160
- if (raw.startsWith("'"))
2161
- return raw.endsWith("'") && raw.length > 1 ? raw.slice(1, -1).replace(/'\\''/g, "'") : '';
2162
- if (raw.startsWith('"'))
2163
- return raw.endsWith('"') && raw.length > 1 ? raw.slice(1, -1).replace(/\\"/g, '"') : '';
2164
- if (raw.includes("'") || raw.includes('"') || /\s/.test(raw))
2165
- return '';
2166
- return raw;
2167
- }
2168
- function redactSecretText(text = '', secrets = []) {
2169
- let out = String(text || '');
2170
- for (const secret of secrets) {
2171
- const value = String(secret || '');
2172
- if (!value)
2173
- continue;
2174
- out = out.split(value).join('[redacted]');
2175
- }
2176
- return out;
2177
- }
2178
- async function sha256Text(value = '') {
2179
- const { createHash } = await import('node:crypto');
2180
- return createHash('sha256').update(String(value || '')).digest('hex');
2181
- }
1687
+ export { checkContext7, ensureCodexCliTool, ensureMadLaunchDependencies, ensureRelatedCliTools, ensureZellijCliTool, formatMadLaunchDependencyAction, maybePromptCodexUpdateForLaunch, maybePromptSksUpdateForLaunch, shouldAutoApproveInstall } from './install-tool-helpers.js';
1688
+ export { codexFastModeDesktopStatus, ensureGlobalCodexFastModeDuringInstall, normalizeCodexFastModeUiConfig, safeWriteCodexConfigToml } from '../core/codex-runtime/codex-desktop-config-policy.js';
1689
+ export { checkRequiredSkills, context7GlobalMcpStatus, ensureCodexImagegenDuringInstall, ensureGlobalCodexSkillsDuringInstall, ensureProjectContext7Config, ensureSksCommandDuringInstall, globalCodexSkillsRoot, selftestSksShimRepair } from './install-helpers-install-support.js';
1690
+ export { askPostinstallQuestion, codexLbConfigPath, codexLbEnvPath, normalizeCodexLbBaseUrl } from './install-helpers-codex-lb-shared.js';
1691
+ export { ensureGlobalCodexAppGlmProfile, upsertCodexAppGlmConfig, upsertCodexLbConfig } from './install-helpers-codex-lb-config.js';
1692
+ export { checkCodexLbResponseChain } from './install-helpers-codex-lb-chain.js';
1693
+ export { selftestCodexLb } from './install-helpers-codex-lb-selftest.js';
2182
1694
  function escapeRegExp(value) {
2183
1695
  return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
2184
1696
  }
2185
- export async function ensureSksCommandDuringInstall(opts = {}) {
2186
- if (process.env.SKS_SKIP_POSTINSTALL_SHIM === '1' && !opts.force)
2187
- return { status: 'skipped', reason: 'SKS_SKIP_POSTINSTALL_SHIM=1' };
2188
- const pathEnv = opts.pathEnv ?? process.env.PATH ?? '';
2189
- const nodeBin = opts.nodeBin || process.execPath;
2190
- const target = opts.target || packagedSksEntrypoint();
2191
- const repair = await reconcileSksPathShimsDuringInstall({ ...opts, pathEnv, nodeBin, target });
2192
- if (repair.status === 'repaired')
2193
- return { ...repair, command: repair.command || repair.repaired?.[0]?.path || target };
2194
- if (repair.status === 'failed')
2195
- return repair;
2196
- const existing = await findCommandOnPath('sks', pathEnv);
2197
- if (isStableSksBin(existing))
2198
- return { status: 'present', command: existing };
2199
- const dirs = candidateShimDirs(pathEnv, opts.home || process.env.HOME);
2200
- const script = process.platform === 'win32'
2201
- ? `@echo off\r\n"${nodeBin}" "${target}" %*\r\n`
2202
- : `#!/bin/sh\nexec "${nodeBin}" "${target}" "$@"\n`;
2203
- const suffix = process.platform === 'win32' ? '.cmd' : '';
2204
- let createdFallback = null;
2205
- let lastError = '';
2206
- for (const entry of dirs) {
2207
- const dest = path.join(entry.dir, `sks${suffix}`);
2208
- try {
2209
- await ensureDir(entry.dir);
2210
- await writeTextAtomic(dest, script);
2211
- if (process.platform !== 'win32')
2212
- await fsp.chmod(dest, 0o755).catch(() => { });
2213
- if (entry.onPath)
2214
- return { status: 'created', command: dest };
2215
- createdFallback ||= dest;
2216
- }
2217
- catch (err) {
2218
- lastError = err.message;
2219
- }
2220
- }
2221
- if (createdFallback)
2222
- return { status: 'created_not_on_path', command: createdFallback };
2223
- return { status: 'failed', error: lastError };
2224
- }
2225
- export async function selftestSksShimRepair() {
2226
- const staleShimTmp = tmpdir();
2227
- const staleBin = path.join(staleShimTmp, 'old-prefix', 'bin');
2228
- const stalePkg = path.join(staleShimTmp, 'old-prefix', 'lib', 'node_modules', 'sneakoscope');
2229
- await ensureDir(path.join(stalePkg, 'bin'));
2230
- await ensureDir(staleBin);
2231
- await writeTextAtomic(path.join(stalePkg, 'package.json'), JSON.stringify({ name: 'sneakoscope', version: '0.0.1' }, null, 2));
2232
- await writeTextAtomic(path.join(stalePkg, 'bin', 'sks.js'), '#!/usr/bin/env node\nconsole.log("sneakoscope 0.0.1");\n');
2233
- await fsp.chmod(path.join(stalePkg, 'bin', 'sks.js'), 0o755).catch(() => { });
2234
- await fsp.symlink(path.join(stalePkg, 'bin', 'sks.js'), path.join(staleBin, 'sks'));
2235
- const repair = await ensureSksCommandDuringInstall({ force: true, pathEnv: staleBin, home: path.join(staleShimTmp, 'home') });
2236
- if (repair.status !== 'repaired')
2237
- throw new Error(`selftest: stale global sks shim was not repaired (${repair.status})`);
2238
- const run = await runProcess(path.join(staleBin, 'sks'), ['--version'], { timeoutMs: 10000, maxOutputBytes: 16 * 1024 });
2239
- if (run.code !== 0 || !String(run.stdout || '').includes(PACKAGE_VERSION))
2240
- throw new Error('selftest: repaired stale sks shim does not run current package version');
2241
- return { ok: true, repaired: repair.repaired || [] };
2242
- }
2243
- async function reconcileSksPathShimsDuringInstall(opts = {}) {
2244
- if (process.env.SKS_SKIP_POSTINSTALL_SHIM_REPAIR === '1' && !opts.force)
2245
- return { status: 'skipped', reason: 'SKS_SKIP_POSTINSTALL_SHIM_REPAIR=1' };
2246
- const target = opts.target || packagedSksEntrypoint();
2247
- const nodeBin = opts.nodeBin || process.execPath;
2248
- const currentVersion = await installedPackageVersion(packageRoot());
2249
- const commands = await findCommandsOnPath(['sks', 'sneakoscope'], opts.pathEnv ?? process.env.PATH ?? '');
2250
- const repaired = [];
2251
- const failed = [];
2252
- for (const command of commands) {
2253
- const info = await inspectSksPathShim(command.path, { target, currentVersion });
2254
- if (!info.repairable)
2255
- continue;
2256
- const script = process.platform === 'win32'
2257
- ? `@echo off\r\n"${nodeBin}" "${target}" %*\r\n`
2258
- : `#!/bin/sh\nexec "${nodeBin}" "${target}" "$@"\n`;
2259
- try {
2260
- await writeTextAtomic(command.path, script);
2261
- if (process.platform !== 'win32')
2262
- await fsp.chmod(command.path, 0o755).catch(() => { });
2263
- repaired.push({ path: command.path, name: command.name, previous_version: info.version || null, target });
2264
- }
2265
- catch (err) {
2266
- failed.push({ path: command.path, name: command.name, previous_version: info.version || null, error: err.message });
2267
- }
2268
- }
2269
- if (repaired.length)
2270
- return { status: 'repaired', command: repaired[0].path, repaired, failed };
2271
- if (failed.length)
2272
- return { status: 'failed', error: failed.map((entry) => `${entry.path}: ${entry.error}`).join('; '), failed };
2273
- return { status: 'present' };
2274
- }
2275
- async function inspectSksPathShim(candidate, opts = {}) {
2276
- if (!candidate || isTransientNpmBinPath(candidate))
2277
- return { repairable: false, reason: 'transient_or_missing' };
2278
- const target = path.resolve(opts.target || packagedSksEntrypoint());
2279
- const resolved = await fsp.realpath(candidate).catch(() => candidate);
2280
- if (path.resolve(resolved) === target)
2281
- return { repairable: false, reason: 'current_target' };
2282
- const packageDir = sksPackageRootForBin(resolved) || sksPackageRootForBin(candidate);
2283
- if (!packageDir)
2284
- return { repairable: false, reason: 'not_sneakoscope_bin' };
2285
- const version = await installedPackageVersion(packageDir);
2286
- const currentVersion = opts.currentVersion || await installedPackageVersion(packageRoot());
2287
- if (!version || !currentVersion || compareVersions(version, currentVersion) >= 0)
2288
- return { repairable: false, reason: 'not_older', version, current_version: currentVersion };
2289
- return { repairable: true, version, current_version: currentVersion, package_dir: packageDir, resolved };
2290
- }
2291
- function sksPackageRootForBin(file) {
2292
- const normalized = String(file || '').split(path.sep).join('/');
2293
- const marker = '/node_modules/sneakoscope/bin/';
2294
- const idx = normalized.lastIndexOf(marker);
2295
- if (idx < 0)
2296
- return null;
2297
- return normalized.slice(0, idx + '/node_modules/sneakoscope'.length).split('/').join(path.sep);
2298
- }
2299
- async function installedPackageVersion(root) {
2300
- const pkg = await readJsonMaybe(path.join(root, 'package.json'));
2301
- return pkg?.version || (root === packageRoot() ? PACKAGE_VERSION : null);
2302
- }
2303
- async function readJsonMaybe(file) {
2304
- try {
2305
- return JSON.parse(await fsp.readFile(file, 'utf8'));
2306
- }
2307
- catch {
2308
- return null;
2309
- }
2310
- }
2311
- function candidateShimDirs(pathEnv, home) {
2312
- const seen = new Set();
2313
- const out = [];
2314
- for (const raw of String(pathEnv || '').split(path.delimiter).filter(Boolean)) {
2315
- const dir = path.resolve(raw);
2316
- if (seen.has(dir) || isTransientNpmBinPath(dir))
2317
- continue;
2318
- seen.add(dir);
2319
- out.push({ dir, onPath: true });
2320
- }
2321
- for (const raw of [home && path.join(home, '.local', 'bin'), home && path.join(home, 'bin')].filter(Boolean)) {
2322
- const dir = path.resolve(raw);
2323
- if (seen.has(dir))
2324
- continue;
2325
- seen.add(dir);
2326
- out.push({ dir, onPath: false });
2327
- }
2328
- return out;
2329
- }
2330
- async function findCommandOnPath(name, pathEnv) {
2331
- const found = await findCommandsOnPath([name], pathEnv);
2332
- return found[0]?.path || null;
2333
- }
2334
- async function findCommandsOnPath(names, pathEnv) {
2335
- const suffixes = process.platform === 'win32' ? ['.cmd', '.exe', ''] : [''];
2336
- const out = [];
2337
- const seen = new Set();
2338
- for (const dir of String(pathEnv || '').split(path.delimiter).filter(Boolean)) {
2339
- for (const name of names) {
2340
- for (const suffix of suffixes) {
2341
- const candidate = path.join(dir, `${name}${suffix}`);
2342
- const key = path.resolve(candidate);
2343
- if (seen.has(key) || !await exists(candidate))
2344
- continue;
2345
- seen.add(key);
2346
- out.push({ name, path: candidate });
2347
- }
2348
- }
2349
- }
2350
- return out;
2351
- }
2352
- async function ensureGlobalContext7DuringInstall() {
2353
- if (process.env.SKS_SKIP_POSTINSTALL_CONTEXT7 === '1')
2354
- return { status: 'skipped', reason: 'SKS_SKIP_POSTINSTALL_CONTEXT7=1' };
2355
- const codex = await getCodexInfo().catch(() => EMPTY_CODEX_INFO);
2356
- if (!codex.bin)
2357
- return { status: 'codex_missing' };
2358
- const env = withoutSecretEnv(['CODEX_LB_API_KEY']);
2359
- const existing = await context7GlobalMcpStatus(codex.bin, env);
2360
- if (existing.present)
2361
- return { status: 'present' };
2362
- const add = await runProcess(codex.bin, ['mcp', 'add', 'context7', '--', 'npx', '-y', '@upstash/context7-mcp@latest'], { env, timeoutMs: 30000, maxOutputBytes: 64 * 1024 }).catch((err) => ({ code: 1, stdout: '', stderr: err.message }));
2363
- if (add.code === 0)
2364
- return { status: 'installed' };
2365
- return { status: 'failed', error: `${add.stderr || add.stdout || 'codex mcp add failed'}`.trim() };
2366
- }
2367
- export async function context7GlobalMcpStatus(codexBin, env = process.env) {
2368
- const list = await runProcess(codexBin, ['mcp', 'list'], { env, timeoutMs: 8000, maxOutputBytes: 32 * 1024 })
2369
- .catch((err) => ({ code: 1, stderr: err.message, stdout: '' }));
2370
- const output = `${list.stdout || ''}\n${list.stderr || ''}`;
2371
- return {
2372
- checked: true,
2373
- ok: list.code === 0,
2374
- present: list.code === 0 && /context7/i.test(output),
2375
- stdout: list.stdout || '',
2376
- stderr: list.stderr || ''
2377
- };
2378
- }
2379
- function withoutSecretEnv(keys = []) {
2380
- const env = { ...process.env };
2381
- for (const key of keys)
2382
- env[key] = '';
2383
- return env;
2384
- }
2385
- export async function ensureGlobalCodexSkillsDuringInstall(opts = {}) {
2386
- if (process.env.SKS_SKIP_POSTINSTALL_GLOBAL_SKILLS === '1' && !opts.force)
2387
- return { status: 'skipped', reason: 'SKS_SKIP_POSTINSTALL_GLOBAL_SKILLS=1' };
2388
- const home = opts.home || process.env.HOME || os.homedir();
2389
- if (!home)
2390
- return { status: 'skipped', reason: 'home directory unavailable' };
2391
- const root = globalCodexSkillsRoot(home);
2392
- try {
2393
- const install = await installGlobalSkills(home);
2394
- const skills = await checkRequiredSkills(home, root);
2395
- return {
2396
- status: skills.ok ? 'installed' : 'partial',
2397
- root,
2398
- installed_count: install.installed.length,
2399
- removed_aliases: [],
2400
- removed_stale_generated_skills: install.removed,
2401
- missing_skills: skills.missing
2402
- };
2403
- }
2404
- catch (err) {
2405
- return { status: 'failed', root, error: err.message };
2406
- }
2407
- }
2408
- async function ensureGlobalGetdesignSkillDuringInstall() {
2409
- if (process.env.SKS_SKIP_POSTINSTALL_GETDESIGN === '1')
2410
- return { status: 'skipped', reason: 'SKS_SKIP_POSTINSTALL_GETDESIGN=1' };
2411
- const pathEnv = process.env.PATH || '';
2412
- const skillsBin = await findCommandOnPath('skills', pathEnv);
2413
- if (!skillsBin)
2414
- return { status: 'skills_cli_missing', install: GETDESIGN_REFERENCE.codex_skill_install };
2415
- const add = await runProcess(skillsBin, ['add', GETDESIGN_REFERENCE.codex_skill], {
2416
- timeoutMs: 30000,
2417
- maxOutputBytes: 64 * 1024
2418
- }).catch((err) => ({ code: 1, stdout: '', stderr: err.message }));
2419
- const out = `${add.stdout || ''}\n${add.stderr || ''}`;
2420
- if (add.code === 0)
2421
- return { status: /already|exists|present/i.test(out) ? 'present' : 'installed', command: skillsBin };
2422
- if (/already|exists|present/i.test(out))
2423
- return { status: 'present', command: skillsBin };
2424
- return { status: 'failed', command: skillsBin, error: out.trim() || 'skills add failed' };
2425
- }
2426
- export async function ensureCodexImagegenDuringInstall(opts = {}) {
2427
- if (process.env.SKS_POSTINSTALL_SKIP_IMAGEGEN_REPAIR === '1' || opts.skip === true) {
2428
- return { status: 'skipped', reason: 'SKS_POSTINSTALL_SKIP_IMAGEGEN_REPAIR' };
2429
- }
2430
- const report = await repairCodexImagegen({
2431
- root: opts.root || process.cwd(),
2432
- apply: opts.apply !== false,
2433
- codexBin: opts.codexBin || null,
2434
- autoInstallCodex: opts.autoInstallCodex === true || process.env.SKS_IMAGEGEN_AUTO_INSTALL_CODEX === '1'
2435
- }).catch((err) => ({
2436
- recovered: false,
2437
- blockers: [err?.message || String(err)],
2438
- before: null,
2439
- after: null
2440
- }));
2441
- if (report.before?.core_ready === true || (report.after?.core_ready === true && report.attempted === false)) {
2442
- return { status: 'ready', report };
2443
- }
2444
- if (report.recovered === true)
2445
- return { status: 'recovered', report };
2446
- return { status: 'blocked', blockers: report.blockers || ['codex_imagegen_unavailable'], report };
2447
- }
2448
- export async function ensureProjectContext7Config(root, transport = 'local') {
2449
- const configPath = path.join(root, '.codex', 'config.toml');
2450
- await ensureDir(path.dirname(configPath));
2451
- const current = await safeReadText(configPath);
2452
- const block = context7ConfigToml(transport).trim();
2453
- const existingBlock = /(^|\n)\[mcp_servers\.context7\]\n[\s\S]*?(?=\n\[[^\]]+\]|\s*$)/;
2454
- if (existingBlock.test(current)) {
2455
- return false;
2456
- }
2457
- if (hasContext7ConfigText(current))
2458
- return false;
2459
- await writeCodexConfigGuarded({
2460
- root,
2461
- configPath,
2462
- before: current,
2463
- cause: 'context7-project-config',
2464
- mutate: () => `${current.trimEnd()}${current.trim() ? '\n\n' : ''}${block}\n`
2465
- });
2466
- return true;
2467
- }
2468
- export async function checkRequiredSkills(root, skillRoot = root ? path.join(root, '.agents', 'skills') : globalCodexSkillsRoot()) {
2469
- const missing = [];
2470
- for (const name of [...DOLLAR_SKILL_NAMES, ...RECOMMENDED_SKILLS]) {
2471
- if (!(await exists(path.join(skillRoot, name, 'SKILL.md'))))
2472
- missing.push(name);
2473
- }
2474
- return { ok: missing.length === 0, root: skillRoot, missing };
2475
- }
2476
- export function globalCodexSkillsRoot(home = process.env.HOME || os.homedir()) {
2477
- return path.join(home, '.agents', 'skills');
2478
- }
2479
- function isStableSksBin(candidate) {
2480
- return Boolean(candidate) && !isTransientNpmBinPath(candidate);
2481
- }
2482
- function isTransientNpmBinPath(candidate) {
2483
- const normalized = String(candidate || '').split(path.sep).join('/');
2484
- return normalized.includes('/_npx/')
2485
- || normalized.includes('/_cacache/tmp/')
2486
- || /\/npm-cache\/_npx\//.test(normalized)
2487
- || (/\/node_modules\/\.bin\/sks$/.test(normalized) && normalized.includes('/.npm-cache/'));
2488
- }
2489
- async function safeReadText(file, fallback = '') {
2490
- try {
2491
- return await fsp.readFile(file, 'utf8');
2492
- }
2493
- catch {
2494
- return fallback;
2495
- }
2496
- }
2497
- async function codexLbLoginCallCount(home) {
2498
- return (await safeReadText(path.join(home, '.codex', 'login-calls.log'))).trim().split(/\r?\n/).filter(Boolean).length;
2499
- }
2500
- function codexLbPostinstallEnv(baseEnv, overrides = {}) {
2501
- return {
2502
- ...baseEnv,
2503
- SKS_POSTINSTALL_NO_BOOTSTRAP: '1',
2504
- SKS_SKIP_POSTINSTALL_SHIM: '1',
2505
- SKS_SKIP_POSTINSTALL_CONTEXT7: '1',
2506
- SKS_SKIP_POSTINSTALL_GETDESIGN: '1',
2507
- SKS_SKIP_POSTINSTALL_GLOBAL_SKILLS: '1',
2508
- SKS_SKIP_POSTINSTALL_CODEX_LB_AUTH: '0',
2509
- SKS_SKIP_CODEX_LB_LAUNCH_ENV: '1',
2510
- SKS_SKIP_CODEX_APP_UPGRADE_REPAIR: '1',
2511
- ...overrides
2512
- };
2513
- }
2514
- export async function selftestCodexLb(tmp) {
2515
- const codexLbHome = path.join(tmp, 'codex-lb-home');
2516
- await ensureDir(path.join(codexLbHome, '.codex'));
2517
- const codexLbFakeBin = path.join(tmp, 'codex-lb-fake-bin');
2518
- await ensureDir(codexLbFakeBin);
2519
- const codexLbFakeCodex = path.join(codexLbFakeBin, 'codex');
2520
- // NOTE: printf format uses literal double-quotes inside single-quoted shell strings so the
2521
- // fake login writes proper JSON in both bash and dash (where `\"` is a non-standard printf
2522
- // escape that dash emits literally and bash collapses to `"`).
2523
- await writeTextAtomic(codexLbFakeCodex, "#!/bin/sh\nif [ \"$1\" = \"--version\" ]; then echo \"codex-cli 99.0.0\"; exit 0; fi\nif [ \"$1\" = \"login\" ] && [ \"$2\" = \"status\" ]; then echo \"logged in with browser auth\"; exit 0; fi\nif [ \"$1\" = \"login\" ] && [ \"$2\" = \"--with-api-key\" ]; then read key; mkdir -p \"$HOME/.codex\"; printf '{\"auth_mode\":\"apikey\",\"OPENAI_API_KEY\":\"%s\"}\\n' \"$key\" > \"$HOME/.codex/auth.json\"; printf '%s\\n' \"$key\" >> \"$HOME/.codex/login-calls.log\"; exit 0; fi\necho \"fake codex unsupported\" >&2\nexit 1\n");
2524
- await fsp.chmod(codexLbFakeCodex, 0o755);
2525
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), `model_reasoning_effort = "low"\nservice_tier = "fast"\nsuppress_unstable_features_warning = true\n\n[profiles.custom]\nmodel_reasoning_effort = "low"\n\n[notice]\nfast_default_opt_out = true\n\n[features]\nhooks = true\n`);
2526
- const codexLbEnvForSelftest = { HOME: codexLbHome, SKS_GLOBAL_ROOT: path.join(tmp, 'codex-lb-global'), PATH: `${codexLbFakeBin}${path.delimiter}${process.env.PATH || ''}`, SKS_SKIP_CODEX_LB_LAUNCH_ENV: '1', SKS_CODEX_MODEL: 'selftest-codex-model' };
2527
- const codexLbSetup = await runProcess(process.execPath, [packagedSksEntrypoint(), 'codex-lb', 'setup', '--host', 'lb.example.test', '--api-key', 'sk-test', '--json'], {
2528
- cwd: tmp,
2529
- env: codexLbEnvForSelftest,
2530
- timeoutMs: 15000,
2531
- maxOutputBytes: 64 * 1024
2532
- });
2533
- if (codexLbSetup.code !== 0)
2534
- throw new Error(`selftest: codex-lb setup exited ${codexLbSetup.code}: ${codexLbSetup.stderr}`);
2535
- const codexLbSetupJson = JSON.parse(codexLbSetup.stdout);
2536
- const codexLbConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2537
- const codexLbEnv = await safeReadText(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'));
2538
- const codexLbAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2539
- if (!codexLbSetupJson.ok || codexLbSetupJson.base_url !== 'https://lb.example.test/backend-api/codex' || !hasTopLevelCodexLbSelected(codexLbConfig) || !codexLbConfig.includes('[model_providers.codex-lb]') || !codexLbEnv.includes("CODEX_LB_BASE_URL='https://lb.example.test/backend-api/codex'") || !codexLbEnv.includes("CODEX_LB_API_KEY='sk-test'") || codexLbSetupJson.codex_environment?.ok !== true || codexLbSetupJson.codex_login?.status !== 'apikey_forced' || !codexLbAuth.includes('OPENAI_API_KEY') || !codexLbAuth.includes('sk-test'))
2540
- throw new Error('selftest: codex-lb setup');
2541
- if (!codexLbConfig.includes('requires_openai_auth = true') || !codexLbConfig.includes('name = "openai"'))
2542
- throw new Error('selftest: codex-lb setup did not write current codex-lb App provider contract');
2543
- const codexLbFailLaunchctl = path.join(codexLbFakeBin, 'launchctl-fail');
2544
- await writeTextAtomic(codexLbFailLaunchctl, '#!/bin/sh\necho "launchctl denied" >&2\nexit 7\n');
2545
- await fsp.chmod(codexLbFailLaunchctl, 0o755);
2546
- const codexLbFailedLaunchEnv = await configureCodexLb({ home: path.join(tmp, 'codex-lb-launch-fail-home'), host: 'lb.example.test', apiKey: 'sk-fail', forceLaunchEnv: true, launchctlBin: codexLbFailLaunchctl });
2547
- if (codexLbFailedLaunchEnv.ok || codexLbFailedLaunchEnv.status !== 'launch_env_failed' || !/launchctl denied/.test(codexLbFailedLaunchEnv.error || ''))
2548
- throw new Error('selftest: codex-lb setup must expose launch-env failure');
2549
- if (!hasCodexUnstableFeatureWarningSuppression(codexLbConfig))
2550
- throw new Error('selftest: codex-lb setup did not suppress Codex unstable feature warning');
2551
- await initProject(codexLbHome, { installScope: 'global', force: true, repair: true });
2552
- const codexLbRepairSetupConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2553
- if (!hasTopLevelCodexLbSelected(codexLbRepairSetupConfig) || !codexLbRepairSetupConfig.includes('[model_providers.codex-lb]') || !codexLbRepairSetupConfig.includes('https://lb.example.test/backend-api/codex') || codexLbRepairSetupConfig.includes('sk-test'))
2554
- throw new Error('selftest: init codex-lb');
2555
- if (!codexLbRepairSetupConfig.includes('requires_openai_auth = true') || !codexLbRepairSetupConfig.includes('name = "openai"'))
2556
- throw new Error('selftest: init codex-lb did not preserve current App provider contract');
2557
- if (!hasCodexUnstableFeatureWarningSuppression(codexLbRepairSetupConfig))
2558
- throw new Error('selftest: init codex-lb did not suppress Codex unstable feature warning');
2559
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), `${codexLbConfig}\n[mcp_servers.supabase]\nurl = "https://mcp.supabase.com/mcp?project_ref=ref&read_only=true&features=database,docs"\n`);
2560
- const ptmp = path.join(tmp, 'codex-lb-project-config'), prevHome = process.env.HOME;
2561
- try {
2562
- process.env.HOME = codexLbHome;
2563
- await initProject(ptmp, { installScope: 'global' });
2564
- }
2565
- finally {
2566
- if (prevHome === undefined)
2567
- delete process.env.HOME;
2568
- else
2569
- process.env.HOME = prevHome;
2570
- }
2571
- const pcfg = await safeReadText(path.join(ptmp, '.codex', 'config.toml'));
2572
- if (!hasTopLevelCodexLbSelected(pcfg) || !pcfg.includes('[model_providers.codex-lb]') || !pcfg.includes('[mcp_servers.supabase]') || !pcfg.includes('read_only=true'))
2573
- throw new Error('selftest: project codex-lb');
2574
- if (!pcfg.includes('requires_openai_auth = true') || !pcfg.includes('name = "openai"'))
2575
- throw new Error('selftest: project codex-lb did not copy current App provider contract');
2576
- if (!hasCodexUnstableFeatureWarningSuppression(pcfg))
2577
- throw new Error('selftest: project codex-lb config did not suppress Codex unstable feature warning');
2578
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), '{"auth_mode":"browser"}\n');
2579
- const codexLbRepair = await runProcess(process.execPath, [packagedSksEntrypoint(), 'auth', 'repair', '--json'], { cwd: tmp, env: codexLbEnvForSelftest, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2580
- if (codexLbRepair.code !== 0)
2581
- throw new Error(`selftest: codex-lb repair exited ${codexLbRepair.code}: ${codexLbRepair.stderr}`);
2582
- const codexLbRepairJson = JSON.parse(codexLbRepair.stdout);
2583
- const codexLbRepairedAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2584
- if (!codexLbRepairJson.ok || codexLbRepairJson.status !== 'repaired' || codexLbRepairJson.codex_environment?.ok !== true || codexLbRepairJson.codex_login?.status !== 'skipped' || !codexLbRepairedAuth.includes('"auth_mode":"browser"') || codexLbRepairedAuth.includes('sk-test'))
2585
- throw new Error('selftest: codex-lb repair');
2586
- const codexLbLegacyRepair = await runProcess(process.execPath, [packagedSksEntrypoint(), 'auth', 'repair', '--json'], { cwd: tmp, env: { ...codexLbEnvForSelftest, SKS_CODEX_LB_SYNC_CODEX_LOGIN: '1' }, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2587
- if (codexLbLegacyRepair.code !== 0)
2588
- throw new Error(`selftest: codex-lb legacy login repair exited ${codexLbLegacyRepair.code}: ${codexLbLegacyRepair.stderr}`);
2589
- const codexLbLegacyRepairJson = JSON.parse(codexLbLegacyRepair.stdout);
2590
- const codexLbLegacyAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2591
- if (!codexLbLegacyRepairJson.ok || codexLbLegacyRepairJson.codex_login?.status !== 'synced' || !codexLbLegacyAuth.includes('"auth_mode":"apikey"') || !codexLbLegacyAuth.includes('sk-test'))
2592
- throw new Error('selftest: codex-lb legacy login repair');
2593
- const codexLbLoginCallsBeforePostinstall = await codexLbLoginCallCount(codexLbHome);
2594
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), '{"auth_mode":"browser"}\n');
2595
- const codexLbPostinstall = await runProcess(process.execPath, [packagedSksEntrypoint(), 'postinstall'], {
2596
- cwd: tmp,
2597
- env: codexLbPostinstallEnv(codexLbEnvForSelftest),
2598
- timeoutMs: 15000,
2599
- maxOutputBytes: 128 * 1024
2600
- });
2601
- if (codexLbPostinstall.code !== 0)
2602
- throw new Error(`selftest: codex-lb postinstall auth preservation exited ${codexLbPostinstall.code}: ${codexLbPostinstall.stderr}`);
2603
- const codexLbPostinstallAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2604
- const codexLbLoginCallsAfterPostinstall = await codexLbLoginCallCount(codexLbHome);
2605
- if (!String(codexLbPostinstall.stdout || '').includes('codex-lb auth: preserved') || !codexLbPostinstallAuth.includes('"auth_mode":"browser"') || codexLbPostinstallAuth.includes('sk-test') || codexLbLoginCallsAfterPostinstall !== codexLbLoginCallsBeforePostinstall)
2606
- throw new Error('selftest: postinstall auth');
2607
- const postinstallEnvKeys = ['HOME', 'PATH', 'INIT_CWD', 'SKS_GLOBAL_ROOT', 'SKS_POSTINSTALL_BOOTSTRAP', 'SKS_POSTINSTALL_NO_BOOTSTRAP', 'SKS_SKIP_POSTINSTALL_SHIM', 'SKS_SKIP_POSTINSTALL_CONTEXT7', 'SKS_SKIP_POSTINSTALL_GETDESIGN', 'SKS_SKIP_POSTINSTALL_GLOBAL_SKILLS', 'SKS_SKIP_POSTINSTALL_CODEX_LB_AUTH', 'SKS_SKIP_CODEX_LB_LAUNCH_ENV', 'SKS_SKIP_CODEX_APP_UPGRADE_REPAIR', 'SKS_CODEX_LB_SYNC_CODEX_LOGIN'];
2608
- const postinstallEnvBefore = Object.fromEntries(postinstallEnvKeys.map((key) => [key, process.env[key]]));
2609
- const codexLbLoginCallsBeforeBootstrap = await codexLbLoginCallCount(codexLbHome);
2610
- try {
2611
- for (const key of postinstallEnvKeys)
2612
- delete process.env[key];
2613
- Object.assign(process.env, {
2614
- HOME: codexLbHome,
2615
- PATH: `${codexLbFakeBin}${path.delimiter}${postinstallEnvBefore.PATH || ''}`,
2616
- INIT_CWD: tmp,
2617
- SKS_GLOBAL_ROOT: path.join(tmp, 'codex-lb-postinstall-global'),
2618
- SKS_POSTINSTALL_BOOTSTRAP: '1',
2619
- SKS_SKIP_POSTINSTALL_SHIM: '1',
2620
- SKS_SKIP_POSTINSTALL_CONTEXT7: '1',
2621
- SKS_SKIP_POSTINSTALL_GETDESIGN: '1',
2622
- SKS_SKIP_POSTINSTALL_GLOBAL_SKILLS: '1',
2623
- SKS_SKIP_POSTINSTALL_CODEX_LB_AUTH: '0',
2624
- SKS_SKIP_CODEX_LB_LAUNCH_ENV: '1',
2625
- SKS_SKIP_CODEX_APP_UPGRADE_REPAIR: '1'
2626
- });
2627
- await postinstall({
2628
- bootstrap: async () => {
2629
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), '{"auth_mode":"browser"}\n');
2630
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), `service_tier = "fast"\nsuppress_unstable_features_warning = true\n\n[features]\nhooks = true\n`);
2631
- }
2632
- });
2633
- }
2634
- finally {
2635
- for (const key of postinstallEnvKeys) {
2636
- if (postinstallEnvBefore[key] === undefined)
2637
- delete process.env[key];
2638
- else
2639
- process.env[key] = postinstallEnvBefore[key];
2640
- }
2641
- }
2642
- const codexLbPostBootstrapAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2643
- const codexLbPostBootstrapConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2644
- const codexLbLoginCallsAfterBootstrap = await codexLbLoginCallCount(codexLbHome);
2645
- if (!codexLbPostBootstrapAuth.includes('"auth_mode":"browser"') || codexLbPostBootstrapAuth.includes('sk-test') || codexLbLoginCallsAfterBootstrap !== codexLbLoginCallsBeforeBootstrap)
2646
- throw new Error('selftest: postinstall drift auth');
2647
- if (!hasTopLevelCodexLbSelected(codexLbPostBootstrapConfig) || !codexLbPostBootstrapConfig.includes('[model_providers.codex-lb]') || !codexLbPostBootstrapConfig.includes('https://lb.example.test/backend-api/codex') || codexLbPostBootstrapConfig.includes('sk-test'))
2648
- throw new Error('selftest: postinstall drift config');
2649
- if (!codexLbPostBootstrapConfig.includes('requires_openai_auth = true') || !codexLbPostBootstrapConfig.includes('name = "openai"'))
2650
- throw new Error('selftest: postinstall drift config did not restore current App provider contract');
2651
- const doctorProject = tmpdir();
2652
- await ensureDir(path.join(doctorProject, '.git'));
2653
- await writeTextAtomic(path.join(doctorProject, 'package.json'), '{"name":"codex-lb-doctor-project","version":"0.0.0"}\n');
2654
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'), "export CODEX_LB_BASE_URL='https://lb.example.test/backend-api/codex'\nexport CODEX_LB_API_KEY='sk-test'\n");
2655
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), '{"auth_mode":"browser"}\n');
2656
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), `service_tier = "fast"\nsuppress_unstable_features_warning = true\n\n[features]\nhooks = true\n`);
2657
- const codexLbDoctorRepair = await runProcess(process.execPath, [packagedSksEntrypoint(), 'doctor', '--fix', '--json'], {
2658
- cwd: doctorProject,
2659
- env: { ...codexLbEnvForSelftest, SKS_GLOBAL_ROOT: path.join(tmp, 'codex-lb-doctor-global') },
2660
- timeoutMs: 30000,
2661
- maxOutputBytes: 256 * 1024
2662
- });
2663
- if (codexLbDoctorRepair.code !== 0)
2664
- throw new Error(`selftest: doctor --fix codex-lb repair exited ${codexLbDoctorRepair.code}: ${codexLbDoctorRepair.stderr}`);
2665
- const codexLbDoctorJson = JSON.parse(codexLbDoctorRepair.stdout);
2666
- const codexLbDoctorAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2667
- const codexLbDoctorConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2668
- if (!codexLbDoctorJson.repair?.codex_lb?.ok || !codexLbDoctorJson.repair.codex_lb.config_repaired || !codexLbDoctorJson.codex_lb?.ok || !codexLbDoctorAuth.includes('"auth_mode":"browser"') || codexLbDoctorAuth.includes('sk-test') || !hasTopLevelCodexLbSelected(codexLbDoctorConfig) || !codexLbDoctorConfig.includes('https://lb.example.test/backend-api/codex') || !hasCodexUnstableFeatureWarningSuppression(codexLbDoctorConfig))
2669
- throw new Error('selftest: doctor codex-lb');
2670
- if (!codexLbDoctorConfig.includes('requires_openai_auth = true') || !codexLbDoctorConfig.includes('name = "openai"'))
2671
- throw new Error('selftest: doctor codex-lb did not restore current App provider contract');
2672
- // codex-lb auth: ChatGPT OAuth ↔ codex-lb env_key conflict reconciliation.
2673
- const oauthAuthJson = JSON.stringify({
2674
- auth_mode: 'chatgpt',
2675
- tokens: { id_token: 'oauth-id', access_token: 'oauth-access', refresh_token: 'oauth-refresh' },
2676
- last_refresh: '2026-01-01T00:00:00Z'
2677
- });
2678
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), `${oauthAuthJson}\n`);
2679
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'), "export CODEX_LB_BASE_URL='https://lb.example.test/backend-api/codex'\nexport CODEX_LB_API_KEY='sk-test'\n");
2680
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), 'model_provider = "codex-lb"\n\n[model_providers.codex-lb]\nname = "openai"\nbase_url = "https://lb.example.test/backend-api/codex"\nwire_api = "responses"\nenv_key = "CODEX_LB_API_KEY"\nsupports_websockets = true\nrequires_openai_auth = true\n');
2681
- await fsp.rm(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'), { force: true });
2682
- const codexLbReconcileRepair = await runProcess(process.execPath, [packagedSksEntrypoint(), 'auth', 'repair', '--json'], { cwd: tmp, env: codexLbEnvForSelftest, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2683
- if (codexLbReconcileRepair.code !== 0)
2684
- throw new Error(`selftest: codex-lb oauth reconcile repair exited ${codexLbReconcileRepair.code}: ${codexLbReconcileRepair.stderr}`);
2685
- const codexLbReconcileJson = JSON.parse(codexLbReconcileRepair.stdout);
2686
- const codexLbReconcileAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2687
- const codexLbReconcileBackup = await safeReadText(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'));
2688
- if (codexLbReconcileJson.auth_reconcile?.status !== 'oauth_preserved' || !codexLbReconcileAuth.includes('oauth-id') || !codexLbReconcileAuth.includes('oauth-refresh') || codexLbReconcileAuth.includes('sk-test') || !codexLbReconcileBackup.includes('oauth-id') || !codexLbReconcileBackup.includes('oauth-refresh'))
2689
- throw new Error('selftest: codex-lb oauth reconcile should preserve ChatGPT OAuth and back it up');
2690
- // Opt-out path: SKS_CODEX_LB_NO_AUTH_RECONCILE=1 keeps auth.json untouched but still backs up the OAuth blob.
2691
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), `${oauthAuthJson}\n`);
2692
- await fsp.rm(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'), { force: true });
2693
- const codexLbReconcileOptOutRepair = await runProcess(process.execPath, [packagedSksEntrypoint(), 'auth', 'repair', '--json'], { cwd: tmp, env: { ...codexLbEnvForSelftest, SKS_CODEX_LB_NO_AUTH_RECONCILE: '1' }, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2694
- if (codexLbReconcileOptOutRepair.code !== 0)
2695
- throw new Error(`selftest: codex-lb oauth reconcile opt-out repair exited ${codexLbReconcileOptOutRepair.code}: ${codexLbReconcileOptOutRepair.stderr}`);
2696
- const codexLbReconcileOptOutJson = JSON.parse(codexLbReconcileOptOutRepair.stdout);
2697
- const codexLbReconcileOptOutAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2698
- const codexLbReconcileOptOutBackup = await safeReadText(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'));
2699
- if (codexLbReconcileOptOutJson.auth_reconcile?.status !== 'backup_only' || !codexLbReconcileOptOutAuth.includes('oauth-id') || !codexLbReconcileOptOutBackup.includes('oauth-id'))
2700
- throw new Error('selftest: codex-lb oauth reconcile opt-out should back up but not rewrite auth.json');
2701
- // Restore path: older SKS versions could leave the codex-lb API key in auth.json. Repair should
2702
- // restore the ChatGPT OAuth backup while keeping codex-lb selected for provider routing.
2703
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), '{"auth_mode":"apikey","OPENAI_API_KEY":"sk-test"}\n');
2704
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'), `${oauthAuthJson}\n`);
2705
- const codexLbReconcileRestoreRepair = await runProcess(process.execPath, [packagedSksEntrypoint(), 'auth', 'repair', '--json'], { cwd: tmp, env: codexLbEnvForSelftest, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2706
- if (codexLbReconcileRestoreRepair.code !== 0)
2707
- throw new Error(`selftest: codex-lb oauth restore repair exited ${codexLbReconcileRestoreRepair.code}: ${codexLbReconcileRestoreRepair.stderr}`);
2708
- const codexLbReconcileRestoreJson = JSON.parse(codexLbReconcileRestoreRepair.stdout);
2709
- const codexLbReconcileRestoreAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2710
- const codexLbReconcileRestoreConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2711
- if (codexLbReconcileRestoreJson.auth_reconcile?.status !== 'oauth_restored' || !codexLbReconcileRestoreAuth.includes('oauth-id') || codexLbReconcileRestoreAuth.includes('sk-test') || !hasTopLevelCodexLbSelected(codexLbReconcileRestoreConfig))
2712
- throw new Error('selftest: codex-lb oauth restore should replace apikey auth.json with ChatGPT OAuth backup while keeping codex-lb selected');
2713
- // codex-lb auth: release flow — restore ChatGPT OAuth from backup so the user can return to
2714
- // the official ChatGPT account login. Default deselects model_provider; flags control whether
2715
- // the provider stays selected and whether the backup file is removed after restore.
2716
- const codexLbReleaseConfig = 'model_provider = "codex-lb"\n\n[model_providers.codex-lb]\nname = "openai"\nbase_url = "https://lb.example.test/backend-api/codex"\nwire_api = "responses"\nenv_key = "CODEX_LB_API_KEY"\nsupports_websockets = true\nrequires_openai_auth = true\n';
2717
- const codexLbReleaseEnv = "export CODEX_LB_BASE_URL='https://lb.example.test/backend-api/codex'\nexport CODEX_LB_API_KEY='sk-test'\n";
2718
- const codexLbReleaseApikeyAuth = '{"auth_mode":"apikey","OPENAI_API_KEY":"sk-test"}\n';
2719
- const codexLbReleaseOauthBackup = `${oauthAuthJson}\n`;
2720
- // Happy path: deselect model_provider and preserve backup file.
2721
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), codexLbReleaseApikeyAuth);
2722
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'), codexLbReleaseOauthBackup);
2723
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'), codexLbReleaseEnv);
2724
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), codexLbReleaseConfig);
2725
- const codexLbReleaseRun = await runProcess(process.execPath, [packagedSksEntrypoint(), 'codex-lb', 'release', '--json'], { cwd: tmp, env: codexLbEnvForSelftest, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2726
- if (codexLbReleaseRun.code !== 0)
2727
- throw new Error(`selftest: codex-lb release exited ${codexLbReleaseRun.code}: ${codexLbReleaseRun.stderr}`);
2728
- const codexLbReleaseJson = JSON.parse(codexLbReleaseRun.stdout);
2729
- const codexLbReleaseAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2730
- const codexLbReleaseBackupAfter = await safeReadText(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'));
2731
- const codexLbReleaseConfigAfter = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2732
- if (codexLbReleaseJson.status !== 'released' || codexLbReleaseJson.provider_unselected !== true || codexLbReleaseJson.backup_removed !== false || !codexLbReleaseAuth.includes('oauth-id') || !codexLbReleaseAuth.includes('oauth-refresh') || codexLbReleaseAuth.includes('apikey') || !codexLbReleaseBackupAfter.includes('oauth-id') || hasTopLevelCodexLbSelected(codexLbReleaseConfigAfter))
2733
- throw new Error('selftest: codex-lb release happy path did not restore OAuth, preserve backup, and deselect model_provider');
2734
- // --keep-provider: restore auth.json but leave model_provider = "codex-lb" alone.
2735
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), codexLbReleaseApikeyAuth);
2736
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'), codexLbReleaseOauthBackup);
2737
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), codexLbReleaseConfig);
2738
- const codexLbReleaseKeepRun = await runProcess(process.execPath, [packagedSksEntrypoint(), 'codex-lb', 'release', '--keep-provider', '--json'], { cwd: tmp, env: codexLbEnvForSelftest, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2739
- if (codexLbReleaseKeepRun.code !== 0)
2740
- throw new Error(`selftest: codex-lb release --keep-provider exited ${codexLbReleaseKeepRun.code}: ${codexLbReleaseKeepRun.stderr}`);
2741
- const codexLbReleaseKeepJson = JSON.parse(codexLbReleaseKeepRun.stdout);
2742
- const codexLbReleaseKeepConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2743
- if (codexLbReleaseKeepJson.status !== 'released' || codexLbReleaseKeepJson.provider_unselected !== false || !hasTopLevelCodexLbSelected(codexLbReleaseKeepConfig))
2744
- throw new Error('selftest: codex-lb release --keep-provider should leave model_provider = "codex-lb" intact');
2745
- // --delete-backup: restore auth.json and remove the backup file.
2746
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), codexLbReleaseApikeyAuth);
2747
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'), codexLbReleaseOauthBackup);
2748
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), codexLbReleaseConfig);
2749
- const codexLbReleaseDeleteRun = await runProcess(process.execPath, [packagedSksEntrypoint(), 'codex-lb', 'release', '--delete-backup', '--json'], { cwd: tmp, env: codexLbEnvForSelftest, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2750
- if (codexLbReleaseDeleteRun.code !== 0)
2751
- throw new Error(`selftest: codex-lb release --delete-backup exited ${codexLbReleaseDeleteRun.code}: ${codexLbReleaseDeleteRun.stderr}`);
2752
- const codexLbReleaseDeleteJson = JSON.parse(codexLbReleaseDeleteRun.stdout);
2753
- const codexLbReleaseDeleteBackupExists = await exists(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'));
2754
- if (codexLbReleaseDeleteJson.status !== 'released' || codexLbReleaseDeleteJson.backup_removed !== true || codexLbReleaseDeleteBackupExists)
2755
- throw new Error('selftest: codex-lb release --delete-backup should remove the backup file after restore');
2756
- // No backup: release should refuse and exit 1.
2757
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), codexLbReleaseApikeyAuth);
2758
- await fsp.rm(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'), { force: true });
2759
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), codexLbReleaseConfig);
2760
- const codexLbReleaseMissingRun = await runProcess(process.execPath, [packagedSksEntrypoint(), 'codex-lb', 'release', '--json'], { cwd: tmp, env: codexLbEnvForSelftest, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2761
- const codexLbReleaseMissingJson = JSON.parse(codexLbReleaseMissingRun.stdout || '{}');
2762
- const codexLbReleaseMissingAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2763
- if (codexLbReleaseMissingRun.code === 0 || codexLbReleaseMissingJson.status !== 'no_backup' || !codexLbReleaseMissingAuth.includes('apikey'))
2764
- throw new Error('selftest: codex-lb release with no backup should exit non-zero and report no_backup without touching auth.json');
2765
- // unselect: flip model_provider off without touching auth.json or env file.
2766
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), codexLbReleaseApikeyAuth);
2767
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), codexLbReleaseConfig);
2768
- const codexLbUnselectRun = await runProcess(process.execPath, [packagedSksEntrypoint(), 'codex-lb', 'unselect', '--json'], { cwd: tmp, env: codexLbEnvForSelftest, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2769
- if (codexLbUnselectRun.code !== 0)
2770
- throw new Error(`selftest: codex-lb unselect exited ${codexLbUnselectRun.code}: ${codexLbUnselectRun.stderr}`);
2771
- const codexLbUnselectJson = JSON.parse(codexLbUnselectRun.stdout);
2772
- const codexLbUnselectConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2773
- const codexLbUnselectAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2774
- if (codexLbUnselectJson.status !== 'unselected' || hasTopLevelCodexLbSelected(codexLbUnselectConfig) || !codexLbUnselectConfig.includes('[model_providers.codex-lb]') || !codexLbUnselectAuth.includes('apikey'))
2775
- throw new Error('selftest: codex-lb unselect should drop model_provider but preserve [model_providers.codex-lb] and auth.json');
2776
- // Restore the doctor-test auth.json shape so downstream selftest assertions still hold.
2777
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), '{"auth_mode":"browser"}\n');
2778
- await fsp.rm(path.join(codexLbHome, '.codex', 'auth.chatgpt-backup.json'), { force: true });
2779
- const codexLbContext7Bin = path.join(tmp, 'codex-lb-context7-bin');
2780
- await ensureDir(codexLbContext7Bin);
2781
- await writeTextAtomic(path.join(codexLbContext7Bin, 'codex'), '#!/bin/sh\nif [ "$1" = "--version" ]; then echo "codex-cli 99.0.0"; exit 0; fi\nif [ "$CODEX_LB_API_KEY" ]; then echo "context7 leaked CODEX_LB_API_KEY" >&2; exit 77; fi\nif [ "$1" = "mcp" ] && [ "$2" = "list" ]; then echo ""; exit 0; fi\nif [ "$1" = "mcp" ] && [ "$2" = "add" ]; then echo "context7 added"; exit 0; fi\necho "unexpected codex $*" >&2\nexit 2\n');
2782
- await fsp.chmod(path.join(codexLbContext7Bin, 'codex'), 0o755);
2783
- const codexLbContext7Postinstall = await runProcess(process.execPath, [packagedSksEntrypoint(), 'postinstall'], {
2784
- cwd: tmp,
2785
- env: {
2786
- ...codexLbEnvForSelftest,
2787
- PATH: `${codexLbContext7Bin}${path.delimiter}${process.env.PATH || ''}`,
2788
- CODEX_LB_API_KEY: 'sk-test',
2789
- SKS_POSTINSTALL_NO_BOOTSTRAP: '1',
2790
- SKS_SKIP_POSTINSTALL_SHIM: '1',
2791
- SKS_SKIP_POSTINSTALL_GETDESIGN: '1',
2792
- SKS_SKIP_POSTINSTALL_GLOBAL_SKILLS: '1',
2793
- SKS_SKIP_POSTINSTALL_CODEX_LB_AUTH: '1'
2794
- },
2795
- timeoutMs: 15000,
2796
- maxOutputBytes: 128 * 1024
2797
- });
2798
- if (codexLbContext7Postinstall.code !== 0 || String(`${codexLbContext7Postinstall.stdout}\n${codexLbContext7Postinstall.stderr}`).includes('leaked CODEX_LB_API_KEY'))
2799
- throw new Error('selftest: Context7 key leak');
2800
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'), "export CODEX_LB_API_KEY='unterminated\n");
2801
- const codexLbLoginCallsBeforeMalformed = await codexLbLoginCallCount(codexLbHome);
2802
- const codexLbMalformedPostinstall = await runProcess(process.execPath, [packagedSksEntrypoint(), 'postinstall'], {
2803
- cwd: tmp,
2804
- env: codexLbPostinstallEnv(codexLbEnvForSelftest),
2805
- timeoutMs: 15000,
2806
- maxOutputBytes: 128 * 1024
2807
- });
2808
- const codexLbLoginCallsAfterMalformed = await codexLbLoginCallCount(codexLbHome);
2809
- if (codexLbMalformedPostinstall.code !== 0 || !String(codexLbMalformedPostinstall.stdout || '').includes('codex-lb auth: stored key missing') || codexLbLoginCallsAfterMalformed !== codexLbLoginCallsBeforeMalformed)
2810
- throw new Error('selftest: bad codex-lb env');
2811
- await fsp.rm(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'), { force: true });
2812
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), '[model_providers.codex-lb]\nname = "openai"\nbase_url = "https://lb.example.test/backend-api/codex"\nwire_api = "responses"\nsupports_websockets = true\nrequires_openai_auth = true\n');
2813
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), '{"auth_mode":"apikey","key":"sk-legacy"}\n');
2814
- const codexLbLoginCallsBeforeLegacyPostinstall = await codexLbLoginCallCount(codexLbHome);
2815
- const codexLbLegacyPostinstall = await runProcess(process.execPath, [packagedSksEntrypoint(), 'postinstall'], {
2816
- cwd: tmp,
2817
- env: codexLbPostinstallEnv(codexLbEnvForSelftest),
2818
- timeoutMs: 15000,
2819
- maxOutputBytes: 128 * 1024
2820
- });
2821
- if (codexLbLegacyPostinstall.code !== 0)
2822
- throw new Error(`selftest: legacy codex-lb postinstall restore exited ${codexLbLegacyPostinstall.code}: ${codexLbLegacyPostinstall.stderr}`);
2823
- const codexLbLegacyPostinstallEnv = await safeReadText(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'));
2824
- const codexLbLegacyPostinstallAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2825
- const codexLbLoginCallsAfterLegacyPostinstall = await codexLbLoginCallCount(codexLbHome);
2826
- if (!String(codexLbLegacyPostinstall.stdout || '').includes('codex-lb auth: restored from existing Codex login cache') || !codexLbLegacyPostinstallEnv.includes("CODEX_LB_API_KEY='sk-legacy'") || !codexLbLegacyPostinstallEnv.includes("CODEX_LB_BASE_URL='https://lb.example.test/backend-api/codex'") || !codexLbLegacyPostinstallAuth.includes('"auth_mode":"apikey"') || !codexLbLegacyPostinstallAuth.includes('sk-legacy') || codexLbLoginCallsAfterLegacyPostinstall !== codexLbLoginCallsBeforeLegacyPostinstall)
2827
- throw new Error('selftest: legacy codex-lb postinstall restore');
2828
- await fsp.rm(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'), { force: true });
2829
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), 'model_provider = "codex-lb"\n\n[model_providers.codex-lb]\nname = "openai"\nbase_url = "https://lb.example.test/backend-api/codex"\nwire_api = "responses"\nsupports_websockets = true\nrequires_openai_auth = true\n');
2830
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), '{"auth_mode":"apikey","key":"sk-legacy-doctor"}\n');
2831
- const codexLbLegacyDoctorProject = tmpdir();
2832
- await ensureDir(path.join(codexLbLegacyDoctorProject, '.git'));
2833
- await writeTextAtomic(path.join(codexLbLegacyDoctorProject, 'package.json'), '{"name":"codex-lb-legacy-doctor-project","version":"0.0.0"}\n');
2834
- const codexLbLegacyDoctorRepair = await runProcess(process.execPath, [packagedSksEntrypoint(), 'doctor', '--fix', '--json'], {
2835
- cwd: codexLbLegacyDoctorProject,
2836
- env: { ...codexLbEnvForSelftest, SKS_GLOBAL_ROOT: path.join(tmp, 'codex-lb-legacy-doctor-global'), SKS_SKIP_CODEX_LB_LAUNCH_ENV: '1' },
2837
- timeoutMs: 30000,
2838
- maxOutputBytes: 256 * 1024
2839
- });
2840
- if (codexLbLegacyDoctorRepair.code !== 0)
2841
- throw new Error(`selftest: legacy doctor --fix codex-lb restore exited ${codexLbLegacyDoctorRepair.code}: ${codexLbLegacyDoctorRepair.stderr}`);
2842
- const codexLbLegacyDoctorJson = JSON.parse(codexLbLegacyDoctorRepair.stdout);
2843
- const codexLbLegacyDoctorEnv = await safeReadText(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'));
2844
- const codexLbLegacyDoctorConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2845
- const codexLbLegacyDoctorAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2846
- if (!codexLbLegacyDoctorJson.repair?.codex_lb?.ok || !codexLbLegacyDoctorJson.repair.codex_lb.legacy_auth_migrated || !codexLbLegacyDoctorEnv.includes("CODEX_LB_API_KEY='sk-legacy-doctor'") || !codexLbLegacyDoctorAuth.includes('"auth_mode":"apikey"') || !codexLbLegacyDoctorAuth.includes('sk-legacy-doctor') || !hasTopLevelCodexLbSelected(codexLbLegacyDoctorConfig) || !codexLbLegacyDoctorConfig.includes('env_key = "CODEX_LB_API_KEY"'))
2847
- throw new Error('selftest: legacy doctor codex-lb restore');
2848
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'), "export CODEX_LB_BASE_URL='https://lb.example.test/backend-api/codex'\n");
2849
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), 'service_tier = "fast"\n');
2850
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), '{"auth_mode":"apikey","key":"sk-env-only"}\n');
2851
- const codexLbLoginCallsBeforeEnvOnlyPostinstall = await codexLbLoginCallCount(codexLbHome);
2852
- const codexLbEnvOnlyPostinstall = await runProcess(process.execPath, [packagedSksEntrypoint(), 'postinstall'], {
2853
- cwd: tmp,
2854
- env: codexLbPostinstallEnv(codexLbEnvForSelftest),
2855
- timeoutMs: 15000,
2856
- maxOutputBytes: 128 * 1024
2857
- });
2858
- if (codexLbEnvOnlyPostinstall.code !== 0)
2859
- throw new Error(`selftest: env-only codex-lb postinstall restore exited ${codexLbEnvOnlyPostinstall.code}: ${codexLbEnvOnlyPostinstall.stderr}`);
2860
- const codexLbEnvOnlyPostinstallEnv = await safeReadText(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'));
2861
- const codexLbEnvOnlyPostinstallConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2862
- const codexLbEnvOnlyPostinstallAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2863
- const codexLbLoginCallsAfterEnvOnlyPostinstall = await codexLbLoginCallCount(codexLbHome);
2864
- if (!String(codexLbEnvOnlyPostinstall.stdout || '').includes('codex-lb auth: restored from existing Codex login cache') || !codexLbEnvOnlyPostinstallEnv.includes("CODEX_LB_API_KEY='sk-env-only'") || !codexLbEnvOnlyPostinstallConfig.includes('env_key = "CODEX_LB_API_KEY"') || !hasTopLevelCodexLbSelected(codexLbEnvOnlyPostinstallConfig) || !codexLbEnvOnlyPostinstallAuth.includes('sk-env-only') || codexLbLoginCallsAfterEnvOnlyPostinstall !== codexLbLoginCallsBeforeEnvOnlyPostinstall)
2865
- throw new Error('selftest: env-only codex-lb postinstall restore');
2866
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'), "export CODEX_LB_BASE_URL='https://lb.example.test/backend-api/codex'\n");
2867
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), 'service_tier = "fast"\n');
2868
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'auth.json'), '{"auth_mode":"apikey","key":"sk-env-only-doctor"}\n');
2869
- const codexLbEnvOnlyDoctorProject = tmpdir();
2870
- await ensureDir(path.join(codexLbEnvOnlyDoctorProject, '.git'));
2871
- await writeTextAtomic(path.join(codexLbEnvOnlyDoctorProject, 'package.json'), '{"name":"codex-lb-env-only-doctor-project","version":"0.0.0"}\n');
2872
- const codexLbEnvOnlyDoctorRepair = await runProcess(process.execPath, [packagedSksEntrypoint(), 'doctor', '--fix', '--json'], {
2873
- cwd: codexLbEnvOnlyDoctorProject,
2874
- env: { ...codexLbEnvForSelftest, SKS_GLOBAL_ROOT: path.join(tmp, 'codex-lb-env-only-doctor-global'), SKS_SKIP_CODEX_LB_LAUNCH_ENV: '1' },
2875
- timeoutMs: 30000,
2876
- maxOutputBytes: 256 * 1024
2877
- });
2878
- if (codexLbEnvOnlyDoctorRepair.code !== 0)
2879
- throw new Error(`selftest: env-only doctor --fix codex-lb restore exited ${codexLbEnvOnlyDoctorRepair.code}: ${codexLbEnvOnlyDoctorRepair.stderr}`);
2880
- const codexLbEnvOnlyDoctorJson = JSON.parse(codexLbEnvOnlyDoctorRepair.stdout);
2881
- const codexLbEnvOnlyDoctorEnv = await safeReadText(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'));
2882
- const codexLbEnvOnlyDoctorConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
2883
- const codexLbEnvOnlyDoctorAuth = await safeReadText(path.join(codexLbHome, '.codex', 'auth.json'));
2884
- if (!codexLbEnvOnlyDoctorJson.repair?.codex_lb?.ok || !codexLbEnvOnlyDoctorJson.repair.codex_lb.legacy_auth_migrated || !codexLbEnvOnlyDoctorEnv.includes("CODEX_LB_API_KEY='sk-env-only-doctor'") || !codexLbEnvOnlyDoctorConfig.includes('env_key = "CODEX_LB_API_KEY"') || !hasTopLevelCodexLbSelected(codexLbEnvOnlyDoctorConfig) || !codexLbEnvOnlyDoctorAuth.includes('sk-env-only-doctor'))
2885
- throw new Error('selftest: env-only doctor codex-lb restore');
2886
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'), "export CODEX_LB_API_KEY='sk-test'\n");
2887
- const codexLbMissingCli = await runProcess(process.execPath, [packagedSksEntrypoint(), 'postinstall'], {
2888
- cwd: tmp,
2889
- env: {
2890
- HOME: codexLbHome,
2891
- SKS_GLOBAL_ROOT: path.join(tmp, 'codex-lb-missing-cli-global'),
2892
- PATH: '',
2893
- SKS_POSTINSTALL_NO_BOOTSTRAP: '1',
2894
- SKS_SKIP_POSTINSTALL_SHIM: '1',
2895
- SKS_SKIP_POSTINSTALL_CONTEXT7: '1',
2896
- SKS_SKIP_POSTINSTALL_GETDESIGN: '1',
2897
- SKS_SKIP_POSTINSTALL_GLOBAL_SKILLS: '1',
2898
- SKS_SKIP_POSTINSTALL_CODEX_LB_AUTH: '0',
2899
- SKS_SKIP_CODEX_LB_LAUNCH_ENV: '1'
2900
- },
2901
- timeoutMs: 15000,
2902
- maxOutputBytes: 128 * 1024
2903
- });
2904
- if (codexLbMissingCli.code !== 0 || !String(codexLbMissingCli.stdout || '').includes('codex-lb auth: preserved') || String(codexLbMissingCli.stdout || '').includes('codex_missing'))
2905
- throw new Error('selftest: codex-lb provider auth should not require Codex CLI login');
2906
- const codexLbNotConfiguredHome = path.join(tmp, 'codex-lb-not-configured-home');
2907
- const codexLbNotConfigured = await runProcess(process.execPath, [packagedSksEntrypoint(), 'postinstall'], {
2908
- cwd: tmp,
2909
- env: {
2910
- HOME: codexLbNotConfiguredHome,
2911
- SKS_GLOBAL_ROOT: path.join(tmp, 'codex-lb-not-configured-global'),
2912
- PATH: '',
2913
- SKS_POSTINSTALL_NO_BOOTSTRAP: '1',
2914
- SKS_SKIP_POSTINSTALL_SHIM: '1',
2915
- SKS_SKIP_POSTINSTALL_CONTEXT7: '1',
2916
- SKS_SKIP_POSTINSTALL_GETDESIGN: '1',
2917
- SKS_SKIP_POSTINSTALL_GLOBAL_SKILLS: '1',
2918
- SKS_SKIP_POSTINSTALL_CODEX_LB_AUTH: '0'
2919
- },
2920
- timeoutMs: 15000,
2921
- maxOutputBytes: 128 * 1024
2922
- });
2923
- if (codexLbNotConfigured.code !== 0 || String(codexLbNotConfigured.stdout || '').includes('codex-lb auth:'))
2924
- throw new Error('selftest: postinstall should stay quiet when codex-lb is not configured');
2925
- const codexLbStatusText = await runProcess(process.execPath, [packagedSksEntrypoint(), 'codex-lb', 'status'], { cwd: tmp, env: codexLbEnvForSelftest, timeoutMs: 15000, maxOutputBytes: 64 * 1024 });
2926
- if (!String(codexLbStatusText.stdout || '').includes('Codex App auth:') || !String(codexLbStatusText.stdout || '').includes('sks codex-lb repair'))
2927
- throw new Error('selftest: codex-lb status did not advertise App auth state and repair command');
2928
- const nonInteractiveLaunchChainCalls = [];
2929
- const nonInteractiveLaunch = await maybePromptCodexLbSetupForLaunch([], {
2930
- home: codexLbHome,
2931
- apiKey: 'sk-test',
2932
- codexBin: path.join(codexLbFakeBin, 'codex'),
2933
- syncLaunchEnv: false,
2934
- timeoutMs: 1000,
2935
- fetch: async (url, init) => {
2936
- nonInteractiveLaunchChainCalls.push({ url, body: JSON.parse(init.body) });
2937
- return new Response(JSON.stringify({ id: nonInteractiveLaunchChainCalls.length === 1 ? 'resp_noninteractive_1' : 'resp_noninteractive_2' }), { status: 200, headers: { 'content-type': 'application/json' } });
2938
- }
2939
- });
2940
- if (!nonInteractiveLaunch.ok || nonInteractiveLaunch.status !== 'present' || nonInteractiveLaunch.chain_health?.status !== 'chain_ok' || nonInteractiveLaunchChainCalls.length !== 2 || nonInteractiveLaunchChainCalls[1].body.previous_response_id !== 'resp_noninteractive_1')
2941
- throw new Error('selftest: non-interactive codex-lb launch path did not run response-chain preflight');
2942
- const nonInteractiveBrokenLaunch = (await maybePromptCodexLbSetupForLaunch([], {
2943
- home: codexLbHome,
2944
- apiKey: 'sk-test',
2945
- codexBin: path.join(codexLbFakeBin, 'codex'),
2946
- syncLaunchEnv: false,
2947
- timeoutMs: 1000,
2948
- fetch: async (_url, init) => {
2949
- const body = JSON.parse(init.body);
2950
- if (!body.previous_response_id)
2951
- return new Response(JSON.stringify({ id: 'resp_noninteractive_broken' }), { status: 200, headers: { 'content-type': 'application/json' } });
2952
- return new Response(JSON.stringify({ error: { type: 'invalid_request_error', code: 'previous_response_not_found', message: 'Previous response not found.', param: 'previous_response_id' } }), { status: 400, headers: { 'content-type': 'application/json' } });
2953
- }
2954
- }));
2955
- if (nonInteractiveBrokenLaunch.status !== 'present' || nonInteractiveBrokenLaunch.bypass_codex_lb === true || nonInteractiveBrokenLaunch.chain_health?.status !== 'previous_response_not_found')
2956
- throw new Error('selftest: previous_response_not_found should keep codex-lb active (stateless LB is normal), not silently bypass to ChatGPT OAuth');
2957
- // Hard chain failure (e.g. 500) in non-interactive context should still keep codex-lb by default — the user explicitly configured it, so don't silently swap providers.
2958
- const hardBrokenLaunchCalls = [];
2959
- const hardBrokenLaunch = (await maybePromptCodexLbSetupForLaunch([], {
2960
- home: codexLbHome,
2961
- apiKey: 'sk-test',
2962
- codexBin: path.join(codexLbFakeBin, 'codex'),
2963
- syncLaunchEnv: false,
2964
- timeoutMs: 1000,
2965
- fetch: async (_url, init) => {
2966
- hardBrokenLaunchCalls.push({ body: JSON.parse(init.body) });
2967
- if (!hardBrokenLaunchCalls[hardBrokenLaunchCalls.length - 1].body.previous_response_id)
2968
- return new Response(JSON.stringify({ id: 'resp_hardbroken_first' }), { status: 200, headers: { 'content-type': 'application/json' } });
2969
- return new Response(JSON.stringify({ error: { type: 'server_error', code: 'internal_error', message: 'simulated upstream failure' } }), { status: 500, headers: { 'content-type': 'application/json' } });
2970
- }
2971
- }));
2972
- if (hardBrokenLaunch.status !== 'present' || hardBrokenLaunch.bypass_codex_lb === true || hardBrokenLaunch.chain_health?.status !== 'second_request_failed')
2973
- throw new Error('selftest: hard codex-lb chain failure in non-interactive launch should default to keeping codex-lb active, not silently bypass');
2974
- // SKS_CODEX_LB_AUTOBYPASS=1 restores the old silent-bypass behavior for CI/automation.
2975
- process.env.SKS_CODEX_LB_AUTOBYPASS = '1';
2976
- let autobypassLaunch;
2977
- try {
2978
- autobypassLaunch = (await maybePromptCodexLbSetupForLaunch([], {
2979
- home: codexLbHome,
2980
- apiKey: 'sk-test',
2981
- codexBin: path.join(codexLbFakeBin, 'codex'),
2982
- syncLaunchEnv: false,
2983
- timeoutMs: 1000,
2984
- fetch: async (_url, init) => {
2985
- const body = JSON.parse(init.body);
2986
- if (!body.previous_response_id)
2987
- return new Response(JSON.stringify({ id: 'resp_autobypass_first' }), { status: 200, headers: { 'content-type': 'application/json' } });
2988
- return new Response(JSON.stringify({ error: { type: 'server_error', code: 'internal_error', message: 'simulated upstream failure' } }), { status: 500, headers: { 'content-type': 'application/json' } });
2989
- }
2990
- }));
2991
- }
2992
- finally {
2993
- delete process.env.SKS_CODEX_LB_AUTOBYPASS;
2994
- }
2995
- if (autobypassLaunch.status !== 'chain_unhealthy' || autobypassLaunch.bypass_codex_lb !== true || autobypassLaunch.chain_health?.status !== 'second_request_failed')
2996
- throw new Error('selftest: SKS_CODEX_LB_AUTOBYPASS=1 should bypass codex-lb on hard chain failure');
2997
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'config.toml'), 'service_tier = "fast"\n');
2998
- await writeTextAtomic(path.join(codexLbHome, '.codex', 'sks-codex-lb.env'), "export CODEX_LB_BASE_URL='https://lb.example.test/backend-api/codex'\nexport CODEX_LB_API_KEY='sk-test'\n");
2999
- const missingProviderLaunchCalls = [];
3000
- const missingProviderLaunch = await maybePromptCodexLbSetupForLaunch([], {
3001
- home: codexLbHome,
3002
- apiKey: 'sk-test',
3003
- codexBin: path.join(codexLbFakeBin, 'codex'),
3004
- syncLaunchEnv: false,
3005
- timeoutMs: 1000,
3006
- fetch: async (url, init) => {
3007
- missingProviderLaunchCalls.push({ url, body: JSON.parse(init.body) });
3008
- return new Response(JSON.stringify({ id: missingProviderLaunchCalls.length === 1 ? 'resp_missing_provider_1' : 'resp_missing_provider_2' }), { status: 200, headers: { 'content-type': 'application/json' } });
3009
- }
3010
- });
3011
- const missingProviderRepairedConfig = await safeReadText(path.join(codexLbHome, '.codex', 'config.toml'));
3012
- if (!missingProviderLaunch.ok || missingProviderLaunch.status !== 'present' || missingProviderLaunch.chain_health?.status !== 'chain_ok' || missingProviderLaunchCalls.length !== 2 || !hasTopLevelCodexLbSelected(missingProviderRepairedConfig) || !missingProviderRepairedConfig.includes('[model_providers.codex-lb]') || !missingProviderRepairedConfig.includes('env_key = "CODEX_LB_API_KEY"') || !missingProviderRepairedConfig.includes('supports_websockets = true') || !missingProviderRepairedConfig.includes('requires_openai_auth = true') || !missingProviderRepairedConfig.includes('name = "openai"'))
3013
- throw new Error('selftest: bare sks launch did not restore codex-lb provider block to current App contract');
3014
- const chainCalls = [];
3015
- const okChain = await checkCodexLbResponseChain({ base_url: 'https://lb.example.test/backend-api/codex', env_path: path.join(codexLbHome, '.codex', 'sks-codex-lb.env') }, {
3016
- apiKey: 'sk-test',
3017
- timeoutMs: 1000,
3018
- fetch: async (url, init) => {
3019
- chainCalls.push({ url, body: JSON.parse(init.body) });
3020
- return new Response(JSON.stringify({ id: chainCalls.length === 1 ? 'resp_selftest_1' : 'resp_selftest_2' }), { status: 200, headers: { 'content-type': 'application/json' } });
3021
- }
3022
- });
3023
- if (!okChain.ok || okChain.status !== 'chain_ok' || chainCalls.length !== 2 || !String(chainCalls[0].url).endsWith('/backend-api/codex/responses') || chainCalls[1].body.previous_response_id !== 'resp_selftest_1')
3024
- throw new Error('selftest: codex-lb response chain health check did not verify previous_response_id continuity');
3025
- const previousGlobalFetch = globalThis.fetch;
3026
- const cacheCalls = [];
3027
- const cachePath = path.join(codexLbHome, '.codex', 'chain-cache-selftest.json');
3028
- try {
3029
- globalThis.fetch = async (url, init) => {
3030
- cacheCalls.push({ url, body: JSON.parse(init.body) });
3031
- return new Response(JSON.stringify({ id: cacheCalls.length === 1 ? 'resp_cache_1' : 'resp_cache_2' }), { status: 200, headers: { 'content-type': 'application/json' } });
3032
- };
3033
- const cacheStatus = { base_url: 'https://cache.example.test/backend-api/codex', env_path: path.join(codexLbHome, '.codex', 'sks-codex-lb.env') };
3034
- const firstCache = await checkCodexLbResponseChain(cacheStatus, { home: codexLbHome, apiKey: 'sk-test', timeoutMs: 1000, cachePath, now: () => 1000 });
3035
- const secondCache = await checkCodexLbResponseChain(cacheStatus, { home: codexLbHome, apiKey: 'sk-test', timeoutMs: 1000, cachePath, now: () => 2000 });
3036
- if (!firstCache.ok || firstCache.status !== 'chain_ok' || secondCache.cached !== true || secondCache.status !== 'chain_ok' || cacheCalls.length !== 2)
3037
- throw new Error('selftest: codex-lb response chain cache did not avoid repeated launch preflight calls');
3038
- }
3039
- finally {
3040
- globalThis.fetch = previousGlobalFetch;
3041
- }
3042
- const brokenChain = await checkCodexLbResponseChain({ base_url: 'https://lb.example.test/backend-api/codex', env_path: path.join(codexLbHome, '.codex', 'sks-codex-lb.env') }, {
3043
- apiKey: 'sk-test',
3044
- timeoutMs: 1000,
3045
- fetch: async (_url, init) => {
3046
- const body = JSON.parse(init.body);
3047
- if (!body.previous_response_id)
3048
- return new Response(JSON.stringify({ id: 'resp_missing_selftest' }), { status: 200, headers: { 'content-type': 'application/json' } });
3049
- return new Response(JSON.stringify({ error: { type: 'invalid_request_error', code: 'previous_response_not_found', message: 'Previous response not found.', param: 'previous_response_id' } }), { status: 400, headers: { 'content-type': 'application/json' } });
3050
- }
3051
- });
3052
- if (brokenChain.ok || brokenChain.status !== 'previous_response_not_found' || brokenChain.chain_unhealthy !== true)
3053
- throw new Error('selftest: codex-lb response chain health check did not detect previous_response_not_found');
3054
- // 0.144 contract: removed feature stamps and legacy fast profile tables are
3055
- // stripped, while stable Computer Use/Browser/ImageGen/plugin flags remain.
3056
- const legacyStamps = ['remote_control = true', 'fast_mode_ui = true', 'codex_git_commit = true', '[user.fast_mode]', '[profiles.sks-fast-high]', 'fast_default_opt_out = true'];
3057
- const survivingLegacy = legacyStamps.filter((stamp) => codexLbConfig.includes(stamp));
3058
- const stableCapabilityStamps = ['computer_use = true', 'browser_use = true', 'browser_use_external = true', 'image_generation = true', 'in_app_browser = true', 'guardian_approval = true', 'tool_suggest = true', 'plugins = true'];
3059
- const missingStableCapabilities = stableCapabilityStamps.filter((stamp) => !codexLbConfig.includes(stamp));
3060
- if (!codexLbConfig.includes('hooks = true') || hasDeprecatedCodexHooksFeatureFlag(codexLbConfig) || !codexLbConfig.includes('multi_agent = true') || !codexLbConfig.includes('fast_mode = true') || !codexLbConfig.includes('apps = true') || survivingLegacy.length || missingStableCapabilities.length || !/\[profiles\.custom\][\s\S]*?model_reasoning_effort = "low"/.test(codexLbConfig) || hasTopLevelCodexModeLock(codexLbConfig))
3061
- throw new Error(`selftest: codex-lb setup did not enforce the current feature-flag contract${survivingLegacy.length ? ` — surviving legacy stamps: ${survivingLegacy.join(', ')}` : ''}${missingStableCapabilities.length ? ` — missing stable capabilities: ${missingStableCapabilities.join(', ')}` : ''}`);
3062
- if (!hasCodexUnstableFeatureWarningSuppression(codexLbConfig))
3063
- throw new Error('selftest: codex-lb setup did not suppress Codex unstable feature warning');
3064
- const codexLbLaunch = `source ${path.join(tmp, '.codex', 'sks-codex-lb.env')} && codex`;
3065
- if (!codexLbLaunch.includes('sks-codex-lb.env'))
3066
- throw new Error('selftest: Zellij launch command does not source codex-lb env file');
3067
- if (codexLbLaunch.includes('--model'))
3068
- throw new Error('selftest: Zellij launch command without an explicit model must inherit the Codex selection');
3069
- const madLaunchSource = await safeReadText(path.join(packageRoot(), 'src', 'core', 'commands', 'mad-sks-command.js'));
3070
- if (!madLaunchSource.includes('const lb = await deps.maybePromptCodexLbSetupForLaunch(args)') || !madLaunchSource.includes("const launchLb = lb.status === 'present'") || !madLaunchSource.includes('codexLbImmediateLaunchOpts(cleanArgs, launchLb') || !madLaunchSource.includes('bypass_codex_lb') || !madLaunchSource.includes('model_provider="openai"') || !madLaunchSource.includes('codexLbFreshSession: true'))
3071
- throw new Error('selftest: MAD launch does not sync codex-lb auth and fresh-session launch options');
3072
- }
3073
- //# sourceMappingURL=install-helpers.js.map