oh-my-opencode 4.7.4 → 4.8.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 (612) hide show
  1. package/.agents/command/get-unpublished-changes.md +35 -6
  2. package/.agents/command/omomomo.md +1 -1
  3. package/.agents/command/publish.md +13 -0
  4. package/.agents/command/security-research.md +0 -1
  5. package/.agents/skills/get-unpublished-changes/SKILL.md +21 -5
  6. package/.agents/skills/omomomo/SKILL.md +1 -2
  7. package/.agents/skills/opencode-qa/scripts/export-roundtrip.sh +57 -19
  8. package/.agents/skills/opencode-qa/scripts/lib/common.sh +19 -7
  9. package/.agents/skills/opencode-qa/scripts/sse-hook-probe.sh +3 -0
  10. package/.agents/skills/opencode-qa/scripts/tui-smoke.sh +1 -1
  11. package/.agents/skills/pre-publish-review/SKILL.md +24 -4
  12. package/.agents/skills/publish/SKILL.md +13 -0
  13. package/.agents/skills/remove-deadcode/SKILL.md +0 -1
  14. package/.agents/skills/security-research/SKILL.md +0 -1
  15. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/code-changes.md +1 -1
  16. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/code-changes.md +2 -2
  17. package/.agents/skills/work-with-pr-workspace/iteration-1/review.html +1 -1
  18. package/.opencode/command/get-unpublished-changes.md +35 -6
  19. package/.opencode/command/omomomo.md +1 -1
  20. package/.opencode/command/publish.md +13 -0
  21. package/.opencode/command/security-research.md +0 -1
  22. package/.opencode/skills/pre-publish-review/SKILL.md +24 -4
  23. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/code-changes.md +1 -1
  24. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/code-changes.md +2 -2
  25. package/.opencode/skills/work-with-pr-workspace/iteration-1/review.html +1 -1
  26. package/README.ja.md +7 -7
  27. package/README.ko.md +9 -7
  28. package/README.md +14 -8
  29. package/README.ru.md +5 -5
  30. package/README.zh-cn.md +7 -7
  31. package/bin/oh-my-opencode.js +24 -1
  32. package/bin/oh-my-opencode.test.ts +79 -20
  33. package/dist/agents/hephaestus/agent.d.ts +1 -1
  34. package/dist/agents/kimi-tool-loop-guard.d.ts +1 -0
  35. package/dist/agents/momus.d.ts +1 -1
  36. package/dist/agents/sisyphus-agent-config.d.ts +4 -0
  37. package/dist/agents/sisyphus-agent-factory.d.ts +6 -0
  38. package/dist/agents/sisyphus-dynamic-prompt-builder.d.ts +2 -0
  39. package/dist/agents/sisyphus-dynamic-prompt-execution.d.ts +2 -0
  40. package/dist/agents/sisyphus-dynamic-prompt-exploration.d.ts +2 -0
  41. package/dist/agents/sisyphus-dynamic-prompt-role.d.ts +2 -0
  42. package/dist/agents/sisyphus-dynamic-prompt-sections.d.ts +18 -0
  43. package/dist/agents/sisyphus-dynamic-prompt-style.d.ts +2 -0
  44. package/dist/agents/sisyphus-dynamic-prompt.d.ts +3 -0
  45. package/dist/agents/sisyphus-gemini-fallback-overrides.d.ts +1 -0
  46. package/dist/agents/sisyphus-junior/agent.d.ts +1 -1
  47. package/dist/agents/sisyphus-junior/index.d.ts +0 -1
  48. package/dist/agents/sisyphus.d.ts +1 -6
  49. package/dist/agents/types.d.ts +14 -3
  50. package/dist/cli/cli-program.d.ts +3 -0
  51. package/dist/cli/doctor/checks/codex.d.ts +11 -0
  52. package/dist/cli/doctor/checks/dependencies.d.ts +1 -0
  53. package/dist/cli/doctor/checks/index.d.ts +3 -0
  54. package/dist/cli/doctor/checks/system.d.ts +4 -0
  55. package/dist/cli/doctor/constants.d.ts +1 -0
  56. package/dist/cli/doctor/doctor-target.d.ts +2 -0
  57. package/dist/cli/doctor/index.d.ts +1 -0
  58. package/dist/cli/doctor/types.d.ts +26 -0
  59. package/dist/cli/index.js +4492 -2265
  60. package/dist/cli/install-codex/codex-cache-bins.d.ts +21 -0
  61. package/dist/cli/install-codex/codex-cache-fs.d.ts +3 -0
  62. package/dist/cli/install-codex/codex-cache-install.d.ts +13 -0
  63. package/dist/cli/install-codex/codex-cache-mcp-manifest.d.ts +2 -0
  64. package/dist/cli/install-codex/codex-cache-prune.d.ts +10 -0
  65. package/dist/cli/install-codex/codex-cache.d.ts +4 -32
  66. package/dist/cli/install-codex/codex-cached-marketplace-manifest.d.ts +6 -0
  67. package/dist/cli/install-codex/codex-config-agents.d.ts +3 -0
  68. package/dist/cli/install-codex/codex-config-features.d.ts +1 -0
  69. package/dist/cli/install-codex/codex-config-marketplaces.d.ts +6 -0
  70. package/dist/cli/install-codex/codex-config-plugins.d.ts +8 -0
  71. package/dist/cli/install-codex/codex-config-toml-sections.d.ts +9 -0
  72. package/dist/cli/install-codex/codex-process.d.ts +5 -0
  73. package/dist/cli/install-codex/index.d.ts +1 -1
  74. package/dist/cli/install-codex/lazycodex-version-stamp.d.ts +19 -0
  75. package/dist/cli/install-codex/link-cached-plugin-agents.d.ts +4 -0
  76. package/dist/cli/install-validators.d.ts +3 -0
  77. package/dist/cli/model-fallback-types.d.ts +3 -0
  78. package/dist/cli/run/event-handlers.d.ts +4 -11
  79. package/dist/cli/run/event-message-handlers.d.ts +5 -0
  80. package/dist/cli/run/event-session-handlers.d.ts +5 -0
  81. package/dist/cli/run/event-session-ids.d.ts +24 -0
  82. package/dist/cli/run/event-think-block.d.ts +3 -0
  83. package/dist/cli/run/event-toast-handlers.d.ts +3 -0
  84. package/dist/cli/run/event-tool-handlers.d.ts +4 -0
  85. package/dist/cli/run/event-tool-output.d.ts +2 -0
  86. package/dist/cli/run/on-complete-hook.d.ts +8 -1
  87. package/dist/cli/run/opencode-binary-resolver.d.ts +2 -1
  88. package/dist/cli/runtime-commands.d.ts +2 -0
  89. package/dist/cli/sparkshell-appserver-websocket.d.ts +4 -0
  90. package/dist/cli/sparkshell-appserver.d.ts +16 -0
  91. package/dist/cli/sparkshell-parse.d.ts +21 -0
  92. package/dist/cli/sparkshell.d.ts +26 -0
  93. package/dist/cli/types.d.ts +9 -0
  94. package/dist/config/schema/claude-code.d.ts +1 -0
  95. package/dist/config/schema/hooks.d.ts +1 -0
  96. package/dist/config/schema/oh-my-opencode-config.d.ts +1 -0
  97. package/dist/create-hooks.d.ts +1 -0
  98. package/dist/features/background-agent/concurrency.d.ts +6 -1
  99. package/dist/features/background-agent/constants.d.ts +1 -0
  100. package/dist/features/background-agent/empty-assistant-turn.d.ts +7 -0
  101. package/dist/features/background-agent/manager.d.ts +12 -0
  102. package/dist/features/background-agent/message-updated-parent-wake-output.d.ts +1 -0
  103. package/dist/features/background-agent/parent-wake-dedupe.d.ts +2 -0
  104. package/dist/features/background-agent/parent-wake-dispatched-tracker.d.ts +21 -0
  105. package/dist/features/background-agent/parent-wake-flush-runner.d.ts +24 -0
  106. package/dist/features/background-agent/parent-wake-history-state.d.ts +5 -0
  107. package/dist/features/background-agent/parent-wake-notifier-types.d.ts +50 -0
  108. package/dist/features/background-agent/parent-wake-notifier.d.ts +8 -50
  109. package/dist/features/background-agent/parent-wake-pending-queue.d.ts +22 -0
  110. package/dist/features/background-agent/parent-wake-prompt-dispatch.d.ts +19 -0
  111. package/dist/features/background-agent/parent-wake-session-history.d.ts +73 -0
  112. package/dist/features/background-agent/parent-wake-session-inspector.d.ts +35 -0
  113. package/dist/features/background-agent/parent-wake-timer-handle.d.ts +5 -0
  114. package/dist/features/background-agent/parent-wake-window-recovery.d.ts +13 -0
  115. package/dist/features/background-agent/process-cleanup.d.ts +2 -0
  116. package/dist/features/background-agent/process-cleanup.test-helpers.d.ts +3 -0
  117. package/dist/features/background-agent/session-stream-activity.d.ts +6 -0
  118. package/dist/features/background-agent/spawner/fallback-agent.d.ts +5 -0
  119. package/dist/features/background-agent/spawner/task-prompt-body.d.ts +34 -0
  120. package/dist/features/background-agent/spawner/task-record.d.ts +2 -0
  121. package/dist/features/background-agent/spawner.d.ts +2 -5
  122. package/dist/features/builtin-commands/templates/refactor-sections/codemap-and-tests.d.ts +1 -0
  123. package/dist/features/builtin-commands/templates/refactor-sections/intro-and-analysis.d.ts +1 -0
  124. package/dist/features/builtin-commands/templates/refactor-sections/plan-and-execution.d.ts +1 -0
  125. package/dist/features/builtin-commands/templates/refactor-sections/team-mode-addendum.d.ts +1 -0
  126. package/dist/features/builtin-commands/templates/refactor-sections/verification-and-tooling.d.ts +1 -0
  127. package/dist/features/builtin-commands/templates/refactor.d.ts +2 -2
  128. package/dist/features/builtin-skills/skills/agent-browser-skill.d.ts +2 -0
  129. package/dist/features/builtin-skills/skills/agent-browser-template.d.ts +2 -0
  130. package/dist/features/builtin-skills/skills/git-master-sections/commit-atomic-planning.d.ts +1 -0
  131. package/dist/features/builtin-skills/skills/git-master-sections/commit-context-analysis.d.ts +1 -0
  132. package/dist/features/builtin-skills/skills/git-master-sections/commit-execution-verification.d.ts +1 -0
  133. package/dist/features/builtin-skills/skills/git-master-sections/commit-workflow.d.ts +1 -1
  134. package/dist/features/builtin-skills/skills/index.d.ts +1 -0
  135. package/dist/features/builtin-skills/skills/playwright-mcp-skill.d.ts +2 -0
  136. package/dist/features/builtin-skills/skills/playwright.d.ts +2 -3
  137. package/dist/features/builtin-skills/skills/visual-qa.d.ts +2 -0
  138. package/dist/features/claude-code-agent-loader/agent-definitions-loader.d.ts +2 -2
  139. package/dist/features/claude-code-agent-loader/claude-model-mapper.d.ts +1 -1
  140. package/dist/features/claude-code-agent-loader/loader.d.ts +2 -2
  141. package/dist/features/claude-code-plugin-loader/agent-loader.d.ts +1 -1
  142. package/dist/features/claude-code-plugin-loader/discovery-core.d.ts +2 -0
  143. package/dist/features/claude-code-plugin-loader/discovery-paths.d.ts +3 -0
  144. package/dist/features/claude-code-plugin-loader/discovery.d.ts +3 -4
  145. package/dist/features/claude-code-plugin-loader/install-path-resolver.d.ts +1 -0
  146. package/dist/features/claude-code-plugin-loader/installed-plugin-database.d.ts +3 -0
  147. package/dist/features/claude-code-plugin-loader/loaded-plugin.d.ts +2 -0
  148. package/dist/features/claude-code-plugin-loader/plugin-key.d.ts +1 -0
  149. package/dist/features/claude-code-plugin-loader/plugin-manifest.d.ts +4 -0
  150. package/dist/features/claude-code-plugin-loader/plugin-settings.d.ts +3 -0
  151. package/dist/features/claude-code-plugin-loader/types.d.ts +1 -0
  152. package/dist/features/hook-message-injector/context-resolver.d.ts +6 -0
  153. package/dist/features/hook-message-injector/id-generation.d.ts +2 -0
  154. package/dist/features/hook-message-injector/index.d.ts +1 -1
  155. package/dist/features/hook-message-injector/injector.d.ts +7 -69
  156. package/dist/features/hook-message-injector/json-message-lookup.d.ts +3 -0
  157. package/dist/features/hook-message-injector/message-directory.d.ts +1 -0
  158. package/dist/features/hook-message-injector/message-injection.d.ts +2 -0
  159. package/dist/features/hook-message-injector/sdk-message-context.d.ts +6 -0
  160. package/dist/features/hook-message-injector/sdk-message-lookup.d.ts +28 -0
  161. package/dist/features/hook-message-injector/types.d.ts +9 -0
  162. package/dist/features/mcp-oauth/callback-server.d.ts +10 -2
  163. package/dist/features/opencode-runtime-skills/source-server.d.ts +1 -0
  164. package/dist/features/skill-mcp-manager/http-client.d.ts +2 -0
  165. package/dist/features/team-mode/deps.d.ts +8 -1
  166. package/dist/features/team-mode/team-layout-tmux/layout.d.ts +2 -0
  167. package/dist/features/team-mode/team-mailbox/send.d.ts +3 -0
  168. package/dist/features/team-mode/team-registry/paths.d.ts +17 -2
  169. package/dist/features/team-mode/team-runtime/shutdown.d.ts +1 -1
  170. package/dist/features/team-mode/team-runtime/unresolved-team-members.d.ts +3 -0
  171. package/dist/features/team-mode/team-state-store/active-resume.d.ts +5 -0
  172. package/dist/features/team-mode/team-state-store/creating-resume.d.ts +4 -0
  173. package/dist/features/team-mode/team-state-store/deleting-resume.d.ts +4 -0
  174. package/dist/features/team-mode/team-state-store/error-normalization.d.ts +2 -0
  175. package/dist/features/team-mode/team-state-store/reservation-reconciliation.d.ts +4 -0
  176. package/dist/features/team-mode/team-state-store/resume-report.d.ts +7 -0
  177. package/dist/features/team-mode/team-state-store/resume.d.ts +2 -7
  178. package/dist/features/team-mode/team-state-store/runtime-cleanup.d.ts +4 -0
  179. package/dist/features/team-mode/team-state-store/session-liveness.d.ts +9 -0
  180. package/dist/features/team-mode/team-state-store/worker-resume-status.d.ts +9 -0
  181. package/dist/features/team-mode/tools/lifecycle-create-tool.d.ts +17 -0
  182. package/dist/features/team-mode/tools/lifecycle-inline-spec.d.ts +19 -0
  183. package/dist/features/team-mode/tools/lifecycle-participant.d.ts +25 -0
  184. package/dist/features/team-mode/tools/lifecycle-shutdown-tools.d.ts +18 -0
  185. package/dist/features/team-mode/tools/lifecycle-test-fixture.d.ts +3 -3
  186. package/dist/features/team-mode/tools/lifecycle.d.ts +3 -37
  187. package/dist/features/team-mode/tools/messaging-live-delivery-client.d.ts +25 -0
  188. package/dist/features/team-mode/tools/messaging-live-delivery-recipient.d.ts +19 -0
  189. package/dist/features/team-mode/tools/messaging-live-delivery-reservation.d.ts +10 -0
  190. package/dist/features/team-mode/tools/messaging-live-delivery-state.d.ts +5 -0
  191. package/dist/features/team-mode/tools/messaging-live-delivery.d.ts +6 -0
  192. package/dist/features/team-mode/tools/messaging-runtime.d.ts +17 -0
  193. package/dist/features/team-mode/tools/messaging.d.ts +4 -29
  194. package/dist/features/tmux-subagent/manager.d.ts +20 -1
  195. package/dist/features/tmux-subagent/session-created-handler.d.ts +4 -0
  196. package/dist/features/tmux-subagent/types.d.ts +1 -0
  197. package/dist/hooks/anthropic-context-window-limit-recovery/message-builder.d.ts +1 -1
  198. package/dist/hooks/atlas/idle-completion-nudge.d.ts +10 -0
  199. package/dist/hooks/atlas/idle-constants.d.ts +4 -0
  200. package/dist/hooks/atlas/idle-continuation.d.ts +23 -0
  201. package/dist/hooks/atlas/idle-session-eligibility.d.ts +8 -0
  202. package/dist/hooks/atlas/tool-execute-after-direct-work.d.ts +9 -0
  203. package/dist/hooks/atlas/tool-execute-after-plan-tasks.d.ts +3 -0
  204. package/dist/hooks/atlas/tool-execute-after-subagent-completion.d.ts +14 -0
  205. package/dist/hooks/auto-update-checker/hook/background-update-check.d.ts +6 -0
  206. package/dist/hooks/auto-update-checker/hook/ignore-toast-error.d.ts +1 -0
  207. package/dist/hooks/hephaestus-agents-md-injector/hook.d.ts +37 -0
  208. package/dist/hooks/hephaestus-agents-md-injector/index.d.ts +1 -0
  209. package/dist/hooks/index.d.ts +1 -0
  210. package/dist/hooks/json-error-recovery/hook.d.ts +1 -1
  211. package/dist/hooks/ralph-loop/command-arguments.d.ts +1 -0
  212. package/dist/hooks/ralph-loop/event-handler-activity.d.ts +10 -0
  213. package/dist/hooks/ralph-loop/event-handler-completion.d.ts +9 -0
  214. package/dist/hooks/ralph-loop/event-handler-continuation.d.ts +16 -0
  215. package/dist/hooks/ralph-loop/event-handler-feedback.d.ts +16 -0
  216. package/dist/hooks/ralph-loop/event-handler-idle.d.ts +15 -0
  217. package/dist/hooks/ralph-loop/event-handler-impl.d.ts +10 -0
  218. package/dist/hooks/ralph-loop/event-handler-runtime-error.d.ts +4 -0
  219. package/dist/hooks/ralph-loop/event-handler-types.d.ts +20 -0
  220. package/dist/hooks/ralph-loop/loop-state-controller.d.ts +1 -0
  221. package/dist/hooks/ralph-loop/ralph-loop-event-handler.d.ts +4 -24
  222. package/dist/hooks/ralph-loop/ralph-loop-hook.d.ts +1 -0
  223. package/dist/hooks/read-image-resizer/png-chunks.d.ts +6 -0
  224. package/dist/hooks/read-image-resizer/png-constants.d.ts +1 -0
  225. package/dist/hooks/read-image-resizer/png-crc.d.ts +1 -0
  226. package/dist/hooks/read-image-resizer/png-decoder.d.ts +1 -0
  227. package/dist/hooks/read-image-resizer/png-encoder.d.ts +1 -0
  228. package/dist/hooks/read-image-resizer/png-filters.d.ts +1 -0
  229. package/dist/hooks/read-image-resizer/png-ihdr.d.ts +11 -0
  230. package/dist/hooks/read-image-resizer/png-nearest-neighbor.d.ts +1 -0
  231. package/dist/hooks/rules-injector/injection-output.d.ts +2 -0
  232. package/dist/hooks/rules-injector/injection-processor.d.ts +22 -0
  233. package/dist/hooks/rules-injector/injection-types.d.ts +43 -0
  234. package/dist/hooks/rules-injector/injector.d.ts +3 -47
  235. package/dist/hooks/rules-injector/match-decision-cache.d.ts +4 -0
  236. package/dist/hooks/rules-injector/parsed-rule-cache.d.ts +11 -0
  237. package/dist/hooks/rules-injector/path-resolution.d.ts +1 -0
  238. package/dist/hooks/rules-injector/rule-match-reason.d.ts +12 -0
  239. package/dist/hooks/rules-injector/transcript-hydration.d.ts +13 -2
  240. package/dist/hooks/runtime-fallback/auto-retry-abort.d.ts +2 -0
  241. package/dist/hooks/runtime-fallback/auto-retry-agent-context.d.ts +2 -0
  242. package/dist/hooks/runtime-fallback/auto-retry-cleanup.d.ts +2 -0
  243. package/dist/hooks/runtime-fallback/auto-retry-dispatch.d.ts +2 -0
  244. package/dist/hooks/runtime-fallback/auto-retry-metadata.d.ts +9 -0
  245. package/dist/hooks/runtime-fallback/auto-retry-timeout.d.ts +5 -0
  246. package/dist/hooks/runtime-fallback/fallback-bootstrap-model.d.ts +1 -1
  247. package/dist/hooks/runtime-fallback/fallback-state.d.ts +4 -1
  248. package/dist/hooks/runtime-fallback/normalize-model.d.ts +12 -0
  249. package/dist/hooks/session-notification-linux.d.ts +3 -0
  250. package/dist/hooks/session-notification-log.d.ts +2 -0
  251. package/dist/hooks/session-notification-macos.d.ts +3 -0
  252. package/dist/hooks/session-notification-platform.d.ts +3 -0
  253. package/dist/hooks/session-notification-runner.d.ts +9 -0
  254. package/dist/hooks/session-notification-send.d.ts +3 -0
  255. package/dist/hooks/session-notification-sender.d.ts +5 -6
  256. package/dist/hooks/session-notification-sound.d.ts +3 -0
  257. package/dist/hooks/session-notification-windows.d.ts +3 -0
  258. package/dist/hooks/session-recovery/error-recovery.d.ts +4 -0
  259. package/dist/hooks/session-recovery/hook-types.d.ts +22 -0
  260. package/dist/hooks/session-recovery/hook.d.ts +2 -19
  261. package/dist/hooks/session-recovery/interrupted-tool-results.d.ts +3 -0
  262. package/dist/hooks/session-recovery/message-state.d.ts +4 -0
  263. package/dist/hooks/session-recovery/storage/thinking-strip.d.ts +7 -1
  264. package/dist/hooks/start-work/context-info-builder.d.ts +9 -9
  265. package/dist/hooks/start-work/context-info-formatters.d.ts +21 -0
  266. package/dist/hooks/start-work/explicit-plan-context.d.ts +9 -0
  267. package/dist/hooks/start-work/plan-discovery-context.d.ts +25 -0
  268. package/dist/hooks/start-work/plan-selection.d.ts +4 -0
  269. package/dist/hooks/start-work/work-initializer.d.ts +17 -0
  270. package/dist/hooks/tool-pair-validator/hook.d.ts +1 -37
  271. package/dist/hooks/tool-pair-validator/message-transform.d.ts +2 -0
  272. package/dist/hooks/tool-pair-validator/tool-part-ids.d.ts +6 -0
  273. package/dist/hooks/tool-pair-validator/tool-result-repair.d.ts +4 -0
  274. package/dist/hooks/tool-pair-validator/types.d.ts +36 -0
  275. package/dist/index.js +12708 -9988
  276. package/dist/oh-my-opencode.schema.json +4 -0
  277. package/dist/openclaw/reply-listener-poll-loop.d.ts +3 -0
  278. package/dist/openclaw/reply-listener-signature.d.ts +2 -0
  279. package/dist/openclaw/reply-listener-sleep.d.ts +1 -0
  280. package/dist/openclaw/reply-listener-start.d.ts +9 -0
  281. package/dist/openclaw/reply-listener-status.d.ts +4 -0
  282. package/dist/openclaw/reply-listener-stop.d.ts +7 -0
  283. package/dist/openclaw/reply-listener.d.ts +5 -18
  284. package/dist/openclaw/session-registry-lock.d.ts +2 -0
  285. package/dist/openclaw/session-registry-paths.d.ts +9 -0
  286. package/dist/openclaw/session-registry-storage.d.ts +4 -0
  287. package/dist/openclaw/session-registry-types.d.ts +11 -0
  288. package/dist/openclaw/session-registry.d.ts +2 -11
  289. package/dist/plugin/chat-message/loop-commands.d.ts +9 -0
  290. package/dist/plugin/chat-message/model-cache-warning.d.ts +12 -0
  291. package/dist/plugin/chat-message/prompt-text.d.ts +2 -0
  292. package/dist/plugin/chat-message/session-model.d.ts +4 -0
  293. package/dist/plugin/chat-message/start-work-message.d.ts +5 -0
  294. package/dist/plugin/chat-message/types.d.ts +67 -0
  295. package/dist/plugin/chat-message.d.ts +3 -24
  296. package/dist/plugin/event-error-utils.d.ts +14 -0
  297. package/dist/plugin/event-hook-dispatcher.d.ts +5 -0
  298. package/dist/plugin/event-model-fallback-state.d.ts +30 -0
  299. package/dist/plugin/event-model-fallback.d.ts +39 -0
  300. package/dist/plugin/event-session-lifecycle.d.ts +49 -0
  301. package/dist/plugin/event-session-recovery.d.ts +9 -0
  302. package/dist/plugin/event-team-handlers.d.ts +13 -0
  303. package/dist/plugin/event-types.d.ts +78 -0
  304. package/dist/plugin/event.d.ts +3 -12
  305. package/dist/plugin/hooks/create-core-hooks.d.ts +1 -0
  306. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -1
  307. package/dist/plugin/hooks/model-fallback-title-updater.d.ts +8 -0
  308. package/dist/plugin/session-compacting.d.ts +4 -1
  309. package/dist/plugin/system-transform.d.ts +1 -1
  310. package/dist/plugin/tool-execute-after.d.ts +2 -0
  311. package/dist/plugin/tool-registry-core-tools.d.ts +15 -0
  312. package/dist/plugin/tool-registry-factories.d.ts +36 -0
  313. package/dist/plugin/tool-registry-gated-tools.d.ts +16 -0
  314. package/dist/plugin/tool-registry-team-tools.d.ts +14 -0
  315. package/dist/plugin/tool-registry-trimming.d.ts +2 -0
  316. package/dist/plugin/tool-registry.d.ts +3 -38
  317. package/dist/plugin/ultrawork-db-model-override.d.ts +1 -1
  318. package/dist/plugin-config/agent-order-warnings.d.ts +1 -0
  319. package/dist/plugin-config/config-merger.d.ts +2 -0
  320. package/dist/plugin-config/layered-config-loader.d.ts +2 -0
  321. package/dist/plugin-config/single-config-loader.d.ts +4 -0
  322. package/dist/plugin-config.d.ts +3 -5
  323. package/dist/plugin-handlers/agent-config-assembly.d.ts +19 -0
  324. package/dist/plugin-handlers/agent-config-finalizer.d.ts +4 -0
  325. package/dist/plugin-handlers/agent-config-handler.d.ts +2 -11
  326. package/dist/plugin-handlers/agent-config-types.d.ts +30 -0
  327. package/dist/plugin-handlers/agent-skill-discovery.d.ts +3 -0
  328. package/dist/plugin-handlers/agent-source-loader.d.ts +2 -0
  329. package/dist/plugin-handlers/hook-config-handler.d.ts +0 -3
  330. package/dist/shared/context-window-usage.d.ts +7 -0
  331. package/dist/shared/dynamic-truncator-types.d.ts +17 -0
  332. package/dist/shared/dynamic-truncator.d.ts +8 -23
  333. package/dist/shared/migration/migrations-sidecar.d.ts +2 -2
  334. package/dist/shared/migration/model-versions.d.ts +7 -4
  335. package/dist/shared/model-availability.d.ts +1 -1
  336. package/dist/shared/opencode-version.d.ts +2 -2
  337. package/dist/shared/sparkshell-awareness.d.ts +5 -0
  338. package/dist/shared/spawn-with-windows-hide.d.ts +2 -0
  339. package/dist/shared/token-limit-truncator.d.ts +2 -0
  340. package/dist/testing/module-mock-lifecycle.d.ts +8 -0
  341. package/dist/tools/delegate-task/openai-categories.d.ts +0 -1
  342. package/dist/tools/delegate-task/subagent-agent-match.d.ts +3 -0
  343. package/dist/tools/delegate-task/subagent-model-resolution.d.ts +4 -0
  344. package/dist/tools/delegate-task/subagent-request-preflight.d.ts +3 -0
  345. package/dist/tools/delegate-task/subagent-resolution-types.d.ts +32 -0
  346. package/dist/tools/delegate-task/subagent-resolver.d.ts +3 -12
  347. package/dist/tools/delegate-task/sync-completion-message.d.ts +20 -0
  348. package/dist/tools/delegate-task/sync-poll-error-recovery.d.ts +1 -0
  349. package/dist/tools/delegate-task/sync-session-lifecycle.d.ts +12 -0
  350. package/dist/tools/delegate-task/sync-session-poller.d.ts +2 -0
  351. package/dist/tools/delegate-task/sync-spawn-reservation.d.ts +10 -0
  352. package/dist/tools/delegate-task/sync-task-metadata.d.ts +11 -0
  353. package/dist/tools/delegate-task/sync-task-runner.d.ts +30 -0
  354. package/dist/tools/delegate-task/sync-task.d.ts +2 -1
  355. package/dist/tools/hashline-edit/formatter-trigger.d.ts +2 -2
  356. package/package.json +16 -14
  357. package/packages/git-bash-mcp/dist/cli.js +29 -12
  358. package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.d.ts +1 -1
  359. package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.js +1 -1
  360. package/packages/lsp-tools-mcp/dist/lsp/config-loader.js +95 -30
  361. package/packages/lsp-tools-mcp/dist/lsp/server-installation.d.ts +1 -2
  362. package/packages/lsp-tools-mcp/dist/lsp/server-installation.js +1 -11
  363. package/packages/lsp-tools-mcp/dist/lsp/transport.d.ts +1 -0
  364. package/packages/lsp-tools-mcp/dist/lsp/transport.js +5 -10
  365. package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.d.ts +4 -1
  366. package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.js +84 -23
  367. package/packages/lsp-tools-mcp/dist/missing-dependency-result.d.ts +2 -0
  368. package/packages/lsp-tools-mcp/dist/missing-dependency-result.js +14 -0
  369. package/packages/lsp-tools-mcp/dist/tools.js +64 -80
  370. package/packages/lsp-tools-mcp/package.json +52 -0
  371. package/packages/omo-codex/lazycodex-repository/.github/workflows/pr-source-guidance.yml +36 -0
  372. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  373. package/packages/omo-codex/plugin/README.md +26 -1
  374. package/packages/omo-codex/plugin/components/comment-checker/src/apply-patch.ts +188 -0
  375. package/packages/omo-codex/plugin/components/comment-checker/src/core-values.ts +1 -0
  376. package/packages/omo-codex/plugin/components/comment-checker/src/core.ts +15 -361
  377. package/packages/omo-codex/plugin/components/comment-checker/src/hook-input.ts +19 -0
  378. package/packages/omo-codex/plugin/components/comment-checker/src/record.ts +11 -0
  379. package/packages/omo-codex/plugin/components/comment-checker/src/request-extractor.ts +102 -0
  380. package/packages/omo-codex/plugin/components/comment-checker/src/types.ts +51 -0
  381. package/packages/omo-codex/plugin/components/comment-checker/test/codex-hook.test.ts +145 -0
  382. package/packages/omo-codex/plugin/components/comment-checker/test/core.test.ts +200 -0
  383. package/packages/omo-codex/plugin/components/lsp/CHANGELOG.md +2 -2
  384. package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus.md +11 -5
  385. package/packages/omo-codex/plugin/components/rules/src/hook-output.ts +11 -1
  386. package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +0 -1
  387. package/packages/omo-codex/plugin/components/rules/src/rules/constants.ts +1 -4
  388. package/packages/omo-codex/plugin/components/rules/src/rules/engine-dynamic-cache.ts +87 -0
  389. package/packages/omo-codex/plugin/components/rules/src/rules/engine-dynamic-loader.ts +94 -0
  390. package/packages/omo-codex/plugin/components/rules/src/rules/engine-loader.ts +84 -0
  391. package/packages/omo-codex/plugin/components/rules/src/rules/engine-paths.ts +103 -0
  392. package/packages/omo-codex/plugin/components/rules/src/rules/engine-static-loader.ts +43 -0
  393. package/packages/omo-codex/plugin/components/rules/src/rules/engine-types.ts +45 -0
  394. package/packages/omo-codex/plugin/components/rules/src/rules/engine.ts +8 -419
  395. package/packages/omo-codex/plugin/components/rules/src/rules/formatter.ts +32 -5
  396. package/packages/omo-codex/plugin/components/rules/src/rules/parser-frontmatter.ts +39 -0
  397. package/packages/omo-codex/plugin/components/rules/src/rules/parser-yaml.ts +271 -0
  398. package/packages/omo-codex/plugin/components/rules/src/rules/parser.ts +3 -294
  399. package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +57 -0
  400. package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +13 -2
  401. package/packages/omo-codex/plugin/components/rules/src/transcript-rule-filter.ts +17 -0
  402. package/packages/omo-codex/plugin/components/rules/test/bundled-rules-priority.test.ts +2 -1
  403. package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +26 -11
  404. package/packages/omo-codex/plugin/components/rules/test/codex-hook-context-pressure.test.ts +104 -138
  405. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +5 -2
  406. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +12 -5
  407. package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +10 -4
  408. package/packages/omo-codex/plugin/components/rules/test/engine.test.ts +65 -3
  409. package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +47 -2
  410. package/packages/omo-codex/plugin/components/rules/test/hook-output.test.ts +16 -0
  411. package/packages/omo-codex/plugin/components/rules/test/parser.test.ts +153 -0
  412. package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +12 -0
  413. package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +236 -0
  414. package/packages/omo-codex/plugin/components/rules/test/tool-paths.test.ts +28 -50
  415. package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +6 -3
  416. package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +13 -6
  417. package/packages/omo-codex/plugin/components/start-work-continuation/src/codex-hook.ts +21 -0
  418. package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +64 -2
  419. package/packages/omo-codex/plugin/components/telemetry/README.md +11 -1
  420. package/packages/omo-codex/plugin/components/telemetry/biome.json +12 -0
  421. package/packages/omo-codex/plugin/components/telemetry/src/codex-hook.ts +30 -3
  422. package/packages/omo-codex/plugin/components/telemetry/src/diagnostics.ts +154 -0
  423. package/packages/omo-codex/plugin/components/telemetry/src/posthog-activity-state.ts +18 -2
  424. package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +36 -4
  425. package/packages/omo-codex/plugin/components/telemetry/test/codex-hook-diagnostics.test.ts +115 -0
  426. package/packages/omo-codex/plugin/components/telemetry/test/codex-hook.test.ts +16 -25
  427. package/packages/omo-codex/plugin/components/telemetry/test/diagnostics.test.ts +119 -0
  428. package/packages/omo-codex/plugin/components/ultrawork/AGENTS.md +1 -1
  429. package/packages/omo-codex/plugin/components/ultrawork/README.md +5 -5
  430. package/packages/omo-codex/plugin/components/ultrawork/agents/codex-ultrawork-reviewer.toml +2 -1
  431. package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -0
  432. package/packages/omo-codex/plugin/components/ultrawork/agents/metis.toml +0 -1
  433. package/packages/omo-codex/plugin/components/ultrawork/agents/momus.toml +0 -1
  434. package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +1 -2
  435. package/packages/omo-codex/plugin/components/ultrawork/directive.md +97 -32
  436. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +65 -0
  437. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/agents/openai.yaml +7 -0
  438. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +131 -0
  439. package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +38 -10
  440. package/packages/omo-codex/plugin/components/ultrawork/test/directive-contract.test.ts +18 -0
  441. package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +47 -0
  442. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  443. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +12 -8
  444. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +28 -21
  445. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +2 -3
  446. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-hook.ts +7 -7
  447. package/packages/omo-codex/plugin/components/ulw-loop/src/command-types.ts +36 -0
  448. package/packages/omo-codex/plugin/components/ulw-loop/src/constants.ts +64 -0
  449. package/packages/omo-codex/plugin/components/ulw-loop/src/domain-types.ts +98 -0
  450. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-crud.ts +17 -2
  451. package/packages/omo-codex/plugin/components/ulw-loop/src/runtime.ts +22 -0
  452. package/packages/omo-codex/plugin/components/ulw-loop/src/steering-types.ts +69 -0
  453. package/packages/omo-codex/plugin/components/ulw-loop/src/types.ts +5 -277
  454. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-commands.test.ts +35 -13
  455. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-complete-goals.test.ts +52 -0
  456. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-steering.test.ts +67 -111
  457. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +2 -2
  458. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +31 -2
  459. package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +46 -9
  460. package/packages/omo-codex/plugin/components/ulw-loop/test/steering.test.ts +20 -29
  461. package/packages/omo-codex/plugin/model-catalog.json +5 -11
  462. package/packages/omo-codex/plugin/package-lock.json +1 -1
  463. package/packages/omo-codex/plugin/scripts/auto-update-state.mjs +78 -0
  464. package/packages/omo-codex/plugin/scripts/auto-update.mjs +173 -61
  465. package/packages/omo-codex/plugin/scripts/migrate-codex-config/catalog.mjs +71 -0
  466. package/packages/omo-codex/plugin/scripts/migrate-codex-config/config-paths.mjs +44 -0
  467. package/packages/omo-codex/plugin/scripts/migrate-codex-config/root-settings.mjs +74 -0
  468. package/packages/omo-codex/plugin/scripts/migrate-codex-config/state.mjs +29 -0
  469. package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +14 -202
  470. package/packages/omo-codex/plugin/scripts/spawn-command.mjs +11 -0
  471. package/packages/omo-codex/plugin/scripts/sync-hook-status-messages.mjs +23 -9
  472. package/packages/omo-codex/plugin/scripts/sync-skills.mjs +131 -28
  473. package/packages/omo-codex/plugin/skills/debugging/references/methodology/04-oracle-triple.md +3 -3
  474. package/packages/omo-codex/plugin/skills/git-master/SKILL.md +100 -0
  475. package/packages/omo-codex/plugin/skills/git-master/agents/openai.yaml +13 -0
  476. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +9 -7
  477. package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/SKILL.md +176 -0
  478. package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/agents/openai.yaml +12 -0
  479. package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/scripts/create-pr-body.mjs +107 -0
  480. package/packages/omo-codex/plugin/skills/lcx-report-bug/SKILL.md +119 -14
  481. package/packages/omo-codex/plugin/skills/lcx-report-bug/agents/openai.yaml +4 -2
  482. package/packages/omo-codex/plugin/skills/programming/references/go/concurrency.md +2 -2
  483. package/packages/omo-codex/plugin/skills/programming/references/python/async-anyio.md +6 -6
  484. package/packages/omo-codex/plugin/skills/programming/references/python/pydantic-ai.md +12 -12
  485. package/packages/omo-codex/plugin/skills/programming/references/typescript/backend-hono.md +7 -7
  486. package/packages/omo-codex/plugin/skills/refactor/SKILL.md +13 -11
  487. package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +10 -8
  488. package/packages/omo-codex/plugin/skills/review-work/SKILL.md +68 -33
  489. package/packages/omo-codex/plugin/skills/start-work/SKILL.md +86 -22
  490. package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +770 -0
  491. package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +12 -8
  492. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +28 -21
  493. package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +45 -379
  494. package/packages/omo-codex/plugin/skills/ulw-plan/agents/openai.yaml +7 -0
  495. package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +131 -0
  496. package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +237 -0
  497. package/packages/omo-codex/plugin/skills/visual-qa/scripts/ansi.ts +17 -0
  498. package/packages/omo-codex/plugin/skills/visual-qa/scripts/cli.ts +82 -0
  499. package/packages/omo-codex/plugin/skills/visual-qa/scripts/east-asian-width.ts +72 -0
  500. package/packages/omo-codex/plugin/skills/visual-qa/scripts/image-diff.ts +109 -0
  501. package/packages/omo-codex/plugin/skills/visual-qa/scripts/png-crc.ts +27 -0
  502. package/packages/omo-codex/plugin/skills/visual-qa/scripts/png-decode.ts +206 -0
  503. package/packages/omo-codex/plugin/skills/visual-qa/scripts/png-synth.ts +57 -0
  504. package/packages/omo-codex/plugin/skills/visual-qa/scripts/tui-grid.ts +88 -0
  505. package/packages/omo-codex/plugin/skills/visual-qa/scripts/types.ts +54 -0
  506. package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +55 -0
  507. package/packages/omo-codex/plugin/test/aggregate-build.test.mjs +38 -0
  508. package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +164 -0
  509. package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +73 -0
  510. package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +69 -0
  511. package/packages/omo-codex/plugin/test/aggregate-model-catalog.test.mjs +53 -0
  512. package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +83 -0
  513. package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +67 -0
  514. package/packages/omo-codex/plugin/test/aggregate.test.mjs +2 -514
  515. package/packages/omo-codex/plugin/test/auto-update-state-persistence.test.mjs +36 -0
  516. package/packages/omo-codex/plugin/test/auto-update.test.mjs +204 -26
  517. package/packages/omo-codex/plugin/test/component-bin-names.test.mjs +1 -1
  518. package/packages/omo-codex/plugin/test/global-review-debug-gate.test.mjs +29 -0
  519. package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +23 -10
  520. package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +81 -0
  521. package/packages/omo-codex/plugin/test/lcx-contribute-bug-fix-template.test.mjs +91 -0
  522. package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +165 -9
  523. package/packages/omo-codex/plugin/test/node-install-surface.test.mjs +0 -19
  524. package/packages/omo-codex/plugin/test/start-work-skill.test.mjs +107 -0
  525. package/packages/omo-codex/plugin/test/subagent-guidance.test.mjs +82 -7
  526. package/packages/omo-codex/plugin/test/sync-hook-status-messages.test.mjs +58 -6
  527. package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +152 -0
  528. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +158 -50
  529. package/packages/omo-codex/plugin/test/ulw-plan-skill.test.mjs +43 -0
  530. package/packages/omo-codex/scripts/install/agent-source-roots.mjs +13 -0
  531. package/packages/omo-codex/scripts/install/agents.mjs +84 -14
  532. package/packages/omo-codex/scripts/install/bin-links.mjs +239 -0
  533. package/packages/omo-codex/scripts/install/cache.mjs +152 -108
  534. package/packages/omo-codex/scripts/install/cached-marketplace-manifest.mjs +21 -0
  535. package/packages/omo-codex/scripts/install/cli-args.mjs +39 -2
  536. package/packages/omo-codex/scripts/install/config.mjs +7 -5
  537. package/packages/omo-codex/scripts/install/lazycodex-version-stamp.mjs +102 -0
  538. package/packages/omo-codex/scripts/install/legacy-bins.mjs +9 -1
  539. package/packages/omo-codex/scripts/install/model-catalog.mjs +9 -1
  540. package/packages/omo-codex/scripts/install/process.mjs +3 -1
  541. package/packages/omo-codex/scripts/install/project-local-cleanup.mjs +0 -1
  542. package/packages/omo-codex/scripts/install/snapshot.mjs +0 -1
  543. package/packages/omo-codex/scripts/install-agent-links.test.mjs +205 -11
  544. package/packages/omo-codex/scripts/install-bin-links.test.mjs +123 -1
  545. package/packages/omo-codex/scripts/install-cache-copy.test.mjs +129 -5
  546. package/packages/omo-codex/scripts/install-cli-args.test.mjs +82 -1
  547. package/packages/omo-codex/scripts/install-config-preservation.test.mjs +43 -0
  548. package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +14 -1
  549. package/packages/omo-codex/scripts/install-config.test.mjs +49 -1
  550. package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +84 -0
  551. package/packages/omo-codex/scripts/install-local-entrypoint.test.mjs +51 -0
  552. package/packages/omo-codex/scripts/install-local.mjs +42 -40
  553. package/packages/omo-codex/scripts/install-local.test.mjs +17 -241
  554. package/packages/omo-codex/scripts/install-marketplace-cache.test.mjs +162 -0
  555. package/packages/omo-codex/scripts/install-packaged-local.test.mjs +10 -6
  556. package/packages/omo-codex/scripts/install-project-local-cleanup.test.mjs +73 -2
  557. package/packages/omo-codex/scripts/sync-telemetry-component.mjs +1 -0
  558. package/packages/shared-skills/skills/debugging/references/methodology/04-oracle-triple.md +3 -3
  559. package/packages/shared-skills/skills/git-master/SKILL.md +100 -0
  560. package/packages/shared-skills/skills/git-master/agents/openai.yaml +13 -0
  561. package/packages/shared-skills/skills/lcx-contribute-bug-fix/SKILL.md +176 -0
  562. package/packages/shared-skills/skills/lcx-contribute-bug-fix/agents/openai.yaml +12 -0
  563. package/packages/shared-skills/skills/lcx-contribute-bug-fix/scripts/create-pr-body.mjs +107 -0
  564. package/packages/shared-skills/skills/lcx-report-bug/SKILL.md +119 -14
  565. package/packages/shared-skills/skills/lcx-report-bug/agents/openai.yaml +4 -2
  566. package/packages/shared-skills/skills/programming/references/go/concurrency.md +2 -2
  567. package/packages/shared-skills/skills/programming/references/python/async-anyio.md +6 -6
  568. package/packages/shared-skills/skills/programming/references/python/pydantic-ai.md +12 -12
  569. package/packages/shared-skills/skills/programming/references/typescript/backend-hono.md +7 -7
  570. package/packages/shared-skills/skills/refactor/SKILL.md +4 -4
  571. package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +1 -1
  572. package/packages/shared-skills/skills/review-work/SKILL.md +55 -33
  573. package/packages/shared-skills/skills/start-work/SKILL.md +76 -19
  574. package/packages/shared-skills/skills/ultraresearch/SKILL.md +770 -0
  575. package/packages/shared-skills/skills/visual-qa/SKILL.md +219 -0
  576. package/packages/shared-skills/skills/visual-qa/scripts/ansi.test.ts +45 -0
  577. package/packages/shared-skills/skills/visual-qa/scripts/ansi.ts +17 -0
  578. package/packages/shared-skills/skills/visual-qa/scripts/cli.test.ts +73 -0
  579. package/packages/shared-skills/skills/visual-qa/scripts/cli.ts +82 -0
  580. package/packages/shared-skills/skills/visual-qa/scripts/east-asian-width.test.ts +60 -0
  581. package/packages/shared-skills/skills/visual-qa/scripts/east-asian-width.ts +72 -0
  582. package/packages/shared-skills/skills/visual-qa/scripts/image-diff.test.ts +70 -0
  583. package/packages/shared-skills/skills/visual-qa/scripts/image-diff.ts +109 -0
  584. package/packages/shared-skills/skills/visual-qa/scripts/png-crc.ts +27 -0
  585. package/packages/shared-skills/skills/visual-qa/scripts/png-decode.test.ts +44 -0
  586. package/packages/shared-skills/skills/visual-qa/scripts/png-decode.ts +206 -0
  587. package/packages/shared-skills/skills/visual-qa/scripts/png-synth.ts +57 -0
  588. package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +83 -0
  589. package/packages/shared-skills/skills/visual-qa/scripts/tui-grid.test.ts +57 -0
  590. package/packages/shared-skills/skills/visual-qa/scripts/tui-grid.ts +88 -0
  591. package/packages/shared-skills/skills/visual-qa/scripts/types.ts +54 -0
  592. package/postinstall.mjs +24 -1
  593. package/dist/agents/custom-agent-summaries.d.ts +0 -8
  594. package/dist/agents/hephaestus/gpt-5-3-codex.d.ts +0 -20
  595. package/dist/agents/prometheus/gemini.d.ts +0 -1
  596. package/dist/agents/prometheus/gpt.d.ts +0 -1
  597. package/dist/agents/sisyphus-junior/gpt-5-3-codex.d.ts +0 -8
  598. package/dist/features/background-agent/session-route.d.ts +0 -12
  599. package/dist/features/background-agent/spawner/parent-directory-resolver.d.ts +0 -6
  600. package/dist/features/background-agent/state.d.ts +0 -35
  601. package/dist/features/claude-tasks/session-storage.d.ts +0 -9
  602. package/dist/features/mcp-oauth/resource-indicator.d.ts +0 -2
  603. package/dist/features/mcp-oauth/schema.d.ts +0 -6
  604. package/dist/features/opencode-skill-loader/async-loader.d.ts +0 -6
  605. package/dist/features/opencode-skill-loader/blocking.d.ts +0 -2
  606. package/dist/features/opencode-skill-loader/discover-worker.d.ts +0 -1
  607. package/dist/hooks/session-recovery/recover-empty-content-message-sdk.d.ts +0 -13
  608. package/dist/shared/bun-hash-shim.d.ts +0 -1
  609. package/dist/tools/delegate-task/resolve-call-id.d.ts +0 -2
  610. package/packages/shared-skills/skills/ulw-plan/SKILL.md +0 -383
  611. /package/packages/lsp-tools-mcp/dist/lsp/{utils.d.ts → startup-failure.d.ts} +0 -0
  612. /package/packages/lsp-tools-mcp/dist/lsp/{utils.js → startup-failure.js} +0 -0
