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