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/index.js
CHANGED
|
@@ -2145,7 +2145,7 @@ var package_default;
|
|
|
2145
2145
|
var init_package = __esm(() => {
|
|
2146
2146
|
package_default = {
|
|
2147
2147
|
name: "oh-my-opencode",
|
|
2148
|
-
version: "5.0.0-beta.
|
|
2148
|
+
version: "5.0.0-beta.5",
|
|
2149
2149
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2150
2150
|
main: "./dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -2325,7 +2325,7 @@ var init_package = __esm(() => {
|
|
|
2325
2325
|
zod: "^4.4.3"
|
|
2326
2326
|
},
|
|
2327
2327
|
devDependencies: {
|
|
2328
|
-
"@code-yeongyu/senpi": "2026.8.
|
|
2328
|
+
"@code-yeongyu/senpi": "2026.8.11-2",
|
|
2329
2329
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
2330
2330
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
2331
2331
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -2365,18 +2365,18 @@ var init_package = __esm(() => {
|
|
|
2365
2365
|
typescript: "^7.0.2"
|
|
2366
2366
|
},
|
|
2367
2367
|
optionalDependencies: {
|
|
2368
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
2369
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
2370
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
2371
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
2372
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
2373
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
2374
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
2375
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
2376
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
2377
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
2378
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
2379
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
2368
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.5",
|
|
2369
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.5",
|
|
2370
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.5",
|
|
2371
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.5",
|
|
2372
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.5",
|
|
2373
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.5",
|
|
2374
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.5",
|
|
2375
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.5",
|
|
2376
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.5",
|
|
2377
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.5",
|
|
2378
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.5",
|
|
2379
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.5"
|
|
2380
2380
|
},
|
|
2381
2381
|
overrides: {
|
|
2382
2382
|
"@earendil-works/pi-agent-core": "0.80.3",
|
|
@@ -22454,6 +22454,7 @@ var init_memory = __esm(() => {
|
|
|
22454
22454
|
OmoMemorySettingsSchema = object({
|
|
22455
22455
|
enabled: boolean2().default(true),
|
|
22456
22456
|
agent: string2().min(1).default("auto"),
|
|
22457
|
+
tool_exposure: _enum2(["direct", "search"]).default("direct"),
|
|
22457
22458
|
reflection: OmoMemoryReflectionSchema.default({
|
|
22458
22459
|
trigger: { step_count: 0, on_compaction: true },
|
|
22459
22460
|
merge: "auto",
|
|
@@ -22469,6 +22470,7 @@ var init_memory = __esm(() => {
|
|
|
22469
22470
|
OmoMemorySettingsLayerSchema = object({
|
|
22470
22471
|
enabled: boolean2().optional(),
|
|
22471
22472
|
agent: string2().min(1).optional(),
|
|
22473
|
+
tool_exposure: _enum2(["direct", "search"]).optional(),
|
|
22472
22474
|
reflection: OmoMemoryReflectionLayerSchema.optional(),
|
|
22473
22475
|
sync: OmoMemorySyncLayerSchema.optional(),
|
|
22474
22476
|
search: OmoMemorySearchLayerSchema.optional(),
|
|
@@ -94439,7 +94441,7 @@ var package_default2;
|
|
|
94439
94441
|
var init_package2 = __esm(() => {
|
|
94440
94442
|
package_default2 = {
|
|
94441
94443
|
name: "@oh-my-opencode/omo-codex",
|
|
94442
|
-
version: "5.0.0-beta.
|
|
94444
|
+
version: "5.0.0-beta.5",
|
|
94443
94445
|
type: "module",
|
|
94444
94446
|
private: true,
|
|
94445
94447
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -95408,20 +95410,20 @@ var init_update_toasts = __esm(() => {
|
|
|
95408
95410
|
});
|
|
95409
95411
|
|
|
95410
95412
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
95411
|
-
import { existsSync as
|
|
95412
|
-
import { dirname as
|
|
95413
|
+
import { existsSync as existsSync47 } from "fs";
|
|
95414
|
+
import { dirname as dirname29, join as join74 } from "path";
|
|
95413
95415
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
95414
95416
|
function defaultGetModuleHostingWorkspace() {
|
|
95415
95417
|
try {
|
|
95416
|
-
const currentDir =
|
|
95418
|
+
const currentDir = dirname29(fileURLToPath5(import.meta.url));
|
|
95417
95419
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
95418
95420
|
if (!pkgJsonPath)
|
|
95419
95421
|
return null;
|
|
95420
|
-
const pkgDir =
|
|
95421
|
-
const nodeModulesDir =
|
|
95422
|
+
const pkgDir = dirname29(pkgJsonPath);
|
|
95423
|
+
const nodeModulesDir = dirname29(pkgDir);
|
|
95422
95424
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
95423
95425
|
return null;
|
|
95424
|
-
return
|
|
95426
|
+
return dirname29(nodeModulesDir);
|
|
95425
95427
|
} catch (error51) {
|
|
95426
95428
|
if (error51 instanceof Error) {
|
|
95427
95429
|
return null;
|
|
@@ -95562,8 +95564,8 @@ var init_background_update_check = __esm(() => {
|
|
|
95562
95564
|
init_package_json_locator();
|
|
95563
95565
|
init_update_toasts();
|
|
95564
95566
|
defaultDeps4 = {
|
|
95565
|
-
existsSync:
|
|
95566
|
-
join:
|
|
95567
|
+
existsSync: existsSync47,
|
|
95568
|
+
join: join74,
|
|
95567
95569
|
runBunInstallWithDetails,
|
|
95568
95570
|
log: log2,
|
|
95569
95571
|
getOpenCodeCacheDir,
|
|
@@ -95726,7 +95728,7 @@ async function showSpinnerToast(ctx, version3, message) {
|
|
|
95726
95728
|
duration: frameInterval + 50
|
|
95727
95729
|
}
|
|
95728
95730
|
}).catch(ignoreToastError);
|
|
95729
|
-
await new Promise((
|
|
95731
|
+
await new Promise((resolve21) => setTimeout(resolve21, frameInterval));
|
|
95730
95732
|
}
|
|
95731
95733
|
}
|
|
95732
95734
|
var SISYPHUS_SPINNER;
|
|
@@ -101339,21 +101341,93 @@ var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", ".
|
|
|
101339
101341
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
101340
101342
|
import { execFile as execFile4 } from "child_process";
|
|
101341
101343
|
import { createHash as createHash5 } from "crypto";
|
|
101342
|
-
import { constants as constants8, existsSync as
|
|
101344
|
+
import { constants as constants8, existsSync as existsSync31 } from "fs";
|
|
101343
101345
|
import { access as access2, readFile as readFile26, stat as stat6 } from "fs/promises";
|
|
101344
|
-
import { homedir as
|
|
101345
|
-
import { dirname as
|
|
101346
|
+
import { homedir as homedir10 } from "os";
|
|
101347
|
+
import { dirname as dirname23, join as join61, resolve as resolve19 } from "path";
|
|
101346
101348
|
import { fileURLToPath } from "url";
|
|
101347
101349
|
import { promisify as promisify2 } from "util";
|
|
101348
101350
|
|
|
101351
|
+
// packages/omo-senpi/src/install/local-launcher.ts
|
|
101352
|
+
import { chmodSync as chmodSync3, existsSync as existsSync30, mkdirSync as mkdirSync10, readFileSync as readFileSync14, rmSync, writeFileSync as writeFileSync6 } from "fs";
|
|
101353
|
+
import { homedir as homedir9 } from "os";
|
|
101354
|
+
import { dirname as dirname21, join as join59, resolve as resolve17 } from "path";
|
|
101355
|
+
var MARKER = "omo-local-launcher";
|
|
101356
|
+
function localLauncherPath(homeDir = homedir9()) {
|
|
101357
|
+
return join59(homeDir, ".local", "bin", "omo");
|
|
101358
|
+
}
|
|
101359
|
+
function localLauncherCmdPath(homeDir = homedir9()) {
|
|
101360
|
+
return join59(homeDir, ".local", "bin", "omo.cmd");
|
|
101361
|
+
}
|
|
101362
|
+
function renderLocalLauncher(options) {
|
|
101363
|
+
const brand = {
|
|
101364
|
+
name: "omo",
|
|
101365
|
+
displayVersion: options.version ?? "local",
|
|
101366
|
+
configDir: ".omo",
|
|
101367
|
+
flatLayout: true,
|
|
101368
|
+
envPrefix: "OMO",
|
|
101369
|
+
userAgent: "omo",
|
|
101370
|
+
originator: "omo",
|
|
101371
|
+
update: {
|
|
101372
|
+
packageName: "omo-ai",
|
|
101373
|
+
distTag: "beta",
|
|
101374
|
+
command: "npm i -g omo-ai@beta",
|
|
101375
|
+
changelogUrl: "https://github.com/code-yeongyu/oh-my-openagent/releases"
|
|
101376
|
+
}
|
|
101377
|
+
};
|
|
101378
|
+
return `#!/usr/bin/env node
|
|
101379
|
+
// ${MARKER}: generated by the omo-senpi installer. Delete this file to remove the local launcher.
|
|
101380
|
+
import { spawn } from "node:child_process"
|
|
101381
|
+
|
|
101382
|
+
const brand = ${JSON.stringify(brand)}
|
|
101383
|
+
const cli = process.env.OMO_SENPI_CLI_PATH ?? ${JSON.stringify(options.senpiCliPath)}
|
|
101384
|
+
const plugin = process.env.OMO_PLUGIN_ROOT ?? ${JSON.stringify(options.pluginPath)}
|
|
101385
|
+
const env = { ...process.env, SENPI_BRAND: JSON.stringify(brand), OMO_NATIVE: "1" }
|
|
101386
|
+
// Anything resolving the product by name must re-enter through this launcher, never the engine.
|
|
101387
|
+
env.OMO_BIN = process.argv[1]
|
|
101388
|
+
const selfUpdate = process.argv[2] === "update"
|
|
101389
|
+
&& process.argv.slice(3).every((arg) => arg.startsWith("-") || ["self", "senpi", "omo"].includes(arg))
|
|
101390
|
+
&& !process.argv.slice(3).some((arg) => arg === "--extensions" || arg === "--models")
|
|
101391
|
+
if (selfUpdate) {
|
|
101392
|
+
console.log("omo is updated via npm: npm i -g omo-ai@beta")
|
|
101393
|
+
process.exit(0)
|
|
101394
|
+
}
|
|
101395
|
+
const child = spawn(process.execPath, [cli, "--extension", plugin, ...process.argv.slice(2)], {
|
|
101396
|
+
env,
|
|
101397
|
+
stdio: "inherit",
|
|
101398
|
+
})
|
|
101399
|
+
child.on("close", (code, signal) => {
|
|
101400
|
+
if (signal) {
|
|
101401
|
+
process.kill(process.pid, signal)
|
|
101402
|
+
return
|
|
101403
|
+
}
|
|
101404
|
+
process.exitCode = code ?? 1
|
|
101405
|
+
})
|
|
101406
|
+
`;
|
|
101407
|
+
}
|
|
101408
|
+
function installLocalLauncher(options) {
|
|
101409
|
+
const path6 = localLauncherPath(options.homeDir);
|
|
101410
|
+
if (existsSync30(path6) && !readFileSync14(path6, "utf8").includes(MARKER))
|
|
101411
|
+
return;
|
|
101412
|
+
mkdirSync10(dirname21(path6), { recursive: true });
|
|
101413
|
+
writeFileSync6(path6, renderLocalLauncher(options));
|
|
101414
|
+
chmodSync3(path6, 493);
|
|
101415
|
+
if ((options.platform ?? process.platform) === "win32") {
|
|
101416
|
+
writeFileSync6(localLauncherCmdPath(options.homeDir), `@echo off\r
|
|
101417
|
+
node "%~dp0omo" %*\r
|
|
101418
|
+
`);
|
|
101419
|
+
}
|
|
101420
|
+
return path6;
|
|
101421
|
+
}
|
|
101422
|
+
|
|
101349
101423
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
101350
101424
|
import { constants as constants7 } from "fs";
|
|
101351
101425
|
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile25, rename as rename5, writeFile as writeFile14 } from "fs/promises";
|
|
101352
|
-
import { dirname as
|
|
101426
|
+
import { dirname as dirname22, join as join60, resolve as resolve18 } from "path";
|
|
101353
101427
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
101354
101428
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
101355
|
-
|
|
101356
|
-
|
|
101429
|
+
join60("packages", "pi-goal"),
|
|
101430
|
+
join60("packages", "pi-webfetch")
|
|
101357
101431
|
];
|
|
101358
101432
|
async function readSettings(settingsPath) {
|
|
101359
101433
|
let raw;
|
|
@@ -101382,13 +101456,13 @@ function dedupePackages(packages) {
|
|
|
101382
101456
|
return [...new Set(packages)];
|
|
101383
101457
|
}
|
|
101384
101458
|
function removeLegacyBuiltinShadows(packages, repoRoot, agentDir) {
|
|
101385
|
-
const shadowPaths = new Set(LEGACY_BUILTIN_SHADOW_PACKAGES.map((path6) =>
|
|
101386
|
-
return packages.filter((entry) => !shadowPaths.has(
|
|
101459
|
+
const shadowPaths = new Set(LEGACY_BUILTIN_SHADOW_PACKAGES.map((path6) => resolve18(repoRoot, path6)));
|
|
101460
|
+
return packages.filter((entry) => !shadowPaths.has(resolve18(agentDir, entry)));
|
|
101387
101461
|
}
|
|
101388
101462
|
async function removeSupersededOmoPackages(packages, currentPluginPath, agentDir) {
|
|
101389
|
-
const currentPath =
|
|
101463
|
+
const currentPath = resolve18(currentPluginPath);
|
|
101390
101464
|
const entries = await Promise.all(packages.map(async (entry) => {
|
|
101391
|
-
const packagePath =
|
|
101465
|
+
const packagePath = resolve18(agentDir, entry);
|
|
101392
101466
|
if (packagePath === currentPath)
|
|
101393
101467
|
return currentPath;
|
|
101394
101468
|
return await readPackageName(packagePath) === OMO_SENPI_PACKAGE_NAME ? undefined : entry;
|
|
@@ -101396,7 +101470,7 @@ async function removeSupersededOmoPackages(packages, currentPluginPath, agentDir
|
|
|
101396
101470
|
return entries.filter((entry) => entry !== undefined);
|
|
101397
101471
|
}
|
|
101398
101472
|
async function writeSettingsAtomically(settingsPath, settings) {
|
|
101399
|
-
await mkdir9(
|
|
101473
|
+
await mkdir9(dirname22(settingsPath), { recursive: true });
|
|
101400
101474
|
const backupPath = await nextBackupPath(settingsPath);
|
|
101401
101475
|
if (await fileExists(settingsPath)) {
|
|
101402
101476
|
await copyFile3(settingsPath, backupPath);
|
|
@@ -101428,7 +101502,7 @@ function isRecord10(value) {
|
|
|
101428
101502
|
async function readPackageName(packagePath) {
|
|
101429
101503
|
let raw;
|
|
101430
101504
|
try {
|
|
101431
|
-
raw = await readFile25(
|
|
101505
|
+
raw = await readFile25(join60(packagePath, "package.json"), "utf8");
|
|
101432
101506
|
} catch (error51) {
|
|
101433
101507
|
if (isErrno(error51, "ENOENT") || isErrno(error51, "ENOTDIR"))
|
|
101434
101508
|
return;
|
|
@@ -101454,39 +101528,39 @@ function isErrno(error51, code) {
|
|
|
101454
101528
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
101455
101529
|
var execFileAsync2 = promisify2(execFile4);
|
|
101456
101530
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
101457
|
-
|
|
101458
|
-
|
|
101459
|
-
|
|
101460
|
-
|
|
101461
|
-
|
|
101462
|
-
|
|
101463
|
-
|
|
101464
|
-
|
|
101465
|
-
|
|
101466
|
-
|
|
101467
|
-
|
|
101468
|
-
|
|
101469
|
-
|
|
101470
|
-
|
|
101471
|
-
|
|
101472
|
-
|
|
101473
|
-
|
|
101474
|
-
|
|
101475
|
-
|
|
101476
|
-
|
|
101477
|
-
|
|
101478
|
-
|
|
101479
|
-
|
|
101480
|
-
|
|
101481
|
-
|
|
101482
|
-
|
|
101483
|
-
|
|
101484
|
-
|
|
101485
|
-
|
|
101486
|
-
|
|
101487
|
-
|
|
101488
|
-
|
|
101489
|
-
|
|
101531
|
+
join61("extensions", "omo.js"),
|
|
101532
|
+
join61("extensions", "reflection-persona.md"),
|
|
101533
|
+
join61("skills", "ast-grep", "SKILL.md"),
|
|
101534
|
+
join61("skills", "coding-agent-sessions", "SKILL.md"),
|
|
101535
|
+
join61("skills", "debugging", "SKILL.md"),
|
|
101536
|
+
join61("skills", "frontend", "SKILL.md"),
|
|
101537
|
+
join61("skills", "git-master", "SKILL.md"),
|
|
101538
|
+
join61("skills", "init-deep", "SKILL.md"),
|
|
101539
|
+
join61("skills", "lsp-setup", "SKILL.md"),
|
|
101540
|
+
join61("skills", "programming", "SKILL.md"),
|
|
101541
|
+
join61("skills", "refactor", "SKILL.md"),
|
|
101542
|
+
join61("skills", "remove-ai-slops", "SKILL.md"),
|
|
101543
|
+
join61("skills", "review-work", "SKILL.md"),
|
|
101544
|
+
join61("skills", "start-work", "SKILL.md"),
|
|
101545
|
+
join61("skills", "ultimate-browsing", "SKILL.md"),
|
|
101546
|
+
join61("skills", "ultrawork", "SKILL.md"),
|
|
101547
|
+
join61("skills", "ulw-loop", "SKILL.md"),
|
|
101548
|
+
join61("skills", "ulw-plan", "SKILL.md"),
|
|
101549
|
+
join61("skills", "ulw-research", "SKILL.md"),
|
|
101550
|
+
join61("skills", "visual-qa", "SKILL.md"),
|
|
101551
|
+
join61("runtime", "ast-grep-mcp", "cli.js"),
|
|
101552
|
+
join61("runtime", "agent-toolkit", "cli.js"),
|
|
101553
|
+
join61("runtime", "agent-toolkit", "ulw-loop", "cli.js"),
|
|
101554
|
+
join61("runtime", "agent-toolkit", "omo-agent-toolkit"),
|
|
101555
|
+
join61("runtime", "agent-toolkit", "omo-agent-toolkit.cmd"),
|
|
101556
|
+
join61("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
101557
|
+
join61("runtime", "lsp-daemon", "dist", "index.js"),
|
|
101558
|
+
join61("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
101559
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
101560
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
101561
|
+
join61("runtime", "lsp-daemon", "dist", "package.json"),
|
|
101562
|
+
join61("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
101563
|
+
join61("scripts", "install.mjs")
|
|
101490
101564
|
];
|
|
101491
101565
|
async function runSenpiInstaller(options = {}) {
|
|
101492
101566
|
const context = resolveInstallContext(options);
|
|
@@ -101498,6 +101572,10 @@ async function runSenpiInstaller(options = {}) {
|
|
|
101498
101572
|
packages.push(context.pluginPath);
|
|
101499
101573
|
settings.packages = packages;
|
|
101500
101574
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
101575
|
+
installLocalLauncher({
|
|
101576
|
+
pluginPath: context.pluginPath,
|
|
101577
|
+
senpiCliPath: join61(context.repoRoot, "packages", "coding-agent", "dist", "cli.js")
|
|
101578
|
+
});
|
|
101501
101579
|
return {
|
|
101502
101580
|
ok: true,
|
|
101503
101581
|
action: "install",
|
|
@@ -101511,14 +101589,14 @@ async function runSenpiInstaller(options = {}) {
|
|
|
101511
101589
|
function resolveInstallContext(options) {
|
|
101512
101590
|
const env3 = options.env ?? process.env;
|
|
101513
101591
|
const allowBuild = options.pluginPath === undefined;
|
|
101514
|
-
const repoRoot =
|
|
101515
|
-
const agentDir =
|
|
101516
|
-
const pluginPath =
|
|
101592
|
+
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname23(fileURLToPath(import.meta.url))) : dirname23(resolve19(options.pluginPath))));
|
|
101593
|
+
const agentDir = resolve19(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ?? join61(homedir10(), ".senpi", "agent"));
|
|
101594
|
+
const pluginPath = resolve19(options.pluginPath ?? join61(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
101517
101595
|
return {
|
|
101518
101596
|
env: env3,
|
|
101519
101597
|
repoRoot,
|
|
101520
101598
|
agentDir,
|
|
101521
|
-
settingsPath:
|
|
101599
|
+
settingsPath: join61(agentDir, "settings.json"),
|
|
101522
101600
|
pluginPath,
|
|
101523
101601
|
platform: options.platform ?? process.platform,
|
|
101524
101602
|
allowBuild,
|
|
@@ -101527,13 +101605,13 @@ function resolveInstallContext(options) {
|
|
|
101527
101605
|
}
|
|
101528
101606
|
async function ensurePluginArtifacts(context) {
|
|
101529
101607
|
if (context.allowBuild) {
|
|
101530
|
-
await context.runCommand("node", [
|
|
101531
|
-
await context.runCommand("node", [
|
|
101532
|
-
await context.runCommand("node", [
|
|
101533
|
-
await context.runCommand("node", [
|
|
101534
|
-
await context.runCommand("node", [
|
|
101535
|
-
await context.runCommand("node", [
|
|
101536
|
-
await context.runCommand("node", [
|
|
101608
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
101609
|
+
await context.runCommand("node", [join61("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
101610
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
101611
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
101612
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
101613
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
101614
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-agent-toolkit.mjs")], { cwd: context.repoRoot });
|
|
101537
101615
|
}
|
|
101538
101616
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
101539
101617
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -101542,14 +101620,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
101542
101620
|
}
|
|
101543
101621
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
101544
101622
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
101545
|
-
if (!await fileExists2(
|
|
101623
|
+
if (!await fileExists2(join61(pluginPath, artifact)))
|
|
101546
101624
|
return true;
|
|
101547
101625
|
}
|
|
101548
101626
|
return false;
|
|
101549
101627
|
}
|
|
101550
101628
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
101551
|
-
const runtimeEntry =
|
|
101552
|
-
const manifestPath =
|
|
101629
|
+
const runtimeEntry = join61(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
101630
|
+
const manifestPath = join61(dirname23(runtimeEntry), "manifest.json");
|
|
101553
101631
|
let runtimeStat;
|
|
101554
101632
|
try {
|
|
101555
101633
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -101606,9 +101684,9 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
101606
101684
|
function findRepoRoot2(importerDir) {
|
|
101607
101685
|
let current = importerDir;
|
|
101608
101686
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
101609
|
-
if (fileExistsSync(
|
|
101687
|
+
if (fileExistsSync(join61(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
101610
101688
|
return current;
|
|
101611
|
-
current =
|
|
101689
|
+
current = resolve19(current, "..");
|
|
101612
101690
|
}
|
|
101613
101691
|
throw new Error("Unable to locate packages/omo-senpi/plugin/package.json from installer module");
|
|
101614
101692
|
}
|
|
@@ -101623,7 +101701,7 @@ async function fileExists2(path6) {
|
|
|
101623
101701
|
}
|
|
101624
101702
|
}
|
|
101625
101703
|
function fileExistsSync(path6) {
|
|
101626
|
-
return
|
|
101704
|
+
return existsSync31(path6);
|
|
101627
101705
|
}
|
|
101628
101706
|
function isErrno2(error51, code) {
|
|
101629
101707
|
return error51 instanceof Error && "code" in error51 && error51.code === code;
|
|
@@ -101662,26 +101740,26 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
101662
101740
|
init_provider_availability();
|
|
101663
101741
|
|
|
101664
101742
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
101665
|
-
import { existsSync as
|
|
101666
|
-
import { join as
|
|
101743
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as readFileSync16 } from "fs";
|
|
101744
|
+
import { join as join63 } from "path";
|
|
101667
101745
|
|
|
101668
101746
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
101669
101747
|
init_shared();
|
|
101670
|
-
import { existsSync as
|
|
101671
|
-
import { join as
|
|
101748
|
+
import { existsSync as existsSync32, readFileSync as readFileSync15 } from "fs";
|
|
101749
|
+
import { join as join62 } from "path";
|
|
101672
101750
|
var TUI_SUBPATH = "tui";
|
|
101673
101751
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
101674
101752
|
function fileEntryPackageJsonPath(entry) {
|
|
101675
101753
|
let path6 = entry.slice("file:".length);
|
|
101676
101754
|
if (path6.startsWith("//"))
|
|
101677
101755
|
path6 = path6.slice(2);
|
|
101678
|
-
return
|
|
101756
|
+
return join62(path6, "package.json");
|
|
101679
101757
|
}
|
|
101680
101758
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
101681
|
-
if (!
|
|
101759
|
+
if (!existsSync32(pkgJsonPath))
|
|
101682
101760
|
return null;
|
|
101683
101761
|
try {
|
|
101684
|
-
const parsed = JSON.parse(
|
|
101762
|
+
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
101685
101763
|
if (parsed.exports === undefined)
|
|
101686
101764
|
return null;
|
|
101687
101765
|
if (typeof parsed.exports === "string")
|
|
@@ -101713,16 +101791,16 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
101713
101791
|
const packageName = packageNameFromServerEntry(entry);
|
|
101714
101792
|
if (packageName === null)
|
|
101715
101793
|
return null;
|
|
101716
|
-
return packageJsonExportsTui(
|
|
101794
|
+
return packageJsonExportsTui(join62(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
101717
101795
|
}
|
|
101718
101796
|
function isOurFilePluginEntry(entry) {
|
|
101719
101797
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
101720
101798
|
return false;
|
|
101721
101799
|
try {
|
|
101722
101800
|
const pkgJsonPath = fileEntryPackageJsonPath(entry);
|
|
101723
|
-
if (!
|
|
101801
|
+
if (!existsSync32(pkgJsonPath))
|
|
101724
101802
|
return false;
|
|
101725
|
-
const parsed = JSON.parse(
|
|
101803
|
+
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
101726
101804
|
return typeof parsed.name === "string" && ACCEPTED_PACKAGE_NAMES.includes(parsed.name);
|
|
101727
101805
|
} catch (error51) {
|
|
101728
101806
|
log2("[tui-plugin-config] Failed to inspect file plugin package", {
|
|
@@ -101755,12 +101833,12 @@ function isCanonicalNamedTuiPluginEntry(entry) {
|
|
|
101755
101833
|
}
|
|
101756
101834
|
function detectServerPluginRegistration() {
|
|
101757
101835
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
101758
|
-
const configPath =
|
|
101836
|
+
const configPath = existsSync32(paths2.configJsonc) ? paths2.configJsonc : existsSync32(paths2.configJson) ? paths2.configJson : null;
|
|
101759
101837
|
if (!configPath) {
|
|
101760
101838
|
return { registered: false, configPath: null, entry: null, packageExportsTui: null };
|
|
101761
101839
|
}
|
|
101762
101840
|
try {
|
|
101763
|
-
const parsed = parseJsonc(
|
|
101841
|
+
const parsed = parseJsonc(readFileSync15(configPath, "utf-8"));
|
|
101764
101842
|
const plugins = parsed.plugin ?? [];
|
|
101765
101843
|
const serverEntry = plugins.find(isServerPluginEntry);
|
|
101766
101844
|
return {
|
|
@@ -101778,8 +101856,8 @@ function detectServerPluginRegistration() {
|
|
|
101778
101856
|
}
|
|
101779
101857
|
}
|
|
101780
101858
|
function detectTuiPluginRegistration() {
|
|
101781
|
-
const tuiJsonPath =
|
|
101782
|
-
if (!
|
|
101859
|
+
const tuiJsonPath = join62(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
101860
|
+
if (!existsSync32(tuiJsonPath)) {
|
|
101783
101861
|
return {
|
|
101784
101862
|
registered: false,
|
|
101785
101863
|
configPath: tuiJsonPath,
|
|
@@ -101790,7 +101868,7 @@ function detectTuiPluginRegistration() {
|
|
|
101790
101868
|
};
|
|
101791
101869
|
}
|
|
101792
101870
|
try {
|
|
101793
|
-
const parsed = parseJsonc(
|
|
101871
|
+
const parsed = parseJsonc(readFileSync15(tuiJsonPath, "utf-8"));
|
|
101794
101872
|
const plugins = parsed.plugin ?? [];
|
|
101795
101873
|
return {
|
|
101796
101874
|
registered: plugins.some(isTuiPluginEntry),
|
|
@@ -101923,7 +102001,7 @@ init_shared();
|
|
|
101923
102001
|
init_write_file_atomically();
|
|
101924
102002
|
function readConfig(path6) {
|
|
101925
102003
|
try {
|
|
101926
|
-
const parsed = parseJsonc(
|
|
102004
|
+
const parsed = parseJsonc(readFileSync16(path6, "utf-8"));
|
|
101927
102005
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
101928
102006
|
return parsed;
|
|
101929
102007
|
}
|
|
@@ -101934,11 +102012,11 @@ function readConfig(path6) {
|
|
|
101934
102012
|
return null;
|
|
101935
102013
|
}
|
|
101936
102014
|
function readServerConfig(configDir) {
|
|
101937
|
-
const jsoncPath =
|
|
101938
|
-
if (
|
|
102015
|
+
const jsoncPath = join63(configDir, "opencode.jsonc");
|
|
102016
|
+
if (existsSync33(jsoncPath))
|
|
101939
102017
|
return readConfig(jsoncPath);
|
|
101940
|
-
const jsonPath =
|
|
101941
|
-
if (
|
|
102018
|
+
const jsonPath = join63(configDir, "opencode.json");
|
|
102019
|
+
if (existsSync33(jsonPath))
|
|
101942
102020
|
return readConfig(jsonPath);
|
|
101943
102021
|
return null;
|
|
101944
102022
|
}
|
|
@@ -101958,7 +102036,7 @@ function desiredTuiEntry(serverEntry) {
|
|
|
101958
102036
|
return null;
|
|
101959
102037
|
}
|
|
101960
102038
|
function readTuiConfig(tuiJsonPath) {
|
|
101961
|
-
if (!
|
|
102039
|
+
if (!existsSync33(tuiJsonPath)) {
|
|
101962
102040
|
return { config: {}, malformed: false };
|
|
101963
102041
|
}
|
|
101964
102042
|
const config3 = readConfig(tuiJsonPath);
|
|
@@ -101979,7 +102057,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
101979
102057
|
if (!desiredEntry) {
|
|
101980
102058
|
return { changed: false, reason: "no-server-entry" };
|
|
101981
102059
|
}
|
|
101982
|
-
const tuiJsonPath =
|
|
102060
|
+
const tuiJsonPath = join63(configDir, "tui.json");
|
|
101983
102061
|
const { config: config3, malformed } = readTuiConfig(tuiJsonPath);
|
|
101984
102062
|
if (malformed) {
|
|
101985
102063
|
return { changed: false, reason: "malformed" };
|
|
@@ -101988,22 +102066,22 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
101988
102066
|
if (plugins.includes(desiredEntry)) {
|
|
101989
102067
|
return { changed: false, reason: "already-present" };
|
|
101990
102068
|
}
|
|
101991
|
-
|
|
102069
|
+
mkdirSync11(configDir, { recursive: true });
|
|
101992
102070
|
writeFileAtomically2(tuiJsonPath, formatConfig({ ...config3, plugin: [...plugins, desiredEntry] }));
|
|
101993
102071
|
return { changed: true, reason: "added" };
|
|
101994
102072
|
}
|
|
101995
102073
|
|
|
101996
102074
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
101997
|
-
import { homedir as
|
|
101998
|
-
import { join as
|
|
102075
|
+
import { homedir as homedir11 } from "os";
|
|
102076
|
+
import { join as join64 } from "path";
|
|
101999
102077
|
|
|
102000
102078
|
// packages/shared-skills/index.mjs
|
|
102001
|
-
import { existsSync as
|
|
102079
|
+
import { existsSync as existsSync34 } from "fs";
|
|
102002
102080
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
102003
102081
|
var SKILLS_PROBE_SPECIFIERS = ["./skills/", "../skills/", "../../skills/"];
|
|
102004
102082
|
function sharedSkillsRootPath() {
|
|
102005
102083
|
const candidates = SKILLS_PROBE_SPECIFIERS.map((specifier) => fileURLToPath2(new URL(specifier, import.meta.url)));
|
|
102006
|
-
return candidates.find((candidate2) =>
|
|
102084
|
+
return candidates.find((candidate2) => existsSync34(candidate2)) ?? candidates[0];
|
|
102007
102085
|
}
|
|
102008
102086
|
|
|
102009
102087
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
@@ -102017,9 +102095,9 @@ function describeResult2(result) {
|
|
|
102017
102095
|
}
|
|
102018
102096
|
async function installAstGrepForOpenCode(options = {}) {
|
|
102019
102097
|
const platform = options.platform ?? process.platform;
|
|
102020
|
-
const baseDir =
|
|
102098
|
+
const baseDir = join64(options.homeDir ?? homedir11(), ".omo");
|
|
102021
102099
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
102022
|
-
const skillDir =
|
|
102100
|
+
const skillDir = join64(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
102023
102101
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
102024
102102
|
try {
|
|
102025
102103
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -105822,7 +105900,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
105822
105900
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
105823
105901
|
init_bun_which_shim();
|
|
105824
105902
|
init_spawn_with_windows_hide();
|
|
105825
|
-
import { delimiter as delimiter2, dirname as
|
|
105903
|
+
import { delimiter as delimiter2, dirname as dirname24, posix as posix9, win32 as win325 } from "path";
|
|
105826
105904
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
105827
105905
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
105828
105906
|
function getCommandCandidates(platform) {
|
|
@@ -105880,7 +105958,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
105880
105958
|
return null;
|
|
105881
105959
|
}
|
|
105882
105960
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
105883
|
-
const preferredDir =
|
|
105961
|
+
const preferredDir = dirname24(binaryPath);
|
|
105884
105962
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
105885
105963
|
return [preferredDir, ...existing].join(delimiter2);
|
|
105886
105964
|
}
|
|
@@ -106049,7 +106127,7 @@ async function resolveSession(options) {
|
|
|
106049
106127
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
106050
106128
|
const delay2 = retryDelayMs * attempt;
|
|
106051
106129
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
106052
|
-
await new Promise((
|
|
106130
|
+
await new Promise((resolve20) => setTimeout(resolve20, delay2));
|
|
106053
106131
|
}
|
|
106054
106132
|
continue;
|
|
106055
106133
|
}
|
|
@@ -106060,7 +106138,7 @@ async function resolveSession(options) {
|
|
|
106060
106138
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
106061
106139
|
const delay2 = retryDelayMs * attempt;
|
|
106062
106140
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
106063
|
-
await new Promise((
|
|
106141
|
+
await new Promise((resolve20) => setTimeout(resolve20, delay2));
|
|
106064
106142
|
}
|
|
106065
106143
|
}
|
|
106066
106144
|
throw new Error("Failed to create session after all retries");
|
|
@@ -106458,26 +106536,26 @@ function isClosingFence(line, fence) {
|
|
|
106458
106536
|
return run?.charAt(0) === fence.marker && run.length >= fence.length;
|
|
106459
106537
|
}
|
|
106460
106538
|
// packages/boulder-state/src/top-level-task.ts
|
|
106461
|
-
import { existsSync as
|
|
106539
|
+
import { existsSync as existsSync35, readFileSync as readFileSync17 } from "fs";
|
|
106462
106540
|
function readCurrentTopLevelTask(planPath) {
|
|
106463
|
-
if (!
|
|
106541
|
+
if (!existsSync35(planPath)) {
|
|
106464
106542
|
return null;
|
|
106465
106543
|
}
|
|
106466
106544
|
try {
|
|
106467
|
-
const content =
|
|
106545
|
+
const content = readFileSync17(planPath, "utf-8");
|
|
106468
106546
|
return parseCurrentTopLevelTask(content);
|
|
106469
106547
|
} catch {
|
|
106470
106548
|
return null;
|
|
106471
106549
|
}
|
|
106472
106550
|
}
|
|
106473
106551
|
// packages/boulder-state/src/storage/path.ts
|
|
106474
|
-
import { existsSync as
|
|
106475
|
-
import { isAbsolute as isAbsolute11, join as
|
|
106552
|
+
import { existsSync as existsSync36 } from "fs";
|
|
106553
|
+
import { isAbsolute as isAbsolute11, join as join65, relative as relative8, resolve as resolve20 } from "path";
|
|
106476
106554
|
function getBoulderFilePath(directory) {
|
|
106477
|
-
return
|
|
106555
|
+
return join65(directory, BOULDER_DIR, BOULDER_FILE);
|
|
106478
106556
|
}
|
|
106479
106557
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
106480
|
-
return isAbsolute11(trackedPath) ?
|
|
106558
|
+
return isAbsolute11(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
|
|
106481
106559
|
}
|
|
106482
106560
|
function resolveBoulderPlanPath(directory, state) {
|
|
106483
106561
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -106485,26 +106563,26 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
106485
106563
|
if (!worktreePath) {
|
|
106486
106564
|
return absolutePlanPath;
|
|
106487
106565
|
}
|
|
106488
|
-
const absoluteDirectory =
|
|
106566
|
+
const absoluteDirectory = resolve20(directory);
|
|
106489
106567
|
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
106490
106568
|
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute11(relativePlanPath)) {
|
|
106491
106569
|
return absolutePlanPath;
|
|
106492
106570
|
}
|
|
106493
106571
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
106494
|
-
const worktreePlanPath =
|
|
106495
|
-
return
|
|
106572
|
+
const worktreePlanPath = resolve20(absoluteWorktreePath, relativePlanPath);
|
|
106573
|
+
return existsSync36(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
106496
106574
|
}
|
|
106497
106575
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
106498
106576
|
return resolveBoulderPlanPath(directory, work);
|
|
106499
106577
|
}
|
|
106500
106578
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
106501
|
-
import { existsSync as
|
|
106579
|
+
import { existsSync as existsSync37, readFileSync as readFileSync18, readdirSync as readdirSync7, statSync as statSync4 } from "fs";
|
|
106502
106580
|
function getPlanProgress(planPath) {
|
|
106503
|
-
if (!
|
|
106581
|
+
if (!existsSync37(planPath)) {
|
|
106504
106582
|
return { total: 0, completed: 0, isComplete: false };
|
|
106505
106583
|
}
|
|
106506
106584
|
try {
|
|
106507
|
-
const content =
|
|
106585
|
+
const content = readFileSync18(planPath, "utf-8");
|
|
106508
106586
|
const checklist = parsePlanChecklist(content);
|
|
106509
106587
|
return {
|
|
106510
106588
|
total: checklist.total,
|
|
@@ -106583,14 +106661,14 @@ function selectMirrorWork(state) {
|
|
|
106583
106661
|
return sorted[0] ?? null;
|
|
106584
106662
|
}
|
|
106585
106663
|
// packages/boulder-state/src/storage/read-state.ts
|
|
106586
|
-
import { existsSync as
|
|
106664
|
+
import { existsSync as existsSync38, readFileSync as readFileSync19 } from "fs";
|
|
106587
106665
|
function readBoulderState(directory) {
|
|
106588
106666
|
const filePath = getBoulderFilePath(directory);
|
|
106589
|
-
if (!
|
|
106667
|
+
if (!existsSync38(filePath)) {
|
|
106590
106668
|
return null;
|
|
106591
106669
|
}
|
|
106592
106670
|
try {
|
|
106593
|
-
const content =
|
|
106671
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
106594
106672
|
const parsed = JSON.parse(content);
|
|
106595
106673
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || Object.keys(parsed).length === 0) {
|
|
106596
106674
|
return null;
|
|
@@ -106656,17 +106734,17 @@ init_state();
|
|
|
106656
106734
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
106657
106735
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
106658
106736
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
106659
|
-
import { existsSync as
|
|
106660
|
-
import { join as
|
|
106737
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync12, readFileSync as readFileSync20, rmSync as rmSync2, writeFileSync as writeFileSync7 } from "fs";
|
|
106738
|
+
import { join as join66 } from "path";
|
|
106661
106739
|
function getMarkerPath(directory, sessionID) {
|
|
106662
|
-
return
|
|
106740
|
+
return join66(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
106663
106741
|
}
|
|
106664
106742
|
function readContinuationMarker(directory, sessionID) {
|
|
106665
106743
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
106666
|
-
if (!
|
|
106744
|
+
if (!existsSync39(markerPath))
|
|
106667
106745
|
return null;
|
|
106668
106746
|
try {
|
|
106669
|
-
const raw =
|
|
106747
|
+
const raw = readFileSync20(markerPath, "utf-8");
|
|
106670
106748
|
const parsed = JSON.parse(raw);
|
|
106671
106749
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
106672
106750
|
return null;
|
|
@@ -106731,8 +106809,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
106731
106809
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
106732
106810
|
init_shared();
|
|
106733
106811
|
init_compaction_marker();
|
|
106734
|
-
import { readFileSync as
|
|
106735
|
-
import { join as
|
|
106812
|
+
import { readFileSync as readFileSync21, readdirSync as readdirSync8 } from "fs";
|
|
106813
|
+
import { join as join67 } from "path";
|
|
106736
106814
|
var defaultSessionLastAgentDeps = {
|
|
106737
106815
|
getMessageDir,
|
|
106738
106816
|
isSqliteBackend,
|
|
@@ -106792,7 +106870,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
106792
106870
|
try {
|
|
106793
106871
|
const messages = readdirSync8(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
106794
106872
|
try {
|
|
106795
|
-
const content =
|
|
106873
|
+
const content = readFileSync21(join67(messageDir, fileName), "utf-8");
|
|
106796
106874
|
const parsed = JSON.parse(content);
|
|
106797
106875
|
return {
|
|
106798
106876
|
fileName,
|
|
@@ -106835,8 +106913,8 @@ init_agent_display_names();
|
|
|
106835
106913
|
|
|
106836
106914
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
106837
106915
|
init_frontmatter2();
|
|
106838
|
-
import { existsSync as
|
|
106839
|
-
import { dirname as
|
|
106916
|
+
import { existsSync as existsSync40, readFileSync as readFileSync22, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "fs";
|
|
106917
|
+
import { dirname as dirname25, join as join68 } from "path";
|
|
106840
106918
|
|
|
106841
106919
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
106842
106920
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -106845,15 +106923,15 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
106845
106923
|
|
|
106846
106924
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
106847
106925
|
function getStateFilePath(directory, customPath) {
|
|
106848
|
-
return customPath ?
|
|
106926
|
+
return customPath ? join68(directory, customPath) : join68(directory, DEFAULT_STATE_FILE);
|
|
106849
106927
|
}
|
|
106850
106928
|
function readState(directory, customPath) {
|
|
106851
106929
|
const filePath = getStateFilePath(directory, customPath);
|
|
106852
|
-
if (!
|
|
106930
|
+
if (!existsSync40(filePath)) {
|
|
106853
106931
|
return null;
|
|
106854
106932
|
}
|
|
106855
106933
|
try {
|
|
106856
|
-
const content =
|
|
106934
|
+
const content = readFileSync22(filePath, "utf-8");
|
|
106857
106935
|
const { data, body } = parseFrontmatter(content);
|
|
106858
106936
|
const active = data.active;
|
|
106859
106937
|
const iteration = data.iteration;
|
|
@@ -107079,7 +107157,7 @@ async function pollForCompletion(ctx, eventState, abortController, options = {})
|
|
|
107079
107157
|
const secondaryMeaningfulWorkTimeoutMs = options.secondaryMeaningfulWorkTimeoutMs ?? DEFAULT_SECONDARY_MEANINGFUL_WORK_TIMEOUT_MS;
|
|
107080
107158
|
const requireMeaningfulWork = options.requireMeaningfulWork ?? false;
|
|
107081
107159
|
const now = options.now ?? Date.now;
|
|
107082
|
-
const sleep = options.sleep ?? ((ms) => new Promise((
|
|
107160
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve21) => setTimeout(resolve21, ms)));
|
|
107083
107161
|
let consecutiveCompleteChecks = 0;
|
|
107084
107162
|
let errorCycleCount = 0;
|
|
107085
107163
|
let firstWorkTimestamp = null;
|
|
@@ -107244,7 +107322,7 @@ function createAbortError() {
|
|
|
107244
107322
|
return error51;
|
|
107245
107323
|
}
|
|
107246
107324
|
function sleep(delayMs) {
|
|
107247
|
-
return new Promise((
|
|
107325
|
+
return new Promise((resolve21) => setTimeout(resolve21, delayMs));
|
|
107248
107326
|
}
|
|
107249
107327
|
function hasPromptStartEvidence(eventState) {
|
|
107250
107328
|
return eventState.mainSessionStarted || eventState.hasReceivedMeaningfulWork || eventState.messageCount > 0 || eventState.currentTool !== null;
|
|
@@ -107619,7 +107697,7 @@ var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
|
|
|
107619
107697
|
async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
|
|
107620
107698
|
const completed = await Promise.race([
|
|
107621
107699
|
eventProcessor.then(() => true),
|
|
107622
|
-
new Promise((
|
|
107700
|
+
new Promise((resolve21) => setTimeout(() => resolve21(false), timeoutMs))
|
|
107623
107701
|
]);
|
|
107624
107702
|
}
|
|
107625
107703
|
async function run(options) {
|
|
@@ -107945,14 +108023,14 @@ async function getLocalVersion(options = {}) {
|
|
|
107945
108023
|
}
|
|
107946
108024
|
}
|
|
107947
108025
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
107948
|
-
import { existsSync as
|
|
108026
|
+
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "fs";
|
|
107949
108027
|
|
|
107950
108028
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
107951
108029
|
init_extract_semver();
|
|
107952
108030
|
init_bun_which_shim();
|
|
107953
|
-
import { existsSync as
|
|
107954
|
-
import { homedir as
|
|
107955
|
-
import { join as
|
|
108031
|
+
import { existsSync as existsSync48, accessSync as accessSync4, constants as constants11 } from "fs";
|
|
108032
|
+
import { homedir as homedir14 } from "os";
|
|
108033
|
+
import { join as join75 } from "path";
|
|
107956
108034
|
|
|
107957
108035
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
107958
108036
|
init_spawn_with_windows_hide();
|
|
@@ -107991,8 +108069,8 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
|
|
|
107991
108069
|
const stdoutPromise = readSpawnStream(proc.stdout);
|
|
107992
108070
|
const stderrPromise = readSpawnStream(proc.stderr);
|
|
107993
108071
|
let timer;
|
|
107994
|
-
const timeoutPromise = new Promise((
|
|
107995
|
-
timer = setTimeout(() =>
|
|
108072
|
+
const timeoutPromise = new Promise((resolve21) => {
|
|
108073
|
+
timer = setTimeout(() => resolve21("timeout"), timeoutMs);
|
|
107996
108074
|
});
|
|
107997
108075
|
const processPromise = (async () => {
|
|
107998
108076
|
await proc.exited;
|
|
@@ -108039,22 +108117,22 @@ function isExecutable2(path12) {
|
|
|
108039
108117
|
}
|
|
108040
108118
|
}
|
|
108041
108119
|
function getDesktopAppPaths(platform) {
|
|
108042
|
-
const home =
|
|
108120
|
+
const home = homedir14();
|
|
108043
108121
|
switch (platform) {
|
|
108044
108122
|
case "darwin":
|
|
108045
108123
|
return [
|
|
108046
108124
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
108047
|
-
|
|
108125
|
+
join75(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
108048
108126
|
];
|
|
108049
108127
|
case "win32": {
|
|
108050
108128
|
const programFiles = process.env.ProgramFiles;
|
|
108051
108129
|
const localAppData = process.env.LOCALAPPDATA;
|
|
108052
108130
|
const paths2 = [];
|
|
108053
108131
|
if (programFiles) {
|
|
108054
|
-
paths2.push(
|
|
108132
|
+
paths2.push(join75(programFiles, "OpenCode", "OpenCode.exe"));
|
|
108055
108133
|
}
|
|
108056
108134
|
if (localAppData) {
|
|
108057
|
-
paths2.push(
|
|
108135
|
+
paths2.push(join75(localAppData, "OpenCode", "OpenCode.exe"));
|
|
108058
108136
|
}
|
|
108059
108137
|
return paths2;
|
|
108060
108138
|
}
|
|
@@ -108062,8 +108140,8 @@ function getDesktopAppPaths(platform) {
|
|
|
108062
108140
|
return [
|
|
108063
108141
|
"/usr/bin/opencode",
|
|
108064
108142
|
"/usr/lib/opencode/opencode",
|
|
108065
|
-
|
|
108066
|
-
|
|
108143
|
+
join75(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
108144
|
+
join75(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
108067
108145
|
];
|
|
108068
108146
|
default:
|
|
108069
108147
|
return [];
|
|
@@ -108075,7 +108153,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
108075
108153
|
}
|
|
108076
108154
|
return [binaryPath, "--version"];
|
|
108077
108155
|
}
|
|
108078
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
108156
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync48) {
|
|
108079
108157
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
108080
108158
|
if (checkExists(desktopPath)) {
|
|
108081
108159
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -108083,7 +108161,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
108083
108161
|
}
|
|
108084
108162
|
return null;
|
|
108085
108163
|
}
|
|
108086
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
108164
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync48) {
|
|
108087
108165
|
for (const binary of OPENCODE_BINARIES2) {
|
|
108088
108166
|
const path12 = bunWhich(binary);
|
|
108089
108167
|
if (path12 && checkExists(path12)) {
|
|
@@ -108095,7 +108173,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
108095
108173
|
const candidates = getCommandCandidates2(platform);
|
|
108096
108174
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
108097
108175
|
for (const command of candidates) {
|
|
108098
|
-
const fullPath =
|
|
108176
|
+
const fullPath = join75(entry, command);
|
|
108099
108177
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
108100
108178
|
return { binary: command, path: fullPath };
|
|
108101
108179
|
}
|
|
@@ -108141,12 +108219,12 @@ function compareVersions3(current, minimum) {
|
|
|
108141
108219
|
|
|
108142
108220
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
108143
108221
|
init_shared();
|
|
108144
|
-
import { existsSync as
|
|
108222
|
+
import { existsSync as existsSync49, readFileSync as readFileSync30 } from "fs";
|
|
108145
108223
|
function detectConfigPath() {
|
|
108146
108224
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
108147
|
-
if (
|
|
108225
|
+
if (existsSync49(paths2.configJsonc))
|
|
108148
108226
|
return paths2.configJsonc;
|
|
108149
|
-
if (
|
|
108227
|
+
if (existsSync49(paths2.configJson))
|
|
108150
108228
|
return paths2.configJson;
|
|
108151
108229
|
return null;
|
|
108152
108230
|
}
|
|
@@ -108192,7 +108270,7 @@ function getPluginInfo() {
|
|
|
108192
108270
|
};
|
|
108193
108271
|
}
|
|
108194
108272
|
try {
|
|
108195
|
-
const content =
|
|
108273
|
+
const content = readFileSync30(configPath, "utf-8");
|
|
108196
108274
|
const parsedConfig = parseJsonc(content);
|
|
108197
108275
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
108198
108276
|
if (!pluginEntry) {
|
|
@@ -108234,39 +108312,39 @@ init_file_utils2();
|
|
|
108234
108312
|
init_checker();
|
|
108235
108313
|
init_auto_update_checker();
|
|
108236
108314
|
init_package_json_locator();
|
|
108237
|
-
import { existsSync as
|
|
108315
|
+
import { existsSync as existsSync50, readFileSync as readFileSync31, readdirSync as readdirSync10 } from "fs";
|
|
108238
108316
|
import { createRequire as createRequire2 } from "module";
|
|
108239
|
-
import { homedir as
|
|
108240
|
-
import { join as
|
|
108317
|
+
import { homedir as homedir15 } from "os";
|
|
108318
|
+
import { join as join76 } from "path";
|
|
108241
108319
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
108242
108320
|
init_shared();
|
|
108243
108321
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
108244
108322
|
if (platform === "darwin")
|
|
108245
|
-
return
|
|
108323
|
+
return join76(homedir15(), "Library", "Caches");
|
|
108246
108324
|
if (platform === "win32")
|
|
108247
|
-
return process.env.LOCALAPPDATA ??
|
|
108248
|
-
return
|
|
108325
|
+
return process.env.LOCALAPPDATA ?? join76(homedir15(), "AppData", "Local");
|
|
108326
|
+
return join76(homedir15(), ".cache");
|
|
108249
108327
|
}
|
|
108250
108328
|
function resolveOpenCodeCacheDir() {
|
|
108251
108329
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
108252
108330
|
if (xdgCacheHome)
|
|
108253
|
-
return
|
|
108331
|
+
return join76(xdgCacheHome, "opencode");
|
|
108254
108332
|
const fromShared = getOpenCodeCacheDir();
|
|
108255
|
-
const platformDefault =
|
|
108256
|
-
if (
|
|
108333
|
+
const platformDefault = join76(getPlatformDefaultCacheDir(), "opencode");
|
|
108334
|
+
if (existsSync50(fromShared) || !existsSync50(platformDefault))
|
|
108257
108335
|
return fromShared;
|
|
108258
108336
|
return platformDefault;
|
|
108259
108337
|
}
|
|
108260
108338
|
function resolveExistingDir(dirPath) {
|
|
108261
|
-
if (!
|
|
108339
|
+
if (!existsSync50(dirPath))
|
|
108262
108340
|
return dirPath;
|
|
108263
108341
|
return resolveSymlink(dirPath);
|
|
108264
108342
|
}
|
|
108265
108343
|
function readPackageJson(filePath) {
|
|
108266
|
-
if (!
|
|
108344
|
+
if (!existsSync50(filePath))
|
|
108267
108345
|
return null;
|
|
108268
108346
|
try {
|
|
108269
|
-
const content =
|
|
108347
|
+
const content = readFileSync31(filePath, "utf-8");
|
|
108270
108348
|
return parseJsonc(content);
|
|
108271
108349
|
} catch (error51) {
|
|
108272
108350
|
if (!(error51 instanceof Error)) {
|
|
@@ -108284,26 +108362,26 @@ function normalizeVersion(value) {
|
|
|
108284
108362
|
function createPackageCandidates(rootDir) {
|
|
108285
108363
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
108286
108364
|
packageName,
|
|
108287
|
-
installedPackagePath:
|
|
108365
|
+
installedPackagePath: join76(rootDir, "node_modules", packageName, "package.json")
|
|
108288
108366
|
}));
|
|
108289
108367
|
}
|
|
108290
108368
|
function createTaggedInstallCandidates(rootDir) {
|
|
108291
|
-
const packagesDir =
|
|
108292
|
-
if (!
|
|
108369
|
+
const packagesDir = join76(rootDir, "packages");
|
|
108370
|
+
if (!existsSync50(packagesDir))
|
|
108293
108371
|
return [];
|
|
108294
108372
|
const candidates = [];
|
|
108295
108373
|
for (const entryName of readdirSync10(packagesDir).sort()) {
|
|
108296
108374
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
108297
108375
|
if (packageName === undefined)
|
|
108298
108376
|
continue;
|
|
108299
|
-
const installDir =
|
|
108377
|
+
const installDir = join76(packagesDir, entryName);
|
|
108300
108378
|
candidates.push({
|
|
108301
108379
|
cacheDir: installDir,
|
|
108302
|
-
cachePackagePath:
|
|
108380
|
+
cachePackagePath: join76(installDir, "package.json"),
|
|
108303
108381
|
packageCandidates: [
|
|
108304
108382
|
{
|
|
108305
108383
|
packageName,
|
|
108306
|
-
installedPackagePath:
|
|
108384
|
+
installedPackagePath: join76(installDir, "node_modules", packageName, "package.json")
|
|
108307
108385
|
}
|
|
108308
108386
|
]
|
|
108309
108387
|
});
|
|
@@ -108311,7 +108389,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
108311
108389
|
return candidates;
|
|
108312
108390
|
}
|
|
108313
108391
|
function selectInstalledPackage(candidate2) {
|
|
108314
|
-
return candidate2.packageCandidates.find((packageCandidate) =>
|
|
108392
|
+
return candidate2.packageCandidates.find((packageCandidate) => existsSync50(packageCandidate.installedPackagePath)) ?? candidate2.packageCandidates[0];
|
|
108315
108393
|
}
|
|
108316
108394
|
function getExpectedVersion(cachePackage, packageName) {
|
|
108317
108395
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -108322,7 +108400,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
108322
108400
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
108323
108401
|
try {
|
|
108324
108402
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
108325
|
-
if (
|
|
108403
|
+
if (existsSync50(packageJsonPath)) {
|
|
108326
108404
|
return { packageName, packageJsonPath };
|
|
108327
108405
|
}
|
|
108328
108406
|
} catch {
|
|
@@ -108348,22 +108426,22 @@ function getLoadedPluginVersion() {
|
|
|
108348
108426
|
const candidates = [
|
|
108349
108427
|
{
|
|
108350
108428
|
cacheDir: configDir,
|
|
108351
|
-
cachePackagePath:
|
|
108429
|
+
cachePackagePath: join76(configDir, "package.json"),
|
|
108352
108430
|
packageCandidates: createPackageCandidates(configDir)
|
|
108353
108431
|
},
|
|
108354
108432
|
...createTaggedInstallCandidates(configDir),
|
|
108355
108433
|
{
|
|
108356
108434
|
cacheDir,
|
|
108357
|
-
cachePackagePath:
|
|
108435
|
+
cachePackagePath: join76(cacheDir, "package.json"),
|
|
108358
108436
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
108359
108437
|
},
|
|
108360
108438
|
...createTaggedInstallCandidates(cacheDir)
|
|
108361
108439
|
];
|
|
108362
|
-
const selectedCandidate = candidates.find((candidate2) => candidate2.packageCandidates.some((packageCandidate) =>
|
|
108440
|
+
const selectedCandidate = candidates.find((candidate2) => candidate2.packageCandidates.some((packageCandidate) => existsSync50(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
108363
108441
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
108364
108442
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
108365
108443
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
108366
|
-
const candidateExists =
|
|
108444
|
+
const candidateExists = existsSync50(candidateInstalledPath);
|
|
108367
108445
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
108368
108446
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
108369
108447
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -108399,8 +108477,8 @@ var defaultDeps6 = {
|
|
|
108399
108477
|
getLoadedPluginVersion,
|
|
108400
108478
|
getLatestPluginVersion,
|
|
108401
108479
|
getSuggestedInstallTag,
|
|
108402
|
-
configExists:
|
|
108403
|
-
readConfigFile: (path12) =>
|
|
108480
|
+
configExists: existsSync51,
|
|
108481
|
+
readConfigFile: (path12) => readFileSync32(path12, "utf-8"),
|
|
108404
108482
|
parseConfigContent: (content) => parseJsonc(content)
|
|
108405
108483
|
};
|
|
108406
108484
|
var BUN_POSTINSTALL_HELPER_PACKAGE_NAME = "@code-yeongyu/comment-checker";
|
|
@@ -108545,26 +108623,26 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
108545
108623
|
|
|
108546
108624
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
108547
108625
|
init_shared();
|
|
108548
|
-
import { existsSync as
|
|
108549
|
-
import { homedir as
|
|
108550
|
-
import { join as
|
|
108626
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
|
|
108627
|
+
import { homedir as homedir16 } from "os";
|
|
108628
|
+
import { join as join77 } from "path";
|
|
108551
108629
|
function getUserConfigDir2() {
|
|
108552
108630
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
108553
108631
|
if (xdgConfig)
|
|
108554
|
-
return
|
|
108555
|
-
return
|
|
108632
|
+
return join77(xdgConfig, "opencode");
|
|
108633
|
+
return join77(homedir16(), ".config", "opencode");
|
|
108556
108634
|
}
|
|
108557
108635
|
function loadCustomProviderNames() {
|
|
108558
108636
|
const configDir = getUserConfigDir2();
|
|
108559
108637
|
const candidatePaths = [
|
|
108560
|
-
|
|
108561
|
-
|
|
108638
|
+
join77(configDir, "opencode.json"),
|
|
108639
|
+
join77(configDir, "opencode.jsonc")
|
|
108562
108640
|
];
|
|
108563
108641
|
for (const configPath of candidatePaths) {
|
|
108564
|
-
if (!
|
|
108642
|
+
if (!existsSync52(configPath))
|
|
108565
108643
|
continue;
|
|
108566
108644
|
try {
|
|
108567
|
-
const content =
|
|
108645
|
+
const content = readFileSync33(configPath, "utf-8");
|
|
108568
108646
|
const data = parseJsonc(content);
|
|
108569
108647
|
if (data?.provider && typeof data.provider === "object") {
|
|
108570
108648
|
return Object.keys(data.provider);
|
|
@@ -108579,16 +108657,16 @@ function loadCustomProviderNames() {
|
|
|
108579
108657
|
return [];
|
|
108580
108658
|
}
|
|
108581
108659
|
function loadAvailableModelsFromCache() {
|
|
108582
|
-
const cacheFile =
|
|
108660
|
+
const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
|
|
108583
108661
|
const customProviders = loadCustomProviderNames();
|
|
108584
|
-
if (!
|
|
108662
|
+
if (!existsSync52(cacheFile)) {
|
|
108585
108663
|
if (customProviders.length > 0) {
|
|
108586
108664
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
108587
108665
|
}
|
|
108588
108666
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
108589
108667
|
}
|
|
108590
108668
|
try {
|
|
108591
|
-
const content =
|
|
108669
|
+
const content = readFileSync33(cacheFile, "utf-8");
|
|
108592
108670
|
const data = parseJsonc(content);
|
|
108593
108671
|
const cacheProviders = Object.keys(data);
|
|
108594
108672
|
let modelCount = 0;
|
|
@@ -108641,7 +108719,7 @@ function loadOmoConfig2() {
|
|
|
108641
108719
|
|
|
108642
108720
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
108643
108721
|
init_shared();
|
|
108644
|
-
import { join as
|
|
108722
|
+
import { join as join78 } from "path";
|
|
108645
108723
|
|
|
108646
108724
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
108647
108725
|
function formatModelWithVariant(model, variant) {
|
|
@@ -108683,7 +108761,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
108683
108761
|
}
|
|
108684
108762
|
function buildModelResolutionDetails(options) {
|
|
108685
108763
|
const details = [];
|
|
108686
|
-
const cacheFile =
|
|
108764
|
+
const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
|
|
108687
108765
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
108688
108766
|
details.push("");
|
|
108689
108767
|
if (options.available.cacheExists) {
|
|
@@ -108992,8 +109070,8 @@ async function checkConfig() {
|
|
|
108992
109070
|
|
|
108993
109071
|
// packages/omo-opencode/src/cli/doctor/checks/deprecated-reasoning-keys.ts
|
|
108994
109072
|
init_main();
|
|
108995
|
-
import { existsSync as
|
|
108996
|
-
import { join as
|
|
109073
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34 } from "fs";
|
|
109074
|
+
import { join as join79 } from "path";
|
|
108997
109075
|
var CANONICAL_REPLACEMENT = new Map([
|
|
108998
109076
|
["variant", "reasoning"],
|
|
108999
109077
|
["reasoningEffort", "reasoning"],
|
|
@@ -109048,16 +109126,16 @@ function userConfigPaths() {
|
|
|
109048
109126
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
109049
109127
|
if (home === undefined || home.length === 0)
|
|
109050
109128
|
return [];
|
|
109051
|
-
return [
|
|
109129
|
+
return [join79(home, ".omo", "omo.jsonc"), join79(home, ".omo", "omo.json")];
|
|
109052
109130
|
}
|
|
109053
109131
|
async function checkDeprecatedReasoningKeys() {
|
|
109054
109132
|
const issues = [];
|
|
109055
109133
|
const scanned = [];
|
|
109056
109134
|
for (const configPath of userConfigPaths()) {
|
|
109057
|
-
if (!
|
|
109135
|
+
if (!existsSync53(configPath))
|
|
109058
109136
|
continue;
|
|
109059
109137
|
scanned.push(configPath);
|
|
109060
|
-
const parsed = parse2(
|
|
109138
|
+
const parsed = parse2(readFileSync34(configPath, "utf-8"));
|
|
109061
109139
|
issues.push(...collectIssues(configPath, parsed, ""));
|
|
109062
109140
|
}
|
|
109063
109141
|
return {
|
|
@@ -109071,28 +109149,28 @@ async function checkDeprecatedReasoningKeys() {
|
|
|
109071
109149
|
|
|
109072
109150
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
109073
109151
|
init_src2();
|
|
109074
|
-
import { existsSync as
|
|
109152
|
+
import { existsSync as existsSync54 } from "fs";
|
|
109075
109153
|
import { createRequire as createRequire3 } from "module";
|
|
109076
|
-
import { homedir as
|
|
109077
|
-
import { dirname as
|
|
109154
|
+
import { homedir as homedir18 } from "os";
|
|
109155
|
+
import { dirname as dirname30, join as join81 } from "path";
|
|
109078
109156
|
|
|
109079
109157
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
109080
|
-
import { join as
|
|
109081
|
-
import { homedir as
|
|
109158
|
+
import { join as join80 } from "path";
|
|
109159
|
+
import { homedir as homedir17, tmpdir as tmpdir4 } from "os";
|
|
109082
109160
|
init_binary_downloader();
|
|
109083
109161
|
init_logger2();
|
|
109084
109162
|
init_plugin_identity();
|
|
109085
109163
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
109086
|
-
var DEBUG_FILE =
|
|
109164
|
+
var DEBUG_FILE = join80(tmpdir4(), "comment-checker-debug.log");
|
|
109087
109165
|
function getCacheDir2() {
|
|
109088
109166
|
if (process.platform === "win32") {
|
|
109089
109167
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
109090
|
-
const base2 = localAppData ||
|
|
109091
|
-
return
|
|
109168
|
+
const base2 = localAppData || join80(homedir17(), "AppData", "Local");
|
|
109169
|
+
return join80(base2, CACHE_DIR_NAME, "bin");
|
|
109092
109170
|
}
|
|
109093
109171
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
109094
|
-
const base = xdgCache ||
|
|
109095
|
-
return
|
|
109172
|
+
const base = xdgCache || join80(homedir17(), ".cache");
|
|
109173
|
+
return join80(base, CACHE_DIR_NAME, "bin");
|
|
109096
109174
|
}
|
|
109097
109175
|
function getBinaryName() {
|
|
109098
109176
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -109142,7 +109220,7 @@ async function getBinaryVersion(binary) {
|
|
|
109142
109220
|
}
|
|
109143
109221
|
}
|
|
109144
109222
|
async function checkAstGrepCli() {
|
|
109145
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
109223
|
+
const runtimeDir = astGrepRuntimeDir(join81(homedir18(), ".omo"));
|
|
109146
109224
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
109147
109225
|
if (sgPath === null) {
|
|
109148
109226
|
return {
|
|
@@ -109171,12 +109249,12 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
109171
109249
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
109172
109250
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
109173
109251
|
try {
|
|
109174
|
-
const packageDir = baseDirOverride ??
|
|
109175
|
-
const vendorPath =
|
|
109176
|
-
if (
|
|
109252
|
+
const packageDir = baseDirOverride ?? dirname30(resolvePackageJsonPath());
|
|
109253
|
+
const vendorPath = join81(packageDir, "vendor", platformKey, binaryName);
|
|
109254
|
+
if (existsSync54(vendorPath))
|
|
109177
109255
|
return vendorPath;
|
|
109178
|
-
const binPath =
|
|
109179
|
-
if (
|
|
109256
|
+
const binPath = join81(packageDir, "bin", binaryName);
|
|
109257
|
+
if (existsSync54(binPath))
|
|
109180
109258
|
return binPath;
|
|
109181
109259
|
} catch (error51) {
|
|
109182
109260
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -109322,8 +109400,8 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
109322
109400
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
109323
109401
|
init_zod();
|
|
109324
109402
|
init_opencode_config_dir();
|
|
109325
|
-
import { existsSync as
|
|
109326
|
-
import { delimiter as delimiter3, dirname as
|
|
109403
|
+
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "fs";
|
|
109404
|
+
import { delimiter as delimiter3, dirname as dirname31, resolve as resolve22 } from "path";
|
|
109327
109405
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
109328
109406
|
|
|
109329
109407
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -109370,7 +109448,7 @@ function resolveRuntimeExecutable(commandName, options = {}) {
|
|
|
109370
109448
|
}
|
|
109371
109449
|
|
|
109372
109450
|
// packages/omo-opencode/src/mcp/shared/ancestor-cli-resolver.ts
|
|
109373
|
-
import { resolve as
|
|
109451
|
+
import { resolve as resolve21 } from "path";
|
|
109374
109452
|
function resolveJavaScriptRuntime(resolveExecutable) {
|
|
109375
109453
|
const node = resolveExecutable("node");
|
|
109376
109454
|
return node.available ? node : resolveExecutable("bun");
|
|
@@ -109378,9 +109456,9 @@ function resolveJavaScriptRuntime(resolveExecutable) {
|
|
|
109378
109456
|
function createAncestorCliCandidates(options) {
|
|
109379
109457
|
const candidates = [];
|
|
109380
109458
|
const seenPaths = new Set;
|
|
109381
|
-
let currentDirectory =
|
|
109459
|
+
let currentDirectory = resolve21(options.startDirectory);
|
|
109382
109460
|
while (true) {
|
|
109383
|
-
const distCliPath =
|
|
109461
|
+
const distCliPath = resolve21(currentDirectory, options.packageRel, options.distCliRel);
|
|
109384
109462
|
if (!seenPaths.has(distCliPath)) {
|
|
109385
109463
|
const runtime5 = resolveJavaScriptRuntime(options.resolveExecutable);
|
|
109386
109464
|
seenPaths.add(distCliPath);
|
|
@@ -109392,7 +109470,7 @@ function createAncestorCliCandidates(options) {
|
|
|
109392
109470
|
runtimeAvailable: runtime5.available
|
|
109393
109471
|
});
|
|
109394
109472
|
}
|
|
109395
|
-
const sourceCliPath =
|
|
109473
|
+
const sourceCliPath = resolve21(currentDirectory, options.packageRel, options.sourceCliRel);
|
|
109396
109474
|
if (!seenPaths.has(sourceCliPath)) {
|
|
109397
109475
|
const runtime5 = options.resolveExecutable("bun");
|
|
109398
109476
|
const sourceCandidateAvailable = options.isSourceCandidateAvailable?.({
|
|
@@ -109409,7 +109487,7 @@ function createAncestorCliCandidates(options) {
|
|
|
109409
109487
|
runtimeAvailable: runtime5.available
|
|
109410
109488
|
});
|
|
109411
109489
|
}
|
|
109412
|
-
const parentDirectory =
|
|
109490
|
+
const parentDirectory = resolve21(currentDirectory, "..");
|
|
109413
109491
|
if (parentDirectory === currentDirectory)
|
|
109414
109492
|
return candidates;
|
|
109415
109493
|
currentDirectory = parentDirectory;
|
|
@@ -109454,7 +109532,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
109454
109532
|
].join(";");
|
|
109455
109533
|
function getModuleDirectory(moduleUrl) {
|
|
109456
109534
|
try {
|
|
109457
|
-
return
|
|
109535
|
+
return dirname31(fileURLToPath7(moduleUrl));
|
|
109458
109536
|
} catch (error51) {
|
|
109459
109537
|
if (!(error51 instanceof Error))
|
|
109460
109538
|
throw error51;
|
|
@@ -109462,11 +109540,11 @@ function getModuleDirectory(moduleUrl) {
|
|
|
109462
109540
|
}
|
|
109463
109541
|
}
|
|
109464
109542
|
function findBootstrapRoot(candidates, pathExists) {
|
|
109465
|
-
return candidates.find((candidate2) => pathExists(
|
|
109543
|
+
return candidates.find((candidate2) => pathExists(resolve22(candidate2.root, "package.json")))?.root ?? process.cwd();
|
|
109466
109544
|
}
|
|
109467
109545
|
function readDaemonPackageVersion(root) {
|
|
109468
109546
|
try {
|
|
109469
|
-
const packageJson = JSON.parse(
|
|
109547
|
+
const packageJson = JSON.parse(readFileSync35(resolve22(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
109470
109548
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
109471
109549
|
} catch (error51) {
|
|
109472
109550
|
if (!(error51 instanceof Error))
|
|
@@ -109478,17 +109556,17 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
109478
109556
|
const runtime5 = resolveJavaScriptRuntime(resolveExecutable);
|
|
109479
109557
|
const bun = resolveExecutable("bun");
|
|
109480
109558
|
const npm = resolveExecutable("npm");
|
|
109481
|
-
const packageManifestPath =
|
|
109559
|
+
const packageManifestPath = resolve22(root, PACKAGE_REL, "package.json");
|
|
109482
109560
|
return {
|
|
109483
109561
|
command: [runtime5.command, "-e", LSP_BOOTSTRAP_SCRIPT, root, npm.command, bun.command],
|
|
109484
109562
|
root,
|
|
109485
|
-
path:
|
|
109563
|
+
path: resolve22(root, PACKAGE_REL, DIST_CLI_REL),
|
|
109486
109564
|
exists: runtime5.available && npm.available && pathExists(packageManifestPath),
|
|
109487
109565
|
runtimeAvailable: runtime5.available
|
|
109488
109566
|
};
|
|
109489
109567
|
}
|
|
109490
109568
|
function resolveLspCommand(options = {}) {
|
|
109491
|
-
const pathExists = options.exists ??
|
|
109569
|
+
const pathExists = options.exists ?? existsSync55;
|
|
109492
109570
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
109493
109571
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
109494
109572
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -109498,7 +109576,7 @@ function resolveLspCommand(options = {}) {
|
|
|
109498
109576
|
sourceCliRel: SOURCE_CLI_REL,
|
|
109499
109577
|
pathExists,
|
|
109500
109578
|
resolveExecutable,
|
|
109501
|
-
isSourceCandidateAvailable: ({ root }) => pathExists(
|
|
109579
|
+
isSourceCandidateAvailable: ({ root }) => pathExists(resolve22(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL)) && readDaemonPackageVersion(root) !== null
|
|
109502
109580
|
}) : [];
|
|
109503
109581
|
const distCandidate = candidates.find((candidate2) => hasCliSuffix(candidate2.path, DIST_CLI_REL) && candidate2.exists);
|
|
109504
109582
|
if (distCandidate) {
|
|
@@ -109512,7 +109590,7 @@ function resolveLspCommand(options = {}) {
|
|
|
109512
109590
|
}
|
|
109513
109591
|
function createLspMcpConfig(options = {}) {
|
|
109514
109592
|
const resolvedCommand = resolveLspCommand(options);
|
|
109515
|
-
const cwd =
|
|
109593
|
+
const cwd = resolve22(options.cwd ?? process.cwd());
|
|
109516
109594
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
109517
109595
|
const sourceVersion = hasCliSuffix(resolvedCommand.path, SOURCE_CLI_REL) ? readDaemonPackageVersion(resolvedCommand.root) : null;
|
|
109518
109596
|
return {
|
|
@@ -109521,9 +109599,9 @@ function createLspMcpConfig(options = {}) {
|
|
|
109521
109599
|
enabled: resolvedCommand.exists,
|
|
109522
109600
|
cwd,
|
|
109523
109601
|
environment: {
|
|
109524
|
-
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) =>
|
|
109525
|
-
LSP_TOOLS_MCP_USER_CONFIG:
|
|
109526
|
-
LSP_TOOLS_MCP_INSTALL_DECISIONS:
|
|
109602
|
+
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) => resolve22(cwd, configPath)).join(delimiter3),
|
|
109603
|
+
LSP_TOOLS_MCP_USER_CONFIG: resolve22(configDir, "lsp.json"),
|
|
109604
|
+
LSP_TOOLS_MCP_INSTALL_DECISIONS: resolve22(configDir, "lsp-install-decisions.json"),
|
|
109527
109605
|
...sourceVersion ? {
|
|
109528
109606
|
[OMO_LSP_DAEMON_CLI]: resolvedCommand.path,
|
|
109529
109607
|
[OMO_LSP_DAEMON_VERSION]: sourceVersion
|
|
@@ -109548,24 +109626,24 @@ function getInstalledLspServers(options = {}) {
|
|
|
109548
109626
|
|
|
109549
109627
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
109550
109628
|
init_shared();
|
|
109551
|
-
import { existsSync as
|
|
109552
|
-
import { homedir as
|
|
109553
|
-
import { join as
|
|
109629
|
+
import { existsSync as existsSync56, readFileSync as readFileSync36 } from "fs";
|
|
109630
|
+
import { homedir as homedir19 } from "os";
|
|
109631
|
+
import { join as join82 } from "path";
|
|
109554
109632
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
109555
109633
|
function getMcpConfigPaths() {
|
|
109556
109634
|
return [
|
|
109557
|
-
|
|
109558
|
-
|
|
109559
|
-
|
|
109635
|
+
join82(homedir19(), ".claude", ".mcp.json"),
|
|
109636
|
+
join82(process.cwd(), ".mcp.json"),
|
|
109637
|
+
join82(process.cwd(), ".claude", ".mcp.json")
|
|
109560
109638
|
];
|
|
109561
109639
|
}
|
|
109562
109640
|
function loadUserMcpConfig() {
|
|
109563
109641
|
const servers = {};
|
|
109564
109642
|
for (const configPath of getMcpConfigPaths()) {
|
|
109565
|
-
if (!
|
|
109643
|
+
if (!existsSync56(configPath))
|
|
109566
109644
|
continue;
|
|
109567
109645
|
try {
|
|
109568
|
-
const content =
|
|
109646
|
+
const content = readFileSync36(configPath, "utf-8");
|
|
109569
109647
|
const config4 = parseJsonc(content);
|
|
109570
109648
|
if (config4.mcpServers) {
|
|
109571
109649
|
Object.assign(servers, config4.mcpServers);
|
|
@@ -109700,17 +109778,17 @@ async function checkTools() {
|
|
|
109700
109778
|
|
|
109701
109779
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
109702
109780
|
init_src5();
|
|
109703
|
-
import { existsSync as
|
|
109781
|
+
import { existsSync as existsSync57, readFileSync as readFileSync37 } from "fs";
|
|
109704
109782
|
function isTelemetryState(value) {
|
|
109705
109783
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
109706
109784
|
}
|
|
109707
109785
|
function readLastActiveDay(stateFilePath) {
|
|
109708
|
-
if (!
|
|
109786
|
+
if (!existsSync57(stateFilePath)) {
|
|
109709
109787
|
return "never";
|
|
109710
109788
|
}
|
|
109711
109789
|
let parsed;
|
|
109712
109790
|
try {
|
|
109713
|
-
parsed = JSON.parse(
|
|
109791
|
+
parsed = JSON.parse(readFileSync37(stateFilePath, "utf-8"));
|
|
109714
109792
|
} catch (error51) {
|
|
109715
109793
|
if (error51 instanceof Error) {
|
|
109716
109794
|
return "unreadable";
|
|
@@ -109768,17 +109846,17 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
109768
109846
|
}
|
|
109769
109847
|
|
|
109770
109848
|
// packages/team-core/src/team-registry/paths.ts
|
|
109771
|
-
import { homedir as
|
|
109849
|
+
import { homedir as homedir20 } from "os";
|
|
109772
109850
|
import path12 from "path";
|
|
109773
109851
|
function resolveBaseDir(config4) {
|
|
109774
|
-
return expandHomeDirectory(config4.base_dir ?? path12.join(
|
|
109852
|
+
return expandHomeDirectory(config4.base_dir ?? path12.join(homedir20(), ".omo"));
|
|
109775
109853
|
}
|
|
109776
109854
|
function expandHomeDirectory(directoryPath3) {
|
|
109777
109855
|
if (directoryPath3 === "~") {
|
|
109778
|
-
return
|
|
109856
|
+
return homedir20();
|
|
109779
109857
|
}
|
|
109780
109858
|
if (directoryPath3.startsWith("~/") || directoryPath3.startsWith("~\\")) {
|
|
109781
|
-
return path12.join(
|
|
109859
|
+
return path12.join(homedir20(), directoryPath3.slice(2));
|
|
109782
109860
|
}
|
|
109783
109861
|
return directoryPath3;
|
|
109784
109862
|
}
|
|
@@ -109835,10 +109913,10 @@ async function pathExists(dir) {
|
|
|
109835
109913
|
|
|
109836
109914
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
109837
109915
|
init_src2();
|
|
109838
|
-
import { existsSync as
|
|
109916
|
+
import { existsSync as existsSync58 } from "fs";
|
|
109839
109917
|
import { lstat as lstat15, readdir as readdir14, readFile as readFile27 } from "fs/promises";
|
|
109840
|
-
import { homedir as
|
|
109841
|
-
import { basename as basename11, join as
|
|
109918
|
+
import { homedir as homedir21 } from "os";
|
|
109919
|
+
import { basename as basename11, join as join83, resolve as resolve23 } from "path";
|
|
109842
109920
|
// packages/omo-opencode/package.json
|
|
109843
109921
|
var package_default3 = {
|
|
109844
109922
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -109903,13 +109981,13 @@ var CODEX_BIN_NAMES = [
|
|
|
109903
109981
|
"omo-git-bash-hook"
|
|
109904
109982
|
];
|
|
109905
109983
|
async function gatherCodexSummary(deps = {}) {
|
|
109906
|
-
const codexHome =
|
|
109984
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join83(homedir21(), ".codex"));
|
|
109907
109985
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
109908
109986
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
109909
109987
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
109910
|
-
const manifest2 = pluginRoot === null ? null : await readJson(
|
|
109911
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
109912
|
-
const configPath =
|
|
109988
|
+
const manifest2 = pluginRoot === null ? null : await readJson(join83(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
109989
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join83(pluginRoot, "lazycodex-install.json"));
|
|
109990
|
+
const configPath = join83(codexHome, "config.toml");
|
|
109913
109991
|
const pluginVersion = stringField(manifest2, "version");
|
|
109914
109992
|
return {
|
|
109915
109993
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -109966,7 +110044,7 @@ function buildCodexIssues(summary) {
|
|
|
109966
110044
|
if (summary.pluginRoot === null) {
|
|
109967
110045
|
issues.push({
|
|
109968
110046
|
title: "OMO Codex plugin is not installed",
|
|
109969
|
-
description: `Expected cached plugin at ${
|
|
110047
|
+
description: `Expected cached plugin at ${join83("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
109970
110048
|
fix: "Run: npx lazycodex-ai install",
|
|
109971
110049
|
severity: "error",
|
|
109972
110050
|
affects: ["plugin loading"]
|
|
@@ -110031,15 +110109,15 @@ function buildCodexIssues(summary) {
|
|
|
110031
110109
|
return issues;
|
|
110032
110110
|
}
|
|
110033
110111
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
110034
|
-
const pluginRoot =
|
|
110035
|
-
if (!
|
|
110112
|
+
const pluginRoot = join83(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
110113
|
+
if (!existsSync58(pluginRoot))
|
|
110036
110114
|
return null;
|
|
110037
110115
|
const versions2 = await readdir14(pluginRoot, { withFileTypes: true });
|
|
110038
110116
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
110039
|
-
return candidates.length === 0 ? null :
|
|
110117
|
+
return candidates.length === 0 ? null : join83(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
110040
110118
|
}
|
|
110041
110119
|
async function readCodexConfigSummary(configPath) {
|
|
110042
|
-
if (!
|
|
110120
|
+
if (!existsSync58(configPath)) {
|
|
110043
110121
|
return {
|
|
110044
110122
|
exists: false,
|
|
110045
110123
|
marketplaceConfigured: false,
|
|
@@ -110064,14 +110142,14 @@ async function readCodexConfigSummary(configPath) {
|
|
|
110064
110142
|
async function readLinkedBins(binDir) {
|
|
110065
110143
|
const linked = [];
|
|
110066
110144
|
for (const name of CODEX_BIN_NAMES) {
|
|
110067
|
-
if (await pathExists2(
|
|
110145
|
+
if (await pathExists2(join83(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
110068
110146
|
linked.push(name);
|
|
110069
110147
|
}
|
|
110070
110148
|
return linked;
|
|
110071
110149
|
}
|
|
110072
110150
|
async function readLinkedAgents(codexHome) {
|
|
110073
|
-
const agentsDir =
|
|
110074
|
-
if (!
|
|
110151
|
+
const agentsDir = join83(codexHome, "agents");
|
|
110152
|
+
if (!existsSync58(agentsDir))
|
|
110075
110153
|
return [];
|
|
110076
110154
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
110077
110155
|
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename11(entry.name, ".toml")).sort();
|
|
@@ -110185,8 +110263,8 @@ async function pathExists2(path14) {
|
|
|
110185
110263
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
110186
110264
|
init_src2();
|
|
110187
110265
|
import { readdir as readdir15, readFile as readFile28, stat as stat7 } from "fs/promises";
|
|
110188
|
-
import { homedir as
|
|
110189
|
-
import { dirname as
|
|
110266
|
+
import { homedir as homedir22 } from "os";
|
|
110267
|
+
import { dirname as dirname32, isAbsolute as isAbsolute12, join as join84, relative as relative9, resolve as resolve24, sep as sep9 } from "path";
|
|
110190
110268
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
110191
110269
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
110192
110270
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -110196,7 +110274,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
110196
110274
|
const env3 = deps.env ?? process.env;
|
|
110197
110275
|
const platform = deps.platform ?? process.platform;
|
|
110198
110276
|
const arch = deps.arch ?? process.arch;
|
|
110199
|
-
const codexHome =
|
|
110277
|
+
const codexHome = resolve24(deps.codexHome ?? env3["CODEX_HOME"] ?? join84(homedir22(), ".codex"));
|
|
110200
110278
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
110201
110279
|
if (summary.pluginRoot === null) {
|
|
110202
110280
|
return {
|
|
@@ -110221,7 +110299,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
110221
110299
|
});
|
|
110222
110300
|
}
|
|
110223
110301
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
110224
|
-
const runtimeSgPath =
|
|
110302
|
+
const runtimeSgPath = join84(runtimeSgDir, sgBinaryName(platform));
|
|
110225
110303
|
const sg = findSgBinarySync({
|
|
110226
110304
|
arch,
|
|
110227
110305
|
env: env3,
|
|
@@ -110260,8 +110338,8 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
110260
110338
|
const manifest2 = await readJson2(manifestPath);
|
|
110261
110339
|
if (manifest2 === null || !isRecord12(manifest2["mcpServers"]))
|
|
110262
110340
|
continue;
|
|
110263
|
-
const manifestRoot =
|
|
110264
|
-
const isRootManifest =
|
|
110341
|
+
const manifestRoot = dirname32(manifestPath);
|
|
110342
|
+
const isRootManifest = resolve24(manifestRoot) === resolve24(pluginRoot);
|
|
110265
110343
|
for (const server2 of Object.values(manifest2["mcpServers"])) {
|
|
110266
110344
|
if (!isRecord12(server2) || !Array.isArray(server2["args"]))
|
|
110267
110345
|
continue;
|
|
@@ -110281,7 +110359,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
110281
110359
|
continue;
|
|
110282
110360
|
const commands2 = [];
|
|
110283
110361
|
collectHookCommands(manifest2, commands2);
|
|
110284
|
-
const hookPluginRoot =
|
|
110362
|
+
const hookPluginRoot = dirname32(dirname32(hookManifestPath));
|
|
110285
110363
|
for (const command of commands2) {
|
|
110286
110364
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
110287
110365
|
referencedCount += 1;
|
|
@@ -110303,8 +110381,8 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
110303
110381
|
broken.push(entry);
|
|
110304
110382
|
}
|
|
110305
110383
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
110306
|
-
const targetPath =
|
|
110307
|
-
const bundleRootPath =
|
|
110384
|
+
const targetPath = resolve24(baseRoot, relativePath);
|
|
110385
|
+
const bundleRootPath = resolve24(bundleRoot);
|
|
110308
110386
|
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
110309
110387
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
110310
110388
|
if (allowEscape)
|
|
@@ -110320,7 +110398,7 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
110320
110398
|
}
|
|
110321
110399
|
async function findHookManifestPaths(root) {
|
|
110322
110400
|
const paths3 = await findManifestPaths(root, "hooks.json");
|
|
110323
|
-
return paths3.filter((path14) =>
|
|
110401
|
+
return paths3.filter((path14) => dirname32(path14).endsWith(`${sep9}hooks`));
|
|
110324
110402
|
}
|
|
110325
110403
|
async function findManifestPaths(root, manifestName) {
|
|
110326
110404
|
let entries;
|
|
@@ -110333,7 +110411,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
110333
110411
|
for (const entry of entries) {
|
|
110334
110412
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
110335
110413
|
continue;
|
|
110336
|
-
const entryPath =
|
|
110414
|
+
const entryPath = join84(root, entry.name);
|
|
110337
110415
|
if (entry.isDirectory()) {
|
|
110338
110416
|
paths3.push(...await findManifestPaths(entryPath, manifestName));
|
|
110339
110417
|
continue;
|
|
@@ -110377,18 +110455,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
110377
110455
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute12(arg));
|
|
110378
110456
|
}
|
|
110379
110457
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
110380
|
-
return
|
|
110458
|
+
return join84(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
110381
110459
|
}
|
|
110382
110460
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
110383
110461
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
110384
110462
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
110385
110463
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
110386
|
-
if (sgPath ===
|
|
110464
|
+
if (sgPath === join84(runtimeSgDir, sgBinaryName(platform)))
|
|
110387
110465
|
return "runtime dir";
|
|
110388
110466
|
return "PATH";
|
|
110389
110467
|
}
|
|
110390
110468
|
async function readBootstrapStateSummary(codexHome) {
|
|
110391
|
-
const statePath =
|
|
110469
|
+
const statePath = join84(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
110392
110470
|
const raw = await readJson2(statePath);
|
|
110393
110471
|
if (raw === null)
|
|
110394
110472
|
return null;
|
|
@@ -110464,24 +110542,24 @@ function isRecord12(value) {
|
|
|
110464
110542
|
}
|
|
110465
110543
|
|
|
110466
110544
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
110467
|
-
import { existsSync as
|
|
110545
|
+
import { existsSync as existsSync59 } from "fs";
|
|
110468
110546
|
import { readFile as readFile29 } from "fs/promises";
|
|
110469
|
-
import { homedir as
|
|
110470
|
-
import { join as
|
|
110547
|
+
import { homedir as homedir23 } from "os";
|
|
110548
|
+
import { join as join85, resolve as resolve25 } from "path";
|
|
110471
110549
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
110472
110550
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
110473
110551
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
110474
110552
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
110475
|
-
const codexHome =
|
|
110553
|
+
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join85(homedir23(), ".codex"));
|
|
110476
110554
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
110477
110555
|
const platform = deps.platform ?? process.platform;
|
|
110478
|
-
const wrapperPath =
|
|
110479
|
-
const legacyWrapperPath =
|
|
110556
|
+
const wrapperPath = join85(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
110557
|
+
const legacyWrapperPath = join85(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
110480
110558
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
110481
110559
|
const issues = [];
|
|
110482
110560
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
110483
110561
|
const targetPath = parseRuntimeTargetPath(wrapper);
|
|
110484
|
-
if (targetPath !== null && !
|
|
110562
|
+
if (targetPath !== null && !existsSync59(targetPath)) {
|
|
110485
110563
|
issues.push({
|
|
110486
110564
|
title: "omo-agent-toolkit runtime wrapper target is missing",
|
|
110487
110565
|
description: `Generated omo-agent-toolkit runtime wrapper at ${wrapperPath} points to missing target ${targetPath}.`,
|
|
@@ -110995,24 +111073,24 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
110995
111073
|
// packages/mcp-client-core/src/mcp-oauth/storage.ts
|
|
110996
111074
|
import { createHash as createHash6 } from "crypto";
|
|
110997
111075
|
import {
|
|
110998
|
-
chmodSync as
|
|
110999
|
-
existsSync as
|
|
111000
|
-
mkdirSync as
|
|
111076
|
+
chmodSync as chmodSync5,
|
|
111077
|
+
existsSync as existsSync62,
|
|
111078
|
+
mkdirSync as mkdirSync15,
|
|
111001
111079
|
readdirSync as readdirSync11,
|
|
111002
|
-
readFileSync as
|
|
111080
|
+
readFileSync as readFileSync39,
|
|
111003
111081
|
renameSync as renameSync7,
|
|
111004
111082
|
unlinkSync as unlinkSync9,
|
|
111005
|
-
writeFileSync as
|
|
111083
|
+
writeFileSync as writeFileSync12
|
|
111006
111084
|
} from "fs";
|
|
111007
|
-
import { basename as basename12, dirname as
|
|
111085
|
+
import { basename as basename12, dirname as dirname33, join as join88 } from "path";
|
|
111008
111086
|
|
|
111009
111087
|
// packages/mcp-client-core/src/config-dir.ts
|
|
111010
|
-
import { existsSync as
|
|
111011
|
-
import { homedir as
|
|
111012
|
-
import { join as
|
|
111088
|
+
import { existsSync as existsSync60, realpathSync as realpathSync8 } from "fs";
|
|
111089
|
+
import { homedir as homedir24 } from "os";
|
|
111090
|
+
import { join as join86, resolve as resolve26 } from "path";
|
|
111013
111091
|
function resolveConfigPath2(pathValue) {
|
|
111014
|
-
const resolvedPath =
|
|
111015
|
-
if (!
|
|
111092
|
+
const resolvedPath = resolve26(pathValue);
|
|
111093
|
+
if (!existsSync60(resolvedPath))
|
|
111016
111094
|
return resolvedPath;
|
|
111017
111095
|
try {
|
|
111018
111096
|
return realpathSync8(resolvedPath);
|
|
@@ -111027,13 +111105,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
111027
111105
|
if (customConfigDir) {
|
|
111028
111106
|
return resolveConfigPath2(customConfigDir);
|
|
111029
111107
|
}
|
|
111030
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
111031
|
-
return resolveConfigPath2(
|
|
111108
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join86(homedir24(), ".config");
|
|
111109
|
+
return resolveConfigPath2(join86(xdgConfigDir, "opencode"));
|
|
111032
111110
|
}
|
|
111033
111111
|
|
|
111034
111112
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
111035
|
-
import { chmodSync as
|
|
111036
|
-
import { join as
|
|
111113
|
+
import { chmodSync as chmodSync4, existsSync as existsSync61, readFileSync as readFileSync38, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "fs";
|
|
111114
|
+
import { join as join87 } from "path";
|
|
111037
111115
|
var INDEX_FILE_NAME = "index.json";
|
|
111038
111116
|
function isTokenIndex(value) {
|
|
111039
111117
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -111041,14 +111119,14 @@ function isTokenIndex(value) {
|
|
|
111041
111119
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
111042
111120
|
}
|
|
111043
111121
|
function getIndexPath(storageDir) {
|
|
111044
|
-
return
|
|
111122
|
+
return join87(storageDir, INDEX_FILE_NAME);
|
|
111045
111123
|
}
|
|
111046
111124
|
function readTokenIndex(storageDir) {
|
|
111047
111125
|
const indexPath = getIndexPath(storageDir);
|
|
111048
|
-
if (!
|
|
111126
|
+
if (!existsSync61(indexPath))
|
|
111049
111127
|
return {};
|
|
111050
111128
|
try {
|
|
111051
|
-
const parsed = JSON.parse(
|
|
111129
|
+
const parsed = JSON.parse(readFileSync38(indexPath, "utf-8"));
|
|
111052
111130
|
return isTokenIndex(parsed) ? parsed : {};
|
|
111053
111131
|
} catch (readError) {
|
|
111054
111132
|
if (!(readError instanceof Error))
|
|
@@ -111060,8 +111138,8 @@ function writeTokenIndex(storageDir, index) {
|
|
|
111060
111138
|
try {
|
|
111061
111139
|
const indexPath = getIndexPath(storageDir);
|
|
111062
111140
|
const tempPath = `${indexPath}.tmp.${Date.now()}`;
|
|
111063
|
-
|
|
111064
|
-
|
|
111141
|
+
writeFileSync11(tempPath, JSON.stringify(index, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111142
|
+
chmodSync4(tempPath, 384);
|
|
111065
111143
|
renameSync6(tempPath, indexPath);
|
|
111066
111144
|
return true;
|
|
111067
111145
|
} catch (writeError) {
|
|
@@ -111085,16 +111163,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
111085
111163
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
111086
111164
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
111087
111165
|
function getMcpOauthStorageDir() {
|
|
111088
|
-
return
|
|
111166
|
+
return join88(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
111089
111167
|
}
|
|
111090
111168
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
111091
111169
|
return createHash6("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
111092
111170
|
}
|
|
111093
111171
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
111094
|
-
return
|
|
111172
|
+
return join88(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
111095
111173
|
}
|
|
111096
111174
|
function getLegacyStoragePath() {
|
|
111097
|
-
return
|
|
111175
|
+
return join88(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
111098
111176
|
}
|
|
111099
111177
|
function normalizeHost2(serverHost) {
|
|
111100
111178
|
let host = serverHost.trim();
|
|
@@ -111155,10 +111233,10 @@ function isOAuthTokenData(value) {
|
|
|
111155
111233
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
111156
111234
|
}
|
|
111157
111235
|
function readTokenFile(filePath) {
|
|
111158
|
-
if (!
|
|
111236
|
+
if (!existsSync62(filePath))
|
|
111159
111237
|
return null;
|
|
111160
111238
|
try {
|
|
111161
|
-
const parsed = JSON.parse(
|
|
111239
|
+
const parsed = JSON.parse(readFileSync39(filePath, "utf-8"));
|
|
111162
111240
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
111163
111241
|
} catch (readError) {
|
|
111164
111242
|
if (!(readError instanceof Error))
|
|
@@ -111168,10 +111246,10 @@ function readTokenFile(filePath) {
|
|
|
111168
111246
|
}
|
|
111169
111247
|
function readLegacyStore() {
|
|
111170
111248
|
const filePath = getLegacyStoragePath();
|
|
111171
|
-
if (!
|
|
111249
|
+
if (!existsSync62(filePath))
|
|
111172
111250
|
return null;
|
|
111173
111251
|
try {
|
|
111174
|
-
const parsed = JSON.parse(
|
|
111252
|
+
const parsed = JSON.parse(readFileSync39(filePath, "utf-8"));
|
|
111175
111253
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
111176
111254
|
return null;
|
|
111177
111255
|
const result = {};
|
|
@@ -111188,13 +111266,13 @@ function readLegacyStore() {
|
|
|
111188
111266
|
}
|
|
111189
111267
|
function writeTokenFile(filePath, token) {
|
|
111190
111268
|
try {
|
|
111191
|
-
const dir =
|
|
111192
|
-
if (!
|
|
111193
|
-
|
|
111269
|
+
const dir = dirname33(filePath);
|
|
111270
|
+
if (!existsSync62(dir)) {
|
|
111271
|
+
mkdirSync15(dir, { recursive: true });
|
|
111194
111272
|
}
|
|
111195
111273
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
111196
|
-
|
|
111197
|
-
|
|
111274
|
+
writeFileSync12(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111275
|
+
chmodSync5(tempPath, 384);
|
|
111198
111276
|
renameSync7(tempPath, filePath);
|
|
111199
111277
|
return true;
|
|
111200
111278
|
} catch (writeError) {
|
|
@@ -111213,7 +111291,7 @@ function saveToken(serverHost, resource, token) {
|
|
|
111213
111291
|
}
|
|
111214
111292
|
function deleteToken(serverHost, resource) {
|
|
111215
111293
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
111216
|
-
if (!
|
|
111294
|
+
if (!existsSync62(filePath))
|
|
111217
111295
|
return deleteLegacyToken(serverHost, resource);
|
|
111218
111296
|
try {
|
|
111219
111297
|
unlinkSync9(filePath);
|
|
@@ -111235,7 +111313,7 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
111235
111313
|
if (Object.keys(store2).length === 0) {
|
|
111236
111314
|
try {
|
|
111237
111315
|
const filePath = getLegacyStoragePath();
|
|
111238
|
-
if (
|
|
111316
|
+
if (existsSync62(filePath))
|
|
111239
111317
|
unlinkSync9(filePath);
|
|
111240
111318
|
return true;
|
|
111241
111319
|
} catch (deleteError) {
|
|
@@ -111249,8 +111327,8 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
111249
111327
|
function writeLegacyStore(store2) {
|
|
111250
111328
|
try {
|
|
111251
111329
|
const filePath = getLegacyStoragePath();
|
|
111252
|
-
|
|
111253
|
-
|
|
111330
|
+
writeFileSync12(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111331
|
+
chmodSync5(filePath, 384);
|
|
111254
111332
|
return true;
|
|
111255
111333
|
} catch (writeError) {
|
|
111256
111334
|
if (!(writeError instanceof Error))
|
|
@@ -111273,7 +111351,7 @@ function listTokensByHost(serverHost) {
|
|
|
111273
111351
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
111274
111352
|
if (!indexedKey.startsWith(prefix))
|
|
111275
111353
|
continue;
|
|
111276
|
-
const indexedToken = readTokenFile(
|
|
111354
|
+
const indexedToken = readTokenFile(join88(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
111277
111355
|
if (indexedToken)
|
|
111278
111356
|
result[indexedKey] = indexedToken;
|
|
111279
111357
|
}
|
|
@@ -111282,13 +111360,13 @@ function listTokensByHost(serverHost) {
|
|
|
111282
111360
|
function listAllTokens() {
|
|
111283
111361
|
const result = { ...readLegacyStore() ?? {} };
|
|
111284
111362
|
const dir = getMcpOauthStorageDir();
|
|
111285
|
-
if (!
|
|
111363
|
+
if (!existsSync62(dir))
|
|
111286
111364
|
return result;
|
|
111287
111365
|
const index = readTokenIndex(dir);
|
|
111288
111366
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
111289
111367
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
111290
111368
|
continue;
|
|
111291
|
-
const token = readTokenFile(
|
|
111369
|
+
const token = readTokenFile(join88(dir, entry.name));
|
|
111292
111370
|
const hash2 = basename12(entry.name, ".json");
|
|
111293
111371
|
if (token)
|
|
111294
111372
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -111488,7 +111566,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
|
111488
111566
|
}
|
|
111489
111567
|
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
111490
111568
|
function startCallbackServer(port) {
|
|
111491
|
-
return new Promise((
|
|
111569
|
+
return new Promise((resolve27, reject) => {
|
|
111492
111570
|
let timeoutId;
|
|
111493
111571
|
const server2 = createServer2((request, response) => {
|
|
111494
111572
|
clearTimeout(timeoutId);
|
|
@@ -111514,7 +111592,7 @@ function startCallbackServer(port) {
|
|
|
111514
111592
|
response.writeHead(200, { "content-type": "text/html" });
|
|
111515
111593
|
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
|
|
111516
111594
|
server2.close();
|
|
111517
|
-
|
|
111595
|
+
resolve27({ code, state: state2 });
|
|
111518
111596
|
});
|
|
111519
111597
|
timeoutId = setTimeout(() => {
|
|
111520
111598
|
server2.close();
|
|
@@ -111854,7 +111932,7 @@ function createMcpOAuthCommand() {
|
|
|
111854
111932
|
}
|
|
111855
111933
|
|
|
111856
111934
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
111857
|
-
import { existsSync as
|
|
111935
|
+
import { existsSync as existsSync63 } from "fs";
|
|
111858
111936
|
|
|
111859
111937
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
111860
111938
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -111991,10 +112069,10 @@ async function boulder(options) {
|
|
|
111991
112069
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
111992
112070
|
const state2 = readBoulderState(directory);
|
|
111993
112071
|
if (!state2) {
|
|
111994
|
-
const message =
|
|
112072
|
+
const message = existsSync63(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
111995
112073
|
process.stderr.write(`${message}
|
|
111996
112074
|
`);
|
|
111997
|
-
return
|
|
112075
|
+
return existsSync63(boulderFilePath) ? 2 : 1;
|
|
111998
112076
|
}
|
|
111999
112077
|
const works = getBoulderWorks(state2);
|
|
112000
112078
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -112012,12 +112090,12 @@ async function boulder(options) {
|
|
|
112012
112090
|
}
|
|
112013
112091
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
112014
112092
|
import { spawn as spawn5 } from "child_process";
|
|
112015
|
-
import { existsSync as
|
|
112016
|
-
import { homedir as
|
|
112093
|
+
import { existsSync as existsSync64, readFileSync as readFileSync40, realpathSync as realpathSync9 } from "fs";
|
|
112094
|
+
import { homedir as homedir25 } from "os";
|
|
112017
112095
|
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
|
|
112018
112096
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
112019
112097
|
const env3 = input.env ?? process.env;
|
|
112020
|
-
const homeDir = input.homeDir ??
|
|
112098
|
+
const homeDir = input.homeDir ?? homedir25();
|
|
112021
112099
|
const localComponentBin = resolveLocalUlwLoopBin(env3, homeDir);
|
|
112022
112100
|
if (localComponentBin !== null)
|
|
112023
112101
|
return { executable: localComponentBin, argsPrefix: [] };
|
|
@@ -112040,29 +112118,29 @@ async function codexUlwLoop(args) {
|
|
|
112040
112118
|
console.error("Codex ulw-loop is not installed. Run: npx lazycodex-ai@latest install --no-tui");
|
|
112041
112119
|
return 1;
|
|
112042
112120
|
}
|
|
112043
|
-
const { promise: promise2, resolve:
|
|
112121
|
+
const { promise: promise2, resolve: resolve27 } = Promise.withResolvers();
|
|
112044
112122
|
const child = spawn5(command.executable, [...command.argsPrefix, ...args], {
|
|
112045
112123
|
stdio: "inherit",
|
|
112046
112124
|
env: { ...process.env, [ULW_LOOP_DELEGATION_SENTINEL]: "1" }
|
|
112047
112125
|
});
|
|
112048
112126
|
child.on("error", (error51) => {
|
|
112049
112127
|
console.error(error51.message);
|
|
112050
|
-
|
|
112128
|
+
resolve27(1);
|
|
112051
112129
|
});
|
|
112052
|
-
child.on("close", (code) =>
|
|
112130
|
+
child.on("close", (code) => resolve27(code ?? 1));
|
|
112053
112131
|
return promise2;
|
|
112054
112132
|
}
|
|
112055
112133
|
function resolveLocalUlwLoopBin(env3, homeDir) {
|
|
112056
112134
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo-ulw-loop", env: env3, homeDir });
|
|
112057
|
-
return candidates.find((candidate2) =>
|
|
112135
|
+
return candidates.find((candidate2) => existsSync64(candidate2)) ?? null;
|
|
112058
112136
|
}
|
|
112059
112137
|
function resolveLegacyLocalOmoBin(env3, homeDir, currentExecutablePaths) {
|
|
112060
112138
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo", env: env3, homeDir });
|
|
112061
|
-
return candidates.find((candidate2) =>
|
|
112139
|
+
return candidates.find((candidate2) => existsSync64(candidate2) && !isCurrentExecutable(candidate2, currentExecutablePaths) && !isGeneratedRuntimeWrapper(candidate2)) ?? null;
|
|
112062
112140
|
}
|
|
112063
112141
|
function isGeneratedRuntimeWrapper(candidate2) {
|
|
112064
112142
|
try {
|
|
112065
|
-
return
|
|
112143
|
+
return readFileSync40(candidate2, "utf8").includes(RUNTIME_WRAPPER_MARKER);
|
|
112066
112144
|
} catch (error51) {
|
|
112067
112145
|
if (error51 instanceof Error)
|
|
112068
112146
|
return false;
|