sneakoscope 8.0.2 → 8.0.4

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 (376) hide show
  1. package/README.md +150 -37
  2. package/config/skills-hash-ledger.v1.json +1 -1
  3. package/crates/sks-core/Cargo.lock +1 -1
  4. package/crates/sks-core/Cargo.toml +1 -1
  5. package/dist/bin/fast-inline.js +55 -27
  6. package/dist/bin/install.js +6 -32
  7. package/dist/bin/sks-dispatch.js +1 -1
  8. package/dist/cli/args.js +0 -2
  9. package/dist/cli/cli-theme.js +18 -9
  10. package/dist/cli/command-manifest-lite.js +6 -6
  11. package/dist/cli/command-registry.js +6 -6
  12. package/dist/cli/feature-commands.js +9 -7
  13. package/dist/cli/install-helpers-codex-lb-chain.js +198 -7
  14. package/dist/cli/install-helpers-codex-lb-config.js +78 -10
  15. package/dist/cli/install-helpers-install-support.js +9 -6
  16. package/dist/cli/install-helpers.js +101 -49
  17. package/dist/cli/install-tool-helpers.js +2 -82
  18. package/dist/cli/output.js +6 -1
  19. package/dist/cli/router.js +101 -2
  20. package/dist/commands/codex-lb.js +119 -19
  21. package/dist/commands/doctor-profile.js +1 -1
  22. package/dist/commands/doctor.js +727 -144
  23. package/dist/commands/mad-sks.js +1 -5
  24. package/dist/config/skills-manifest.json +4 -2
  25. package/dist/core/agents/agent-codex-cockpit.js +0 -3
  26. package/dist/core/agents/agent-effort-policy.js +5 -5
  27. package/dist/core/agents/agent-janitor.js +0 -20
  28. package/dist/core/agents/agent-orchestrator.js +9 -56
  29. package/dist/core/agents/agent-output-validator.js +2 -3
  30. package/dist/core/agents/agent-patch-schema.js +2 -2
  31. package/dist/core/agents/agent-proof-evidence.js +0 -65
  32. package/dist/core/agents/agent-recursion-guard.js +1 -1
  33. package/dist/core/agents/agent-runner-codex-exec.js +5 -3
  34. package/dist/core/agents/agent-scheduler.js +327 -85
  35. package/dist/core/agents/agent-schema.js +1 -1
  36. package/dist/core/agents/agent-trust-report.js +0 -36
  37. package/dist/core/agents/agent-worker-pipeline.js +0 -1
  38. package/dist/core/agents/fast-mode-policy.js +1 -3
  39. package/dist/core/agents/native-cli-worker-runtime-proof.js +1 -1
  40. package/dist/core/agents/native-cli-worker-runtime.js +69 -647
  41. package/dist/core/agents/native-cli-worker.js +6 -7
  42. package/dist/core/agents/native-worker-backend-router.js +2 -32
  43. package/dist/core/agents/no-subagent-scaling-policy.js +1 -1
  44. package/dist/core/agents/parallel-runtime-proof.js +1 -6
  45. package/dist/core/agents/runtime-proof-summary.js +1 -35
  46. package/dist/core/architecture-hardening/contracts/contracts.js +193 -0
  47. package/dist/core/architecture-hardening/migration/migration.js +111 -0
  48. package/dist/core/architecture-hardening/state/state-service.js +155 -0
  49. package/dist/core/artifact-schemas.js +0 -3
  50. package/dist/core/codex/codex-config-guard.js +238 -52
  51. package/dist/core/codex-adapter.js +5 -3
  52. package/dist/core/codex-app/auxiliary-oauth-policy.js +36 -0
  53. package/dist/core/codex-app/catalog-compat/catalog-service.js +104 -0
  54. package/dist/core/codex-app/child-policy/child-policy.js +35 -0
  55. package/dist/core/codex-app/codex-app-handoff.js +0 -1
  56. package/dist/core/codex-app/codex-hook-lifecycle.js +1 -1
  57. package/dist/core/codex-app/codex-init-deep.js +1 -1
  58. package/dist/core/codex-app/menubar/app-bundle.js +2 -0
  59. package/dist/core/codex-app/menubar/constants.js +14 -1
  60. package/dist/core/codex-app/menubar/global-install.js +288 -0
  61. package/dist/core/codex-app/menubar/installer.js +79 -14
  62. package/dist/core/codex-app/menubar/launch-agent.js +267 -45
  63. package/dist/core/codex-app/menubar/paths.js +3 -0
  64. package/dist/core/codex-app/menubar/rollback.js +55 -7
  65. package/dist/core/codex-app/menubar/status.js +75 -4
  66. package/dist/core/codex-app/provider-child-policy.js +64 -0
  67. package/dist/core/codex-app/provider-mode.js +91 -0
  68. package/dist/core/codex-app/provider-operation-stages.js +20 -0
  69. package/dist/core/codex-app/provider-session-policy.js +85 -0
  70. package/dist/core/codex-app/session-policy/session-pinning.js +68 -0
  71. package/dist/core/codex-app.js +3 -2
  72. package/dist/core/codex-control/codex-0139-image-path-real-probe.js +3 -1
  73. package/dist/core/codex-control/codex-0139-web-search-probe.js +3 -1
  74. package/dist/core/codex-control/codex-app-server-runtime-env.js +13 -4
  75. package/dist/core/codex-control/codex-app-server-v2-client.js +3 -3
  76. package/dist/core/codex-control/codex-control-proof.js +0 -1
  77. package/dist/core/codex-control/codex-task-runner.js +1 -4
  78. package/dist/core/codex-exec-output-schema.js +4 -1
  79. package/dist/core/codex-lb/codex-lb-env.js +63 -72
  80. package/dist/core/codex-lb/codex-lb-setup.js +15 -2
  81. package/dist/core/codex-lb/desktop-bridge/header-policy.js +6 -0
  82. package/dist/core/codex-lb/desktop-bridge/http-forward.js +48 -6
  83. package/dist/core/codex-lb/desktop-bridge/security.js +134 -0
  84. package/dist/core/codex-lb/desktop-bridge/server.js +9 -3
  85. package/dist/core/codex-lb/desktop-bridge/state.js +26 -6
  86. package/dist/core/codex-lb/desktop-bridge/types.js +1 -0
  87. package/dist/core/codex-lb/desktop-center-credentials.js +517 -58
  88. package/dist/core/codex-lb/desktop-controller.js +177 -56
  89. package/dist/core/codex-lb/desktop-service.js +179 -40
  90. package/dist/core/codex-lb/legacy-migration.js +1 -3
  91. package/dist/core/codex-lb/native-openai-transport/transport.js +68 -0
  92. package/dist/core/codex-lb/probes/cli-image-tool-probe.js +1 -1
  93. package/dist/core/codex-lb/provider-routing/provider-router.js +58 -0
  94. package/dist/core/codex-lb/routing-truth.js +327 -0
  95. package/dist/core/codex-native/codex-native-feature-broker.js +4 -0
  96. package/dist/core/codex-native/codex-native-pattern-analysis.js +1 -2
  97. package/dist/core/codex-native/core-skill-manifest.js +1 -1
  98. package/dist/core/codex-plugins/codex-plugin-json.js +26 -6
  99. package/dist/core/codex-plugins/codex-plugin-repair.js +32 -6
  100. package/dist/core/commands/basic-cli.js +9 -7
  101. package/dist/core/commands/computer-use-command.js +1 -1
  102. package/dist/core/commands/image-ux-review-command.js +16 -9
  103. package/dist/core/commands/install-package-command.js +105 -0
  104. package/dist/core/commands/intent-normalization/normalizer.js +96 -0
  105. package/dist/core/commands/mad-sks-command.js +23 -274
  106. package/dist/core/commands/mad-sks-headless.js +11 -30
  107. package/dist/core/commands/naruto-command.js +0 -25
  108. package/dist/core/commands/qa-loop-command.js +104 -22
  109. package/dist/core/commands/remote-command.js +2 -2
  110. package/dist/core/commands/research-command.js +10 -5
  111. package/dist/core/commands/telegram-command.js +407 -0
  112. package/dist/core/config-adopt/config-adopt-command.js +35 -0
  113. package/dist/core/config-adopt/config-adopt.js +346 -0
  114. package/dist/core/config-adopt/index.js +3 -0
  115. package/dist/core/doctor/command-alias-cleanup.js +4 -1
  116. package/dist/core/doctor/current-project-guidance-nested.js +37 -6
  117. package/dist/core/doctor/current-project-guidance.js +15 -9
  118. package/dist/core/doctor/doctor-dirty-planner.js +1 -4
  119. package/dist/core/doctor/doctor-readiness-matrix.js +15 -18
  120. package/dist/core/doctor/retired-managed-residue-private.js +4 -3
  121. package/dist/core/doctor/retired-managed-residue-runtime.js +2 -2
  122. package/dist/core/doctor/skill-legacy-surface.js +11 -10
  123. package/dist/core/doctor/sks-menubar-doctor.js +4 -0
  124. package/dist/core/evaluation.js +0 -19
  125. package/dist/core/evidence/v2/evidence-key.js +105 -0
  126. package/dist/core/feature-fixtures.js +12 -7
  127. package/dist/core/feature-registry.js +52 -21
  128. package/dist/core/hooks-runtime/hook-context.js +9 -0
  129. package/dist/core/hooks-runtime/managed-skill-admission.js +54 -4
  130. package/dist/core/hooks-runtime/official-subagent-lifecycle.js +69 -52
  131. package/dist/core/hooks-runtime/stop-finalization.js +226 -0
  132. package/dist/core/hooks-runtime/stop-repeat-guard.js +21 -2
  133. package/dist/core/hooks-runtime/subagent-skill-availability-contract.js +2 -2
  134. package/dist/core/hooks-runtime/subagent-skill-availability-evidence.js +3 -3
  135. package/dist/core/hooks-runtime/subagent-skill-availability-guards.js +43 -5
  136. package/dist/core/hooks-runtime/subagent-skill-availability.js +64 -30
  137. package/dist/core/hooks-runtime/subagent-stop-hook.js +15 -2
  138. package/dist/core/hooks-runtime.js +179 -212
  139. package/dist/core/image/reference-evidence/reference-registry.js +145 -0
  140. package/dist/core/image-ux-review/imagegen-adapter.js +21 -9
  141. package/dist/core/image-ux-review/reference-policy/reference-policy.js +9 -0
  142. package/dist/core/imagegen/codex-lb-imagegen-target.js +8 -0
  143. package/dist/core/imagegen/imagegen-capability.js +59 -2
  144. package/dist/core/imagegen/require-imagegen.js +2 -2
  145. package/dist/core/init/skills.js +17 -3
  146. package/dist/core/init.js +3 -3
  147. package/dist/core/install/installed-package-smoke.js +23 -5
  148. package/dist/core/json/canonical.js +9 -0
  149. package/dist/core/locks/file-lock.js +0 -1
  150. package/dist/core/loops/loop-continuation-enforcer.js +65 -7
  151. package/dist/core/loops/loop-decomposer.js +0 -1
  152. package/dist/core/loops/loop-gate-runner.js +65 -4
  153. package/dist/core/loops/loop-gate-selector.js +0 -2
  154. package/dist/core/loops/loop-proof-validation.js +38 -0
  155. package/dist/core/loops/loop-risk-classifier.js +1 -1
  156. package/dist/core/loops/loop-runtime.js +14 -2
  157. package/dist/core/loops/loop-scheduler.js +7 -2
  158. package/dist/core/loops/loop-worker-runtime.js +0 -15
  159. package/dist/core/loops/loop-worktree-runtime.js +52 -4
  160. package/dist/core/managed-assets/managed-assets-manifest.js +14 -14
  161. package/dist/core/naruto/hardware-capacity-probe.js +9 -6
  162. package/dist/core/naruto/naruto-active-pool.js +2 -14
  163. package/dist/core/naruto/naruto-concurrency-governor.js +71 -31
  164. package/dist/core/naruto/naruto-loop-worker-router.js +0 -2
  165. package/dist/core/naruto/naruto-verification-dag.js +0 -1
  166. package/dist/core/naruto/naruto-write-e2e.js +1 -2
  167. package/dist/core/naruto/resource-pressure-monitor.js +0 -4
  168. package/dist/core/observability/architecture-hardening/safe-projection.js +65 -0
  169. package/dist/core/perf/import-graph-budget.js +0 -1
  170. package/dist/core/perf/release-latency-slo.js +3 -2
  171. package/dist/core/preflight/parallel-preflight-engine.js +2 -15
  172. package/dist/core/product-design-app-server.js +13 -1
  173. package/dist/core/proof/fake-real-proof-policy.js +2 -17
  174. package/dist/core/proof/route-proof-gate.js +2 -10
  175. package/dist/core/proof/route-proof-policy.js +1 -1
  176. package/dist/core/proof/runtime-evidence-policy.js +185 -0
  177. package/dist/core/proof/runtime-truth-matrix.js +64 -39
  178. package/dist/core/proof/validation.js +27 -11
  179. package/dist/core/provider/provider-context.js +18 -2
  180. package/dist/core/providers/openrouter/openrouter-account.js +3 -2
  181. package/dist/core/python-tools/python-tool-runner.js +1 -1
  182. package/dist/core/qa-loop/qa-execution-control.js +57 -0
  183. package/dist/core/questions.js +1 -1
  184. package/dist/core/release/extreme-parallel-scheduler.js +0 -3
  185. package/dist/core/release/gate-manifest.js +3 -7
  186. package/dist/core/release/gate-pack-manifest.js +3 -7
  187. package/dist/core/release/package-size-budget.js +2 -2
  188. package/dist/core/release/physical-release-gates.js +189 -0
  189. package/dist/core/release/publish-preflight.js +113 -0
  190. package/dist/core/release/release-gate-affected-selector.js +0 -2
  191. package/dist/core/release/release-gate-batch-runner.js +1 -1
  192. package/dist/core/release/release-gate-node.js +0 -1
  193. package/dist/core/release/release-gate-resource-governor.js +0 -1
  194. package/dist/core/release/release-pack-receipt.js +5 -8
  195. package/dist/core/release/release-real-contract.js +0 -6
  196. package/dist/core/release/resource-class-budget.js +0 -1
  197. package/dist/core/release/stage-publish.js +178 -36
  198. package/dist/core/research/research-adversarial-review.js +103 -9
  199. package/dist/core/research.js +1 -1
  200. package/dist/core/retention.js +0 -1
  201. package/dist/core/routes/constants.js +1 -1
  202. package/dist/core/routes/diagnostic-allowlist.js +0 -1
  203. package/dist/core/routes/dollar-manifest-lite.js +1 -1
  204. package/dist/core/routes.js +46 -15
  205. package/dist/core/runtime/execution-control.js +226 -0
  206. package/dist/core/runtime/progress-recovery/progress-recovery.js +89 -0
  207. package/dist/core/runtime/task-profile.js +10 -4
  208. package/dist/core/runtime/verification-budget.js +10 -1
  209. package/dist/core/safety/intent-contract/intent-contract.js +94 -0
  210. package/dist/core/safety/mutation-guard.js +0 -2
  211. package/dist/core/safety/mutation-ledger.js +0 -2
  212. package/dist/core/safety/requested-scope-contract.js +0 -0
  213. package/dist/core/search-visibility/discovery.js +1 -1
  214. package/dist/core/search-visibility/index.js +12 -0
  215. package/dist/core/search-visibility/verifier.js +112 -3
  216. package/dist/core/security/private-credential-file.js +209 -0
  217. package/dist/core/session/project-namespace.js +0 -5
  218. package/dist/core/skills/skill-agent-metadata.js +1 -3
  219. package/dist/core/strategy/adhd-orchestrating-gate.js +0 -1
  220. package/dist/core/subagents/agent-catalog.js +19 -34
  221. package/dist/core/subagents/model-policy.js +65 -24
  222. package/dist/core/subagents/naruto-help-contract.js +8 -8
  223. package/dist/core/subagents/naruto-host-credentials.js +13 -0
  224. package/dist/core/subagents/official-subagent-config.js +16 -6
  225. package/dist/core/subagents/official-subagent-preparation.js +35 -16
  226. package/dist/core/subagents/official-subagent-prompt.js +7 -7
  227. package/dist/core/subagents/official-subagent-runner.js +27 -4
  228. package/dist/core/subagents/role-model-preferences.js +1 -1
  229. package/dist/core/subagents/thread-budget.js +19 -12
  230. package/dist/core/subagents/wave-lifecycle.js +18 -6
  231. package/dist/core/telegram/access.js +58 -0
  232. package/dist/core/telegram/client.js +157 -0
  233. package/dist/core/telegram/confirmation.js +37 -0
  234. package/dist/core/telegram/doctor.js +154 -0
  235. package/dist/core/telegram/index.js +9 -0
  236. package/dist/core/telegram/keychain.js +317 -0
  237. package/dist/core/telegram/liveness.js +118 -0
  238. package/dist/core/telegram/poller.js +90 -0
  239. package/dist/core/telegram/redaction.js +15 -0
  240. package/dist/core/telegram/state-lock.js +416 -0
  241. package/dist/core/telegram/types.js +1 -0
  242. package/dist/core/text/strings.js +3 -0
  243. package/dist/core/triwiki/context-graph/store/evidence-write-lock.js +29 -0
  244. package/dist/core/triwiki/context-graph/store/fragment-cache.js +24 -0
  245. package/dist/core/triwiki/context-graph/store/snapshot-store.js +69 -21
  246. package/dist/core/triwiki/triwiki-gate-impact-map.js +2 -2
  247. package/dist/core/triwiki/triwiki-module-card.js +1 -2
  248. package/dist/core/update/installed-cli-resolution.js +170 -0
  249. package/dist/core/update/update-diagnostics.js +52 -0
  250. package/dist/core/update/update-migration-state.js +30 -12
  251. package/dist/core/update/update-operation.js +2 -1
  252. package/dist/core/update/update-stage-diagnostics.js +38 -0
  253. package/dist/core/update/update-status.js +2 -9
  254. package/dist/core/update-check.js +279 -91
  255. package/dist/core/version.js +1 -1
  256. package/dist/native/sks-menubar/Sources/AppDelegate.swift +19 -1
  257. package/dist/native/sks-menubar/Sources/AppIdentity.swift +7 -0
  258. package/dist/native/sks-menubar/Sources/ControlCenterWindowController.swift +6 -2
  259. package/dist/native/sks-menubar/Sources/OperationCoordinator.swift +159 -92
  260. package/dist/native/sks-menubar/Sources/OperationModels.swift +389 -0
  261. package/dist/native/sks-menubar/Sources/OverviewViewController.swift +57 -0
  262. package/dist/native/sks-menubar/Sources/ProcessClient.swift +3 -1
  263. package/dist/native/sks-menubar/Sources/ProvidersConnectTest.swift +115 -0
  264. package/dist/native/sks-menubar/Sources/ProvidersFastMode.swift +17 -0
  265. package/dist/native/sks-menubar/Sources/ProvidersMultiProvider.swift +3 -0
  266. package/dist/native/sks-menubar/Sources/ProvidersOpenRouter.swift +58 -17
  267. package/dist/native/sks-menubar/Sources/ProvidersReliability.swift +302 -0
  268. package/dist/native/sks-menubar/Sources/ProvidersRoleModels.swift +5 -0
  269. package/dist/native/sks-menubar/Sources/ProvidersRoutingTruth.swift +190 -0
  270. package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +158 -126
  271. package/dist/native/sks-menubar/Sources/RemoteCodingViewController.swift +462 -26
  272. package/dist/native/sks-menubar/Sources/SKSKeychainStore.swift +344 -0
  273. package/dist/native/sks-menubar/Sources/SecureProcessEnvelope.swift +27 -0
  274. package/dist/native/sks-menubar/Sources/SingletonInstanceGuard.swift +328 -0
  275. package/dist/native/sks-menubar/Sources/StatusItemController.swift +10 -2
  276. package/dist/native/sks-menubar/Sources/TelegramPrivateFileStore.swift +498 -0
  277. package/dist/native/sks-menubar/Sources/TelegramPrivateFileSupport.swift +236 -0
  278. package/dist/native/sks-menubar/Sources/TelegramProcessGateway.swift +454 -0
  279. package/dist/native/sks-menubar/Sources/TelegramRuntimeSupport.swift +56 -0
  280. package/dist/native/sks-menubar/Sources/TelegramStateLock.swift +448 -0
  281. package/dist/native/sks-menubar/Sources/TelegramSupport.swift +187 -0
  282. package/dist/native/sks-menubar/Sources/TelegramTransport.swift +499 -0
  283. package/dist/native/sks-menubar/Sources/main.swift +15 -1
  284. package/dist/scripts/all-feature-deep-completion-check.js +5 -1
  285. package/dist/scripts/check-publish-tag.js +56 -0
  286. package/dist/scripts/codex-lb-fast-mode-truth-check.js +10 -3
  287. package/dist/scripts/codex-lb-fast-ui-preservation-check.js +12 -3
  288. package/dist/scripts/codex-lb-gpt56-fast-profile-check.js +4 -2
  289. package/dist/scripts/codex-native-agent-role-content-check.js +3 -3
  290. package/dist/scripts/codex-native-gate-lib.js +14 -7
  291. package/dist/scripts/current-command-surface-check.js +7 -7
  292. package/dist/scripts/current-surface-update-e2e-check.js +4 -3
  293. package/dist/scripts/current-upgrade-matrix-check.js +5 -24
  294. package/dist/scripts/docs-truthfulness-check.js +17 -13
  295. package/dist/scripts/gate-lib.js +0 -2
  296. package/dist/scripts/gate-policy-audit-check.js +3 -2
  297. package/dist/scripts/harness-benchmark-check.js +1 -1
  298. package/dist/scripts/init-deep-backup-retention-check.js +1 -1
  299. package/dist/scripts/lib/codex-sdk-gate-lib.js +1 -2
  300. package/dist/scripts/loop-directive-check-lib.js +28 -38
  301. package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +14 -180
  302. package/dist/scripts/mad-sks-launch-sql-plane-boundary-check.js +2 -11
  303. package/dist/scripts/official-subagent-workflow-check.js +1 -1
  304. package/dist/scripts/packlist-performance-check.js +1 -2
  305. package/dist/scripts/prepublish-release-check-or-fast.js +32 -0
  306. package/dist/scripts/publish-preflight.js +12 -0
  307. package/dist/scripts/release-affected-selector-check.js +2 -2
  308. package/dist/scripts/release-gate-batch-runner-check.js +2 -2
  309. package/dist/scripts/release-metadata-check.js +8 -12
  310. package/dist/scripts/release-real-check.js +2 -54
  311. package/dist/scripts/runtime-domain-gate-lib.js +2 -96
  312. package/dist/scripts/runtime-proof-summary-check.js +2 -6
  313. package/dist/scripts/search-visibility-gate-lib.js +0 -1
  314. package/dist/scripts/sks-cli-gate-lib.js +1 -1
  315. package/dist/scripts/typed-routing-gate-lib.js +7 -59
  316. package/docs/demo.tape +1 -1
  317. package/infra-harness-gates.json +1 -1456
  318. package/package.json +10 -7
  319. package/release-gates.v2.json +0 -1
  320. package/schemas/agents/parallel-runtime-proof.schema.json +0 -2
  321. package/schemas/codex/agent-result.schema.json +0 -6
  322. package/schemas/naruto/naruto-concurrency-governor.schema.json +1 -3
  323. package/schemas/release/release-gate-node.schema.json +1 -1
  324. package/dist/commands/zellij-lane.js +0 -22
  325. package/dist/commands/zellij-monitor-pane.js +0 -26
  326. package/dist/commands/zellij-slot-column-anchor.js +0 -22
  327. package/dist/commands/zellij-slot-pane.js +0 -80
  328. package/dist/commands/zellij-viewport-pane.js +0 -57
  329. package/dist/commands/zellij.js +0 -422
  330. package/dist/core/agents/agent-runner-zellij.js +0 -164
  331. package/dist/core/agents/agent-slot-pane-binding-proof.js +0 -96
  332. package/dist/core/agents/parallel-write-fixture.js +0 -305
  333. package/dist/core/agents/worker-pane-communication-contract.js +0 -100
  334. package/dist/core/agents/zellij-lane-supervisor.js +0 -428
  335. package/dist/core/agents/zellij-right-lane-cockpit.js +0 -66
  336. package/dist/core/doctor/doctor-zellij-repair.js +0 -40
  337. package/dist/core/ops/upgrade-migration-fixtures.js +0 -119
  338. package/dist/core/proof/route-finalizer-fixtures.js +0 -21
  339. package/dist/core/zellij/homebrew-policy.js +0 -43
  340. package/dist/core/zellij/zellij-capability.js +0 -126
  341. package/dist/core/zellij/zellij-clipboard-config.js +0 -52
  342. package/dist/core/zellij/zellij-command.js +0 -149
  343. package/dist/core/zellij/zellij-fake-adapter.js +0 -186
  344. package/dist/core/zellij/zellij-lane-renderer.js +0 -706
  345. package/dist/core/zellij/zellij-lane-runtime.js +0 -189
  346. package/dist/core/zellij/zellij-launcher.js +0 -268
  347. package/dist/core/zellij/zellij-layout-builder.js +0 -191
  348. package/dist/core/zellij/zellij-monitor-renderer.js +0 -52
  349. package/dist/core/zellij/zellij-official-subagent-activity.js +0 -526
  350. package/dist/core/zellij/zellij-official-subagent-telemetry.js +0 -258
  351. package/dist/core/zellij/zellij-pane-proof.js +0 -226
  352. package/dist/core/zellij/zellij-right-column-manager.js +0 -308
  353. package/dist/core/zellij/zellij-screen-proof.js +0 -120
  354. package/dist/core/zellij/zellij-self-heal-types.js +0 -44
  355. package/dist/core/zellij/zellij-self-heal.js +0 -408
  356. package/dist/core/zellij/zellij-slot-column-anchor.js +0 -304
  357. package/dist/core/zellij/zellij-slot-pane-renderer.js +0 -521
  358. package/dist/core/zellij/zellij-slot-telemetry.js +0 -384
  359. package/dist/core/zellij/zellij-theme.js +0 -66
  360. package/dist/core/zellij/zellij-ui-mode.js +0 -34
  361. package/dist/core/zellij/zellij-update.js +0 -348
  362. package/dist/core/zellij/zellij-viewport-binder.js +0 -61
  363. package/dist/core/zellij/zellij-worker-pane-manager.js +0 -881
  364. package/dist/core/zellij/zellij-worker-pane-summary.js +0 -64
  365. package/dist/native/sks-menubar/Tests/AppRuntimeTestSupport.swift +0 -26
  366. package/dist/native/sks-menubar/Tests/OperationCoordinatorTests.swift +0 -174
  367. package/dist/native/sks-menubar/Tests/ProcessClientTests.swift +0 -20
  368. package/dist/native/sks-menubar/Tests/ProvidersViewControllerTests.swift +0 -142
  369. package/dist/scripts/zellij-pane-proof-check.js +0 -88
  370. package/dist/scripts/zellij-real-session-cleanup-check.js +0 -139
  371. package/dist/scripts/zellij-real-session-launch-check.js +0 -126
  372. package/dist/scripts/zellij-screen-proof-check.js +0 -43
  373. package/schemas/zellij/zellij-right-column-state.schema.json +0 -40
  374. package/schemas/zellij/zellij-slot-telemetry.schema.json +0 -89
  375. package/schemas/zellij/zellij-worker-pane.schema.json +0 -53
  376. package/scripts/build-clean-atomic.mjs +0 -323
