oh-my-opencode 4.18.0 → 4.18.1

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 (192) hide show
  1. package/.agents/skills/codex-qa/scripts/lsp-e2e.sh +3654 -0
  2. package/.agents/skills/opencode-qa/scripts/lsp-e2e.sh +3071 -0
  3. package/.agents/skills/work-with-pr/SKILL.md +16 -37
  4. package/.agents/skills/work-with-pr-workspace/evals/evals.json +3 -3
  5. package/.opencode/skills/work-with-pr/SKILL.md +16 -37
  6. package/.opencode/skills/work-with-pr-workspace/evals/evals.json +3 -3
  7. package/dist/cli/index.js +457 -154
  8. package/dist/cli-node/index.js +457 -154
  9. package/dist/index.js +415 -388
  10. package/package.json +16 -16
  11. package/packages/lsp-core/package.json +4 -0
  12. package/packages/lsp-core/src/index.ts +1 -0
  13. package/packages/lsp-core/src/lsp/cleanup-errors.test.ts +18 -0
  14. package/packages/lsp-core/src/lsp/cleanup-errors.ts +12 -3
  15. package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +261 -0
  16. package/packages/lsp-core/src/lsp/client-wrapper.test.ts +63 -0
  17. package/packages/lsp-core/src/lsp/client-wrapper.ts +35 -5
  18. package/packages/lsp-core/src/lsp/client.ts +262 -80
  19. package/packages/lsp-core/src/lsp/config-loader.ts +5 -17
  20. package/packages/lsp-core/src/lsp/connection.ts +12 -6
  21. package/packages/lsp-core/src/lsp/directory-diagnostics.test.ts +104 -0
  22. package/packages/lsp-core/src/lsp/directory-diagnostics.ts +60 -27
  23. package/packages/lsp-core/src/lsp/errors.ts +11 -0
  24. package/packages/lsp-core/src/lsp/fixtures/diagnostics-freshness-contract-probe.ts +283 -0
  25. package/packages/lsp-core/src/lsp/fixtures/workspace-edit-contract-probe.ts +196 -0
  26. package/packages/lsp-core/src/lsp/fixtures/workspace-edit-server.mjs +215 -0
  27. package/packages/lsp-core/src/lsp/formatters.ts +3 -0
  28. package/packages/lsp-core/src/lsp/json-rpc-connection-cancellation.test.ts +97 -0
  29. package/packages/lsp-core/src/lsp/json-rpc-connection.ts +73 -5
  30. package/packages/lsp-core/src/lsp/server-install-state.ts +3 -6
  31. package/packages/lsp-core/src/lsp/transport-protocol.ts +52 -0
  32. package/packages/lsp-core/src/lsp/transport.ts +96 -70
  33. package/packages/lsp-core/src/lsp/workspace-apply-edit-failure.ts +19 -0
  34. package/packages/lsp-core/src/lsp/workspace-apply-edit-lease.integration.test.ts +214 -0
  35. package/packages/lsp-core/src/lsp/workspace-apply-edit-sync.integration.test.ts +113 -0
  36. package/packages/lsp-core/src/lsp/workspace-apply-edit-test-support.ts +163 -0
  37. package/packages/lsp-core/src/lsp/workspace-apply-edit.integration.test.ts +163 -0
  38. package/packages/lsp-core/src/lsp/workspace-document-state.test.ts +67 -0
  39. package/packages/lsp-core/src/lsp/workspace-document-state.ts +368 -0
  40. package/packages/lsp-core/src/lsp/workspace-edit-adversarial.test.ts +113 -0
  41. package/packages/lsp-core/src/lsp/workspace-edit-commit.test.ts +140 -0
  42. package/packages/lsp-core/src/lsp/workspace-edit-commit.ts +220 -0
  43. package/packages/lsp-core/src/lsp/workspace-edit-contract-evidence.test.ts +56 -0
  44. package/packages/lsp-core/src/lsp/workspace-edit-contract-evidence.ts +30 -0
  45. package/packages/lsp-core/src/lsp/workspace-edit-fingerprint.ts +44 -0
  46. package/packages/lsp-core/src/lsp/workspace-edit-options.test.ts +147 -0
  47. package/packages/lsp-core/src/lsp/workspace-edit-parse-helpers.ts +59 -0
  48. package/packages/lsp-core/src/lsp/workspace-edit-parser.ts +130 -0
  49. package/packages/lsp-core/src/lsp/workspace-edit-path.ts +98 -0
  50. package/packages/lsp-core/src/lsp/workspace-edit-plan-types.ts +60 -0
  51. package/packages/lsp-core/src/lsp/workspace-edit-plan.ts +73 -0
  52. package/packages/lsp-core/src/lsp/workspace-edit-prevalidation.test.ts +174 -0
  53. package/packages/lsp-core/src/lsp/workspace-edit-resource-parser.ts +89 -0
  54. package/packages/lsp-core/src/lsp/workspace-edit-simulation.ts +183 -0
  55. package/packages/lsp-core/src/lsp/workspace-edit-snapshot.ts +53 -0
  56. package/packages/lsp-core/src/lsp/workspace-edit-text.ts +125 -0
  57. package/packages/lsp-core/src/lsp/workspace-edit-types.ts +121 -0
  58. package/packages/lsp-core/src/lsp/workspace-edit.characterization.test.ts +95 -0
  59. package/packages/lsp-core/src/lsp/workspace-edit.ts +49 -200
  60. package/packages/lsp-core/src/lsp/workspace-mutation-controller.ts +182 -0
  61. package/packages/lsp-core/src/mcp.ts +18 -7
  62. package/packages/lsp-core/src/missing-dependency-result.test.ts +105 -0
  63. package/packages/lsp-core/src/missing-dependency-result.ts +57 -0
  64. package/packages/lsp-core/src/post-edit/index.ts +1 -0
  65. package/packages/lsp-core/src/post-edit/orchestration.test.ts +157 -0
  66. package/packages/lsp-core/src/post-edit/orchestration.ts +178 -0
  67. package/packages/lsp-core/src/request-context.test.ts +171 -0
  68. package/packages/lsp-core/src/request-context.ts +222 -9
  69. package/packages/lsp-core/src/tool-surface.test.ts +4 -1
  70. package/packages/lsp-core/src/tools/diagnostics.ts +32 -13
  71. package/packages/lsp-core/src/tools/navigation.ts +12 -12
  72. package/packages/lsp-core/src/tools/rename.ts +10 -15
  73. package/packages/lsp-core/src/tools/symbols.ts +11 -11
  74. package/packages/lsp-core/src/tools/types.ts +2 -1
  75. package/packages/lsp-daemon/dist/cli.js +3114 -747
  76. package/packages/lsp-daemon/dist/client.d.ts +105 -0
  77. package/packages/lsp-daemon/dist/client.js +5851 -0
  78. package/packages/lsp-daemon/dist/daemon-client.d.ts +11 -6
  79. package/packages/lsp-daemon/dist/daemon-client.js +113 -30
  80. package/packages/lsp-daemon/dist/daemon-server.d.ts +1 -0
  81. package/packages/lsp-daemon/dist/daemon-server.js +40 -15
  82. package/packages/lsp-daemon/dist/ensure-daemon.d.ts +8 -7
  83. package/packages/lsp-daemon/dist/ensure-daemon.js +67 -44
  84. package/packages/lsp-daemon/dist/index.d.ts +2 -2
  85. package/packages/lsp-daemon/dist/index.js +2862 -754
  86. package/packages/lsp-daemon/dist/ipc-protocol.d.ts +46 -0
  87. package/packages/lsp-daemon/dist/ipc-protocol.js +187 -0
  88. package/packages/lsp-daemon/dist/lock.js +14 -4
  89. package/packages/lsp-daemon/dist/ownership.d.ts +49 -0
  90. package/packages/lsp-daemon/dist/ownership.js +168 -0
  91. package/packages/lsp-daemon/dist/paths.d.ts +33 -9
  92. package/packages/lsp-daemon/dist/paths.js +72 -33
  93. package/packages/lsp-daemon/dist/proxy.d.ts +3 -0
  94. package/packages/lsp-daemon/dist/proxy.js +54 -3
  95. package/packages/lsp-daemon/dist/request-routing.d.ts +7 -2
  96. package/packages/lsp-daemon/dist/request-routing.js +71 -22
  97. package/packages/lsp-daemon/dist/run-daemon.js +9 -2
  98. package/packages/lsp-daemon/dist/runtime-contract.d.ts +21 -0
  99. package/packages/lsp-daemon/dist/runtime-contract.js +58 -0
  100. package/packages/lsp-daemon/dist/socket-jsonrpc.js +6 -1
  101. package/packages/lsp-daemon/package.json +12 -3
  102. package/packages/lsp-tools-mcp/dist/cli.js +2115 -442
  103. package/packages/lsp-tools-mcp/dist/lsp/manager.js +1741 -148
  104. package/packages/lsp-tools-mcp/dist/mcp.js +2127 -454
  105. package/packages/lsp-tools-mcp/dist/request-context.js +176 -6
  106. package/packages/lsp-tools-mcp/dist/tools.js +2118 -446
  107. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  108. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  109. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  110. package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
  111. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  112. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  113. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  114. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  115. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  116. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  117. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +55 -0
  118. package/packages/omo-codex/plugin/components/lsp/dist/cli.js +2959 -944
  119. package/packages/omo-codex/plugin/components/lsp/dist/codex-hook-cli.js +0 -4
  120. package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.d.ts +5 -2
  121. package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.js +41 -62
  122. package/packages/omo-codex/plugin/components/lsp/dist/daemon-cli-path.d.ts +1 -1
  123. package/packages/omo-codex/plugin/components/lsp/dist/daemon-cli-path.js +24 -15
  124. package/packages/omo-codex/plugin/components/lsp/dist/lsp-session-state.d.ts +3 -7
  125. package/packages/omo-codex/plugin/components/lsp/dist/lsp-session-state.js +23 -49
  126. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  127. package/packages/omo-codex/plugin/components/lsp/package.json +3 -2
  128. package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-daemon.mjs +31 -1
  129. package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-daemon.test.mjs +76 -0
  130. package/packages/omo-codex/plugin/components/lsp/scripts/build-runtime.mjs +201 -0
  131. package/packages/omo-codex/plugin/components/lsp/scripts/build-runtime.test.mjs +55 -0
  132. package/packages/omo-codex/plugin/components/lsp/src/codex-hook-cli.ts +0 -4
  133. package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +49 -71
  134. package/packages/omo-codex/plugin/components/lsp/src/daemon-cli-path.ts +26 -15
  135. package/packages/omo-codex/plugin/components/lsp/src/lsp-session-state.ts +26 -64
  136. package/packages/omo-codex/plugin/components/lsp/test/codex-hook-unavailable.test.ts +16 -17
  137. package/packages/omo-codex/plugin/components/lsp/test/codex-hook.test.ts +30 -4
  138. package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +19 -5
  139. package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus/gpt-5.5.md +1 -1
  140. package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus/gpt-5.6.md +1 -1
  141. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  142. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  143. package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +1 -1
  144. package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
  145. package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
  146. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  147. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  148. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  149. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  150. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  151. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  152. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
  153. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  154. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +1 -1
  155. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +6 -5
  156. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  157. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  158. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  159. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +1 -1
  160. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  161. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  162. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  163. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  164. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  165. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  166. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  167. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  168. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  169. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
  170. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  171. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  172. package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +1 -1
  173. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  174. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +1 -1
  175. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  176. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  177. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  178. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  179. package/packages/omo-codex/plugin/package-lock.json +26 -14
  180. package/packages/omo-codex/plugin/package.json +1 -1
  181. package/packages/omo-codex/plugin/scripts/build-bundled-mcp-runtimes.mjs +2 -3
  182. package/packages/omo-codex/plugin/scripts/build-components.mjs +13 -1
  183. package/packages/omo-codex/plugin/scripts/sync-skills.mjs +1 -1
  184. package/packages/omo-codex/plugin/skills/start-work/SKILL.md +1 -1
  185. package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +1 -1
  186. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +6 -5
  187. package/packages/omo-codex/plugin/test/aggregate-build.test.mjs +8 -0
  188. package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +128 -15
  189. package/packages/omo-codex/plugin/test/install-time-build-runtime.test.mjs +10 -0
  190. package/packages/omo-codex/plugin/test/lsp-prebuild-layouts.test.mjs +2 -0
  191. package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +1 -1
  192. package/packages/omo-codex/scripts/install-dist/install-local.mjs +328 -63
