oh-my-opencode 5.0.0-beta.1 → 5.0.0-beta.11
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/.agents/command/publish.md +44 -16
- package/.agents/skills/publish/SKILL.md +44 -16
- package/.agents/skills/work-with-pr/SKILL.md +37 -23
- package/.opencode/command/publish.md +44 -16
- package/.opencode/skills/work-with-pr/SKILL.md +37 -23
- package/README.md +12 -1
- package/dist/agents/atlas/agent.d.ts +0 -1
- package/dist/agents/sisyphus/grok-4.d.ts +20 -0
- package/dist/agents/sisyphus/index.d.ts +2 -0
- package/dist/agents/sisyphus-agent-config.d.ts +6 -0
- package/dist/agents/sisyphus-agent-factory.d.ts +1 -1
- package/dist/agents/sisyphus-runtime-prompt-reconciler.d.ts +15 -4
- package/dist/agents/types.d.ts +2 -2
- package/dist/cli/index.js +805 -534
- package/dist/cli/run/on-complete-hook.d.ts +2 -0
- package/dist/cli-node/index.js +805 -534
- package/dist/hooks/atlas/final-wave-approval-gate.test-support.d.ts +50 -0
- package/dist/hooks/atlas/system-reminder-templates.d.ts +0 -1
- package/dist/index.js +1566 -1217
- package/dist/shared/normalize-sdk-response.d.ts +1 -0
- package/dist/shared/shell-env.d.ts +1 -1
- package/dist/skills/coding-agent-sessions/SKILL.md +3 -2
- package/dist/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/dist/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/dist/skills/frontend/SKILL.md +10 -7
- package/dist/skills/frontend/references/design/_INDEX.md +1 -0
- package/dist/skills/frontend/references/design/stylegallery.md +80 -0
- package/dist/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
- package/dist/skills/ultimate-browsing/engine/AGENTS.md +179 -0
- package/dist/skills/ultimate-browsing/engine/templates/package.json +1 -1
- package/dist/skills/ultimate-browsing/references/chrome-stealth.md +11 -11
- package/dist/skills/ulw-plan/SKILL.md +2 -2
- package/dist/skills/ulw-plan/references/full-workflow.md +27 -3
- package/dist/skills/ulw-plan/references/intent-clear.md +2 -1
- package/dist/skills/ulw-plan/references/intent-unclear.md +3 -3
- package/dist/tools/delegate-task/builtin-categories.d.ts +1 -0
- package/dist/tools/delegate-task/builtin-category-definition.d.ts +1 -0
- package/dist/tools/delegate-task/tool-description.d.ts +3 -1
- package/dist/tui.js +184 -83
- package/package.json +21 -19
- package/packages/lsp-core/src/lsp/client-diagnostics-concurrency.integration.test.ts +44 -0
- package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +0 -28
- package/packages/lsp-core/src/lsp/client-wrapper-outside-cwd.test.ts +78 -0
- package/packages/lsp-core/src/lsp/client-wrapper.test.ts +66 -13
- package/packages/lsp-core/src/lsp/client-wrapper.ts +70 -18
- package/packages/lsp-core/src/lsp/outside-context-workspace.ts +33 -0
- package/packages/lsp-core/src/lsp/workspace-edit-adversarial.test.ts +20 -1
- package/packages/lsp-core/src/lsp/workspace-markers.ts +1 -0
- package/packages/lsp-core/src/tools/diagnostics.ts +3 -3
- package/packages/lsp-core/src/tools/navigation.ts +4 -2
- package/packages/lsp-core/src/tools/rename.ts +4 -2
- package/packages/lsp-core/src/tools/symbols.ts +1 -1
- package/packages/lsp-daemon/dist/cli.js +160 -71
- package/packages/lsp-daemon/dist/client.js +135 -46
- package/packages/lsp-daemon/dist/index.js +143 -54
- package/packages/lsp-tools-mcp/dist/cli.js +131 -42
- package/packages/lsp-tools-mcp/dist/mcp.js +131 -42
- package/packages/lsp-tools-mcp/dist/tools.js +131 -42
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- 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/codegraph/dist/cli.js +118 -8
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +118 -8
- package/packages/omo-codex/plugin/components/codegraph/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/lazycodex-executor-verify/test/codex-hook.test.ts +3 -17
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +147 -64
- 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/rules/test/bundled-rules-priority.test.ts +11 -16
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +16 -23
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +9 -7
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +0 -6
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-dedup.test.ts +6 -4
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-directive.test.ts +12 -9
- package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +28 -37
- package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +37 -69
- package/packages/omo-codex/plugin/components/rules/test/hook-output.test.ts +2 -3
- package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +1 -15
- package/packages/omo-codex/plugin/components/start-work-continuation/AGENTS.md +3 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/test/cli.test.ts +0 -3
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +2 -16
- 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/teammode/test/thread-title-hook.test.ts +3 -9
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +24 -12
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +24 -12
- 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/directive.md +6 -0
- 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/ultrawork/skills/ultrawork/SKILL.md +6 -0
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +27 -3
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +2 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +3 -3
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +0 -136
- package/packages/omo-codex/plugin/components/ultrawork/test/skill-pointer.test.ts +0 -2
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +3 -2
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/define-goal.md +108 -0
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-continuation.test.ts +0 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +0 -3
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +2 -35
- package/packages/omo-codex/plugin/components/ulw-loop/test/ultrawork-directive.test.ts +4 -5
- 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-codegraph-init-guidance.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/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-checking-codegraph-bootstrap.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-start-work-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-checking-start-work-continuation.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 +20 -20
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +3 -2
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +10 -7
- package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +1 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/stylegallery.md +80 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/AGENTS.md +179 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/package.json +1 -1
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/chrome-stealth.md +11 -11
- package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +6 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +3 -2
- package/packages/omo-codex/plugin/skills/ulw-loop/references/define-goal.md +108 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +1 -0
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +27 -3
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +2 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +3 -3
- package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +19 -173
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +4 -24
- package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +175 -13
- package/packages/omo-codex/plugin/test/aggregate.test.mjs +78 -2
- package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +19 -33
- package/packages/omo-codex/plugin/test/lcx-contribute-bug-fix-template.test.mjs +21 -27
- package/packages/omo-codex/plugin/test/scaffold-plan.test.mjs +0 -36
- package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +101 -0
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +1 -119
- package/packages/omo-codex/plugin/test/teammode-archive-ambiguity.test.mjs +0 -40
- package/packages/omo-codex/plugin/test/teammode-communication.test.mjs +6 -62
- package/packages/omo-codex/plugin/test/teammode-thread-links.test.mjs +3 -36
- package/packages/omo-codex/plugin/test/teammode-transport.test.mjs +0 -44
- package/packages/omo-codex/plugin/test/teammode-worktree.test.mjs +2 -6
- package/packages/omo-codex/plugin/test/ultrawork-skill-pointer.test.mjs +0 -3
- package/packages/omo-codex/plugin/test/ulw-plan-review-state-contract.test.mjs +0 -3
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +57 -19
- package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +7 -2
- package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +3 -2
- package/packages/shared-skills/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/packages/shared-skills/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/packages/shared-skills/skills/frontend/SKILL.md +10 -7
- package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +1 -0
- package/packages/shared-skills/skills/frontend/references/design/stylegallery.md +80 -0
- package/packages/shared-skills/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
- package/packages/shared-skills/skills/ultimate-browsing/engine/AGENTS.md +179 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/templates/package.json +1 -1
- package/packages/shared-skills/skills/ultimate-browsing/references/chrome-stealth.md +11 -11
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +2 -2
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +27 -3
- package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +2 -1
- package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +3 -3
- package/dist/tools/call-omo-agent/background-agent-executor.d.ts +0 -5
- package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +0 -92
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +0 -314
- package/packages/omo-codex/plugin/test/ulw-plan-scope-contract.test.mjs +0 -24
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { argv, stderr } from "node:process";
|
|
5
5
|
|
|
6
6
|
// src/proxy.ts
|
|
7
|
-
import { existsSync as
|
|
8
|
-
import { basename as
|
|
7
|
+
import { existsSync as existsSync13, realpathSync as realpathSync6 } from "node:fs";
|
|
8
|
+
import { basename as basename4, delimiter as delimiter4, dirname as dirname10, isAbsolute as isAbsolute5 } from "node:path";
|
|
9
9
|
|
|
10
10
|
// ../mcp-stdio-core/src/record.ts
|
|
11
11
|
function isPlainRecord(value) {
|
|
@@ -315,8 +315,8 @@ function createIdleTimer(idleTimeoutMs, log, onTimeout) {
|
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
// ../lsp-core/src/lsp/client-wrapper.ts
|
|
318
|
-
import { existsSync as
|
|
319
|
-
import { dirname as
|
|
318
|
+
import { existsSync as existsSync10, realpathSync as realpathSync5, statSync as statSync3 } from "node:fs";
|
|
319
|
+
import { basename as basename3, dirname as dirname7, join as join5, resolve as resolve7 } from "node:path";
|
|
320
320
|
|
|
321
321
|
// ../lsp-core/src/request-context.ts
|
|
322
322
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -3500,15 +3500,52 @@ async function disposeDefaultLspManager() {
|
|
|
3500
3500
|
}
|
|
3501
3501
|
}
|
|
3502
3502
|
|
|
3503
|
+
// ../lsp-core/src/lsp/outside-context-workspace.ts
|
|
3504
|
+
import { existsSync as existsSync6, realpathSync as realpathSync4 } from "node:fs";
|
|
3505
|
+
import { dirname as dirname5, join as join3 } from "node:path";
|
|
3506
|
+
|
|
3507
|
+
// ../lsp-core/src/lsp/workspace-markers.ts
|
|
3508
|
+
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
3509
|
+
|
|
3510
|
+
// ../lsp-core/src/lsp/outside-context-workspace.ts
|
|
3511
|
+
function findWorkspaceRootOutsideContext(directory) {
|
|
3512
|
+
const marked = nearestMarkedAncestor(directory);
|
|
3513
|
+
if (marked !== undefined)
|
|
3514
|
+
return marked;
|
|
3515
|
+
return realpathSync4(nearestExistingAncestor(directory));
|
|
3516
|
+
}
|
|
3517
|
+
function nearestMarkedAncestor(directory) {
|
|
3518
|
+
let current = directory;
|
|
3519
|
+
for (;; ) {
|
|
3520
|
+
if (existsSync6(current) && WORKSPACE_MARKERS.some((marker) => existsSync6(join3(current, marker)))) {
|
|
3521
|
+
return realpathSync4(current);
|
|
3522
|
+
}
|
|
3523
|
+
const parent = dirname5(current);
|
|
3524
|
+
if (parent === current)
|
|
3525
|
+
return;
|
|
3526
|
+
current = parent;
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
function nearestExistingAncestor(directory) {
|
|
3530
|
+
let current = directory;
|
|
3531
|
+
while (!existsSync6(current)) {
|
|
3532
|
+
const parent = dirname5(current);
|
|
3533
|
+
if (parent === current)
|
|
3534
|
+
return current;
|
|
3535
|
+
current = parent;
|
|
3536
|
+
}
|
|
3537
|
+
return current;
|
|
3538
|
+
}
|
|
3539
|
+
|
|
3503
3540
|
// ../lsp-core/src/lsp/server-install-state.ts
|
|
3504
|
-
import { existsSync as
|
|
3505
|
-
import { dirname as
|
|
3541
|
+
import { existsSync as existsSync7, mkdirSync, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
3542
|
+
import { dirname as dirname6 } from "node:path";
|
|
3506
3543
|
function getInstallDecisionsPath() {
|
|
3507
3544
|
return lspRequestContext().installDecisionsPath;
|
|
3508
3545
|
}
|
|
3509
3546
|
function loadInstallDecisions() {
|
|
3510
3547
|
const path = getInstallDecisionsPath();
|
|
3511
|
-
if (!
|
|
3548
|
+
if (!existsSync7(path))
|
|
3512
3549
|
return {};
|
|
3513
3550
|
try {
|
|
3514
3551
|
const parsed = JSON.parse(readFileSync3(path, "utf8"));
|
|
@@ -3530,7 +3567,7 @@ function isInstallDecision(value) {
|
|
|
3530
3567
|
}
|
|
3531
3568
|
function writeInstallDecisions(decisions) {
|
|
3532
3569
|
const path = getInstallDecisionsPath();
|
|
3533
|
-
mkdirSync(
|
|
3570
|
+
mkdirSync(dirname6(path), { recursive: true });
|
|
3534
3571
|
const tmpPath = `${path}.tmp`;
|
|
3535
3572
|
writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
|
|
3536
3573
|
`, "utf8");
|
|
@@ -3549,7 +3586,7 @@ function isRecord5(value) {
|
|
|
3549
3586
|
}
|
|
3550
3587
|
|
|
3551
3588
|
// ../lsp-core/src/lsp/config-loader.ts
|
|
3552
|
-
import { existsSync as
|
|
3589
|
+
import { existsSync as existsSync8, readFileSync as readFileSync4 } from "node:fs";
|
|
3553
3590
|
|
|
3554
3591
|
// ../lsp-core/src/lsp/server-definitions.ts
|
|
3555
3592
|
var LSP_INSTALL_HINTS = {
|
|
@@ -3706,7 +3743,7 @@ function getUserConfigPath() {
|
|
|
3706
3743
|
return lspRequestContext().userConfigPath;
|
|
3707
3744
|
}
|
|
3708
3745
|
function loadJsonFile(path) {
|
|
3709
|
-
if (!
|
|
3746
|
+
if (!existsSync8(path))
|
|
3710
3747
|
return null;
|
|
3711
3748
|
try {
|
|
3712
3749
|
const parsed = JSON.parse(readFileSync4(path, "utf-8"));
|
|
@@ -3894,8 +3931,8 @@ function getDisabledServerIds() {
|
|
|
3894
3931
|
}
|
|
3895
3932
|
|
|
3896
3933
|
// ../lsp-core/src/lsp/server-installation.ts
|
|
3897
|
-
import { existsSync as
|
|
3898
|
-
import { delimiter as delimiter3, join as
|
|
3934
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
3935
|
+
import { delimiter as delimiter3, join as join4 } from "node:path";
|
|
3899
3936
|
function isServerInstalled(command, _workingDirectory) {
|
|
3900
3937
|
if (command.length === 0)
|
|
3901
3938
|
return false;
|
|
@@ -3903,7 +3940,7 @@ function isServerInstalled(command, _workingDirectory) {
|
|
|
3903
3940
|
if (!cmd)
|
|
3904
3941
|
return false;
|
|
3905
3942
|
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
3906
|
-
if (
|
|
3943
|
+
if (existsSync9(cmd))
|
|
3907
3944
|
return true;
|
|
3908
3945
|
}
|
|
3909
3946
|
const isWindows = process.platform === "win32";
|
|
@@ -3924,7 +3961,7 @@ function isServerInstalled(command, _workingDirectory) {
|
|
|
3924
3961
|
const paths = pathEnv.split(delimiter3);
|
|
3925
3962
|
for (const p of paths) {
|
|
3926
3963
|
for (const suffix of exts) {
|
|
3927
|
-
if (
|
|
3964
|
+
if (existsSync9(join4(p, cmd + suffix))) {
|
|
3928
3965
|
return true;
|
|
3929
3966
|
}
|
|
3930
3967
|
}
|
|
@@ -4020,7 +4057,6 @@ function getAllServers() {
|
|
|
4020
4057
|
}
|
|
4021
4058
|
|
|
4022
4059
|
// ../lsp-core/src/lsp/client-wrapper.ts
|
|
4023
|
-
var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
|
|
4024
4060
|
function isDirectoryPath(filePath) {
|
|
4025
4061
|
try {
|
|
4026
4062
|
return statSync3(filePath).isDirectory();
|
|
@@ -4029,32 +4065,85 @@ function isDirectoryPath(filePath) {
|
|
|
4029
4065
|
}
|
|
4030
4066
|
}
|
|
4031
4067
|
function findWorkspaceRoot(filePath) {
|
|
4032
|
-
const
|
|
4068
|
+
const cwd = contextCwd();
|
|
4069
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4033
4070
|
let dir = abs;
|
|
4034
4071
|
if (!isDirectoryPath(dir)) {
|
|
4035
|
-
dir =
|
|
4036
|
-
}
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4072
|
+
dir = dirname7(dir);
|
|
4073
|
+
}
|
|
4074
|
+
if (!isPathInside(cwd, abs))
|
|
4075
|
+
return findWorkspaceRootOutsideContext(dir);
|
|
4076
|
+
const fallbackRoot = nearestExistingDirectoryInsideContext(dir, cwd) ?? cwd;
|
|
4077
|
+
while (isPathInside(cwd, dir)) {
|
|
4078
|
+
const canonicalDir = existingDirectoryInsideContext(dir, cwd);
|
|
4079
|
+
if (canonicalDir !== undefined) {
|
|
4080
|
+
for (const marker of WORKSPACE_MARKERS) {
|
|
4081
|
+
if (existsSync10(join5(dir, marker))) {
|
|
4082
|
+
return canonicalDir;
|
|
4083
|
+
}
|
|
4042
4084
|
}
|
|
4043
4085
|
}
|
|
4044
|
-
|
|
4045
|
-
|
|
4086
|
+
if (dir === cwd)
|
|
4087
|
+
break;
|
|
4088
|
+
dir = dirname7(dir);
|
|
4046
4089
|
}
|
|
4047
|
-
return
|
|
4090
|
+
return fallbackRoot;
|
|
4048
4091
|
}
|
|
4049
|
-
function
|
|
4092
|
+
function resolveReadablePathInsideContext(filePath) {
|
|
4050
4093
|
const cwd = contextCwd();
|
|
4051
4094
|
const abs = resolve7(cwd, filePath);
|
|
4095
|
+
if (isPathInside(cwd, abs))
|
|
4096
|
+
return abs;
|
|
4097
|
+
const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
|
|
4098
|
+
if (rebased !== undefined)
|
|
4099
|
+
return rebased;
|
|
4100
|
+
return canonicalizeExistingOrNearestAncestor(abs);
|
|
4101
|
+
}
|
|
4102
|
+
function resolvePathInsideContext(filePath) {
|
|
4103
|
+
const cwd = contextCwd();
|
|
4104
|
+
const abs = resolveReadablePathInsideContext(filePath);
|
|
4052
4105
|
const canonical = canonicalizeExistingOrNearestAncestor(abs);
|
|
4053
4106
|
if (!isPathInside(cwd, canonical)) {
|
|
4054
4107
|
throw new LspInvalidPathError(`LSP file path must be inside request cwd: ${filePath}`);
|
|
4055
4108
|
}
|
|
4056
4109
|
return canonical;
|
|
4057
4110
|
}
|
|
4111
|
+
function rebaseThroughCanonicalAncestor(path, cwd) {
|
|
4112
|
+
let current = path;
|
|
4113
|
+
const suffix = [];
|
|
4114
|
+
while (true) {
|
|
4115
|
+
if (existsSync10(current)) {
|
|
4116
|
+
const canonical = realpathSync5(current);
|
|
4117
|
+
if (isPathInside(cwd, canonical))
|
|
4118
|
+
return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
|
|
4119
|
+
}
|
|
4120
|
+
const parent = dirname7(current);
|
|
4121
|
+
if (parent === current)
|
|
4122
|
+
return;
|
|
4123
|
+
suffix.unshift(basename3(current));
|
|
4124
|
+
current = parent;
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4127
|
+
function existingDirectoryInsideContext(directory, cwd) {
|
|
4128
|
+
if (!existsSync10(directory))
|
|
4129
|
+
return;
|
|
4130
|
+
const canonical = realpathSync5(directory);
|
|
4131
|
+
if (!statSync3(canonical).isDirectory())
|
|
4132
|
+
return;
|
|
4133
|
+
return isPathInside(cwd, canonical) ? canonical : undefined;
|
|
4134
|
+
}
|
|
4135
|
+
function nearestExistingDirectoryInsideContext(directory, cwd) {
|
|
4136
|
+
let current = directory;
|
|
4137
|
+
while (isPathInside(cwd, current)) {
|
|
4138
|
+
const canonical = existingDirectoryInsideContext(current, cwd);
|
|
4139
|
+
if (canonical !== undefined)
|
|
4140
|
+
return canonical;
|
|
4141
|
+
if (current === cwd)
|
|
4142
|
+
return;
|
|
4143
|
+
current = dirname7(current);
|
|
4144
|
+
}
|
|
4145
|
+
return;
|
|
4146
|
+
}
|
|
4058
4147
|
function formatServerLookupError(result) {
|
|
4059
4148
|
if (result.status === "not_installed") {
|
|
4060
4149
|
return formatNotInstalled(result);
|
|
@@ -4125,7 +4214,7 @@ function formatNotInstalled(result) {
|
|
|
4125
4214
|
].join(`
|
|
4126
4215
|
`);
|
|
4127
4216
|
}
|
|
4128
|
-
var
|
|
4217
|
+
var READ_ONLY_TOOLS = new Set([
|
|
4129
4218
|
"diagnostics",
|
|
4130
4219
|
"definition",
|
|
4131
4220
|
"references",
|
|
@@ -4134,7 +4223,7 @@ var READ_ONLY_RETRY_TOOLS = new Set([
|
|
|
4134
4223
|
"prepareRename"
|
|
4135
4224
|
]);
|
|
4136
4225
|
async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
4137
|
-
const absPath = resolvePathInsideContext(filePath);
|
|
4226
|
+
const absPath = READ_ONLY_TOOLS.has(toolName) ? resolveReadablePathInsideContext(filePath) : resolvePathInsideContext(filePath);
|
|
4138
4227
|
if (isDirectoryPath(absPath)) {
|
|
4139
4228
|
throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
|
|
4140
4229
|
}
|
|
@@ -4149,9 +4238,9 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4149
4238
|
const acquireAndCall = async (allowRetry) => {
|
|
4150
4239
|
const client = await manager.getClient(root, server2, options.signal);
|
|
4151
4240
|
try {
|
|
4152
|
-
return await fn(client, root);
|
|
4241
|
+
return await fn(client, root, absPath);
|
|
4153
4242
|
} catch (err) {
|
|
4154
|
-
if (allowRetry &&
|
|
4243
|
+
if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
|
|
4155
4244
|
manager.invalidateClient(root, server2.id, client);
|
|
4156
4245
|
return acquireAndCall(false);
|
|
4157
4246
|
}
|
|
@@ -4169,8 +4258,8 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
|
|
|
4169
4258
|
}
|
|
4170
4259
|
|
|
4171
4260
|
// ../lsp-core/src/lsp/directory-diagnostics.ts
|
|
4172
|
-
import { existsSync as
|
|
4173
|
-
import { join as
|
|
4261
|
+
import { existsSync as existsSync11, lstatSync as lstatSync4, readdirSync as readdirSync3 } from "node:fs";
|
|
4262
|
+
import { join as join6, resolve as resolve8 } from "node:path";
|
|
4174
4263
|
|
|
4175
4264
|
// ../lsp-core/src/lsp/formatters.ts
|
|
4176
4265
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -4300,7 +4389,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
|
|
|
4300
4389
|
for (const entry of entries) {
|
|
4301
4390
|
if (files.length >= maxFiles)
|
|
4302
4391
|
return;
|
|
4303
|
-
const fullPath =
|
|
4392
|
+
const fullPath = join6(currentDir, entry);
|
|
4304
4393
|
let stat;
|
|
4305
4394
|
try {
|
|
4306
4395
|
stat = lstatSync4(fullPath);
|
|
@@ -4326,7 +4415,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
4326
4415
|
throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
|
|
4327
4416
|
}
|
|
4328
4417
|
const absDir = resolve8(options.workspaceRoot ?? contextCwd(), directory);
|
|
4329
|
-
if (!
|
|
4418
|
+
if (!existsSync11(absDir)) {
|
|
4330
4419
|
throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
|
|
4331
4420
|
}
|
|
4332
4421
|
const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
|
|
@@ -4413,7 +4502,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
|
|
|
4413
4502
|
|
|
4414
4503
|
// ../lsp-core/src/lsp/infer-extension.ts
|
|
4415
4504
|
import { lstatSync as lstatSync5, readdirSync as readdirSync4 } from "node:fs";
|
|
4416
|
-
import { join as
|
|
4505
|
+
import { join as join7 } from "node:path";
|
|
4417
4506
|
var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
|
|
4418
4507
|
var MAX_SCAN_ENTRIES = 500;
|
|
4419
4508
|
function inferExtensionFromDirectory(directory) {
|
|
@@ -4431,7 +4520,7 @@ function inferExtensionFromDirectory(directory) {
|
|
|
4431
4520
|
for (const entry of entries) {
|
|
4432
4521
|
if (scanned >= MAX_SCAN_ENTRIES)
|
|
4433
4522
|
return;
|
|
4434
|
-
const fullPath =
|
|
4523
|
+
const fullPath = join7(dir, entry);
|
|
4435
4524
|
let stat;
|
|
4436
4525
|
try {
|
|
4437
4526
|
stat = lstatSync5(fullPath);
|
|
@@ -4606,7 +4695,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
4606
4695
|
const filePath = requireString(params, "filePath");
|
|
4607
4696
|
const severity = severityFilter(params);
|
|
4608
4697
|
try {
|
|
4609
|
-
const absPath =
|
|
4698
|
+
const absPath = resolveReadablePathInsideContext(filePath);
|
|
4610
4699
|
if (isDirectoryPath(absPath)) {
|
|
4611
4700
|
const extension = inferExtensionFromDirectory(absPath);
|
|
4612
4701
|
if (!extension) {
|
|
@@ -4635,7 +4724,7 @@ async function executeLspDiagnostics(params, signal) {
|
|
|
4635
4724
|
};
|
|
4636
4725
|
return text(output2.output, details2);
|
|
4637
4726
|
}
|
|
4638
|
-
const result = await withLspClient(filePath, async (client) => client.diagnostics(
|
|
4727
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
|
|
4639
4728
|
if (result.transientError) {
|
|
4640
4729
|
const message = result.transientError.message;
|
|
4641
4730
|
const details2 = {
|
|
@@ -4710,7 +4799,7 @@ async function executeLspGotoDefinition(params, signal) {
|
|
|
4710
4799
|
const line = requireNumber(params, "line");
|
|
4711
4800
|
const character = requireNumber(params, "character");
|
|
4712
4801
|
try {
|
|
4713
|
-
const result = await withLspClient(filePath, async (client) => client.definition(
|
|
4802
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.definition(resolvedFilePath, line, character, signal), "definition", clientOptions(signal));
|
|
4714
4803
|
const locations = !result ? [] : Array.isArray(result) ? result : [result];
|
|
4715
4804
|
const details = { filePath, line, character, locations };
|
|
4716
4805
|
if (locations.length === 0)
|
|
@@ -4735,7 +4824,7 @@ async function executeLspFindReferences(params, signal) {
|
|
|
4735
4824
|
const character = requireNumber(params, "character");
|
|
4736
4825
|
const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
|
|
4737
4826
|
try {
|
|
4738
|
-
const result = await withLspClient(filePath, async (client) => client.references(
|
|
4827
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.references(resolvedFilePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
|
|
4739
4828
|
const references = Array.isArray(result) ? result : [];
|
|
4740
4829
|
const total = references.length;
|
|
4741
4830
|
const truncated = total > DEFAULT_MAX_REFERENCES;
|
|
@@ -4777,7 +4866,7 @@ async function executeLspPrepareRename(params, signal) {
|
|
|
4777
4866
|
const line = requireNumber(params, "line");
|
|
4778
4867
|
const character = requireNumber(params, "character");
|
|
4779
4868
|
try {
|
|
4780
|
-
const result = await withLspClient(filePath, async (client) => client.prepareRename(
|
|
4869
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.prepareRename(resolvedFilePath, line, character, signal), "prepareRename", clientOptions(signal));
|
|
4781
4870
|
const details = { filePath, line, character, result };
|
|
4782
4871
|
return text(formatPrepareRenameResult(result), details);
|
|
4783
4872
|
} catch (error) {
|
|
@@ -4798,7 +4887,7 @@ async function executeLspRename(params, signal) {
|
|
|
4798
4887
|
const character = requireNumber(params, "character");
|
|
4799
4888
|
const newName = requireString(params, "newName");
|
|
4800
4889
|
try {
|
|
4801
|
-
const result = await withLspClient(filePath, async (client) => client.rename(
|
|
4890
|
+
const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.rename(resolvedFilePath, line, character, newName, signal), "rename", clientOptions(signal));
|
|
4802
4891
|
const details = { filePath, line, character, newName, apply: result.apply, edit: result.edit };
|
|
4803
4892
|
return text(formatApplyResult(result.apply), details, !result.apply.success);
|
|
4804
4893
|
} catch (error) {
|
|
@@ -4878,7 +4967,7 @@ async function executeLspSymbols(params, signal) {
|
|
|
4878
4967
|
const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
|
|
4879
4968
|
return formatSymbolsResult(filePath, scope, symbols2, limit, query);
|
|
4880
4969
|
}
|
|
4881
|
-
const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(
|
|
4970
|
+
const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
|
|
4882
4971
|
return formatSymbolsResult(filePath, scope, symbols, limit);
|
|
4883
4972
|
} catch (error) {
|
|
4884
4973
|
const query = optionalString(params, "query");
|
|
@@ -5113,7 +5202,7 @@ function requestedProtocolVersion(params) {
|
|
|
5113
5202
|
// src/daemon-client.ts
|
|
5114
5203
|
import { connect } from "node:net";
|
|
5115
5204
|
import { homedir as homedir3 } from "node:os";
|
|
5116
|
-
import { join as
|
|
5205
|
+
import { join as join8 } from "node:path";
|
|
5117
5206
|
|
|
5118
5207
|
// src/daemon-request-error.ts
|
|
5119
5208
|
class DaemonRequestError extends Error {
|
|
@@ -5192,9 +5281,9 @@ function errorText(error) {
|
|
|
5192
5281
|
|
|
5193
5282
|
// src/ensure-daemon.ts
|
|
5194
5283
|
import { spawn as spawn2 } from "node:child_process";
|
|
5195
|
-
import { closeSync as closeSync2, existsSync as
|
|
5284
|
+
import { closeSync as closeSync2, existsSync as existsSync12, mkdirSync as mkdirSync3, openSync as openSync2, writeSync as writeSync2 } from "node:fs";
|
|
5196
5285
|
import { Socket } from "node:net";
|
|
5197
|
-
import { dirname as
|
|
5286
|
+
import { dirname as dirname9, isAbsolute as isAbsolute4 } from "node:path";
|
|
5198
5287
|
import { argv0, execPath } from "node:process";
|
|
5199
5288
|
|
|
5200
5289
|
// src/ipc-protocol.ts
|
|
@@ -5212,7 +5301,7 @@ import {
|
|
|
5212
5301
|
unlinkSync,
|
|
5213
5302
|
writeSync
|
|
5214
5303
|
} from "node:fs";
|
|
5215
|
-
import { dirname as
|
|
5304
|
+
import { dirname as dirname8 } from "node:path";
|
|
5216
5305
|
var OMO_DAEMON_PROTOCOL_VERSION = 1;
|
|
5217
5306
|
var AUTH_ERROR_CODE = -32001;
|
|
5218
5307
|
var PROTOCOL_ERROR_CODE = -32002;
|
|
@@ -5322,7 +5411,7 @@ function setPrivateFileMode(path) {
|
|
|
5322
5411
|
chmodSync(path, 384);
|
|
5323
5412
|
}
|
|
5324
5413
|
function createAuthToken(paths) {
|
|
5325
|
-
ensurePrivateDirectory(
|
|
5414
|
+
ensurePrivateDirectory(dirname8(paths.auth));
|
|
5326
5415
|
const token = randomBytes(AUTH_TOKEN_BYTES).toString("base64url");
|
|
5327
5416
|
let fd;
|
|
5328
5417
|
try {
|
|
@@ -5662,7 +5751,7 @@ function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
|
|
|
5662
5751
|
});
|
|
5663
5752
|
}
|
|
5664
5753
|
function spawnDaemonProcess(paths) {
|
|
5665
|
-
mkdirSync3(
|
|
5754
|
+
mkdirSync3(dirname9(paths.log), { recursive: true });
|
|
5666
5755
|
const logFd = openSync2(paths.log, "a");
|
|
5667
5756
|
try {
|
|
5668
5757
|
const child = spawn2(resolveDaemonNodeExecutable(), [paths.cliPath, "daemon"], {
|
|
@@ -5681,7 +5770,7 @@ function spawnDaemonProcess(paths) {
|
|
|
5681
5770
|
throw error;
|
|
5682
5771
|
}
|
|
5683
5772
|
}
|
|
5684
|
-
function resolveDaemonNodeExecutable(cachedExecPath = execPath, originalArgv0 = argv0, pathExists =
|
|
5773
|
+
function resolveDaemonNodeExecutable(cachedExecPath = execPath, originalArgv0 = argv0, pathExists = existsSync12) {
|
|
5685
5774
|
if (pathExists(cachedExecPath))
|
|
5686
5775
|
return cachedExecPath;
|
|
5687
5776
|
if (isAbsolute4(originalArgv0) && pathExists(originalArgv0))
|
|
@@ -5901,9 +5990,9 @@ function currentRequestContext(env = process.env) {
|
|
|
5901
5990
|
const home = env["HOME"] ?? homedir3();
|
|
5902
5991
|
return parseLspRequestContext({
|
|
5903
5992
|
cwd,
|
|
5904
|
-
projectConfigPaths: [
|
|
5905
|
-
userConfigPath:
|
|
5906
|
-
installDecisionsPath:
|
|
5993
|
+
projectConfigPaths: [join8(cwd, ".codex", "lsp-client.json")],
|
|
5994
|
+
userConfigPath: join8(home, ".codex", "lsp-client.json"),
|
|
5995
|
+
installDecisionsPath: join8(home, ".codex", "lsp-install-decisions.json"),
|
|
5907
5996
|
capabilities: { installDecisionTool: true }
|
|
5908
5997
|
});
|
|
5909
5998
|
}
|
|
@@ -6158,18 +6247,18 @@ function canonicalizePathList(value) {
|
|
|
6158
6247
|
return value.split(delimiter4).map((entry) => canonicalizePath(entry) ?? entry).join(delimiter4);
|
|
6159
6248
|
}
|
|
6160
6249
|
function canonicalizePath(value) {
|
|
6161
|
-
if (value === undefined || !isAbsolute5(value) || !
|
|
6250
|
+
if (value === undefined || !isAbsolute5(value) || !existsSync13(value))
|
|
6162
6251
|
return value;
|
|
6163
|
-
return
|
|
6252
|
+
return realpathSync6(value);
|
|
6164
6253
|
}
|
|
6165
6254
|
function projectRootFromOpenCodeConfigPath(path2) {
|
|
6166
|
-
if (
|
|
6255
|
+
if (basename4(path2) !== "lsp.json" && basename4(path2) !== "lsp-client.json")
|
|
6167
6256
|
return;
|
|
6168
|
-
const configDir =
|
|
6169
|
-
const configDirName =
|
|
6257
|
+
const configDir = dirname10(path2);
|
|
6258
|
+
const configDirName = basename4(configDir);
|
|
6170
6259
|
if (configDirName !== ".opencode" && configDirName !== ".omo")
|
|
6171
6260
|
return;
|
|
6172
|
-
return
|
|
6261
|
+
return dirname10(configDir);
|
|
6173
6262
|
}
|
|
6174
6263
|
|
|
6175
6264
|
// src/daemon-server.ts
|
|
@@ -6178,12 +6267,12 @@ import { createServer as createServer2 } from "node:net";
|
|
|
6178
6267
|
|
|
6179
6268
|
// src/ownership.ts
|
|
6180
6269
|
import { randomUUID } from "node:crypto";
|
|
6181
|
-
import { existsSync as
|
|
6182
|
-
import { dirname as
|
|
6270
|
+
import { existsSync as existsSync14, lstatSync as lstatSync7, readFileSync as readFileSync7, statSync as statSync5, unlinkSync as unlinkSync3 } from "node:fs";
|
|
6271
|
+
import { dirname as dirname12 } from "node:path";
|
|
6183
6272
|
|
|
6184
6273
|
// src/lock.ts
|
|
6185
6274
|
import { closeSync as closeSync3, mkdirSync as mkdirSync4, openSync as openSync3, readFileSync as readFileSync6, unlinkSync as unlinkSync2, writeSync as writeSync3 } from "node:fs";
|
|
6186
|
-
import { dirname as
|
|
6275
|
+
import { dirname as dirname11 } from "node:path";
|
|
6187
6276
|
function isProcessAlive2(pid) {
|
|
6188
6277
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
6189
6278
|
return false;
|
|
@@ -6205,7 +6294,7 @@ function readLockPid(lockPath) {
|
|
|
6205
6294
|
}
|
|
6206
6295
|
}
|
|
6207
6296
|
function tryAcquireLock(lockPath, ownerPid = process.pid) {
|
|
6208
|
-
mkdirSync4(
|
|
6297
|
+
mkdirSync4(dirname11(lockPath), { recursive: true });
|
|
6209
6298
|
for (let attempt = 0;attempt < 2; attempt += 1) {
|
|
6210
6299
|
const handle = writeLockFile(lockPath, ownerPid);
|
|
6211
6300
|
if (handle)
|
|
@@ -6286,7 +6375,7 @@ async function acquireStartupLease(paths, pingOwner) {
|
|
|
6286
6375
|
function ensureDaemonDirectories(paths) {
|
|
6287
6376
|
ensurePrivateDirectory(paths.dir);
|
|
6288
6377
|
if (process.platform !== "win32")
|
|
6289
|
-
ensurePrivateDirectory(
|
|
6378
|
+
ensurePrivateDirectory(dirname12(paths.socket));
|
|
6290
6379
|
}
|
|
6291
6380
|
function readDaemonOwner(paths) {
|
|
6292
6381
|
try {
|
|
@@ -6366,7 +6455,7 @@ async function validateExistingOwner(paths, pingOwner) {
|
|
|
6366
6455
|
throw new DaemonStartupDeferredError("reachable_owner_mismatch");
|
|
6367
6456
|
}
|
|
6368
6457
|
function cleanupDeadOwner(paths, owner) {
|
|
6369
|
-
if (process.platform !== "win32" &&
|
|
6458
|
+
if (process.platform !== "win32" && existsSync14(owner.endpoint.path)) {
|
|
6370
6459
|
const stat = lstatSync7(owner.endpoint.path);
|
|
6371
6460
|
if (stat.isSocket())
|
|
6372
6461
|
unlinkSync3(owner.endpoint.path);
|
|
@@ -6417,7 +6506,7 @@ function parseEndpoint(value) {
|
|
|
6417
6506
|
// src/version-reap.ts
|
|
6418
6507
|
import { execFile } from "node:child_process";
|
|
6419
6508
|
import { readdir, readFile, rm } from "node:fs/promises";
|
|
6420
|
-
import { basename as
|
|
6509
|
+
import { basename as basename5, dirname as dirname13, join as join9 } from "node:path";
|
|
6421
6510
|
var TERM_GRACE_MS = 5000;
|
|
6422
6511
|
var KILL_GRACE_MS = 1000;
|
|
6423
6512
|
var VERSION_ENTRY_PATTERN = /^v([A-Za-z0-9][A-Za-z0-9._+-]{0,127})$/;
|
|
@@ -6438,7 +6527,7 @@ async function attestDaemonCliProcess(pid, platform, deps = {}) {
|
|
|
6438
6527
|
return isNodeCliDaemonCommand(command.trim());
|
|
6439
6528
|
}
|
|
6440
6529
|
async function reapStaleDaemonVersions(ownPaths, deps = {}) {
|
|
6441
|
-
const baseDir =
|
|
6530
|
+
const baseDir = dirname13(ownPaths.dir);
|
|
6442
6531
|
const platform = deps.platform ?? process.platform;
|
|
6443
6532
|
const isAlive = deps.isAlive ?? isProcessAlive2;
|
|
6444
6533
|
const attest = deps.attest ?? ((pid) => attestDaemonCliProcess(pid, platform));
|
|
@@ -6457,7 +6546,7 @@ async function reapStaleDaemonVersions(ownPaths, deps = {}) {
|
|
|
6457
6546
|
const version = parseVersionEntry(entry.name);
|
|
6458
6547
|
if (version === null || !entry.isDirectory())
|
|
6459
6548
|
continue;
|
|
6460
|
-
const versionDir =
|
|
6549
|
+
const versionDir = join9(baseDir, entry.name);
|
|
6461
6550
|
const siblingPaths = daemonPaths({ [OMO_LSP_DAEMON_DIR]: baseDir }, { cliPath: ownPaths.cliPath, version });
|
|
6462
6551
|
results.push(await reapOneVersion({
|
|
6463
6552
|
version,
|
|
@@ -6481,7 +6570,7 @@ async function reapOneVersion(context) {
|
|
|
6481
6570
|
const { version, versionDir } = context;
|
|
6482
6571
|
const owner = context.readOwner(context.siblingPaths);
|
|
6483
6572
|
if (!owner) {
|
|
6484
|
-
const lockPid = readLockPid(
|
|
6573
|
+
const lockPid = readLockPid(join9(versionDir, "daemon.lock"));
|
|
6485
6574
|
if (lockPid !== null && context.isAlive(lockPid)) {
|
|
6486
6575
|
context.log(`reap: sparing v${version}: owner metadata missing but daemon.lock is held by live pid ${lockPid}`);
|
|
6487
6576
|
return { version, status: "spared", reason: `owner metadata missing but lock held by live pid ${lockPid}` };
|
|
@@ -6547,7 +6636,7 @@ function splitCmdline(buffer) {
|
|
|
6547
6636
|
function isNodeCliDaemonArgv(argv) {
|
|
6548
6637
|
if (argv.length < 2 || !argv.includes("daemon"))
|
|
6549
6638
|
return false;
|
|
6550
|
-
const executable =
|
|
6639
|
+
const executable = basename5(argv[0] ?? "");
|
|
6551
6640
|
if (!/^node(?:\.exe)?$/i.test(executable))
|
|
6552
6641
|
return false;
|
|
6553
6642
|
return argv.some((value) => value === "cli.js" || value.endsWith("/cli.js") || value.endsWith("\\cli.js"));
|