@@ -13,7 +13,10 @@ import { compareSemVer, extractSemVer, parseSemVer } from './update/semver.js';
13
13
  import { countUpdates, emptyUpdateStatus, resolveSksUpdateStatus, UpdateStatusRefreshError } from './update/update-status.js';
14
14
  import { acquireUpdateOperationLock, authorizeUpdateRollback, buildUpdateNowCommand, buildUpdateRollbackCommand, canonicalUpdateRegistry, UpdateOperationRecorder, updateOperationLastInstallPath, updateReceiptHasConfirmedGlobalInstall } from './update/update-operation.js';
15
15
  import { runTemporaryInstallSmoke } from './update/temporary-install-smoke.js';
16
+ import { updateStageFailureDiagnostics } from './update/update-stage-diagnostics.js';
17
+ import { executableOnInjectedPath, inspectInstalledCliResolution } from './update/installed-cli-resolution.js';
16
18
  import { ui as cliUi, withHeartbeat } from '../cli/cli-theme.js';
19
+ import { uniqueTruthyStrings as uniqueStrings } from './text/strings.js';
17
20
  const DEFAULT_REGISTRY = 'https://registry.npmjs.org/';
18
21
  const DOCTOR_OWNED_UPDATE_MIGRATION_SINCE = '8.0.2';