@@ -22,6 +22,21 @@ describe("start-work Stop hook", () => {
22
22
  expect(output).toBe("");
23
23
  });
24
24
 
25
+ it("#given no boulder state and start work prompt #when stop hook runs #then it stays quiet", () => {
26
+ // given
27
+ const fs = createMemoryFs();
28
+ const input = {
29
+ ...createStopInput(),
30
+ last_assistant_message: "I'll start work on this plan now.",
31
+ };
32
+
33
+ // when
34
+ const output = runStopHook(input, fs);
35
+
36
+ // then
37
+ expect(output).toBe("");
38
+ });
39
+
25
40
  it("#given active codex work with remaining top-level tasks #when hook runs #then returns block JSON", () => {
26
41
  // given
27
42
  const fs = createMemoryFs({
@@ -49,6 +64,38 @@ describe("start-work Stop hook", () => {
49
64
  expect(parsed.reason).toContain("- Your session id in boulder.json: `codex:sess_abc`");
50
65
  });
51
66
 
67
+ it("#given context-window pressure in transcript #when hook runs #then it does not inject continuation text", () => {
68
+ // given
69
+ const transcriptPath = "/repo/transcript.jsonl";
70
+ const fs = createMemoryFs({
71
+ [BOULDER_PATH]: createBoulderJson({
72
+ sessionIds: ["codex:sess_abc"],
73
+ status: "active",
74
+ }),
75
+ [PLAN_PATH]: ["# Plan", "", "## TODOs", "- [ ] First"].join("\n"),
76
+ [transcriptPath]: [
77
+ JSON.stringify({
78
+ type: "message",
79
+ payload: {
80
+ content: {
81
+ error: {
82
+ code: "context_too_large",
83
+ },
84
+ },
85
+ },
86
+ }),
87
+ "Your input exceeds the context window of this model.",
88
+ "",
89
+ ].join("\n"),
90
+ });
91
+
92
+ // when
93
+ const output = runStopHook({ ...createStopInput(), transcript_path: transcriptPath }, fs);
94
+
95
+ // then
96
+ expect(output).toBe("");
97
+ });
98
+
52
99
  it("#given active codex work #when continuation directive is emitted #then subagent guidance is reliable", () => {
53
100
  // given
54
101
  const fs = createMemoryFs({
@@ -66,9 +113,11 @@ describe("start-work Stop hook", () => {
66
113
  const parsed = parseBlockOutput(output);
67
114
  expect(parsed.reason).toMatch(/TASK:/);
68
115
  expect(parsed.reason).toMatch(/fork_turns:\s*"none"/);
69
- expect(parsed.reason).toMatch(/wait_agent.*signal, not proof/);
70
- expect(parsed.reason).toMatch(/one targeted followup/);
116
+ expect(parsed.reason).toMatch(/wait_agent.*mailbox signals/);
117
+ expect(parsed.reason).toMatch(/TASK STILL ACTIVE/);
71
118
  expect(parsed.reason).toMatch(/respawn.*smaller/);
119
+ expect(parsed.reason).toMatch(/WORKING:/);
120
+ expect(parsed.reason).toMatch(/single `list_agents`/);
72
121
  });
73
122
 
74
123
  it("#given active work belongs to another harness #when hook runs #then returns empty output", () => {
@@ -113,6 +162,19 @@ describe("start-work Stop hook", () => {
113
162
  expect(output).toBe("");
114
163
  });
115
164
 
165
+ it("#given malformed boulder JSON #when hook runs #then returns empty output", () => {
166
+ // given
167
+ const fs = createMemoryFs({
168
+ [BOULDER_PATH]: "{",
169
+ });
170
+
171
+ // when
172
+ const output = runStopHook(createStopInput(), fs);
173
+
174
+ // then
175
+ expect(output).toBe("");
176
+ });
177
+
116
178
  it("#given malformed input #when hook runs #then returns empty output", () => {
117
179
  // given
118
180
  const fs = createMemoryFs();
@@ -76,7 +76,17 @@ containing `{ "lastActiveDayUTC": "YYYY-MM-DD" }`. If the stored day matches tod
76
76
 
77
77
  ## Failure Behavior
78
78
 
79
- Every telemetry path is wrapped in `try`/`catch`. The hook always exits 0 with no stdout output, even when PostHog construction, capture, or shutdown fails. Codex session startup is never blocked or slowed by telemetry failures.
79
+ Every telemetry path is wrapped in `try`/`catch`. The hook always exits 0 with no stdout or stderr output, even when PostHog construction, capture, or shutdown fails. Codex session startup is never blocked or slowed by telemetry failures.
80
+
81
+ Handled telemetry failures are written only to a local diagnostics file:
82
+
83
+ ```
84
+ $XDG_DATA_HOME/omo-codex/telemetry-diagnostics.jsonl
85
+ # or, when XDG_DATA_HOME is unset:
86
+ ~/.local/share/omo-codex/telemetry-diagnostics.jsonl
87
+ ```
88
+
89
+ The diagnostics file keeps JSONL rows for recent telemetry failures, prunes stale rows during writes, and caps itself at 256 KiB by dropping the oldest complete rows. Diagnostics are never sent to PostHog and do not include prompt contents, transcript contents, raw hostnames, API keys, tokens, or full hook payloads.
80
90
 
81
91
  ## Endpoint Overrides
82
92
 
@@ -34,6 +34,18 @@
34
34
  "includes": ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts", "!**/node_modules/**/*", "!**/dist/**/*"]
35
35
  },
36
36
  "overrides": [
37
+ {
38
+ "includes": [
39
+ "src/atomic-write.ts",
40
+ "src/data-path.ts",
41
+ "src/diagnostics.ts",
42
+ "src/env-flags.ts",
43
+ "src/posthog-activity-state.ts"
44
+ ],
45
+ "formatter": {
46
+ "enabled": false
47
+ }
48
+ },
37
49
  {
38
50
  "includes": ["vitest.config.ts"],
39
51
  "linter": {
@@ -1,3 +1,8 @@
1
+ import {
2
+ type TelemetryDiagnosticErrorKind,
3
+ type TelemetryDiagnosticEvent,
4
+ writeTelemetryDiagnostic,
5
+ } from "./diagnostics.js";
1
6
  import {
2
7
  createPluginPostHog,
3
8
  getPostHogDistinctId,
@@ -22,6 +27,19 @@ export type CodexTelemetryHookOptions = {
22
27
 
23
28
  const SESSION_START_REASON: PostHogActivityReason = "session_start";
24
29
 
30
+ function writeHookDiagnostic(
31
+ event: TelemetryDiagnosticEvent,
32
+ error: unknown,
33
+ errorKind: TelemetryDiagnosticErrorKind,
34
+ ): void {
35
+ writeTelemetryDiagnostic({
36
+ event,
37
+ source: "plugin",
38
+ error,
39
+ errorKind,
40
+ });
41
+ }
42
+
25
43
  export async function runSessionStartHook(
26
44
  _input: CodexSessionStartInput,
27
45
  options: CodexTelemetryHookOptions = {},
@@ -29,10 +47,18 @@ export async function runSessionStartHook(
29
47
  const createClient = options.createClient ?? createPluginPostHog;
30
48
  const getDistinctId = options.getDistinctId ?? getPostHogDistinctId;
31
49
 
32
- const client = await createClient();
50
+ let client: PostHogClient;
51
+ try {
52
+ client = await createClient();
53
+ } catch (error) {
54
+ writeHookDiagnostic("telemetry_posthog_init_failed", error, error instanceof Error ? "error" : "non_error");
55
+ return "";
56
+ }
57
+
33
58
  try {
34
59
  client.trackActive(getDistinctId(), SESSION_START_REASON);
35
- } catch {
60
+ } catch (error) {
61
+ writeHookDiagnostic("telemetry_capture_failed", error, error instanceof Error ? "error" : "non_error");
36
62
  await safeShutdown(client);
37
63
  return "";
38
64
  }
@@ -43,7 +69,8 @@ export async function runSessionStartHook(
43
69
  async function safeShutdown(client: PostHogClient): Promise<void> {
44
70
  try {
45
71
  await client.shutdown();
46
- } catch {
72
+ } catch (error) {
73
+ writeHookDiagnostic("telemetry_shutdown_failed", error, error instanceof Error ? "error" : "non_error");
47
74
  return;
48
75
  }
49
76
  }
@@ -0,0 +1,154 @@
1
+ import { appendFileSync, existsSync, mkdirSync, readFileSync } from "node:fs"
2
+ import { join } from "node:path"
3
+
4
+ import { writeFileAtomically } from "./atomic-write.js"
5
+ import { getActivityStateDir } from "./data-path.js"
6
+
7
+ export type TelemetryDiagnosticEvent =
8
+ | "telemetry_activity_state_read_failed"
9
+ | "telemetry_activity_state_write_failed"
10
+ | "telemetry_capture_failed"
11
+ | "telemetry_cpu_info_unavailable"
12
+ | "telemetry_posthog_import_failed"
13
+ | "telemetry_posthog_init_failed"
14
+ | "telemetry_shutdown_failed"
15
+
16
+ export type TelemetryDiagnosticSource = "cli" | "install" | "plugin" | "shared"
17
+
18
+ export type TelemetryDiagnosticErrorKind = "error" | "non_error"
19
+
20
+ export type TelemetryDiagnosticInput = {
21
+ readonly event: TelemetryDiagnosticEvent
22
+ readonly source: TelemetryDiagnosticSource
23
+ readonly error?: unknown
24
+ readonly errorKind?: TelemetryDiagnosticErrorKind
25
+ }
26
+
27
+ const DIAGNOSTICS_FILE_NAME = "telemetry-diagnostics.jsonl"
28
+ const DIAGNOSTICS_RETENTION_MS = 7 * 24 * 60 * 60 * 1000
29
+ const DIAGNOSTICS_MAX_BYTES = 256 * 1024
30
+
31
+ export function getTelemetryDiagnosticsFilePath(): string {
32
+ return join(getActivityStateDir(), DIAGNOSTICS_FILE_NAME)
33
+ }
34
+
35
+ export function writeTelemetryDiagnostic(input: TelemetryDiagnosticInput, now: Date = new Date()): void {
36
+ try {
37
+ cleanupTelemetryDiagnostics(now)
38
+ mkdirSync(getActivityStateDir(), { recursive: true })
39
+ appendFileSync(getTelemetryDiagnosticsFilePath(), `${JSON.stringify(toDiagnosticRecord(input, now))}\n`, "utf-8")
40
+ } catch {
41
+ return
42
+ }
43
+ }
44
+
45
+ export function cleanupTelemetryDiagnostics(now: Date = new Date()): void {
46
+ const diagnosticsFilePath = getTelemetryDiagnosticsFilePath()
47
+ if (!existsSync(diagnosticsFilePath)) {
48
+ return
49
+ }
50
+
51
+ try {
52
+ const cutoffMs = now.getTime() - DIAGNOSTICS_RETENTION_MS
53
+ const retainedLines = trimToMaxBytes(
54
+ readFileSync(diagnosticsFilePath, "utf-8")
55
+ .split("\n")
56
+ .filter((line) => shouldRetainLine(line, cutoffMs)),
57
+ )
58
+ writeFileAtomically(diagnosticsFilePath, retainedLines.length === 0 ? "" : `${retainedLines.join("\n")}\n`)
59
+ } catch {
60
+ return
61
+ }
62
+ }
63
+
64
+ function toDiagnosticRecord(
65
+ input: TelemetryDiagnosticInput,
66
+ now: Date,
67
+ ): Record<string, string> {
68
+ return {
69
+ timestamp: now.toISOString(),
70
+ event: input.event,
71
+ source: input.source,
72
+ ...serializeError(input.error, input.errorKind),
73
+ }
74
+ }
75
+
76
+ function serializeError(
77
+ error: unknown,
78
+ errorKind?: TelemetryDiagnosticErrorKind,
79
+ ): Record<string, string> {
80
+ if (error instanceof Error) {
81
+ return {
82
+ error_kind: errorKind ?? "error",
83
+ error_name: error.name,
84
+ error_message: error.message,
85
+ }
86
+ }
87
+
88
+ if (error === undefined) {
89
+ return {}
90
+ }
91
+
92
+ return {
93
+ error_kind: errorKind ?? "non_error",
94
+ error_name: typeof error,
95
+ error_message: String(error),
96
+ }
97
+ }
98
+
99
+ function shouldRetainLine(line: string, cutoffMs: number): boolean {
100
+ if (line.length === 0) {
101
+ return false
102
+ }
103
+
104
+ const parsed = parseDiagnosticLine(line)
105
+ if (parsed === null) {
106
+ return false
107
+ }
108
+
109
+ const timestamp = parsed["timestamp"]
110
+ if (typeof timestamp !== "string") {
111
+ return false
112
+ }
113
+
114
+ const timestampMs = Date.parse(timestamp)
115
+ return Number.isFinite(timestampMs) && timestampMs >= cutoffMs
116
+ }
117
+
118
+ function parseDiagnosticLine(line: string): Record<string, unknown> | null {
119
+ try {
120
+ const parsed: unknown = JSON.parse(line)
121
+ if (!isRecord(parsed)) {
122
+ return null
123
+ }
124
+ return parsed
125
+ } catch {
126
+ return null
127
+ }
128
+ }
129
+
130
+ function isRecord(value: unknown): value is Record<string, unknown> {
131
+ return value !== null && typeof value === "object" && !Array.isArray(value)
132
+ }
133
+
134
+ function trimToMaxBytes(lines: ReadonlyArray<string>): ReadonlyArray<string> {
135
+ const retained: string[] = []
136
+ let totalBytes = 0
137
+
138
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
139
+ const line = lines[index]
140
+ if (line === undefined) {
141
+ continue
142
+ }
143
+
144
+ const lineBytes = Buffer.byteLength(`${line}\n`, "utf-8")
145
+ if (totalBytes + lineBytes > DIAGNOSTICS_MAX_BYTES) {
146
+ break
147
+ }
148
+
149
+ retained.unshift(line)
150
+ totalBytes += lineBytes
151
+ }
152
+
153
+ return retained
154
+ }
@@ -3,6 +3,7 @@ import { join } from "node:path"
3
3
 
4
4
  import { writeFileAtomically } from "./atomic-write.js"
5
5
  import { getActivityStateDir } from "./data-path.js"
6
+ import { type TelemetryDiagnosticErrorKind, type TelemetryDiagnosticEvent, writeTelemetryDiagnostic } from "./diagnostics.js"
6
7
 
7
8
  export type PostHogActivityState = {
8
9
  readonly lastActiveDayUTC?: string
@@ -27,6 +28,19 @@ function isPostHogActivityState(value: unknown): value is PostHogActivityState {
27
28
  return value !== null && typeof value === "object" && !Array.isArray(value)
28
29
  }
29
30
 
31
+ function writeActivityStateDiagnostic(
32
+ event: TelemetryDiagnosticEvent,
33
+ error: unknown,
34
+ errorKind: TelemetryDiagnosticErrorKind,
35
+ ): void {
36
+ writeTelemetryDiagnostic({
37
+ event,
38
+ source: "shared",
39
+ error,
40
+ errorKind,
41
+ })
42
+ }
43
+
30
44
  function readPostHogActivityState(): PostHogActivityState {
31
45
  const stateFilePath = getPostHogActivityStateFilePath()
32
46
 
@@ -43,7 +57,8 @@ function readPostHogActivityState(): PostHogActivityState {
43
57
  }
44
58
 
45
59
  return stateJson
46
- } catch {
60
+ } catch (error) {
61
+ writeActivityStateDiagnostic("telemetry_activity_state_read_failed", error, error instanceof Error ? "error" : "non_error")
47
62
  return {}
48
63
  }
49
64
  }
@@ -55,7 +70,8 @@ function writePostHogActivityState(nextState: PostHogActivityState): void {
55
70
  try {
56
71
  mkdirSync(stateDir, { recursive: true })
57
72
  writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}\n`)
58
- } catch {
73
+ } catch (error) {
74
+ writeActivityStateDiagnostic("telemetry_activity_state_write_failed", error, error instanceof Error ? "error" : "non_error")
59
75
  return
60
76
  }
61
77
  }
@@ -3,6 +3,12 @@ import os from "node:os";
3
3
 
4
4
  import type { PostHog } from "posthog-node";
5
5
 
6
+ import {
7
+ type TelemetryDiagnosticErrorKind,
8
+ type TelemetryDiagnosticEvent,
9
+ type TelemetryDiagnosticSource,
10
+ writeTelemetryDiagnostic,
11
+ } from "./diagnostics.js";
6
12
  import { getPostHogApiKey, getPostHogHost, hasPostHogApiKey, shouldDisablePostHog } from "./env-flags.js";
7
13
  import { getPostHogActivityCaptureState } from "./posthog-activity-state.js";
8
14
  import {
@@ -44,6 +50,15 @@ function resolveActivityStateProvider(): ActivityStateProvider {
44
50
  return activityStateProviderOverride ?? getPostHogActivityCaptureState;
45
51
  }
46
52
 
53
+ function writePostHogDiagnostic(
54
+ event: TelemetryDiagnosticEvent,
55
+ source: TelemetryDiagnosticSource,
56
+ error: unknown,
57
+ errorKind: TelemetryDiagnosticErrorKind,
58
+ ): void {
59
+ writeTelemetryDiagnostic({ event, source, error, errorKind });
60
+ }
61
+
47
62
  function getSafeCpuInfo(): { readonly count: number; readonly model: string | undefined } {
48
63
  try {
49
64
  const cpuInfo = resolveOsProvider().cpus();
@@ -51,7 +66,13 @@ function getSafeCpuInfo(): { readonly count: number; readonly model: string | un
51
66
  count: cpuInfo.length,
52
67
  model: cpuInfo[0]?.model,
53
68
  };
54
- } catch {
69
+ } catch (error) {
70
+ writePostHogDiagnostic(
71
+ "telemetry_cpu_info_unavailable",
72
+ "plugin",
73
+ error,
74
+ error instanceof Error ? "error" : "non_error",
75
+ );
55
76
  return {
56
77
  count: 0,
57
78
  model: undefined,
@@ -96,8 +117,13 @@ export async function createPluginPostHog(): Promise<PostHogClient> {
96
117
  const module = await import("posthog-node");
97
118
  PostHogClientConstructor = module.PostHog;
98
119
  } catch (error) {
99
- if (error instanceof Error) return NO_OP_POSTHOG;
100
- throw error;
120
+ writePostHogDiagnostic(
121
+ "telemetry_posthog_import_failed",
122
+ "plugin",
123
+ error,
124
+ error instanceof Error ? "error" : "non_error",
125
+ );
126
+ return NO_OP_POSTHOG;
101
127
  }
102
128
 
103
129
  let client: PostHog;
@@ -112,7 +138,13 @@ export async function createPluginPostHog(): Promise<PostHogClient> {
112
138
  host: getPostHogHost(),
113
139
  disableGeoip: false,
114
140
  });
115
- } catch {
141
+ } catch (error) {
142
+ writePostHogDiagnostic(
143
+ "telemetry_posthog_init_failed",
144
+ "plugin",
145
+ error,
146
+ error instanceof Error ? "error" : "non_error",
147
+ );
116
148
  return NO_OP_POSTHOG;
117
149
  }
118
150
 
@@ -0,0 +1,115 @@
1
+ import { mkdtempSync, readFileSync, rmSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
3
+ import path from "node:path";
4
+ import { afterEach, describe, expect, it } from "vitest";
5
+
6
+ import { type CodexSessionStartInput, runSessionStartHook } from "../src/codex-hook.js";
7
+ import { getTelemetryDiagnosticsFilePath } from "../src/diagnostics.js";
8
+ import type { PostHogClient } from "../src/posthog.js";
9
+
10
+ const tempDirectories: string[] = [];
11
+ const originalXdgDataHome = process.env["XDG_DATA_HOME"];
12
+
13
+ afterEach(() => {
14
+ if (originalXdgDataHome === undefined) {
15
+ delete process.env["XDG_DATA_HOME"];
16
+ } else {
17
+ process.env["XDG_DATA_HOME"] = originalXdgDataHome;
18
+ }
19
+
20
+ for (const directory of tempDirectories.splice(0)) {
21
+ rmSync(directory, { recursive: true, force: true });
22
+ }
23
+ });
24
+
25
+ function makeSessionStartInput(overrides: Partial<CodexSessionStartInput> = {}): CodexSessionStartInput {
26
+ return {
27
+ session_id: "session-123",
28
+ transcript_path: null,
29
+ cwd: "/tmp/project",
30
+ hook_event_name: "SessionStart",
31
+ model: "gpt-5.5",
32
+ permission_mode: "default",
33
+ source: "startup",
34
+ ...overrides,
35
+ };
36
+ }
37
+
38
+ function createDiagnosticsDataDir(): string {
39
+ const dataDir = mkdtempSync(path.join(tmpdir(), "codex-telemetry-diagnostics-"));
40
+ tempDirectories.push(dataDir);
41
+ process.env["XDG_DATA_HOME"] = dataDir;
42
+ return dataDir;
43
+ }
44
+
45
+ describe("runSessionStartHook diagnostics", () => {
46
+ describe("#given a client whose trackActive throws", () => {
47
+ it("#when invoked #then swallows the error, writes diagnostics, still shuts down, and returns empty string", async () => {
48
+ let shutdownCalls = 0;
49
+ createDiagnosticsDataDir();
50
+ const throwingClient: PostHogClient = {
51
+ trackActive: () => {
52
+ throw new Error("trackActive failed");
53
+ },
54
+ shutdown: async () => {
55
+ shutdownCalls += 1;
56
+ },
57
+ };
58
+
59
+ const output = await runSessionStartHook(makeSessionStartInput(), {
60
+ createClient: () => throwingClient,
61
+ getDistinctId: () => "distinct-id-abc",
62
+ });
63
+
64
+ expect(output).toBe("");
65
+ expect(shutdownCalls).toBe(1);
66
+ const diagnostics = readFileSync(getTelemetryDiagnosticsFilePath(), "utf-8");
67
+ expect(diagnostics).toContain('"event":"telemetry_capture_failed"');
68
+ expect(diagnostics).toContain('"error_message":"trackActive failed"');
69
+ });
70
+
71
+ it("#when invoked with a non-Error throw #then writes diagnostics and still returns empty string", async () => {
72
+ let shutdownCalls = 0;
73
+ const failure = Symbol("trackActive failed");
74
+ createDiagnosticsDataDir();
75
+ const throwingClient: PostHogClient = {
76
+ trackActive: () => {
77
+ throw failure;
78
+ },
79
+ shutdown: async () => {
80
+ shutdownCalls += 1;
81
+ },
82
+ };
83
+
84
+ const output = await runSessionStartHook(makeSessionStartInput(), {
85
+ createClient: () => throwingClient,
86
+ getDistinctId: () => "distinct-id-abc",
87
+ });
88
+
89
+ expect(output).toBe("");
90
+ expect(shutdownCalls).toBe(1);
91
+ const diagnostics = readFileSync(getTelemetryDiagnosticsFilePath(), "utf-8");
92
+ expect(diagnostics).toContain('"event":"telemetry_capture_failed"');
93
+ expect(diagnostics).toContain('"error_name":"symbol"');
94
+ expect(diagnostics).toContain('"error_message":"Symbol(trackActive failed)"');
95
+ });
96
+ });
97
+
98
+ describe("#given a client whose shutdown rejects", () => {
99
+ it("#when invoked #then swallows the rejection and returns empty string", async () => {
100
+ const rejectingClient: PostHogClient = {
101
+ trackActive: () => undefined,
102
+ shutdown: async () => {
103
+ throw new Error("shutdown failed");
104
+ },
105
+ };
106
+
107
+ const output = await runSessionStartHook(makeSessionStartInput(), {
108
+ createClient: () => rejectingClient,
109
+ getDistinctId: () => "distinct-id-abc",
110
+ });
111
+
112
+ expect(output).toBe("");
113
+ });
114
+ });
115
+ });
@@ -22,8 +22,15 @@ type CliResult = {
22
22
  };
23
23
 
24
24
  const tempDirectories: string[] = [];
25
+ const originalXdgDataHome = process.env["XDG_DATA_HOME"];
25
26
 
26
27
  afterEach(() => {
28
+ if (originalXdgDataHome === undefined) {
29
+ delete process.env["XDG_DATA_HOME"];
30
+ } else {
31
+ process.env["XDG_DATA_HOME"] = originalXdgDataHome;
32
+ }
33
+
27
34
  for (const directory of tempDirectories.splice(0)) {
28
35
  rmSync(directory, { recursive: true, force: true });
29
36
  }
@@ -116,39 +123,23 @@ describe("runSessionStartHook", () => {
116
123
  });
117
124
  });
118
125
 
119
- describe("#given a client whose trackActive throws", () => {
120
- it("#when invoked #then swallows the error, still shuts down, and returns empty string", async () => {
121
- let shutdownCalls = 0;
122
- const throwingClient: PostHogClient = {
123
- trackActive: () => {
124
- throw new Error("trackActive failed");
125
- },
126
- shutdown: async () => {
127
- shutdownCalls += 1;
128
- },
129
- };
130
-
126
+ describe("#given PostHog client creation fails", () => {
127
+ it("#when createClient throws #then hook resolves with empty output", async () => {
131
128
  const output = await runSessionStartHook(makeSessionStartInput(), {
132
- createClient: () => throwingClient,
129
+ createClient: () => {
130
+ throw new Error("posthog unavailable");
131
+ },
133
132
  getDistinctId: () => "distinct-id-abc",
134
133
  });
135
134
 
136
135
  expect(output).toBe("");
137
- expect(shutdownCalls).toBe(1);
138
136
  });
139
- });
140
-
141
- describe("#given a client whose shutdown rejects", () => {
142
- it("#when invoked #then swallows the rejection and returns empty string", async () => {
143
- const rejectingClient: PostHogClient = {
144
- trackActive: () => undefined,
145
- shutdown: async () => {
146
- throw new Error("shutdown failed");
147
- },
148
- };
149
137
 
138
+ it("#when createClient rejects #then hook resolves with empty output", async () => {
150
139
  const output = await runSessionStartHook(makeSessionStartInput(), {
151
- createClient: () => rejectingClient,
140
+ createClient: async () => {
141
+ throw new Error("posthog unavailable");
142
+ },
152
143
  getDistinctId: () => "distinct-id-abc",
153
144
  });
154
145