lazycodex-ai 5.0.0-beta.60 → 5.0.0-beta.62
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 +418 -330
- package/dist/cli-node/index.js +418 -330
- package/package.json +1 -1
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +6885 -249
- 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/bootstrap/src/setup.ts +7 -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/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/dist/cli.js +20 -11
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/src/directive-content.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/CHANGELOG.md +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +20 -11
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +58 -5
- package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/factory.js +17 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.d.ts +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.js +21 -4
- package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-role-guard.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-role-guard.js +22 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +7 -7
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/sdk/factory.ts +25 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/spawn-guard.ts +21 -3
- package/packages/omo-codex/plugin/components/ulw-loop/src/spawn-role-guard.ts +22 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/sdk-driver-states.test.ts +145 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/spawn-guard.test.ts +7 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/spawn-role-matrix.test.ts +113 -0
- 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-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/post-tool-use-recording-spawn-admission.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-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-ulw-execute-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-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 +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +3 -3
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +20 -11
- package/packages/omo-codex/plugin/skills/ulw-execute/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +3 -3
- package/packages/omo-codex/plugin/test/bootstrap-default-role.test.mjs +66 -0
- package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +13 -1
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +7058 -417
- package/packages/prompts-core/prompts/ultrawork/codex.md +20 -11
package/dist/cli-node/index.js
CHANGED
|
@@ -65,7 +65,7 @@ var package_default;
|
|
|
65
65
|
var init_package = __esm(() => {
|
|
66
66
|
package_default = {
|
|
67
67
|
name: "oh-my-opencode",
|
|
68
|
-
version: "5.0.0-beta.
|
|
68
|
+
version: "5.0.0-beta.62",
|
|
69
69
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
70
70
|
main: "./dist/index.js",
|
|
71
71
|
types: "dist/index.d.ts",
|
|
@@ -250,7 +250,7 @@ var init_package = __esm(() => {
|
|
|
250
250
|
zod: "^4.4.3"
|
|
251
251
|
},
|
|
252
252
|
devDependencies: {
|
|
253
|
-
"@code-yeongyu/senpi": "2026.9.
|
|
253
|
+
"@code-yeongyu/senpi": "2026.9.13",
|
|
254
254
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
255
255
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
256
256
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -291,18 +291,18 @@ var init_package = __esm(() => {
|
|
|
291
291
|
typescript: "^7.0.2"
|
|
292
292
|
},
|
|
293
293
|
optionalDependencies: {
|
|
294
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
295
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
296
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
297
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
298
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
299
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
300
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
301
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
302
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
303
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
304
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
305
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
294
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.62",
|
|
295
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.62",
|
|
296
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.62",
|
|
297
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.62",
|
|
298
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.62",
|
|
299
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.62",
|
|
300
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.62",
|
|
301
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.62",
|
|
302
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.62",
|
|
303
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.62",
|
|
304
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.62",
|
|
305
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.62"
|
|
306
306
|
},
|
|
307
307
|
overrides: {
|
|
308
308
|
"@earendil-works/pi-agent-core": "0.84.2",
|
|
@@ -77023,20 +77023,20 @@ var init_config_manager = __esm(() => {
|
|
|
77023
77023
|
|
|
77024
77024
|
// packages/telemetry-core/src/activity-state.ts
|
|
77025
77025
|
import { existsSync as existsSync24, mkdirSync as mkdirSync8, readFileSync as readFileSync11 } from "node:fs";
|
|
77026
|
-
import { basename as basename8, join as
|
|
77026
|
+
import { basename as basename8, join as join51 } from "node:path";
|
|
77027
77027
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
77028
77028
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
77029
77029
|
env: options.env,
|
|
77030
77030
|
osProvider: options.osProvider
|
|
77031
77031
|
});
|
|
77032
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
77032
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join51(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
77033
77033
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename8(dataDir) === product.cacheDirName) {
|
|
77034
77034
|
return dataDir;
|
|
77035
77035
|
}
|
|
77036
|
-
return
|
|
77036
|
+
return join51(dataDir, product.cacheDirName);
|
|
77037
77037
|
}
|
|
77038
77038
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
77039
|
-
return
|
|
77039
|
+
return join51(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
77040
77040
|
}
|
|
77041
77041
|
function getDailyActiveCaptureState(input) {
|
|
77042
77042
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -77107,9 +77107,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
77107
77107
|
|
|
77108
77108
|
// packages/telemetry-core/src/diagnostics.ts
|
|
77109
77109
|
import { appendFileSync as appendFileSync2, existsSync as existsSync25, mkdirSync as mkdirSync9, readFileSync as readFileSync12 } from "node:fs";
|
|
77110
|
-
import { join as
|
|
77110
|
+
import { join as join52 } from "node:path";
|
|
77111
77111
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
77112
|
-
return
|
|
77112
|
+
return join52(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
77113
77113
|
}
|
|
77114
77114
|
function writeTelemetryDiagnostic(input, options) {
|
|
77115
77115
|
const now = options.now ?? new Date;
|
|
@@ -84416,13 +84416,13 @@ var init_index_node = __esm(() => {
|
|
|
84416
84416
|
});
|
|
84417
84417
|
|
|
84418
84418
|
// packages/telemetry-core/src/machine-id.ts
|
|
84419
|
-
import { createHash as
|
|
84419
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
84420
84420
|
import os4 from "node:os";
|
|
84421
84421
|
function getDefaultTelemetryOsProvider() {
|
|
84422
84422
|
return os4;
|
|
84423
84423
|
}
|
|
84424
84424
|
function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetryOsProvider()) {
|
|
84425
|
-
return
|
|
84425
|
+
return createHash5("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
|
|
84426
84426
|
}
|
|
84427
84427
|
var init_machine_id = () => {};
|
|
84428
84428
|
|
|
@@ -84621,7 +84621,7 @@ var package_default2;
|
|
|
84621
84621
|
var init_package2 = __esm(() => {
|
|
84622
84622
|
package_default2 = {
|
|
84623
84623
|
name: "@oh-my-opencode/omo-codex",
|
|
84624
|
-
version: "5.0.0-beta.
|
|
84624
|
+
version: "5.0.0-beta.62",
|
|
84625
84625
|
type: "module",
|
|
84626
84626
|
private: true,
|
|
84627
84627
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -85493,7 +85493,7 @@ var init_update_toasts = __esm(() => {
|
|
|
85493
85493
|
|
|
85494
85494
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
85495
85495
|
import { existsSync as existsSync46 } from "node:fs";
|
|
85496
|
-
import { dirname as dirname30, join as
|
|
85496
|
+
import { dirname as dirname30, join as join74 } from "node:path";
|
|
85497
85497
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
85498
85498
|
function defaultGetModuleHostingWorkspace() {
|
|
85499
85499
|
try {
|
|
@@ -85647,7 +85647,7 @@ var init_background_update_check = __esm(() => {
|
|
|
85647
85647
|
init_update_toasts();
|
|
85648
85648
|
defaultDeps4 = {
|
|
85649
85649
|
existsSync: existsSync46,
|
|
85650
|
-
join:
|
|
85650
|
+
join: join74,
|
|
85651
85651
|
runBunInstallWithDetails,
|
|
85652
85652
|
log: log2,
|
|
85653
85653
|
getOpenCodeCacheDir,
|
|
@@ -88069,7 +88069,19 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
88069
88069
|
}
|
|
88070
88070
|
|
|
88071
88071
|
// packages/omo-codex/src/install/install-codex.ts
|
|
88072
|
-
import { join as
|
|
88072
|
+
import { join as join53, resolve as resolve12 } from "node:path";
|
|
88073
|
+
|
|
88074
|
+
// packages/omo-codex/src/install/codex-default-role-config.ts
|
|
88075
|
+
init_src4();
|
|
88076
|
+
function readDefaultRoleConfig(options = {}) {
|
|
88077
|
+
const result = loadOmoConfig({ ...options, harness: "codex" });
|
|
88078
|
+
return {
|
|
88079
|
+
enabled: result.config.agents?.default?.disable !== true,
|
|
88080
|
+
warnings: result.diagnostics.map((diagnostic) => diagnostic.message)
|
|
88081
|
+
};
|
|
88082
|
+
}
|
|
88083
|
+
|
|
88084
|
+
// packages/omo-codex/src/install/install-codex.ts
|
|
88073
88085
|
import { existsSync as existsSync26 } from "node:fs";
|
|
88074
88086
|
import { homedir as homedir6 } from "node:os";
|
|
88075
88087
|
|
|
@@ -89996,6 +90008,12 @@ function removeStaleManagedAgentBlocks(config, keepAgentNames) {
|
|
|
89996
90008
|
|
|
89997
90009
|
`);
|
|
89998
90010
|
}
|
|
90011
|
+
function hasForeignAgentRegistration(config, agentConfig) {
|
|
90012
|
+
const section = findTomlSection(config, `agents.${tomlKeySegment(agentConfig.name)}`);
|
|
90013
|
+
if (!section)
|
|
90014
|
+
return false;
|
|
90015
|
+
return !section.text.includes(`config_file = ${JSON.stringify(agentConfig.configFile)}`);
|
|
90016
|
+
}
|
|
89999
90017
|
function ensureAgentConfig(config, agentConfig) {
|
|
90000
90018
|
const header = `agents.${tomlKeySegment(agentConfig.name)}`;
|
|
90001
90019
|
const section = findTomlSection(config, header);
|
|
@@ -90965,8 +90983,8 @@ function toCodexResolution(resolution) {
|
|
|
90965
90983
|
}
|
|
90966
90984
|
|
|
90967
90985
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
90968
|
-
import { copyFile, lstat as
|
|
90969
|
-
import { basename as basename6, join as
|
|
90986
|
+
import { copyFile, lstat as lstat10, mkdir as mkdir6, readdir as readdir7, rm as rm9, writeFile as writeFile7 } from "node:fs/promises";
|
|
90987
|
+
import { basename as basename6, join as join41 } from "node:path";
|
|
90970
90988
|
|
|
90971
90989
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
90972
90990
|
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
@@ -91383,6 +91401,66 @@ function nodeErrorCode2(error) {
|
|
|
91383
91401
|
return typeof error.code === "string" ? error.code : null;
|
|
91384
91402
|
}
|
|
91385
91403
|
|
|
91404
|
+
// packages/omo-codex/src/install/default-agent-role.ts
|
|
91405
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
91406
|
+
import { lstat as lstat9, readFile as readFile15, rm as rm8 } from "node:fs/promises";
|
|
91407
|
+
import { join as join40 } from "node:path";
|
|
91408
|
+
var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
|
|
91409
|
+
async function installDefaultAgentRole(input) {
|
|
91410
|
+
const target = join40(input.codexHome, "agents", "default.toml");
|
|
91411
|
+
const receipt = join40(input.codexHome, "agents", ".lazycodex-default.sha256");
|
|
91412
|
+
const configPath = join40(input.codexHome, "config.toml");
|
|
91413
|
+
const config = await readIfPresent(configPath);
|
|
91414
|
+
const entry = await lstat9(target).catch((error) => {
|
|
91415
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
91416
|
+
return null;
|
|
91417
|
+
throw error;
|
|
91418
|
+
});
|
|
91419
|
+
if (entry !== null && !entry.isFile()) {
|
|
91420
|
+
if (!input.enabled)
|
|
91421
|
+
return null;
|
|
91422
|
+
throw new Error("Preserved user-owned agents/default.toml: refusing to replace a symlink or directory");
|
|
91423
|
+
}
|
|
91424
|
+
const existing = await readIfPresent(target);
|
|
91425
|
+
const digest = await readIfPresent(receipt);
|
|
91426
|
+
const owned = existing !== null && digest === hash(existing);
|
|
91427
|
+
const foreign = hasForeignAgentRegistration(config ?? "", REGISTRATION);
|
|
91428
|
+
if (!input.enabled) {
|
|
91429
|
+
if (owned) {
|
|
91430
|
+
if (!foreign && config !== null) {
|
|
91431
|
+
const next = splitTomlSections(config).filter((section) => section.header === null || parseAgentHeaderName(section.header) !== "default").map((section) => section.text).join("");
|
|
91432
|
+
if (next !== config)
|
|
91433
|
+
await writeFileAtomic(configPath, next);
|
|
91434
|
+
}
|
|
91435
|
+
await rm8(target);
|
|
91436
|
+
await rm8(receipt);
|
|
91437
|
+
}
|
|
91438
|
+
return null;
|
|
91439
|
+
}
|
|
91440
|
+
if (foreign || existing !== null && !owned) {
|
|
91441
|
+
throw new Error("Preserved user-owned agents.default / agents/default.toml. Move it aside to install the LazyCodex fallback, or set [codex].agents.default.disable = true in omo.jsonc. Explicit LazyCodex roles remain required.");
|
|
91442
|
+
}
|
|
91443
|
+
const worker = await readFile15(input.worker.path, "utf8");
|
|
91444
|
+
const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
|
|
91445
|
+
if (content === worker)
|
|
91446
|
+
throw new Error("Cannot derive default: medium worker has no matching internal name");
|
|
91447
|
+
await writeFileAtomic(target, content);
|
|
91448
|
+
await writeFileAtomic(receipt, hash(content));
|
|
91449
|
+
return { name: "default.toml", path: target, target: input.worker.target };
|
|
91450
|
+
}
|
|
91451
|
+
async function readIfPresent(path) {
|
|
91452
|
+
try {
|
|
91453
|
+
return await readFile15(path, "utf8");
|
|
91454
|
+
} catch (error) {
|
|
91455
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
91456
|
+
return null;
|
|
91457
|
+
throw error;
|
|
91458
|
+
}
|
|
91459
|
+
}
|
|
91460
|
+
function hash(content) {
|
|
91461
|
+
return createHash3("sha256").update(content).digest("hex");
|
|
91462
|
+
}
|
|
91463
|
+
|
|
91386
91464
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
91387
91465
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
91388
91466
|
async function linkCachedPluginAgents(input) {
|
|
@@ -91392,13 +91470,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
91392
91470
|
await writeManifest(input.pluginRoot, []);
|
|
91393
91471
|
return [];
|
|
91394
91472
|
}
|
|
91395
|
-
const agentsDir =
|
|
91473
|
+
const agentsDir = join41(input.codexHome, "agents");
|
|
91396
91474
|
await mkdir6(agentsDir, { recursive: true });
|
|
91397
91475
|
const linked = [];
|
|
91398
91476
|
for (const agentPath of bundledAgents) {
|
|
91399
91477
|
const agentFileName = basename6(agentPath);
|
|
91400
91478
|
const agentName = agentNameFromToml2(agentFileName);
|
|
91401
|
-
const linkPath =
|
|
91479
|
+
const linkPath = join41(agentsDir, agentFileName);
|
|
91402
91480
|
await replaceWithCopy(linkPath, agentPath);
|
|
91403
91481
|
await restorePreservedReasoning({
|
|
91404
91482
|
agentName,
|
|
@@ -91413,11 +91491,17 @@ async function linkCachedPluginAgents(input) {
|
|
|
91413
91491
|
});
|
|
91414
91492
|
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
91415
91493
|
}
|
|
91494
|
+
const worker = linked.find((entry) => entry.name === "lazycodex-worker-medium.toml");
|
|
91495
|
+
if (worker !== undefined) {
|
|
91496
|
+
const fallback = await installDefaultAgentRole({ codexHome: input.codexHome, worker, enabled: input.defaultRoleEnabled !== false });
|
|
91497
|
+
if (fallback !== null)
|
|
91498
|
+
linked.push(fallback);
|
|
91499
|
+
}
|
|
91416
91500
|
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
91417
91501
|
return linked;
|
|
91418
91502
|
}
|
|
91419
91503
|
async function discoverBundledAgents(pluginRoot) {
|
|
91420
|
-
const componentsRoot =
|
|
91504
|
+
const componentsRoot = join41(pluginRoot, "components");
|
|
91421
91505
|
if (!await exists4(componentsRoot))
|
|
91422
91506
|
return [];
|
|
91423
91507
|
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
@@ -91425,14 +91509,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
91425
91509
|
for (const entry of componentEntries) {
|
|
91426
91510
|
if (!entry.isDirectory())
|
|
91427
91511
|
continue;
|
|
91428
|
-
const agentsRoot =
|
|
91512
|
+
const agentsRoot = join41(componentsRoot, entry.name, "agents");
|
|
91429
91513
|
if (!await exists4(agentsRoot))
|
|
91430
91514
|
continue;
|
|
91431
91515
|
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
91432
91516
|
for (const file of agentEntries) {
|
|
91433
91517
|
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
91434
91518
|
continue;
|
|
91435
|
-
agents.push(
|
|
91519
|
+
agents.push(join41(agentsRoot, file.name));
|
|
91436
91520
|
}
|
|
91437
91521
|
}
|
|
91438
91522
|
agents.sort();
|
|
@@ -91445,14 +91529,14 @@ async function replaceWithCopy(linkPath, target) {
|
|
|
91445
91529
|
async function prepareReplacement(linkPath) {
|
|
91446
91530
|
if (!await exists4(linkPath))
|
|
91447
91531
|
return;
|
|
91448
|
-
const entryStat = await
|
|
91532
|
+
const entryStat = await lstat10(linkPath);
|
|
91449
91533
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
91450
91534
|
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
91451
91535
|
}
|
|
91452
|
-
await
|
|
91536
|
+
await rm9(linkPath, { force: true });
|
|
91453
91537
|
}
|
|
91454
91538
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
91455
|
-
const manifestPath =
|
|
91539
|
+
const manifestPath = join41(pluginRoot, MANIFEST_FILE);
|
|
91456
91540
|
const payload = { agents: [...agentPaths].sort() };
|
|
91457
91541
|
await writeFile7(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
91458
91542
|
`);
|
|
@@ -91462,7 +91546,7 @@ function agentNameFromToml2(fileName) {
|
|
|
91462
91546
|
}
|
|
91463
91547
|
async function exists4(path) {
|
|
91464
91548
|
try {
|
|
91465
|
-
await
|
|
91549
|
+
await lstat10(path);
|
|
91466
91550
|
return true;
|
|
91467
91551
|
} catch (error) {
|
|
91468
91552
|
if (nodeErrorCode3(error) !== "ENOENT")
|
|
@@ -91477,12 +91561,12 @@ function nodeErrorCode3(error) {
|
|
|
91477
91561
|
}
|
|
91478
91562
|
|
|
91479
91563
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
91480
|
-
import { readFile as
|
|
91481
|
-
import { join as
|
|
91564
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
91565
|
+
import { join as join42 } from "node:path";
|
|
91482
91566
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
91483
91567
|
async function readMarketplace(repoRoot, options) {
|
|
91484
|
-
const marketplacePath = options?.marketplacePath ??
|
|
91485
|
-
const raw = await
|
|
91568
|
+
const marketplacePath = options?.marketplacePath ?? join42(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
91569
|
+
const raw = await readFile16(marketplacePath, "utf8");
|
|
91486
91570
|
const parsed = JSON.parse(raw);
|
|
91487
91571
|
if (!isPlainRecord4(parsed))
|
|
91488
91572
|
throw new Error("marketplace.json must be an object");
|
|
@@ -91500,10 +91584,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
91500
91584
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
91501
91585
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
91502
91586
|
const relativePath = sourcePath.slice(2);
|
|
91503
|
-
return
|
|
91587
|
+
return join42(repoRoot, ...relativePath.split(/[\\/]/));
|
|
91504
91588
|
}
|
|
91505
91589
|
async function readPluginManifest(pluginRoot) {
|
|
91506
|
-
const raw = await
|
|
91590
|
+
const raw = await readFile16(join42(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
91507
91591
|
const parsed = JSON.parse(raw);
|
|
91508
91592
|
if (!isPlainRecord4(parsed))
|
|
91509
91593
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -91584,8 +91668,8 @@ function validateLocalSourcePath(path) {
|
|
|
91584
91668
|
}
|
|
91585
91669
|
|
|
91586
91670
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
91587
|
-
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as
|
|
91588
|
-
import { join as
|
|
91671
|
+
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm10, writeFile as writeFile8 } from "node:fs/promises";
|
|
91672
|
+
import { join as join43, sep as sep6 } from "node:path";
|
|
91589
91673
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
91590
91674
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
91591
91675
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -91598,28 +91682,28 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
91598
91682
|
return snapshotPlugins;
|
|
91599
91683
|
}
|
|
91600
91684
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
91601
|
-
return
|
|
91685
|
+
return join43(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
91602
91686
|
}
|
|
91603
91687
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
91604
|
-
const manifestDir =
|
|
91688
|
+
const manifestDir = join43(marketplaceRoot, ".agents", "plugins");
|
|
91605
91689
|
await mkdir7(manifestDir, { recursive: true });
|
|
91606
|
-
const tempPath =
|
|
91690
|
+
const tempPath = join43(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
91607
91691
|
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
91608
91692
|
`);
|
|
91609
|
-
await rename4(tempPath,
|
|
91693
|
+
await rename4(tempPath, join43(manifestDir, "marketplace.json"));
|
|
91610
91694
|
}
|
|
91611
91695
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
91612
|
-
const pluginsDir =
|
|
91696
|
+
const pluginsDir = join43(marketplaceRoot, "plugins");
|
|
91613
91697
|
await mkdir7(pluginsDir, { recursive: true });
|
|
91614
|
-
const targetPath =
|
|
91615
|
-
const tempPath =
|
|
91616
|
-
await
|
|
91698
|
+
const targetPath = join43(pluginsDir, plugin.name);
|
|
91699
|
+
const tempPath = join43(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
91700
|
+
await rm10(tempPath, { recursive: true, force: true });
|
|
91617
91701
|
await cp3(plugin.sourcePath, tempPath, {
|
|
91618
91702
|
recursive: true,
|
|
91619
91703
|
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
91620
91704
|
});
|
|
91621
91705
|
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
91622
|
-
await
|
|
91706
|
+
await rm10(targetPath, { recursive: true, force: true });
|
|
91623
91707
|
await rename4(tempPath, targetPath);
|
|
91624
91708
|
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
91625
91709
|
return { name: plugin.name, path: targetPath };
|
|
@@ -91633,11 +91717,11 @@ function shouldCopyMarketplaceSourcePath(path, root) {
|
|
|
91633
91717
|
}
|
|
91634
91718
|
|
|
91635
91719
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
91636
|
-
import { readdir as readdir8, readFile as
|
|
91637
|
-
import { join as
|
|
91720
|
+
import { readdir as readdir8, readFile as readFile17, writeFile as writeFile9 } from "node:fs/promises";
|
|
91721
|
+
import { join as join44 } from "node:path";
|
|
91638
91722
|
async function readDistributionManifest(repoRoot) {
|
|
91639
91723
|
try {
|
|
91640
|
-
const parsed = JSON.parse(await
|
|
91724
|
+
const parsed = JSON.parse(await readFile17(join44(repoRoot, "package.json"), "utf8"));
|
|
91641
91725
|
if (!isPlainRecord4(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
91642
91726
|
return;
|
|
91643
91727
|
return {
|
|
@@ -91661,19 +91745,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
91661
91745
|
return input.manifestVersion ?? "local";
|
|
91662
91746
|
}
|
|
91663
91747
|
async function stampLazyCodexPluginVersion(input) {
|
|
91664
|
-
const manifestPath =
|
|
91748
|
+
const manifestPath = join44(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
91665
91749
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
91666
91750
|
await stampJsonVersion(manifestPath, input.version);
|
|
91667
|
-
await stampJsonVersion(
|
|
91751
|
+
await stampJsonVersion(join44(input.pluginRoot, "package.json"), input.version);
|
|
91668
91752
|
for (const hookPath of hookPaths) {
|
|
91669
|
-
await stampHookStatusMessages(
|
|
91753
|
+
await stampHookStatusMessages(join44(input.pluginRoot, hookPath), input.version);
|
|
91670
91754
|
}
|
|
91671
91755
|
await stampComponentVersions(input);
|
|
91672
91756
|
}
|
|
91673
91757
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
91674
91758
|
if (input.distributionManifest === undefined)
|
|
91675
91759
|
return;
|
|
91676
|
-
await writeFile9(
|
|
91760
|
+
await writeFile9(join44(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
91677
91761
|
packageName: input.distributionManifest.name,
|
|
91678
91762
|
version: input.distributionManifest.version
|
|
91679
91763
|
}, null, "\t")}
|
|
@@ -91681,7 +91765,7 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
91681
91765
|
}
|
|
91682
91766
|
async function stampJsonVersion(path, version) {
|
|
91683
91767
|
try {
|
|
91684
|
-
const parsed = JSON.parse(await
|
|
91768
|
+
const parsed = JSON.parse(await readFile17(path, "utf8"));
|
|
91685
91769
|
if (!isPlainRecord4(parsed))
|
|
91686
91770
|
return;
|
|
91687
91771
|
parsed.version = version;
|
|
@@ -91695,7 +91779,7 @@ async function stampJsonVersion(path, version) {
|
|
|
91695
91779
|
}
|
|
91696
91780
|
async function readPluginHookPaths(manifestPath) {
|
|
91697
91781
|
try {
|
|
91698
|
-
const parsed = JSON.parse(await
|
|
91782
|
+
const parsed = JSON.parse(await readFile17(manifestPath, "utf8"));
|
|
91699
91783
|
if (!isPlainRecord4(parsed))
|
|
91700
91784
|
return [];
|
|
91701
91785
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
@@ -91715,7 +91799,7 @@ function stripDotSlash3(path) {
|
|
|
91715
91799
|
}
|
|
91716
91800
|
async function stampHookStatusMessages(path, version) {
|
|
91717
91801
|
try {
|
|
91718
|
-
const parsed = JSON.parse(await
|
|
91802
|
+
const parsed = JSON.parse(await readFile17(path, "utf8"));
|
|
91719
91803
|
if (!isPlainRecord4(parsed))
|
|
91720
91804
|
return;
|
|
91721
91805
|
stampHookGroups(parsed.hooks, version);
|
|
@@ -91730,16 +91814,16 @@ async function stampHookStatusMessages(path, version) {
|
|
|
91730
91814
|
async function stampComponentVersions(input) {
|
|
91731
91815
|
let entries;
|
|
91732
91816
|
try {
|
|
91733
|
-
entries = await readdir8(
|
|
91817
|
+
entries = await readdir8(join44(input.pluginRoot, "components"));
|
|
91734
91818
|
} catch (error) {
|
|
91735
91819
|
if (error instanceof Error)
|
|
91736
91820
|
return;
|
|
91737
91821
|
throw error;
|
|
91738
91822
|
}
|
|
91739
91823
|
for (const entry of entries) {
|
|
91740
|
-
const componentRoot =
|
|
91741
|
-
await stampJsonVersion(
|
|
91742
|
-
await stampHookStatusMessages(
|
|
91824
|
+
const componentRoot = join44(input.pluginRoot, "components", entry);
|
|
91825
|
+
await stampJsonVersion(join44(componentRoot, "package.json"), input.version);
|
|
91826
|
+
await stampHookStatusMessages(join44(componentRoot, "hooks", "hooks.json"), input.version);
|
|
91743
91827
|
}
|
|
91744
91828
|
}
|
|
91745
91829
|
function stampHookGroups(hooks, version) {
|
|
@@ -91796,8 +91880,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
91796
91880
|
};
|
|
91797
91881
|
|
|
91798
91882
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
91799
|
-
import { copyFile as copyFile2, lstat as
|
|
91800
|
-
import { dirname as dirname16, join as
|
|
91883
|
+
import { copyFile as copyFile2, lstat as lstat11, readFile as readFile18, writeFile as writeFile10 } from "node:fs/promises";
|
|
91884
|
+
import { dirname as dirname16, join as join45, resolve as resolve10 } from "node:path";
|
|
91801
91885
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
91802
91886
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
91803
91887
|
".codex/hooks.json",
|
|
@@ -91816,7 +91900,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
91816
91900
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
91817
91901
|
const configs = [];
|
|
91818
91902
|
for (const configPath of project.configPaths) {
|
|
91819
|
-
const original = await
|
|
91903
|
+
const original = await readFile18(configPath, "utf8");
|
|
91820
91904
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
91821
91905
|
if (!repair.changed) {
|
|
91822
91906
|
configs.push({
|
|
@@ -91900,17 +91984,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
91900
91984
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
91901
91985
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
91902
91986
|
}
|
|
91903
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
91987
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join45(resolve10(codexHome), "config.toml");
|
|
91904
91988
|
let current = resolve10(startDirectory);
|
|
91905
91989
|
const configPathsFromCwd = [];
|
|
91906
91990
|
while (true) {
|
|
91907
|
-
const configPath =
|
|
91991
|
+
const configPath = join45(current, ".codex", "config.toml");
|
|
91908
91992
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
91909
91993
|
if (codexHomeConfigPath === null || resolve10(configPath) !== codexHomeConfigPath) {
|
|
91910
91994
|
configPathsFromCwd.push(configPath);
|
|
91911
91995
|
}
|
|
91912
91996
|
}
|
|
91913
|
-
if (await exists5(
|
|
91997
|
+
if (await exists5(join45(current, ".git"))) {
|
|
91914
91998
|
return configPathsFromCwd.length === 0 ? null : {
|
|
91915
91999
|
projectRoot: current,
|
|
91916
92000
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
@@ -91930,7 +92014,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
91930
92014
|
}
|
|
91931
92015
|
}
|
|
91932
92016
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
91933
|
-
const codexDirStat = await maybeLstat(
|
|
92017
|
+
const codexDirStat = await maybeLstat(join45(directory, ".codex"));
|
|
91934
92018
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
91935
92019
|
return false;
|
|
91936
92020
|
const configStat = await maybeLstat(configPath);
|
|
@@ -91950,7 +92034,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
91950
92034
|
const seenPaths = new Set;
|
|
91951
92035
|
for (const projectRoot of projectRoots) {
|
|
91952
92036
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
91953
|
-
const artifactPath =
|
|
92037
|
+
const artifactPath = join45(projectRoot, relativePath);
|
|
91954
92038
|
if (seenPaths.has(artifactPath))
|
|
91955
92039
|
continue;
|
|
91956
92040
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -91984,7 +92068,7 @@ function formatBackupTimestamp(date) {
|
|
|
91984
92068
|
}
|
|
91985
92069
|
async function maybeLstat(path) {
|
|
91986
92070
|
try {
|
|
91987
|
-
return await
|
|
92071
|
+
return await lstat11(path);
|
|
91988
92072
|
} catch (error) {
|
|
91989
92073
|
if (nodeErrorCode4(error) === "ENOENT")
|
|
91990
92074
|
return null;
|
|
@@ -92025,14 +92109,14 @@ function formatUnknownError(error) {
|
|
|
92025
92109
|
}
|
|
92026
92110
|
|
|
92027
92111
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
92028
|
-
import { createHash as
|
|
92029
|
-
import { lstat as
|
|
92112
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
92113
|
+
import { lstat as lstat12, readFile as readFile20, readdir as readdir10, rm as rm11 } from "node:fs/promises";
|
|
92030
92114
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
92031
|
-
import { join as
|
|
92115
|
+
import { join as join46, posix as posix6 } from "node:path";
|
|
92032
92116
|
|
|
92033
92117
|
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
|
|
92034
92118
|
import { execFile } from "node:child_process";
|
|
92035
|
-
import { readFile as
|
|
92119
|
+
import { readFile as readFile19, readdir as readdir9, readlink as readlink5 } from "node:fs/promises";
|
|
92036
92120
|
import { connect } from "node:net";
|
|
92037
92121
|
import { basename as basename7 } from "node:path";
|
|
92038
92122
|
var PROBE_TIMEOUT_MS = 500;
|
|
@@ -92074,7 +92158,7 @@ async function attestLegacyDaemonOwnership(input, deps = {}) {
|
|
|
92074
92158
|
return false;
|
|
92075
92159
|
}
|
|
92076
92160
|
async function attestLinuxOwnership(input, deps) {
|
|
92077
|
-
const readFileImpl = deps.readFile ??
|
|
92161
|
+
const readFileImpl = deps.readFile ?? readFile19;
|
|
92078
92162
|
const readDirImpl = deps.readDir ?? readdir9;
|
|
92079
92163
|
const readLinkImpl = deps.readLink ?? readlink5;
|
|
92080
92164
|
const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
|
|
@@ -92201,7 +92285,7 @@ async function readBinary(readFileImpl, path) {
|
|
|
92201
92285
|
var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
|
|
92202
92286
|
var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
92203
92287
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
92204
|
-
const daemonRoot =
|
|
92288
|
+
const daemonRoot = join46(codexHome, "codex-lsp", "daemon");
|
|
92205
92289
|
const platform = deps.platform ?? process.platform;
|
|
92206
92290
|
const tmpDir = deps.tmpDir ?? tmpdir3();
|
|
92207
92291
|
const probe = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
|
|
@@ -92211,7 +92295,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
92211
92295
|
const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
|
|
92212
92296
|
const results = [];
|
|
92213
92297
|
for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
|
|
92214
|
-
const versionPath =
|
|
92298
|
+
const versionPath = join46(daemonRoot, entry.name);
|
|
92215
92299
|
const parsedVersion = parseVersionEntry(entry.name);
|
|
92216
92300
|
if (parsedVersion === null || !entry.isDirectory()) {
|
|
92217
92301
|
await removeVersionDir(versionPath);
|
|
@@ -92259,7 +92343,7 @@ function parseVersionEntry(entryName) {
|
|
|
92259
92343
|
return LEGACY_VERSION_PATTERN.test(version) ? version : null;
|
|
92260
92344
|
}
|
|
92261
92345
|
async function readLegacyMetadata(input) {
|
|
92262
|
-
const pidText = await readRegularTrimmedFile(
|
|
92346
|
+
const pidText = await readRegularTrimmedFile(join46(input.versionPath, "daemon.pid"));
|
|
92263
92347
|
if (pidText === "non_regular")
|
|
92264
92348
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
92265
92349
|
if (pidText === null)
|
|
@@ -92267,7 +92351,7 @@ async function readLegacyMetadata(input) {
|
|
|
92267
92351
|
const pid = Number.parseInt(pidText, 10);
|
|
92268
92352
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
92269
92353
|
return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
|
|
92270
|
-
const endpointText = await readRegularTrimmedFile(
|
|
92354
|
+
const endpointText = await readRegularTrimmedFile(join46(input.versionPath, "daemon.endpoint"));
|
|
92271
92355
|
if (endpointText === "non_regular")
|
|
92272
92356
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
92273
92357
|
if (endpointText === null)
|
|
@@ -92294,19 +92378,19 @@ function legacyEndpointCandidates(input) {
|
|
|
92294
92378
|
return [natural, hashed];
|
|
92295
92379
|
}
|
|
92296
92380
|
async function readRegularTrimmedFile(path) {
|
|
92297
|
-
const stats = await
|
|
92381
|
+
const stats = await lstat12(path).catch(() => null);
|
|
92298
92382
|
if (stats === null)
|
|
92299
92383
|
return null;
|
|
92300
92384
|
if (!stats.isFile())
|
|
92301
92385
|
return "non_regular";
|
|
92302
|
-
const content = (await
|
|
92386
|
+
const content = (await readFile20(path, "utf8")).trim();
|
|
92303
92387
|
return content.length > 0 ? content : null;
|
|
92304
92388
|
}
|
|
92305
92389
|
function shortDigest(value) {
|
|
92306
|
-
return
|
|
92390
|
+
return createHash4("sha256").update(value).digest("hex").slice(0, 16);
|
|
92307
92391
|
}
|
|
92308
92392
|
async function removeVersionDir(path) {
|
|
92309
|
-
await
|
|
92393
|
+
await rm11(path, { recursive: true, force: true });
|
|
92310
92394
|
}
|
|
92311
92395
|
function removed(version, reason) {
|
|
92312
92396
|
return { version, status: "removed", reason };
|
|
@@ -92346,7 +92430,7 @@ function processIsRunning(pid) {
|
|
|
92346
92430
|
|
|
92347
92431
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
92348
92432
|
import { homedir as homedir5 } from "node:os";
|
|
92349
|
-
import { join as
|
|
92433
|
+
import { join as join47, resolve as resolve11 } from "node:path";
|
|
92350
92434
|
function resolveCodexInstallerBinDir(input) {
|
|
92351
92435
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
92352
92436
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -92355,16 +92439,16 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
92355
92439
|
const defaultCodexHome = resolve11(homeDir, ".codex");
|
|
92356
92440
|
const resolvedCodexHome = resolve11(input.codexHome);
|
|
92357
92441
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
92358
|
-
return
|
|
92442
|
+
return join47(resolvedCodexHome, "bin");
|
|
92359
92443
|
return resolve11(homeDir, ".local", "bin");
|
|
92360
92444
|
}
|
|
92361
92445
|
|
|
92362
92446
|
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
|
|
92363
|
-
import { readFile as
|
|
92364
|
-
import { join as
|
|
92447
|
+
import { readFile as readFile21, readdir as readdir11, writeFile as writeFile11 } from "node:fs/promises";
|
|
92448
|
+
import { join as join48 } from "node:path";
|
|
92365
92449
|
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
|
|
92366
92450
|
async function writeInstalledCodexBinDir(input) {
|
|
92367
|
-
await writeFile11(
|
|
92451
|
+
await writeFile11(join48(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
|
|
92368
92452
|
`);
|
|
92369
92453
|
}
|
|
92370
92454
|
async function readInstalledCodexBinDir(codexHome) {
|
|
@@ -92377,20 +92461,20 @@ async function readInstalledCodexBinDir(codexHome) {
|
|
|
92377
92461
|
}
|
|
92378
92462
|
async function installedBinDirManifestPaths(codexHome) {
|
|
92379
92463
|
const paths = [
|
|
92380
|
-
|
|
92464
|
+
join48(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_BIN_DIR_MANIFEST)
|
|
92381
92465
|
];
|
|
92382
|
-
const versionRoot =
|
|
92466
|
+
const versionRoot = join48(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
92383
92467
|
const entries = await readdir11(versionRoot, { withFileTypes: true }).catch(() => null);
|
|
92384
92468
|
if (entries !== null) {
|
|
92385
92469
|
for (const entry of entries) {
|
|
92386
92470
|
if (entry.isDirectory())
|
|
92387
|
-
paths.push(
|
|
92471
|
+
paths.push(join48(versionRoot, entry.name, INSTALLED_BIN_DIR_MANIFEST));
|
|
92388
92472
|
}
|
|
92389
92473
|
}
|
|
92390
92474
|
return paths;
|
|
92391
92475
|
}
|
|
92392
92476
|
async function readBinDirFromManifest(manifestPath) {
|
|
92393
|
-
const raw = await
|
|
92477
|
+
const raw = await readFile21(manifestPath, "utf8").catch(() => null);
|
|
92394
92478
|
if (raw === null)
|
|
92395
92479
|
return null;
|
|
92396
92480
|
let parsed;
|
|
@@ -92408,8 +92492,8 @@ async function readBinDirFromManifest(manifestPath) {
|
|
|
92408
92492
|
}
|
|
92409
92493
|
|
|
92410
92494
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
92411
|
-
import { readFile as
|
|
92412
|
-
import { join as
|
|
92495
|
+
import { readFile as readFile22, writeFile as writeFile12 } from "node:fs/promises";
|
|
92496
|
+
import { join as join49 } from "node:path";
|
|
92413
92497
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
92414
92498
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
92415
92499
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -92417,8 +92501,8 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
92417
92501
|
async function removeGitBashHooksOffWindows(input) {
|
|
92418
92502
|
if (input.platform === "win32")
|
|
92419
92503
|
return;
|
|
92420
|
-
const manifestPath =
|
|
92421
|
-
const parsed = JSON.parse(await
|
|
92504
|
+
const manifestPath = join49(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
92505
|
+
const parsed = JSON.parse(await readFile22(manifestPath, "utf8"));
|
|
92422
92506
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.hooks))
|
|
92423
92507
|
return;
|
|
92424
92508
|
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
|
|
@@ -92430,7 +92514,7 @@ async function removeGitBashHooksOffWindows(input) {
|
|
|
92430
92514
|
|
|
92431
92515
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
92432
92516
|
init_src();
|
|
92433
|
-
import { join as
|
|
92517
|
+
import { join as join50 } from "node:path";
|
|
92434
92518
|
function describeResult(result) {
|
|
92435
92519
|
if (result.kind === "succeeded")
|
|
92436
92520
|
return null;
|
|
@@ -92444,7 +92528,7 @@ async function installAstGrepForCodex(options) {
|
|
|
92444
92528
|
return;
|
|
92445
92529
|
const platform = options.platform ?? process.platform;
|
|
92446
92530
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
92447
|
-
const skillDir =
|
|
92531
|
+
const skillDir = join50(plugin.path, "skills", "ast-grep");
|
|
92448
92532
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
92449
92533
|
try {
|
|
92450
92534
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -92477,7 +92561,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
92477
92561
|
const env = options.env ?? process.env;
|
|
92478
92562
|
const platform = options.platform ?? process.platform;
|
|
92479
92563
|
const repoRoot = resolve12(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env }));
|
|
92480
|
-
const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ??
|
|
92564
|
+
const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ?? join53(homedir6(), ".codex"));
|
|
92481
92565
|
const projectDirectory = resolve12(options.projectDirectory ?? env.OMO_CODEX_PROJECT ?? process.cwd());
|
|
92482
92566
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env });
|
|
92483
92567
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -92494,9 +92578,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
92494
92578
|
if (!gitBashResolution.found) {
|
|
92495
92579
|
throw new Error(gitBashResolution.installHint);
|
|
92496
92580
|
}
|
|
92497
|
-
const codexPackageRoot =
|
|
92581
|
+
const codexPackageRoot = join53(repoRoot, "packages", "omo-codex");
|
|
92498
92582
|
const marketplace = await readMarketplace(repoRoot, {
|
|
92499
|
-
marketplacePath:
|
|
92583
|
+
marketplacePath: join53(codexPackageRoot, "marketplace.json")
|
|
92500
92584
|
});
|
|
92501
92585
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
92502
92586
|
const installed = [];
|
|
@@ -92542,7 +92626,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
92542
92626
|
if (runtimeLink !== null)
|
|
92543
92627
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
92544
92628
|
else
|
|
92545
|
-
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${
|
|
92629
|
+
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${join53(repoRoot, "dist", "cli", "index.js")} is missing; omo-agent-toolkit ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
92546
92630
|
}
|
|
92547
92631
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
92548
92632
|
installed.push(plugin);
|
|
@@ -92562,6 +92646,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
92562
92646
|
installed,
|
|
92563
92647
|
pluginSources
|
|
92564
92648
|
});
|
|
92649
|
+
const omoConfig = readDefaultRoleConfig({ cwd: projectDirectory, env });
|
|
92650
|
+
for (const warning of omoConfig.warnings)
|
|
92651
|
+
log(`Warning: ${warning}`);
|
|
92565
92652
|
for (const plugin of installed) {
|
|
92566
92653
|
const pluginRoot = agentSourceRoots.get(plugin.name) ?? plugin.path;
|
|
92567
92654
|
const agentLinks = await linkCachedPluginAgents({
|
|
@@ -92569,7 +92656,8 @@ async function runCodexInstaller(options = {}) {
|
|
|
92569
92656
|
pluginRoot,
|
|
92570
92657
|
platform,
|
|
92571
92658
|
preservedReasoning,
|
|
92572
|
-
preservedServiceTier
|
|
92659
|
+
preservedServiceTier,
|
|
92660
|
+
defaultRoleEnabled: omoConfig.enabled
|
|
92573
92661
|
});
|
|
92574
92662
|
for (const link of agentLinks) {
|
|
92575
92663
|
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
@@ -92605,13 +92693,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
92605
92693
|
continue;
|
|
92606
92694
|
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
|
|
92607
92695
|
}
|
|
92608
|
-
const marketplaceRoot =
|
|
92696
|
+
const marketplaceRoot = join53(codexHome, "plugins", "cache", marketplace.name);
|
|
92609
92697
|
await writeCachedMarketplaceManifest({
|
|
92610
92698
|
marketplaceName: marketplace.name,
|
|
92611
92699
|
marketplaceRoot,
|
|
92612
92700
|
plugins: installed
|
|
92613
92701
|
});
|
|
92614
|
-
const configPath =
|
|
92702
|
+
const configPath = join53(codexHome, "config.toml");
|
|
92615
92703
|
await updateCodexConfig({
|
|
92616
92704
|
configPath,
|
|
92617
92705
|
repoRoot: codexPackageRoot,
|
|
@@ -92670,7 +92758,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
92670
92758
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
92671
92759
|
if (isRepoRootWithCodexPlugin(current))
|
|
92672
92760
|
return current;
|
|
92673
|
-
for (const wrapperPackageRoot of [
|
|
92761
|
+
for (const wrapperPackageRoot of [join53(current, "node_modules", "oh-my-openagent"), join53(current, "oh-my-openagent")]) {
|
|
92674
92762
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
92675
92763
|
return wrapperPackageRoot;
|
|
92676
92764
|
}
|
|
@@ -92688,7 +92776,7 @@ function findRepoRoot(input) {
|
|
|
92688
92776
|
return findRepoRootFromImporter(input.importerDir);
|
|
92689
92777
|
}
|
|
92690
92778
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
92691
|
-
return existsSync26(
|
|
92779
|
+
return existsSync26(join53(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
92692
92780
|
}
|
|
92693
92781
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
92694
92782
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -92823,13 +92911,13 @@ function defaultRunCommand2(command, args) {
|
|
|
92823
92911
|
});
|
|
92824
92912
|
}
|
|
92825
92913
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
92826
|
-
import { lstat as
|
|
92914
|
+
import { lstat as lstat15, readFile as readFile25, readdir as readdir13, rm as rm13, rmdir } from "node:fs/promises";
|
|
92827
92915
|
import { homedir as homedir8 } from "node:os";
|
|
92828
|
-
import { isAbsolute as isAbsolute11, join as
|
|
92916
|
+
import { isAbsolute as isAbsolute11, join as join56, relative as relative6, resolve as resolve15 } from "node:path";
|
|
92829
92917
|
|
|
92830
92918
|
// packages/omo-codex/src/install/codex-cleanup-bins.ts
|
|
92831
|
-
import { lstat as
|
|
92832
|
-
import { dirname as dirname18, isAbsolute as isAbsolute9, join as
|
|
92919
|
+
import { lstat as lstat13, readFile as readFile23, readdir as readdir12, readlink as readlink6, rm as rm12 } from "node:fs/promises";
|
|
92920
|
+
import { dirname as dirname18, isAbsolute as isAbsolute9, join as join54, resolve as resolve13 } from "node:path";
|
|
92833
92921
|
var ROOT_RUNTIME_BIN_NAME = "omo";
|
|
92834
92922
|
var MANAGED_CODEX_BIN_NAMES = new Set([
|
|
92835
92923
|
ROOT_RUNTIME_BIN_NAME,
|
|
@@ -92859,9 +92947,9 @@ async function removeManagedCodexBins(binDir, platform) {
|
|
|
92859
92947
|
const binName = managedBinNameForEntry2(entry.name, platform);
|
|
92860
92948
|
if (binName === null || !MANAGED_CODEX_BIN_NAMES.has(binName))
|
|
92861
92949
|
continue;
|
|
92862
|
-
const linkPath =
|
|
92950
|
+
const linkPath = join54(binDir, entry.name);
|
|
92863
92951
|
if (await isManagedCodexBin(linkPath, platform, binName)) {
|
|
92864
|
-
await
|
|
92952
|
+
await rm12(linkPath, { force: true });
|
|
92865
92953
|
removed.push(linkPath);
|
|
92866
92954
|
}
|
|
92867
92955
|
}
|
|
@@ -92874,7 +92962,7 @@ function managedBinNameForEntry2(entryName, platform) {
|
|
|
92874
92962
|
return normalizedEntryName.endsWith(".cmd") ? normalizedEntryName.slice(0, -".cmd".length) : null;
|
|
92875
92963
|
}
|
|
92876
92964
|
async function isManagedCodexBin(linkPath, platform, binName) {
|
|
92877
|
-
const entryStat = await
|
|
92965
|
+
const entryStat = await lstat13(linkPath).catch((error) => {
|
|
92878
92966
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
92879
92967
|
return null;
|
|
92880
92968
|
throw error;
|
|
@@ -92890,12 +92978,12 @@ async function isManagedCodexBin(linkPath, platform, binName) {
|
|
|
92890
92978
|
}
|
|
92891
92979
|
if (!entryStat.isFile())
|
|
92892
92980
|
return false;
|
|
92893
|
-
const content = await
|
|
92981
|
+
const content = await readFile23(linkPath, "utf8");
|
|
92894
92982
|
return content.includes(RUNTIME_WRAPPER_MARKER) || content.includes(COMMAND_SHIM_MARKER);
|
|
92895
92983
|
}
|
|
92896
92984
|
|
|
92897
92985
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
92898
|
-
import { lstat as
|
|
92986
|
+
import { lstat as lstat14, mkdir as mkdir8, readFile as readFile24, writeFile as writeFile13 } from "node:fs/promises";
|
|
92899
92987
|
import { dirname as dirname19 } from "node:path";
|
|
92900
92988
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
92901
92989
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
@@ -92928,7 +93016,7 @@ function cleanupCodexLightConfigText(config) {
|
|
|
92928
93016
|
async function cleanupCodexConfig(configPath, now) {
|
|
92929
93017
|
if (!await configExists(configPath))
|
|
92930
93018
|
return { changed: false };
|
|
92931
|
-
const original = await
|
|
93019
|
+
const original = await readFile24(configPath, "utf8");
|
|
92932
93020
|
const next = cleanupCodexLightConfigText(original);
|
|
92933
93021
|
if (next === original)
|
|
92934
93022
|
return { changed: false };
|
|
@@ -92997,7 +93085,7 @@ function formatBackupTimestamp2(date) {
|
|
|
92997
93085
|
}
|
|
92998
93086
|
async function configExists(path) {
|
|
92999
93087
|
try {
|
|
93000
|
-
await
|
|
93088
|
+
await lstat14(path);
|
|
93001
93089
|
return true;
|
|
93002
93090
|
} catch (error) {
|
|
93003
93091
|
if (nodeErrorCode5(error) === "ENOENT")
|
|
@@ -93012,7 +93100,7 @@ function nodeErrorCode5(error) {
|
|
|
93012
93100
|
}
|
|
93013
93101
|
|
|
93014
93102
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
93015
|
-
import { dirname as dirname20, isAbsolute as isAbsolute10, join as
|
|
93103
|
+
import { dirname as dirname20, isAbsolute as isAbsolute10, join as join55, relative as relative5, resolve as resolve14 } from "node:path";
|
|
93016
93104
|
function codexHomeResolvesToFilesystemRoot(codexHome) {
|
|
93017
93105
|
const resolved = resolve14(codexHome);
|
|
93018
93106
|
return dirname20(resolved) === resolved;
|
|
@@ -93029,11 +93117,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
93029
93117
|
if (target === codexHome)
|
|
93030
93118
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
93031
93119
|
const exactManagedRoots = new Set([
|
|
93032
|
-
resolve14(
|
|
93033
|
-
resolve14(
|
|
93034
|
-
resolve14(
|
|
93035
|
-
resolve14(
|
|
93036
|
-
resolve14(
|
|
93120
|
+
resolve14(join55(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
93121
|
+
resolve14(join55(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
93122
|
+
resolve14(join55(codexHome, "runtime", "ast-grep")),
|
|
93123
|
+
resolve14(join55(codexHome, "runtime", "node")),
|
|
93124
|
+
resolve14(join55(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
93037
93125
|
]);
|
|
93038
93126
|
if (exactManagedRoots.has(target))
|
|
93039
93127
|
return null;
|
|
@@ -93063,8 +93151,8 @@ function skipped(path, reason) {
|
|
|
93063
93151
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
93064
93152
|
async function cleanupCodexLight(input = {}) {
|
|
93065
93153
|
const env = input.env ?? process.env;
|
|
93066
|
-
const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ??
|
|
93067
|
-
const configPath =
|
|
93154
|
+
const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ?? join56(homedir8(), ".codex"));
|
|
93155
|
+
const configPath = join56(codexHome, "config.toml");
|
|
93068
93156
|
const installedBinDir = await readInstalledCodexBinDir(codexHome);
|
|
93069
93157
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
93070
93158
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
@@ -93118,17 +93206,17 @@ function firstConfiguredPath(...values) {
|
|
|
93118
93206
|
}
|
|
93119
93207
|
function managedGlobalStatePaths(codexHome) {
|
|
93120
93208
|
return [
|
|
93121
|
-
|
|
93122
|
-
|
|
93123
|
-
|
|
93124
|
-
|
|
93125
|
-
|
|
93209
|
+
join56(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
93210
|
+
join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
93211
|
+
join56(codexHome, "runtime", "ast-grep"),
|
|
93212
|
+
join56(codexHome, "runtime", "node"),
|
|
93213
|
+
join56(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
93126
93214
|
];
|
|
93127
93215
|
}
|
|
93128
93216
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
93129
93217
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
93130
93218
|
const results = [];
|
|
93131
|
-
await walkForManagedBootstrapDirs(
|
|
93219
|
+
await walkForManagedBootstrapDirs(join56(codexHome, "plugins"), 0, results);
|
|
93132
93220
|
return results;
|
|
93133
93221
|
}
|
|
93134
93222
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -93140,9 +93228,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
93140
93228
|
for (const entry of entries) {
|
|
93141
93229
|
if (!entry.isDirectory())
|
|
93142
93230
|
continue;
|
|
93143
|
-
const childPath =
|
|
93231
|
+
const childPath = join56(directory, entry.name);
|
|
93144
93232
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
93145
|
-
const bootstrapDir =
|
|
93233
|
+
const bootstrapDir = join56(childPath, "bootstrap");
|
|
93146
93234
|
if (await exists6(bootstrapDir))
|
|
93147
93235
|
results.push(bootstrapDir);
|
|
93148
93236
|
continue;
|
|
@@ -93166,9 +93254,9 @@ async function removeManagedPathBestEffort(path, seams) {
|
|
|
93166
93254
|
}
|
|
93167
93255
|
async function attemptRemove(path) {
|
|
93168
93256
|
try {
|
|
93169
|
-
if (await
|
|
93257
|
+
if (await lstat15(path).catch(() => null) === null)
|
|
93170
93258
|
return false;
|
|
93171
|
-
await
|
|
93259
|
+
await rm13(path, { recursive: true, force: true });
|
|
93172
93260
|
return true;
|
|
93173
93261
|
} catch {
|
|
93174
93262
|
return false;
|
|
@@ -93176,7 +93264,7 @@ async function attemptRemove(path) {
|
|
|
93176
93264
|
}
|
|
93177
93265
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
93178
93266
|
try {
|
|
93179
|
-
await rmdir(
|
|
93267
|
+
await rmdir(join56(codexHome, "runtime"));
|
|
93180
93268
|
} catch (error) {
|
|
93181
93269
|
if (isExpectedRuntimePruneFailure(error))
|
|
93182
93270
|
return;
|
|
@@ -93188,14 +93276,14 @@ function isExpectedRuntimePruneFailure(error) {
|
|
|
93188
93276
|
}
|
|
93189
93277
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
93190
93278
|
const manifestPaths = [
|
|
93191
|
-
|
|
93279
|
+
join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
93192
93280
|
];
|
|
93193
|
-
const versionRoot =
|
|
93281
|
+
const versionRoot = join56(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
93194
93282
|
if (await exists6(versionRoot)) {
|
|
93195
93283
|
const entries = await readdir13(versionRoot, { withFileTypes: true });
|
|
93196
93284
|
for (const entry of entries) {
|
|
93197
93285
|
if (entry.isDirectory())
|
|
93198
|
-
manifestPaths.push(
|
|
93286
|
+
manifestPaths.push(join56(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
93199
93287
|
}
|
|
93200
93288
|
}
|
|
93201
93289
|
const paths = new Set;
|
|
@@ -93212,19 +93300,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
93212
93300
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
93213
93301
|
if (!await exists6(configPath))
|
|
93214
93302
|
return [];
|
|
93215
|
-
const config = await
|
|
93216
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
93303
|
+
const config = await readFile25(configPath, "utf8");
|
|
93304
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join56(codexHome, "agents", `${agentName}.toml`));
|
|
93217
93305
|
}
|
|
93218
93306
|
async function readInstalledAgentManifest(manifestPath) {
|
|
93219
93307
|
if (!await exists6(manifestPath))
|
|
93220
93308
|
return [];
|
|
93221
|
-
const parsed = JSON.parse(await
|
|
93309
|
+
const parsed = JSON.parse(await readFile25(manifestPath, "utf8"));
|
|
93222
93310
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.agents))
|
|
93223
93311
|
return [];
|
|
93224
93312
|
return parsed.agents.filter((path) => typeof path === "string");
|
|
93225
93313
|
}
|
|
93226
93314
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
93227
|
-
const agentsDir =
|
|
93315
|
+
const agentsDir = join56(codexHome, "agents");
|
|
93228
93316
|
const removed = [];
|
|
93229
93317
|
const skipped = [];
|
|
93230
93318
|
for (const path of paths) {
|
|
@@ -93239,7 +93327,7 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
93239
93327
|
skipped.push(path);
|
|
93240
93328
|
continue;
|
|
93241
93329
|
}
|
|
93242
|
-
await
|
|
93330
|
+
await rm13(path, { force: true });
|
|
93243
93331
|
removed.push(path);
|
|
93244
93332
|
}
|
|
93245
93333
|
return { removed, skipped };
|
|
@@ -93260,7 +93348,7 @@ async function exists6(path) {
|
|
|
93260
93348
|
}
|
|
93261
93349
|
async function maybeLstat2(path) {
|
|
93262
93350
|
try {
|
|
93263
|
-
return await
|
|
93351
|
+
return await lstat15(path);
|
|
93264
93352
|
} catch (error) {
|
|
93265
93353
|
if (nodeErrorCode6(error) === "ENOENT")
|
|
93266
93354
|
return null;
|
|
@@ -93276,14 +93364,14 @@ function nodeErrorCode6(error) {
|
|
|
93276
93364
|
import { execFile as execFile3 } from "node:child_process";
|
|
93277
93365
|
import { existsSync as existsSync30 } from "node:fs";
|
|
93278
93366
|
import { homedir as homedir11 } from "node:os";
|
|
93279
|
-
import { dirname as dirname24, join as
|
|
93367
|
+
import { dirname as dirname24, join as join61, resolve as resolve19 } from "node:path";
|
|
93280
93368
|
import { fileURLToPath } from "node:url";
|
|
93281
93369
|
import { promisify as promisify2 } from "node:util";
|
|
93282
93370
|
|
|
93283
93371
|
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
93284
93372
|
import { existsSync as existsSync28 } from "node:fs";
|
|
93285
93373
|
import { homedir as homedir9 } from "node:os";
|
|
93286
|
-
import { join as
|
|
93374
|
+
import { join as join57, resolve as resolve16 } from "node:path";
|
|
93287
93375
|
var AGENT_DIR_ENV_NAMES = [
|
|
93288
93376
|
"OMO_CODING_AGENT_DIR",
|
|
93289
93377
|
"SENPI_CODING_AGENT_DIR",
|
|
@@ -93297,25 +93385,25 @@ function resolveAgentHome(options) {
|
|
|
93297
93385
|
if (configured)
|
|
93298
93386
|
return resolve16(configured);
|
|
93299
93387
|
}
|
|
93300
|
-
const brandedHome =
|
|
93301
|
-
const canonical =
|
|
93302
|
-
if (exists(
|
|
93388
|
+
const brandedHome = join57(homeDir, ".omo");
|
|
93389
|
+
const canonical = join57(brandedHome, "agent");
|
|
93390
|
+
if (exists(join57(canonical, AGENT_HOME_SENTINEL)))
|
|
93303
93391
|
return canonical;
|
|
93304
|
-
if (exists(
|
|
93392
|
+
if (exists(join57(brandedHome, AGENT_HOME_SENTINEL)))
|
|
93305
93393
|
return brandedHome;
|
|
93306
|
-
return
|
|
93394
|
+
return join57(homeDir, ".senpi", "agent");
|
|
93307
93395
|
}
|
|
93308
93396
|
|
|
93309
93397
|
// packages/omo-senpi/src/install/local-launcher.ts
|
|
93310
93398
|
import { chmodSync as chmodSync3, existsSync as existsSync29, mkdirSync as mkdirSync10, readFileSync as readFileSync13, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
93311
93399
|
import { homedir as homedir10 } from "node:os";
|
|
93312
|
-
import { dirname as dirname21, join as
|
|
93400
|
+
import { dirname as dirname21, join as join58, resolve as resolve17 } from "node:path";
|
|
93313
93401
|
var MARKER = "omo-local-launcher";
|
|
93314
93402
|
function localLauncherPath(homeDir = homedir10()) {
|
|
93315
|
-
return
|
|
93403
|
+
return join58(homeDir, ".local", "bin", "omo");
|
|
93316
93404
|
}
|
|
93317
93405
|
function localLauncherCmdPath(homeDir = homedir10()) {
|
|
93318
|
-
return
|
|
93406
|
+
return join58(homeDir, ".local", "bin", "omo.cmd");
|
|
93319
93407
|
}
|
|
93320
93408
|
function renderLocalLauncher(options) {
|
|
93321
93409
|
const brand = {
|
|
@@ -93328,7 +93416,7 @@ function renderLocalLauncher(options) {
|
|
|
93328
93416
|
userAgent: "omo",
|
|
93329
93417
|
originator: "omo",
|
|
93330
93418
|
changelog: {
|
|
93331
|
-
path:
|
|
93419
|
+
path: join58(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
|
|
93332
93420
|
},
|
|
93333
93421
|
update: {
|
|
93334
93422
|
packageName: "omo-ai",
|
|
@@ -93395,10 +93483,10 @@ node "%~dp0omo" %*\r
|
|
|
93395
93483
|
}
|
|
93396
93484
|
|
|
93397
93485
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
93398
|
-
import { createHash as
|
|
93486
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
93399
93487
|
import { constants as constants9 } from "node:fs";
|
|
93400
|
-
import { access as access2, readFile as
|
|
93401
|
-
import { dirname as dirname23, join as
|
|
93488
|
+
import { access as access2, readFile as readFile27, stat as stat6 } from "node:fs/promises";
|
|
93489
|
+
import { dirname as dirname23, join as join60 } from "node:path";
|
|
93402
93490
|
|
|
93403
93491
|
// packages/memory-core/src/personas/manifest.ts
|
|
93404
93492
|
var PERSONA_ASSET_FILENAMES = {
|
|
@@ -93416,18 +93504,18 @@ var PERSONA_ASSET_FILES = [
|
|
|
93416
93504
|
|
|
93417
93505
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
93418
93506
|
import { constants as constants8 } from "node:fs";
|
|
93419
|
-
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as
|
|
93420
|
-
import { basename as basename9, dirname as dirname22, join as
|
|
93507
|
+
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile26, rename as rename5, writeFile as writeFile14 } from "node:fs/promises";
|
|
93508
|
+
import { basename as basename9, dirname as dirname22, join as join59, resolve as resolve18 } from "node:path";
|
|
93421
93509
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
93422
93510
|
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
|
|
93423
93511
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
93424
|
-
|
|
93425
|
-
|
|
93512
|
+
join59("packages", "pi-goal"),
|
|
93513
|
+
join59("packages", "pi-webfetch")
|
|
93426
93514
|
];
|
|
93427
93515
|
async function readSettings(settingsPath) {
|
|
93428
93516
|
let raw;
|
|
93429
93517
|
try {
|
|
93430
|
-
raw = await
|
|
93518
|
+
raw = await readFile26(settingsPath, "utf8");
|
|
93431
93519
|
} catch (error) {
|
|
93432
93520
|
if (isErrno(error, "ENOENT"))
|
|
93433
93521
|
return {};
|
|
@@ -93501,7 +93589,7 @@ function isRecord13(value) {
|
|
|
93501
93589
|
async function readPackageName(packagePath) {
|
|
93502
93590
|
let raw;
|
|
93503
93591
|
try {
|
|
93504
|
-
raw = await
|
|
93592
|
+
raw = await readFile26(join59(packagePath, "package.json"), "utf8");
|
|
93505
93593
|
} catch (error) {
|
|
93506
93594
|
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
|
|
93507
93595
|
return;
|
|
@@ -93533,50 +93621,50 @@ function isErrno(error, code) {
|
|
|
93533
93621
|
|
|
93534
93622
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
93535
93623
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
93536
|
-
|
|
93537
|
-
|
|
93538
|
-
|
|
93539
|
-
|
|
93540
|
-
|
|
93541
|
-
...PERSONA_ASSET_FILES.map((filename) =>
|
|
93542
|
-
|
|
93543
|
-
|
|
93544
|
-
|
|
93545
|
-
|
|
93546
|
-
|
|
93547
|
-
|
|
93548
|
-
|
|
93549
|
-
|
|
93550
|
-
|
|
93551
|
-
|
|
93552
|
-
|
|
93553
|
-
|
|
93554
|
-
|
|
93555
|
-
|
|
93556
|
-
|
|
93557
|
-
|
|
93558
|
-
|
|
93559
|
-
|
|
93560
|
-
|
|
93561
|
-
|
|
93562
|
-
|
|
93563
|
-
|
|
93564
|
-
|
|
93565
|
-
|
|
93566
|
-
|
|
93567
|
-
|
|
93568
|
-
|
|
93569
|
-
|
|
93624
|
+
join60("extensions", "omo.js"),
|
|
93625
|
+
join60("extensions", "omo-task.js"),
|
|
93626
|
+
join60("extensions", "omo-member.js"),
|
|
93627
|
+
join60("extensions", "omo-agent-toolkit.js"),
|
|
93628
|
+
join60("extensions", "memory-run-supervisor.mjs"),
|
|
93629
|
+
...PERSONA_ASSET_FILES.map((filename) => join60("extensions", filename)),
|
|
93630
|
+
join60("skills", "ast-grep", "SKILL.md"),
|
|
93631
|
+
join60("skills", "coding-agent-sessions", "SKILL.md"),
|
|
93632
|
+
join60("skills", "debugging", "SKILL.md"),
|
|
93633
|
+
join60("skills", "frontend", "SKILL.md"),
|
|
93634
|
+
join60("skills", "git-master", "SKILL.md"),
|
|
93635
|
+
join60("skills", "init-deep", "SKILL.md"),
|
|
93636
|
+
join60("skills", "lsp-setup", "SKILL.md"),
|
|
93637
|
+
join60("skills", "programming", "SKILL.md"),
|
|
93638
|
+
join60("skills", "refactor", "SKILL.md"),
|
|
93639
|
+
join60("skills", "remove-ai-slops", "SKILL.md"),
|
|
93640
|
+
join60("skills", "review-work", "SKILL.md"),
|
|
93641
|
+
join60("skills", "ultimate-browsing", "SKILL.md"),
|
|
93642
|
+
join60("skills", "ultrawork", "SKILL.md"),
|
|
93643
|
+
join60("skills", "ulw-execute", "SKILL.md"),
|
|
93644
|
+
join60("skills", "ulw-loop", "SKILL.md"),
|
|
93645
|
+
join60("skills", "ulw-plan", "SKILL.md"),
|
|
93646
|
+
join60("skills", "ulw-research", "SKILL.md"),
|
|
93647
|
+
join60("skills", "visual-qa", "SKILL.md"),
|
|
93648
|
+
join60("skills-conditional", "x-search", "SKILL.md"),
|
|
93649
|
+
join60("runtime", "ast-grep-mcp", "cli.js"),
|
|
93650
|
+
join60("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
93651
|
+
join60("runtime", "lsp-daemon", "dist", "index.js"),
|
|
93652
|
+
join60("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
93653
|
+
join60("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
93654
|
+
join60("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
93655
|
+
join60("runtime", "lsp-daemon", "dist", "package.json"),
|
|
93656
|
+
join60("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
93657
|
+
join60("scripts", "install.mjs")
|
|
93570
93658
|
];
|
|
93571
93659
|
async function ensurePluginArtifacts(context) {
|
|
93572
93660
|
if (context.allowBuild) {
|
|
93573
|
-
await context.runCommand("node", [
|
|
93574
|
-
await context.runCommand("node", [
|
|
93575
|
-
await context.runCommand("node", [
|
|
93576
|
-
await context.runCommand("node", [
|
|
93577
|
-
await context.runCommand("node", [
|
|
93578
|
-
await context.runCommand("node", [
|
|
93579
|
-
await context.runCommand("node", [
|
|
93661
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
93662
|
+
await context.runCommand("node", [join60("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
93663
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
93664
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
93665
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
93666
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
93667
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
|
|
93580
93668
|
}
|
|
93581
93669
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
93582
93670
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -93585,14 +93673,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
93585
93673
|
}
|
|
93586
93674
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
93587
93675
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
93588
|
-
if (!await fileExists2(
|
|
93676
|
+
if (!await fileExists2(join60(pluginPath, artifact)))
|
|
93589
93677
|
return true;
|
|
93590
93678
|
}
|
|
93591
93679
|
return false;
|
|
93592
93680
|
}
|
|
93593
93681
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
93594
|
-
const runtimeEntry =
|
|
93595
|
-
const manifestPath =
|
|
93682
|
+
const runtimeEntry = join60(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
93683
|
+
const manifestPath = join60(dirname23(runtimeEntry), "manifest.json");
|
|
93596
93684
|
let runtimeStat;
|
|
93597
93685
|
try {
|
|
93598
93686
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -93607,7 +93695,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
93607
93695
|
}
|
|
93608
93696
|
let manifest;
|
|
93609
93697
|
try {
|
|
93610
|
-
manifest = JSON.parse(await
|
|
93698
|
+
manifest = JSON.parse(await readFile27(manifestPath, "utf8"));
|
|
93611
93699
|
} catch (error) {
|
|
93612
93700
|
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
|
|
93613
93701
|
}
|
|
@@ -93616,7 +93704,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
93616
93704
|
}
|
|
93617
93705
|
let actualSha256;
|
|
93618
93706
|
try {
|
|
93619
|
-
actualSha256 =
|
|
93707
|
+
actualSha256 = createHash6("sha256").update(await readFile27(runtimeEntry)).digest("hex");
|
|
93620
93708
|
} catch (error) {
|
|
93621
93709
|
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
|
|
93622
93710
|
}
|
|
@@ -93667,7 +93755,7 @@ async function runSenpiInstaller(options = {}) {
|
|
|
93667
93755
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
93668
93756
|
const launcherPath = installLocalLauncher({
|
|
93669
93757
|
pluginPath: context.pluginPath,
|
|
93670
|
-
senpiCliPath:
|
|
93758
|
+
senpiCliPath: join61(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
|
|
93671
93759
|
homeDir: context.homeDir
|
|
93672
93760
|
});
|
|
93673
93761
|
return {
|
|
@@ -93687,13 +93775,13 @@ function resolveInstallContext(options) {
|
|
|
93687
93775
|
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname24(fileURLToPath(import.meta.url))) : dirname24(resolve19(options.pluginPath))));
|
|
93688
93776
|
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
|
|
93689
93777
|
const agentDir = resolve19(options.agentDir ?? resolveAgentHome({ env, homeDir }));
|
|
93690
|
-
const pluginPath = resolve19(options.pluginPath ??
|
|
93778
|
+
const pluginPath = resolve19(options.pluginPath ?? join61(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
93691
93779
|
return {
|
|
93692
93780
|
env,
|
|
93693
93781
|
repoRoot,
|
|
93694
93782
|
agentDir,
|
|
93695
93783
|
homeDir,
|
|
93696
|
-
settingsPath:
|
|
93784
|
+
settingsPath: join61(agentDir, "settings.json"),
|
|
93697
93785
|
pluginPath,
|
|
93698
93786
|
platform: options.platform ?? process.platform,
|
|
93699
93787
|
allowBuild,
|
|
@@ -93710,7 +93798,7 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
93710
93798
|
function findRepoRoot2(importerDir) {
|
|
93711
93799
|
let current = importerDir;
|
|
93712
93800
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
93713
|
-
if (fileExistsSync(
|
|
93801
|
+
if (fileExistsSync(join61(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
93714
93802
|
return current;
|
|
93715
93803
|
current = resolve19(current, "..");
|
|
93716
93804
|
}
|
|
@@ -93754,19 +93842,19 @@ init_provider_availability();
|
|
|
93754
93842
|
|
|
93755
93843
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
93756
93844
|
import { existsSync as existsSync32, mkdirSync as mkdirSync11, readFileSync as readFileSync15 } from "node:fs";
|
|
93757
|
-
import { join as
|
|
93845
|
+
import { join as join63 } from "node:path";
|
|
93758
93846
|
|
|
93759
93847
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
93760
93848
|
init_shared();
|
|
93761
93849
|
import { existsSync as existsSync31, readFileSync as readFileSync14 } from "node:fs";
|
|
93762
|
-
import { join as
|
|
93850
|
+
import { join as join62 } from "node:path";
|
|
93763
93851
|
var TUI_SUBPATH = "tui";
|
|
93764
93852
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
93765
93853
|
function fileEntryPackageJsonPath(entry) {
|
|
93766
93854
|
let path = entry.slice("file:".length);
|
|
93767
93855
|
if (path.startsWith("//"))
|
|
93768
93856
|
path = path.slice(2);
|
|
93769
|
-
return
|
|
93857
|
+
return join62(path, "package.json");
|
|
93770
93858
|
}
|
|
93771
93859
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
93772
93860
|
if (!existsSync31(pkgJsonPath))
|
|
@@ -93804,7 +93892,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
93804
93892
|
const packageName = packageNameFromServerEntry(entry);
|
|
93805
93893
|
if (packageName === null)
|
|
93806
93894
|
return null;
|
|
93807
|
-
return packageJsonExportsTui(
|
|
93895
|
+
return packageJsonExportsTui(join62(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
93808
93896
|
}
|
|
93809
93897
|
function isOurFilePluginEntry(entry) {
|
|
93810
93898
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -93869,7 +93957,7 @@ function detectServerPluginRegistration() {
|
|
|
93869
93957
|
}
|
|
93870
93958
|
}
|
|
93871
93959
|
function detectTuiPluginRegistration() {
|
|
93872
|
-
const tuiJsonPath =
|
|
93960
|
+
const tuiJsonPath = join62(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
93873
93961
|
if (!existsSync31(tuiJsonPath)) {
|
|
93874
93962
|
return {
|
|
93875
93963
|
registered: false,
|
|
@@ -94025,10 +94113,10 @@ function readConfig(path) {
|
|
|
94025
94113
|
return null;
|
|
94026
94114
|
}
|
|
94027
94115
|
function readServerConfig(configDir) {
|
|
94028
|
-
const jsoncPath =
|
|
94116
|
+
const jsoncPath = join63(configDir, "opencode.jsonc");
|
|
94029
94117
|
if (existsSync32(jsoncPath))
|
|
94030
94118
|
return readConfig(jsoncPath);
|
|
94031
|
-
const jsonPath =
|
|
94119
|
+
const jsonPath = join63(configDir, "opencode.json");
|
|
94032
94120
|
if (existsSync32(jsonPath))
|
|
94033
94121
|
return readConfig(jsonPath);
|
|
94034
94122
|
return null;
|
|
@@ -94070,7 +94158,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
94070
94158
|
if (!desiredEntry) {
|
|
94071
94159
|
return { changed: false, reason: "no-server-entry" };
|
|
94072
94160
|
}
|
|
94073
|
-
const tuiJsonPath =
|
|
94161
|
+
const tuiJsonPath = join63(configDir, "tui.json");
|
|
94074
94162
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
94075
94163
|
if (malformed) {
|
|
94076
94164
|
return { changed: false, reason: "malformed" };
|
|
@@ -94086,7 +94174,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
94086
94174
|
|
|
94087
94175
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
94088
94176
|
import { homedir as homedir12 } from "node:os";
|
|
94089
|
-
import { join as
|
|
94177
|
+
import { join as join64 } from "node:path";
|
|
94090
94178
|
|
|
94091
94179
|
// packages/shared-skills/index.mjs
|
|
94092
94180
|
import { existsSync as existsSync33 } from "node:fs";
|
|
@@ -94108,9 +94196,9 @@ function describeResult2(result) {
|
|
|
94108
94196
|
}
|
|
94109
94197
|
async function installAstGrepForOpenCode(options = {}) {
|
|
94110
94198
|
const platform = options.platform ?? process.platform;
|
|
94111
|
-
const baseDir =
|
|
94199
|
+
const baseDir = join64(options.homeDir ?? homedir12(), ".omo");
|
|
94112
94200
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
94113
|
-
const skillDir =
|
|
94201
|
+
const skillDir = join64(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
94114
94202
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
94115
94203
|
try {
|
|
94116
94204
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -98331,9 +98419,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
98331
98419
|
}
|
|
98332
98420
|
// packages/boulder-state/src/storage/path.ts
|
|
98333
98421
|
import { existsSync as existsSync35 } from "node:fs";
|
|
98334
|
-
import { isAbsolute as isAbsolute12, join as
|
|
98422
|
+
import { isAbsolute as isAbsolute12, join as join65, relative as relative8, resolve as resolve20 } from "node:path";
|
|
98335
98423
|
function getBoulderFilePath(directory) {
|
|
98336
|
-
return
|
|
98424
|
+
return join65(directory, BOULDER_DIR, BOULDER_FILE);
|
|
98337
98425
|
}
|
|
98338
98426
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
98339
98427
|
return isAbsolute12(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
|
|
@@ -98516,9 +98604,9 @@ init_state();
|
|
|
98516
98604
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
98517
98605
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
98518
98606
|
import { existsSync as existsSync38, mkdirSync as mkdirSync12, readFileSync as readFileSync19, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "node:fs";
|
|
98519
|
-
import { join as
|
|
98607
|
+
import { join as join66 } from "node:path";
|
|
98520
98608
|
function getMarkerPath(directory, sessionID) {
|
|
98521
|
-
return
|
|
98609
|
+
return join66(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
98522
98610
|
}
|
|
98523
98611
|
function readContinuationMarker(directory, sessionID) {
|
|
98524
98612
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -98591,7 +98679,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
98591
98679
|
init_shared();
|
|
98592
98680
|
init_compaction_marker();
|
|
98593
98681
|
import { readFileSync as readFileSync20, readdirSync as readdirSync8 } from "node:fs";
|
|
98594
|
-
import { join as
|
|
98682
|
+
import { join as join67 } from "node:path";
|
|
98595
98683
|
var defaultSessionLastAgentDeps = {
|
|
98596
98684
|
getMessageDir,
|
|
98597
98685
|
isSqliteBackend,
|
|
@@ -98651,7 +98739,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
98651
98739
|
try {
|
|
98652
98740
|
const messages = readdirSync8(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
98653
98741
|
try {
|
|
98654
|
-
const content = readFileSync20(
|
|
98742
|
+
const content = readFileSync20(join67(messageDir, fileName), "utf-8");
|
|
98655
98743
|
const parsed = JSON.parse(content);
|
|
98656
98744
|
return {
|
|
98657
98745
|
fileName,
|
|
@@ -98695,7 +98783,7 @@ init_agent_display_names();
|
|
|
98695
98783
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
98696
98784
|
init_frontmatter2();
|
|
98697
98785
|
import { existsSync as existsSync39, readFileSync as readFileSync21, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "node:fs";
|
|
98698
|
-
import { dirname as dirname26, join as
|
|
98786
|
+
import { dirname as dirname26, join as join68 } from "node:path";
|
|
98699
98787
|
|
|
98700
98788
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
98701
98789
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -98704,7 +98792,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
98704
98792
|
|
|
98705
98793
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
98706
98794
|
function getStateFilePath(directory, customPath) {
|
|
98707
|
-
return customPath ?
|
|
98795
|
+
return customPath ? join68(directory, customPath) : join68(directory, DEFAULT_STATE_FILE);
|
|
98708
98796
|
}
|
|
98709
98797
|
function readState(directory, customPath) {
|
|
98710
98798
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -99811,7 +99899,7 @@ init_extract_semver();
|
|
|
99811
99899
|
init_bun_which_shim();
|
|
99812
99900
|
import { existsSync as existsSync47, accessSync as accessSync4, constants as constants12 } from "node:fs";
|
|
99813
99901
|
import { homedir as homedir15 } from "node:os";
|
|
99814
|
-
import { join as
|
|
99902
|
+
import { join as join75 } from "node:path";
|
|
99815
99903
|
|
|
99816
99904
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
99817
99905
|
init_spawn_with_windows_hide();
|
|
@@ -99903,17 +99991,17 @@ function getDesktopAppPaths(platform) {
|
|
|
99903
99991
|
case "darwin":
|
|
99904
99992
|
return [
|
|
99905
99993
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
99906
|
-
|
|
99994
|
+
join75(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
99907
99995
|
];
|
|
99908
99996
|
case "win32": {
|
|
99909
99997
|
const programFiles = process.env.ProgramFiles;
|
|
99910
99998
|
const localAppData = process.env.LOCALAPPDATA;
|
|
99911
99999
|
const paths = [];
|
|
99912
100000
|
if (programFiles) {
|
|
99913
|
-
paths.push(
|
|
100001
|
+
paths.push(join75(programFiles, "OpenCode", "OpenCode.exe"));
|
|
99914
100002
|
}
|
|
99915
100003
|
if (localAppData) {
|
|
99916
|
-
paths.push(
|
|
100004
|
+
paths.push(join75(localAppData, "OpenCode", "OpenCode.exe"));
|
|
99917
100005
|
}
|
|
99918
100006
|
return paths;
|
|
99919
100007
|
}
|
|
@@ -99921,8 +100009,8 @@ function getDesktopAppPaths(platform) {
|
|
|
99921
100009
|
return [
|
|
99922
100010
|
"/usr/bin/opencode",
|
|
99923
100011
|
"/usr/lib/opencode/opencode",
|
|
99924
|
-
|
|
99925
|
-
|
|
100012
|
+
join75(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
100013
|
+
join75(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
99926
100014
|
];
|
|
99927
100015
|
default:
|
|
99928
100016
|
return [];
|
|
@@ -99954,7 +100042,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
99954
100042
|
const candidates = getCommandCandidates2(platform);
|
|
99955
100043
|
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
|
|
99956
100044
|
for (const command of candidates) {
|
|
99957
|
-
const fullPath =
|
|
100045
|
+
const fullPath = join75(entry, command);
|
|
99958
100046
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
99959
100047
|
return { binary: command, path: fullPath };
|
|
99960
100048
|
}
|
|
@@ -100098,22 +100186,22 @@ init_package_json_locator();
|
|
|
100098
100186
|
import { existsSync as existsSync49, readFileSync as readFileSync30, readdirSync as readdirSync10 } from "node:fs";
|
|
100099
100187
|
import { createRequire as createRequire2 } from "node:module";
|
|
100100
100188
|
import { homedir as homedir16 } from "node:os";
|
|
100101
|
-
import { join as
|
|
100189
|
+
import { join as join76 } from "node:path";
|
|
100102
100190
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
100103
100191
|
init_shared();
|
|
100104
100192
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
100105
100193
|
if (platform === "darwin")
|
|
100106
|
-
return
|
|
100194
|
+
return join76(homedir16(), "Library", "Caches");
|
|
100107
100195
|
if (platform === "win32")
|
|
100108
|
-
return process.env.LOCALAPPDATA ??
|
|
100109
|
-
return
|
|
100196
|
+
return process.env.LOCALAPPDATA ?? join76(homedir16(), "AppData", "Local");
|
|
100197
|
+
return join76(homedir16(), ".cache");
|
|
100110
100198
|
}
|
|
100111
100199
|
function resolveOpenCodeCacheDir() {
|
|
100112
100200
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
100113
100201
|
if (xdgCacheHome)
|
|
100114
|
-
return
|
|
100202
|
+
return join76(xdgCacheHome, "opencode");
|
|
100115
100203
|
const fromShared = getOpenCodeCacheDir();
|
|
100116
|
-
const platformDefault =
|
|
100204
|
+
const platformDefault = join76(getPlatformDefaultCacheDir(), "opencode");
|
|
100117
100205
|
if (existsSync49(fromShared) || !existsSync49(platformDefault))
|
|
100118
100206
|
return fromShared;
|
|
100119
100207
|
return platformDefault;
|
|
@@ -100145,11 +100233,11 @@ function normalizeVersion(value) {
|
|
|
100145
100233
|
function createPackageCandidates(rootDir) {
|
|
100146
100234
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
100147
100235
|
packageName,
|
|
100148
|
-
installedPackagePath:
|
|
100236
|
+
installedPackagePath: join76(rootDir, "node_modules", packageName, "package.json")
|
|
100149
100237
|
}));
|
|
100150
100238
|
}
|
|
100151
100239
|
function createTaggedInstallCandidates(rootDir) {
|
|
100152
|
-
const packagesDir =
|
|
100240
|
+
const packagesDir = join76(rootDir, "packages");
|
|
100153
100241
|
if (!existsSync49(packagesDir))
|
|
100154
100242
|
return [];
|
|
100155
100243
|
const candidates = [];
|
|
@@ -100157,14 +100245,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
100157
100245
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
100158
100246
|
if (packageName === undefined)
|
|
100159
100247
|
continue;
|
|
100160
|
-
const installDir =
|
|
100248
|
+
const installDir = join76(packagesDir, entryName);
|
|
100161
100249
|
candidates.push({
|
|
100162
100250
|
cacheDir: installDir,
|
|
100163
|
-
cachePackagePath:
|
|
100251
|
+
cachePackagePath: join76(installDir, "package.json"),
|
|
100164
100252
|
packageCandidates: [
|
|
100165
100253
|
{
|
|
100166
100254
|
packageName,
|
|
100167
|
-
installedPackagePath:
|
|
100255
|
+
installedPackagePath: join76(installDir, "node_modules", packageName, "package.json")
|
|
100168
100256
|
}
|
|
100169
100257
|
]
|
|
100170
100258
|
});
|
|
@@ -100209,13 +100297,13 @@ function getLoadedPluginVersion() {
|
|
|
100209
100297
|
const candidates = [
|
|
100210
100298
|
{
|
|
100211
100299
|
cacheDir: configDir,
|
|
100212
|
-
cachePackagePath:
|
|
100300
|
+
cachePackagePath: join76(configDir, "package.json"),
|
|
100213
100301
|
packageCandidates: createPackageCandidates(configDir)
|
|
100214
100302
|
},
|
|
100215
100303
|
...createTaggedInstallCandidates(configDir),
|
|
100216
100304
|
{
|
|
100217
100305
|
cacheDir,
|
|
100218
|
-
cachePackagePath:
|
|
100306
|
+
cachePackagePath: join76(cacheDir, "package.json"),
|
|
100219
100307
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
100220
100308
|
},
|
|
100221
100309
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -100409,18 +100497,18 @@ async function checkSystem(deps = defaultDeps5) {
|
|
|
100409
100497
|
init_shared();
|
|
100410
100498
|
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "node:fs";
|
|
100411
100499
|
import { homedir as homedir17 } from "node:os";
|
|
100412
|
-
import { join as
|
|
100500
|
+
import { join as join77 } from "node:path";
|
|
100413
100501
|
function getUserConfigDir2() {
|
|
100414
100502
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
100415
100503
|
if (xdgConfig)
|
|
100416
|
-
return
|
|
100417
|
-
return
|
|
100504
|
+
return join77(xdgConfig, "opencode");
|
|
100505
|
+
return join77(homedir17(), ".config", "opencode");
|
|
100418
100506
|
}
|
|
100419
100507
|
function loadCustomProviderNames() {
|
|
100420
100508
|
const configDir = getUserConfigDir2();
|
|
100421
100509
|
const candidatePaths = [
|
|
100422
|
-
|
|
100423
|
-
|
|
100510
|
+
join77(configDir, "opencode.json"),
|
|
100511
|
+
join77(configDir, "opencode.jsonc")
|
|
100424
100512
|
];
|
|
100425
100513
|
for (const configPath of candidatePaths) {
|
|
100426
100514
|
if (!existsSync51(configPath))
|
|
@@ -100441,7 +100529,7 @@ function loadCustomProviderNames() {
|
|
|
100441
100529
|
return [];
|
|
100442
100530
|
}
|
|
100443
100531
|
function loadAvailableModelsFromCache() {
|
|
100444
|
-
const cacheFile =
|
|
100532
|
+
const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
|
|
100445
100533
|
const customProviders = loadCustomProviderNames();
|
|
100446
100534
|
if (!existsSync51(cacheFile)) {
|
|
100447
100535
|
if (customProviders.length > 0) {
|
|
@@ -100503,7 +100591,7 @@ function loadOmoConfig2() {
|
|
|
100503
100591
|
|
|
100504
100592
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
100505
100593
|
init_shared();
|
|
100506
|
-
import { join as
|
|
100594
|
+
import { join as join78 } from "node:path";
|
|
100507
100595
|
|
|
100508
100596
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
100509
100597
|
function formatModelWithVariant(model, variant) {
|
|
@@ -100545,7 +100633,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
100545
100633
|
}
|
|
100546
100634
|
function buildModelResolutionDetails(options) {
|
|
100547
100635
|
const details = [];
|
|
100548
|
-
const cacheFile =
|
|
100636
|
+
const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
|
|
100549
100637
|
details.push("═══ Available Models (from cache) ═══");
|
|
100550
100638
|
details.push("");
|
|
100551
100639
|
if (options.available.cacheExists) {
|
|
@@ -100857,7 +100945,7 @@ init_src4();
|
|
|
100857
100945
|
init_main();
|
|
100858
100946
|
init_config_migration();
|
|
100859
100947
|
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "node:fs";
|
|
100860
|
-
import { join as
|
|
100948
|
+
import { join as join79 } from "node:path";
|
|
100861
100949
|
var CANONICAL_REPLACEMENT = new Map([
|
|
100862
100950
|
["variant", "reasoning"],
|
|
100863
100951
|
["reasoningEffort", "reasoning"],
|
|
@@ -100918,7 +101006,7 @@ function userConfigPaths() {
|
|
|
100918
101006
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
100919
101007
|
if (home === undefined || home.length === 0)
|
|
100920
101008
|
return [];
|
|
100921
|
-
return [
|
|
101009
|
+
return [join79(home, ".omo", "omo.jsonc"), join79(home, ".omo", "omo.json")];
|
|
100922
101010
|
}
|
|
100923
101011
|
async function checkDeprecatedReasoningKeys() {
|
|
100924
101012
|
const issues = [];
|
|
@@ -100944,25 +101032,25 @@ init_src();
|
|
|
100944
101032
|
import { existsSync as existsSync53 } from "node:fs";
|
|
100945
101033
|
import { createRequire as createRequire3 } from "node:module";
|
|
100946
101034
|
import { homedir as homedir19 } from "node:os";
|
|
100947
|
-
import { dirname as dirname31, join as
|
|
101035
|
+
import { dirname as dirname31, join as join81 } from "node:path";
|
|
100948
101036
|
|
|
100949
101037
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
100950
|
-
import { join as
|
|
101038
|
+
import { join as join80 } from "path";
|
|
100951
101039
|
import { homedir as homedir18, tmpdir as tmpdir4 } from "os";
|
|
100952
101040
|
init_binary_downloader();
|
|
100953
101041
|
init_logger2();
|
|
100954
101042
|
init_plugin_identity();
|
|
100955
101043
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
100956
|
-
var DEBUG_FILE =
|
|
101044
|
+
var DEBUG_FILE = join80(tmpdir4(), "comment-checker-debug.log");
|
|
100957
101045
|
function getCacheDir2() {
|
|
100958
101046
|
if (process.platform === "win32") {
|
|
100959
101047
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
100960
|
-
const base = localAppData ||
|
|
100961
|
-
return
|
|
101048
|
+
const base = localAppData || join80(homedir18(), "AppData", "Local");
|
|
101049
|
+
return join80(base, CACHE_DIR_NAME, "bin");
|
|
100962
101050
|
}
|
|
100963
101051
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
100964
|
-
const base = xdgCache ||
|
|
100965
|
-
return
|
|
101052
|
+
const base = xdgCache || join80(homedir18(), ".cache");
|
|
101053
|
+
return join80(base, CACHE_DIR_NAME, "bin");
|
|
100966
101054
|
}
|
|
100967
101055
|
function getBinaryName() {
|
|
100968
101056
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -101012,7 +101100,7 @@ async function getBinaryVersion(binary) {
|
|
|
101012
101100
|
}
|
|
101013
101101
|
}
|
|
101014
101102
|
async function checkAstGrepCli() {
|
|
101015
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
101103
|
+
const runtimeDir = astGrepRuntimeDir(join81(homedir19(), ".omo"));
|
|
101016
101104
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
101017
101105
|
if (sgPath === null) {
|
|
101018
101106
|
return {
|
|
@@ -101042,10 +101130,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
101042
101130
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
101043
101131
|
try {
|
|
101044
101132
|
const packageDir = baseDirOverride ?? dirname31(resolvePackageJsonPath());
|
|
101045
|
-
const vendorPath =
|
|
101133
|
+
const vendorPath = join81(packageDir, "vendor", platformKey, binaryName);
|
|
101046
101134
|
if (existsSync53(vendorPath))
|
|
101047
101135
|
return vendorPath;
|
|
101048
|
-
const binPath =
|
|
101136
|
+
const binPath = join81(packageDir, "bin", binaryName);
|
|
101049
101137
|
if (existsSync53(binPath))
|
|
101050
101138
|
return binPath;
|
|
101051
101139
|
} catch (error) {
|
|
@@ -101421,13 +101509,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
101421
101509
|
init_shared();
|
|
101422
101510
|
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "node:fs";
|
|
101423
101511
|
import { homedir as homedir20 } from "node:os";
|
|
101424
|
-
import { join as
|
|
101512
|
+
import { join as join82 } from "node:path";
|
|
101425
101513
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
101426
101514
|
function getMcpConfigPaths() {
|
|
101427
101515
|
return [
|
|
101428
|
-
|
|
101429
|
-
|
|
101430
|
-
|
|
101516
|
+
join82(homedir20(), ".claude", ".mcp.json"),
|
|
101517
|
+
join82(process.cwd(), ".mcp.json"),
|
|
101518
|
+
join82(process.cwd(), ".claude", ".mcp.json")
|
|
101431
101519
|
];
|
|
101432
101520
|
}
|
|
101433
101521
|
function loadUserMcpConfig() {
|
|
@@ -101707,9 +101795,9 @@ async function pathExists(dir) {
|
|
|
101707
101795
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
101708
101796
|
init_src();
|
|
101709
101797
|
import { existsSync as existsSync57 } from "node:fs";
|
|
101710
|
-
import { lstat as
|
|
101798
|
+
import { lstat as lstat16, readdir as readdir14, readFile as readFile28 } from "node:fs/promises";
|
|
101711
101799
|
import { homedir as homedir22 } from "node:os";
|
|
101712
|
-
import { basename as basename11, join as
|
|
101800
|
+
import { basename as basename11, join as join83, resolve as resolve23 } from "node:path";
|
|
101713
101801
|
// packages/omo-opencode/package.json
|
|
101714
101802
|
var package_default3 = {
|
|
101715
101803
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -101775,13 +101863,13 @@ var CODEX_BIN_NAMES = [
|
|
|
101775
101863
|
"omo-git-bash-hook"
|
|
101776
101864
|
];
|
|
101777
101865
|
async function gatherCodexSummary(deps = {}) {
|
|
101778
|
-
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
101866
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join83(homedir22(), ".codex"));
|
|
101779
101867
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
101780
101868
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
101781
101869
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
101782
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
101783
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
101784
|
-
const configPath =
|
|
101870
|
+
const manifest = pluginRoot === null ? null : await readJson(join83(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
101871
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join83(pluginRoot, "lazycodex-install.json"));
|
|
101872
|
+
const configPath = join83(codexHome, "config.toml");
|
|
101785
101873
|
const pluginVersion = stringField(manifest, "version");
|
|
101786
101874
|
return {
|
|
101787
101875
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -101838,7 +101926,7 @@ function buildCodexIssues(summary) {
|
|
|
101838
101926
|
if (summary.pluginRoot === null) {
|
|
101839
101927
|
issues.push({
|
|
101840
101928
|
title: "OMO Codex plugin is not installed",
|
|
101841
|
-
description: `Expected cached plugin at ${
|
|
101929
|
+
description: `Expected cached plugin at ${join83("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
101842
101930
|
fix: "Run: npx lazycodex-ai install",
|
|
101843
101931
|
severity: "error",
|
|
101844
101932
|
affects: ["plugin loading"]
|
|
@@ -101903,12 +101991,12 @@ function buildCodexIssues(summary) {
|
|
|
101903
101991
|
return issues;
|
|
101904
101992
|
}
|
|
101905
101993
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
101906
|
-
const pluginRoot =
|
|
101994
|
+
const pluginRoot = join83(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
101907
101995
|
if (!existsSync57(pluginRoot))
|
|
101908
101996
|
return null;
|
|
101909
101997
|
const versions = await readdir14(pluginRoot, { withFileTypes: true });
|
|
101910
101998
|
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
101911
|
-
return candidates.length === 0 ? null :
|
|
101999
|
+
return candidates.length === 0 ? null : join83(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
101912
102000
|
}
|
|
101913
102001
|
async function readCodexConfigSummary(configPath) {
|
|
101914
102002
|
if (!existsSync57(configPath)) {
|
|
@@ -101922,7 +102010,7 @@ async function readCodexConfigSummary(configPath) {
|
|
|
101922
102010
|
companionLifecycleHookStateEvents: []
|
|
101923
102011
|
};
|
|
101924
102012
|
}
|
|
101925
|
-
const content = await
|
|
102013
|
+
const content = await readFile28(configPath, "utf8");
|
|
101926
102014
|
return {
|
|
101927
102015
|
exists: true,
|
|
101928
102016
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -101936,13 +102024,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
101936
102024
|
async function readLinkedBins(binDir) {
|
|
101937
102025
|
const linked = [];
|
|
101938
102026
|
for (const name of CODEX_BIN_NAMES) {
|
|
101939
|
-
if (await pathExists2(
|
|
102027
|
+
if (await pathExists2(join83(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
101940
102028
|
linked.push(name);
|
|
101941
102029
|
}
|
|
101942
102030
|
return linked;
|
|
101943
102031
|
}
|
|
101944
102032
|
async function readLinkedAgents(codexHome) {
|
|
101945
|
-
const agentsDir =
|
|
102033
|
+
const agentsDir = join83(codexHome, "agents");
|
|
101946
102034
|
if (!existsSync57(agentsDir))
|
|
101947
102035
|
return [];
|
|
101948
102036
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
@@ -101950,7 +102038,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
101950
102038
|
}
|
|
101951
102039
|
async function readJson(path) {
|
|
101952
102040
|
try {
|
|
101953
|
-
const parsed = JSON.parse(await
|
|
102041
|
+
const parsed = JSON.parse(await readFile28(path, "utf8"));
|
|
101954
102042
|
return isPlainRecord(parsed) ? parsed : null;
|
|
101955
102043
|
} catch (error) {
|
|
101956
102044
|
if (error instanceof Error)
|
|
@@ -102045,7 +102133,7 @@ function compareVersionsDescending(left, right) {
|
|
|
102045
102133
|
}
|
|
102046
102134
|
async function pathExists2(path) {
|
|
102047
102135
|
try {
|
|
102048
|
-
await
|
|
102136
|
+
await lstat16(path);
|
|
102049
102137
|
return true;
|
|
102050
102138
|
} catch (error) {
|
|
102051
102139
|
if (error instanceof Error)
|
|
@@ -102074,9 +102162,9 @@ function resolveLatestVersion(input) {
|
|
|
102074
102162
|
|
|
102075
102163
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
102076
102164
|
init_src();
|
|
102077
|
-
import { readdir as readdir15, readFile as
|
|
102165
|
+
import { readdir as readdir15, readFile as readFile29, stat as stat7 } from "node:fs/promises";
|
|
102078
102166
|
import { homedir as homedir23 } from "node:os";
|
|
102079
|
-
import { dirname as dirname33, isAbsolute as isAbsolute13, join as
|
|
102167
|
+
import { dirname as dirname33, isAbsolute as isAbsolute13, join as join84, relative as relative9, resolve as resolve24, sep as sep9 } from "node:path";
|
|
102080
102168
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
102081
102169
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
102082
102170
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -102086,7 +102174,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
102086
102174
|
const env = deps.env ?? process.env;
|
|
102087
102175
|
const platform = deps.platform ?? process.platform;
|
|
102088
102176
|
const arch = deps.arch ?? process.arch;
|
|
102089
|
-
const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ??
|
|
102177
|
+
const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ?? join84(homedir23(), ".codex"));
|
|
102090
102178
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
102091
102179
|
if (summary.pluginRoot === null) {
|
|
102092
102180
|
return {
|
|
@@ -102111,7 +102199,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
102111
102199
|
});
|
|
102112
102200
|
}
|
|
102113
102201
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
102114
|
-
const runtimeSgPath =
|
|
102202
|
+
const runtimeSgPath = join84(runtimeSgDir, sgBinaryName(platform));
|
|
102115
102203
|
const sg = findSgBinarySync({
|
|
102116
102204
|
arch,
|
|
102117
102205
|
env,
|
|
@@ -102223,7 +102311,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
102223
102311
|
for (const entry of entries) {
|
|
102224
102312
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
102225
102313
|
continue;
|
|
102226
|
-
const entryPath =
|
|
102314
|
+
const entryPath = join84(root, entry.name);
|
|
102227
102315
|
if (entry.isDirectory()) {
|
|
102228
102316
|
paths.push(...await findManifestPaths(entryPath, manifestName));
|
|
102229
102317
|
continue;
|
|
@@ -102267,18 +102355,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
102267
102355
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute13(arg));
|
|
102268
102356
|
}
|
|
102269
102357
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
102270
|
-
return
|
|
102358
|
+
return join84(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
102271
102359
|
}
|
|
102272
102360
|
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
|
|
102273
102361
|
const override = env[SG_PATH_ENV_KEY]?.trim();
|
|
102274
102362
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
102275
102363
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
102276
|
-
if (sgPath ===
|
|
102364
|
+
if (sgPath === join84(runtimeSgDir, sgBinaryName(platform)))
|
|
102277
102365
|
return "runtime dir";
|
|
102278
102366
|
return "PATH";
|
|
102279
102367
|
}
|
|
102280
102368
|
async function readBootstrapStateSummary(codexHome) {
|
|
102281
|
-
const statePath =
|
|
102369
|
+
const statePath = join84(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
102282
102370
|
const raw = await readJson2(statePath);
|
|
102283
102371
|
if (raw === null)
|
|
102284
102372
|
return null;
|
|
@@ -102327,7 +102415,7 @@ function degradedDetailLines(entries) {
|
|
|
102327
102415
|
}
|
|
102328
102416
|
async function readJson2(path) {
|
|
102329
102417
|
try {
|
|
102330
|
-
const parsed = JSON.parse(await
|
|
102418
|
+
const parsed = JSON.parse(await readFile29(path, "utf8"));
|
|
102331
102419
|
return isRecord15(parsed) ? parsed : null;
|
|
102332
102420
|
} catch (error) {
|
|
102333
102421
|
if (error instanceof Error)
|
|
@@ -102355,18 +102443,18 @@ function isRecord15(value) {
|
|
|
102355
102443
|
|
|
102356
102444
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
102357
102445
|
import { existsSync as existsSync58 } from "node:fs";
|
|
102358
|
-
import { readFile as
|
|
102446
|
+
import { readFile as readFile30 } from "node:fs/promises";
|
|
102359
102447
|
import { homedir as homedir24 } from "node:os";
|
|
102360
|
-
import { join as
|
|
102448
|
+
import { join as join85, resolve as resolve25 } from "node:path";
|
|
102361
102449
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
102362
102450
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
102363
102451
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
102364
102452
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
102365
|
-
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
102453
|
+
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join85(homedir24(), ".codex"));
|
|
102366
102454
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
102367
102455
|
const platform = deps.platform ?? process.platform;
|
|
102368
|
-
const wrapperPath =
|
|
102369
|
-
const legacyWrapperPath =
|
|
102456
|
+
const wrapperPath = join85(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
102457
|
+
const legacyWrapperPath = join85(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
102370
102458
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
102371
102459
|
const issues = [];
|
|
102372
102460
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -102400,7 +102488,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
102400
102488
|
}
|
|
102401
102489
|
async function readRuntimeWrapper(path) {
|
|
102402
102490
|
try {
|
|
102403
|
-
return await
|
|
102491
|
+
return await readFile30(path, "utf8");
|
|
102404
102492
|
} catch (error) {
|
|
102405
102493
|
if (error instanceof Error)
|
|
102406
102494
|
return null;
|
|
@@ -102890,7 +102978,7 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
102890
102978
|
}
|
|
102891
102979
|
|
|
102892
102980
|
// packages/mcp-client-core/src/mcp-oauth/storage.ts
|
|
102893
|
-
import { createHash as
|
|
102981
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
102894
102982
|
import {
|
|
102895
102983
|
chmodSync as chmodSync5,
|
|
102896
102984
|
existsSync as existsSync61,
|
|
@@ -102901,12 +102989,12 @@ import {
|
|
|
102901
102989
|
unlinkSync as unlinkSync9,
|
|
102902
102990
|
writeFileSync as writeFileSync12
|
|
102903
102991
|
} from "node:fs";
|
|
102904
|
-
import { basename as basename12, dirname as dirname34, join as
|
|
102992
|
+
import { basename as basename12, dirname as dirname34, join as join88 } from "node:path";
|
|
102905
102993
|
|
|
102906
102994
|
// packages/mcp-client-core/src/config-dir.ts
|
|
102907
102995
|
import { existsSync as existsSync59, realpathSync as realpathSync8 } from "node:fs";
|
|
102908
102996
|
import { homedir as homedir25 } from "node:os";
|
|
102909
|
-
import { join as
|
|
102997
|
+
import { join as join86, resolve as resolve26 } from "node:path";
|
|
102910
102998
|
function resolveConfigPath2(pathValue) {
|
|
102911
102999
|
const resolvedPath = resolve26(pathValue);
|
|
102912
103000
|
if (!existsSync59(resolvedPath))
|
|
@@ -102924,13 +103012,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
102924
103012
|
if (customConfigDir) {
|
|
102925
103013
|
return resolveConfigPath2(customConfigDir);
|
|
102926
103014
|
}
|
|
102927
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
102928
|
-
return resolveConfigPath2(
|
|
103015
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join86(homedir25(), ".config");
|
|
103016
|
+
return resolveConfigPath2(join86(xdgConfigDir, "opencode"));
|
|
102929
103017
|
}
|
|
102930
103018
|
|
|
102931
103019
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
102932
103020
|
import { chmodSync as chmodSync4, existsSync as existsSync60, readFileSync as readFileSync37, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "node:fs";
|
|
102933
|
-
import { join as
|
|
103021
|
+
import { join as join87 } from "node:path";
|
|
102934
103022
|
var INDEX_FILE_NAME = "index.json";
|
|
102935
103023
|
function isTokenIndex(value) {
|
|
102936
103024
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -102938,7 +103026,7 @@ function isTokenIndex(value) {
|
|
|
102938
103026
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
102939
103027
|
}
|
|
102940
103028
|
function getIndexPath(storageDir) {
|
|
102941
|
-
return
|
|
103029
|
+
return join87(storageDir, INDEX_FILE_NAME);
|
|
102942
103030
|
}
|
|
102943
103031
|
function readTokenIndex(storageDir) {
|
|
102944
103032
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -102982,16 +103070,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
|
|
|
102982
103070
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
102983
103071
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
102984
103072
|
function getMcpOauthStorageDir() {
|
|
102985
|
-
return
|
|
103073
|
+
return join88(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
102986
103074
|
}
|
|
102987
103075
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
102988
|
-
return
|
|
103076
|
+
return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
102989
103077
|
}
|
|
102990
103078
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
102991
|
-
return
|
|
103079
|
+
return join88(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
102992
103080
|
}
|
|
102993
103081
|
function getLegacyStoragePath() {
|
|
102994
|
-
return
|
|
103082
|
+
return join88(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
102995
103083
|
}
|
|
102996
103084
|
function normalizeHost2(serverHost) {
|
|
102997
103085
|
let host = serverHost.trim();
|
|
@@ -103170,7 +103258,7 @@ function listTokensByHost(serverHost) {
|
|
|
103170
103258
|
for (const [hash, indexedKey] of Object.entries(index)) {
|
|
103171
103259
|
if (!indexedKey.startsWith(prefix))
|
|
103172
103260
|
continue;
|
|
103173
|
-
const indexedToken = readTokenFile(
|
|
103261
|
+
const indexedToken = readTokenFile(join88(getMcpOauthStorageDir(), `${hash}.json`));
|
|
103174
103262
|
if (indexedToken)
|
|
103175
103263
|
result[indexedKey] = indexedToken;
|
|
103176
103264
|
}
|
|
@@ -103185,7 +103273,7 @@ function listAllTokens() {
|
|
|
103185
103273
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
103186
103274
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
103187
103275
|
continue;
|
|
103188
|
-
const token = readTokenFile(
|
|
103276
|
+
const token = readTokenFile(join88(dir, entry.name));
|
|
103189
103277
|
const hash = basename12(entry.name, ".json");
|
|
103190
103278
|
if (token)
|
|
103191
103279
|
result[index[hash] ?? hash] = token;
|
|
@@ -103359,13 +103447,13 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
|
|
|
103359
103447
|
|
|
103360
103448
|
// packages/mcp-client-core/src/mcp-oauth/oauth-authorization-flow.ts
|
|
103361
103449
|
import { spawn as spawn4 } from "node:child_process";
|
|
103362
|
-
import { createHash as
|
|
103450
|
+
import { createHash as createHash8, randomBytes as randomBytes2 } from "node:crypto";
|
|
103363
103451
|
import { createServer as createServer2 } from "node:http";
|
|
103364
103452
|
function generateCodeVerifier() {
|
|
103365
103453
|
return randomBytes2(32).toString("base64url");
|
|
103366
103454
|
}
|
|
103367
103455
|
function generateCodeChallenge(verifier) {
|
|
103368
|
-
return
|
|
103456
|
+
return createHash8("sha256").update(verifier).digest("base64url");
|
|
103369
103457
|
}
|
|
103370
103458
|
function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
103371
103459
|
const url = new URL(authorizationEndpoint);
|