19
22
  export async function runSksUpdateStatus(options = {}) {
@@ -275,6 +278,7 @@ export const UPDATE_STAGE_ORDER = [
275
278
  'native_capability_setup',
276
279
  'menubar_rebuild',
277
280
  'menubar_signature_verify',
281
+ 'menubar_version_probe',
278
282
  'update_finalize_doctor',
279
283
  'final_self_verification',
280
284
  'snapshot_refresh'
@@ -566,7 +570,7 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
566
570
  operationRecorder.recordStage(id, false, status, detail);
567
571
  await operationRecorder.flush();
568
572
  };
569
- const finalize = async (result) => {
573
+ const finalize = async (result, operationError = result.error) => {
570
574
  result.temporary_install_smoke = temporaryInstallSmoke;
571
575
  result.operation_receipt_path = operationRecorder.receiptPath;
572
576
  const finished = await operationRecorder.finish({
@@ -574,7 +578,7 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
574
578
  ? 'terminal_uncertain'
575
579
  : result.ok ? (activeRollbackAuthorization ? 'rolled_back' : 'succeeded') : 'failed',
576
580
  resultStatus: result.status,
577
- error: result.error
581
+ error: operationError
578
582
  });
579
583
  operationFinished = true;
580
584
  if (finished.state === 'terminal_uncertain' && result.status !== 'terminal_uncertain') {
@@ -790,7 +794,14 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
790
794
  }).catch(() => null);
791
795
  let migrationCurrent = isUpdateMigrationReceiptCurrent(receipt);
792
796
  recordMigrationReceiptStage(stage, 'hook_trust_repair', receipt, 'hook-trust-refresh');
793
- stage('project_receipt', migrationCurrent, migrationCurrent ? 'current' : 'failed', { root: projectReceiptRoot });
797
+ stage('project_receipt', migrationCurrent, migrationCurrent ? 'current' : 'failed', {
798
+ root: projectReceiptRoot,
799
+ receipt_status: receipt?.status || null,
800
+ receipt_version: receipt?.sks_version || null,
801
+ required_blockers: receipt?.required_blockers || [],
802
+ optional_warnings: receipt?.optional_warnings || [],
803
+ installation_epoch_sha256: receipt?.installation_epoch_sha256 || null
804
+ });
794
805
  recordMigrationReceiptStage(stage, 'global_skills_reconcile', receipt, 'skills-reconcile');
795
806
  stage('native_capability_setup', true, 'skipped_current', { reason: 'package_already_current' });
796
807
  const sksMenuBar = migrationCurrent
@@ -804,6 +815,7 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
804
815
  env
805
816
  });
