oh-my-opencode 5.1.82 → 5.1.84
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.
- package/dist/cli/cli-program.d.ts +3 -0
- package/dist/cli/index.js +202 -193
- package/dist/cli-node/index.js +202 -193
- package/dist/index.js +28 -22
- package/dist/skills/browser/SKILL.md +97 -91
- package/dist/skills/browser/references/commands.md +88 -26
- package/dist/skills/browser/references/desktop.md +21 -0
- package/dist/skills/browser/references/install.md +18 -0
- package/dist/skills/browser/references/owned-engine/README.md +5 -2
- package/dist/skills/browser/references/owned-engine/frames-and-humans.md +7 -2
- package/dist/skills/browser/references/owned-engine/network.md +4 -3
- package/dist/skills/browser/references/recipes/1password.md +4 -2
- package/dist/skills/browser/runtime/omowright/index.js +7 -7
- package/dist/skills/browser/runtime/omowright/manifest.json +4 -4
- package/dist/skills/debugging/references/tools/browser-qa.md +1 -1
- package/dist/skills/programming/SKILL.md +51 -320
- package/dist/skills/programming/references/go/README.md +1 -0
- package/dist/skills/programming/references/python/README.md +21 -3
- package/dist/skills/programming/references/python/error-handling.md +14 -0
- package/dist/skills/programming/references/rust/README.md +5 -1
- package/dist/skills/programming/references/typescript/README.md +9 -3
- package/dist/skills/programming/references/typescript/error-handling.md +18 -0
- package/dist/skills/ultimate-browsing/SKILL.md +1 -1
- package/dist/skills/visual-qa/references/browser-setup.md +5 -5
- package/dist/tui.js +16 -16
- package/package.json +14 -14
- package/packages/lsp-core/src/lsp/client-key.ts +14 -0
- package/packages/lsp-core/src/lsp/client-startup.ts +139 -0
- package/packages/lsp-core/src/lsp/client-wrapper.ts +4 -4
- package/packages/lsp-core/src/lsp/config-loader.ts +15 -0
- package/packages/lsp-core/src/lsp/directory-diagnostics-group-scan.test.ts +388 -0
- package/packages/lsp-core/src/lsp/directory-diagnostics-mixed-typescript.test.ts +124 -0
- package/packages/lsp-core/src/lsp/directory-diagnostics.test.ts +4 -4
- package/packages/lsp-core/src/lsp/directory-diagnostics.ts +38 -41
- package/packages/lsp-core/src/lsp/directory-group-scan.ts +124 -0
- package/packages/lsp-core/src/lsp/directory-server-groups.ts +84 -0
- package/packages/lsp-core/src/lsp/manager-acquisition.test.ts +115 -0
- package/packages/lsp-core/src/lsp/manager-lifecycle.test.ts +9 -9
- package/packages/lsp-core/src/lsp/manager-max-clients.test.ts +41 -16
- package/packages/lsp-core/src/lsp/manager-reaping.test.ts +119 -0
- package/packages/lsp-core/src/lsp/manager-test-support.ts +108 -0
- package/packages/lsp-core/src/lsp/manager.ts +80 -249
- package/packages/lsp-core/src/lsp/native-typescript.ts +88 -0
- package/packages/lsp-core/src/lsp/server-installation.ts +15 -7
- package/packages/lsp-core/src/lsp/server-resolution-typescript-native.test.ts +327 -0
- package/packages/lsp-core/src/lsp/server-resolution.ts +28 -2
- package/packages/lsp-core/src/lsp/timer-provider.ts +17 -0
- package/packages/lsp-core/src/lsp/typescript-project-test-support.ts +52 -0
- package/packages/lsp-daemon/dist/cli.js +486 -310
- package/packages/lsp-daemon/dist/client.js +472 -296
- package/packages/lsp-daemon/dist/index.js +476 -300
- package/packages/lsp-tools-mcp/dist/cli.js +467 -291
- package/packages/lsp-tools-mcp/dist/lsp/manager.js +160 -193
- package/packages/lsp-tools-mcp/dist/mcp.js +467 -291
- package/packages/lsp-tools-mcp/dist/tools.js +467 -291
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +2 -2
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +478 -313
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +8711 -172
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +8660 -121
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +5 -0
- package/packages/omo-codex/plugin/components/telemetry/tsconfig.json +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/shared/src/config-loader.ts +15 -1
- package/packages/omo-codex/plugin/skills/browser/SKILL.md +97 -91
- package/packages/omo-codex/plugin/skills/browser/references/commands.md +88 -26
- package/packages/omo-codex/plugin/skills/browser/references/desktop.md +21 -0
- package/packages/omo-codex/plugin/skills/browser/references/install.md +18 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/README.md +5 -2
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +7 -2
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/network.md +4 -3
- package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +4 -2
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +7 -7
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +4 -4
- package/packages/omo-codex/plugin/skills/debugging/references/tools/browser-qa.md +1 -1
- package/packages/omo-codex/plugin/skills/programming/SKILL.md +51 -320
- package/packages/omo-codex/plugin/skills/programming/references/go/README.md +1 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/README.md +21 -3
- package/packages/omo-codex/plugin/skills/programming/references/python/error-handling.md +14 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/README.md +5 -1
- package/packages/omo-codex/plugin/skills/programming/references/typescript/README.md +9 -3
- package/packages/omo-codex/plugin/skills/programming/references/typescript/error-handling.md +18 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/visual-qa/references/browser-setup.md +5 -5
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +21189 -20653
- package/packages/shared-skills/skills/browser/SKILL.md +97 -91
- package/packages/shared-skills/skills/browser/references/commands.md +88 -26
- package/packages/shared-skills/skills/browser/references/desktop.md +21 -0
- package/packages/shared-skills/skills/browser/references/install.md +18 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/README.md +5 -2
- package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +7 -2
- package/packages/shared-skills/skills/browser/references/owned-engine/network.md +4 -3
- package/packages/shared-skills/skills/browser/references/recipes/1password.md +4 -2
- package/packages/shared-skills/skills/browser/runtime/omowright/index.js +7 -7
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +4 -4
- package/packages/shared-skills/skills/debugging/references/tools/browser-qa.md +1 -1
- package/packages/shared-skills/skills/programming/SKILL.md +51 -320
- package/packages/shared-skills/skills/programming/references/go/README.md +1 -0
- package/packages/shared-skills/skills/programming/references/python/README.md +21 -3
- package/packages/shared-skills/skills/programming/references/python/error-handling.md +14 -0
- package/packages/shared-skills/skills/programming/references/rust/README.md +5 -1
- package/packages/shared-skills/skills/programming/references/typescript/README.md +9 -3
- package/packages/shared-skills/skills/programming/references/typescript/error-handling.md +18 -0
- package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +1 -1
- package/packages/shared-skills/skills/visual-qa/references/browser-setup.md +5 -5
|
@@ -95,7 +95,7 @@ const { omowright } = await loadOmowright()
|
|
|
95
95
|
A browser your code launches with a task-owned profile. `connectPipe` opens no listening port; `connectCloakProfile` launches CloakBrowser with a pinned fingerprint seed and is the path for WAF, Cloudflare and bot-scored pages.
|
|
96
96
|
|
|
97
97
|
```js
|
|
98
|
-
const browser = await omowright.connectPipe({ browserPath, browserArgs: ["--headless", `--user-data-dir=${profile}`], storageRoot: profile })
|
|
98
|
+
const browser = await omowright.connectPipe({ browserPath: omowright.detectBrowsers().find((b) => b.installed)?.binary, browserArgs: ["--headless", `--user-data-dir=${profile}`], storageRoot: profile })
|
|
99
99
|
try {
|
|
100
100
|
const page = await browser.newTab(url)
|
|
101
101
|
const tree = omowright.compactSnapshot(await page.snapshot()) // the read; refs come from it
|
|
@@ -21,7 +21,7 @@ PNG of the page itself, so no browser chrome can appear in it.
|
|
|
21
21
|
const { mkdtempSync, rmSync } = await import("node:fs")
|
|
22
22
|
const profile = mkdtempSync(`${(await import("node:os")).tmpdir()}/visual-qa-`)
|
|
23
23
|
const browser = await omowright.connectPipe({
|
|
24
|
-
browserPath:
|
|
24
|
+
browserPath: omowright.detectBrowsers().find((b) => b.installed)?.binary, // or omowright.findCloakBrowserPath(); never a guessed path
|
|
25
25
|
browserArgs: ["--headless", "--no-first-run", `--user-data-dir=${profile}`],
|
|
26
26
|
storageRoot: profile,
|
|
27
27
|
})
|
|
@@ -67,14 +67,14 @@ cloning its profile:
|
|
|
67
67
|
const session = await omowright.connectBrowserSkill({ name: "visual-qa capture", focused: false })
|
|
68
68
|
const sync = async () => (await session.cooperate("sync")).context_id // BrowserSkill 0.4: one context per page action
|
|
69
69
|
try {
|
|
70
|
-
await session.navigate(url, { waitUntil: "load"
|
|
70
|
+
await session.navigate(url, { waitUntil: "load" }) // first navigation: no sync (it throws on the blank tab)
|
|
71
71
|
await session.resize(1440, 900, { context: await sync() }) // desktop column of the matrix
|
|
72
72
|
await Bun.write(`${outDir}/${route}-1440-top.png`, (await session.screenshot()).buffer) // { buffer, width, height }
|
|
73
|
-
await session.emulate({ overrides: { width: 390, mobile: true }, context: await sync() }) // phone column; `off: true` restores
|
|
73
|
+
await session.emulate({ overrides: { width: 390, height: 844, mobile: true }, context: await sync() }) // phone column; `off: true` restores
|
|
74
74
|
await Bun.write(`${outDir}/${route}-390-top.png`, (await session.screenshot()).buffer)
|
|
75
75
|
} finally {
|
|
76
|
-
await session.emulate({ off: true, context: await sync() })
|
|
77
|
-
await session.stop()
|
|
76
|
+
try { await session.emulate({ off: true, context: await sync() }) } // a refused sync must not skip stop()
|
|
77
|
+
finally { await session.stop() }
|
|
78
78
|
}
|
|
79
79
|
```
|
|
80
80
|
|
package/dist/tui.js
CHANGED
|
@@ -71168,7 +71168,7 @@ var init_config = __esm(() => {
|
|
|
71168
71168
|
|
|
71169
71169
|
// packages/omo-config-core/src/schema/legacy-category-names.ts
|
|
71170
71170
|
function canonicalCategoryName(name) {
|
|
71171
|
-
return Object.hasOwn(LEGACY_CATEGORY_NAME_ALIASES, name) ? LEGACY_CATEGORY_NAME_ALIASES[name] : name;
|
|
71171
|
+
return Object.hasOwn(LEGACY_CATEGORY_NAME_ALIASES, name) ? LEGACY_CATEGORY_NAME_ALIASES[name] ?? name : name;
|
|
71172
71172
|
}
|
|
71173
71173
|
function isRecord9(value) {
|
|
71174
71174
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -71227,7 +71227,7 @@ var init_legacy_category_names = __esm(() => {
|
|
|
71227
71227
|
|
|
71228
71228
|
// packages/omo-config-core/src/schema/legacy-harness-names.ts
|
|
71229
71229
|
function canonicalHarnessName(name) {
|
|
71230
|
-
return Object.hasOwn(OMO_CONFIG_LEGACY_HARNESS_ALIASES, name) ? OMO_CONFIG_LEGACY_HARNESS_ALIASES[name] : name;
|
|
71230
|
+
return Object.hasOwn(OMO_CONFIG_LEGACY_HARNESS_ALIASES, name) ? OMO_CONFIG_LEGACY_HARNESS_ALIASES[name] ?? name : name;
|
|
71231
71231
|
}
|
|
71232
71232
|
function harnessBlockKey(harness) {
|
|
71233
71233
|
return `[${harness}]`;
|
|
@@ -75883,7 +75883,7 @@ init_shared();
|
|
|
75883
75883
|
// package.json
|
|
75884
75884
|
var package_default = {
|
|
75885
75885
|
name: "oh-my-opencode",
|
|
75886
|
-
version: "5.1.
|
|
75886
|
+
version: "5.1.84",
|
|
75887
75887
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
75888
75888
|
main: "./dist/index.js",
|
|
75889
75889
|
types: "dist/index.d.ts",
|
|
@@ -76147,7 +76147,7 @@ var package_default = {
|
|
|
76147
76147
|
"jsonc-parser": "^3.3.1",
|
|
76148
76148
|
knip: "6.43.0",
|
|
76149
76149
|
"node-pty": "^1.1.0",
|
|
76150
|
-
omowright: "^0.3.
|
|
76150
|
+
omowright: "^0.3.4",
|
|
76151
76151
|
"oxc-parser": "0.148.0",
|
|
76152
76152
|
oxlint: "1.89.0",
|
|
76153
76153
|
picocolors: "^1.1.1",
|
|
@@ -76157,18 +76157,18 @@ var package_default = {
|
|
|
76157
76157
|
typescript: "^7.0.2"
|
|
76158
76158
|
},
|
|
76159
76159
|
optionalDependencies: {
|
|
76160
|
-
"oh-my-opencode-darwin-arm64": "5.1.
|
|
76161
|
-
"oh-my-opencode-darwin-x64": "5.1.
|
|
76162
|
-
"oh-my-opencode-darwin-x64-baseline": "5.1.
|
|
76163
|
-
"oh-my-opencode-linux-arm64": "5.1.
|
|
76164
|
-
"oh-my-opencode-linux-arm64-musl": "5.1.
|
|
76165
|
-
"oh-my-opencode-linux-x64": "5.1.
|
|
76166
|
-
"oh-my-opencode-linux-x64-baseline": "5.1.
|
|
76167
|
-
"oh-my-opencode-linux-x64-musl": "5.1.
|
|
76168
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.1.
|
|
76169
|
-
"oh-my-opencode-windows-arm64": "5.1.
|
|
76170
|
-
"oh-my-opencode-windows-x64": "5.1.
|
|
76171
|
-
"oh-my-opencode-windows-x64-baseline": "5.1.
|
|
76160
|
+
"oh-my-opencode-darwin-arm64": "5.1.84",
|
|
76161
|
+
"oh-my-opencode-darwin-x64": "5.1.84",
|
|
76162
|
+
"oh-my-opencode-darwin-x64-baseline": "5.1.84",
|
|
76163
|
+
"oh-my-opencode-linux-arm64": "5.1.84",
|
|
76164
|
+
"oh-my-opencode-linux-arm64-musl": "5.1.84",
|
|
76165
|
+
"oh-my-opencode-linux-x64": "5.1.84",
|
|
76166
|
+
"oh-my-opencode-linux-x64-baseline": "5.1.84",
|
|
76167
|
+
"oh-my-opencode-linux-x64-musl": "5.1.84",
|
|
76168
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.1.84",
|
|
76169
|
+
"oh-my-opencode-windows-arm64": "5.1.84",
|
|
76170
|
+
"oh-my-opencode-windows-x64": "5.1.84",
|
|
76171
|
+
"oh-my-opencode-windows-x64-baseline": "5.1.84"
|
|
76172
76172
|
},
|
|
76173
76173
|
overrides: {
|
|
76174
76174
|
hono: "^4.13.8",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-my-opencode",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.84",
|
|
4
4
|
"description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
"jsonc-parser": "^3.3.1",
|
|
265
265
|
"knip": "6.43.0",
|
|
266
266
|
"node-pty": "^1.1.0",
|
|
267
|
-
"omowright": "^0.3.
|
|
267
|
+
"omowright": "^0.3.4",
|
|
268
268
|
"oxc-parser": "0.148.0",
|
|
269
269
|
"oxlint": "1.89.0",
|
|
270
270
|
"picocolors": "^1.1.1",
|
|
@@ -274,18 +274,18 @@
|
|
|
274
274
|
"typescript": "^7.0.2"
|
|
275
275
|
},
|
|
276
276
|
"optionalDependencies": {
|
|
277
|
-
"oh-my-opencode-darwin-arm64": "5.1.
|
|
278
|
-
"oh-my-opencode-darwin-x64": "5.1.
|
|
279
|
-
"oh-my-opencode-darwin-x64-baseline": "5.1.
|
|
280
|
-
"oh-my-opencode-linux-arm64": "5.1.
|
|
281
|
-
"oh-my-opencode-linux-arm64-musl": "5.1.
|
|
282
|
-
"oh-my-opencode-linux-x64": "5.1.
|
|
283
|
-
"oh-my-opencode-linux-x64-baseline": "5.1.
|
|
284
|
-
"oh-my-opencode-linux-x64-musl": "5.1.
|
|
285
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.1.
|
|
286
|
-
"oh-my-opencode-windows-arm64": "5.1.
|
|
287
|
-
"oh-my-opencode-windows-x64": "5.1.
|
|
288
|
-
"oh-my-opencode-windows-x64-baseline": "5.1.
|
|
277
|
+
"oh-my-opencode-darwin-arm64": "5.1.84",
|
|
278
|
+
"oh-my-opencode-darwin-x64": "5.1.84",
|
|
279
|
+
"oh-my-opencode-darwin-x64-baseline": "5.1.84",
|
|
280
|
+
"oh-my-opencode-linux-arm64": "5.1.84",
|
|
281
|
+
"oh-my-opencode-linux-arm64-musl": "5.1.84",
|
|
282
|
+
"oh-my-opencode-linux-x64": "5.1.84",
|
|
283
|
+
"oh-my-opencode-linux-x64-baseline": "5.1.84",
|
|
284
|
+
"oh-my-opencode-linux-x64-musl": "5.1.84",
|
|
285
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.1.84",
|
|
286
|
+
"oh-my-opencode-windows-arm64": "5.1.84",
|
|
287
|
+
"oh-my-opencode-windows-x64": "5.1.84",
|
|
288
|
+
"oh-my-opencode-windows-x64-baseline": "5.1.84"
|
|
289
289
|
},
|
|
290
290
|
"overrides": {
|
|
291
291
|
"hono": "^4.13.8",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ResolvedServer } from "./types.js"
|
|
2
|
+
|
|
3
|
+
/** What tells two resident clients apart: the server id and the exact command it was resolved to. */
|
|
4
|
+
export type ClientIdentity = Pick<ResolvedServer, "id" | "command">
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The resident client key. The resolved command is part of it because one server id can resolve to
|
|
8
|
+
* different binaries under one workspace root: in a monorepo, a TypeScript 7 package is served by its
|
|
9
|
+
* own `tsc --lsp` while a TypeScript 5 sibling is served by typescript-language-server. The same root
|
|
10
|
+
* and command still share one client.
|
|
11
|
+
*/
|
|
12
|
+
export function lspClientKey(root: string, server: ClientIdentity): string {
|
|
13
|
+
return JSON.stringify([root, server.id, server.command])
|
|
14
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { LspClient } from "./client.js"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Lifecycle of a starting client, owned by the LspManager.
|
|
5
|
+
*
|
|
6
|
+
* The manager owns every startup and every shutdown; a caller only waits. A startup begun by getClient
|
|
7
|
+
* is held by its waiters, counted in `pendingWaiters` from the moment they join until each one either
|
|
8
|
+
* becomes a reference or leaves. A waiter whose signal aborts (a caller cancellation or a directory
|
|
9
|
+
* scan's start deadline) detaches: it stops counting and rejects at once, and never awaits a shutdown.
|
|
10
|
+
* When the last waiter of a waiter-held startup leaves while it holds no reference, the manager drops
|
|
11
|
+
* the startup from its pool (so `clientCount()` no longer counts it) and stops it as a tracked
|
|
12
|
+
* tombstone, which the next getClient for that key and `stopAll()` await, so no process outlives the
|
|
13
|
+
* manager. A start that fails is dropped and stopped the same way, once. A warmup startup has no waiter
|
|
14
|
+
* to lose and runs to its end.
|
|
15
|
+
*
|
|
16
|
+
* States of one key: ABSENT; STARTING (N counted waiters); RESIDENT (R references, plus the counted
|
|
17
|
+
* waiters of a start that just finished); STOPPING (not pooled, stop tracked in `pendingStops`).
|
|
18
|
+
* - getClient resident hit: R+1 synchronously, no await.
|
|
19
|
+
* - getClient cold start or joining a start: counted (N+1) synchronously, then awaits the start. When it
|
|
20
|
+
* resumes it stops counting and takes its reference (R+1) in one synchronous step, after checking it
|
|
21
|
+
* still holds the pooled instance for its key and that the client is alive. A client that is no longer
|
|
22
|
+
* pooled (stopped by the init-timeout reaper, invalidateClient or stopAll while it waited) is never
|
|
23
|
+
* handed out: the caller acquires again through the normal path, which awaits that stop and starts a
|
|
24
|
+
* fresh client, or rejects once the manager is disposed.
|
|
25
|
+
* - Waiter abort or deadline: N-1, rejects; the last waiter leaving stops the startup as above.
|
|
26
|
+
* - releaseClient: R-1 on the instance the caller held; a stale instance gives back nothing.
|
|
27
|
+
* - Eviction at the resident cap and the idle reaper take only a RESIDENT client with R = 0 and N = 0.
|
|
28
|
+
* - The init-timeout reaper stops a startup older than the init timeout whatever its waiters, and
|
|
29
|
+
* stopAll stops everything; neither hands the stopped client to a caller.
|
|
30
|
+
*/
|
|
31
|
+
export interface ManagedClient {
|
|
32
|
+
readonly key: string
|
|
33
|
+
readonly root: string
|
|
34
|
+
readonly serverId: string
|
|
35
|
+
readonly client: LspClient
|
|
36
|
+
/** False for a warmup startup, which no waiter holds. */
|
|
37
|
+
readonly heldByWaiters: boolean
|
|
38
|
+
refCount: number
|
|
39
|
+
pendingWaiters: number
|
|
40
|
+
lastUsedAt: number
|
|
41
|
+
initPromise: Promise<void> | null
|
|
42
|
+
isInitializing: boolean
|
|
43
|
+
initializingSince: number | null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface StartupRequest {
|
|
47
|
+
readonly key: string
|
|
48
|
+
readonly root: string
|
|
49
|
+
readonly serverId: string
|
|
50
|
+
readonly client: LspClient
|
|
51
|
+
readonly heldByWaiters: boolean
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export class ClientStartups {
|
|
55
|
+
constructor(
|
|
56
|
+
private readonly now: () => number,
|
|
57
|
+
private readonly discard: (managed: ManagedClient) => void,
|
|
58
|
+
) {}
|
|
59
|
+
|
|
60
|
+
begin(request: StartupRequest): ManagedClient {
|
|
61
|
+
const { client } = request
|
|
62
|
+
const startedAt = this.now()
|
|
63
|
+
const initPromise = (async () => {
|
|
64
|
+
await client.start()
|
|
65
|
+
await client.initialize()
|
|
66
|
+
})()
|
|
67
|
+
const managed: ManagedClient = {
|
|
68
|
+
...request,
|
|
69
|
+
refCount: 0,
|
|
70
|
+
pendingWaiters: 0,
|
|
71
|
+
lastUsedAt: startedAt,
|
|
72
|
+
initPromise,
|
|
73
|
+
isInitializing: true,
|
|
74
|
+
initializingSince: startedAt,
|
|
75
|
+
}
|
|
76
|
+
// Registered before any waiter, so the pool reflects the outcome by the time a waiter resumes.
|
|
77
|
+
initPromise.then(
|
|
78
|
+
() => {
|
|
79
|
+
managed.isInitializing = false
|
|
80
|
+
managed.initializingSince = null
|
|
81
|
+
managed.initPromise = null
|
|
82
|
+
managed.lastUsedAt = this.now()
|
|
83
|
+
},
|
|
84
|
+
() => this.discard(managed),
|
|
85
|
+
)
|
|
86
|
+
return managed
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Waits for the start as one counted waiter. A rejection has already detached the waiter; a
|
|
91
|
+
* resolution leaves it counted, and the caller must turn it into a reference or `detach` it before
|
|
92
|
+
* its next await.
|
|
93
|
+
*/
|
|
94
|
+
async wait(managed: ManagedClient, initPromise: Promise<void>, signal: AbortSignal | undefined): Promise<void> {
|
|
95
|
+
managed.pendingWaiters++
|
|
96
|
+
try {
|
|
97
|
+
await awaitWithSignal(initPromise, signal)
|
|
98
|
+
} catch (error) {
|
|
99
|
+
this.detach(managed)
|
|
100
|
+
throw error
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
detach(managed: ManagedClient): void {
|
|
105
|
+
managed.pendingWaiters--
|
|
106
|
+
if (managed.pendingWaiters === 0 && managed.refCount === 0 && managed.heldByWaiters) this.discard(managed)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function awaitWithSignal<T>(promise: Promise<T>, signal: AbortSignal | undefined): Promise<T> {
|
|
111
|
+
if (!signal) return promise
|
|
112
|
+
return new Promise<T>((resolve, reject) => {
|
|
113
|
+
let settled = false
|
|
114
|
+
const onAbort = () => {
|
|
115
|
+
if (settled) return
|
|
116
|
+
settled = true
|
|
117
|
+
reject(new DOMException("Aborted", "AbortError"))
|
|
118
|
+
}
|
|
119
|
+
if (signal.aborted) {
|
|
120
|
+
onAbort()
|
|
121
|
+
return
|
|
122
|
+
}
|
|
123
|
+
signal.addEventListener("abort", onAbort, { once: true })
|
|
124
|
+
promise.then(
|
|
125
|
+
(value) => {
|
|
126
|
+
if (settled) return
|
|
127
|
+
settled = true
|
|
128
|
+
signal.removeEventListener("abort", onAbort)
|
|
129
|
+
resolve(value)
|
|
130
|
+
},
|
|
131
|
+
(err) => {
|
|
132
|
+
if (settled) return
|
|
133
|
+
settled = true
|
|
134
|
+
signal.removeEventListener("abort", onAbort)
|
|
135
|
+
reject(err)
|
|
136
|
+
},
|
|
137
|
+
)
|
|
138
|
+
})
|
|
139
|
+
}
|
|
@@ -255,7 +255,7 @@ export async function withLspClient<T>(
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
const ext = effectiveExtension(absPath)
|
|
258
|
-
const result = findServerForExtension(ext)
|
|
258
|
+
const result = findServerForExtension(ext, absPath)
|
|
259
259
|
if (result.status !== "found") {
|
|
260
260
|
throw new LspServerLookupError(formatServerLookupError(result), result)
|
|
261
261
|
}
|
|
@@ -271,18 +271,18 @@ export async function withLspClient<T>(
|
|
|
271
271
|
return await fn(client, root, absPath)
|
|
272
272
|
} catch (err) {
|
|
273
273
|
if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
|
|
274
|
-
manager.invalidateClient(root, server
|
|
274
|
+
manager.invalidateClient(root, server, client)
|
|
275
275
|
return acquireAndCall(false)
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
if (err instanceof LspRequestTimeoutError) {
|
|
279
|
-
if (manager.isServerInitializing(root, server
|
|
279
|
+
if (manager.isServerInitializing(root, server)) {
|
|
280
280
|
throw new LspServerInitializingError(err)
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
throw err
|
|
284
284
|
} finally {
|
|
285
|
-
manager.releaseClient(root, server
|
|
285
|
+
manager.releaseClient(root, server, client)
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
|
|
@@ -21,6 +21,13 @@ type ConfigSource = "project" | "user"
|
|
|
21
21
|
|
|
22
22
|
export interface ServerWithSource extends ResolvedServer {
|
|
23
23
|
source: "project" | "user" | "builtin"
|
|
24
|
+
/**
|
|
25
|
+
* True when no config file named `command`, so it is the builtin default. A configured command
|
|
26
|
+
* stays false even when it is textually equal to the default.
|
|
27
|
+
*/
|
|
28
|
+
inheritsBuiltinCommand: boolean
|
|
29
|
+
/** The `initialization` a config file supplied, without the builtin option set merged in. */
|
|
30
|
+
configuredInitialization?: Record<string, unknown>
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
export function getConfigPaths(): { project: string; user: string } {
|
|
@@ -106,6 +113,7 @@ export function getMergedServers(): ServerWithSource[] {
|
|
|
106
113
|
extensions: config.extensions,
|
|
107
114
|
priority: -100,
|
|
108
115
|
source: "builtin",
|
|
116
|
+
inheritsBuiltinCommand: true,
|
|
109
117
|
...(config.initialization === undefined ? {} : { initialization: config.initialization }),
|
|
110
118
|
})
|
|
111
119
|
}
|
|
@@ -133,7 +141,9 @@ function createServerFromEntry(id: string, entry: LspEntry, source: ConfigSource
|
|
|
133
141
|
extensions: entry.extensions ?? builtin.extensions,
|
|
134
142
|
priority: entry.priority ?? 0,
|
|
135
143
|
source,
|
|
144
|
+
inheritsBuiltinCommand: true,
|
|
136
145
|
})
|
|
146
|
+
if (entry.initialization !== undefined) server.configuredInitialization = entry.initialization
|
|
137
147
|
const initialization = mergeInitialization(builtin.initialization, entry.initialization)
|
|
138
148
|
if (initialization !== undefined) {
|
|
139
149
|
server.initialization = initialization
|
|
@@ -148,6 +158,7 @@ function createServerFromEntry(id: string, entry: LspEntry, source: ConfigSource
|
|
|
148
158
|
extensions: entry.extensions,
|
|
149
159
|
priority: entry.priority ?? 0,
|
|
150
160
|
source,
|
|
161
|
+
inheritsBuiltinCommand: false,
|
|
151
162
|
})
|
|
152
163
|
applyOptionalServerFields(server, entry)
|
|
153
164
|
return server
|
|
@@ -160,6 +171,7 @@ function createServerFromEntry(id: string, entry: LspEntry, source: ConfigSource
|
|
|
160
171
|
extensions: entry.extensions ?? builtin.extensions,
|
|
161
172
|
priority: entry.priority ?? 0,
|
|
162
173
|
source,
|
|
174
|
+
inheritsBuiltinCommand: entry.command === undefined,
|
|
163
175
|
})
|
|
164
176
|
applyOptionalServerFields(server, entry)
|
|
165
177
|
const builtinInitialization = entry.command === undefined ? builtin.initialization : undefined
|
|
@@ -185,6 +197,7 @@ function createServer(input: {
|
|
|
185
197
|
readonly extensions: string[]
|
|
186
198
|
readonly priority: number
|
|
187
199
|
readonly source: ConfigSource
|
|
200
|
+
readonly inheritsBuiltinCommand: boolean
|
|
188
201
|
readonly env?: Record<string, string>
|
|
189
202
|
readonly initialization?: Record<string, unknown>
|
|
190
203
|
}): ServerWithSource {
|
|
@@ -194,6 +207,7 @@ function createServer(input: {
|
|
|
194
207
|
extensions: input.extensions,
|
|
195
208
|
priority: input.priority,
|
|
196
209
|
source: input.source,
|
|
210
|
+
inheritsBuiltinCommand: input.inheritsBuiltinCommand,
|
|
197
211
|
}
|
|
198
212
|
if (input.env !== undefined) {
|
|
199
213
|
server.env = input.env
|
|
@@ -210,6 +224,7 @@ function applyOptionalServerFields(server: ServerWithSource, entry: LspEntry): v
|
|
|
210
224
|
}
|
|
211
225
|
if (entry.initialization !== undefined) {
|
|
212
226
|
server.initialization = entry.initialization
|
|
227
|
+
server.configuredInitialization = entry.initialization
|
|
213
228
|
}
|
|
214
229
|
}
|
|
215
230
|
|