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