806
817
  stage('menubar_signature_verify', menuVerification.ok, menuVerification.status, menuVerification.detail);
818
+ stage('menubar_version_probe', menuVerification.versionProbe.ok, menuVerification.versionProbe.status, menuVerification.versionProbe.detail);
807
819
  const currentFinalizeDoctor = await runUpdateFinalizeDoctor({
808
820
  root: projectReceiptRoot,
809
821
  env: nestedProcessEnv,
@@ -813,7 +825,9 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
813
825
  entrypoint: currentFinalizeDoctor.entrypoint,
814
826
  args: currentFinalizeDoctor.args,
815
827
  exit_code: currentFinalizeDoctor.exit_code,
816
- timed_out: currentFinalizeDoctor.timed_out
828
+ timed_out: currentFinalizeDoctor.timed_out,
829
+ required_blockers: currentFinalizeDoctor.required_blockers,
830
+ optional_warnings: currentFinalizeDoctor.optional_warnings
817
831
  });
818
832
  const finalCurrentReceipt = await readProjectUpdateMigrationReceipt(projectReceiptRoot);
819
833
  if (finalCurrentReceipt)
@@ -833,6 +847,16 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
833
847
  && snapshotOk
834
848
  && currentStageFailures.length === 0
835
849
  && !currentMenuBarTerminalUncertain;