package/dist/cli/index.js CHANGED
@@ -2145,7 +2145,7 @@ var package_default;
2145
2145
  var init_package = __esm(() => {
2146
2146
  package_default = {
2147
2147
  name: "oh-my-opencode",
2148
- version: "4.18.0",
2148
+ version: "4.18.1",
2149
2149
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
2150
2150
  main: "./dist/index.js",
2151
2151
  types: "dist/index.d.ts",
@@ -2254,7 +2254,8 @@ var init_package = __esm(() => {
2254
2254
  "build:codex-install": "bun run script/build-codex-install.ts",
2255
2255
  "install:codex-dev": "bun run script/build-codex-install.ts && bun run script/install-codex-dev.ts",
2256
2256
  "build:codex-plugin": "npm --prefix packages/omo-codex/plugin ci && bun run --cwd packages/omo-codex/plugin build",
2257
- "build:senpi-plugin": "node packages/omo-senpi/plugin/scripts/build-extension.mjs && node packages/omo-senpi/plugin/scripts/sync-skills.mjs && node packages/omo-senpi/plugin/scripts/embed-directive.mjs --check",
2257
+ "build:senpi-plugin": "bun run build:lsp-daemon && bun run build:senpi-plugin:stage",
2258
+ "build:senpi-plugin:stage": "node packages/omo-senpi/plugin/scripts/stage-lsp-daemon-runtime.mjs && node packages/omo-senpi/plugin/scripts/build-extension.mjs && node packages/omo-senpi/plugin/scripts/sync-skills.mjs && node packages/omo-senpi/plugin/scripts/embed-directive.mjs --check && node packages/omo-senpi/plugin/scripts/build-install.mjs",
2258
2259
  "build:materialize-frontend": "node packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs --strict",
2259
2260
  "build:shared-skills-assets": "bun run build:materialize-frontend && rm -rf dist/skills && cp -R packages/shared-skills/skills dist/skills",
2260
2261
  "build:lsp-tools-mcp": "npm --prefix packages/lsp-tools-mcp ci && npm --prefix packages/lsp-tools-mcp run build",
@@ -2276,7 +2277,7 @@ var init_package = __esm(() => {
2276
2277
  "typecheck:script": "tsgo --noEmit -p script/tsconfig.json",
2277
2278
  test: "bun test",
2278
2279
  "test:codex": "bun run build:codex-install && bun run build:git-bash-mcp && bun run build:lsp-tools-mcp && bun run build:lsp-daemon && npm --prefix packages/lsp-tools-mcp test && npm --prefix packages/omo-codex/plugin ci && npm --prefix packages/omo-codex/plugin/components/ulw-loop test && bun run --cwd packages/omo-codex/plugin build && npm --prefix packages/omo-codex/plugin/components/codegraph run typecheck && npm --prefix packages/omo-codex/plugin/components/codegraph test && node scripts/check-third-party-notices.mjs --ship && bun test packages/omo-opencode/src/cli/cli-installer.platform.test.ts packages/omo-codex/src/install/codex-cache.test.ts packages/omo-codex/src/install/codex-cleanup.test.ts packages/omo-codex/src/install/codex-config-agent-cleanup.test.ts packages/omo-codex/src/install/codex-config-autonomous-features.test.ts packages/omo-codex/src/install/codex-config-reasoning.test.ts packages/omo-codex/src/install/codex-config-toml.test.ts packages/omo-codex/src/install/codex-project-local-cleanup.test.ts packages/omo-codex/src/install/install-codex-project-local-cleanup.test.ts packages/omo-codex/src/install/install-codex.test.ts packages/omo-codex/src/install/install-codex-packaged.test.ts packages/omo-codex/src/install/link-cached-plugin-agents.test.ts packages/omo-codex/src/**/*.test.ts packages/utils/src/jsonc-parser.test.ts packages/utils/src/frontmatter.test.ts packages/hashline-core/src/hash-computation.test.ts packages/hashline-core/src/smoke-untested-modules.test.ts packages/rules-engine/src/index.test.ts packages/rules-engine/src/security-boundary.test.ts packages/agents-md-core/src/injector.test.ts packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts && node --test packages/omo-codex/plugin/test/*.test.mjs packages/omo-codex/scripts/install-cache-copy.test.mjs packages/omo-codex/scripts/install-cli-args.test.mjs packages/omo-codex/scripts/install-delegated-command.test.mjs packages/omo-codex/scripts/install-config-autonomous-features.test.mjs packages/omo-codex/scripts/install-config-autonomous.test.mjs packages/omo-codex/scripts/install-config-reasoning.test.mjs packages/omo-codex/scripts/install-config.test.mjs packages/omo-codex/scripts/install-hook-targets.test.mjs packages/omo-codex/scripts/install-project-local-cleanup.test.mjs packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs packages/omo-codex/scripts/install-local-entrypoint.test.mjs packages/omo-codex/scripts/install-local-git-bash-preflight.test.mjs packages/omo-codex/scripts/install-local.test.mjs packages/omo-codex/scripts/install-marketplace-cache.test.mjs packages/omo-codex/scripts/install-mcp-context7-runtime.test.mjs packages/omo-codex/scripts/install-mcp-runtime.test.mjs packages/omo-codex/scripts/install-packaged-local.test.mjs packages/omo-codex/scripts/install-generated-bundle.test.mjs packages/omo-codex/scripts/install-agent-links.test.mjs packages/omo-codex/scripts/install-bin-links.test.mjs",
2279
- "test:senpi": "node packages/omo-senpi/plugin/scripts/build-extension.mjs && node packages/omo-senpi/plugin/scripts/sync-skills.mjs && node packages/omo-senpi/plugin/scripts/embed-directive.mjs --check && bun test packages/omo-senpi",
2280
+ "test:senpi": "bun run build:senpi-plugin && tsgo --noEmit -p packages/omo-senpi/tsconfig.json && bun test packages/omo-senpi",
2280
2281
  "test:windows-codex": "bun run test:codex",
2281
2282
  "build:git-bash-mcp": "bun run --cwd packages/git-bash-mcp build"
2282
2283
  },
@@ -2316,7 +2317,6 @@ var init_package = __esm(() => {
2316
2317
  picocolors: "^1.1.1",
2317
2318
  picomatch: "^4.0.4",
2318
2319
  "posthog-node": "^5.34.3",
2319
- "vscode-jsonrpc": "^8.2.1",
2320
2320
  zod: "^4.4.3"
2321
2321
  },
2322
2322
  devDependencies: {
@@ -2357,18 +2357,18 @@ var init_package = __esm(() => {
2357
2357
  typescript: "^6.0.3"
2358
2358
  },
2359
2359
  optionalDependencies: {
2360
- "oh-my-opencode-darwin-arm64": "4.18.0",
2361
- "oh-my-opencode-darwin-x64": "4.18.0",
2362
- "oh-my-opencode-darwin-x64-baseline": "4.18.0",
2363
- "oh-my-opencode-linux-arm64": "4.18.0",
2364
- "oh-my-opencode-linux-arm64-musl": "4.18.0",
2365
- "oh-my-opencode-linux-x64": "4.18.0",
2366
- "oh-my-opencode-linux-x64-baseline": "4.18.0",
2367
- "oh-my-opencode-linux-x64-musl": "4.18.0",
2368
- "oh-my-opencode-linux-x64-musl-baseline": "4.18.0",
2369
- "oh-my-opencode-windows-arm64": "4.18.0",
2370
- "oh-my-opencode-windows-x64": "4.18.0",
2371
- "oh-my-opencode-windows-x64-baseline": "4.18.0"
2360
+ "oh-my-opencode-darwin-arm64": "4.18.1",
2361
+ "oh-my-opencode-darwin-x64": "4.18.1",
2362
+ "oh-my-opencode-darwin-x64-baseline": "4.18.1",
2363
+ "oh-my-opencode-linux-arm64": "4.18.1",
2364
+ "oh-my-opencode-linux-arm64-musl": "4.18.1",
2365
+ "oh-my-opencode-linux-x64": "4.18.1",
2366
+ "oh-my-opencode-linux-x64-baseline": "4.18.1",
2367
+ "oh-my-opencode-linux-x64-musl": "4.18.1",
2368
+ "oh-my-opencode-linux-x64-musl-baseline": "4.18.1",
2369
+ "oh-my-opencode-windows-arm64": "4.18.1",
2370
+ "oh-my-opencode-windows-x64": "4.18.1",
2371
+ "oh-my-opencode-windows-x64-baseline": "4.18.1"
2372
2372
  },
2373
2373
  overrides: {
2374
2374
  "@earendil-works/pi-agent-core": "0.80.3",
@@ -66795,14 +66795,14 @@ var init_config_manager = __esm(() => {
66795
66795
 
66796
66796
  // packages/telemetry-core/src/activity-state.ts
66797
66797
  import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as readFileSync14 } from "fs";
66798
- import { basename as basename10, join as join53 } from "path";
66798
+ import { basename as basename11, join as join53 } from "path";
66799
66799
  function resolveTelemetryStateDir(product, options = {}) {
66800
66800
  const dataDir = resolveXdgDataDir(product.cacheDirName, {
66801
66801
  env: options.env,
66802
66802
  osProvider: options.osProvider
66803
66803
  });
66804
66804
  const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join53(options.env.XDG_DATA_HOME, product.cacheDirName);
66805
- if (dataDir === xdgStateDir || xdgStateDir === undefined && basename10(dataDir) === product.cacheDirName) {
66805
+ if (dataDir === xdgStateDir || xdgStateDir === undefined && basename11(dataDir) === product.cacheDirName) {
66806
66806
  return dataDir;
66807
66807
  }
66808
66808
  return join53(dataDir, product.cacheDirName);
@@ -67036,18 +67036,18 @@ var init_env2 = __esm(() => {
67036
67036
  });
67037
67037
 
67038
67038
  // packages/telemetry-core/src/machine-id.ts
67039
- import { createHash as createHash3 } from "crypto";
67039
+ import { createHash as createHash4 } from "crypto";
67040
67040
  import os4 from "os";
67041
67041
  function getDefaultTelemetryOsProvider() {
67042
67042
  return os4;
67043
67043
  }
67044
67044
  function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetryOsProvider()) {
67045
- return createHash3("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
67045
+ return createHash4("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
67046
67046
  }
67047
67047
  var init_machine_id = () => {};
67048
67048
 
67049
67049
  // node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
67050
- import { dirname as dirname18, posix as posix2, sep as sep7 } from "path";
67050
+ import { dirname as dirname18, posix as posix3, sep as sep7 } from "path";
67051
67051
  function createModulerModifier() {
67052
67052
  const getModuleFromFileName = createGetModuleFromFilename();
67053
67053
  return async (frames) => {
@@ -67062,7 +67062,7 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname18(proc
67062
67062
  if (!filename)
67063
67063
  return;
67064
67064
  const normalizedFilename = isWindows ? normalizeWindowsPath(filename) : filename;
67065
- let { dir, base: file2, ext } = posix2.parse(normalizedFilename);
67065
+ let { dir, base: file2, ext } = posix3.parse(normalizedFilename);
67066
67066
  if (ext === ".js" || ext === ".mjs" || ext === ".cjs")
67067
67067
  file2 = file2.slice(0, -1 * ext.length);
67068
67068
  const decodedFile = decodeURIComponent(file2);
@@ -72602,7 +72602,7 @@ var package_default2;
72602
72602
  var init_package2 = __esm(() => {
72603
72603
  package_default2 = {
72604
72604
  name: "@oh-my-opencode/omo-codex",
72605
- version: "4.18.0",
72605
+ version: "4.18.1",
72606
72606
  type: "module",
72607
72607
  private: true,
72608
72608
  description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
@@ -73421,18 +73421,18 @@ function removeFromTextBunLock(lockPath, packageNames) {
73421
73421
  try {
73422
73422
  const content = fs12.readFileSync(lockPath, "utf-8");
73423
73423
  const lock = JSON.parse(stripTrailingCommas(content));
73424
- let removed = false;
73424
+ let removed2 = false;
73425
73425
  for (const packageName of packageNames) {
73426
73426
  if (lock.packages?.[packageName]) {
73427
73427
  delete lock.packages[packageName];
73428
73428
  log2(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
73429
- removed = true;
73429
+ removed2 = true;
73430
73430
  }
73431
73431
  }
73432
- if (removed) {
73432
+ if (removed2) {
73433
73433
  fs12.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
73434
73434
  }
73435
- return removed;
73435
+ return removed2;
73436
73436
  } catch (error51) {
73437
73437
  if (!(error51 instanceof Error)) {
73438
73438
  throw error51;
@@ -73472,7 +73472,7 @@ function getInvalidationPackageNames(packageName, defaultPackageName, acceptedPa
73472
73472
  function removeSpecifierRootDirs(cacheDir, packageNames) {
73473
73473
  const parentDirs = [cacheDir, path13.join(cacheDir, "packages")];
73474
73474
  const prefixes = packageNames.map((packageName) => `${packageName}@`);
73475
- let removed = false;
73475
+ let removed2 = false;
73476
73476
  for (const parentDir of parentDirs) {
73477
73477
  if (!fs12.existsSync(parentDir)) {
73478
73478
  continue;
@@ -73484,10 +73484,10 @@ function removeSpecifierRootDirs(cacheDir, packageNames) {
73484
73484
  const specifierDir = path13.join(parentDir, entry.name);
73485
73485
  fs12.rmSync(specifierDir, { recursive: true, force: true });
73486
73486
  log2(`[auto-update-checker] Specifier cache removed: ${specifierDir}`);
73487
- removed = true;
73487
+ removed2 = true;
73488
73488
  }
73489
73489
  }
73490
- return removed;
73490
+ return removed2;
73491
73491
  }
73492
73492
  function invalidatePackage(packageName, options = {}) {
73493
73493
  try {
@@ -77787,65 +77787,297 @@ function formatUnknownError(error) {
77787
77787
  }
77788
77788
 
77789
77789
  // packages/omo-codex/src/install/lsp-daemon-reaper.ts
77790
- import { readFile as readFile18, readdir as readdir9, rm as rm10 } from "fs/promises";
77790
+ import { createHash as createHash3 } from "crypto";
77791
+ import { lstat as lstat11, readFile as readFile19, readdir as readdir10, rm as rm10 } from "fs/promises";
77792
+ import { tmpdir as tmpdir3 } from "os";
77793
+ import { join as join48, posix as posix2 } from "path";
77794
+
77795
+ // packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
77796
+ import { execFile as execFile2 } from "child_process";
77797
+ import { readFile as readFile18, readdir as readdir9, readlink as readlink5 } from "fs/promises";
77791
77798
  import { connect } from "net";
77792
- import { join as join48 } from "path";
77793
- async function reapLspDaemons(codexHome, deps = {}) {
77794
- const killProcess = deps.killProcess ?? sendSigterm;
77795
- const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
77796
- const daemonRoot = join48(codexHome, "codex-lsp", "daemon");
77797
- const reaped = [];
77798
- let entries;
77799
+ import { basename as basename10 } from "path";
77800
+ var PROBE_TIMEOUT_MS = 500;
77801
+ async function probeLegacyJsonRpcEndpoint(endpoint, timeoutMs = PROBE_TIMEOUT_MS) {
77802
+ return await new Promise((resolve14) => {
77803
+ const socket = connect(endpoint);
77804
+ let settled = false;
77805
+ let buffer = "";
77806
+ const finish = (value) => {
77807
+ if (settled)
77808
+ return;
77809
+ settled = true;
77810
+ clearTimeout(timer);
77811
+ socket.destroy();
77812
+ resolve14(value);
77813
+ };
77814
+ const timer = setTimeout(() => finish(false), timeoutMs);
77815
+ timer.unref?.();
77816
+ socket.once("connect", () => {
77817
+ socket.write(`${JSON.stringify(legacyStatusRequest())}
77818
+ `);
77819
+ });
77820
+ socket.on("data", (chunk) => {
77821
+ buffer += chunk.toString("utf8");
77822
+ const newlineIndex = buffer.indexOf(`
77823
+ `);
77824
+ if (newlineIndex < 0)
77825
+ return;
77826
+ finish(isJsonRpcResponse(buffer.slice(0, newlineIndex).trim()));
77827
+ });
77828
+ socket.once("error", () => finish(false));
77829
+ });
77830
+ }
77831
+ async function attestLegacyDaemonOwnership(input, deps = {}) {
77832
+ if (input.platform === "linux")
77833
+ return await attestLinuxOwnership(input, deps);
77834
+ if (input.platform === "darwin")
77835
+ return await attestMacOwnership(input, deps);
77836
+ return false;
77837
+ }
77838
+ async function attestLinuxOwnership(input, deps) {
77839
+ const readFileImpl = deps.readFile ?? readFile18;
77840
+ const readDirImpl = deps.readDir ?? readdir9;
77841
+ const readLinkImpl = deps.readLink ?? readlink5;
77842
+ const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
77843
+ if (procNetUnix === null)
77844
+ return false;
77845
+ const inode = inodeForEndpoint(procNetUnix, input.endpoint);
77846
+ if (inode === null)
77847
+ return false;
77848
+ const fdEntries = await readDirImpl(`/proc/${input.pid}/fd`).catch(() => null);
77849
+ if (fdEntries === null)
77850
+ return false;
77851
+ let ownsEndpoint = false;
77852
+ for (const fdEntry of fdEntries) {
77853
+ const target = await readLinkImpl(`/proc/${input.pid}/fd/${fdEntry}`).catch(() => null);
77854
+ if (target !== `socket:[${inode}]`)
77855
+ continue;
77856
+ ownsEndpoint = true;
77857
+ break;
77858
+ }
77859
+ if (!ownsEndpoint)
77860
+ return false;
77861
+ const cmdline = await readBinary(readFileImpl, `/proc/${input.pid}/cmdline`);
77862
+ if (cmdline === null)
77863
+ return false;
77864
+ return isNodeCliDaemonArgv(splitCmdline(cmdline));
77865
+ }
77866
+ async function attestMacOwnership(input, deps) {
77867
+ const executeFileImpl = deps.executeFile ?? execFile2;
77868
+ const filteredLsofOutput = await executeForStdout(executeFileImpl, "/usr/sbin/lsof", [
77869
+ "-a",
77870
+ "-n",
77871
+ "-P",
77872
+ "-p",
77873
+ String(input.pid),
77874
+ "-U",
77875
+ "-Fn",
77876
+ "--",
77877
+ input.endpoint
77878
+ ]);
77879
+ const lsofOutput = filteredLsofOutput ?? await executeForStdout(executeFileImpl, "/usr/sbin/lsof", [
77880
+ "-a",
77881
+ "-n",
77882
+ "-P",
77883
+ "-p",
77884
+ String(input.pid),
77885
+ "-U",
77886
+ "-Fn"
77887
+ ]);
77888
+ if (lsofOutput === null || !lsofShowsUnixEndpoint(lsofOutput, input.pid, input.endpoint))
77889
+ return false;
77890
+ const commandOutput = await executeForStdout(executeFileImpl, "/bin/ps", ["-p", String(input.pid), "-o", "command="]);
77891
+ if (commandOutput === null)
77892
+ return false;
77893
+ return isNodeCliDaemonCommand(commandOutput.trim());
77894
+ }
77895
+ function legacyStatusRequest() {
77896
+ return {
77897
+ jsonrpc: "2.0",
77898
+ id: 1,
77899
+ method: "tools/call",
77900
+ params: { name: "status", arguments: {} }
77901
+ };
77902
+ }
77903
+ function isJsonRpcResponse(line) {
77904
+ if (line.length === 0)
77905
+ return false;
77799
77906
  try {
77800
- entries = await readdir9(daemonRoot);
77907
+ const parsed = JSON.parse(line);
77908
+ return parsed.jsonrpc === "2.0" && parsed.id === 1 && (Object.hasOwn(parsed, "result") || Object.hasOwn(parsed, "error"));
77801
77909
  } catch {
77802
- return reaped;
77910
+ return false;
77803
77911
  }
77804
- for (const entry of entries) {
77805
- const versionDir = join48(daemonRoot, entry);
77806
- const pid = await readPidFile(join48(versionDir, "daemon.pid"));
77807
- const socketPath = await readEndpointFile(join48(versionDir, "daemon.endpoint"));
77808
- if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
77809
- reaped.push(pid);
77912
+ }
77913
+ function inodeForEndpoint(procNetUnix, endpoint) {
77914
+ for (const line of procNetUnix.split(/\r?\n/)) {
77915
+ const trimmed = line.trim();
77916
+ if (trimmed.length === 0 || trimmed.startsWith("Num"))
77917
+ continue;
77918
+ const fields = trimmed.split(/\s+/);
77919
+ if (fields.length < 8 || fields[7] !== endpoint)
77920
+ continue;
77921
+ return fields[6] ?? null;
77922
+ }
77923
+ return null;
77924
+ }
77925
+ function splitCmdline(buffer) {
77926
+ return buffer.toString("utf8").split("\x00").filter((value) => value.length > 0);
77927
+ }
77928
+ function isNodeCliDaemonArgv(argv) {
77929
+ if (argv.length < 2 || !argv.includes("daemon"))
77930
+ return false;
77931
+ const executable = basename10(argv[0] ?? "");
77932
+ if (!/^node(?:\.exe)?$/i.test(executable))
77933
+ return false;
77934
+ return argv.some((value) => value === "cli.js" || value.endsWith("/cli.js") || value.endsWith("\\cli.js"));
77935
+ }
77936
+ function lsofShowsUnixEndpoint(output, pid, endpoint) {
77937
+ const lines = output.split(/\r?\n/).filter((line) => line.length > 0);
77938
+ const endpointName = basename10(endpoint);
77939
+ return lines.includes(`p${pid}`) && lines.some((line) => line === `n${endpoint}` || line === `n${endpointName}`);
77940
+ }
77941
+ function isNodeCliDaemonCommand(command) {
77942
+ return /\bnode(?:\.exe)?\b/i.test(command) && /\bcli\.js\b/.test(command) && /\bdaemon\b/.test(command);
77943
+ }
77944
+ async function executeForStdout(executeFileImpl, file2, args) {
77945
+ return await new Promise((resolve14) => {
77946
+ executeFileImpl(file2, [...args], { encoding: "utf8", maxBuffer: 1024 * 1024, timeout: 1000 }, (error, stdout) => {
77947
+ if (error !== null) {
77948
+ resolve14(null);
77949
+ return;
77950
+ }
77951
+ resolve14(stdout);
77952
+ });
77953
+ });
77954
+ }
77955
+ async function readText(readFileImpl, path7) {
77956
+ return await readFileImpl(path7, "utf8").catch(() => null);
77957
+ }
77958
+ async function readBinary(readFileImpl, path7) {
77959
+ return await readFileImpl(path7).catch(() => null);
77960
+ }
77961
+
77962
+ // packages/omo-codex/src/install/lsp-daemon-reaper.ts
77963
+ var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
77964
+ var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
77965
+ async function reapLspDaemons(codexHome, deps = {}) {
77966
+ const daemonRoot = join48(codexHome, "codex-lsp", "daemon");
77967
+ const platform = deps.platform ?? process.platform;
77968
+ const tmpDir = deps.tmpDir ?? tmpdir3();
77969
+ const probe2 = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
77970
+ const attest = deps.attestLegacyDaemonOwnership ?? ((input) => attestLegacyDaemonOwnership(input));
77971
+ const killProcess = deps.killProcess ?? sendSigterm;
77972
+ const waitForProcessExit = deps.waitForProcessExit ?? defaultWaitForProcessExit;
77973
+ const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
77974
+ const results = [];
77975
+ for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
77976
+ const versionPath = join48(daemonRoot, entry.name);
77977
+ const parsedVersion = parseVersionEntry(entry.name);
77978
+ if (parsedVersion === null || !entry.isDirectory()) {
77979
+ await removeVersionDir(versionPath);
77980
+ results.push(removed(entry.name, "removed invalid legacy version entry"));
77981
+ continue;
77982
+ }
77983
+ const metadata = await readLegacyMetadata({ versionPath, version: parsedVersion, codexHome, platform, tmpDir });
77984
+ if (metadata.kind === "remove") {
77985
+ await removeVersionDir(versionPath);
77986
+ results.push(removed(parsedVersion, metadata.reason));
77987
+ continue;
77988
+ }
77989
+ if (!await probe2(metadata.endpoint)) {
77990
+ await removeVersionDir(versionPath);
77991
+ results.push(removed(parsedVersion, "removed stale legacy daemon state"));
77992
+ continue;
77993
+ }
77994
+ if (platform === "win32") {
77995
+ results.push(deferred(parsedVersion, "legacy named pipe responded but Windows cannot prove pid ownership safely"));
77996
+ continue;
77810
77997
  }
77811
- await rm10(versionDir, { recursive: true, force: true });
77998
+ const owned = await attest({ pid: metadata.pid, endpoint: metadata.endpoint, platform });
77999
+ if (!owned) {
78000
+ results.push(deferred(parsedVersion, "legacy endpoint responded but pid ownership was not proven"));
78001
+ continue;
78002
+ }
78003
+ if (!killProcess(metadata.pid)) {
78004
+ await removeVersionDir(versionPath);
78005
+ results.push(removed(parsedVersion, "removed stale legacy daemon state"));
78006
+ continue;
78007
+ }
78008
+ if (!await waitForProcessExit(metadata.pid, LEGACY_EXIT_WAIT_TIMEOUT_MS)) {
78009
+ results.push(deferred(parsedVersion, `timed out waiting ${LEGACY_EXIT_WAIT_TIMEOUT_MS}ms for the proven legacy daemon to exit`));
78010
+ continue;
78011
+ }
78012
+ await removeVersionDir(versionPath);
78013
+ results.push(terminated(parsedVersion, "terminated proven owned legacy daemon"));
77812
78014
  }
77813
- return reaped;
78015
+ return results;
77814
78016
  }
77815
- async function readEndpointFile(path7) {
77816
- try {
77817
- const content = (await readFile18(path7, "utf8")).trim();
77818
- return content.length > 0 ? content : null;
77819
- } catch {
78017
+ function parseVersionEntry(entryName) {
78018
+ if (!entryName.startsWith("v"))
77820
78019
  return null;
78020
+ const version = entryName.slice(1);
78021
+ return LEGACY_VERSION_PATTERN.test(version) ? version : null;
78022
+ }
78023
+ async function readLegacyMetadata(input) {
78024
+ const pidText = await readRegularTrimmedFile(join48(input.versionPath, "daemon.pid"));
78025
+ if (pidText === "non_regular")
78026
+ return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
78027
+ if (pidText === null)
78028
+ return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
78029
+ const pid = Number.parseInt(pidText, 10);
78030
+ if (!Number.isInteger(pid) || pid <= 0)
78031
+ return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
78032
+ const endpointText = await readRegularTrimmedFile(join48(input.versionPath, "daemon.endpoint"));
78033
+ if (endpointText === "non_regular")
78034
+ return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
78035
+ if (endpointText === null)
78036
+ return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
78037
+ const allowedEndpoints = legacyEndpointCandidates({
78038
+ version: input.version,
78039
+ versionPath: input.versionPath,
78040
+ platform: input.platform,
78041
+ tmpDir: input.tmpDir
78042
+ });
78043
+ if (!allowedEndpoints.includes(endpointText)) {
78044
+ return { kind: "remove", reason: "removed legacy daemon state with an endpoint outside the frozen vectors" };
77821
78045
  }
78046
+ return { kind: "valid", pid, endpoint: endpointText };
77822
78047
  }
77823
- async function readPidFile(path7) {
77824
- try {
77825
- const pid = Number.parseInt((await readFile18(path7, "utf8")).trim(), 10);
77826
- return Number.isInteger(pid) && pid > 0 ? pid : null;
77827
- } catch {
77828
- return null;
78048
+ function legacyEndpointCandidates(input) {
78049
+ if (input.platform === "win32") {
78050
+ const normalizedVersionPath = input.versionPath.replaceAll("/", "\\");
78051
+ const digest = shortDigest(normalizedVersionPath);
78052
+ return [`\\\\.\\pipe\\omo-lsp-${input.version}-${digest}`];
77829
78053
  }
78054
+ const natural = posix2.join(input.versionPath, "daemon.sock");
78055
+ const hashed = posix2.join(input.tmpDir, `omo-lsp-${input.version}-${shortDigest(input.versionPath)}.sock`);
78056
+ return [natural, hashed];
77830
78057
  }
77831
- function probeSocketLive(socketPath, timeoutMs = 500) {
77832
- return new Promise((resolve14) => {
77833
- const socket = connect(socketPath);
77834
- const done = (ok) => {
77835
- socket.destroy();
77836
- resolve14(ok);
77837
- };
77838
- const timer = setTimeout(() => done(false), timeoutMs);
77839
- timer.unref();
77840
- socket.once("connect", () => {
77841
- clearTimeout(timer);
77842
- done(true);
77843
- });
77844
- socket.once("error", () => {
77845
- clearTimeout(timer);
77846
- done(false);
77847
- });
77848
- });
78058
+ async function readRegularTrimmedFile(path7) {
78059
+ const stats = await lstat11(path7).catch(() => null);
78060
+ if (stats === null)
78061
+ return null;
78062
+ if (!stats.isFile())
78063
+ return "non_regular";
78064
+ const content = (await readFile19(path7, "utf8")).trim();
78065
+ return content.length > 0 ? content : null;
78066
+ }
78067
+ function shortDigest(value) {
78068
+ return createHash3("sha256").update(value).digest("hex").slice(0, 16);
78069
+ }
78070
+ async function removeVersionDir(path7) {
78071
+ await rm10(path7, { recursive: true, force: true });
78072
+ }
78073
+ function removed(version, reason) {
78074
+ return { version, status: "removed", reason };
78075
+ }
78076
+ function terminated(version, reason) {
78077
+ return { version, status: "terminated", reason };
78078
+ }
78079
+ function deferred(version, reason) {
78080
+ return { version, status: "deferred", reason };
77849
78081
  }
77850
78082
  function sendSigterm(pid) {
77851
78083
  try {
@@ -77855,6 +78087,24 @@ function sendSigterm(pid) {
77855
78087
  return false;
77856
78088
  }
77857
78089
  }
78090
+ async function defaultWaitForProcessExit(pid, timeoutMs) {
78091
+ const deadline = Date.now() + timeoutMs;
78092
+ for (;; ) {
78093
+ if (!processIsRunning(pid))
78094
+ return true;
78095
+ if (Date.now() >= deadline)
78096
+ return false;
78097
+ await new Promise((resolve14) => setTimeout(resolve14, 100));
78098
+ }
78099
+ }
78100
+ function processIsRunning(pid) {
78101
+ try {
78102
+ process.kill(pid, 0);
78103
+ return true;
78104
+ } catch {
78105
+ return false;
78106
+ }
78107
+ }
77858
78108
 
77859
78109
  // packages/omo-codex/src/install/codex-installer-bin-dir.ts
77860
78110
  import { homedir as homedir5 } from "os";
@@ -77872,7 +78122,7 @@ function resolveCodexInstallerBinDir(input) {
77872
78122
  }
77873
78123
 
77874
78124
  // packages/omo-codex/src/install/codex-git-bash-hooks.ts
77875
- import { readFile as readFile19, writeFile as writeFile11 } from "fs/promises";
78125
+ import { readFile as readFile20, writeFile as writeFile11 } from "fs/promises";
77876
78126
  import { join as join50 } from "path";
77877
78127
  var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
77878
78128
  "./hooks/pre-tool-use-recommending-git-bash-mcp.json",
@@ -77882,7 +78132,7 @@ async function removeGitBashHooksOffWindows(input) {
77882
78132
  if (input.platform === "win32")
77883
78133
  return;
77884
78134
  const manifestPath = join50(input.pluginRoot, ".codex-plugin", "plugin.json");
77885
- const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
78135
+ const parsed = JSON.parse(await readFile20(manifestPath, "utf8"));
77886
78136
  if (!isPlainRecord3(parsed) || !Array.isArray(parsed.hooks))
77887
78137
  return;
77888
78138
  const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
@@ -78076,7 +78326,16 @@ async function runCodexInstaller(options = {}) {
78076
78326
  pluginNames: marketplace.plugins.map((plugin) => plugin.name)
78077
78327
  });
78078
78328
  }
78079
- await reapLspDaemons(codexHome).catch(() => []);
78329
+ const legacyDaemonCleanup = await reapLspDaemons(codexHome).catch((error) => {
78330
+ const message = error instanceof Error ? error.message : String(error);
78331
+ log4(`Warning: skipped legacy Codex LSP daemon cleanup: ${message}`);
78332
+ return [];
78333
+ });
78334
+ for (const cleanup of legacyDaemonCleanup) {
78335
+ if (cleanup.status !== "deferred")
78336
+ continue;
78337
+ log4(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
78338
+ }
78080
78339
  const marketplaceRoot = join55(codexHome, "plugins", "cache", marketplace.name);
78081
78340
  await writeCachedMarketplaceManifest({
78082
78341
  marketplaceName: marketplace.name,
@@ -78168,10 +78427,10 @@ function codexMarketplaceSource(marketplaceRoot) {
78168
78427
  }
78169
78428
  // packages/omo-codex/src/install/codex-installation-detection.ts
78170
78429
  init_bun_which_shim();
78171
- import { execFile as execFile2 } from "child_process";
78430
+ import { execFile as execFile3 } from "child_process";
78172
78431
  import { existsSync as existsSync31 } from "fs";
78173
78432
  import { homedir as homedir7 } from "os";
78174
- import { posix as posix3, win32 as win323 } from "path";
78433
+ import { posix as posix4, win32 as win323 } from "path";
78175
78434
  var CODEX_PATH_CHECK_LABEL = "codex (PATH)";
78176
78435
  var WINDOWS_START_APPS_ARGS = [
78177
78436
  "-NoProfile",
@@ -78248,11 +78507,11 @@ async function findWindowsCodexStartApp(runCommand) {
78248
78507
  }
78249
78508
  }
78250
78509
  function macCodexAppPaths(homeDir) {
78251
- return ["/Applications/Codex.app", posix3.join(homeDir, "Applications", "Codex.app")];
78510
+ return ["/Applications/Codex.app", posix4.join(homeDir, "Applications", "Codex.app")];
78252
78511
  }
78253
78512
  function macCodexDmgPaths(homeDir) {
78254
- const downloads = posix3.join(homeDir, "Downloads");
78255
- return [posix3.join(downloads, "codex.dmg"), posix3.join(downloads, "Codex.dmg")];
78513
+ const downloads = posix4.join(homeDir, "Downloads");
78514
+ return [posix4.join(downloads, "codex.dmg"), posix4.join(downloads, "Codex.dmg")];
78256
78515
  }
78257
78516
  function windowsCodexCliPaths(env3) {
78258
78517
  const candidates = [];
@@ -78290,18 +78549,18 @@ function dedupe(values) {
78290
78549
  }
78291
78550
  function defaultRunCommand2(command, args) {
78292
78551
  return new Promise((resolve16) => {
78293
- execFile2(command, [...args], { encoding: "utf8", windowsHide: true }, (error, stdout) => {
78552
+ execFile3(command, [...args], { encoding: "utf8", windowsHide: true }, (error, stdout) => {
78294
78553
  resolve16({ success: error === null, stdout });
78295
78554
  });
78296
78555
  });
78297
78556
  }
78298
78557
  // packages/omo-codex/src/install/codex-cleanup.ts
78299
- import { lstat as lstat12, readFile as readFile21, readdir as readdir10, rm as rm11, rmdir } from "fs/promises";
78558
+ import { lstat as lstat13, readFile as readFile22, readdir as readdir11, rm as rm11, rmdir } from "fs/promises";
78300
78559
  import { homedir as homedir8 } from "os";
78301
78560
  import { isAbsolute as isAbsolute11, join as join57, relative as relative7, resolve as resolve17 } from "path";
78302
78561
 
78303
78562
  // packages/omo-codex/src/install/codex-cleanup-config.ts
78304
- import { lstat as lstat11, mkdir as mkdir8, readFile as readFile20, writeFile as writeFile12 } from "fs/promises";
78563
+ import { lstat as lstat12, mkdir as mkdir8, readFile as readFile21, writeFile as writeFile12 } from "fs/promises";
78305
78564
  import { dirname as dirname19 } from "path";
78306
78565
  var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
78307
78566
  var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
@@ -78334,7 +78593,7 @@ function cleanupCodexLightConfigText(config) {
78334
78593
  async function cleanupCodexConfig(configPath, now) {
78335
78594
  if (!await configExists(configPath))
78336
78595
  return { changed: false };
78337
- const original = await readFile20(configPath, "utf8");
78596
+ const original = await readFile21(configPath, "utf8");
78338
78597
  const next = cleanupCodexLightConfigText(original);
78339
78598
  if (next === original)
78340
78599
  return { changed: false };
@@ -78403,7 +78662,7 @@ function formatBackupTimestamp2(date) {
78403
78662
  }
78404
78663
  async function configExists(path7) {
78405
78664
  try {
78406
- await lstat11(path7);
78665
+ await lstat12(path7);
78407
78666
  return true;
78408
78667
  } catch (error) {
78409
78668
  if (nodeErrorCode5(error) === "ENOENT")
@@ -78521,7 +78780,7 @@ async function collectBootstrapDataDirsByGlob(codexHome) {
78521
78780
  async function walkForManagedBootstrapDirs(directory, depth, results) {
78522
78781
  if (depth > BOOTSTRAP_DATA_GLOB_MAX_DEPTH)
78523
78782
  return;
78524
- const entries = await readdir10(directory, { withFileTypes: true }).catch(() => null);
78783
+ const entries = await readdir11(directory, { withFileTypes: true }).catch(() => null);
78525
78784
  if (entries === null)
78526
78785
  return;
78527
78786
  for (const entry of entries) {
@@ -78553,7 +78812,7 @@ async function removeManagedPathBestEffort(path7, seams) {
78553
78812
  }
78554
78813
  async function attemptRemove(path7) {
78555
78814
  try {
78556
- if (await lstat12(path7).catch(() => null) === null)
78815
+ if (await lstat13(path7).catch(() => null) === null)
78557
78816
  return false;
78558
78817
  await rm11(path7, { recursive: true, force: true });
78559
78818
  return true;
@@ -78579,7 +78838,7 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
78579
78838
  ];
78580
78839
  const versionRoot = join57(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
78581
78840
  if (await exists6(versionRoot)) {
78582
- const entries = await readdir10(versionRoot, { withFileTypes: true });
78841
+ const entries = await readdir11(versionRoot, { withFileTypes: true });
78583
78842
  for (const entry of entries) {
78584
78843
  if (entry.isDirectory())
78585
78844
  manifestPaths.push(join57(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
@@ -78599,20 +78858,20 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
78599
78858
  async function readManagedAgentPathsFromConfig(codexHome, configPath) {
78600
78859
  if (!await exists6(configPath))
78601
78860
  return [];
78602
- const config = await readFile21(configPath, "utf8");
78861
+ const config = await readFile22(configPath, "utf8");
78603
78862
  return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join57(codexHome, "agents", `${agentName}.toml`));
78604
78863
  }
78605
78864
  async function readInstalledAgentManifest(manifestPath) {
78606
78865
  if (!await exists6(manifestPath))
78607
78866
  return [];
78608
- const parsed = JSON.parse(await readFile21(manifestPath, "utf8"));
78867
+ const parsed = JSON.parse(await readFile22(manifestPath, "utf8"));
78609
78868
  if (!isPlainRecord3(parsed) || !Array.isArray(parsed.agents))
78610
78869
  return [];
78611
78870
  return parsed.agents.filter((path7) => typeof path7 === "string");
78612
78871
  }
78613
78872
  async function removeManifestListedAgentLinks(codexHome, paths) {
78614
78873
  const agentsDir = join57(codexHome, "agents");
78615
- const removed = [];
78874
+ const removed2 = [];
78616
78875
  const skipped2 = [];
78617
78876
  for (const path7 of paths) {
78618
78877
  if (!isSafeManagedAgentPath(agentsDir, path7)) {
@@ -78627,9 +78886,9 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
78627
78886
  continue;
78628
78887
  }
78629
78888
  await rm11(path7, { force: true });
78630
- removed.push(path7);
78889
+ removed2.push(path7);
78631
78890
  }
78632
- return { removed, skipped: skipped2 };
78891
+ return { removed: removed2, skipped: skipped2 };
78633
78892
  }
78634
78893
  function isSafeManagedAgentPath(agentsDir, path7) {
78635
78894
  if (!isAbsolute11(path7))
@@ -78647,7 +78906,7 @@ async function exists6(path7) {
78647
78906
  }
78648
78907
  async function maybeLstat2(path7) {
78649
78908
  try {
78650
- return await lstat12(path7);
78909
+ return await lstat13(path7);
78651
78910
  } catch (error) {
78652
78911
  if (nodeErrorCode6(error) === "ENOENT")
78653
78912
  return null;
@@ -78662,18 +78921,26 @@ function nodeErrorCode6(error) {
78662
78921
  // packages/omo-codex/src/install/codex-git-bash-mcp-env.ts
78663
78922
  var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
78664
78923
  // packages/omo-senpi/src/install/install-senpi.ts
78665
- import { execFile as execFile3 } from "child_process";
78924
+ import { execFile as execFile4 } from "child_process";
78666
78925
  import { constants as constants7, existsSync as existsSync32 } from "fs";
78667
- import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile22, rename as rename5, writeFile as writeFile13 } from "fs/promises";
78926
+ import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile23, rename as rename5, writeFile as writeFile13 } from "fs/promises";
78668
78927
  import { homedir as homedir9 } from "os";
78669
78928
  import { dirname as dirname21, join as join58, resolve as resolve18 } from "path";
78670
78929
  import { fileURLToPath } from "url";
78671
78930
  import { promisify as promisify2 } from "util";
78672
- var execFileAsync2 = promisify2(execFile3);
78931
+ var execFileAsync2 = promisify2(execFile4);
78673
78932
  var REQUIRED_PLUGIN_ARTIFACTS = [
78674
78933
  join58("extensions", "omo.js"),
78675
78934
  join58("skills", "ultrawork", "SKILL.md"),
78676
- join58("skills", "ulw-loop", "SKILL.md")
78935
+ join58("skills", "ulw-loop", "SKILL.md"),
78936
+ join58("runtime", "lsp-daemon", "dist", "cli.js"),
78937
+ join58("runtime", "lsp-daemon", "dist", "index.js"),
78938
+ join58("runtime", "lsp-daemon", "dist", "index.d.ts"),
78939
+ join58("runtime", "lsp-daemon", "dist", "daemon-client.js"),
78940
+ join58("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
78941
+ join58("runtime", "lsp-daemon", "dist", "package.json"),
78942
+ join58("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
78943
+ join58("scripts", "install.mjs")
78677
78944
  ];
78678
78945
  async function runSenpiInstaller(options = {}) {
78679
78946
  const context = resolveInstallContext(options);
@@ -78697,7 +78964,8 @@ async function runSenpiInstaller(options = {}) {
78697
78964
  }
78698
78965
  function resolveInstallContext(options) {
78699
78966
  const env3 = options.env ?? process.env;
78700
- const repoRoot = resolve18(options.repoRoot ?? findRepoRoot2(dirname21(fileURLToPath(import.meta.url))));
78967
+ const allowBuild = options.pluginPath === undefined;
78968
+ const repoRoot = resolve18(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname21(fileURLToPath(import.meta.url))) : dirname21(resolve18(options.pluginPath))));
78701
78969
  const agentDir = resolve18(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ?? join58(homedir9(), ".senpi", "agent"));
78702
78970
  const pluginPath = resolve18(options.pluginPath ?? join58(repoRoot, "packages", "omo-senpi", "plugin"));
78703
78971
  return {
@@ -78706,6 +78974,7 @@ function resolveInstallContext(options) {
78706
78974
  agentDir,
78707
78975
  settingsPath: join58(agentDir, "settings.json"),
78708
78976
  pluginPath,
78977
+ allowBuild,
78709
78978
  runCommand: options.runCommand ?? defaultRunCommand3
78710
78979
  };
78711
78980
  }
@@ -78713,8 +78982,13 @@ async function ensurePluginArtifacts(context) {
78713
78982
  const missing = await hasMissingPluginArtifact(context.pluginPath);
78714
78983
  if (!missing)
78715
78984
  return;
78985
+ if (!context.allowBuild) {
78986
+ throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
78987
+ }
78716
78988
  await context.runCommand("node", [join58(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
78717
78989
  await context.runCommand("node", [join58(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
78990
+ await context.runCommand("node", [join58(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
78991
+ await context.runCommand("node", [join58(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
78718
78992
  }
78719
78993
  async function hasMissingPluginArtifact(pluginPath) {
78720
78994
  for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
@@ -78733,7 +79007,7 @@ async function defaultRunCommand3(command, args, options) {
78733
79007
  async function readSettings(settingsPath) {
78734
79008
  let raw;
78735
79009
  try {
78736
- raw = await readFile22(settingsPath, "utf8");
79010
+ raw = await readFile23(settingsPath, "utf8");
78737
79011
  } catch (error) {
78738
79012
  if (isErrno(error, "ENOENT"))
78739
79013
  return {};
@@ -78812,7 +79086,7 @@ function isErrno(error, code) {
78812
79086
  return error instanceof Error && "code" in error && error.code === code;
78813
79087
  }
78814
79088
  // packages/omo-opencode/src/cli/star-request.ts
78815
- import { execFile as execFile4 } from "child_process";
79089
+ import { execFile as execFile5 } from "child_process";
78816
79090
  import { promisify as promisify3 } from "util";
78817
79091
  var STAR_REPOSITORIES = [
78818
79092
  "code-yeongyu/oh-my-openagent",
@@ -78824,7 +79098,7 @@ var PLATFORM_REPOSITORIES = {
78824
79098
  both: STAR_REPOSITORIES,
78825
79099
  senpi: STAR_REPOSITORIES
78826
79100
  };
78827
- var execFileAsync3 = promisify3(execFile4);
79101
+ var execFileAsync3 = promisify3(execFile5);
78828
79102
  async function runGitHubStarCommand(repository) {
78829
79103
  await execFileAsync3("gh", ["api", "--silent", "--method", "PUT", `/user/starred/${repository}`]);
78830
79104
  }
@@ -97194,7 +97468,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
97194
97468
  // packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
97195
97469
  init_bun_which_shim();
97196
97470
  init_spawn_with_windows_hide();
97197
- import { delimiter as delimiter2, dirname as dirname23, posix as posix4, win32 as win324 } from "path";
97471
+ import { delimiter as delimiter2, dirname as dirname23, posix as posix5, win32 as win324 } from "path";
97198
97472
  var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
97199
97473
  var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
97200
97474
  function getCommandCandidates(platform) {
@@ -97205,7 +97479,7 @@ function getCommandCandidates(platform) {
97205
97479
  function getPathTools(platform) {
97206
97480
  if (platform === "win32")
97207
97481
  return win324;
97208
- return posix4;
97482
+ return posix5;
97209
97483
  }
97210
97484
  function collectCandidateBinaryPaths(pathEnv, which2 = bunWhich, platform = process.platform) {
97211
97485
  const seen = new Set;
@@ -100364,12 +100638,12 @@ import { dirname as dirname30, join as join79 } from "path";
100364
100638
 
100365
100639
  // packages/omo-opencode/src/hooks/comment-checker/downloader.ts
100366
100640
  import { join as join78 } from "path";
100367
- import { homedir as homedir18, tmpdir as tmpdir3 } from "os";
100641
+ import { homedir as homedir18, tmpdir as tmpdir4 } from "os";
100368
100642
  init_binary_downloader();
100369
100643
  init_logger2();
100370
100644
  init_plugin_identity();
100371
100645
  var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
100372
- var DEBUG_FILE = join78(tmpdir3(), "comment-checker-debug.log");
100646
+ var DEBUG_FILE = join78(tmpdir4(), "comment-checker-debug.log");
100373
100647
  function getCacheDir2() {
100374
100648
  if (process.platform === "win32") {
100375
100649
  const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
@@ -100606,13 +100880,14 @@ async function getGhCliInfo(dependencies = {}) {
100606
100880
  }
100607
100881
 
100608
100882
  // packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
100609
- import { readFileSync as readFileSync38 } from "fs";
100883
+ import { readFileSync as readFileSync39 } from "fs";
100610
100884
  import { join as join80 } from "path";
100611
100885
 
100612
100886
  // packages/omo-opencode/src/mcp/lsp.ts
100613
- import { existsSync as existsSync56 } from "fs";
100887
+ import { existsSync as existsSync56, readFileSync as readFileSync38 } from "fs";
100614
100888
  import { delimiter as delimiter3, dirname as dirname31, resolve as resolve21 } from "path";
100615
100889
  import { fileURLToPath as fileURLToPath7 } from "url";
100890
+ init_opencode_config_dir();
100616
100891
 
100617
100892
  // packages/omo-opencode/src/mcp/cli-suffix.ts
100618
100893
  function normalizeCliPath(path14) {
@@ -100624,7 +100899,7 @@ function hasCliSuffix(candidatePath, suffix) {
100624
100899
 
100625
100900
  // packages/omo-opencode/src/mcp/runtime-executable.ts
100626
100901
  init_bun_which_shim();
100627
- import { basename as basename12 } from "path";
100902
+ import { basename as basename13 } from "path";
100628
100903
  var NODE_EXECUTABLE_NAMES = new Set(["node", "node.exe"]);
100629
100904
  function isUnsafeCommandName2(commandName) {
100630
100905
  if (commandName.length === 0)
@@ -100640,7 +100915,7 @@ function isUnsafeCommandName2(commandName) {
100640
100915
  return false;
100641
100916
  }
100642
100917
  function isNodeExecPath(execPath) {
100643
- return NODE_EXECUTABLE_NAMES.has(basename12(execPath).toLowerCase());
100918
+ return NODE_EXECUTABLE_NAMES.has(basename13(execPath).toLowerCase());
100644
100919
  }
100645
100920
  function resolveRuntimeExecutable(commandName, options = {}) {
100646
100921
  if (isUnsafeCommandName2(commandName)) {
@@ -100710,8 +100985,15 @@ var LSP_TOOLS_PACKAGE_REL = "packages/lsp-tools-mcp";
100710
100985
  var DIST_CLI_REL = "dist/cli.js";
100711
100986
  var SOURCE_CLI_REL = "src/cli.ts";
100712
100987
  var PROJECT_LSP_CONFIGS = [".opencode/lsp.json", ".omo/lsp.json", ".omo/lsp-client.json"];
100988
+ var DAEMON_PACKAGE_NAME = "@code-yeongyu/lsp-daemon";
100989
+ var OMO_LSP_DAEMON_CLI = "OMO_LSP_DAEMON_CLI";
100990
+ var OMO_LSP_DAEMON_VERSION = "OMO_LSP_DAEMON_VERSION";
100991
+ var DaemonPackageSchema = exports_external.object({
100992
+ version: exports_external.string().min(1)
100993
+ });
100713
100994
  var LSP_BOOTSTRAP_SCRIPT = [
100714
100995
  "const { existsSync } = require('node:fs')",
100996
+ "const { createRequire } = require('node:module')",
100715
100997
  "const { join } = require('node:path')",
100716
100998
  "const { spawnSync } = require('node:child_process')",
100717
100999
  "const root = process.argv[1]",
@@ -100720,16 +101002,18 @@ var LSP_BOOTSTRAP_SCRIPT = [
100720
101002
  `const toolsPackage = join(root, '${LSP_TOOLS_PACKAGE_REL}')`,
100721
101003
  `const daemonPackage = join(root, '${PACKAGE_REL}')`,
100722
101004
  "const toolsDist = join(toolsPackage, 'dist/cli.js')",
100723
- "const daemonDist = join(daemonPackage, 'dist/cli.js')",
101005
+ "const daemonPackageJson = join(daemonPackage, 'package.json')",
100724
101006
  "const daemonSource = join(daemonPackage, 'src/cli.ts')",
100725
101007
  "const run = (command, args, stdio) => spawnSync(command, args, { cwd: root, env: process.env, stdio })",
100726
101008
  "const finish = (result) => { if (result.error) { console.error(result.error.message); process.exit(1) } process.exit(result.status ?? 1) }",
100727
101009
  "const runIfAvailable = (command, args) => { const result = run(command, args, 'inherit'); if (result.error) return false; finish(result); return true }",
100728
- "if (existsSync(daemonDist)) finish(run(process.execPath, [daemonDist, 'mcp'], 'inherit'))",
100729
- "if (existsSync(daemonSource) && existsSync(toolsDist)) runIfAvailable(bun, [daemonSource, 'mcp'])",
101010
+ `const resolveDaemonCli = () => { try { return createRequire(daemonPackageJson).resolve('${DAEMON_PACKAGE_NAME}/cli') } catch (error) { if (error instanceof Error) return null; throw error } }`,
101011
+ "const daemonCli = existsSync(daemonPackageJson) ? resolveDaemonCli() : null",
101012
+ "if (daemonCli) finish(run(process.execPath, [daemonCli, 'mcp'], 'inherit'))",
101013
+ `if (existsSync(daemonSource) && existsSync(toolsDist)) { const pkg = require(daemonPackageJson); process.env.${OMO_LSP_DAEMON_CLI} = daemonSource; process.env.${OMO_LSP_DAEMON_VERSION} = pkg.version; runIfAvailable(bun, [daemonSource, 'mcp']) }`,
100730
101014
  "const steps = [[npm, ['--prefix', toolsPackage, 'install', '--no-package-lock', '--no-audit', '--no-fund']], [npm, ['--prefix', toolsPackage, 'run', 'build']], [npm, ['--prefix', daemonPackage, 'install', '--no-package-lock', '--no-audit', '--no-fund']], [npm, ['--prefix', daemonPackage, 'run', 'build']]]",
100731
101015
  "for (const [command, args] of steps) { const result = run(command, args, ['ignore', 'ignore', 'inherit']); if (result.error || result.status !== 0) finish(result) }",
100732
- "finish(run(process.execPath, [daemonDist, 'mcp'], 'inherit'))"
101016
+ "finish(run(process.execPath, [resolveDaemonCli(), 'mcp'], 'inherit'))"
100733
101017
  ].join(";");
100734
101018
  function getModuleDirectory(moduleUrl) {
100735
101019
  try {
@@ -100743,6 +101027,16 @@ function getModuleDirectory(moduleUrl) {
100743
101027
  function findBootstrapRoot(candidates, pathExists) {
100744
101028
  return candidates.find((candidate) => pathExists(resolve21(candidate.root, "package.json")))?.root ?? process.cwd();
100745
101029
  }
101030
+ function readDaemonPackageVersion(root) {
101031
+ try {
101032
+ const packageJson = JSON.parse(readFileSync38(resolve21(root, PACKAGE_REL, "package.json"), "utf-8"));
101033
+ return DaemonPackageSchema.parse(packageJson).version;
101034
+ } catch (error51) {
101035
+ if (!(error51 instanceof Error))
101036
+ throw error51;
101037
+ return null;
101038
+ }
101039
+ }
100746
101040
  function createBootstrapCandidate(root, pathExists, resolveExecutable) {
100747
101041
  const runtime5 = resolveJavaScriptRuntime(resolveExecutable);
100748
101042
  const bun = resolveExecutable("bun");
@@ -100767,7 +101061,7 @@ function resolveLspCommand(options = {}) {
100767
101061
  sourceCliRel: SOURCE_CLI_REL,
100768
101062
  pathExists,
100769
101063
  resolveExecutable,
100770
- isSourceCandidateAvailable: ({ root }) => pathExists(resolve21(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL))
101064
+ isSourceCandidateAvailable: ({ root }) => pathExists(resolve21(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL)) && readDaemonPackageVersion(root) !== null
100771
101065
  }) : [];
100772
101066
  const distCandidate = candidates.find((candidate) => hasCliSuffix(candidate.path, DIST_CLI_REL) && candidate.exists);
100773
101067
  if (distCandidate) {
@@ -100781,12 +101075,21 @@ function resolveLspCommand(options = {}) {
100781
101075
  }
100782
101076
  function createLspMcpConfig(options = {}) {
100783
101077
  const resolvedCommand = resolveLspCommand(options);
101078
+ const cwd = resolve21(options.cwd ?? process.cwd());
101079
+ const configDir = getOpenCodeConfigDir({ binary: "opencode" });
101080
+ const sourceVersion = hasCliSuffix(resolvedCommand.path, SOURCE_CLI_REL) ? readDaemonPackageVersion(resolvedCommand.root) : null;
100784
101081
  return {
100785
101082
  type: "local",
100786
101083
  command: resolvedCommand.command,
100787
101084
  enabled: resolvedCommand.exists,
100788
101085
  environment: {
100789
- LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.join(delimiter3)
101086
+ LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) => resolve21(cwd, configPath)).join(delimiter3),
101087
+ LSP_TOOLS_MCP_USER_CONFIG: resolve21(configDir, "lsp.json"),
101088
+ LSP_TOOLS_MCP_INSTALL_DECISIONS: resolve21(configDir, "lsp-install-decisions.json"),
101089
+ ...sourceVersion ? {
101090
+ [OMO_LSP_DAEMON_CLI]: resolvedCommand.path,
101091
+ [OMO_LSP_DAEMON_VERSION]: sourceVersion
101092
+ } : {}
100790
101093
  }
100791
101094
  };
100792
101095
  }
@@ -100803,7 +101106,7 @@ function readOmoConfig(configDirectory) {
100803
101106
  return null;
100804
101107
  }
100805
101108
  try {
100806
- const content = readFileSync38(detected.path, "utf-8");
101109
+ const content = readFileSync39(detected.path, "utf-8");
100807
101110
  return parseJsonc(content);
100808
101111
  } catch (error51) {
100809
101112
  if (!(error51 instanceof Error)) {
@@ -100833,7 +101136,7 @@ function getInstalledLspServers(options = {}) {
100833
101136
 
100834
101137
  // packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
100835
101138
  init_shared();
100836
- import { existsSync as existsSync57, readFileSync as readFileSync39 } from "fs";
101139
+ import { existsSync as existsSync57, readFileSync as readFileSync40 } from "fs";
100837
101140
  import { homedir as homedir20 } from "os";
100838
101141
  import { join as join81 } from "path";
100839
101142
  var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
@@ -100850,7 +101153,7 @@ function loadUserMcpConfig() {
100850
101153
  if (!existsSync57(configPath))
100851
101154
  continue;
100852
101155
  try {
100853
- const content = readFileSync39(configPath, "utf-8");
101156
+ const content = readFileSync40(configPath, "utf-8");
100854
101157
  const config3 = parseJsonc(content);
100855
101158
  if (config3.mcpServers) {
100856
101159
  Object.assign(servers, config3.mcpServers);
@@ -100985,7 +101288,7 @@ async function checkTools() {
100985
101288
 
100986
101289
  // packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
100987
101290
  init_src4();
100988
- import { existsSync as existsSync58, readFileSync as readFileSync40 } from "fs";
101291
+ import { existsSync as existsSync58, readFileSync as readFileSync41 } from "fs";
100989
101292
  function isTelemetryState(value) {
100990
101293
  return value !== null && typeof value === "object" && !Array.isArray(value);
100991
101294
  }
@@ -100995,7 +101298,7 @@ function readLastActiveDay(stateFilePath) {
100995
101298
  }
100996
101299
  let parsed;
100997
101300
  try {
100998
- parsed = JSON.parse(readFileSync40(stateFilePath, "utf-8"));
101301
+ parsed = JSON.parse(readFileSync41(stateFilePath, "utf-8"));
100999
101302
  } catch (error51) {
101000
101303
  if (error51 instanceof Error) {
101001
101304
  return "unreadable";
@@ -101070,7 +101373,7 @@ function expandHomeDirectory(directoryPath) {
101070
101373
  // packages/omo-opencode/src/cli/doctor/checks/team-mode.ts
101071
101374
  init_shared();
101072
101375
  init_plugin_identity();
101073
- import { readFileSync as readFileSync41, promises as fs13 } from "fs";
101376
+ import { readFileSync as readFileSync42, promises as fs13 } from "fs";
101074
101377
  import path15 from "path";
101075
101378
  async function checkTeamMode() {
101076
101379
  const config3 = loadTeamModeConfig();
@@ -101107,7 +101410,7 @@ function loadTeamModeConfig() {
101107
101410
  if (!configPath)
101108
101411
  return { team_mode: undefined };
101109
101412
  try {
101110
- return parseJsonc(readFileSync41(configPath, "utf-8"));
101413
+ return parseJsonc(readFileSync42(configPath, "utf-8"));
101111
101414
  } catch (error51) {
101112
101415
  if (error51 instanceof Error) {
101113
101416
  return { team_mode: undefined };
@@ -101141,9 +101444,9 @@ async function pathExists(dir) {
101141
101444
  // packages/omo-opencode/src/cli/doctor/checks/codex.ts
101142
101445
  init_src();
101143
101446
  import { existsSync as existsSync59 } from "fs";
101144
- import { lstat as lstat13, readdir as readdir11, readFile as readFile23 } from "fs/promises";
101447
+ import { lstat as lstat14, readdir as readdir12, readFile as readFile24 } from "fs/promises";
101145
101448
  import { homedir as homedir22 } from "os";
101146
- import { basename as basename13, join as join82, resolve as resolve22 } from "path";
101449
+ import { basename as basename14, join as join82, resolve as resolve22 } from "path";
101147
101450
  // packages/omo-opencode/package.json
101148
101451
  var package_default3 = {
101149
101452
  name: "@oh-my-opencode/omo-opencode",
@@ -101332,7 +101635,7 @@ async function resolveInstalledPluginRoot(codexHome) {
101332
101635
  const pluginRoot = join82(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
101333
101636
  if (!existsSync59(pluginRoot))
101334
101637
  return null;
101335
- const versions2 = await readdir11(pluginRoot, { withFileTypes: true });
101638
+ const versions2 = await readdir12(pluginRoot, { withFileTypes: true });
101336
101639
  const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
101337
101640
  return candidates.length === 0 ? null : join82(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
101338
101641
  }
@@ -101348,7 +101651,7 @@ async function readCodexConfigSummary(configPath) {
101348
101651
  companionLifecycleHookStateEvents: []
101349
101652
  };
101350
101653
  }
101351
- const content = await readFile23(configPath, "utf8");
101654
+ const content = await readFile24(configPath, "utf8");
101352
101655
  return {
101353
101656
  exists: true,
101354
101657
  marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
@@ -101371,12 +101674,12 @@ async function readLinkedAgents(codexHome) {
101371
101674
  const agentsDir = join82(codexHome, "agents");
101372
101675
  if (!existsSync59(agentsDir))
101373
101676
  return [];
101374
- const entries = await readdir11(agentsDir, { withFileTypes: true });
101375
- return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename13(entry.name, ".toml")).sort();
101677
+ const entries = await readdir12(agentsDir, { withFileTypes: true });
101678
+ return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename14(entry.name, ".toml")).sort();
101376
101679
  }
101377
101680
  async function readJson(path16) {
101378
101681
  try {
101379
- const parsed = JSON.parse(await readFile23(path16, "utf8"));
101682
+ const parsed = JSON.parse(await readFile24(path16, "utf8"));
101380
101683
  return isPlainRecord(parsed) ? parsed : null;
101381
101684
  } catch (error51) {
101382
101685
  if (error51 instanceof Error)
@@ -101471,7 +101774,7 @@ function compareVersionsDescending(left, right) {
101471
101774
  }
101472
101775
  async function pathExists2(path16) {
101473
101776
  try {
101474
- await lstat13(path16);
101777
+ await lstat14(path16);
101475
101778
  return true;
101476
101779
  } catch (error51) {
101477
101780
  if (error51 instanceof Error)
@@ -101482,7 +101785,7 @@ async function pathExists2(path16) {
101482
101785
 
101483
101786
  // packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
101484
101787
  init_src();
101485
- import { readdir as readdir12, readFile as readFile24, stat as stat6 } from "fs/promises";
101788
+ import { readdir as readdir13, readFile as readFile25, stat as stat6 } from "fs/promises";
101486
101789
  import { homedir as homedir23 } from "os";
101487
101790
  import { dirname as dirname32, isAbsolute as isAbsolute13, join as join83, relative as relative10, resolve as resolve23, sep as sep9 } from "path";
101488
101791
  var CODEX_COMPONENTS_CHECK_ID = "codex-components";
@@ -101623,7 +101926,7 @@ async function findHookManifestPaths(root) {
101623
101926
  async function findManifestPaths(root, manifestName) {
101624
101927
  let entries;
101625
101928
  try {
101626
- entries = await readdir12(root, { withFileTypes: true });
101929
+ entries = await readdir13(root, { withFileTypes: true });
101627
101930
  } catch {
101628
101931
  return [];
101629
101932
  }
@@ -101735,7 +102038,7 @@ function degradedDetailLines(entries) {
101735
102038
  }
101736
102039
  async function readJson2(path16) {
101737
102040
  try {
101738
- const parsed = JSON.parse(await readFile24(path16, "utf8"));
102041
+ const parsed = JSON.parse(await readFile25(path16, "utf8"));
101739
102042
  return isRecord6(parsed) ? parsed : null;
101740
102043
  } catch (error51) {
101741
102044
  if (error51 instanceof Error)
@@ -101763,7 +102066,7 @@ function isRecord6(value) {
101763
102066
 
101764
102067
  // packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
101765
102068
  import { existsSync as existsSync60 } from "fs";
101766
- import { readFile as readFile25 } from "fs/promises";
102069
+ import { readFile as readFile26 } from "fs/promises";
101767
102070
  import { homedir as homedir24 } from "os";
101768
102071
  import { join as join84, resolve as resolve24 } from "path";
101769
102072
  var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
@@ -101798,7 +102101,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
101798
102101
  }
101799
102102
  async function readRuntimeWrapper(path16) {
101800
102103
  try {
101801
- return await readFile25(path16, "utf8");
102104
+ return await readFile26(path16, "utf8");
101802
102105
  } catch (error51) {
101803
102106
  if (error51 instanceof Error)
101804
102107
  return null;
@@ -102274,18 +102577,18 @@ Doctor failed unexpectedly: ${message}`];
102274
102577
  }
102275
102578
 
102276
102579
  // packages/mcp-client-core/src/mcp-oauth/storage.ts
102277
- import { createHash as createHash4 } from "crypto";
102580
+ import { createHash as createHash5 } from "crypto";
102278
102581
  import {
102279
102582
  chmodSync as chmodSync4,
102280
102583
  existsSync as existsSync63,
102281
102584
  mkdirSync as mkdirSync14,
102282
102585
  readdirSync as readdirSync9,
102283
- readFileSync as readFileSync43,
102586
+ readFileSync as readFileSync44,
102284
102587
  renameSync as renameSync7,
102285
102588
  unlinkSync as unlinkSync8,
102286
102589
  writeFileSync as writeFileSync11
102287
102590
  } from "fs";
102288
- import { basename as basename14, dirname as dirname33, join as join87 } from "path";
102591
+ import { basename as basename15, dirname as dirname33, join as join87 } from "path";
102289
102592
 
102290
102593
  // packages/mcp-client-core/src/config-dir.ts
102291
102594
  import { existsSync as existsSync61, realpathSync as realpathSync8 } from "fs";
@@ -102313,7 +102616,7 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
102313
102616
  }
102314
102617
 
102315
102618
  // packages/mcp-client-core/src/mcp-oauth/storage-index.ts
102316
- import { chmodSync as chmodSync3, existsSync as existsSync62, readFileSync as readFileSync42, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "fs";
102619
+ import { chmodSync as chmodSync3, existsSync as existsSync62, readFileSync as readFileSync43, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "fs";
102317
102620
  import { join as join86 } from "path";
102318
102621
  var INDEX_FILE_NAME = "index.json";
102319
102622
  function isTokenIndex(value) {
@@ -102329,7 +102632,7 @@ function readTokenIndex(storageDir) {
102329
102632
  if (!existsSync62(indexPath))
102330
102633
  return {};
102331
102634
  try {
102332
- const parsed = JSON.parse(readFileSync42(indexPath, "utf-8"));
102635
+ const parsed = JSON.parse(readFileSync43(indexPath, "utf-8"));
102333
102636
  return isTokenIndex(parsed) ? parsed : {};
102334
102637
  } catch (readError) {
102335
102638
  if (!(readError instanceof Error))
@@ -102369,7 +102672,7 @@ function getMcpOauthStorageDir() {
102369
102672
  return join87(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
102370
102673
  }
102371
102674
  function getMcpOauthServerHash(serverHost, resource) {
102372
- return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
102675
+ return createHash5("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
102373
102676
  }
102374
102677
  function getMcpOauthStoragePath(serverHost, resource) {
102375
102678
  return join87(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
@@ -102439,7 +102742,7 @@ function readTokenFile(filePath) {
102439
102742
  if (!existsSync63(filePath))
102440
102743
  return null;
102441
102744
  try {
102442
- const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
102745
+ const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
102443
102746
  return isOAuthTokenData(parsed) ? parsed : null;
102444
102747
  } catch (readError) {
102445
102748
  if (!(readError instanceof Error))
@@ -102452,7 +102755,7 @@ function readLegacyStore() {
102452
102755
  if (!existsSync63(filePath))
102453
102756
  return null;
102454
102757
  try {
102455
- const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
102758
+ const parsed = JSON.parse(readFileSync44(filePath, "utf-8"));
102456
102759
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
102457
102760
  return null;
102458
102761
  const result = {};
@@ -102570,7 +102873,7 @@ function listAllTokens() {
102570
102873
  if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
102571
102874
  continue;
102572
102875
  const token = readTokenFile(join87(dir, entry.name));
102573
- const hash2 = basename14(entry.name, ".json");
102876
+ const hash2 = basename15(entry.name, ".json");
102574
102877
  if (token)
102575
102878
  result[index[hash2] ?? hash2] = token;
102576
102879
  }
@@ -102743,13 +103046,13 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
102743
103046
 
102744
103047
  // packages/mcp-client-core/src/mcp-oauth/oauth-authorization-flow.ts
102745
103048
  import { spawn as spawn4 } from "child_process";
102746
- import { createHash as createHash5, randomBytes as randomBytes2 } from "crypto";
103049
+ import { createHash as createHash6, randomBytes as randomBytes2 } from "crypto";
102747
103050
  import { createServer as createServer2 } from "http";
102748
103051
  function generateCodeVerifier() {
102749
103052
  return randomBytes2(32).toString("base64url");
102750
103053
  }
102751
103054
  function generateCodeChallenge(verifier) {
102752
- return createHash5("sha256").update(verifier).digest("base64url");
103055
+ return createHash6("sha256").update(verifier).digest("base64url");
102753
103056
  }
102754
103057
  function buildAuthorizationUrl(authorizationEndpoint, options) {
102755
103058
  const url2 = new URL(authorizationEndpoint);
@@ -103293,7 +103596,7 @@ async function boulder(options) {
103293
103596
  }
103294
103597
  // packages/omo-opencode/src/cli/codex-ulw-loop.ts
103295
103598
  import { spawn as spawn5 } from "child_process";
103296
- import { existsSync as existsSync65, readFileSync as readFileSync44, realpathSync as realpathSync9 } from "fs";
103599
+ import { existsSync as existsSync65, readFileSync as readFileSync45, realpathSync as realpathSync9 } from "fs";
103297
103600
  import { homedir as homedir26 } from "os";
103298
103601
  var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
103299
103602
  function resolveCodexUlwLoopCommand(input = {}) {
@@ -103343,7 +103646,7 @@ function resolveLegacyLocalOmoBin(env3, homeDir, currentExecutablePaths) {
103343
103646
  }
103344
103647
  function isGeneratedRuntimeWrapper(candidate) {
103345
103648
  try {
103346
- return readFileSync44(candidate, "utf8").includes(RUNTIME_WRAPPER_MARKER);
103649
+ return readFileSync45(candidate, "utf8").includes(RUNTIME_WRAPPER_MARKER);
103347
103650
  } catch (error51) {
103348
103651
  if (error51 instanceof Error)
103349
103652
  return false;