lazycodex-ai 5.0.0-beta.49 → 5.0.0-beta.50
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/index.js +4682 -14969
- package/dist/cli-node/index.js +4727 -15014
- package/package.json +1 -1
- package/packages/lsp-daemon/dist/cli.js +181 -181
- package/packages/lsp-daemon/dist/client.js +232 -232
- package/packages/lsp-daemon/dist/index.js +132 -132
- package/packages/lsp-tools-mcp/dist/cli.js +103 -101
- package/packages/lsp-tools-mcp/dist/lsp/manager.js +14 -14
- package/packages/lsp-tools-mcp/dist/mcp.js +129 -129
- package/packages/lsp-tools-mcp/dist/tools.js +47 -47
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/README.md +4 -0
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +151 -102
- 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/AGENTS.md +2 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/directive.md +2 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/cli.js +35 -24
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.js +31 -21
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/types.d.ts +3 -0
- 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/lazycodex-executor-verify/src/codex-hook.ts +31 -23
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/types.ts +3 -0
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/cli.test.ts +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +133 -7
- package/packages/omo-codex/plugin/components/lcx/skills/lcx-doctor/SKILL.md +3 -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 +298 -298
- 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/README.md +2 -0
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus/gpt-6.md +123 -0
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +38 -30
- 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/rules/src/post-compact-budget.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/test/hephaestus-model-variant.test.ts +38 -2
- package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +24 -0
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +2 -2
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +66 -357
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +66 -358
- 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/ultrawork/README.md +2 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-clone-fidelity-reviewer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-code-reviewer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-gate-reviewer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-qa-executor.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-high.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-low.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-medium.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/metis.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/momus.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +1 -1
- 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/dist/cli.js +3 -3
- 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/dist/cli.js +63 -63
- 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/model-catalog.json +16 -7
- package/packages/omo-codex/plugin/package-lock.json +16 -16
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/catalog.mjs +16 -7
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +8 -4
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/subagent-limit-guard.mjs +18 -90
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/toml-section-editor.mjs +1 -1
- package/packages/omo-codex/plugin/shared/package.json +1 -1
- package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +3 -1
- package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +12 -12
- package/packages/omo-codex/plugin/test/aggregate-model-catalog.test.mjs +14 -4
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +4 -4
- package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +25 -1
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +35 -35
- package/packages/omo-codex/plugin/test/multi-agent-v2-regression.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/subagent-limit-migration.test.mjs +107 -15
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +318 -569
|
@@ -1835,14 +1835,14 @@ function parseSinglePathResource(input, kind) {
|
|
|
1835
1835
|
return;
|
|
1836
1836
|
}
|
|
1837
1837
|
if (kind === "create") {
|
|
1838
|
-
const
|
|
1838
|
+
const options = parseOptions(change["options"], ["overwrite", "ignoreIfExists"], changeIndex);
|
|
1839
1839
|
target.operations.push({
|
|
1840
1840
|
kind,
|
|
1841
1841
|
changeIndex,
|
|
1842
1842
|
path: resolvedPath.path,
|
|
1843
1843
|
reportedPath: resolvedPath.requestedPath,
|
|
1844
|
-
overwrite:
|
|
1845
|
-
ignoreIfExists:
|
|
1844
|
+
overwrite: options["overwrite"] ?? false,
|
|
1845
|
+
ignoreIfExists: options["ignoreIfExists"] ?? false,
|
|
1846
1846
|
followedSymbolicLink: resolvedPath.followedSymbolicLink
|
|
1847
1847
|
});
|
|
1848
1848
|
return;
|
|
@@ -2312,11 +2312,11 @@ class PlanPathIndex {
|
|
|
2312
2312
|
}
|
|
2313
2313
|
}
|
|
2314
2314
|
}
|
|
2315
|
-
add(path,
|
|
2315
|
+
add(path, reportedPath, changeIndex) {
|
|
2316
2316
|
if (!this.firstChangeByPath.has(path))
|
|
2317
2317
|
this.firstChangeByPath.set(path, changeIndex);
|
|
2318
2318
|
if (!this.reportedPathByCanonical.has(path))
|
|
2319
|
-
this.reportedPathByCanonical.set(path,
|
|
2319
|
+
this.reportedPathByCanonical.set(path, reportedPath);
|
|
2320
2320
|
}
|
|
2321
2321
|
}
|
|
2322
2322
|
function fingerprintWorkspaceEdit(edit, workspaceRoot) {
|
|
@@ -2428,8 +2428,8 @@ class WorkspaceMutationController {
|
|
|
2428
2428
|
};
|
|
2429
2429
|
}
|
|
2430
2430
|
lease.phase = "applying";
|
|
2431
|
-
lease.applyCompletion = new Promise((
|
|
2432
|
-
lease.resolveApply =
|
|
2431
|
+
lease.applyCompletion = new Promise((resolve) => {
|
|
2432
|
+
lease.resolveApply = resolve;
|
|
2433
2433
|
});
|
|
2434
2434
|
const edit = isRecord3(params) ? params["edit"] : undefined;
|
|
2435
2435
|
const record = edit === undefined ? { fingerprint: null, result: failure("workspace/applyEdit params.edit is required", 0) } : await this.applyEdit(edit, lease);
|
|
@@ -2624,13 +2624,13 @@ class LspClient extends LspClientConnection {
|
|
|
2624
2624
|
if (!pushFallbackOnly) {
|
|
2625
2625
|
const cached = this.documents.getPullCache(snapshot);
|
|
2626
2626
|
try {
|
|
2627
|
-
const
|
|
2628
|
-
if (
|
|
2627
|
+
const remainingMs = deadlineAt - this.timerProvider.now();
|
|
2628
|
+
if (remainingMs <= 0)
|
|
2629
2629
|
return this.freshnessTimeout(absPath);
|
|
2630
2630
|
const result = await this.sendRequest("textDocument/diagnostic", {
|
|
2631
2631
|
textDocument: { uri },
|
|
2632
2632
|
...cached?.resultId === undefined ? {} : { previousResultId: cached.resultId }
|
|
2633
|
-
}, { timeoutMs:
|
|
2633
|
+
}, { timeoutMs: remainingMs, ...signal === undefined ? {} : { signal } });
|
|
2634
2634
|
if (!this.documents.isCurrentSnapshot(snapshot))
|
|
2635
2635
|
continue;
|
|
2636
2636
|
const report = this.parseDiagnosticPullReport(result);
|
|
@@ -2711,7 +2711,7 @@ function waitForDiagnosticsActivity(wait, signal) {
|
|
|
2711
2711
|
return wait;
|
|
2712
2712
|
if (signal.aborted)
|
|
2713
2713
|
return Promise.reject(abortError2(signal));
|
|
2714
|
-
return new Promise((
|
|
2714
|
+
return new Promise((resolve, reject) => {
|
|
2715
2715
|
const onAbort = () => {
|
|
2716
2716
|
signal.removeEventListener("abort", onAbort);
|
|
2717
2717
|
reject(abortError2(signal));
|
|
@@ -2719,7 +2719,7 @@ function waitForDiagnosticsActivity(wait, signal) {
|
|
|
2719
2719
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
2720
2720
|
wait.then(() => {
|
|
2721
2721
|
signal.removeEventListener("abort", onAbort);
|
|
2722
|
-
|
|
2722
|
+
resolve();
|
|
2723
2723
|
}, (error) => {
|
|
2724
2724
|
signal.removeEventListener("abort", onAbort);
|
|
2725
2725
|
reject(error);
|
|
@@ -2787,7 +2787,7 @@ async function stopClientBestEffort(client) {
|
|
|
2787
2787
|
function awaitWithSignal(promise, signal) {
|
|
2788
2788
|
if (!signal)
|
|
2789
2789
|
return promise;
|
|
2790
|
-
return new Promise((
|
|
2790
|
+
return new Promise((resolve, reject) => {
|
|
2791
2791
|
let settled = false;
|
|
2792
2792
|
const onAbort = () => {
|
|
2793
2793
|
if (settled)
|
|
@@ -2805,7 +2805,7 @@ function awaitWithSignal(promise, signal) {
|
|
|
2805
2805
|
return;
|
|
2806
2806
|
settled = true;
|
|
2807
2807
|
signal.removeEventListener("abort", onAbort);
|
|
2808
|
-
|
|
2808
|
+
resolve(value);
|
|
2809
2809
|
}, (err) => {
|
|
2810
2810
|
if (settled)
|
|
2811
2811
|
return;
|
|
@@ -3826,7 +3826,7 @@ async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS, signal) {
|
|
|
3826
3826
|
return await pingDaemon(paths, token, timeoutMs, signal) !== null;
|
|
3827
3827
|
}
|
|
3828
3828
|
function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
|
|
3829
|
-
return new Promise((
|
|
3829
|
+
return new Promise((resolve) => {
|
|
3830
3830
|
const socket = new Socket;
|
|
3831
3831
|
let settled = false;
|
|
3832
3832
|
let timer;
|
|
@@ -3838,7 +3838,7 @@ function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
|
|
|
3838
3838
|
clearTimeout(timer);
|
|
3839
3839
|
signal?.removeEventListener("abort", onAbort);
|
|
3840
3840
|
socket.destroy();
|
|
3841
|
-
|
|
3841
|
+
resolve(value);
|
|
3842
3842
|
};
|
|
3843
3843
|
const onAbort = () => finish(null);
|
|
3844
3844
|
const decoder = createLineDecoder((message) => {
|
|
@@ -3901,7 +3901,7 @@ function defaultEnsureDaemonDeps() {
|
|
|
3901
3901
|
};
|
|
3902
3902
|
}
|
|
3903
3903
|
function sleepWithSignal(ms, signal) {
|
|
3904
|
-
return new Promise((
|
|
3904
|
+
return new Promise((resolve) => {
|
|
3905
3905
|
let settled = false;
|
|
3906
3906
|
const finish = () => {
|
|
3907
3907
|
if (settled)
|
|
@@ -3909,7 +3909,7 @@ function sleepWithSignal(ms, signal) {
|
|
|
3909
3909
|
settled = true;
|
|
3910
3910
|
clearTimeout(timer);
|
|
3911
3911
|
signal?.removeEventListener("abort", finish);
|
|
3912
|
-
|
|
3912
|
+
resolve();
|
|
3913
3913
|
};
|
|
3914
3914
|
const timer = setTimeout(finish, ms);
|
|
3915
3915
|
if (signal?.aborted) {
|
|
@@ -3924,7 +3924,7 @@ function awaitWithSignal2(promise, signal) {
|
|
|
3924
3924
|
return promise;
|
|
3925
3925
|
if (signal.aborted)
|
|
3926
3926
|
return Promise.reject(abortError3(signal));
|
|
3927
|
-
return new Promise((
|
|
3927
|
+
return new Promise((resolve, reject) => {
|
|
3928
3928
|
let settled = false;
|
|
3929
3929
|
const finish = (run) => {
|
|
3930
3930
|
if (settled)
|
|
@@ -3935,7 +3935,7 @@ function awaitWithSignal2(promise, signal) {
|
|
|
3935
3935
|
};
|
|
3936
3936
|
const onAbort = () => finish(() => reject(abortError3(signal)));
|
|
3937
3937
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
3938
|
-
promise.then((value) => finish(() =>
|
|
3938
|
+
promise.then((value) => finish(() => resolve(value)), (error) => finish(() => reject(error)));
|
|
3939
3939
|
});
|
|
3940
3940
|
}
|
|
3941
3941
|
function throwIfAborted(signal) {
|
|
@@ -3964,18 +3964,18 @@ function parsePingResponse(message) {
|
|
|
3964
3964
|
return null;
|
|
3965
3965
|
if (!endpoint || typeof endpoint !== "object" || Array.isArray(endpoint))
|
|
3966
3966
|
return null;
|
|
3967
|
-
const
|
|
3967
|
+
const path = Reflect.get(endpoint, "path");
|
|
3968
3968
|
const kind = Reflect.get(endpoint, "kind");
|
|
3969
|
-
if (typeof
|
|
3969
|
+
if (typeof path !== "string")
|
|
3970
3970
|
return null;
|
|
3971
3971
|
if (kind === "windows")
|
|
3972
|
-
return { pid, nonce, startedAt, endpoint: { kind, path
|
|
3972
|
+
return { pid, nonce, startedAt, endpoint: { kind, path } };
|
|
3973
3973
|
if (kind === "missing")
|
|
3974
|
-
return { pid, nonce, startedAt, endpoint: { kind, path
|
|
3974
|
+
return { pid, nonce, startedAt, endpoint: { kind, path } };
|
|
3975
3975
|
const dev = Reflect.get(endpoint, "dev");
|
|
3976
3976
|
const ino = Reflect.get(endpoint, "ino");
|
|
3977
3977
|
if (kind === "unix" && typeof dev === "number" && typeof ino === "number") {
|
|
3978
|
-
return { pid, nonce, startedAt, endpoint: { kind, path
|
|
3978
|
+
return { pid, nonce, startedAt, endpoint: { kind, path, dev, ino } };
|
|
3979
3979
|
}
|
|
3980
3980
|
return null;
|
|
3981
3981
|
}
|
|
@@ -4023,7 +4023,7 @@ ${body}` : `${body}
|
|
|
4023
4023
|
await writeChunk(output, payload);
|
|
4024
4024
|
}
|
|
4025
4025
|
function writeChunk(output, chunk) {
|
|
4026
|
-
return new Promise((
|
|
4026
|
+
return new Promise((resolve, reject) => {
|
|
4027
4027
|
let settled = false;
|
|
4028
4028
|
const onError = (error) => {
|
|
4029
4029
|
if (settled)
|
|
@@ -4043,7 +4043,7 @@ function writeChunk(output, chunk) {
|
|
|
4043
4043
|
return;
|
|
4044
4044
|
}
|
|
4045
4045
|
output.removeListener("error", onError);
|
|
4046
|
-
|
|
4046
|
+
resolve();
|
|
4047
4047
|
});
|
|
4048
4048
|
} catch (error) {
|
|
4049
4049
|
output.removeListener("error", onError);
|
|
@@ -4511,11 +4511,11 @@ function getInstallDecisionsPath() {
|
|
|
4511
4511
|
return lspRequestContext().installDecisionsPath;
|
|
4512
4512
|
}
|
|
4513
4513
|
function loadInstallDecisions() {
|
|
4514
|
-
const
|
|
4515
|
-
if (!existsSync8(
|
|
4514
|
+
const path = getInstallDecisionsPath();
|
|
4515
|
+
if (!existsSync8(path))
|
|
4516
4516
|
return {};
|
|
4517
4517
|
try {
|
|
4518
|
-
const parsed = JSON.parse(readFileSync4(
|
|
4518
|
+
const parsed = JSON.parse(readFileSync4(path, "utf8"));
|
|
4519
4519
|
return isInstallDecisions(parsed) ? parsed : {};
|
|
4520
4520
|
} catch {
|
|
4521
4521
|
return {};
|
|
@@ -4533,12 +4533,12 @@ function isInstallDecision(value) {
|
|
|
4533
4533
|
return value === "declined" || value === "allowed";
|
|
4534
4534
|
}
|
|
4535
4535
|
function writeInstallDecisions(decisions) {
|
|
4536
|
-
const
|
|
4537
|
-
mkdirSync3(dirname8(
|
|
4538
|
-
const tmpPath = `${
|
|
4536
|
+
const path = getInstallDecisionsPath();
|
|
4537
|
+
mkdirSync3(dirname8(path), { recursive: true });
|
|
4538
|
+
const tmpPath = `${path}.tmp`;
|
|
4539
4539
|
writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
|
|
4540
4540
|
`, "utf8");
|
|
4541
|
-
renameSync2(tmpPath,
|
|
4541
|
+
renameSync2(tmpPath, path);
|
|
4542
4542
|
}
|
|
4543
4543
|
function isInstallDecisions(value) {
|
|
4544
4544
|
return isRecord5(value) && Object.values(value).every(isInstallDecisionRecord);
|
|
@@ -4560,11 +4560,11 @@ function getProjectConfigPaths() {
|
|
|
4560
4560
|
function getUserConfigPath() {
|
|
4561
4561
|
return lspRequestContext().userConfigPath;
|
|
4562
4562
|
}
|
|
4563
|
-
function loadJsonFile(
|
|
4564
|
-
if (!existsSync9(
|
|
4563
|
+
function loadJsonFile(path) {
|
|
4564
|
+
if (!existsSync9(path))
|
|
4565
4565
|
return null;
|
|
4566
4566
|
try {
|
|
4567
|
-
const parsed = JSON.parse(readFileSync5(
|
|
4567
|
+
const parsed = JSON.parse(readFileSync5(path, "utf-8"));
|
|
4568
4568
|
return isConfigJson(parsed) ? parsed : null;
|
|
4569
4569
|
} catch {
|
|
4570
4570
|
return null;
|
|
@@ -4581,8 +4581,8 @@ function loadAllConfigs() {
|
|
|
4581
4581
|
return configs;
|
|
4582
4582
|
}
|
|
4583
4583
|
function loadFirstJsonFile(paths) {
|
|
4584
|
-
for (const
|
|
4585
|
-
const config = loadJsonFile(
|
|
4584
|
+
for (const path of paths) {
|
|
4585
|
+
const config = loadJsonFile(path);
|
|
4586
4586
|
if (config)
|
|
4587
4587
|
return config;
|
|
4588
4588
|
}
|
|
@@ -4608,10 +4608,10 @@ function getMergedServers() {
|
|
|
4608
4608
|
}
|
|
4609
4609
|
if (seen.has(id))
|
|
4610
4610
|
continue;
|
|
4611
|
-
const
|
|
4612
|
-
if (!
|
|
4611
|
+
const server = createServerFromEntry(id, entry, source);
|
|
4612
|
+
if (!server)
|
|
4613
4613
|
continue;
|
|
4614
|
-
servers.push(
|
|
4614
|
+
servers.push(server);
|
|
4615
4615
|
seen.add(id);
|
|
4616
4616
|
}
|
|
4617
4617
|
}
|
|
@@ -4643,7 +4643,7 @@ function createServerFromEntry(id, entry, source) {
|
|
|
4643
4643
|
if (source === "project") {
|
|
4644
4644
|
if (!builtin)
|
|
4645
4645
|
return null;
|
|
4646
|
-
const
|
|
4646
|
+
const server = createServer({
|
|
4647
4647
|
id,
|
|
4648
4648
|
command: builtin.command,
|
|
4649
4649
|
extensions: entry.extensions ?? builtin.extensions,
|
|
@@ -4651,35 +4651,35 @@ function createServerFromEntry(id, entry, source) {
|
|
|
4651
4651
|
source
|
|
4652
4652
|
});
|
|
4653
4653
|
if (entry.initialization !== undefined) {
|
|
4654
|
-
|
|
4654
|
+
server.initialization = entry.initialization;
|
|
4655
4655
|
}
|
|
4656
|
-
return
|
|
4656
|
+
return server;
|
|
4657
4657
|
}
|
|
4658
4658
|
if (entry.command && entry.extensions) {
|
|
4659
|
-
const
|
|
4659
|
+
const server = createServer({
|
|
4660
4660
|
id,
|
|
4661
4661
|
command: entry.command,
|
|
4662
4662
|
extensions: entry.extensions,
|
|
4663
4663
|
priority: entry.priority ?? 0,
|
|
4664
4664
|
source
|
|
4665
4665
|
});
|
|
4666
|
-
applyOptionalServerFields(
|
|
4667
|
-
return
|
|
4666
|
+
applyOptionalServerFields(server, entry);
|
|
4667
|
+
return server;
|
|
4668
4668
|
}
|
|
4669
4669
|
if (!builtin)
|
|
4670
4670
|
return null;
|
|
4671
|
-
const
|
|
4671
|
+
const server = createServer({
|
|
4672
4672
|
id,
|
|
4673
4673
|
command: entry.command ?? builtin.command,
|
|
4674
4674
|
extensions: entry.extensions ?? builtin.extensions,
|
|
4675
4675
|
priority: entry.priority ?? 0,
|
|
4676
4676
|
source
|
|
4677
4677
|
});
|
|
4678
|
-
applyOptionalServerFields(
|
|
4679
|
-
return
|
|
4678
|
+
applyOptionalServerFields(server, entry);
|
|
4679
|
+
return server;
|
|
4680
4680
|
}
|
|
4681
4681
|
function createServer(input) {
|
|
4682
|
-
const
|
|
4682
|
+
const server = {
|
|
4683
4683
|
id: input.id,
|
|
4684
4684
|
command: input.command,
|
|
4685
4685
|
extensions: input.extensions,
|
|
@@ -4687,19 +4687,19 @@ function createServer(input) {
|
|
|
4687
4687
|
source: input.source
|
|
4688
4688
|
};
|
|
4689
4689
|
if (input.env !== undefined) {
|
|
4690
|
-
|
|
4690
|
+
server.env = input.env;
|
|
4691
4691
|
}
|
|
4692
4692
|
if (input.initialization !== undefined) {
|
|
4693
|
-
|
|
4693
|
+
server.initialization = input.initialization;
|
|
4694
4694
|
}
|
|
4695
|
-
return
|
|
4695
|
+
return server;
|
|
4696
4696
|
}
|
|
4697
|
-
function applyOptionalServerFields(
|
|
4697
|
+
function applyOptionalServerFields(server, entry) {
|
|
4698
4698
|
if (entry.env !== undefined) {
|
|
4699
|
-
|
|
4699
|
+
server.env = entry.env;
|
|
4700
4700
|
}
|
|
4701
4701
|
if (entry.initialization !== undefined) {
|
|
4702
|
-
|
|
4702
|
+
server.initialization = entry.initialization;
|
|
4703
4703
|
}
|
|
4704
4704
|
}
|
|
4705
4705
|
function isConfigJson(value) {
|
|
@@ -4788,9 +4788,9 @@ var LOCAL_BIN_RULES = [
|
|
|
4788
4788
|
];
|
|
4789
4789
|
var resolutionCache = new Map;
|
|
4790
4790
|
var probeCount = 0;
|
|
4791
|
-
function probe(
|
|
4791
|
+
function probe(path) {
|
|
4792
4792
|
probeCount += 1;
|
|
4793
|
-
return existsSync10(
|
|
4793
|
+
return existsSync10(path);
|
|
4794
4794
|
}
|
|
4795
4795
|
function executableSuffixes(platform, pathExt) {
|
|
4796
4796
|
if (platform !== "win32")
|
|
@@ -4890,24 +4890,24 @@ function withResolvedCommand(command, binaryPath) {
|
|
|
4890
4890
|
function findServerForExtension(ext) {
|
|
4891
4891
|
const servers = getMergedServers();
|
|
4892
4892
|
const workingDirectory = contextCwd();
|
|
4893
|
-
for (const
|
|
4894
|
-
if (!
|
|
4893
|
+
for (const server of servers) {
|
|
4894
|
+
if (!server.extensions.includes(ext))
|
|
4895
4895
|
continue;
|
|
4896
|
-
const binaryPath = resolveServerBinary(
|
|
4896
|
+
const binaryPath = resolveServerBinary(server.command, workingDirectory);
|
|
4897
4897
|
if (binaryPath !== null) {
|
|
4898
4898
|
const resolvedServer = {
|
|
4899
|
-
id:
|
|
4900
|
-
command: withResolvedCommand(
|
|
4901
|
-
extensions:
|
|
4902
|
-
priority:
|
|
4899
|
+
id: server.id,
|
|
4900
|
+
command: withResolvedCommand(server.command, binaryPath),
|
|
4901
|
+
extensions: server.extensions,
|
|
4902
|
+
priority: server.priority
|
|
4903
4903
|
};
|
|
4904
|
-
if (
|
|
4904
|
+
if (server.env !== undefined) {
|
|
4905
4905
|
return {
|
|
4906
4906
|
status: "found",
|
|
4907
4907
|
server: {
|
|
4908
4908
|
...resolvedServer,
|
|
4909
|
-
env:
|
|
4910
|
-
...
|
|
4909
|
+
env: server.env,
|
|
4910
|
+
...server.initialization === undefined ? {} : { initialization: server.initialization }
|
|
4911
4911
|
}
|
|
4912
4912
|
};
|
|
4913
4913
|
}
|
|
@@ -4915,20 +4915,20 @@ function findServerForExtension(ext) {
|
|
|
4915
4915
|
status: "found",
|
|
4916
4916
|
server: {
|
|
4917
4917
|
...resolvedServer,
|
|
4918
|
-
...
|
|
4918
|
+
...server.initialization === undefined ? {} : { initialization: server.initialization }
|
|
4919
4919
|
}
|
|
4920
4920
|
};
|
|
4921
4921
|
}
|
|
4922
4922
|
}
|
|
4923
|
-
for (const
|
|
4924
|
-
if (
|
|
4925
|
-
const installHint = LSP_INSTALL_HINTS[
|
|
4923
|
+
for (const server of servers) {
|
|
4924
|
+
if (server.extensions.includes(ext)) {
|
|
4925
|
+
const installHint = LSP_INSTALL_HINTS[server.id] ?? `Install '${server.command[0]}' and ensure it's in your PATH`;
|
|
4926
4926
|
return {
|
|
4927
4927
|
status: "not_installed",
|
|
4928
4928
|
server: {
|
|
4929
|
-
id:
|
|
4930
|
-
command:
|
|
4931
|
-
extensions:
|
|
4929
|
+
id: server.id,
|
|
4930
|
+
command: server.command,
|
|
4931
|
+
extensions: server.extensions
|
|
4932
4932
|
},
|
|
4933
4933
|
installHint
|
|
4934
4934
|
};
|
|
@@ -4947,18 +4947,18 @@ function getAllServers() {
|
|
|
4947
4947
|
const workingDirectory = contextCwd();
|
|
4948
4948
|
const result = [];
|
|
4949
4949
|
const seen = new Set;
|
|
4950
|
-
for (const
|
|
4951
|
-
if (seen.has(
|
|
4950
|
+
for (const server of servers) {
|
|
4951
|
+
if (seen.has(server.id))
|
|
4952
4952
|
continue;
|
|
4953
4953
|
result.push({
|
|
4954
|
-
id:
|
|
4955
|
-
installed: isServerInstalled(
|
|
4956
|
-
extensions:
|
|
4954
|
+
id: server.id,
|
|
4955
|
+
installed: isServerInstalled(server.command, workingDirectory),
|
|
4956
|
+
extensions: server.extensions,
|
|
4957
4957
|
disabled: false,
|
|
4958
|
-
source:
|
|
4959
|
-
priority:
|
|
4958
|
+
source: server.source,
|
|
4959
|
+
priority: server.priority
|
|
4960
4960
|
});
|
|
4961
|
-
seen.add(
|
|
4961
|
+
seen.add(server.id);
|
|
4962
4962
|
}
|
|
4963
4963
|
for (const id of disabled) {
|
|
4964
4964
|
if (seen.has(id))
|
|
@@ -5033,8 +5033,8 @@ function resolvePathInsideContext(filePath) {
|
|
|
5033
5033
|
}
|
|
5034
5034
|
return canonical;
|
|
5035
5035
|
}
|
|
5036
|
-
function rebaseThroughCanonicalAncestor(
|
|
5037
|
-
let current =
|
|
5036
|
+
function rebaseThroughCanonicalAncestor(path, cwd) {
|
|
5037
|
+
let current = path;
|
|
5038
5038
|
const suffix = [];
|
|
5039
5039
|
while (true) {
|
|
5040
5040
|
if (existsSync11(current)) {
|
|
@@ -5106,20 +5106,20 @@ function formatInstallOptions(serverId, installHint) {
|
|
|
5106
5106
|
];
|
|
5107
5107
|
}
|
|
5108
5108
|
function formatNotInstalled(result) {
|
|
5109
|
-
const { server
|
|
5110
|
-
const extensions =
|
|
5111
|
-
const decision = loadInstallDecision(
|
|
5109
|
+
const { server, installHint } = result;
|
|
5110
|
+
const extensions = server.extensions.join(", ");
|
|
5111
|
+
const decision = loadInstallDecision(server.id)?.decision;
|
|
5112
5112
|
const context = lspRequestContext();
|
|
5113
5113
|
if (decision === "declined") {
|
|
5114
|
-
return `LSP server '${
|
|
5114
|
+
return `LSP server '${server.id}' (${extensions}) is NOT INSTALLED; user previously declined installation — proceed without LSP.`;
|
|
5115
5115
|
}
|
|
5116
5116
|
const header = [
|
|
5117
|
-
`LSP server '${
|
|
5117
|
+
`LSP server '${server.id}' for ${extensions} is NOT INSTALLED.`,
|
|
5118
5118
|
"",
|
|
5119
|
-
`Command not found: ${
|
|
5119
|
+
`Command not found: ${server.command[0]}`,
|
|
5120
5120
|
""
|
|
5121
5121
|
];
|
|
5122
|
-
const installOptions = formatInstallOptions(
|
|
5122
|
+
const installOptions = formatInstallOptions(server.id, installHint);
|
|
5123
5123
|
if (decision === "allowed") {
|
|
5124
5124
|
return [
|
|
5125
5125
|
...header,
|
|
@@ -5145,7 +5145,7 @@ function formatNotInstalled(result) {
|
|
|
5145
5145
|
"ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
|
|
5146
5146
|
"- If the user agrees: run the install command above, then retry this tool.",
|
|
5147
5147
|
"- If the user declines, OR has NOT explicitly asked for LSP installation:",
|
|
5148
|
-
` call lsp_install_decision { server_id: "${
|
|
5148
|
+
` call lsp_install_decision { server_id: "${server.id}", decision: "declined" },`,
|
|
5149
5149
|
` which writes to ${context.installDecisionsPath},`,
|
|
5150
5150
|
" then ignore this message and proceed WITHOUT LSP."
|
|
5151
5151
|
].join(`
|
|
@@ -5169,26 +5169,26 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
5169
5169
|
if (result.status !== "found") {
|
|
5170
5170
|
throw new LspServerLookupError(formatServerLookupError(result), result);
|
|
5171
5171
|
}
|
|
5172
|
-
const
|
|
5172
|
+
const server = result.server;
|
|
5173
5173
|
const root = findWorkspaceRoot(absPath);
|
|
5174
5174
|
const manager = options.manager ?? getLspManager();
|
|
5175
5175
|
const acquireAndCall = async (allowRetry) => {
|
|
5176
|
-
const client = await manager.getClient(root,
|
|
5176
|
+
const client = await manager.getClient(root, server, options.signal);
|
|
5177
5177
|
try {
|
|
5178
5178
|
return await fn(client, root, absPath);
|
|
5179
5179
|
} catch (err) {
|
|
5180
5180
|
if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
|
|
5181
|
-
manager.invalidateClient(root,
|
|
5181
|
+
manager.invalidateClient(root, server.id, client);
|
|
5182
5182
|
return acquireAndCall(false);
|
|
5183
5183
|
}
|
|
5184
5184
|
if (err instanceof LspRequestTimeoutError) {
|
|
5185
|
-
if (manager.isServerInitializing(root,
|
|
5185
|
+
if (manager.isServerInitializing(root, server.id)) {
|
|
5186
5186
|
throw new LspServerInitializingError(err);
|
|
5187
5187
|
}
|
|
5188
5188
|
}
|
|
5189
5189
|
throw err;
|
|
5190
5190
|
} finally {
|
|
5191
|
-
manager.releaseClient(root,
|
|
5191
|
+
manager.releaseClient(root, server.id);
|
|
5192
5192
|
}
|
|
5193
5193
|
};
|
|
5194
5194
|
return acquireAndCall(true);
|
|
@@ -5211,10 +5211,10 @@ function uriToPath(uri) {
|
|
|
5211
5211
|
}
|
|
5212
5212
|
function formatLocation(loc) {
|
|
5213
5213
|
if ("targetUri" in loc) {
|
|
5214
|
-
const
|
|
5215
|
-
const
|
|
5216
|
-
const
|
|
5217
|
-
return `${
|
|
5214
|
+
const uri = uriToPath(loc.targetUri);
|
|
5215
|
+
const line = loc.targetRange.start.line + 1;
|
|
5216
|
+
const char = loc.targetRange.start.character;
|
|
5217
|
+
return `${uri}:${line}:${char}`;
|
|
5218
5218
|
}
|
|
5219
5219
|
const uri = uriToPath(loc.uri);
|
|
5220
5220
|
const line = loc.range.start.line + 1;
|
|
@@ -5359,7 +5359,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
5359
5359
|
if (serverResult.status !== "found") {
|
|
5360
5360
|
throw new LspServerLookupError(formatServerLookupError(serverResult));
|
|
5361
5361
|
}
|
|
5362
|
-
const
|
|
5362
|
+
const server = serverResult.server;
|
|
5363
5363
|
const allFiles = (options.listFiles ?? collectFilesWithExtension)(absDir, extension, maxFiles + 1);
|
|
5364
5364
|
const wasCapped = allFiles.length > maxFiles;
|
|
5365
5365
|
const filesToProcess = allFiles.slice(0, maxFiles);
|
|
@@ -5379,7 +5379,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
5379
5379
|
const fileErrors = [];
|
|
5380
5380
|
const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
|
|
5381
5381
|
options.signal?.throwIfAborted();
|
|
5382
|
-
const client = await manager.getClient(root,
|
|
5382
|
+
const client = await manager.getClient(root, server, options.signal);
|
|
5383
5383
|
try {
|
|
5384
5384
|
let nextIndex = 0;
|
|
5385
5385
|
const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
|
|
@@ -5407,7 +5407,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
5407
5407
|
});
|
|
5408
5408
|
await Promise.all(workers);
|
|
5409
5409
|
} finally {
|
|
5410
|
-
manager.releaseClient(root,
|
|
5410
|
+
manager.releaseClient(root, server.id);
|
|
5411
5411
|
}
|
|
5412
5412
|
const displayDiagnostics = allDiagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS);
|
|
5413
5413
|
const wasDiagCapped = allDiagnostics.length > DEFAULT_MAX_DIAGNOSTICS;
|
|
@@ -5616,8 +5616,8 @@ function clientOptions(signal) {
|
|
|
5616
5616
|
}
|
|
5617
5617
|
|
|
5618
5618
|
// ../lsp-core/src/tools/result.ts
|
|
5619
|
-
function text(
|
|
5620
|
-
return { content: [{ type: "text", text
|
|
5619
|
+
function text(text, details, isError = false) {
|
|
5620
|
+
return { content: [{ type: "text", text }], details, isError };
|
|
5621
5621
|
}
|
|
5622
5622
|
|
|
5623
5623
|
// ../lsp-core/src/tools/diagnostics.ts
|
|
@@ -5637,7 +5637,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5637
5637
|
const extension = inferExtensionFromDirectory(absPath);
|
|
5638
5638
|
if (!extension) {
|
|
5639
5639
|
const message = `No supported source files found in directory: ${absPath}`;
|
|
5640
|
-
const
|
|
5640
|
+
const details = {
|
|
5641
5641
|
filePath,
|
|
5642
5642
|
severity,
|
|
5643
5643
|
mode: "directory",
|
|
@@ -5647,24 +5647,24 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5647
5647
|
error: message,
|
|
5648
5648
|
errorKind: "no_files"
|
|
5649
5649
|
};
|
|
5650
|
-
return text(message,
|
|
5650
|
+
return text(message, details);
|
|
5651
5651
|
}
|
|
5652
|
-
const
|
|
5653
|
-
const
|
|
5652
|
+
const output = await aggregateDiagnosticsForDirectory(absPath, extension, severity, undefined, signal === undefined ? {} : { signal });
|
|
5653
|
+
const details = {
|
|
5654
5654
|
filePath,
|
|
5655
5655
|
severity,
|
|
5656
5656
|
mode: "directory",
|
|
5657
5657
|
diagnostics: [],
|
|
5658
|
-
totalDiagnostics:
|
|
5658
|
+
totalDiagnostics: output.totalDiagnostics,
|
|
5659
5659
|
truncated: false,
|
|
5660
|
-
fileFailures: [...
|
|
5660
|
+
fileFailures: [...output.fileFailures]
|
|
5661
5661
|
};
|
|
5662
|
-
return text(
|
|
5662
|
+
return text(output.output, details);
|
|
5663
5663
|
}
|
|
5664
5664
|
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
|
|
5665
5665
|
if (result.transientError) {
|
|
5666
5666
|
const message = result.transientError.message;
|
|
5667
|
-
const
|
|
5667
|
+
const details = {
|
|
5668
5668
|
filePath,
|
|
5669
5669
|
severity,
|
|
5670
5670
|
mode: "file",
|
|
@@ -5674,7 +5674,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
5674
5674
|
error: message,
|
|
5675
5675
|
errorKind: result.transientError.kind
|
|
5676
5676
|
};
|
|
5677
|
-
return text(message,
|
|
5677
|
+
return text(message, details, true);
|
|
5678
5678
|
}
|
|
5679
5679
|
const diagnostics = filterDiagnosticsBySeverity(asDiagnosticArray(result), severity);
|
|
5680
5680
|
const total = diagnostics.length;
|
|
@@ -5805,7 +5805,7 @@ async function executeLspInstallDecision(params) {
|
|
|
5805
5805
|
if (!isInstallDecision(decision)) {
|
|
5806
5806
|
return text(`Invalid decision '${String(decision)}'. Expected "declined" or "allowed".`, { serverId, errorKind: "invalid_decision" }, true);
|
|
5807
5807
|
}
|
|
5808
|
-
const serverIds = [...new Set(getMergedServers().map((
|
|
5808
|
+
const serverIds = [...new Set(getMergedServers().map((server) => server.id))];
|
|
5809
5809
|
if (!serverIds.includes(serverId)) {
|
|
5810
5810
|
const preview = serverIds.slice(0, 20).join(", ");
|
|
5811
5811
|
return text(`Unknown LSP server '${serverId}'. Known servers: ${preview}${serverIds.length > 20 ? "..." : ""}`, { serverId, errorKind: "unknown_server" }, true);
|
|
@@ -5945,10 +5945,10 @@ function objectSchema(properties, required = []) {
|
|
|
5945
5945
|
async function executeLspStatus() {
|
|
5946
5946
|
const servers = getAllServers();
|
|
5947
5947
|
const snapshots = getLspManager().getSnapshot();
|
|
5948
|
-
const installed = servers.filter((
|
|
5949
|
-
const configuredLines = servers.map((
|
|
5950
|
-
const state =
|
|
5951
|
-
return `- ${
|
|
5948
|
+
const installed = servers.filter((server) => server.installed && !server.disabled);
|
|
5949
|
+
const configuredLines = servers.map((server) => {
|
|
5950
|
+
const state = server.disabled ? "disabled" : server.installed ? "installed" : "missing";
|
|
5951
|
+
return `- ${server.id}: ${state}; source=${server.source}; extensions=${server.extensions.join(", ")}`;
|
|
5952
5952
|
});
|
|
5953
5953
|
const activeLines = snapshots.map((snapshot) => {
|
|
5954
5954
|
const state = snapshot.alive ? snapshot.isInitializing ? "initializing" : "alive" : "dead";
|
|
@@ -5991,8 +5991,8 @@ async function executeLspSymbols(params, signal) {
|
|
|
5991
5991
|
errorKind: "missing_query"
|
|
5992
5992
|
});
|
|
5993
5993
|
}
|
|
5994
|
-
const
|
|
5995
|
-
return formatSymbolsResult(filePath, scope,
|
|
5994
|
+
const symbols = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
|
|
5995
|
+
return formatSymbolsResult(filePath, scope, symbols, limit, query);
|
|
5996
5996
|
}
|
|
5997
5997
|
const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
|
|
5998
5998
|
return formatSymbolsResult(filePath, scope, symbols, limit);
|
|
@@ -6384,7 +6384,7 @@ function withContext(args, context) {
|
|
|
6384
6384
|
function ensureDaemonAvailable(paths, ensure, signal) {
|
|
6385
6385
|
if (!signal)
|
|
6386
6386
|
return ensure(paths);
|
|
6387
|
-
return new Promise((
|
|
6387
|
+
return new Promise((resolve, reject) => {
|
|
6388
6388
|
let settled = false;
|
|
6389
6389
|
const finish = (run) => {
|
|
6390
6390
|
if (settled)
|
|
@@ -6399,11 +6399,11 @@ function ensureDaemonAvailable(paths, ensure, signal) {
|
|
|
6399
6399
|
return;
|
|
6400
6400
|
}
|
|
6401
6401
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
6402
|
-
Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() =>
|
|
6402
|
+
Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
|
|
6403
6403
|
});
|
|
6404
6404
|
}
|
|
6405
6405
|
function sendToolCall(paths, token, name, args, options) {
|
|
6406
|
-
return new Promise((
|
|
6406
|
+
return new Promise((resolve, reject) => {
|
|
6407
6407
|
const socket = connect(paths.socket);
|
|
6408
6408
|
const requestId = allocateProxyRequestId();
|
|
6409
6409
|
let settled = false;
|
|
@@ -6456,7 +6456,7 @@ function sendToolCall(paths, token, name, args, options) {
|
|
|
6456
6456
|
}
|
|
6457
6457
|
const result = toToolResult(message, requestId);
|
|
6458
6458
|
if (result)
|
|
6459
|
-
finish(() =>
|
|
6459
|
+
finish(() => resolve(result));
|
|
6460
6460
|
else
|
|
6461
6461
|
finish(() => reject(new DaemonRequestError("invalid daemon response", requestWritten)));
|
|
6462
6462
|
});
|
|
@@ -6629,10 +6629,10 @@ function canonicalizePath(value) {
|
|
|
6629
6629
|
return value;
|
|
6630
6630
|
return realpathSync6(value);
|
|
6631
6631
|
}
|
|
6632
|
-
function projectRootFromOpenCodeConfigPath(
|
|
6633
|
-
if (basename4(
|
|
6632
|
+
function projectRootFromOpenCodeConfigPath(path) {
|
|
6633
|
+
if (basename4(path) !== "lsp.json" && basename4(path) !== "lsp-client.json")
|
|
6634
6634
|
return;
|
|
6635
|
-
const configDir = dirname11(
|
|
6635
|
+
const configDir = dirname11(path);
|
|
6636
6636
|
const configDirName = basename4(configDir);
|
|
6637
6637
|
if (configDirName !== ".opencode" && configDirName !== ".omo")
|
|
6638
6638
|
return;
|