850
+ const currentError = currentOk ? null : currentMenuBarTerminalUncertain
851
+ ? 'Menu Bar launch or rollback completion could not be confirmed'
852
+ : currentFinalizeDoctor.ok
853
+ ? currentStageFailures.length
854
+ ? `current-version repair verification failed: ${currentStageFailures.join(',')}`
855
+ : 'current-version repair verification failed'
856
+ : 'current-version repair verification failed: update_finalize_doctor';
857
+ const currentOperationError = currentError && currentStageFailures.length
858
+ ? requiredUpdateStageFailureError(currentError, stages, currentStageFailures, projectReceiptRoot)
859
+ : currentError;
836
860
  return finalize(buildUpdateNowResult({
837
861
  packageName,
838
862
  from: check.current,
@@ -857,14 +881,8 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
857
881
  migrationCurrent,
858
882
  sksMenuBar,
859
883
  stages,
860
- error: currentOk ? null : currentMenuBarTerminalUncertain
861
- ? 'Menu Bar launch or rollback completion could not be confirmed'
862
- : currentFinalizeDoctor.ok
863
- ? currentStageFailures.length
864
- ? `current-version repair verification failed: ${currentStageFailures.join(',')}`
865
- : 'current-version repair verification failed'
866
- : 'current-version repair verification failed: update_finalize_doctor'
867
- }));
884
+ error: currentError
885
+ }), currentOperationError);
868
886
  }
869
887
  const oldDoctorTimeoutOverride = Number.parseInt(env.SKS_UPDATE_OLD_DOCTOR_TIMEOUT_MS || '', 10);
870
888
  const oldDoctorTimeoutMs = Number.isFinite(oldDoctorTimeoutOverride) && oldDoctorTimeoutOverride > 0
@@ -978,6 +996,8 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
978
996
  stage('global_install', installOk, installOk ? env.SKS_UPDATE_FAKE_INSTALL === '1' ? 'fake_installed' : 'installed' : 'failed', { command, code: install.code, timed_out: install.timedOut === true });
979
997
  let newBinary = null;
980
998
  let newVersion = null;
999
+ let installedCliResolution = null;
1000
+ let installedPackageIdentityOk = false;
981
1001
  let newVersionDoctor = null;
982
1002
  let preDoctorReceipt = null;
983
1003
  let projectReceipt = null;
@@ -985,30 +1005,84 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
985
1005
  let sksMenuBar = null;
986
1006
  let menubarVerified = process.platform !== 'darwin' || env.SKS_UPDATE_SKIP_SKS_MENUBAR === '1';
987
1007
  if (installOk) {
1008
+ installedCliResolution = env.SKS_UPDATE_FAKE_INSTALL === '1'
1009
+ ? null
1010
+ : await inspectInstalledCliResolution({
1011
+ packageName,
1012
+ expectedVersion: installVersion,
1013
+ globalRoot,
1014
+ env,
1015
+ cwd,
1016
+ timeoutMs: 5_000,
1017
+ maxOutputBytes: 4_096
1018
+ });
988
1019
  newBinary = env.SKS_UPDATE_FAKE_INSTALL === '1'
989
1020
  ? path.resolve(env.SKS_UPDATE_FAKE_NEW_ENTRYPOINT || path.join(packageRoot(), 'dist', 'bin', 'sks.js'))
990
- : await resolveInstalledSksEntrypoint({ packageName, globalRoot, env });
991
- stage('resolve_new_binary', Boolean(newBinary), newBinary ? 'resolved' : 'missing', { new_binary: newBinary });
1021
+ : installedCliResolution?.entrypoint
1022
+ || await resolveInstalledSksEntrypoint({ packageName, globalRoot, env });
1023
+ installedPackageIdentityOk = env.SKS_UPDATE_FAKE_INSTALL === '1'
1024
+ ? Boolean(newBinary)
1025
+ : Boolean(newBinary
1026
+ && installedCliResolution?.manifest_name === packageName
1027
+ && installedCliResolution.manifest_version === installVersion);
1028
+ stage('resolve_new_binary', installedPackageIdentityOk, installedPackageIdentityOk ? 'resolved_exact_global_package' : 'missing_or_mismatched', {
1029
+ new_binary: newBinary,
1030
+ package_root: installedCliResolution?.package_root || null,
1031
+ manifest_name: installedCliResolution?.manifest_name || null,
1032
+ manifest_version: installedCliResolution?.manifest_version || null,
1033
+ path_binary: installedCliResolution?.path_binary || null,
1034
+ path_version_before_doctor: installedCliResolution?.path_version || null,
1035
+ blockers: installedCliResolution?.blockers || []
1036
+ });
992
1037
  if (newBinary) {
993
- const versionProbe = await runProcess(process.execPath, [newBinary, '--version'], {
994
- cwd,
995
- env: { ...env, SKS_UPDATE_MIGRATION_GATE_DISABLED: '1', SKS_DISABLE_UPDATE_CHECK: '1' },
996
- timeoutMs: 5000,
997
- maxOutputBytes: 4096
998
- }).catch((err) => ({ code: 1, stdout: '', stderr: err?.message || String(err) }));
999
- newVersion = parseVersionText(versionProbe.stdout || versionProbe.stderr || '') || null;
1000
- stage('version_probe', Boolean(newVersion), newVersion ? 'version_detected' : 'failed', { new_version: newVersion, code: versionProbe.code });
1001
- preDoctorReceipt = await readProjectUpdateMigrationReceipt(projectReceiptRoot);
1002
- stageStart('new_version_doctor', 'running migration doctor on updated install');
1003
- newVersionDoctor = await updateHeartbeat(machineOutput, 'new-version doctor', runPackageLocalDoctor({
1004
- root: projectReceiptRoot,
1005
- entrypoint: newBinary,
1006
- args: ['doctor', '--fix', '--yes', '--profile', 'migration', '--machine-only', '--report-file', path.join(projectReceiptRoot, '.sneakoscope', 'update', 'new-version-doctor.json')],
1007
- env: nestedProcessEnv,
1008
- timeoutMs: updateDoctorTimeoutMs(env),
1009
- maxOutputBytes: 32 * 1024
1010
- }), 60_000);
1011
- stage('new_version_doctor', newVersionDoctor.ok, newVersionDoctor.status, { entrypoint: newBinary, exit_code: newVersionDoctor.exit_code, timeout_ms: updateDoctorTimeoutMs(env), timed_out: newVersionDoctor.timedOut });
1038
+ let versionProbeCode = installedCliResolution?.entrypoint_version ? 0 : 1;
1039
+ newVersion = installedCliResolution?.entrypoint_version || null;
1040
+ if (!newVersion) {
1041
+ const versionProbe = await runProcess(process.execPath, [newBinary, '--version'], {
1042
+ cwd,
1043
+ env: { ...env, SKS_UPDATE_MIGRATION_GATE_DISABLED: '1', SKS_DISABLE_UPDATE_CHECK: '1' },
1044
+ timeoutMs: 5000,
1045
+ maxOutputBytes: 4096
1046
+ }).catch((err) => ({ code: 1, stdout: '', stderr: err?.message || String(err) }));
1047
+ versionProbeCode = versionProbe.code;
1048
+ newVersion = parseVersionText(versionProbe.stdout || versionProbe.stderr || '') || null;
1049
+ }
1050
+ const exactVersion = compareSemVer(newVersion, installVersion) === 0;
1051
+ stage('version_probe', exactVersion, exactVersion ? 'exact_version_detected' : 'version_mismatch', {
1052
+ expected_version: installVersion,
1053
+ new_version: newVersion,
1054
+ code: versionProbeCode
1055
+ });
1056
+ if (installedPackageIdentityOk && exactVersion) {
1057
+ preDoctorReceipt = await readProjectUpdateMigrationReceipt(projectReceiptRoot);
1058
+ stageStart('new_version_doctor', 'running migration doctor on updated install');
1059
+ newVersionDoctor = await updateHeartbeat(machineOutput, 'new-version doctor', runPackageLocalDoctor({
1060
+ root: projectReceiptRoot,
1061
+ entrypoint: newBinary,
1062
+ args: ['doctor', '--fix', '--yes', '--profile', 'migration', '--machine-only', '--report-file', path.join(projectReceiptRoot, '.sneakoscope', 'update', 'new-version-doctor.json')],
1063
+ env: nestedProcessEnv,
1064
+ timeoutMs: updateDoctorTimeoutMs(env),
1065
+ maxOutputBytes: 32 * 1024
1066
+ }), 60_000);
1067
+ stage('new_version_doctor', newVersionDoctor.ok, newVersionDoctor.status, {
1068
+ entrypoint: newBinary,
1069
+ exit_code: newVersionDoctor.exit_code,
1070
+ timeout_ms: updateDoctorTimeoutMs(env),
1071
+ timed_out: newVersionDoctor.timedOut,
1072
+ required_blockers: newVersionDoctor.required_blockers
1073
+ });
1074
+ }
1075
+ else {
1076
+ stage('new_version_doctor', false, 'skipped_unverified_install_identity', {
1077
+ expected_version: installVersion,
1078
+ manifest_version: installedCliResolution?.manifest_version || null,
1079
+ entrypoint_version: newVersion
1080
+ });
1081
+ }
1082
+ }
1083
+ else {
1084
+ stage('version_probe', false, 'entrypoint_missing', { expected_version: installVersion });
1085
+ stage('new_version_doctor', false, 'skipped_entrypoint_missing', { expected_version: installVersion });
1012
1086
  }
1013
1087
  if (newBinary && newVersionDoctor?.ok) {
1014
1088
  const doctorReceipt = await readProjectUpdateMigrationReceipt(projectReceiptRoot);
@@ -1048,6 +1122,8 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
1048
1122
  via: receiptResult.via,
1049
1123
  expected_version: installVersion,
1050
1124
  receipt_version: projectReceipt?.sks_version || null,
1125
+ required_blockers: projectReceipt?.required_blockers || [],
1126
+ optional_warnings: projectReceipt?.optional_warnings || [],
1051
1127
  error: receiptResult.error
1052
1128
  });
