oh-my-opencode 5.0.0-beta.3 → 5.0.0-beta.5
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 +431 -353
- package/dist/cli-node/index.js +431 -353
- package/dist/index.js +16 -14
- package/dist/skills/ultimate-browsing/engine/AGENTS.md +69 -0
- package/dist/tui.js +2 -0
- package/package.json +14 -14
- 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 +2 -0
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +2 -0
- 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/lsp/dist/.omo-runtime-manifest.json +2 -2
- 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/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/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- 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/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- 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/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 +13 -13
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/AGENTS.md +69 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +2 -2
- package/packages/shared-skills/skills/ultimate-browsing/engine/AGENTS.md +69 -0
package/dist/cli-node/index.js
CHANGED
|
@@ -2146,7 +2146,7 @@ var package_default;
|
|
|
2146
2146
|
var init_package = __esm(() => {
|
|
2147
2147
|
package_default = {
|
|
2148
2148
|
name: "oh-my-opencode",
|
|
2149
|
-
version: "5.0.0-beta.
|
|
2149
|
+
version: "5.0.0-beta.5",
|
|
2150
2150
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2151
2151
|
main: "./dist/index.js",
|
|
2152
2152
|
types: "dist/index.d.ts",
|
|
@@ -2326,7 +2326,7 @@ var init_package = __esm(() => {
|
|
|
2326
2326
|
zod: "^4.4.3"
|
|
2327
2327
|
},
|
|
2328
2328
|
devDependencies: {
|
|
2329
|
-
"@code-yeongyu/senpi": "2026.8.
|
|
2329
|
+
"@code-yeongyu/senpi": "2026.8.11-2",
|
|
2330
2330
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
2331
2331
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
2332
2332
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -2366,18 +2366,18 @@ var init_package = __esm(() => {
|
|
|
2366
2366
|
typescript: "^7.0.2"
|
|
2367
2367
|
},
|
|
2368
2368
|
optionalDependencies: {
|
|
2369
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
2370
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
2371
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
2372
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
2373
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
2374
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
2375
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
2376
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
2377
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
2378
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
2379
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
2380
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
2369
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.5",
|
|
2370
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.5",
|
|
2371
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.5",
|
|
2372
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.5",
|
|
2373
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.5",
|
|
2374
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.5",
|
|
2375
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.5",
|
|
2376
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.5",
|
|
2377
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.5",
|
|
2378
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.5",
|
|
2379
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.5",
|
|
2380
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.5"
|
|
2381
2381
|
},
|
|
2382
2382
|
overrides: {
|
|
2383
2383
|
"@earendil-works/pi-agent-core": "0.80.3",
|
|
@@ -22455,6 +22455,7 @@ var init_memory = __esm(() => {
|
|
|
22455
22455
|
OmoMemorySettingsSchema = object({
|
|
22456
22456
|
enabled: boolean2().default(true),
|
|
22457
22457
|
agent: string2().min(1).default("auto"),
|
|
22458
|
+
tool_exposure: _enum2(["direct", "search"]).default("direct"),
|
|
22458
22459
|
reflection: OmoMemoryReflectionSchema.default({
|
|
22459
22460
|
trigger: { step_count: 0, on_compaction: true },
|
|
22460
22461
|
merge: "auto",
|
|
@@ -22470,6 +22471,7 @@ var init_memory = __esm(() => {
|
|
|
22470
22471
|
OmoMemorySettingsLayerSchema = object({
|
|
22471
22472
|
enabled: boolean2().optional(),
|
|
22472
22473
|
agent: string2().min(1).optional(),
|
|
22474
|
+
tool_exposure: _enum2(["direct", "search"]).optional(),
|
|
22473
22475
|
reflection: OmoMemoryReflectionLayerSchema.optional(),
|
|
22474
22476
|
sync: OmoMemorySyncLayerSchema.optional(),
|
|
22475
22477
|
search: OmoMemorySearchLayerSchema.optional(),
|
|
@@ -94495,7 +94497,7 @@ var package_default2;
|
|
|
94495
94497
|
var init_package2 = __esm(() => {
|
|
94496
94498
|
package_default2 = {
|
|
94497
94499
|
name: "@oh-my-opencode/omo-codex",
|
|
94498
|
-
version: "5.0.0-beta.
|
|
94500
|
+
version: "5.0.0-beta.5",
|
|
94499
94501
|
type: "module",
|
|
94500
94502
|
private: true,
|
|
94501
94503
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -95464,20 +95466,20 @@ var init_update_toasts = __esm(() => {
|
|
|
95464
95466
|
});
|
|
95465
95467
|
|
|
95466
95468
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
95467
|
-
import { existsSync as
|
|
95468
|
-
import { dirname as
|
|
95469
|
+
import { existsSync as existsSync47 } from "node:fs";
|
|
95470
|
+
import { dirname as dirname29, join as join74 } from "node:path";
|
|
95469
95471
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
95470
95472
|
function defaultGetModuleHostingWorkspace() {
|
|
95471
95473
|
try {
|
|
95472
|
-
const currentDir =
|
|
95474
|
+
const currentDir = dirname29(fileURLToPath5(import.meta.url));
|
|
95473
95475
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
95474
95476
|
if (!pkgJsonPath)
|
|
95475
95477
|
return null;
|
|
95476
|
-
const pkgDir =
|
|
95477
|
-
const nodeModulesDir =
|
|
95478
|
+
const pkgDir = dirname29(pkgJsonPath);
|
|
95479
|
+
const nodeModulesDir = dirname29(pkgDir);
|
|
95478
95480
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
95479
95481
|
return null;
|
|
95480
|
-
return
|
|
95482
|
+
return dirname29(nodeModulesDir);
|
|
95481
95483
|
} catch (error51) {
|
|
95482
95484
|
if (error51 instanceof Error) {
|
|
95483
95485
|
return null;
|
|
@@ -95618,8 +95620,8 @@ var init_background_update_check = __esm(() => {
|
|
|
95618
95620
|
init_package_json_locator();
|
|
95619
95621
|
init_update_toasts();
|
|
95620
95622
|
defaultDeps4 = {
|
|
95621
|
-
existsSync:
|
|
95622
|
-
join:
|
|
95623
|
+
existsSync: existsSync47,
|
|
95624
|
+
join: join74,
|
|
95623
95625
|
runBunInstallWithDetails,
|
|
95624
95626
|
log: log2,
|
|
95625
95627
|
getOpenCodeCacheDir,
|
|
@@ -95782,7 +95784,7 @@ async function showSpinnerToast(ctx, version3, message) {
|
|
|
95782
95784
|
duration: frameInterval + 50
|
|
95783
95785
|
}
|
|
95784
95786
|
}).catch(ignoreToastError);
|
|
95785
|
-
await new Promise((
|
|
95787
|
+
await new Promise((resolve21) => setTimeout(resolve21, frameInterval));
|
|
95786
95788
|
}
|
|
95787
95789
|
}
|
|
95788
95790
|
var SISYPHUS_SPINNER;
|
|
@@ -101395,21 +101397,93 @@ var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", ".
|
|
|
101395
101397
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
101396
101398
|
import { execFile as execFile4 } from "node:child_process";
|
|
101397
101399
|
import { createHash as createHash5 } from "node:crypto";
|
|
101398
|
-
import { constants as constants8, existsSync as
|
|
101400
|
+
import { constants as constants8, existsSync as existsSync31 } from "node:fs";
|
|
101399
101401
|
import { access as access2, readFile as readFile26, stat as stat6 } from "node:fs/promises";
|
|
101400
|
-
import { homedir as
|
|
101401
|
-
import { dirname as
|
|
101402
|
+
import { homedir as homedir10 } from "node:os";
|
|
101403
|
+
import { dirname as dirname23, join as join61, resolve as resolve19 } from "node:path";
|
|
101402
101404
|
import { fileURLToPath } from "node:url";
|
|
101403
101405
|
import { promisify as promisify2 } from "node:util";
|
|
101404
101406
|
|
|
101407
|
+
// packages/omo-senpi/src/install/local-launcher.ts
|
|
101408
|
+
import { chmodSync as chmodSync3, existsSync as existsSync30, mkdirSync as mkdirSync10, readFileSync as readFileSync14, rmSync, writeFileSync as writeFileSync6 } from "node:fs";
|
|
101409
|
+
import { homedir as homedir9 } from "node:os";
|
|
101410
|
+
import { dirname as dirname21, join as join59, resolve as resolve17 } from "node:path";
|
|
101411
|
+
var MARKER = "omo-local-launcher";
|
|
101412
|
+
function localLauncherPath(homeDir = homedir9()) {
|
|
101413
|
+
return join59(homeDir, ".local", "bin", "omo");
|
|
101414
|
+
}
|
|
101415
|
+
function localLauncherCmdPath(homeDir = homedir9()) {
|
|
101416
|
+
return join59(homeDir, ".local", "bin", "omo.cmd");
|
|
101417
|
+
}
|
|
101418
|
+
function renderLocalLauncher(options) {
|
|
101419
|
+
const brand = {
|
|
101420
|
+
name: "omo",
|
|
101421
|
+
displayVersion: options.version ?? "local",
|
|
101422
|
+
configDir: ".omo",
|
|
101423
|
+
flatLayout: true,
|
|
101424
|
+
envPrefix: "OMO",
|
|
101425
|
+
userAgent: "omo",
|
|
101426
|
+
originator: "omo",
|
|
101427
|
+
update: {
|
|
101428
|
+
packageName: "omo-ai",
|
|
101429
|
+
distTag: "beta",
|
|
101430
|
+
command: "npm i -g omo-ai@beta",
|
|
101431
|
+
changelogUrl: "https://github.com/code-yeongyu/oh-my-openagent/releases"
|
|
101432
|
+
}
|
|
101433
|
+
};
|
|
101434
|
+
return `#!/usr/bin/env node
|
|
101435
|
+
// ${MARKER}: generated by the omo-senpi installer. Delete this file to remove the local launcher.
|
|
101436
|
+
import { spawn } from "node:child_process"
|
|
101437
|
+
|
|
101438
|
+
const brand = ${JSON.stringify(brand)}
|
|
101439
|
+
const cli = process.env.OMO_SENPI_CLI_PATH ?? ${JSON.stringify(options.senpiCliPath)}
|
|
101440
|
+
const plugin = process.env.OMO_PLUGIN_ROOT ?? ${JSON.stringify(options.pluginPath)}
|
|
101441
|
+
const env = { ...process.env, SENPI_BRAND: JSON.stringify(brand), OMO_NATIVE: "1" }
|
|
101442
|
+
// Anything resolving the product by name must re-enter through this launcher, never the engine.
|
|
101443
|
+
env.OMO_BIN = process.argv[1]
|
|
101444
|
+
const selfUpdate = process.argv[2] === "update"
|
|
101445
|
+
&& process.argv.slice(3).every((arg) => arg.startsWith("-") || ["self", "senpi", "omo"].includes(arg))
|
|
101446
|
+
&& !process.argv.slice(3).some((arg) => arg === "--extensions" || arg === "--models")
|
|
101447
|
+
if (selfUpdate) {
|
|
101448
|
+
console.log("omo is updated via npm: npm i -g omo-ai@beta")
|
|
101449
|
+
process.exit(0)
|
|
101450
|
+
}
|
|
101451
|
+
const child = spawn(process.execPath, [cli, "--extension", plugin, ...process.argv.slice(2)], {
|
|
101452
|
+
env,
|
|
101453
|
+
stdio: "inherit",
|
|
101454
|
+
})
|
|
101455
|
+
child.on("close", (code, signal) => {
|
|
101456
|
+
if (signal) {
|
|
101457
|
+
process.kill(process.pid, signal)
|
|
101458
|
+
return
|
|
101459
|
+
}
|
|
101460
|
+
process.exitCode = code ?? 1
|
|
101461
|
+
})
|
|
101462
|
+
`;
|
|
101463
|
+
}
|
|
101464
|
+
function installLocalLauncher(options) {
|
|
101465
|
+
const path6 = localLauncherPath(options.homeDir);
|
|
101466
|
+
if (existsSync30(path6) && !readFileSync14(path6, "utf8").includes(MARKER))
|
|
101467
|
+
return;
|
|
101468
|
+
mkdirSync10(dirname21(path6), { recursive: true });
|
|
101469
|
+
writeFileSync6(path6, renderLocalLauncher(options));
|
|
101470
|
+
chmodSync3(path6, 493);
|
|
101471
|
+
if ((options.platform ?? process.platform) === "win32") {
|
|
101472
|
+
writeFileSync6(localLauncherCmdPath(options.homeDir), `@echo off\r
|
|
101473
|
+
node "%~dp0omo" %*\r
|
|
101474
|
+
`);
|
|
101475
|
+
}
|
|
101476
|
+
return path6;
|
|
101477
|
+
}
|
|
101478
|
+
|
|
101405
101479
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
101406
101480
|
import { constants as constants7 } from "node:fs";
|
|
101407
101481
|
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile25, rename as rename5, writeFile as writeFile14 } from "node:fs/promises";
|
|
101408
|
-
import { dirname as
|
|
101482
|
+
import { dirname as dirname22, join as join60, resolve as resolve18 } from "node:path";
|
|
101409
101483
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
101410
101484
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
101411
|
-
|
|
101412
|
-
|
|
101485
|
+
join60("packages", "pi-goal"),
|
|
101486
|
+
join60("packages", "pi-webfetch")
|
|
101413
101487
|
];
|
|
101414
101488
|
async function readSettings(settingsPath) {
|
|
101415
101489
|
let raw;
|
|
@@ -101438,13 +101512,13 @@ function dedupePackages(packages) {
|
|
|
101438
101512
|
return [...new Set(packages)];
|
|
101439
101513
|
}
|
|
101440
101514
|
function removeLegacyBuiltinShadows(packages, repoRoot, agentDir) {
|
|
101441
|
-
const shadowPaths = new Set(LEGACY_BUILTIN_SHADOW_PACKAGES.map((path6) =>
|
|
101442
|
-
return packages.filter((entry) => !shadowPaths.has(
|
|
101515
|
+
const shadowPaths = new Set(LEGACY_BUILTIN_SHADOW_PACKAGES.map((path6) => resolve18(repoRoot, path6)));
|
|
101516
|
+
return packages.filter((entry) => !shadowPaths.has(resolve18(agentDir, entry)));
|
|
101443
101517
|
}
|
|
101444
101518
|
async function removeSupersededOmoPackages(packages, currentPluginPath, agentDir) {
|
|
101445
|
-
const currentPath =
|
|
101519
|
+
const currentPath = resolve18(currentPluginPath);
|
|
101446
101520
|
const entries = await Promise.all(packages.map(async (entry) => {
|
|
101447
|
-
const packagePath =
|
|
101521
|
+
const packagePath = resolve18(agentDir, entry);
|
|
101448
101522
|
if (packagePath === currentPath)
|
|
101449
101523
|
return currentPath;
|
|
101450
101524
|
return await readPackageName(packagePath) === OMO_SENPI_PACKAGE_NAME ? undefined : entry;
|
|
@@ -101452,7 +101526,7 @@ async function removeSupersededOmoPackages(packages, currentPluginPath, agentDir
|
|
|
101452
101526
|
return entries.filter((entry) => entry !== undefined);
|
|
101453
101527
|
}
|
|
101454
101528
|
async function writeSettingsAtomically(settingsPath, settings) {
|
|
101455
|
-
await mkdir9(
|
|
101529
|
+
await mkdir9(dirname22(settingsPath), { recursive: true });
|
|
101456
101530
|
const backupPath = await nextBackupPath(settingsPath);
|
|
101457
101531
|
if (await fileExists(settingsPath)) {
|
|
101458
101532
|
await copyFile3(settingsPath, backupPath);
|
|
@@ -101484,7 +101558,7 @@ function isRecord10(value) {
|
|
|
101484
101558
|
async function readPackageName(packagePath) {
|
|
101485
101559
|
let raw;
|
|
101486
101560
|
try {
|
|
101487
|
-
raw = await readFile25(
|
|
101561
|
+
raw = await readFile25(join60(packagePath, "package.json"), "utf8");
|
|
101488
101562
|
} catch (error51) {
|
|
101489
101563
|
if (isErrno(error51, "ENOENT") || isErrno(error51, "ENOTDIR"))
|
|
101490
101564
|
return;
|
|
@@ -101510,39 +101584,39 @@ function isErrno(error51, code) {
|
|
|
101510
101584
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
101511
101585
|
var execFileAsync2 = promisify2(execFile4);
|
|
101512
101586
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
101513
|
-
|
|
101514
|
-
|
|
101515
|
-
|
|
101516
|
-
|
|
101517
|
-
|
|
101518
|
-
|
|
101519
|
-
|
|
101520
|
-
|
|
101521
|
-
|
|
101522
|
-
|
|
101523
|
-
|
|
101524
|
-
|
|
101525
|
-
|
|
101526
|
-
|
|
101527
|
-
|
|
101528
|
-
|
|
101529
|
-
|
|
101530
|
-
|
|
101531
|
-
|
|
101532
|
-
|
|
101533
|
-
|
|
101534
|
-
|
|
101535
|
-
|
|
101536
|
-
|
|
101537
|
-
|
|
101538
|
-
|
|
101539
|
-
|
|
101540
|
-
|
|
101541
|
-
|
|
101542
|
-
|
|
101543
|
-
|
|
101544
|
-
|
|
101545
|
-
|
|
101587
|
+
join61("extensions", "omo.js"),
|
|
101588
|
+
join61("extensions", "reflection-persona.md"),
|
|
101589
|
+
join61("skills", "ast-grep", "SKILL.md"),
|
|
101590
|
+
join61("skills", "coding-agent-sessions", "SKILL.md"),
|
|
101591
|
+
join61("skills", "debugging", "SKILL.md"),
|
|
101592
|
+
join61("skills", "frontend", "SKILL.md"),
|
|
101593
|
+
join61("skills", "git-master", "SKILL.md"),
|
|
101594
|
+
join61("skills", "init-deep", "SKILL.md"),
|
|
101595
|
+
join61("skills", "lsp-setup", "SKILL.md"),
|
|
101596
|
+
join61("skills", "programming", "SKILL.md"),
|
|
101597
|
+
join61("skills", "refactor", "SKILL.md"),
|
|
101598
|
+
join61("skills", "remove-ai-slops", "SKILL.md"),
|
|
101599
|
+
join61("skills", "review-work", "SKILL.md"),
|
|
101600
|
+
join61("skills", "start-work", "SKILL.md"),
|
|
101601
|
+
join61("skills", "ultimate-browsing", "SKILL.md"),
|
|
101602
|
+
join61("skills", "ultrawork", "SKILL.md"),
|
|
101603
|
+
join61("skills", "ulw-loop", "SKILL.md"),
|
|
101604
|
+
join61("skills", "ulw-plan", "SKILL.md"),
|
|
101605
|
+
join61("skills", "ulw-research", "SKILL.md"),
|
|
101606
|
+
join61("skills", "visual-qa", "SKILL.md"),
|
|
101607
|
+
join61("runtime", "ast-grep-mcp", "cli.js"),
|
|
101608
|
+
join61("runtime", "agent-toolkit", "cli.js"),
|
|
101609
|
+
join61("runtime", "agent-toolkit", "ulw-loop", "cli.js"),
|
|
101610
|
+
join61("runtime", "agent-toolkit", "omo-agent-toolkit"),
|
|
101611
|
+
join61("runtime", "agent-toolkit", "omo-agent-toolkit.cmd"),
|
|
101612
|
+
join61("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
101613
|
+
join61("runtime", "lsp-daemon", "dist", "index.js"),
|
|
101614
|
+
join61("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
101615
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
101616
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
101617
|
+
join61("runtime", "lsp-daemon", "dist", "package.json"),
|
|
101618
|
+
join61("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
101619
|
+
join61("scripts", "install.mjs")
|
|
101546
101620
|
];
|
|
101547
101621
|
async function runSenpiInstaller(options = {}) {
|
|
101548
101622
|
const context = resolveInstallContext(options);
|
|
@@ -101554,6 +101628,10 @@ async function runSenpiInstaller(options = {}) {
|
|
|
101554
101628
|
packages.push(context.pluginPath);
|
|
101555
101629
|
settings.packages = packages;
|
|
101556
101630
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
101631
|
+
installLocalLauncher({
|
|
101632
|
+
pluginPath: context.pluginPath,
|
|
101633
|
+
senpiCliPath: join61(context.repoRoot, "packages", "coding-agent", "dist", "cli.js")
|
|
101634
|
+
});
|
|
101557
101635
|
return {
|
|
101558
101636
|
ok: true,
|
|
101559
101637
|
action: "install",
|
|
@@ -101567,14 +101645,14 @@ async function runSenpiInstaller(options = {}) {
|
|
|
101567
101645
|
function resolveInstallContext(options) {
|
|
101568
101646
|
const env3 = options.env ?? process.env;
|
|
101569
101647
|
const allowBuild = options.pluginPath === undefined;
|
|
101570
|
-
const repoRoot =
|
|
101571
|
-
const agentDir =
|
|
101572
|
-
const pluginPath =
|
|
101648
|
+
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname23(fileURLToPath(import.meta.url))) : dirname23(resolve19(options.pluginPath))));
|
|
101649
|
+
const agentDir = resolve19(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ?? join61(homedir10(), ".senpi", "agent"));
|
|
101650
|
+
const pluginPath = resolve19(options.pluginPath ?? join61(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
101573
101651
|
return {
|
|
101574
101652
|
env: env3,
|
|
101575
101653
|
repoRoot,
|
|
101576
101654
|
agentDir,
|
|
101577
|
-
settingsPath:
|
|
101655
|
+
settingsPath: join61(agentDir, "settings.json"),
|
|
101578
101656
|
pluginPath,
|
|
101579
101657
|
platform: options.platform ?? process.platform,
|
|
101580
101658
|
allowBuild,
|
|
@@ -101583,13 +101661,13 @@ function resolveInstallContext(options) {
|
|
|
101583
101661
|
}
|
|
101584
101662
|
async function ensurePluginArtifacts(context) {
|
|
101585
101663
|
if (context.allowBuild) {
|
|
101586
|
-
await context.runCommand("node", [
|
|
101587
|
-
await context.runCommand("node", [
|
|
101588
|
-
await context.runCommand("node", [
|
|
101589
|
-
await context.runCommand("node", [
|
|
101590
|
-
await context.runCommand("node", [
|
|
101591
|
-
await context.runCommand("node", [
|
|
101592
|
-
await context.runCommand("node", [
|
|
101664
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
101665
|
+
await context.runCommand("node", [join61("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
101666
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
101667
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
101668
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
101669
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
101670
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-agent-toolkit.mjs")], { cwd: context.repoRoot });
|
|
101593
101671
|
}
|
|
101594
101672
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
101595
101673
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -101598,14 +101676,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
101598
101676
|
}
|
|
101599
101677
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
101600
101678
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
101601
|
-
if (!await fileExists2(
|
|
101679
|
+
if (!await fileExists2(join61(pluginPath, artifact)))
|
|
101602
101680
|
return true;
|
|
101603
101681
|
}
|
|
101604
101682
|
return false;
|
|
101605
101683
|
}
|
|
101606
101684
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
101607
|
-
const runtimeEntry =
|
|
101608
|
-
const manifestPath =
|
|
101685
|
+
const runtimeEntry = join61(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
101686
|
+
const manifestPath = join61(dirname23(runtimeEntry), "manifest.json");
|
|
101609
101687
|
let runtimeStat;
|
|
101610
101688
|
try {
|
|
101611
101689
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -101662,9 +101740,9 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
101662
101740
|
function findRepoRoot2(importerDir) {
|
|
101663
101741
|
let current = importerDir;
|
|
101664
101742
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
101665
|
-
if (fileExistsSync(
|
|
101743
|
+
if (fileExistsSync(join61(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
101666
101744
|
return current;
|
|
101667
|
-
current =
|
|
101745
|
+
current = resolve19(current, "..");
|
|
101668
101746
|
}
|
|
101669
101747
|
throw new Error("Unable to locate packages/omo-senpi/plugin/package.json from installer module");
|
|
101670
101748
|
}
|
|
@@ -101679,7 +101757,7 @@ async function fileExists2(path6) {
|
|
|
101679
101757
|
}
|
|
101680
101758
|
}
|
|
101681
101759
|
function fileExistsSync(path6) {
|
|
101682
|
-
return
|
|
101760
|
+
return existsSync31(path6);
|
|
101683
101761
|
}
|
|
101684
101762
|
function isErrno2(error51, code) {
|
|
101685
101763
|
return error51 instanceof Error && "code" in error51 && error51.code === code;
|
|
@@ -101718,26 +101796,26 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
101718
101796
|
init_provider_availability();
|
|
101719
101797
|
|
|
101720
101798
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
101721
|
-
import { existsSync as
|
|
101722
|
-
import { join as
|
|
101799
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as readFileSync16 } from "node:fs";
|
|
101800
|
+
import { join as join63 } from "node:path";
|
|
101723
101801
|
|
|
101724
101802
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
101725
101803
|
init_shared();
|
|
101726
|
-
import { existsSync as
|
|
101727
|
-
import { join as
|
|
101804
|
+
import { existsSync as existsSync32, readFileSync as readFileSync15 } from "node:fs";
|
|
101805
|
+
import { join as join62 } from "node:path";
|
|
101728
101806
|
var TUI_SUBPATH = "tui";
|
|
101729
101807
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
101730
101808
|
function fileEntryPackageJsonPath(entry) {
|
|
101731
101809
|
let path6 = entry.slice("file:".length);
|
|
101732
101810
|
if (path6.startsWith("//"))
|
|
101733
101811
|
path6 = path6.slice(2);
|
|
101734
|
-
return
|
|
101812
|
+
return join62(path6, "package.json");
|
|
101735
101813
|
}
|
|
101736
101814
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
101737
|
-
if (!
|
|
101815
|
+
if (!existsSync32(pkgJsonPath))
|
|
101738
101816
|
return null;
|
|
101739
101817
|
try {
|
|
101740
|
-
const parsed = JSON.parse(
|
|
101818
|
+
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
101741
101819
|
if (parsed.exports === undefined)
|
|
101742
101820
|
return null;
|
|
101743
101821
|
if (typeof parsed.exports === "string")
|
|
@@ -101769,16 +101847,16 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
101769
101847
|
const packageName = packageNameFromServerEntry(entry);
|
|
101770
101848
|
if (packageName === null)
|
|
101771
101849
|
return null;
|
|
101772
|
-
return packageJsonExportsTui(
|
|
101850
|
+
return packageJsonExportsTui(join62(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
101773
101851
|
}
|
|
101774
101852
|
function isOurFilePluginEntry(entry) {
|
|
101775
101853
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
101776
101854
|
return false;
|
|
101777
101855
|
try {
|
|
101778
101856
|
const pkgJsonPath = fileEntryPackageJsonPath(entry);
|
|
101779
|
-
if (!
|
|
101857
|
+
if (!existsSync32(pkgJsonPath))
|
|
101780
101858
|
return false;
|
|
101781
|
-
const parsed = JSON.parse(
|
|
101859
|
+
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
101782
101860
|
return typeof parsed.name === "string" && ACCEPTED_PACKAGE_NAMES.includes(parsed.name);
|
|
101783
101861
|
} catch (error51) {
|
|
101784
101862
|
log2("[tui-plugin-config] Failed to inspect file plugin package", {
|
|
@@ -101811,12 +101889,12 @@ function isCanonicalNamedTuiPluginEntry(entry) {
|
|
|
101811
101889
|
}
|
|
101812
101890
|
function detectServerPluginRegistration() {
|
|
101813
101891
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
101814
|
-
const configPath =
|
|
101892
|
+
const configPath = existsSync32(paths2.configJsonc) ? paths2.configJsonc : existsSync32(paths2.configJson) ? paths2.configJson : null;
|
|
101815
101893
|
if (!configPath) {
|
|
101816
101894
|
return { registered: false, configPath: null, entry: null, packageExportsTui: null };
|
|
101817
101895
|
}
|
|
101818
101896
|
try {
|
|
101819
|
-
const parsed = parseJsonc(
|
|
101897
|
+
const parsed = parseJsonc(readFileSync15(configPath, "utf-8"));
|
|
101820
101898
|
const plugins = parsed.plugin ?? [];
|
|
101821
101899
|
const serverEntry = plugins.find(isServerPluginEntry);
|
|
101822
101900
|
return {
|
|
@@ -101834,8 +101912,8 @@ function detectServerPluginRegistration() {
|
|
|
101834
101912
|
}
|
|
101835
101913
|
}
|
|
101836
101914
|
function detectTuiPluginRegistration() {
|
|
101837
|
-
const tuiJsonPath =
|
|
101838
|
-
if (!
|
|
101915
|
+
const tuiJsonPath = join62(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
101916
|
+
if (!existsSync32(tuiJsonPath)) {
|
|
101839
101917
|
return {
|
|
101840
101918
|
registered: false,
|
|
101841
101919
|
configPath: tuiJsonPath,
|
|
@@ -101846,7 +101924,7 @@ function detectTuiPluginRegistration() {
|
|
|
101846
101924
|
};
|
|
101847
101925
|
}
|
|
101848
101926
|
try {
|
|
101849
|
-
const parsed = parseJsonc(
|
|
101927
|
+
const parsed = parseJsonc(readFileSync15(tuiJsonPath, "utf-8"));
|
|
101850
101928
|
const plugins = parsed.plugin ?? [];
|
|
101851
101929
|
return {
|
|
101852
101930
|
registered: plugins.some(isTuiPluginEntry),
|
|
@@ -101979,7 +102057,7 @@ init_shared();
|
|
|
101979
102057
|
init_write_file_atomically();
|
|
101980
102058
|
function readConfig(path6) {
|
|
101981
102059
|
try {
|
|
101982
|
-
const parsed = parseJsonc(
|
|
102060
|
+
const parsed = parseJsonc(readFileSync16(path6, "utf-8"));
|
|
101983
102061
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
101984
102062
|
return parsed;
|
|
101985
102063
|
}
|
|
@@ -101990,11 +102068,11 @@ function readConfig(path6) {
|
|
|
101990
102068
|
return null;
|
|
101991
102069
|
}
|
|
101992
102070
|
function readServerConfig(configDir) {
|
|
101993
|
-
const jsoncPath =
|
|
101994
|
-
if (
|
|
102071
|
+
const jsoncPath = join63(configDir, "opencode.jsonc");
|
|
102072
|
+
if (existsSync33(jsoncPath))
|
|
101995
102073
|
return readConfig(jsoncPath);
|
|
101996
|
-
const jsonPath =
|
|
101997
|
-
if (
|
|
102074
|
+
const jsonPath = join63(configDir, "opencode.json");
|
|
102075
|
+
if (existsSync33(jsonPath))
|
|
101998
102076
|
return readConfig(jsonPath);
|
|
101999
102077
|
return null;
|
|
102000
102078
|
}
|
|
@@ -102014,7 +102092,7 @@ function desiredTuiEntry(serverEntry) {
|
|
|
102014
102092
|
return null;
|
|
102015
102093
|
}
|
|
102016
102094
|
function readTuiConfig(tuiJsonPath) {
|
|
102017
|
-
if (!
|
|
102095
|
+
if (!existsSync33(tuiJsonPath)) {
|
|
102018
102096
|
return { config: {}, malformed: false };
|
|
102019
102097
|
}
|
|
102020
102098
|
const config3 = readConfig(tuiJsonPath);
|
|
@@ -102035,7 +102113,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
102035
102113
|
if (!desiredEntry) {
|
|
102036
102114
|
return { changed: false, reason: "no-server-entry" };
|
|
102037
102115
|
}
|
|
102038
|
-
const tuiJsonPath =
|
|
102116
|
+
const tuiJsonPath = join63(configDir, "tui.json");
|
|
102039
102117
|
const { config: config3, malformed } = readTuiConfig(tuiJsonPath);
|
|
102040
102118
|
if (malformed) {
|
|
102041
102119
|
return { changed: false, reason: "malformed" };
|
|
@@ -102044,22 +102122,22 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
102044
102122
|
if (plugins.includes(desiredEntry)) {
|
|
102045
102123
|
return { changed: false, reason: "already-present" };
|
|
102046
102124
|
}
|
|
102047
|
-
|
|
102125
|
+
mkdirSync11(configDir, { recursive: true });
|
|
102048
102126
|
writeFileAtomically2(tuiJsonPath, formatConfig({ ...config3, plugin: [...plugins, desiredEntry] }));
|
|
102049
102127
|
return { changed: true, reason: "added" };
|
|
102050
102128
|
}
|
|
102051
102129
|
|
|
102052
102130
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
102053
|
-
import { homedir as
|
|
102054
|
-
import { join as
|
|
102131
|
+
import { homedir as homedir11 } from "node:os";
|
|
102132
|
+
import { join as join64 } from "node:path";
|
|
102055
102133
|
|
|
102056
102134
|
// packages/shared-skills/index.mjs
|
|
102057
|
-
import { existsSync as
|
|
102135
|
+
import { existsSync as existsSync34 } from "node:fs";
|
|
102058
102136
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
102059
102137
|
var SKILLS_PROBE_SPECIFIERS = ["./skills/", "../skills/", "../../skills/"];
|
|
102060
102138
|
function sharedSkillsRootPath() {
|
|
102061
102139
|
const candidates = SKILLS_PROBE_SPECIFIERS.map((specifier) => fileURLToPath2(new URL(specifier, import.meta.url)));
|
|
102062
|
-
return candidates.find((candidate2) =>
|
|
102140
|
+
return candidates.find((candidate2) => existsSync34(candidate2)) ?? candidates[0];
|
|
102063
102141
|
}
|
|
102064
102142
|
|
|
102065
102143
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
@@ -102073,9 +102151,9 @@ function describeResult2(result) {
|
|
|
102073
102151
|
}
|
|
102074
102152
|
async function installAstGrepForOpenCode(options = {}) {
|
|
102075
102153
|
const platform = options.platform ?? process.platform;
|
|
102076
|
-
const baseDir =
|
|
102154
|
+
const baseDir = join64(options.homeDir ?? homedir11(), ".omo");
|
|
102077
102155
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
102078
|
-
const skillDir =
|
|
102156
|
+
const skillDir = join64(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
102079
102157
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
102080
102158
|
try {
|
|
102081
102159
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -105878,7 +105956,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
105878
105956
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
105879
105957
|
init_bun_which_shim();
|
|
105880
105958
|
init_spawn_with_windows_hide();
|
|
105881
|
-
import { delimiter as delimiter2, dirname as
|
|
105959
|
+
import { delimiter as delimiter2, dirname as dirname24, posix as posix9, win32 as win325 } from "node:path";
|
|
105882
105960
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
105883
105961
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
105884
105962
|
function getCommandCandidates(platform) {
|
|
@@ -105936,7 +106014,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
105936
106014
|
return null;
|
|
105937
106015
|
}
|
|
105938
106016
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
105939
|
-
const preferredDir =
|
|
106017
|
+
const preferredDir = dirname24(binaryPath);
|
|
105940
106018
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
105941
106019
|
return [preferredDir, ...existing].join(delimiter2);
|
|
105942
106020
|
}
|
|
@@ -106105,7 +106183,7 @@ async function resolveSession(options) {
|
|
|
106105
106183
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
106106
106184
|
const delay2 = retryDelayMs * attempt;
|
|
106107
106185
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
106108
|
-
await new Promise((
|
|
106186
|
+
await new Promise((resolve20) => setTimeout(resolve20, delay2));
|
|
106109
106187
|
}
|
|
106110
106188
|
continue;
|
|
106111
106189
|
}
|
|
@@ -106116,7 +106194,7 @@ async function resolveSession(options) {
|
|
|
106116
106194
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
106117
106195
|
const delay2 = retryDelayMs * attempt;
|
|
106118
106196
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
106119
|
-
await new Promise((
|
|
106197
|
+
await new Promise((resolve20) => setTimeout(resolve20, delay2));
|
|
106120
106198
|
}
|
|
106121
106199
|
}
|
|
106122
106200
|
throw new Error("Failed to create session after all retries");
|
|
@@ -106514,26 +106592,26 @@ function isClosingFence(line, fence) {
|
|
|
106514
106592
|
return run?.charAt(0) === fence.marker && run.length >= fence.length;
|
|
106515
106593
|
}
|
|
106516
106594
|
// packages/boulder-state/src/top-level-task.ts
|
|
106517
|
-
import { existsSync as
|
|
106595
|
+
import { existsSync as existsSync35, readFileSync as readFileSync17 } from "node:fs";
|
|
106518
106596
|
function readCurrentTopLevelTask(planPath) {
|
|
106519
|
-
if (!
|
|
106597
|
+
if (!existsSync35(planPath)) {
|
|
106520
106598
|
return null;
|
|
106521
106599
|
}
|
|
106522
106600
|
try {
|
|
106523
|
-
const content =
|
|
106601
|
+
const content = readFileSync17(planPath, "utf-8");
|
|
106524
106602
|
return parseCurrentTopLevelTask(content);
|
|
106525
106603
|
} catch {
|
|
106526
106604
|
return null;
|
|
106527
106605
|
}
|
|
106528
106606
|
}
|
|
106529
106607
|
// packages/boulder-state/src/storage/path.ts
|
|
106530
|
-
import { existsSync as
|
|
106531
|
-
import { isAbsolute as isAbsolute11, join as
|
|
106608
|
+
import { existsSync as existsSync36 } from "node:fs";
|
|
106609
|
+
import { isAbsolute as isAbsolute11, join as join65, relative as relative8, resolve as resolve20 } from "node:path";
|
|
106532
106610
|
function getBoulderFilePath(directory) {
|
|
106533
|
-
return
|
|
106611
|
+
return join65(directory, BOULDER_DIR, BOULDER_FILE);
|
|
106534
106612
|
}
|
|
106535
106613
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
106536
|
-
return isAbsolute11(trackedPath) ?
|
|
106614
|
+
return isAbsolute11(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
|
|
106537
106615
|
}
|
|
106538
106616
|
function resolveBoulderPlanPath(directory, state) {
|
|
106539
106617
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -106541,26 +106619,26 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
106541
106619
|
if (!worktreePath) {
|
|
106542
106620
|
return absolutePlanPath;
|
|
106543
106621
|
}
|
|
106544
|
-
const absoluteDirectory =
|
|
106622
|
+
const absoluteDirectory = resolve20(directory);
|
|
106545
106623
|
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
106546
106624
|
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute11(relativePlanPath)) {
|
|
106547
106625
|
return absolutePlanPath;
|
|
106548
106626
|
}
|
|
106549
106627
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
106550
|
-
const worktreePlanPath =
|
|
106551
|
-
return
|
|
106628
|
+
const worktreePlanPath = resolve20(absoluteWorktreePath, relativePlanPath);
|
|
106629
|
+
return existsSync36(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
106552
106630
|
}
|
|
106553
106631
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
106554
106632
|
return resolveBoulderPlanPath(directory, work);
|
|
106555
106633
|
}
|
|
106556
106634
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
106557
|
-
import { existsSync as
|
|
106635
|
+
import { existsSync as existsSync37, readFileSync as readFileSync18, readdirSync as readdirSync7, statSync as statSync4 } from "node:fs";
|
|
106558
106636
|
function getPlanProgress(planPath) {
|
|
106559
|
-
if (!
|
|
106637
|
+
if (!existsSync37(planPath)) {
|
|
106560
106638
|
return { total: 0, completed: 0, isComplete: false };
|
|
106561
106639
|
}
|
|
106562
106640
|
try {
|
|
106563
|
-
const content =
|
|
106641
|
+
const content = readFileSync18(planPath, "utf-8");
|
|
106564
106642
|
const checklist = parsePlanChecklist(content);
|
|
106565
106643
|
return {
|
|
106566
106644
|
total: checklist.total,
|
|
@@ -106639,14 +106717,14 @@ function selectMirrorWork(state) {
|
|
|
106639
106717
|
return sorted[0] ?? null;
|
|
106640
106718
|
}
|
|
106641
106719
|
// packages/boulder-state/src/storage/read-state.ts
|
|
106642
|
-
import { existsSync as
|
|
106720
|
+
import { existsSync as existsSync38, readFileSync as readFileSync19 } from "node:fs";
|
|
106643
106721
|
function readBoulderState(directory) {
|
|
106644
106722
|
const filePath = getBoulderFilePath(directory);
|
|
106645
|
-
if (!
|
|
106723
|
+
if (!existsSync38(filePath)) {
|
|
106646
106724
|
return null;
|
|
106647
106725
|
}
|
|
106648
106726
|
try {
|
|
106649
|
-
const content =
|
|
106727
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
106650
106728
|
const parsed = JSON.parse(content);
|
|
106651
106729
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || Object.keys(parsed).length === 0) {
|
|
106652
106730
|
return null;
|
|
@@ -106712,17 +106790,17 @@ init_state();
|
|
|
106712
106790
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
106713
106791
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
106714
106792
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
106715
|
-
import { existsSync as
|
|
106716
|
-
import { join as
|
|
106793
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync12, readFileSync as readFileSync20, rmSync as rmSync2, writeFileSync as writeFileSync7 } from "node:fs";
|
|
106794
|
+
import { join as join66 } from "node:path";
|
|
106717
106795
|
function getMarkerPath(directory, sessionID) {
|
|
106718
|
-
return
|
|
106796
|
+
return join66(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
106719
106797
|
}
|
|
106720
106798
|
function readContinuationMarker(directory, sessionID) {
|
|
106721
106799
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
106722
|
-
if (!
|
|
106800
|
+
if (!existsSync39(markerPath))
|
|
106723
106801
|
return null;
|
|
106724
106802
|
try {
|
|
106725
|
-
const raw =
|
|
106803
|
+
const raw = readFileSync20(markerPath, "utf-8");
|
|
106726
106804
|
const parsed = JSON.parse(raw);
|
|
106727
106805
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
106728
106806
|
return null;
|
|
@@ -106787,8 +106865,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
106787
106865
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
106788
106866
|
init_shared();
|
|
106789
106867
|
init_compaction_marker();
|
|
106790
|
-
import { readFileSync as
|
|
106791
|
-
import { join as
|
|
106868
|
+
import { readFileSync as readFileSync21, readdirSync as readdirSync8 } from "node:fs";
|
|
106869
|
+
import { join as join67 } from "node:path";
|
|
106792
106870
|
var defaultSessionLastAgentDeps = {
|
|
106793
106871
|
getMessageDir,
|
|
106794
106872
|
isSqliteBackend,
|
|
@@ -106848,7 +106926,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
106848
106926
|
try {
|
|
106849
106927
|
const messages = readdirSync8(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
106850
106928
|
try {
|
|
106851
|
-
const content =
|
|
106929
|
+
const content = readFileSync21(join67(messageDir, fileName), "utf-8");
|
|
106852
106930
|
const parsed = JSON.parse(content);
|
|
106853
106931
|
return {
|
|
106854
106932
|
fileName,
|
|
@@ -106891,8 +106969,8 @@ init_agent_display_names();
|
|
|
106891
106969
|
|
|
106892
106970
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
106893
106971
|
init_frontmatter2();
|
|
106894
|
-
import { existsSync as
|
|
106895
|
-
import { dirname as
|
|
106972
|
+
import { existsSync as existsSync40, readFileSync as readFileSync22, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "node:fs";
|
|
106973
|
+
import { dirname as dirname25, join as join68 } from "node:path";
|
|
106896
106974
|
|
|
106897
106975
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
106898
106976
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -106901,15 +106979,15 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
106901
106979
|
|
|
106902
106980
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
106903
106981
|
function getStateFilePath(directory, customPath) {
|
|
106904
|
-
return customPath ?
|
|
106982
|
+
return customPath ? join68(directory, customPath) : join68(directory, DEFAULT_STATE_FILE);
|
|
106905
106983
|
}
|
|
106906
106984
|
function readState(directory, customPath) {
|
|
106907
106985
|
const filePath = getStateFilePath(directory, customPath);
|
|
106908
|
-
if (!
|
|
106986
|
+
if (!existsSync40(filePath)) {
|
|
106909
106987
|
return null;
|
|
106910
106988
|
}
|
|
106911
106989
|
try {
|
|
106912
|
-
const content =
|
|
106990
|
+
const content = readFileSync22(filePath, "utf-8");
|
|
106913
106991
|
const { data, body } = parseFrontmatter(content);
|
|
106914
106992
|
const active = data.active;
|
|
106915
106993
|
const iteration = data.iteration;
|
|
@@ -107135,7 +107213,7 @@ async function pollForCompletion(ctx, eventState, abortController, options = {})
|
|
|
107135
107213
|
const secondaryMeaningfulWorkTimeoutMs = options.secondaryMeaningfulWorkTimeoutMs ?? DEFAULT_SECONDARY_MEANINGFUL_WORK_TIMEOUT_MS;
|
|
107136
107214
|
const requireMeaningfulWork = options.requireMeaningfulWork ?? false;
|
|
107137
107215
|
const now = options.now ?? Date.now;
|
|
107138
|
-
const sleep = options.sleep ?? ((ms) => new Promise((
|
|
107216
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve21) => setTimeout(resolve21, ms)));
|
|
107139
107217
|
let consecutiveCompleteChecks = 0;
|
|
107140
107218
|
let errorCycleCount = 0;
|
|
107141
107219
|
let firstWorkTimestamp = null;
|
|
@@ -107300,7 +107378,7 @@ function createAbortError() {
|
|
|
107300
107378
|
return error51;
|
|
107301
107379
|
}
|
|
107302
107380
|
function sleep(delayMs) {
|
|
107303
|
-
return new Promise((
|
|
107381
|
+
return new Promise((resolve21) => setTimeout(resolve21, delayMs));
|
|
107304
107382
|
}
|
|
107305
107383
|
function hasPromptStartEvidence(eventState) {
|
|
107306
107384
|
return eventState.mainSessionStarted || eventState.hasReceivedMeaningfulWork || eventState.messageCount > 0 || eventState.currentTool !== null;
|
|
@@ -107675,7 +107753,7 @@ var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
|
|
|
107675
107753
|
async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
|
|
107676
107754
|
const completed = await Promise.race([
|
|
107677
107755
|
eventProcessor.then(() => true),
|
|
107678
|
-
new Promise((
|
|
107756
|
+
new Promise((resolve21) => setTimeout(() => resolve21(false), timeoutMs))
|
|
107679
107757
|
]);
|
|
107680
107758
|
}
|
|
107681
107759
|
async function run(options) {
|
|
@@ -108001,14 +108079,14 @@ async function getLocalVersion(options = {}) {
|
|
|
108001
108079
|
}
|
|
108002
108080
|
}
|
|
108003
108081
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
108004
|
-
import { existsSync as
|
|
108082
|
+
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "node:fs";
|
|
108005
108083
|
|
|
108006
108084
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
108007
108085
|
init_extract_semver();
|
|
108008
108086
|
init_bun_which_shim();
|
|
108009
|
-
import { existsSync as
|
|
108010
|
-
import { homedir as
|
|
108011
|
-
import { join as
|
|
108087
|
+
import { existsSync as existsSync48, accessSync as accessSync4, constants as constants11 } from "node:fs";
|
|
108088
|
+
import { homedir as homedir14 } from "node:os";
|
|
108089
|
+
import { join as join75 } from "node:path";
|
|
108012
108090
|
|
|
108013
108091
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
108014
108092
|
init_spawn_with_windows_hide();
|
|
@@ -108047,8 +108125,8 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
|
|
|
108047
108125
|
const stdoutPromise = readSpawnStream(proc.stdout);
|
|
108048
108126
|
const stderrPromise = readSpawnStream(proc.stderr);
|
|
108049
108127
|
let timer;
|
|
108050
|
-
const timeoutPromise = new Promise((
|
|
108051
|
-
timer = setTimeout(() =>
|
|
108128
|
+
const timeoutPromise = new Promise((resolve21) => {
|
|
108129
|
+
timer = setTimeout(() => resolve21("timeout"), timeoutMs);
|
|
108052
108130
|
});
|
|
108053
108131
|
const processPromise = (async () => {
|
|
108054
108132
|
await proc.exited;
|
|
@@ -108095,22 +108173,22 @@ function isExecutable2(path12) {
|
|
|
108095
108173
|
}
|
|
108096
108174
|
}
|
|
108097
108175
|
function getDesktopAppPaths(platform) {
|
|
108098
|
-
const home =
|
|
108176
|
+
const home = homedir14();
|
|
108099
108177
|
switch (platform) {
|
|
108100
108178
|
case "darwin":
|
|
108101
108179
|
return [
|
|
108102
108180
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
108103
|
-
|
|
108181
|
+
join75(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
108104
108182
|
];
|
|
108105
108183
|
case "win32": {
|
|
108106
108184
|
const programFiles = process.env.ProgramFiles;
|
|
108107
108185
|
const localAppData = process.env.LOCALAPPDATA;
|
|
108108
108186
|
const paths2 = [];
|
|
108109
108187
|
if (programFiles) {
|
|
108110
|
-
paths2.push(
|
|
108188
|
+
paths2.push(join75(programFiles, "OpenCode", "OpenCode.exe"));
|
|
108111
108189
|
}
|
|
108112
108190
|
if (localAppData) {
|
|
108113
|
-
paths2.push(
|
|
108191
|
+
paths2.push(join75(localAppData, "OpenCode", "OpenCode.exe"));
|
|
108114
108192
|
}
|
|
108115
108193
|
return paths2;
|
|
108116
108194
|
}
|
|
@@ -108118,8 +108196,8 @@ function getDesktopAppPaths(platform) {
|
|
|
108118
108196
|
return [
|
|
108119
108197
|
"/usr/bin/opencode",
|
|
108120
108198
|
"/usr/lib/opencode/opencode",
|
|
108121
|
-
|
|
108122
|
-
|
|
108199
|
+
join75(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
108200
|
+
join75(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
108123
108201
|
];
|
|
108124
108202
|
default:
|
|
108125
108203
|
return [];
|
|
@@ -108131,7 +108209,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
108131
108209
|
}
|
|
108132
108210
|
return [binaryPath, "--version"];
|
|
108133
108211
|
}
|
|
108134
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
108212
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync48) {
|
|
108135
108213
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
108136
108214
|
if (checkExists(desktopPath)) {
|
|
108137
108215
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -108139,7 +108217,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
108139
108217
|
}
|
|
108140
108218
|
return null;
|
|
108141
108219
|
}
|
|
108142
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
108220
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync48) {
|
|
108143
108221
|
for (const binary of OPENCODE_BINARIES2) {
|
|
108144
108222
|
const path12 = bunWhich(binary);
|
|
108145
108223
|
if (path12 && checkExists(path12)) {
|
|
@@ -108151,7 +108229,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
108151
108229
|
const candidates = getCommandCandidates2(platform);
|
|
108152
108230
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
108153
108231
|
for (const command of candidates) {
|
|
108154
|
-
const fullPath =
|
|
108232
|
+
const fullPath = join75(entry, command);
|
|
108155
108233
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
108156
108234
|
return { binary: command, path: fullPath };
|
|
108157
108235
|
}
|
|
@@ -108197,12 +108275,12 @@ function compareVersions3(current, minimum) {
|
|
|
108197
108275
|
|
|
108198
108276
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
108199
108277
|
init_shared();
|
|
108200
|
-
import { existsSync as
|
|
108278
|
+
import { existsSync as existsSync49, readFileSync as readFileSync30 } from "node:fs";
|
|
108201
108279
|
function detectConfigPath() {
|
|
108202
108280
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
108203
|
-
if (
|
|
108281
|
+
if (existsSync49(paths2.configJsonc))
|
|
108204
108282
|
return paths2.configJsonc;
|
|
108205
|
-
if (
|
|
108283
|
+
if (existsSync49(paths2.configJson))
|
|
108206
108284
|
return paths2.configJson;
|
|
108207
108285
|
return null;
|
|
108208
108286
|
}
|
|
@@ -108248,7 +108326,7 @@ function getPluginInfo() {
|
|
|
108248
108326
|
};
|
|
108249
108327
|
}
|
|
108250
108328
|
try {
|
|
108251
|
-
const content =
|
|
108329
|
+
const content = readFileSync30(configPath, "utf-8");
|
|
108252
108330
|
const parsedConfig = parseJsonc(content);
|
|
108253
108331
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
108254
108332
|
if (!pluginEntry) {
|
|
@@ -108290,39 +108368,39 @@ init_file_utils2();
|
|
|
108290
108368
|
init_checker();
|
|
108291
108369
|
init_auto_update_checker();
|
|
108292
108370
|
init_package_json_locator();
|
|
108293
|
-
import { existsSync as
|
|
108371
|
+
import { existsSync as existsSync50, readFileSync as readFileSync31, readdirSync as readdirSync10 } from "node:fs";
|
|
108294
108372
|
import { createRequire as createRequire3 } from "node:module";
|
|
108295
|
-
import { homedir as
|
|
108296
|
-
import { join as
|
|
108373
|
+
import { homedir as homedir15 } from "node:os";
|
|
108374
|
+
import { join as join76 } from "node:path";
|
|
108297
108375
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
108298
108376
|
init_shared();
|
|
108299
108377
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
108300
108378
|
if (platform === "darwin")
|
|
108301
|
-
return
|
|
108379
|
+
return join76(homedir15(), "Library", "Caches");
|
|
108302
108380
|
if (platform === "win32")
|
|
108303
|
-
return process.env.LOCALAPPDATA ??
|
|
108304
|
-
return
|
|
108381
|
+
return process.env.LOCALAPPDATA ?? join76(homedir15(), "AppData", "Local");
|
|
108382
|
+
return join76(homedir15(), ".cache");
|
|
108305
108383
|
}
|
|
108306
108384
|
function resolveOpenCodeCacheDir() {
|
|
108307
108385
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
108308
108386
|
if (xdgCacheHome)
|
|
108309
|
-
return
|
|
108387
|
+
return join76(xdgCacheHome, "opencode");
|
|
108310
108388
|
const fromShared = getOpenCodeCacheDir();
|
|
108311
|
-
const platformDefault =
|
|
108312
|
-
if (
|
|
108389
|
+
const platformDefault = join76(getPlatformDefaultCacheDir(), "opencode");
|
|
108390
|
+
if (existsSync50(fromShared) || !existsSync50(platformDefault))
|
|
108313
108391
|
return fromShared;
|
|
108314
108392
|
return platformDefault;
|
|
108315
108393
|
}
|
|
108316
108394
|
function resolveExistingDir(dirPath) {
|
|
108317
|
-
if (!
|
|
108395
|
+
if (!existsSync50(dirPath))
|
|
108318
108396
|
return dirPath;
|
|
108319
108397
|
return resolveSymlink(dirPath);
|
|
108320
108398
|
}
|
|
108321
108399
|
function readPackageJson(filePath) {
|
|
108322
|
-
if (!
|
|
108400
|
+
if (!existsSync50(filePath))
|
|
108323
108401
|
return null;
|
|
108324
108402
|
try {
|
|
108325
|
-
const content =
|
|
108403
|
+
const content = readFileSync31(filePath, "utf-8");
|
|
108326
108404
|
return parseJsonc(content);
|
|
108327
108405
|
} catch (error51) {
|
|
108328
108406
|
if (!(error51 instanceof Error)) {
|
|
@@ -108340,26 +108418,26 @@ function normalizeVersion(value) {
|
|
|
108340
108418
|
function createPackageCandidates(rootDir) {
|
|
108341
108419
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
108342
108420
|
packageName,
|
|
108343
|
-
installedPackagePath:
|
|
108421
|
+
installedPackagePath: join76(rootDir, "node_modules", packageName, "package.json")
|
|
108344
108422
|
}));
|
|
108345
108423
|
}
|
|
108346
108424
|
function createTaggedInstallCandidates(rootDir) {
|
|
108347
|
-
const packagesDir =
|
|
108348
|
-
if (!
|
|
108425
|
+
const packagesDir = join76(rootDir, "packages");
|
|
108426
|
+
if (!existsSync50(packagesDir))
|
|
108349
108427
|
return [];
|
|
108350
108428
|
const candidates = [];
|
|
108351
108429
|
for (const entryName of readdirSync10(packagesDir).sort()) {
|
|
108352
108430
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
108353
108431
|
if (packageName === undefined)
|
|
108354
108432
|
continue;
|
|
108355
|
-
const installDir =
|
|
108433
|
+
const installDir = join76(packagesDir, entryName);
|
|
108356
108434
|
candidates.push({
|
|
108357
108435
|
cacheDir: installDir,
|
|
108358
|
-
cachePackagePath:
|
|
108436
|
+
cachePackagePath: join76(installDir, "package.json"),
|
|
108359
108437
|
packageCandidates: [
|
|
108360
108438
|
{
|
|
108361
108439
|
packageName,
|
|
108362
|
-
installedPackagePath:
|
|
108440
|
+
installedPackagePath: join76(installDir, "node_modules", packageName, "package.json")
|
|
108363
108441
|
}
|
|
108364
108442
|
]
|
|
108365
108443
|
});
|
|
@@ -108367,7 +108445,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
108367
108445
|
return candidates;
|
|
108368
108446
|
}
|
|
108369
108447
|
function selectInstalledPackage(candidate2) {
|
|
108370
|
-
return candidate2.packageCandidates.find((packageCandidate) =>
|
|
108448
|
+
return candidate2.packageCandidates.find((packageCandidate) => existsSync50(packageCandidate.installedPackagePath)) ?? candidate2.packageCandidates[0];
|
|
108371
108449
|
}
|
|
108372
108450
|
function getExpectedVersion(cachePackage, packageName) {
|
|
108373
108451
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -108378,7 +108456,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
108378
108456
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
108379
108457
|
try {
|
|
108380
108458
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
108381
|
-
if (
|
|
108459
|
+
if (existsSync50(packageJsonPath)) {
|
|
108382
108460
|
return { packageName, packageJsonPath };
|
|
108383
108461
|
}
|
|
108384
108462
|
} catch {
|
|
@@ -108404,22 +108482,22 @@ function getLoadedPluginVersion() {
|
|
|
108404
108482
|
const candidates = [
|
|
108405
108483
|
{
|
|
108406
108484
|
cacheDir: configDir,
|
|
108407
|
-
cachePackagePath:
|
|
108485
|
+
cachePackagePath: join76(configDir, "package.json"),
|
|
108408
108486
|
packageCandidates: createPackageCandidates(configDir)
|
|
108409
108487
|
},
|
|
108410
108488
|
...createTaggedInstallCandidates(configDir),
|
|
108411
108489
|
{
|
|
108412
108490
|
cacheDir,
|
|
108413
|
-
cachePackagePath:
|
|
108491
|
+
cachePackagePath: join76(cacheDir, "package.json"),
|
|
108414
108492
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
108415
108493
|
},
|
|
108416
108494
|
...createTaggedInstallCandidates(cacheDir)
|
|
108417
108495
|
];
|
|
108418
|
-
const selectedCandidate = candidates.find((candidate2) => candidate2.packageCandidates.some((packageCandidate) =>
|
|
108496
|
+
const selectedCandidate = candidates.find((candidate2) => candidate2.packageCandidates.some((packageCandidate) => existsSync50(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
108419
108497
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
108420
108498
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
108421
108499
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
108422
|
-
const candidateExists =
|
|
108500
|
+
const candidateExists = existsSync50(candidateInstalledPath);
|
|
108423
108501
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
108424
108502
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
108425
108503
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -108455,8 +108533,8 @@ var defaultDeps6 = {
|
|
|
108455
108533
|
getLoadedPluginVersion,
|
|
108456
108534
|
getLatestPluginVersion,
|
|
108457
108535
|
getSuggestedInstallTag,
|
|
108458
|
-
configExists:
|
|
108459
|
-
readConfigFile: (path12) =>
|
|
108536
|
+
configExists: existsSync51,
|
|
108537
|
+
readConfigFile: (path12) => readFileSync32(path12, "utf-8"),
|
|
108460
108538
|
parseConfigContent: (content) => parseJsonc(content)
|
|
108461
108539
|
};
|
|
108462
108540
|
var BUN_POSTINSTALL_HELPER_PACKAGE_NAME = "@code-yeongyu/comment-checker";
|
|
@@ -108601,26 +108679,26 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
108601
108679
|
|
|
108602
108680
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
108603
108681
|
init_shared();
|
|
108604
|
-
import { existsSync as
|
|
108605
|
-
import { homedir as
|
|
108606
|
-
import { join as
|
|
108682
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "node:fs";
|
|
108683
|
+
import { homedir as homedir16 } from "node:os";
|
|
108684
|
+
import { join as join77 } from "node:path";
|
|
108607
108685
|
function getUserConfigDir2() {
|
|
108608
108686
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
108609
108687
|
if (xdgConfig)
|
|
108610
|
-
return
|
|
108611
|
-
return
|
|
108688
|
+
return join77(xdgConfig, "opencode");
|
|
108689
|
+
return join77(homedir16(), ".config", "opencode");
|
|
108612
108690
|
}
|
|
108613
108691
|
function loadCustomProviderNames() {
|
|
108614
108692
|
const configDir = getUserConfigDir2();
|
|
108615
108693
|
const candidatePaths = [
|
|
108616
|
-
|
|
108617
|
-
|
|
108694
|
+
join77(configDir, "opencode.json"),
|
|
108695
|
+
join77(configDir, "opencode.jsonc")
|
|
108618
108696
|
];
|
|
108619
108697
|
for (const configPath of candidatePaths) {
|
|
108620
|
-
if (!
|
|
108698
|
+
if (!existsSync52(configPath))
|
|
108621
108699
|
continue;
|
|
108622
108700
|
try {
|
|
108623
|
-
const content =
|
|
108701
|
+
const content = readFileSync33(configPath, "utf-8");
|
|
108624
108702
|
const data = parseJsonc(content);
|
|
108625
108703
|
if (data?.provider && typeof data.provider === "object") {
|
|
108626
108704
|
return Object.keys(data.provider);
|
|
@@ -108635,16 +108713,16 @@ function loadCustomProviderNames() {
|
|
|
108635
108713
|
return [];
|
|
108636
108714
|
}
|
|
108637
108715
|
function loadAvailableModelsFromCache() {
|
|
108638
|
-
const cacheFile =
|
|
108716
|
+
const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
|
|
108639
108717
|
const customProviders = loadCustomProviderNames();
|
|
108640
|
-
if (!
|
|
108718
|
+
if (!existsSync52(cacheFile)) {
|
|
108641
108719
|
if (customProviders.length > 0) {
|
|
108642
108720
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
108643
108721
|
}
|
|
108644
108722
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
108645
108723
|
}
|
|
108646
108724
|
try {
|
|
108647
|
-
const content =
|
|
108725
|
+
const content = readFileSync33(cacheFile, "utf-8");
|
|
108648
108726
|
const data = parseJsonc(content);
|
|
108649
108727
|
const cacheProviders = Object.keys(data);
|
|
108650
108728
|
let modelCount = 0;
|
|
@@ -108697,7 +108775,7 @@ function loadOmoConfig2() {
|
|
|
108697
108775
|
|
|
108698
108776
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
108699
108777
|
init_shared();
|
|
108700
|
-
import { join as
|
|
108778
|
+
import { join as join78 } from "node:path";
|
|
108701
108779
|
|
|
108702
108780
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
108703
108781
|
function formatModelWithVariant(model, variant) {
|
|
@@ -108739,7 +108817,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
108739
108817
|
}
|
|
108740
108818
|
function buildModelResolutionDetails(options) {
|
|
108741
108819
|
const details = [];
|
|
108742
|
-
const cacheFile =
|
|
108820
|
+
const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
|
|
108743
108821
|
details.push("═══ Available Models (from cache) ═══");
|
|
108744
108822
|
details.push("");
|
|
108745
108823
|
if (options.available.cacheExists) {
|
|
@@ -109048,8 +109126,8 @@ async function checkConfig() {
|
|
|
109048
109126
|
|
|
109049
109127
|
// packages/omo-opencode/src/cli/doctor/checks/deprecated-reasoning-keys.ts
|
|
109050
109128
|
init_main();
|
|
109051
|
-
import { existsSync as
|
|
109052
|
-
import { join as
|
|
109129
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34 } from "node:fs";
|
|
109130
|
+
import { join as join79 } from "node:path";
|
|
109053
109131
|
var CANONICAL_REPLACEMENT = new Map([
|
|
109054
109132
|
["variant", "reasoning"],
|
|
109055
109133
|
["reasoningEffort", "reasoning"],
|
|
@@ -109104,16 +109182,16 @@ function userConfigPaths() {
|
|
|
109104
109182
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
109105
109183
|
if (home === undefined || home.length === 0)
|
|
109106
109184
|
return [];
|
|
109107
|
-
return [
|
|
109185
|
+
return [join79(home, ".omo", "omo.jsonc"), join79(home, ".omo", "omo.json")];
|
|
109108
109186
|
}
|
|
109109
109187
|
async function checkDeprecatedReasoningKeys() {
|
|
109110
109188
|
const issues = [];
|
|
109111
109189
|
const scanned = [];
|
|
109112
109190
|
for (const configPath of userConfigPaths()) {
|
|
109113
|
-
if (!
|
|
109191
|
+
if (!existsSync53(configPath))
|
|
109114
109192
|
continue;
|
|
109115
109193
|
scanned.push(configPath);
|
|
109116
|
-
const parsed = parse2(
|
|
109194
|
+
const parsed = parse2(readFileSync34(configPath, "utf-8"));
|
|
109117
109195
|
issues.push(...collectIssues(configPath, parsed, ""));
|
|
109118
109196
|
}
|
|
109119
109197
|
return {
|
|
@@ -109127,28 +109205,28 @@ async function checkDeprecatedReasoningKeys() {
|
|
|
109127
109205
|
|
|
109128
109206
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
109129
109207
|
init_src2();
|
|
109130
|
-
import { existsSync as
|
|
109208
|
+
import { existsSync as existsSync54 } from "node:fs";
|
|
109131
109209
|
import { createRequire as createRequire4 } from "node:module";
|
|
109132
|
-
import { homedir as
|
|
109133
|
-
import { dirname as
|
|
109210
|
+
import { homedir as homedir18 } from "node:os";
|
|
109211
|
+
import { dirname as dirname30, join as join81 } from "node:path";
|
|
109134
109212
|
|
|
109135
109213
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
109136
|
-
import { join as
|
|
109137
|
-
import { homedir as
|
|
109214
|
+
import { join as join80 } from "path";
|
|
109215
|
+
import { homedir as homedir17, tmpdir as tmpdir4 } from "os";
|
|
109138
109216
|
init_binary_downloader();
|
|
109139
109217
|
init_logger2();
|
|
109140
109218
|
init_plugin_identity();
|
|
109141
109219
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
109142
|
-
var DEBUG_FILE =
|
|
109220
|
+
var DEBUG_FILE = join80(tmpdir4(), "comment-checker-debug.log");
|
|
109143
109221
|
function getCacheDir2() {
|
|
109144
109222
|
if (process.platform === "win32") {
|
|
109145
109223
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
109146
|
-
const base2 = localAppData ||
|
|
109147
|
-
return
|
|
109224
|
+
const base2 = localAppData || join80(homedir17(), "AppData", "Local");
|
|
109225
|
+
return join80(base2, CACHE_DIR_NAME, "bin");
|
|
109148
109226
|
}
|
|
109149
109227
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
109150
|
-
const base = xdgCache ||
|
|
109151
|
-
return
|
|
109228
|
+
const base = xdgCache || join80(homedir17(), ".cache");
|
|
109229
|
+
return join80(base, CACHE_DIR_NAME, "bin");
|
|
109152
109230
|
}
|
|
109153
109231
|
function getBinaryName() {
|
|
109154
109232
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -109198,7 +109276,7 @@ async function getBinaryVersion(binary) {
|
|
|
109198
109276
|
}
|
|
109199
109277
|
}
|
|
109200
109278
|
async function checkAstGrepCli() {
|
|
109201
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
109279
|
+
const runtimeDir = astGrepRuntimeDir(join81(homedir18(), ".omo"));
|
|
109202
109280
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
109203
109281
|
if (sgPath === null) {
|
|
109204
109282
|
return {
|
|
@@ -109227,12 +109305,12 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
109227
109305
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
109228
109306
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
109229
109307
|
try {
|
|
109230
|
-
const packageDir = baseDirOverride ??
|
|
109231
|
-
const vendorPath =
|
|
109232
|
-
if (
|
|
109308
|
+
const packageDir = baseDirOverride ?? dirname30(resolvePackageJsonPath());
|
|
109309
|
+
const vendorPath = join81(packageDir, "vendor", platformKey, binaryName);
|
|
109310
|
+
if (existsSync54(vendorPath))
|
|
109233
109311
|
return vendorPath;
|
|
109234
|
-
const binPath =
|
|
109235
|
-
if (
|
|
109312
|
+
const binPath = join81(packageDir, "bin", binaryName);
|
|
109313
|
+
if (existsSync54(binPath))
|
|
109236
109314
|
return binPath;
|
|
109237
109315
|
} catch (error51) {
|
|
109238
109316
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -109378,8 +109456,8 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
109378
109456
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
109379
109457
|
init_zod();
|
|
109380
109458
|
init_opencode_config_dir();
|
|
109381
|
-
import { existsSync as
|
|
109382
|
-
import { delimiter as delimiter3, dirname as
|
|
109459
|
+
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "node:fs";
|
|
109460
|
+
import { delimiter as delimiter3, dirname as dirname31, resolve as resolve22 } from "node:path";
|
|
109383
109461
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
109384
109462
|
|
|
109385
109463
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -109426,7 +109504,7 @@ function resolveRuntimeExecutable(commandName, options = {}) {
|
|
|
109426
109504
|
}
|
|
109427
109505
|
|
|
109428
109506
|
// packages/omo-opencode/src/mcp/shared/ancestor-cli-resolver.ts
|
|
109429
|
-
import { resolve as
|
|
109507
|
+
import { resolve as resolve21 } from "node:path";
|
|
109430
109508
|
function resolveJavaScriptRuntime(resolveExecutable) {
|
|
109431
109509
|
const node = resolveExecutable("node");
|
|
109432
109510
|
return node.available ? node : resolveExecutable("bun");
|
|
@@ -109434,9 +109512,9 @@ function resolveJavaScriptRuntime(resolveExecutable) {
|
|
|
109434
109512
|
function createAncestorCliCandidates(options) {
|
|
109435
109513
|
const candidates = [];
|
|
109436
109514
|
const seenPaths = new Set;
|
|
109437
|
-
let currentDirectory =
|
|
109515
|
+
let currentDirectory = resolve21(options.startDirectory);
|
|
109438
109516
|
while (true) {
|
|
109439
|
-
const distCliPath =
|
|
109517
|
+
const distCliPath = resolve21(currentDirectory, options.packageRel, options.distCliRel);
|
|
109440
109518
|
if (!seenPaths.has(distCliPath)) {
|
|
109441
109519
|
const runtime5 = resolveJavaScriptRuntime(options.resolveExecutable);
|
|
109442
109520
|
seenPaths.add(distCliPath);
|
|
@@ -109448,7 +109526,7 @@ function createAncestorCliCandidates(options) {
|
|
|
109448
109526
|
runtimeAvailable: runtime5.available
|
|
109449
109527
|
});
|
|
109450
109528
|
}
|
|
109451
|
-
const sourceCliPath =
|
|
109529
|
+
const sourceCliPath = resolve21(currentDirectory, options.packageRel, options.sourceCliRel);
|
|
109452
109530
|
if (!seenPaths.has(sourceCliPath)) {
|
|
109453
109531
|
const runtime5 = options.resolveExecutable("bun");
|
|
109454
109532
|
const sourceCandidateAvailable = options.isSourceCandidateAvailable?.({
|
|
@@ -109465,7 +109543,7 @@ function createAncestorCliCandidates(options) {
|
|
|
109465
109543
|
runtimeAvailable: runtime5.available
|
|
109466
109544
|
});
|
|
109467
109545
|
}
|
|
109468
|
-
const parentDirectory =
|
|
109546
|
+
const parentDirectory = resolve21(currentDirectory, "..");
|
|
109469
109547
|
if (parentDirectory === currentDirectory)
|
|
109470
109548
|
return candidates;
|
|
109471
109549
|
currentDirectory = parentDirectory;
|
|
@@ -109510,7 +109588,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
109510
109588
|
].join(";");
|
|
109511
109589
|
function getModuleDirectory(moduleUrl) {
|
|
109512
109590
|
try {
|
|
109513
|
-
return
|
|
109591
|
+
return dirname31(fileURLToPath7(moduleUrl));
|
|
109514
109592
|
} catch (error51) {
|
|
109515
109593
|
if (!(error51 instanceof Error))
|
|
109516
109594
|
throw error51;
|
|
@@ -109518,11 +109596,11 @@ function getModuleDirectory(moduleUrl) {
|
|
|
109518
109596
|
}
|
|
109519
109597
|
}
|
|
109520
109598
|
function findBootstrapRoot(candidates, pathExists) {
|
|
109521
|
-
return candidates.find((candidate2) => pathExists(
|
|
109599
|
+
return candidates.find((candidate2) => pathExists(resolve22(candidate2.root, "package.json")))?.root ?? process.cwd();
|
|
109522
109600
|
}
|
|
109523
109601
|
function readDaemonPackageVersion(root) {
|
|
109524
109602
|
try {
|
|
109525
|
-
const packageJson = JSON.parse(
|
|
109603
|
+
const packageJson = JSON.parse(readFileSync35(resolve22(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
109526
109604
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
109527
109605
|
} catch (error51) {
|
|
109528
109606
|
if (!(error51 instanceof Error))
|
|
@@ -109534,17 +109612,17 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
109534
109612
|
const runtime5 = resolveJavaScriptRuntime(resolveExecutable);
|
|
109535
109613
|
const bun = resolveExecutable("bun");
|
|
109536
109614
|
const npm = resolveExecutable("npm");
|
|
109537
|
-
const packageManifestPath =
|
|
109615
|
+
const packageManifestPath = resolve22(root, PACKAGE_REL, "package.json");
|
|
109538
109616
|
return {
|
|
109539
109617
|
command: [runtime5.command, "-e", LSP_BOOTSTRAP_SCRIPT, root, npm.command, bun.command],
|
|
109540
109618
|
root,
|
|
109541
|
-
path:
|
|
109619
|
+
path: resolve22(root, PACKAGE_REL, DIST_CLI_REL),
|
|
109542
109620
|
exists: runtime5.available && npm.available && pathExists(packageManifestPath),
|
|
109543
109621
|
runtimeAvailable: runtime5.available
|
|
109544
109622
|
};
|
|
109545
109623
|
}
|
|
109546
109624
|
function resolveLspCommand(options = {}) {
|
|
109547
|
-
const pathExists = options.exists ??
|
|
109625
|
+
const pathExists = options.exists ?? existsSync55;
|
|
109548
109626
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
109549
109627
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
109550
109628
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -109554,7 +109632,7 @@ function resolveLspCommand(options = {}) {
|
|
|
109554
109632
|
sourceCliRel: SOURCE_CLI_REL,
|
|
109555
109633
|
pathExists,
|
|
109556
109634
|
resolveExecutable,
|
|
109557
|
-
isSourceCandidateAvailable: ({ root }) => pathExists(
|
|
109635
|
+
isSourceCandidateAvailable: ({ root }) => pathExists(resolve22(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL)) && readDaemonPackageVersion(root) !== null
|
|
109558
109636
|
}) : [];
|
|
109559
109637
|
const distCandidate = candidates.find((candidate2) => hasCliSuffix(candidate2.path, DIST_CLI_REL) && candidate2.exists);
|
|
109560
109638
|
if (distCandidate) {
|
|
@@ -109568,7 +109646,7 @@ function resolveLspCommand(options = {}) {
|
|
|
109568
109646
|
}
|
|
109569
109647
|
function createLspMcpConfig(options = {}) {
|
|
109570
109648
|
const resolvedCommand = resolveLspCommand(options);
|
|
109571
|
-
const cwd =
|
|
109649
|
+
const cwd = resolve22(options.cwd ?? process.cwd());
|
|
109572
109650
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
109573
109651
|
const sourceVersion = hasCliSuffix(resolvedCommand.path, SOURCE_CLI_REL) ? readDaemonPackageVersion(resolvedCommand.root) : null;
|
|
109574
109652
|
return {
|
|
@@ -109577,9 +109655,9 @@ function createLspMcpConfig(options = {}) {
|
|
|
109577
109655
|
enabled: resolvedCommand.exists,
|
|
109578
109656
|
cwd,
|
|
109579
109657
|
environment: {
|
|
109580
|
-
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) =>
|
|
109581
|
-
LSP_TOOLS_MCP_USER_CONFIG:
|
|
109582
|
-
LSP_TOOLS_MCP_INSTALL_DECISIONS:
|
|
109658
|
+
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) => resolve22(cwd, configPath)).join(delimiter3),
|
|
109659
|
+
LSP_TOOLS_MCP_USER_CONFIG: resolve22(configDir, "lsp.json"),
|
|
109660
|
+
LSP_TOOLS_MCP_INSTALL_DECISIONS: resolve22(configDir, "lsp-install-decisions.json"),
|
|
109583
109661
|
...sourceVersion ? {
|
|
109584
109662
|
[OMO_LSP_DAEMON_CLI]: resolvedCommand.path,
|
|
109585
109663
|
[OMO_LSP_DAEMON_VERSION]: sourceVersion
|
|
@@ -109604,24 +109682,24 @@ function getInstalledLspServers(options = {}) {
|
|
|
109604
109682
|
|
|
109605
109683
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
109606
109684
|
init_shared();
|
|
109607
|
-
import { existsSync as
|
|
109608
|
-
import { homedir as
|
|
109609
|
-
import { join as
|
|
109685
|
+
import { existsSync as existsSync56, readFileSync as readFileSync36 } from "node:fs";
|
|
109686
|
+
import { homedir as homedir19 } from "node:os";
|
|
109687
|
+
import { join as join82 } from "node:path";
|
|
109610
109688
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
109611
109689
|
function getMcpConfigPaths() {
|
|
109612
109690
|
return [
|
|
109613
|
-
|
|
109614
|
-
|
|
109615
|
-
|
|
109691
|
+
join82(homedir19(), ".claude", ".mcp.json"),
|
|
109692
|
+
join82(process.cwd(), ".mcp.json"),
|
|
109693
|
+
join82(process.cwd(), ".claude", ".mcp.json")
|
|
109616
109694
|
];
|
|
109617
109695
|
}
|
|
109618
109696
|
function loadUserMcpConfig() {
|
|
109619
109697
|
const servers = {};
|
|
109620
109698
|
for (const configPath of getMcpConfigPaths()) {
|
|
109621
|
-
if (!
|
|
109699
|
+
if (!existsSync56(configPath))
|
|
109622
109700
|
continue;
|
|
109623
109701
|
try {
|
|
109624
|
-
const content =
|
|
109702
|
+
const content = readFileSync36(configPath, "utf-8");
|
|
109625
109703
|
const config4 = parseJsonc(content);
|
|
109626
109704
|
if (config4.mcpServers) {
|
|
109627
109705
|
Object.assign(servers, config4.mcpServers);
|
|
@@ -109756,17 +109834,17 @@ async function checkTools() {
|
|
|
109756
109834
|
|
|
109757
109835
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
109758
109836
|
init_src5();
|
|
109759
|
-
import { existsSync as
|
|
109837
|
+
import { existsSync as existsSync57, readFileSync as readFileSync37 } from "node:fs";
|
|
109760
109838
|
function isTelemetryState(value) {
|
|
109761
109839
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
109762
109840
|
}
|
|
109763
109841
|
function readLastActiveDay(stateFilePath) {
|
|
109764
|
-
if (!
|
|
109842
|
+
if (!existsSync57(stateFilePath)) {
|
|
109765
109843
|
return "never";
|
|
109766
109844
|
}
|
|
109767
109845
|
let parsed;
|
|
109768
109846
|
try {
|
|
109769
|
-
parsed = JSON.parse(
|
|
109847
|
+
parsed = JSON.parse(readFileSync37(stateFilePath, "utf-8"));
|
|
109770
109848
|
} catch (error51) {
|
|
109771
109849
|
if (error51 instanceof Error) {
|
|
109772
109850
|
return "unreadable";
|
|
@@ -109824,17 +109902,17 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
109824
109902
|
}
|
|
109825
109903
|
|
|
109826
109904
|
// packages/team-core/src/team-registry/paths.ts
|
|
109827
|
-
import { homedir as
|
|
109905
|
+
import { homedir as homedir20 } from "node:os";
|
|
109828
109906
|
import path12 from "node:path";
|
|
109829
109907
|
function resolveBaseDir(config4) {
|
|
109830
|
-
return expandHomeDirectory(config4.base_dir ?? path12.join(
|
|
109908
|
+
return expandHomeDirectory(config4.base_dir ?? path12.join(homedir20(), ".omo"));
|
|
109831
109909
|
}
|
|
109832
109910
|
function expandHomeDirectory(directoryPath3) {
|
|
109833
109911
|
if (directoryPath3 === "~") {
|
|
109834
|
-
return
|
|
109912
|
+
return homedir20();
|
|
109835
109913
|
}
|
|
109836
109914
|
if (directoryPath3.startsWith("~/") || directoryPath3.startsWith("~\\")) {
|
|
109837
|
-
return path12.join(
|
|
109915
|
+
return path12.join(homedir20(), directoryPath3.slice(2));
|
|
109838
109916
|
}
|
|
109839
109917
|
return directoryPath3;
|
|
109840
109918
|
}
|
|
@@ -109891,10 +109969,10 @@ async function pathExists(dir) {
|
|
|
109891
109969
|
|
|
109892
109970
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
109893
109971
|
init_src2();
|
|
109894
|
-
import { existsSync as
|
|
109972
|
+
import { existsSync as existsSync58 } from "node:fs";
|
|
109895
109973
|
import { lstat as lstat15, readdir as readdir14, readFile as readFile27 } from "node:fs/promises";
|
|
109896
|
-
import { homedir as
|
|
109897
|
-
import { basename as basename11, join as
|
|
109974
|
+
import { homedir as homedir21 } from "node:os";
|
|
109975
|
+
import { basename as basename11, join as join83, resolve as resolve23 } from "node:path";
|
|
109898
109976
|
// packages/omo-opencode/package.json
|
|
109899
109977
|
var package_default3 = {
|
|
109900
109978
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -109959,13 +110037,13 @@ var CODEX_BIN_NAMES = [
|
|
|
109959
110037
|
"omo-git-bash-hook"
|
|
109960
110038
|
];
|
|
109961
110039
|
async function gatherCodexSummary(deps = {}) {
|
|
109962
|
-
const codexHome =
|
|
110040
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join83(homedir21(), ".codex"));
|
|
109963
110041
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
109964
110042
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
109965
110043
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
109966
|
-
const manifest2 = pluginRoot === null ? null : await readJson(
|
|
109967
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
109968
|
-
const configPath =
|
|
110044
|
+
const manifest2 = pluginRoot === null ? null : await readJson(join83(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
110045
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join83(pluginRoot, "lazycodex-install.json"));
|
|
110046
|
+
const configPath = join83(codexHome, "config.toml");
|
|
109969
110047
|
const pluginVersion = stringField(manifest2, "version");
|
|
109970
110048
|
return {
|
|
109971
110049
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -110022,7 +110100,7 @@ function buildCodexIssues(summary) {
|
|
|
110022
110100
|
if (summary.pluginRoot === null) {
|
|
110023
110101
|
issues.push({
|
|
110024
110102
|
title: "OMO Codex plugin is not installed",
|
|
110025
|
-
description: `Expected cached plugin at ${
|
|
110103
|
+
description: `Expected cached plugin at ${join83("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
110026
110104
|
fix: "Run: npx lazycodex-ai install",
|
|
110027
110105
|
severity: "error",
|
|
110028
110106
|
affects: ["plugin loading"]
|
|
@@ -110087,15 +110165,15 @@ function buildCodexIssues(summary) {
|
|
|
110087
110165
|
return issues;
|
|
110088
110166
|
}
|
|
110089
110167
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
110090
|
-
const pluginRoot =
|
|
110091
|
-
if (!
|
|
110168
|
+
const pluginRoot = join83(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
110169
|
+
if (!existsSync58(pluginRoot))
|
|
110092
110170
|
return null;
|
|
110093
110171
|
const versions2 = await readdir14(pluginRoot, { withFileTypes: true });
|
|
110094
110172
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
110095
|
-
return candidates.length === 0 ? null :
|
|
110173
|
+
return candidates.length === 0 ? null : join83(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
110096
110174
|
}
|
|
110097
110175
|
async function readCodexConfigSummary(configPath) {
|
|
110098
|
-
if (!
|
|
110176
|
+
if (!existsSync58(configPath)) {
|
|
110099
110177
|
return {
|
|
110100
110178
|
exists: false,
|
|
110101
110179
|
marketplaceConfigured: false,
|
|
@@ -110120,14 +110198,14 @@ async function readCodexConfigSummary(configPath) {
|
|
|
110120
110198
|
async function readLinkedBins(binDir) {
|
|
110121
110199
|
const linked = [];
|
|
110122
110200
|
for (const name of CODEX_BIN_NAMES) {
|
|
110123
|
-
if (await pathExists2(
|
|
110201
|
+
if (await pathExists2(join83(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
110124
110202
|
linked.push(name);
|
|
110125
110203
|
}
|
|
110126
110204
|
return linked;
|
|
110127
110205
|
}
|
|
110128
110206
|
async function readLinkedAgents(codexHome) {
|
|
110129
|
-
const agentsDir =
|
|
110130
|
-
if (!
|
|
110207
|
+
const agentsDir = join83(codexHome, "agents");
|
|
110208
|
+
if (!existsSync58(agentsDir))
|
|
110131
110209
|
return [];
|
|
110132
110210
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
110133
110211
|
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename11(entry.name, ".toml")).sort();
|
|
@@ -110241,8 +110319,8 @@ async function pathExists2(path14) {
|
|
|
110241
110319
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
110242
110320
|
init_src2();
|
|
110243
110321
|
import { readdir as readdir15, readFile as readFile28, stat as stat7 } from "node:fs/promises";
|
|
110244
|
-
import { homedir as
|
|
110245
|
-
import { dirname as
|
|
110322
|
+
import { homedir as homedir22 } from "node:os";
|
|
110323
|
+
import { dirname as dirname32, isAbsolute as isAbsolute12, join as join84, relative as relative9, resolve as resolve24, sep as sep9 } from "node:path";
|
|
110246
110324
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
110247
110325
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
110248
110326
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -110252,7 +110330,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
110252
110330
|
const env3 = deps.env ?? process.env;
|
|
110253
110331
|
const platform = deps.platform ?? process.platform;
|
|
110254
110332
|
const arch = deps.arch ?? process.arch;
|
|
110255
|
-
const codexHome =
|
|
110333
|
+
const codexHome = resolve24(deps.codexHome ?? env3["CODEX_HOME"] ?? join84(homedir22(), ".codex"));
|
|
110256
110334
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
110257
110335
|
if (summary.pluginRoot === null) {
|
|
110258
110336
|
return {
|
|
@@ -110277,7 +110355,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
110277
110355
|
});
|
|
110278
110356
|
}
|
|
110279
110357
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
110280
|
-
const runtimeSgPath =
|
|
110358
|
+
const runtimeSgPath = join84(runtimeSgDir, sgBinaryName(platform));
|
|
110281
110359
|
const sg = findSgBinarySync({
|
|
110282
110360
|
arch,
|
|
110283
110361
|
env: env3,
|
|
@@ -110316,8 +110394,8 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
110316
110394
|
const manifest2 = await readJson2(manifestPath);
|
|
110317
110395
|
if (manifest2 === null || !isRecord12(manifest2["mcpServers"]))
|
|
110318
110396
|
continue;
|
|
110319
|
-
const manifestRoot =
|
|
110320
|
-
const isRootManifest =
|
|
110397
|
+
const manifestRoot = dirname32(manifestPath);
|
|
110398
|
+
const isRootManifest = resolve24(manifestRoot) === resolve24(pluginRoot);
|
|
110321
110399
|
for (const server2 of Object.values(manifest2["mcpServers"])) {
|
|
110322
110400
|
if (!isRecord12(server2) || !Array.isArray(server2["args"]))
|
|
110323
110401
|
continue;
|
|
@@ -110337,7 +110415,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
110337
110415
|
continue;
|
|
110338
110416
|
const commands2 = [];
|
|
110339
110417
|
collectHookCommands(manifest2, commands2);
|
|
110340
|
-
const hookPluginRoot =
|
|
110418
|
+
const hookPluginRoot = dirname32(dirname32(hookManifestPath));
|
|
110341
110419
|
for (const command of commands2) {
|
|
110342
110420
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
110343
110421
|
referencedCount += 1;
|
|
@@ -110359,8 +110437,8 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
110359
110437
|
broken.push(entry);
|
|
110360
110438
|
}
|
|
110361
110439
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
110362
|
-
const targetPath =
|
|
110363
|
-
const bundleRootPath =
|
|
110440
|
+
const targetPath = resolve24(baseRoot, relativePath);
|
|
110441
|
+
const bundleRootPath = resolve24(bundleRoot);
|
|
110364
110442
|
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
110365
110443
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
110366
110444
|
if (allowEscape)
|
|
@@ -110376,7 +110454,7 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
110376
110454
|
}
|
|
110377
110455
|
async function findHookManifestPaths(root) {
|
|
110378
110456
|
const paths3 = await findManifestPaths(root, "hooks.json");
|
|
110379
|
-
return paths3.filter((path14) =>
|
|
110457
|
+
return paths3.filter((path14) => dirname32(path14).endsWith(`${sep9}hooks`));
|
|
110380
110458
|
}
|
|
110381
110459
|
async function findManifestPaths(root, manifestName) {
|
|
110382
110460
|
let entries;
|
|
@@ -110389,7 +110467,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
110389
110467
|
for (const entry of entries) {
|
|
110390
110468
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
110391
110469
|
continue;
|
|
110392
|
-
const entryPath =
|
|
110470
|
+
const entryPath = join84(root, entry.name);
|
|
110393
110471
|
if (entry.isDirectory()) {
|
|
110394
110472
|
paths3.push(...await findManifestPaths(entryPath, manifestName));
|
|
110395
110473
|
continue;
|
|
@@ -110433,18 +110511,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
110433
110511
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute12(arg));
|
|
110434
110512
|
}
|
|
110435
110513
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
110436
|
-
return
|
|
110514
|
+
return join84(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
110437
110515
|
}
|
|
110438
110516
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
110439
110517
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
110440
110518
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
110441
110519
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
110442
|
-
if (sgPath ===
|
|
110520
|
+
if (sgPath === join84(runtimeSgDir, sgBinaryName(platform)))
|
|
110443
110521
|
return "runtime dir";
|
|
110444
110522
|
return "PATH";
|
|
110445
110523
|
}
|
|
110446
110524
|
async function readBootstrapStateSummary(codexHome) {
|
|
110447
|
-
const statePath =
|
|
110525
|
+
const statePath = join84(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
110448
110526
|
const raw = await readJson2(statePath);
|
|
110449
110527
|
if (raw === null)
|
|
110450
110528
|
return null;
|
|
@@ -110520,24 +110598,24 @@ function isRecord12(value) {
|
|
|
110520
110598
|
}
|
|
110521
110599
|
|
|
110522
110600
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
110523
|
-
import { existsSync as
|
|
110601
|
+
import { existsSync as existsSync59 } from "node:fs";
|
|
110524
110602
|
import { readFile as readFile29 } from "node:fs/promises";
|
|
110525
|
-
import { homedir as
|
|
110526
|
-
import { join as
|
|
110603
|
+
import { homedir as homedir23 } from "node:os";
|
|
110604
|
+
import { join as join85, resolve as resolve25 } from "node:path";
|
|
110527
110605
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
110528
110606
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
110529
110607
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
110530
110608
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
110531
|
-
const codexHome =
|
|
110609
|
+
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join85(homedir23(), ".codex"));
|
|
110532
110610
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
110533
110611
|
const platform = deps.platform ?? process.platform;
|
|
110534
|
-
const wrapperPath =
|
|
110535
|
-
const legacyWrapperPath =
|
|
110612
|
+
const wrapperPath = join85(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
110613
|
+
const legacyWrapperPath = join85(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
110536
110614
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
110537
110615
|
const issues = [];
|
|
110538
110616
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
110539
110617
|
const targetPath = parseRuntimeTargetPath(wrapper);
|
|
110540
|
-
if (targetPath !== null && !
|
|
110618
|
+
if (targetPath !== null && !existsSync59(targetPath)) {
|
|
110541
110619
|
issues.push({
|
|
110542
110620
|
title: "omo-agent-toolkit runtime wrapper target is missing",
|
|
110543
110621
|
description: `Generated omo-agent-toolkit runtime wrapper at ${wrapperPath} points to missing target ${targetPath}.`,
|
|
@@ -111051,24 +111129,24 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
111051
111129
|
// packages/mcp-client-core/src/mcp-oauth/storage.ts
|
|
111052
111130
|
import { createHash as createHash6 } from "node:crypto";
|
|
111053
111131
|
import {
|
|
111054
|
-
chmodSync as
|
|
111055
|
-
existsSync as
|
|
111056
|
-
mkdirSync as
|
|
111132
|
+
chmodSync as chmodSync5,
|
|
111133
|
+
existsSync as existsSync62,
|
|
111134
|
+
mkdirSync as mkdirSync15,
|
|
111057
111135
|
readdirSync as readdirSync11,
|
|
111058
|
-
readFileSync as
|
|
111136
|
+
readFileSync as readFileSync39,
|
|
111059
111137
|
renameSync as renameSync7,
|
|
111060
111138
|
unlinkSync as unlinkSync9,
|
|
111061
|
-
writeFileSync as
|
|
111139
|
+
writeFileSync as writeFileSync12
|
|
111062
111140
|
} from "node:fs";
|
|
111063
|
-
import { basename as basename12, dirname as
|
|
111141
|
+
import { basename as basename12, dirname as dirname33, join as join88 } from "node:path";
|
|
111064
111142
|
|
|
111065
111143
|
// packages/mcp-client-core/src/config-dir.ts
|
|
111066
|
-
import { existsSync as
|
|
111067
|
-
import { homedir as
|
|
111068
|
-
import { join as
|
|
111144
|
+
import { existsSync as existsSync60, realpathSync as realpathSync8 } from "node:fs";
|
|
111145
|
+
import { homedir as homedir24 } from "node:os";
|
|
111146
|
+
import { join as join86, resolve as resolve26 } from "node:path";
|
|
111069
111147
|
function resolveConfigPath2(pathValue) {
|
|
111070
|
-
const resolvedPath =
|
|
111071
|
-
if (!
|
|
111148
|
+
const resolvedPath = resolve26(pathValue);
|
|
111149
|
+
if (!existsSync60(resolvedPath))
|
|
111072
111150
|
return resolvedPath;
|
|
111073
111151
|
try {
|
|
111074
111152
|
return realpathSync8(resolvedPath);
|
|
@@ -111083,13 +111161,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
111083
111161
|
if (customConfigDir) {
|
|
111084
111162
|
return resolveConfigPath2(customConfigDir);
|
|
111085
111163
|
}
|
|
111086
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
111087
|
-
return resolveConfigPath2(
|
|
111164
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join86(homedir24(), ".config");
|
|
111165
|
+
return resolveConfigPath2(join86(xdgConfigDir, "opencode"));
|
|
111088
111166
|
}
|
|
111089
111167
|
|
|
111090
111168
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
111091
|
-
import { chmodSync as
|
|
111092
|
-
import { join as
|
|
111169
|
+
import { chmodSync as chmodSync4, existsSync as existsSync61, readFileSync as readFileSync38, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "node:fs";
|
|
111170
|
+
import { join as join87 } from "node:path";
|
|
111093
111171
|
var INDEX_FILE_NAME = "index.json";
|
|
111094
111172
|
function isTokenIndex(value) {
|
|
111095
111173
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -111097,14 +111175,14 @@ function isTokenIndex(value) {
|
|
|
111097
111175
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
111098
111176
|
}
|
|
111099
111177
|
function getIndexPath(storageDir) {
|
|
111100
|
-
return
|
|
111178
|
+
return join87(storageDir, INDEX_FILE_NAME);
|
|
111101
111179
|
}
|
|
111102
111180
|
function readTokenIndex(storageDir) {
|
|
111103
111181
|
const indexPath = getIndexPath(storageDir);
|
|
111104
|
-
if (!
|
|
111182
|
+
if (!existsSync61(indexPath))
|
|
111105
111183
|
return {};
|
|
111106
111184
|
try {
|
|
111107
|
-
const parsed = JSON.parse(
|
|
111185
|
+
const parsed = JSON.parse(readFileSync38(indexPath, "utf-8"));
|
|
111108
111186
|
return isTokenIndex(parsed) ? parsed : {};
|
|
111109
111187
|
} catch (readError) {
|
|
111110
111188
|
if (!(readError instanceof Error))
|
|
@@ -111116,8 +111194,8 @@ function writeTokenIndex(storageDir, index) {
|
|
|
111116
111194
|
try {
|
|
111117
111195
|
const indexPath = getIndexPath(storageDir);
|
|
111118
111196
|
const tempPath = `${indexPath}.tmp.${Date.now()}`;
|
|
111119
|
-
|
|
111120
|
-
|
|
111197
|
+
writeFileSync11(tempPath, JSON.stringify(index, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111198
|
+
chmodSync4(tempPath, 384);
|
|
111121
111199
|
renameSync6(tempPath, indexPath);
|
|
111122
111200
|
return true;
|
|
111123
111201
|
} catch (writeError) {
|
|
@@ -111141,16 +111219,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
111141
111219
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
111142
111220
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
111143
111221
|
function getMcpOauthStorageDir() {
|
|
111144
|
-
return
|
|
111222
|
+
return join88(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
111145
111223
|
}
|
|
111146
111224
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
111147
111225
|
return createHash6("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
111148
111226
|
}
|
|
111149
111227
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
111150
|
-
return
|
|
111228
|
+
return join88(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
111151
111229
|
}
|
|
111152
111230
|
function getLegacyStoragePath() {
|
|
111153
|
-
return
|
|
111231
|
+
return join88(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
111154
111232
|
}
|
|
111155
111233
|
function normalizeHost2(serverHost) {
|
|
111156
111234
|
let host = serverHost.trim();
|
|
@@ -111211,10 +111289,10 @@ function isOAuthTokenData(value) {
|
|
|
111211
111289
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
111212
111290
|
}
|
|
111213
111291
|
function readTokenFile(filePath) {
|
|
111214
|
-
if (!
|
|
111292
|
+
if (!existsSync62(filePath))
|
|
111215
111293
|
return null;
|
|
111216
111294
|
try {
|
|
111217
|
-
const parsed = JSON.parse(
|
|
111295
|
+
const parsed = JSON.parse(readFileSync39(filePath, "utf-8"));
|
|
111218
111296
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
111219
111297
|
} catch (readError) {
|
|
111220
111298
|
if (!(readError instanceof Error))
|
|
@@ -111224,10 +111302,10 @@ function readTokenFile(filePath) {
|
|
|
111224
111302
|
}
|
|
111225
111303
|
function readLegacyStore() {
|
|
111226
111304
|
const filePath = getLegacyStoragePath();
|
|
111227
|
-
if (!
|
|
111305
|
+
if (!existsSync62(filePath))
|
|
111228
111306
|
return null;
|
|
111229
111307
|
try {
|
|
111230
|
-
const parsed = JSON.parse(
|
|
111308
|
+
const parsed = JSON.parse(readFileSync39(filePath, "utf-8"));
|
|
111231
111309
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
111232
111310
|
return null;
|
|
111233
111311
|
const result = {};
|
|
@@ -111244,13 +111322,13 @@ function readLegacyStore() {
|
|
|
111244
111322
|
}
|
|
111245
111323
|
function writeTokenFile(filePath, token) {
|
|
111246
111324
|
try {
|
|
111247
|
-
const dir =
|
|
111248
|
-
if (!
|
|
111249
|
-
|
|
111325
|
+
const dir = dirname33(filePath);
|
|
111326
|
+
if (!existsSync62(dir)) {
|
|
111327
|
+
mkdirSync15(dir, { recursive: true });
|
|
111250
111328
|
}
|
|
111251
111329
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
111252
|
-
|
|
111253
|
-
|
|
111330
|
+
writeFileSync12(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111331
|
+
chmodSync5(tempPath, 384);
|
|
111254
111332
|
renameSync7(tempPath, filePath);
|
|
111255
111333
|
return true;
|
|
111256
111334
|
} catch (writeError) {
|
|
@@ -111269,7 +111347,7 @@ function saveToken(serverHost, resource, token) {
|
|
|
111269
111347
|
}
|
|
111270
111348
|
function deleteToken(serverHost, resource) {
|
|
111271
111349
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
111272
|
-
if (!
|
|
111350
|
+
if (!existsSync62(filePath))
|
|
111273
111351
|
return deleteLegacyToken(serverHost, resource);
|
|
111274
111352
|
try {
|
|
111275
111353
|
unlinkSync9(filePath);
|
|
@@ -111291,7 +111369,7 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
111291
111369
|
if (Object.keys(store2).length === 0) {
|
|
111292
111370
|
try {
|
|
111293
111371
|
const filePath = getLegacyStoragePath();
|
|
111294
|
-
if (
|
|
111372
|
+
if (existsSync62(filePath))
|
|
111295
111373
|
unlinkSync9(filePath);
|
|
111296
111374
|
return true;
|
|
111297
111375
|
} catch (deleteError) {
|
|
@@ -111305,8 +111383,8 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
111305
111383
|
function writeLegacyStore(store2) {
|
|
111306
111384
|
try {
|
|
111307
111385
|
const filePath = getLegacyStoragePath();
|
|
111308
|
-
|
|
111309
|
-
|
|
111386
|
+
writeFileSync12(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111387
|
+
chmodSync5(filePath, 384);
|
|
111310
111388
|
return true;
|
|
111311
111389
|
} catch (writeError) {
|
|
111312
111390
|
if (!(writeError instanceof Error))
|
|
@@ -111329,7 +111407,7 @@ function listTokensByHost(serverHost) {
|
|
|
111329
111407
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
111330
111408
|
if (!indexedKey.startsWith(prefix))
|
|
111331
111409
|
continue;
|
|
111332
|
-
const indexedToken = readTokenFile(
|
|
111410
|
+
const indexedToken = readTokenFile(join88(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
111333
111411
|
if (indexedToken)
|
|
111334
111412
|
result[indexedKey] = indexedToken;
|
|
111335
111413
|
}
|
|
@@ -111338,13 +111416,13 @@ function listTokensByHost(serverHost) {
|
|
|
111338
111416
|
function listAllTokens() {
|
|
111339
111417
|
const result = { ...readLegacyStore() ?? {} };
|
|
111340
111418
|
const dir = getMcpOauthStorageDir();
|
|
111341
|
-
if (!
|
|
111419
|
+
if (!existsSync62(dir))
|
|
111342
111420
|
return result;
|
|
111343
111421
|
const index = readTokenIndex(dir);
|
|
111344
111422
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
111345
111423
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
111346
111424
|
continue;
|
|
111347
|
-
const token = readTokenFile(
|
|
111425
|
+
const token = readTokenFile(join88(dir, entry.name));
|
|
111348
111426
|
const hash2 = basename12(entry.name, ".json");
|
|
111349
111427
|
if (token)
|
|
111350
111428
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -111544,7 +111622,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
|
111544
111622
|
}
|
|
111545
111623
|
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
111546
111624
|
function startCallbackServer(port) {
|
|
111547
|
-
return new Promise((
|
|
111625
|
+
return new Promise((resolve27, reject) => {
|
|
111548
111626
|
let timeoutId;
|
|
111549
111627
|
const server2 = createServer2((request, response) => {
|
|
111550
111628
|
clearTimeout(timeoutId);
|
|
@@ -111570,7 +111648,7 @@ function startCallbackServer(port) {
|
|
|
111570
111648
|
response.writeHead(200, { "content-type": "text/html" });
|
|
111571
111649
|
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
|
|
111572
111650
|
server2.close();
|
|
111573
|
-
|
|
111651
|
+
resolve27({ code, state: state2 });
|
|
111574
111652
|
});
|
|
111575
111653
|
timeoutId = setTimeout(() => {
|
|
111576
111654
|
server2.close();
|
|
@@ -111910,7 +111988,7 @@ function createMcpOAuthCommand() {
|
|
|
111910
111988
|
}
|
|
111911
111989
|
|
|
111912
111990
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
111913
|
-
import { existsSync as
|
|
111991
|
+
import { existsSync as existsSync63 } from "node:fs";
|
|
111914
111992
|
|
|
111915
111993
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
111916
111994
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -112047,10 +112125,10 @@ async function boulder(options) {
|
|
|
112047
112125
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
112048
112126
|
const state2 = readBoulderState(directory);
|
|
112049
112127
|
if (!state2) {
|
|
112050
|
-
const message =
|
|
112128
|
+
const message = existsSync63(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
112051
112129
|
process.stderr.write(`${message}
|
|
112052
112130
|
`);
|
|
112053
|
-
return
|
|
112131
|
+
return existsSync63(boulderFilePath) ? 2 : 1;
|
|
112054
112132
|
}
|
|
112055
112133
|
const works = getBoulderWorks(state2);
|
|
112056
112134
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -112068,12 +112146,12 @@ async function boulder(options) {
|
|
|
112068
112146
|
}
|
|
112069
112147
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
112070
112148
|
import { spawn as spawn5 } from "node:child_process";
|
|
112071
|
-
import { existsSync as
|
|
112072
|
-
import { homedir as
|
|
112149
|
+
import { existsSync as existsSync64, readFileSync as readFileSync40, realpathSync as realpathSync9 } from "node:fs";
|
|
112150
|
+
import { homedir as homedir25 } from "node:os";
|
|
112073
112151
|
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
|
|
112074
112152
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
112075
112153
|
const env3 = input.env ?? process.env;
|
|
112076
|
-
const homeDir = input.homeDir ??
|
|
112154
|
+
const homeDir = input.homeDir ?? homedir25();
|
|
112077
112155
|
const localComponentBin = resolveLocalUlwLoopBin(env3, homeDir);
|
|
112078
112156
|
if (localComponentBin !== null)
|
|
112079
112157
|
return { executable: localComponentBin, argsPrefix: [] };
|
|
@@ -112096,29 +112174,29 @@ async function codexUlwLoop(args) {
|
|
|
112096
112174
|
console.error("Codex ulw-loop is not installed. Run: npx lazycodex-ai@latest install --no-tui");
|
|
112097
112175
|
return 1;
|
|
112098
112176
|
}
|
|
112099
|
-
const { promise: promise2, resolve:
|
|
112177
|
+
const { promise: promise2, resolve: resolve27 } = Promise.withResolvers();
|
|
112100
112178
|
const child = spawn5(command.executable, [...command.argsPrefix, ...args], {
|
|
112101
112179
|
stdio: "inherit",
|
|
112102
112180
|
env: { ...process.env, [ULW_LOOP_DELEGATION_SENTINEL]: "1" }
|
|
112103
112181
|
});
|
|
112104
112182
|
child.on("error", (error51) => {
|
|
112105
112183
|
console.error(error51.message);
|
|
112106
|
-
|
|
112184
|
+
resolve27(1);
|
|
112107
112185
|
});
|
|
112108
|
-
child.on("close", (code) =>
|
|
112186
|
+
child.on("close", (code) => resolve27(code ?? 1));
|
|
112109
112187
|
return promise2;
|
|
112110
112188
|
}
|
|
112111
112189
|
function resolveLocalUlwLoopBin(env3, homeDir) {
|
|
112112
112190
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo-ulw-loop", env: env3, homeDir });
|
|
112113
|
-
return candidates.find((candidate2) =>
|
|
112191
|
+
return candidates.find((candidate2) => existsSync64(candidate2)) ?? null;
|
|
112114
112192
|
}
|
|
112115
112193
|
function resolveLegacyLocalOmoBin(env3, homeDir, currentExecutablePaths) {
|
|
112116
112194
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo", env: env3, homeDir });
|
|
112117
|
-
return candidates.find((candidate2) =>
|
|
112195
|
+
return candidates.find((candidate2) => existsSync64(candidate2) && !isCurrentExecutable(candidate2, currentExecutablePaths) && !isGeneratedRuntimeWrapper(candidate2)) ?? null;
|
|
112118
112196
|
}
|
|
112119
112197
|
function isGeneratedRuntimeWrapper(candidate2) {
|
|
112120
112198
|
try {
|
|
112121
|
-
return
|
|
112199
|
+
return readFileSync40(candidate2, "utf8").includes(RUNTIME_WRAPPER_MARKER);
|
|
112122
112200
|
} catch (error51) {
|
|
112123
112201
|
if (error51 instanceof Error)
|
|
112124
112202
|
return false;
|