1053
1129
  recordMigrationReceiptStage(stage, 'global_skills_reconcile', projectReceipt, 'skills-reconcile');
@@ -1073,10 +1149,11 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
1073
1149
  });
1074
1150
  menubarVerified = menuVerification.ok;
1075
1151
  stage('menubar_signature_verify', menuVerification.ok, menuVerification.status, menuVerification.detail);
1152
+ stage('menubar_version_probe', menuVerification.versionProbe.ok, menuVerification.versionProbe.status, menuVerification.versionProbe.detail);
1076
1153
  }
1077
1154
  }
1078
1155
  }
1079
- const finalizeDoctor = installOk && newBinary
1156
+ const finalizeDoctor = installOk && newBinary && installedPackageIdentityOk
1080
1157
  ? await runUpdateFinalizeDoctor({
1081
1158
  entrypoint: newBinary,
1082
1159
  root: projectReceiptRoot,
@@ -1089,7 +1166,9 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
1089
1166
  entrypoint: finalizeDoctor.entrypoint,
1090
1167
  args: finalizeDoctor.args,
1091
1168
  exit_code: finalizeDoctor.exit_code,
1092
- timed_out: finalizeDoctor.timed_out
1169
+ timed_out: finalizeDoctor.timed_out,
1170
+ required_blockers: finalizeDoctor.required_blockers,
1171
+ optional_warnings: finalizeDoctor.optional_warnings
1093
1172
  } : {})
1094
1173
  });
1095
1174
  if (finalizeDoctor) {
@@ -1098,7 +1177,26 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
1098
1177
  projectReceipt = finalDoctorReceipt;
1099
1178
  migrationCurrent = isUpdateMigrationReceiptCurrent(projectReceipt, installVersion);
1100
1179
  }
1101
- const verification = await runFinalUpdateVerification({ installOk, newBinary, installVersion, env, projectReceiptRoot });
1180
+ if (installOk && installVersion && env.SKS_UPDATE_FAKE_INSTALL !== '1') {
1181
+ installedCliResolution = await inspectInstalledCliResolution({
1182
+ packageName,
1183
+ expectedVersion: installVersion,
1184
+ globalRoot,
1185
+ env,
1186
+ cwd,
1187
+ timeoutMs: 5_000,
1188
+ maxOutputBytes: 4_096
1189
+ });
1190
+ }
1191
+ const verification = await runFinalUpdateVerification({
1192
+ installOk,
1193
+ packageName,
1194
+ newBinary,
1195
+ installVersion,
1196
+ env,
1197
+ projectReceiptRoot,
1198
+ installedCliResolution
1199
+ });
1102
1200
  const verifyOk = verification.length > 0 && verification.every((item) => item.ok) && finalizeDoctor?.ok === true;
1103
1201
  if (verification.length) {
1104
1202
  stage('final_self_verification', verifyOk, verifyOk ? 'verified' : 'issues', {
@@ -1112,24 +1210,53 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
1112
1210
  stage('final_self_verification', false, 'not_run', {});
1113
1211
  const snapshot = await runSksUpdateStatus(updateStatusOptionsFromNow(options, newVersion || check.current, {
1114
1212
  ...env,
1213
+ ...(env.SKS_UPDATE_FAKE_INSTALL === '1' && installVersion
1214
+ ? { SKS_INSTALLED_SKS_VERSION: installVersion }
1215
+ : {}),
1115
1216
  ...(installVersion ? { [versionOverrideEnvName(packageName)]: check.latest || installVersion } : {})
1116
1217
  })).catch(() => null);
1117
- const snapshotOk = snapshot?.schema === 'sks.update-status.v3' && snapshot.source !== 'error';
1118
- stage('snapshot_refresh', snapshotOk, snapshotOk ? snapshot.source : 'failed', {
1218
+ const snapshotVersionOk = compareSemVer(snapshot?.sks.current || null, installVersion) === 0;
1219
+ const snapshotOk = snapshot?.schema === 'sks.update-status.v3'
1220
+ && snapshot.source !== 'error'
1221
+ && snapshotVersionOk;
1222
+ stage('snapshot_refresh', snapshotOk, snapshotOk ? snapshot.source : snapshot?.source === 'error' ? 'failed' : 'resolved_version_mismatch', {
1119
1223
  current: snapshot?.sks.current || null,
1224
+ expected: installVersion,
1120
1225
  update_count: snapshot?.update_count ?? null,
1121
1226
  public_error: snapshot?.public_error || null
1122
1227
  });
1123
1228
  const executionStageIds = UPDATE_STAGE_ORDER.filter((id) => !['update_finalize_doctor', 'final_self_verification', 'snapshot_refresh'].includes(id));
1124
1229
  const executionStageFailures = requiredUpdateStageFailures(stages, executionStageIds);
1230
+ const allStageFailures = requiredUpdateStageFailures(stages, UPDATE_STAGE_ORDER);
1231
+ const installedCliOk = env.SKS_UPDATE_FAKE_INSTALL === '1'
1232
+ || installedCliResolution?.ok === true;
1125
1233
  const baseOk = installOk && Boolean(newBinary) && newVersionDoctor?.ok === true
1126
- && migrationCurrent && menubarVerified && executionStageFailures.length === 0;
1234
+ && installedCliOk && migrationCurrent && menubarVerified && executionStageFailures.length === 0;
1127
1235
  const ok = baseOk && verifyOk && snapshotOk;
1128
1236
  const menuBarTerminalUncertain = menuBarInstallIsTerminalUncertain(sksMenuBar);
1129
1237
  const terminalUncertain = install.timedOut === true || menuBarTerminalUncertain;
1130
1238
  const status = terminalUncertain
1131
1239
  ? 'terminal_uncertain'
1132
1240
  : ok ? 'updated' : baseOk ? 'updated_with_issues' : 'failed';
1241
+ const stageFailureError = executionStageFailures.length
1242
+ ? requiredUpdateStageFailureError(`required update stages failed: ${executionStageFailures.join(',')}`, stages, executionStageFailures, projectReceiptRoot)
1243
+ : null;
1244
+ const resultError = terminalUncertain
1245
+ ? menuBarTerminalUncertain
1246
+ ? 'Menu Bar launch or rollback completion could not be confirmed'
1247
+ : 'global install timed out; package side-effect completion is uncertain'
1248
+ : ok ? null
1249
+ : stageFailureError
1250
+ ? stageFailureError.message
1251
+ : status === 'updated_with_issues'
1252
+ ? !snapshotOk
1253
+ ? `update status still resolves SKS ${snapshot?.sks.current || 'unknown'} instead of ${installVersion}`
1254
+ : verificationError(verification, finalizeDoctor)
1255
+ : updateNowError(install, newBinary, newVersionDoctor, migrationCurrent, installedCliResolution);
1256
+ const resultOperationError = stageFailureError
1257
+ || (resultError && allStageFailures.length
1258
+ ? requiredUpdateStageFailureError(resultError, stages, allStageFailures, projectReceiptRoot)
1259
+ : resultError);
1133
1260
  return finalize(buildUpdateNowResult({
1134
1261
  packageName,
1135
1262
  from: check.current,
@@ -1149,23 +1276,15 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
1149
1276
  oldVersionDoctor,
1150
1277
  newBinary,
1151
1278
  newVersion,
1279
+ installedCliResolution,
1152
1280
  newVersionDoctor,
1153
1281
  projectReceipt,
1154
1282
  migrationCurrent,
1155
1283
  sksMenuBar,
1156
1284
  stages,
1157
1285
  verification,
1158
- error: terminalUncertain
1159
- ? menuBarTerminalUncertain
1160
- ? 'Menu Bar launch or rollback completion could not be confirmed'
1161
- : 'global install timed out; package side-effect completion is uncertain'
1162
- : ok ? null
1163
- : executionStageFailures.length
1164
- ? `required update stages failed: ${executionStageFailures.join(',')}`
1165
- : status === 'updated_with_issues'
1166
- ? verificationError(verification, finalizeDoctor)
1167
- : updateNowError(install, newBinary, newVersionDoctor, migrationCurrent)
1168
- }));
1286
+ error: resultError
1287
+ }), resultOperationError);
1169
1288
  }
1170
1289
  catch (error) {
1171
1290
  if (operation && !operationFinished) {
@@ -1173,7 +1292,7 @@ async function runSksUpdateNowInternal(options, rollbackAuthorization) {
1173
1292
  await operation.finish({
1174
1293
  state: 'failed',
1175
1294
  resultStatus: 'failed',
1176
- error: error instanceof Error ? error.message : String(error)
1295
+ error
1177
1296
  });
1178
1297
  operationFinished = true;
1179
1298
  }
@@ -1193,15 +1312,31 @@ function requiredUpdateStageFailures(stages, requiredIds) {
1193
1312
  return matches.length !== 1 || matches[0]?.ok !== true;
1194
1313
  });
1195
1314
  }
1315
+ function requiredUpdateStageFailureError(message, stages, failedIds, projectRoot) {
1316
+ for (const id of failedIds) {
1317
+ for (const stage of stages.filter((entry) => entry.id === id && entry.ok !== true)) {
1318
+ const rootCause = updateStageFailureDiagnostics(stage, projectRoot)[0];
1319
+ if (rootCause)
1320
+ return new Error(message, { cause: new Error(rootCause) });
1321
+ }
1322
+ }
1323
+ return new Error(message);
1324
+ }
1196
1325
  export function menuBarInstallIsTerminalUncertain(result) {
1197
1326
  return result?.status === 'terminal_uncertain'
1198
1327
  || result?.launch?.terminal_uncertain === true
1199
1328
  || result?.rollback?.status === 'terminal_uncertain';
1200
1329
  }
1201
1330
  async function runUpdateFinalizeDoctor(opts) {
1202
- const env = opts.env.SKS_TEST_FINALIZE_DOCTOR_FAIL === '1'
1203
- ? { ...opts.env, SKS_TEST_DOCTOR_FAIL: '1' }
1204
- : opts.env;
1331
+ const env = opts.env.SKS_TEST_FINALIZE_DOCTOR_USER_CONFIG_PRESERVED === '1'
1332
+ ? {
1333
+ ...opts.env,
1334
+ SKS_TEST_DOCTOR_FAIL: undefined,
1335
+ SKS_TEST_DOCTOR_USER_CONFIG_PRESERVED: '1'
1336
+ }
1337
+ : opts.env.SKS_TEST_FINALIZE_DOCTOR_FAIL === '1'
1338
+ ? { ...opts.env, SKS_TEST_DOCTOR_FAIL: '1' }
1339
+ : opts.env;
1205
1340
  return updateHeartbeat(opts.machineOutput, 'update finalize doctor', runPackageLocalDoctor({
1206
1341
  root: opts.root,
1207
1342
  ...(opts.entrypoint ? { entrypoint: opts.entrypoint } : {}),
@@ -1319,7 +1454,7 @@ export async function detectEffectiveSksVersion(options = {}) {
1319
1454
  add(options.currentVersion || PACKAGE_VERSION, 'runtime');
1320
1455
  add(env.SKS_INSTALLED_SKS_VERSION, 'env:SKS_INSTALLED_SKS_VERSION');
1321
1456
  const packageRootPromise = readJson(path.join(packageRoot(), 'package.json'), {}).catch(() => ({}));
1322
- const pathSksPromise = which('sks')
1457
+ const pathSksPromise = executableOnInjectedPath('sks', env)
1323
1458
  .then(async (sks) => {
1324
1459
  if (!sks)
1325
1460
  return null;
@@ -1457,26 +1592,6 @@ function normalizeLockedInstalledVersionObservation(value) {
1457
1592
  ])
1458
1593
  };
1459
1594
  }
1460
- async function executableOnInjectedPath(command, env) {
1461
- const rawPath = String(env.PATH ?? process.env.PATH ?? '').slice(0, 64 * 1024);
1462
- const extensions = process.platform === 'win32'
1463
- ? uniqueStrings(String(env.PATHEXT || '.COM;.EXE;.BAT;.CMD').split(';').map((extension) => extension.toLowerCase()))
1464
- : [''];
1465
- const names = process.platform === 'win32' && path.extname(command)
1466
- ? [command]
1467
- : extensions.map((extension) => `${command}${extension}`);
1468
- for (const directory of rawPath.split(path.delimiter).filter(Boolean).slice(0, 256)) {
1469
- for (const name of names) {
1470
- const candidate = path.resolve(directory, name);
1471
- try {
1472
- await fs.access(candidate);
1473
- return candidate;
1474
- }
1475
- catch { }
1476
- }
1477
- }
1478
- return null;
1479
- }
1480
1595
  function boundedLockedProbeTimeout(value) {
1481
1596
  if (!Number.isFinite(value))
1482
1597
  return 2500;
@@ -1595,6 +1710,7 @@ function buildUpdateNowResult(input) {
1595
1710
  old_version_doctor: input.oldVersionDoctor,
1596
1711
  new_binary: input.newBinary,
1597
1712
  new_version: input.newVersion,
1713
+ installed_cli_resolution: input.installedCliResolution || null,
1598
1714
  new_version_doctor: input.newVersionDoctor,
1599
1715
  project_receipt: input.projectReceipt,
1600
1716
  migration_current: input.migrationCurrent,
@@ -1614,10 +1730,42 @@ function buildUpdateNowResult(input) {
1614
1730
  }
1615
1731
  async function verifyUpdateMenuBar(input) {
1616
1732
  if (process.platform !== 'darwin' || input.env.SKS_UPDATE_SKIP_SKS_MENUBAR === '1') {
1617
- return { ok: true, status: 'skipped', detail: { reason: process.platform !== 'darwin' ? 'not_macos' : 'SKS_UPDATE_SKIP_SKS_MENUBAR=1' } };
1733
+ const reason = process.platform !== 'darwin' ? 'not_macos' : 'SKS_UPDATE_SKIP_SKS_MENUBAR=1';
1734
+ return {
1735
+ ok: true,
1736
+ status: 'skipped',
1737
+ detail: { reason },
1738
+ versionProbe: {
1739
+ ok: true,
1740
+ status: 'skipped',
1741
+ detail: {
1742
+ running_version: null,
1743
+ running_pid: null,
1744
+ expected_version: input.expectedVersion,
1745
+ probe_ok: true,
1746
+ reason
1747
+ }
1748
+ }
1749
+ };
1618
1750
  }
1619
1751
  if (!input.install || input.install.ok === false) {
1620
- return { ok: false, status: 'install_failed', detail: { blockers: input.install?.blockers || ['menubar_install_missing'] } };
1752
+ const blockers = input.install?.blockers || ['menubar_install_missing'];
1753
+ return {
1754
+ ok: false,
1755
+ status: 'install_failed',
1756
+ detail: { blockers },
1757
+ versionProbe: {
1758
+ ok: false,
1759
+ status: 'install_failed',
1760
+ detail: {
1761
+ running_version: null,
1762
+ running_pid: null,
1763
+ expected_version: input.expectedVersion,
1764
+ probe_ok: false,
1765
+ blockers
1766
+ }
1767
+ }
1768
+ };
1621
1769
  }
1622
1770
  const status = await inspectSksMenuBarStatus({
1623
1771
  ...(input.home === undefined ? {} : { home: input.home }),
@@ -1629,6 +1777,25 @@ async function verifyUpdateMenuBar(input) {
1629
1777
  const signatureOk = status?.signature.checked === true && status.signature.ok === true;
1630
1778
  const resourcesOk = resources?.checked === true && resources.ok === true;
1631
1779
  const ok = status?.installed === true && versionOk && signatureOk && resourcesOk;
1780
+ const runningProcess = status?.running_process || input.install.running_process;
1781
+ const probe = status?.menubar_version_probe || input.install.menubar_version_probe;
1782
+ const launchExpected = input.install.launch?.requested === true;
1783
+ const restartDeferred = input.env.SKS_UPDATE_DEFER_MENUBAR_RESTART === '1';
1784
+ const runningVersion = runningProcess?.package_version || probe?.running_version || null;
1785
+ const runningPid = runningProcess?.pid || probe?.pid || null;
1786
+ const runningProcessOk = runningProcess?.ok === true && runningPid !== null;
1787
+ const runningVersionOk = runningVersion === input.expectedVersion;
1788
+ const probeOk = probe?.ok === true && runningProcessOk && runningVersionOk;
1789
+ const versionProbeOk = !launchExpected || probeOk;
1790
+ const versionProbeStatus = !launchExpected
1791
+ ? restartDeferred ? 'restart_deferred' : 'launch_not_requested'
1792
+ : !runningProcessOk
1793
+ ? 'running_process_missing'
1794
+ : !runningVersionOk
1795
+ ? 'running_version_mismatch'
1796
+ : probe?.ok !== true
1797
+ ? 'probe_failed'
1798
+ : 'verified';
1632
1799
  return {
1633
1800
  ok,
1634
1801
  status: ok ? 'verified' : 'failed',
@@ -1640,6 +1807,19 @@ async function verifyUpdateMenuBar(input) {
1640
1807
  resources_ok: resourcesOk,
1641
1808
  missing_resources: resources?.missing || [],
1642
1809
  mismatched_resources: resources?.mismatched || []
1810
+ },
1811
+ versionProbe: {
1812
+ ok: versionProbeOk,
1813
+ status: versionProbeStatus,
1814
+ detail: {
1815
+ running_version: runningVersion,
1816
+ running_pid: runningPid,
1817
+ expected_version: input.expectedVersion,
1818
+ probe_ok: probeOk,
1819
+ launch_expected: launchExpected,
1820
+ restart_deferred: restartDeferred,
1821
+ probe_error: probe?.error || runningProcess?.error || null
1822
+ }
1643
1823
  }
1644
1824
  };
1645
1825
  }
@@ -1792,6 +1972,23 @@ async function runFinalUpdateVerification(input) {
1792
1972
  detail: `expected ${input.installVersion}, got ${got || 'missing'}`,
1793
1973
  remediation: 'Run: sks update now --version <expected>'
1794
1974
  });
1975
+ if (input.installedCliResolution) {
1976
+ const resolution = input.installedCliResolution;
1977
+ verification.push({
1978
+ id: 'package_manifest',
1979
+ ok: resolution.manifest_name === input.packageName
1980
+ && resolution.manifest_version === input.installVersion
1981
+ && resolution.entrypoint === input.newBinary,
1982
+ detail: `expected ${input.packageName}@${input.installVersion}, got ${resolution.manifest_name || 'missing'}@${resolution.manifest_version || 'missing'} from ${resolution.package_root || 'missing'}`,
1983
+ remediation: `Run: npm install --global ${input.packageName}@${input.installVersion}`
1984
+ });
1985
+ verification.push({
1986
+ id: 'path_version_match',
1987
+ ok: resolution.path_version === input.installVersion && resolution.path_targets_entrypoint,
1988
+ detail: `expected PATH sks ${input.installVersion} at the verified entrypoint; got ${resolution.path_version || 'missing'} from ${resolution.path_binary || 'missing'} (exact target: ${resolution.path_targets_entrypoint ? 'yes' : 'no'})`,
1989
+ remediation: 'Remove or reorder the older SKS npm prefix on PATH, then rerun: sks update now'
1990
+ });
1991
+ }
1795
1992
  const hookState = await readCodexHookActualState(input.projectReceiptRoot).catch(() => null);
1796
1993
  const managedEntries = (hookState?.entries || []).filter((entry) => entry.managed === true);
1797
1994
  const untrusted = managedEntries.filter((entry) => entry.trust_status !== 'Trusted' && entry.trust_status !== 'Managed');
@@ -1801,15 +1998,6 @@ async function runFinalUpdateVerification(input) {
1801
1998
  detail: untrusted.length ? untrusted.map((entry) => entry.key).slice(0, 3).join(', ') : `managed ${managedEntries.length}`,
1802
1999
  remediation: 'Run: sks codex trust-doctor --fix --managed --actual'
1803
2000
  });
1804
- const stampPath = path.join(path.dirname(input.newBinary), '..', '.sks-build-stamp.json');
1805
- const stamp = await readJson(stampPath, null).catch(() => null);
1806
- const stampVersion = stamp?.package_version || stamp?.version || null;
1807
- verification.push({
1808
- id: 'dist_stamp',
1809
- ok: stampVersion === input.installVersion,
1810
- detail: `expected ${input.installVersion}, got ${stampVersion || 'missing'}`,
1811
- remediation: 'Run: npm run build:incremental'
1812
- });
1813
2001
  const home = input.env.HOME || os.homedir();
1814
2002
  const skillsManifest = await readJson(path.join(home, '.agents', 'skills', '.sks-generated.json'), null).catch(() => null);
1815
2003
  verification.push({
@@ -1839,11 +2027,14 @@ function verificationError(verification, finalizeDoctor) {
1839
2027
  ? `update self-verification failed: ${failed.join(', ')}`
1840
2028
  : 'update self-verification did not run';
1841
2029
  }
1842
- function updateNowError(install, newBinary, newVersionDoctor, migrationCurrent) {
2030
+ function updateNowError(install, newBinary, newVersionDoctor, migrationCurrent, installedCliResolution) {
1843
2031
  if (install.code !== 0)
1844
2032
  return `${install.stderr || install.stdout || 'npm global install failed'}`.trim();
1845
2033
  if (!newBinary)
1846
2034
  return 'new package-local sks binary could not be resolved after install';
2035
+ if (installedCliResolution && !installedCliResolution.ok) {
2036
+ return `installed SKS CLI resolution failed: ${installedCliResolution.blockers.join(', ') || 'unknown resolution blocker'}; PATH sks=${installedCliResolution.path_binary || 'missing'} version=${installedCliResolution.path_version || 'missing'}`;
2037
+ }
1847
2038
  if (!newVersionDoctor?.ok)
1848
2039
  return newVersionDoctor?.error || 'new-version global Doctor failed';
1849
2040
  if (!migrationCurrent)
@@ -1854,8 +2045,8 @@ function effectiveInstalledVersion(candidates) {
1854
2045
  const firstBySource = (source) => candidates.find((candidate) => candidate.source === source)?.version || null;
1855
2046
  const firstByPrefix = (prefix) => candidates.find((candidate) => candidate.source.startsWith(prefix))?.version || null;
1856
2047
  return firstBySource('env:SKS_INSTALLED_SKS_VERSION')
1857
- || firstByPrefix('npm-global:')
1858
2048
  || firstByPrefix('PATH:')
2049
+ || firstByPrefix('npm-global:')
1859
2050
  || firstBySource('runtime')
1860
2051
  || firstBySource('packageRoot:package.json')
1861
2052
  || highestPackageVersion(candidates.map((candidate) => candidate.version));
@@ -1865,6 +2056,3 @@ function highestPackageVersion(versions) {
1865
2056
  .filter((version) => typeof version === 'string' && version.length > 0)
1866
2057
  .reduce((best, candidate) => comparePackageVersions(candidate, best) > 0 ? candidate : best, '0.0.0');
1867
2058
  }
1868
- function uniqueStrings(values) {
1869
- return [...new Set(values.filter(Boolean))];
1870
- }
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '8.0.2';
1
+ export const PACKAGE_VERSION = '8.0.4';