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/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var package_default;
|
|
|
64
64
|
var init_package = __esm(() => {
|
|
65
65
|
package_default = {
|
|
66
66
|
name: "oh-my-opencode",
|
|
67
|
-
version: "5.0.0-beta.
|
|
67
|
+
version: "5.0.0-beta.62",
|
|
68
68
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
69
69
|
main: "./dist/index.js",
|
|
70
70
|
types: "dist/index.d.ts",
|
|
@@ -249,7 +249,7 @@ var init_package = __esm(() => {
|
|
|
249
249
|
zod: "^4.4.3"
|
|
250
250
|
},
|
|
251
251
|
devDependencies: {
|
|
252
|
-
"@code-yeongyu/senpi": "2026.9.
|
|
252
|
+
"@code-yeongyu/senpi": "2026.9.13",
|
|
253
253
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
254
254
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
255
255
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -290,18 +290,18 @@ var init_package = __esm(() => {
|
|
|
290
290
|
typescript: "^7.0.2"
|
|
291
291
|
},
|
|
292
292
|
optionalDependencies: {
|
|
293
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
294
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
295
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
296
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
297
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
298
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
299
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
300
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
301
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
302
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
303
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
304
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
293
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.62",
|
|
294
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.62",
|
|
295
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.62",
|
|
296
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.62",
|
|
297
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.62",
|
|
298
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.62",
|
|
299
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.62",
|
|
300
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.62",
|
|
301
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.62",
|
|
302
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.62",
|
|
303
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.62",
|
|
304
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.62"
|
|
305
305
|
},
|
|
306
306
|
overrides: {
|
|
307
307
|
"@earendil-works/pi-agent-core": "0.84.2",
|
|
@@ -76944,20 +76944,20 @@ var init_config_manager = __esm(() => {
|
|
|
76944
76944
|
|
|
76945
76945
|
// packages/telemetry-core/src/activity-state.ts
|
|
76946
76946
|
import { existsSync as existsSync24, mkdirSync as mkdirSync8, readFileSync as readFileSync11 } from "fs";
|
|
76947
|
-
import { basename as basename8, join as
|
|
76947
|
+
import { basename as basename8, join as join51 } from "path";
|
|
76948
76948
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
76949
76949
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
76950
76950
|
env: options.env,
|
|
76951
76951
|
osProvider: options.osProvider
|
|
76952
76952
|
});
|
|
76953
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
76953
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join51(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
76954
76954
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename8(dataDir) === product.cacheDirName) {
|
|
76955
76955
|
return dataDir;
|
|
76956
76956
|
}
|
|
76957
|
-
return
|
|
76957
|
+
return join51(dataDir, product.cacheDirName);
|
|
76958
76958
|
}
|
|
76959
76959
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
76960
|
-
return
|
|
76960
|
+
return join51(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
76961
76961
|
}
|
|
76962
76962
|
function getDailyActiveCaptureState(input) {
|
|
76963
76963
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -77028,9 +77028,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
77028
77028
|
|
|
77029
77029
|
// packages/telemetry-core/src/diagnostics.ts
|
|
77030
77030
|
import { appendFileSync as appendFileSync2, existsSync as existsSync25, mkdirSync as mkdirSync9, readFileSync as readFileSync12 } from "fs";
|
|
77031
|
-
import { join as
|
|
77031
|
+
import { join as join52 } from "path";
|
|
77032
77032
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
77033
|
-
return
|
|
77033
|
+
return join52(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
77034
77034
|
}
|
|
77035
77035
|
function writeTelemetryDiagnostic(input, options) {
|
|
77036
77036
|
const now = options.now ?? new Date;
|
|
@@ -84337,13 +84337,13 @@ var init_index_node = __esm(() => {
|
|
|
84337
84337
|
});
|
|
84338
84338
|
|
|
84339
84339
|
// packages/telemetry-core/src/machine-id.ts
|
|
84340
|
-
import { createHash as
|
|
84340
|
+
import { createHash as createHash5 } from "crypto";
|
|
84341
84341
|
import os4 from "os";
|
|
84342
84342
|
function getDefaultTelemetryOsProvider() {
|
|
84343
84343
|
return os4;
|
|
84344
84344
|
}
|
|
84345
84345
|
function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetryOsProvider()) {
|
|
84346
|
-
return
|
|
84346
|
+
return createHash5("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
|
|
84347
84347
|
}
|
|
84348
84348
|
var init_machine_id = () => {};
|
|
84349
84349
|
|
|
@@ -84542,7 +84542,7 @@ var package_default2;
|
|
|
84542
84542
|
var init_package2 = __esm(() => {
|
|
84543
84543
|
package_default2 = {
|
|
84544
84544
|
name: "@oh-my-opencode/omo-codex",
|
|
84545
|
-
version: "5.0.0-beta.
|
|
84545
|
+
version: "5.0.0-beta.62",
|
|
84546
84546
|
type: "module",
|
|
84547
84547
|
private: true,
|
|
84548
84548
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -85414,7 +85414,7 @@ var init_update_toasts = __esm(() => {
|
|
|
85414
85414
|
|
|
85415
85415
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
85416
85416
|
import { existsSync as existsSync46 } from "fs";
|
|
85417
|
-
import { dirname as dirname30, join as
|
|
85417
|
+
import { dirname as dirname30, join as join74 } from "path";
|
|
85418
85418
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
85419
85419
|
function defaultGetModuleHostingWorkspace() {
|
|
85420
85420
|
try {
|
|
@@ -85568,7 +85568,7 @@ var init_background_update_check = __esm(() => {
|
|
|
85568
85568
|
init_update_toasts();
|
|
85569
85569
|
defaultDeps4 = {
|
|
85570
85570
|
existsSync: existsSync46,
|
|
85571
|
-
join:
|
|
85571
|
+
join: join74,
|
|
85572
85572
|
runBunInstallWithDetails,
|
|
85573
85573
|
log: log2,
|
|
85574
85574
|
getOpenCodeCacheDir,
|
|
@@ -87990,7 +87990,19 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
87990
87990
|
}
|
|
87991
87991
|
|
|
87992
87992
|
// packages/omo-codex/src/install/install-codex.ts
|
|
87993
|
-
import { join as
|
|
87993
|
+
import { join as join53, resolve as resolve12 } from "path";
|
|
87994
|
+
|
|
87995
|
+
// packages/omo-codex/src/install/codex-default-role-config.ts
|
|
87996
|
+
init_src4();
|
|
87997
|
+
function readDefaultRoleConfig(options = {}) {
|
|
87998
|
+
const result = loadOmoConfig({ ...options, harness: "codex" });
|
|
87999
|
+
return {
|
|
88000
|
+
enabled: result.config.agents?.default?.disable !== true,
|
|
88001
|
+
warnings: result.diagnostics.map((diagnostic) => diagnostic.message)
|
|
88002
|
+
};
|
|
88003
|
+
}
|
|
88004
|
+
|
|
88005
|
+
// packages/omo-codex/src/install/install-codex.ts
|
|
87994
88006
|
import { existsSync as existsSync26 } from "fs";
|
|
87995
88007
|
import { homedir as homedir6 } from "os";
|
|
87996
88008
|
|
|
@@ -89917,6 +89929,12 @@ function removeStaleManagedAgentBlocks(config, keepAgentNames) {
|
|
|
89917
89929
|
|
|
89918
89930
|
`);
|
|
89919
89931
|
}
|
|
89932
|
+
function hasForeignAgentRegistration(config, agentConfig) {
|
|
89933
|
+
const section = findTomlSection(config, `agents.${tomlKeySegment(agentConfig.name)}`);
|
|
89934
|
+
if (!section)
|
|
89935
|
+
return false;
|
|
89936
|
+
return !section.text.includes(`config_file = ${JSON.stringify(agentConfig.configFile)}`);
|
|
89937
|
+
}
|
|
89920
89938
|
function ensureAgentConfig(config, agentConfig) {
|
|
89921
89939
|
const header = `agents.${tomlKeySegment(agentConfig.name)}`;
|
|
89922
89940
|
const section = findTomlSection(config, header);
|
|
@@ -90886,8 +90904,8 @@ function toCodexResolution(resolution) {
|
|
|
90886
90904
|
}
|
|
90887
90905
|
|
|
90888
90906
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
90889
|
-
import { copyFile, lstat as
|
|
90890
|
-
import { basename as basename6, join as
|
|
90907
|
+
import { copyFile, lstat as lstat10, mkdir as mkdir6, readdir as readdir7, rm as rm9, writeFile as writeFile7 } from "fs/promises";
|
|
90908
|
+
import { basename as basename6, join as join41 } from "path";
|
|
90891
90909
|
|
|
90892
90910
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
90893
90911
|
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile6 } from "fs/promises";
|
|
@@ -91304,6 +91322,66 @@ function nodeErrorCode2(error) {
|
|
|
91304
91322
|
return typeof error.code === "string" ? error.code : null;
|
|
91305
91323
|
}
|
|
91306
91324
|
|
|
91325
|
+
// packages/omo-codex/src/install/default-agent-role.ts
|
|
91326
|
+
import { createHash as createHash3 } from "crypto";
|
|
91327
|
+
import { lstat as lstat9, readFile as readFile15, rm as rm8 } from "fs/promises";
|
|
91328
|
+
import { join as join40 } from "path";
|
|
91329
|
+
var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
|
|
91330
|
+
async function installDefaultAgentRole(input) {
|
|
91331
|
+
const target = join40(input.codexHome, "agents", "default.toml");
|
|
91332
|
+
const receipt = join40(input.codexHome, "agents", ".lazycodex-default.sha256");
|
|
91333
|
+
const configPath = join40(input.codexHome, "config.toml");
|
|
91334
|
+
const config = await readIfPresent(configPath);
|
|
91335
|
+
const entry = await lstat9(target).catch((error) => {
|
|
91336
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
91337
|
+
return null;
|
|
91338
|
+
throw error;
|
|
91339
|
+
});
|
|
91340
|
+
if (entry !== null && !entry.isFile()) {
|
|
91341
|
+
if (!input.enabled)
|
|
91342
|
+
return null;
|
|
91343
|
+
throw new Error("Preserved user-owned agents/default.toml: refusing to replace a symlink or directory");
|
|
91344
|
+
}
|
|
91345
|
+
const existing = await readIfPresent(target);
|
|
91346
|
+
const digest = await readIfPresent(receipt);
|
|
91347
|
+
const owned = existing !== null && digest === hash(existing);
|
|
91348
|
+
const foreign = hasForeignAgentRegistration(config ?? "", REGISTRATION);
|
|
91349
|
+
if (!input.enabled) {
|
|
91350
|
+
if (owned) {
|
|
91351
|
+
if (!foreign && config !== null) {
|
|
91352
|
+
const next = splitTomlSections(config).filter((section) => section.header === null || parseAgentHeaderName(section.header) !== "default").map((section) => section.text).join("");
|
|
91353
|
+
if (next !== config)
|
|
91354
|
+
await writeFileAtomic(configPath, next);
|
|
91355
|
+
}
|
|
91356
|
+
await rm8(target);
|
|
91357
|
+
await rm8(receipt);
|
|
91358
|
+
}
|
|
91359
|
+
return null;
|
|
91360
|
+
}
|
|
91361
|
+
if (foreign || existing !== null && !owned) {
|
|
91362
|
+
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.");
|
|
91363
|
+
}
|
|
91364
|
+
const worker = await readFile15(input.worker.path, "utf8");
|
|
91365
|
+
const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
|
|
91366
|
+
if (content === worker)
|
|
91367
|
+
throw new Error("Cannot derive default: medium worker has no matching internal name");
|
|
91368
|
+
await writeFileAtomic(target, content);
|
|
91369
|
+
await writeFileAtomic(receipt, hash(content));
|
|
91370
|
+
return { name: "default.toml", path: target, target: input.worker.target };
|
|
91371
|
+
}
|
|
91372
|
+
async function readIfPresent(path) {
|
|
91373
|
+
try {
|
|
91374
|
+
return await readFile15(path, "utf8");
|
|
91375
|
+
} catch (error) {
|
|
91376
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
91377
|
+
return null;
|
|
91378
|
+
throw error;
|
|
91379
|
+
}
|
|
91380
|
+
}
|
|
91381
|
+
function hash(content) {
|
|
91382
|
+
return createHash3("sha256").update(content).digest("hex");
|
|
91383
|
+
}
|
|
91384
|
+
|
|
91307
91385
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
91308
91386
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
91309
91387
|
async function linkCachedPluginAgents(input) {
|
|
@@ -91313,13 +91391,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
91313
91391
|
await writeManifest(input.pluginRoot, []);
|
|
91314
91392
|
return [];
|
|
91315
91393
|
}
|
|
91316
|
-
const agentsDir =
|
|
91394
|
+
const agentsDir = join41(input.codexHome, "agents");
|
|
91317
91395
|
await mkdir6(agentsDir, { recursive: true });
|
|
91318
91396
|
const linked = [];
|
|
91319
91397
|
for (const agentPath of bundledAgents) {
|
|
91320
91398
|
const agentFileName = basename6(agentPath);
|
|
91321
91399
|
const agentName = agentNameFromToml2(agentFileName);
|
|
91322
|
-
const linkPath =
|
|
91400
|
+
const linkPath = join41(agentsDir, agentFileName);
|
|
91323
91401
|
await replaceWithCopy(linkPath, agentPath);
|
|
91324
91402
|
await restorePreservedReasoning({
|
|
91325
91403
|
agentName,
|
|
@@ -91334,11 +91412,17 @@ async function linkCachedPluginAgents(input) {
|
|
|
91334
91412
|
});
|
|
91335
91413
|
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
91336
91414
|
}
|
|
91415
|
+
const worker = linked.find((entry) => entry.name === "lazycodex-worker-medium.toml");
|
|
91416
|
+
if (worker !== undefined) {
|
|
91417
|
+
const fallback = await installDefaultAgentRole({ codexHome: input.codexHome, worker, enabled: input.defaultRoleEnabled !== false });
|
|
91418
|
+
if (fallback !== null)
|
|
91419
|
+
linked.push(fallback);
|
|
91420
|
+
}
|
|
91337
91421
|
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
91338
91422
|
return linked;
|
|
91339
91423
|
}
|
|
91340
91424
|
async function discoverBundledAgents(pluginRoot) {
|
|
91341
|
-
const componentsRoot =
|
|
91425
|
+
const componentsRoot = join41(pluginRoot, "components");
|
|
91342
91426
|
if (!await exists4(componentsRoot))
|
|
91343
91427
|
return [];
|
|
91344
91428
|
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
@@ -91346,14 +91430,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
91346
91430
|
for (const entry of componentEntries) {
|
|
91347
91431
|
if (!entry.isDirectory())
|
|
91348
91432
|
continue;
|
|
91349
|
-
const agentsRoot =
|
|
91433
|
+
const agentsRoot = join41(componentsRoot, entry.name, "agents");
|
|
91350
91434
|
if (!await exists4(agentsRoot))
|
|
91351
91435
|
continue;
|
|
91352
91436
|
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
91353
91437
|
for (const file of agentEntries) {
|
|
91354
91438
|
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
91355
91439
|
continue;
|
|
91356
|
-
agents.push(
|
|
91440
|
+
agents.push(join41(agentsRoot, file.name));
|
|
91357
91441
|
}
|
|
91358
91442
|
}
|
|
91359
91443
|
agents.sort();
|
|
@@ -91366,14 +91450,14 @@ async function replaceWithCopy(linkPath, target) {
|
|
|
91366
91450
|
async function prepareReplacement(linkPath) {
|
|
91367
91451
|
if (!await exists4(linkPath))
|
|
91368
91452
|
return;
|
|
91369
|
-
const entryStat = await
|
|
91453
|
+
const entryStat = await lstat10(linkPath);
|
|
91370
91454
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
91371
91455
|
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
91372
91456
|
}
|
|
91373
|
-
await
|
|
91457
|
+
await rm9(linkPath, { force: true });
|
|
91374
91458
|
}
|
|
91375
91459
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
91376
|
-
const manifestPath =
|
|
91460
|
+
const manifestPath = join41(pluginRoot, MANIFEST_FILE);
|
|
91377
91461
|
const payload = { agents: [...agentPaths].sort() };
|
|
91378
91462
|
await writeFile7(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
91379
91463
|
`);
|
|
@@ -91383,7 +91467,7 @@ function agentNameFromToml2(fileName) {
|
|
|
91383
91467
|
}
|
|
91384
91468
|
async function exists4(path) {
|
|
91385
91469
|
try {
|
|
91386
|
-
await
|
|
91470
|
+
await lstat10(path);
|
|
91387
91471
|
return true;
|
|
91388
91472
|
} catch (error) {
|
|
91389
91473
|
if (nodeErrorCode3(error) !== "ENOENT")
|
|
@@ -91398,12 +91482,12 @@ function nodeErrorCode3(error) {
|
|
|
91398
91482
|
}
|
|
91399
91483
|
|
|
91400
91484
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
91401
|
-
import { readFile as
|
|
91402
|
-
import { join as
|
|
91485
|
+
import { readFile as readFile16 } from "fs/promises";
|
|
91486
|
+
import { join as join42 } from "path";
|
|
91403
91487
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
91404
91488
|
async function readMarketplace(repoRoot, options) {
|
|
91405
|
-
const marketplacePath = options?.marketplacePath ??
|
|
91406
|
-
const raw = await
|
|
91489
|
+
const marketplacePath = options?.marketplacePath ?? join42(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
91490
|
+
const raw = await readFile16(marketplacePath, "utf8");
|
|
91407
91491
|
const parsed = JSON.parse(raw);
|
|
91408
91492
|
if (!isPlainRecord4(parsed))
|
|
91409
91493
|
throw new Error("marketplace.json must be an object");
|
|
@@ -91421,10 +91505,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
91421
91505
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
91422
91506
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
91423
91507
|
const relativePath = sourcePath.slice(2);
|
|
91424
|
-
return
|
|
91508
|
+
return join42(repoRoot, ...relativePath.split(/[\\/]/));
|
|
91425
91509
|
}
|
|
91426
91510
|
async function readPluginManifest(pluginRoot) {
|
|
91427
|
-
const raw = await
|
|
91511
|
+
const raw = await readFile16(join42(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
91428
91512
|
const parsed = JSON.parse(raw);
|
|
91429
91513
|
if (!isPlainRecord4(parsed))
|
|
91430
91514
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -91505,8 +91589,8 @@ function validateLocalSourcePath(path) {
|
|
|
91505
91589
|
}
|
|
91506
91590
|
|
|
91507
91591
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
91508
|
-
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as
|
|
91509
|
-
import { join as
|
|
91592
|
+
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm10, writeFile as writeFile8 } from "fs/promises";
|
|
91593
|
+
import { join as join43, sep as sep6 } from "path";
|
|
91510
91594
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
91511
91595
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
91512
91596
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -91519,28 +91603,28 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
91519
91603
|
return snapshotPlugins;
|
|
91520
91604
|
}
|
|
91521
91605
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
91522
|
-
return
|
|
91606
|
+
return join43(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
91523
91607
|
}
|
|
91524
91608
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
91525
|
-
const manifestDir =
|
|
91609
|
+
const manifestDir = join43(marketplaceRoot, ".agents", "plugins");
|
|
91526
91610
|
await mkdir7(manifestDir, { recursive: true });
|
|
91527
|
-
const tempPath =
|
|
91611
|
+
const tempPath = join43(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
91528
91612
|
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
91529
91613
|
`);
|
|
91530
|
-
await rename4(tempPath,
|
|
91614
|
+
await rename4(tempPath, join43(manifestDir, "marketplace.json"));
|
|
91531
91615
|
}
|
|
91532
91616
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
91533
|
-
const pluginsDir =
|
|
91617
|
+
const pluginsDir = join43(marketplaceRoot, "plugins");
|
|
91534
91618
|
await mkdir7(pluginsDir, { recursive: true });
|
|
91535
|
-
const targetPath =
|
|
91536
|
-
const tempPath =
|
|
91537
|
-
await
|
|
91619
|
+
const targetPath = join43(pluginsDir, plugin.name);
|
|
91620
|
+
const tempPath = join43(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
91621
|
+
await rm10(tempPath, { recursive: true, force: true });
|
|
91538
91622
|
await cp3(plugin.sourcePath, tempPath, {
|
|
91539
91623
|
recursive: true,
|
|
91540
91624
|
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
91541
91625
|
});
|
|
91542
91626
|
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
91543
|
-
await
|
|
91627
|
+
await rm10(targetPath, { recursive: true, force: true });
|
|
91544
91628
|
await rename4(tempPath, targetPath);
|
|
91545
91629
|
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
91546
91630
|
return { name: plugin.name, path: targetPath };
|
|
@@ -91554,11 +91638,11 @@ function shouldCopyMarketplaceSourcePath(path, root) {
|
|
|
91554
91638
|
}
|
|
91555
91639
|
|
|
91556
91640
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
91557
|
-
import { readdir as readdir8, readFile as
|
|
91558
|
-
import { join as
|
|
91641
|
+
import { readdir as readdir8, readFile as readFile17, writeFile as writeFile9 } from "fs/promises";
|
|
91642
|
+
import { join as join44 } from "path";
|
|
91559
91643
|
async function readDistributionManifest(repoRoot) {
|
|
91560
91644
|
try {
|
|
91561
|
-
const parsed = JSON.parse(await
|
|
91645
|
+
const parsed = JSON.parse(await readFile17(join44(repoRoot, "package.json"), "utf8"));
|
|
91562
91646
|
if (!isPlainRecord4(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
91563
91647
|
return;
|
|
91564
91648
|
return {
|
|
@@ -91582,19 +91666,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
91582
91666
|
return input.manifestVersion ?? "local";
|
|
91583
91667
|
}
|
|
91584
91668
|
async function stampLazyCodexPluginVersion(input) {
|
|
91585
|
-
const manifestPath =
|
|
91669
|
+
const manifestPath = join44(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
91586
91670
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
91587
91671
|
await stampJsonVersion(manifestPath, input.version);
|
|
91588
|
-
await stampJsonVersion(
|
|
91672
|
+
await stampJsonVersion(join44(input.pluginRoot, "package.json"), input.version);
|
|
91589
91673
|
for (const hookPath of hookPaths) {
|
|
91590
|
-
await stampHookStatusMessages(
|
|
91674
|
+
await stampHookStatusMessages(join44(input.pluginRoot, hookPath), input.version);
|
|
91591
91675
|
}
|
|
91592
91676
|
await stampComponentVersions(input);
|
|
91593
91677
|
}
|
|
91594
91678
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
91595
91679
|
if (input.distributionManifest === undefined)
|
|
91596
91680
|
return;
|
|
91597
|
-
await writeFile9(
|
|
91681
|
+
await writeFile9(join44(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
91598
91682
|
packageName: input.distributionManifest.name,
|
|
91599
91683
|
version: input.distributionManifest.version
|
|
91600
91684
|
}, null, "\t")}
|
|
@@ -91602,7 +91686,7 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
91602
91686
|
}
|
|
91603
91687
|
async function stampJsonVersion(path, version) {
|
|
91604
91688
|
try {
|
|
91605
|
-
const parsed = JSON.parse(await
|
|
91689
|
+
const parsed = JSON.parse(await readFile17(path, "utf8"));
|
|
91606
91690
|
if (!isPlainRecord4(parsed))
|
|
91607
91691
|
return;
|
|
91608
91692
|
parsed.version = version;
|
|
@@ -91616,7 +91700,7 @@ async function stampJsonVersion(path, version) {
|
|
|
91616
91700
|
}
|
|
91617
91701
|
async function readPluginHookPaths(manifestPath) {
|
|
91618
91702
|
try {
|
|
91619
|
-
const parsed = JSON.parse(await
|
|
91703
|
+
const parsed = JSON.parse(await readFile17(manifestPath, "utf8"));
|
|
91620
91704
|
if (!isPlainRecord4(parsed))
|
|
91621
91705
|
return [];
|
|
91622
91706
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
@@ -91636,7 +91720,7 @@ function stripDotSlash3(path) {
|
|
|
91636
91720
|
}
|
|
91637
91721
|
async function stampHookStatusMessages(path, version) {
|
|
91638
91722
|
try {
|
|
91639
|
-
const parsed = JSON.parse(await
|
|
91723
|
+
const parsed = JSON.parse(await readFile17(path, "utf8"));
|
|
91640
91724
|
if (!isPlainRecord4(parsed))
|
|
91641
91725
|
return;
|
|
91642
91726
|
stampHookGroups(parsed.hooks, version);
|
|
@@ -91651,16 +91735,16 @@ async function stampHookStatusMessages(path, version) {
|
|
|
91651
91735
|
async function stampComponentVersions(input) {
|
|
91652
91736
|
let entries;
|
|
91653
91737
|
try {
|
|
91654
|
-
entries = await readdir8(
|
|
91738
|
+
entries = await readdir8(join44(input.pluginRoot, "components"));
|
|
91655
91739
|
} catch (error) {
|
|
91656
91740
|
if (error instanceof Error)
|
|
91657
91741
|
return;
|
|
91658
91742
|
throw error;
|
|
91659
91743
|
}
|
|
91660
91744
|
for (const entry of entries) {
|
|
91661
|
-
const componentRoot =
|
|
91662
|
-
await stampJsonVersion(
|
|
91663
|
-
await stampHookStatusMessages(
|
|
91745
|
+
const componentRoot = join44(input.pluginRoot, "components", entry);
|
|
91746
|
+
await stampJsonVersion(join44(componentRoot, "package.json"), input.version);
|
|
91747
|
+
await stampHookStatusMessages(join44(componentRoot, "hooks", "hooks.json"), input.version);
|
|
91664
91748
|
}
|
|
91665
91749
|
}
|
|
91666
91750
|
function stampHookGroups(hooks, version) {
|
|
@@ -91717,8 +91801,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
91717
91801
|
};
|
|
91718
91802
|
|
|
91719
91803
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
91720
|
-
import { copyFile as copyFile2, lstat as
|
|
91721
|
-
import { dirname as dirname16, join as
|
|
91804
|
+
import { copyFile as copyFile2, lstat as lstat11, readFile as readFile18, writeFile as writeFile10 } from "fs/promises";
|
|
91805
|
+
import { dirname as dirname16, join as join45, resolve as resolve10 } from "path";
|
|
91722
91806
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
91723
91807
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
91724
91808
|
".codex/hooks.json",
|
|
@@ -91737,7 +91821,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
91737
91821
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
91738
91822
|
const configs = [];
|
|
91739
91823
|
for (const configPath of project.configPaths) {
|
|
91740
|
-
const original = await
|
|
91824
|
+
const original = await readFile18(configPath, "utf8");
|
|
91741
91825
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
91742
91826
|
if (!repair.changed) {
|
|
91743
91827
|
configs.push({
|
|
@@ -91821,17 +91905,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
91821
91905
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
91822
91906
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
91823
91907
|
}
|
|
91824
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
91908
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join45(resolve10(codexHome), "config.toml");
|
|
91825
91909
|
let current = resolve10(startDirectory);
|
|
91826
91910
|
const configPathsFromCwd = [];
|
|
91827
91911
|
while (true) {
|
|
91828
|
-
const configPath =
|
|
91912
|
+
const configPath = join45(current, ".codex", "config.toml");
|
|
91829
91913
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
91830
91914
|
if (codexHomeConfigPath === null || resolve10(configPath) !== codexHomeConfigPath) {
|
|
91831
91915
|
configPathsFromCwd.push(configPath);
|
|
91832
91916
|
}
|
|
91833
91917
|
}
|
|
91834
|
-
if (await exists5(
|
|
91918
|
+
if (await exists5(join45(current, ".git"))) {
|
|
91835
91919
|
return configPathsFromCwd.length === 0 ? null : {
|
|
91836
91920
|
projectRoot: current,
|
|
91837
91921
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
@@ -91851,7 +91935,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
91851
91935
|
}
|
|
91852
91936
|
}
|
|
91853
91937
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
91854
|
-
const codexDirStat = await maybeLstat(
|
|
91938
|
+
const codexDirStat = await maybeLstat(join45(directory, ".codex"));
|
|
91855
91939
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
91856
91940
|
return false;
|
|
91857
91941
|
const configStat = await maybeLstat(configPath);
|
|
@@ -91871,7 +91955,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
91871
91955
|
const seenPaths = new Set;
|
|
91872
91956
|
for (const projectRoot of projectRoots) {
|
|
91873
91957
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
91874
|
-
const artifactPath =
|
|
91958
|
+
const artifactPath = join45(projectRoot, relativePath);
|
|
91875
91959
|
if (seenPaths.has(artifactPath))
|
|
91876
91960
|
continue;
|
|
91877
91961
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -91905,7 +91989,7 @@ function formatBackupTimestamp(date) {
|
|
|
91905
91989
|
}
|
|
91906
91990
|
async function maybeLstat(path) {
|
|
91907
91991
|
try {
|
|
91908
|
-
return await
|
|
91992
|
+
return await lstat11(path);
|
|
91909
91993
|
} catch (error) {
|
|
91910
91994
|
if (nodeErrorCode4(error) === "ENOENT")
|
|
91911
91995
|
return null;
|
|
@@ -91946,14 +92030,14 @@ function formatUnknownError(error) {
|
|
|
91946
92030
|
}
|
|
91947
92031
|
|
|
91948
92032
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
91949
|
-
import { createHash as
|
|
91950
|
-
import { lstat as
|
|
92033
|
+
import { createHash as createHash4 } from "crypto";
|
|
92034
|
+
import { lstat as lstat12, readFile as readFile20, readdir as readdir10, rm as rm11 } from "fs/promises";
|
|
91951
92035
|
import { tmpdir as tmpdir3 } from "os";
|
|
91952
|
-
import { join as
|
|
92036
|
+
import { join as join46, posix as posix6 } from "path";
|
|
91953
92037
|
|
|
91954
92038
|
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
|
|
91955
92039
|
import { execFile } from "child_process";
|
|
91956
|
-
import { readFile as
|
|
92040
|
+
import { readFile as readFile19, readdir as readdir9, readlink as readlink5 } from "fs/promises";
|
|
91957
92041
|
import { connect } from "net";
|
|
91958
92042
|
import { basename as basename7 } from "path";
|
|
91959
92043
|
var PROBE_TIMEOUT_MS = 500;
|
|
@@ -91995,7 +92079,7 @@ async function attestLegacyDaemonOwnership(input, deps = {}) {
|
|
|
91995
92079
|
return false;
|
|
91996
92080
|
}
|
|
91997
92081
|
async function attestLinuxOwnership(input, deps) {
|
|
91998
|
-
const readFileImpl = deps.readFile ??
|
|
92082
|
+
const readFileImpl = deps.readFile ?? readFile19;
|
|
91999
92083
|
const readDirImpl = deps.readDir ?? readdir9;
|
|
92000
92084
|
const readLinkImpl = deps.readLink ?? readlink5;
|
|
92001
92085
|
const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
|
|
@@ -92122,7 +92206,7 @@ async function readBinary(readFileImpl, path) {
|
|
|
92122
92206
|
var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
|
|
92123
92207
|
var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
92124
92208
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
92125
|
-
const daemonRoot =
|
|
92209
|
+
const daemonRoot = join46(codexHome, "codex-lsp", "daemon");
|
|
92126
92210
|
const platform = deps.platform ?? process.platform;
|
|
92127
92211
|
const tmpDir = deps.tmpDir ?? tmpdir3();
|
|
92128
92212
|
const probe = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
|
|
@@ -92132,7 +92216,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
92132
92216
|
const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
|
|
92133
92217
|
const results = [];
|
|
92134
92218
|
for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
|
|
92135
|
-
const versionPath =
|
|
92219
|
+
const versionPath = join46(daemonRoot, entry.name);
|
|
92136
92220
|
const parsedVersion = parseVersionEntry(entry.name);
|
|
92137
92221
|
if (parsedVersion === null || !entry.isDirectory()) {
|
|
92138
92222
|
await removeVersionDir(versionPath);
|
|
@@ -92180,7 +92264,7 @@ function parseVersionEntry(entryName) {
|
|
|
92180
92264
|
return LEGACY_VERSION_PATTERN.test(version) ? version : null;
|
|
92181
92265
|
}
|
|
92182
92266
|
async function readLegacyMetadata(input) {
|
|
92183
|
-
const pidText = await readRegularTrimmedFile(
|
|
92267
|
+
const pidText = await readRegularTrimmedFile(join46(input.versionPath, "daemon.pid"));
|
|
92184
92268
|
if (pidText === "non_regular")
|
|
92185
92269
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
92186
92270
|
if (pidText === null)
|
|
@@ -92188,7 +92272,7 @@ async function readLegacyMetadata(input) {
|
|
|
92188
92272
|
const pid = Number.parseInt(pidText, 10);
|
|
92189
92273
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
92190
92274
|
return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
|
|
92191
|
-
const endpointText = await readRegularTrimmedFile(
|
|
92275
|
+
const endpointText = await readRegularTrimmedFile(join46(input.versionPath, "daemon.endpoint"));
|
|
92192
92276
|
if (endpointText === "non_regular")
|
|
92193
92277
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
92194
92278
|
if (endpointText === null)
|
|
@@ -92215,19 +92299,19 @@ function legacyEndpointCandidates(input) {
|
|
|
92215
92299
|
return [natural, hashed];
|
|
92216
92300
|
}
|
|
92217
92301
|
async function readRegularTrimmedFile(path) {
|
|
92218
|
-
const stats = await
|
|
92302
|
+
const stats = await lstat12(path).catch(() => null);
|
|
92219
92303
|
if (stats === null)
|
|
92220
92304
|
return null;
|
|
92221
92305
|
if (!stats.isFile())
|
|
92222
92306
|
return "non_regular";
|
|
92223
|
-
const content = (await
|
|
92307
|
+
const content = (await readFile20(path, "utf8")).trim();
|
|
92224
92308
|
return content.length > 0 ? content : null;
|
|
92225
92309
|
}
|
|
92226
92310
|
function shortDigest(value) {
|
|
92227
|
-
return
|
|
92311
|
+
return createHash4("sha256").update(value).digest("hex").slice(0, 16);
|
|
92228
92312
|
}
|
|
92229
92313
|
async function removeVersionDir(path) {
|
|
92230
|
-
await
|
|
92314
|
+
await rm11(path, { recursive: true, force: true });
|
|
92231
92315
|
}
|
|
92232
92316
|
function removed(version, reason) {
|
|
92233
92317
|
return { version, status: "removed", reason };
|
|
@@ -92267,7 +92351,7 @@ function processIsRunning(pid) {
|
|
|
92267
92351
|
|
|
92268
92352
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
92269
92353
|
import { homedir as homedir5 } from "os";
|
|
92270
|
-
import { join as
|
|
92354
|
+
import { join as join47, resolve as resolve11 } from "path";
|
|
92271
92355
|
function resolveCodexInstallerBinDir(input) {
|
|
92272
92356
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
92273
92357
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -92276,16 +92360,16 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
92276
92360
|
const defaultCodexHome = resolve11(homeDir, ".codex");
|
|
92277
92361
|
const resolvedCodexHome = resolve11(input.codexHome);
|
|
92278
92362
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
92279
|
-
return
|
|
92363
|
+
return join47(resolvedCodexHome, "bin");
|
|
92280
92364
|
return resolve11(homeDir, ".local", "bin");
|
|
92281
92365
|
}
|
|
92282
92366
|
|
|
92283
92367
|
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
|
|
92284
|
-
import { readFile as
|
|
92285
|
-
import { join as
|
|
92368
|
+
import { readFile as readFile21, readdir as readdir11, writeFile as writeFile11 } from "fs/promises";
|
|
92369
|
+
import { join as join48 } from "path";
|
|
92286
92370
|
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
|
|
92287
92371
|
async function writeInstalledCodexBinDir(input) {
|
|
92288
|
-
await writeFile11(
|
|
92372
|
+
await writeFile11(join48(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
|
|
92289
92373
|
`);
|
|
92290
92374
|
}
|
|
92291
92375
|
async function readInstalledCodexBinDir(codexHome) {
|
|
@@ -92298,20 +92382,20 @@ async function readInstalledCodexBinDir(codexHome) {
|
|
|
92298
92382
|
}
|
|
92299
92383
|
async function installedBinDirManifestPaths(codexHome) {
|
|
92300
92384
|
const paths = [
|
|
92301
|
-
|
|
92385
|
+
join48(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_BIN_DIR_MANIFEST)
|
|
92302
92386
|
];
|
|
92303
|
-
const versionRoot =
|
|
92387
|
+
const versionRoot = join48(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
92304
92388
|
const entries = await readdir11(versionRoot, { withFileTypes: true }).catch(() => null);
|
|
92305
92389
|
if (entries !== null) {
|
|
92306
92390
|
for (const entry of entries) {
|
|
92307
92391
|
if (entry.isDirectory())
|
|
92308
|
-
paths.push(
|
|
92392
|
+
paths.push(join48(versionRoot, entry.name, INSTALLED_BIN_DIR_MANIFEST));
|
|
92309
92393
|
}
|
|
92310
92394
|
}
|
|
92311
92395
|
return paths;
|
|
92312
92396
|
}
|
|
92313
92397
|
async function readBinDirFromManifest(manifestPath) {
|
|
92314
|
-
const raw = await
|
|
92398
|
+
const raw = await readFile21(manifestPath, "utf8").catch(() => null);
|
|
92315
92399
|
if (raw === null)
|
|
92316
92400
|
return null;
|
|
92317
92401
|
let parsed;
|
|
@@ -92329,8 +92413,8 @@ async function readBinDirFromManifest(manifestPath) {
|
|
|
92329
92413
|
}
|
|
92330
92414
|
|
|
92331
92415
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
92332
|
-
import { readFile as
|
|
92333
|
-
import { join as
|
|
92416
|
+
import { readFile as readFile22, writeFile as writeFile12 } from "fs/promises";
|
|
92417
|
+
import { join as join49 } from "path";
|
|
92334
92418
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
92335
92419
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
92336
92420
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -92338,8 +92422,8 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
92338
92422
|
async function removeGitBashHooksOffWindows(input) {
|
|
92339
92423
|
if (input.platform === "win32")
|
|
92340
92424
|
return;
|
|
92341
|
-
const manifestPath =
|
|
92342
|
-
const parsed = JSON.parse(await
|
|
92425
|
+
const manifestPath = join49(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
92426
|
+
const parsed = JSON.parse(await readFile22(manifestPath, "utf8"));
|
|
92343
92427
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.hooks))
|
|
92344
92428
|
return;
|
|
92345
92429
|
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
|
|
@@ -92351,7 +92435,7 @@ async function removeGitBashHooksOffWindows(input) {
|
|
|
92351
92435
|
|
|
92352
92436
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
92353
92437
|
init_src();
|
|
92354
|
-
import { join as
|
|
92438
|
+
import { join as join50 } from "path";
|
|
92355
92439
|
function describeResult(result) {
|
|
92356
92440
|
if (result.kind === "succeeded")
|
|
92357
92441
|
return null;
|
|
@@ -92365,7 +92449,7 @@ async function installAstGrepForCodex(options) {
|
|
|
92365
92449
|
return;
|
|
92366
92450
|
const platform = options.platform ?? process.platform;
|
|
92367
92451
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
92368
|
-
const skillDir =
|
|
92452
|
+
const skillDir = join50(plugin.path, "skills", "ast-grep");
|
|
92369
92453
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
92370
92454
|
try {
|
|
92371
92455
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -92398,7 +92482,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
92398
92482
|
const env = options.env ?? process.env;
|
|
92399
92483
|
const platform = options.platform ?? process.platform;
|
|
92400
92484
|
const repoRoot = resolve12(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env }));
|
|
92401
|
-
const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ??
|
|
92485
|
+
const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ?? join53(homedir6(), ".codex"));
|
|
92402
92486
|
const projectDirectory = resolve12(options.projectDirectory ?? env.OMO_CODEX_PROJECT ?? process.cwd());
|
|
92403
92487
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env });
|
|
92404
92488
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -92415,9 +92499,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
92415
92499
|
if (!gitBashResolution.found) {
|
|
92416
92500
|
throw new Error(gitBashResolution.installHint);
|
|
92417
92501
|
}
|
|
92418
|
-
const codexPackageRoot =
|
|
92502
|
+
const codexPackageRoot = join53(repoRoot, "packages", "omo-codex");
|
|
92419
92503
|
const marketplace = await readMarketplace(repoRoot, {
|
|
92420
|
-
marketplacePath:
|
|
92504
|
+
marketplacePath: join53(codexPackageRoot, "marketplace.json")
|
|
92421
92505
|
});
|
|
92422
92506
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
92423
92507
|
const installed = [];
|
|
@@ -92463,7 +92547,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
92463
92547
|
if (runtimeLink !== null)
|
|
92464
92548
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
92465
92549
|
else
|
|
92466
|
-
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${
|
|
92550
|
+
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`);
|
|
92467
92551
|
}
|
|
92468
92552
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
92469
92553
|
installed.push(plugin);
|
|
@@ -92483,6 +92567,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
92483
92567
|
installed,
|
|
92484
92568
|
pluginSources
|
|
92485
92569
|
});
|
|
92570
|
+
const omoConfig = readDefaultRoleConfig({ cwd: projectDirectory, env });
|
|
92571
|
+
for (const warning of omoConfig.warnings)
|
|
92572
|
+
log(`Warning: ${warning}`);
|
|
92486
92573
|
for (const plugin of installed) {
|
|
92487
92574
|
const pluginRoot = agentSourceRoots.get(plugin.name) ?? plugin.path;
|
|
92488
92575
|
const agentLinks = await linkCachedPluginAgents({
|
|
@@ -92490,7 +92577,8 @@ async function runCodexInstaller(options = {}) {
|
|
|
92490
92577
|
pluginRoot,
|
|
92491
92578
|
platform,
|
|
92492
92579
|
preservedReasoning,
|
|
92493
|
-
preservedServiceTier
|
|
92580
|
+
preservedServiceTier,
|
|
92581
|
+
defaultRoleEnabled: omoConfig.enabled
|
|
92494
92582
|
});
|
|
92495
92583
|
for (const link of agentLinks) {
|
|
92496
92584
|
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
@@ -92526,13 +92614,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
92526
92614
|
continue;
|
|
92527
92615
|
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
|
|
92528
92616
|
}
|
|
92529
|
-
const marketplaceRoot =
|
|
92617
|
+
const marketplaceRoot = join53(codexHome, "plugins", "cache", marketplace.name);
|
|
92530
92618
|
await writeCachedMarketplaceManifest({
|
|
92531
92619
|
marketplaceName: marketplace.name,
|
|
92532
92620
|
marketplaceRoot,
|
|
92533
92621
|
plugins: installed
|
|
92534
92622
|
});
|
|
92535
|
-
const configPath =
|
|
92623
|
+
const configPath = join53(codexHome, "config.toml");
|
|
92536
92624
|
await updateCodexConfig({
|
|
92537
92625
|
configPath,
|
|
92538
92626
|
repoRoot: codexPackageRoot,
|
|
@@ -92591,7 +92679,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
92591
92679
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
92592
92680
|
if (isRepoRootWithCodexPlugin(current))
|
|
92593
92681
|
return current;
|
|
92594
|
-
for (const wrapperPackageRoot of [
|
|
92682
|
+
for (const wrapperPackageRoot of [join53(current, "node_modules", "oh-my-openagent"), join53(current, "oh-my-openagent")]) {
|
|
92595
92683
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
92596
92684
|
return wrapperPackageRoot;
|
|
92597
92685
|
}
|
|
@@ -92609,7 +92697,7 @@ function findRepoRoot(input) {
|
|
|
92609
92697
|
return findRepoRootFromImporter(input.importerDir);
|
|
92610
92698
|
}
|
|
92611
92699
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
92612
|
-
return existsSync26(
|
|
92700
|
+
return existsSync26(join53(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
92613
92701
|
}
|
|
92614
92702
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
92615
92703
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -92744,13 +92832,13 @@ function defaultRunCommand2(command, args) {
|
|
|
92744
92832
|
});
|
|
92745
92833
|
}
|
|
92746
92834
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
92747
|
-
import { lstat as
|
|
92835
|
+
import { lstat as lstat15, readFile as readFile25, readdir as readdir13, rm as rm13, rmdir } from "fs/promises";
|
|
92748
92836
|
import { homedir as homedir8 } from "os";
|
|
92749
|
-
import { isAbsolute as isAbsolute11, join as
|
|
92837
|
+
import { isAbsolute as isAbsolute11, join as join56, relative as relative6, resolve as resolve15 } from "path";
|
|
92750
92838
|
|
|
92751
92839
|
// packages/omo-codex/src/install/codex-cleanup-bins.ts
|
|
92752
|
-
import { lstat as
|
|
92753
|
-
import { dirname as dirname18, isAbsolute as isAbsolute9, join as
|
|
92840
|
+
import { lstat as lstat13, readFile as readFile23, readdir as readdir12, readlink as readlink6, rm as rm12 } from "fs/promises";
|
|
92841
|
+
import { dirname as dirname18, isAbsolute as isAbsolute9, join as join54, resolve as resolve13 } from "path";
|
|
92754
92842
|
var ROOT_RUNTIME_BIN_NAME = "omo";
|
|
92755
92843
|
var MANAGED_CODEX_BIN_NAMES = new Set([
|
|
92756
92844
|
ROOT_RUNTIME_BIN_NAME,
|
|
@@ -92780,9 +92868,9 @@ async function removeManagedCodexBins(binDir, platform) {
|
|
|
92780
92868
|
const binName = managedBinNameForEntry2(entry.name, platform);
|
|
92781
92869
|
if (binName === null || !MANAGED_CODEX_BIN_NAMES.has(binName))
|
|
92782
92870
|
continue;
|
|
92783
|
-
const linkPath =
|
|
92871
|
+
const linkPath = join54(binDir, entry.name);
|
|
92784
92872
|
if (await isManagedCodexBin(linkPath, platform, binName)) {
|
|
92785
|
-
await
|
|
92873
|
+
await rm12(linkPath, { force: true });
|
|
92786
92874
|
removed.push(linkPath);
|
|
92787
92875
|
}
|
|
92788
92876
|
}
|
|
@@ -92795,7 +92883,7 @@ function managedBinNameForEntry2(entryName, platform) {
|
|
|
92795
92883
|
return normalizedEntryName.endsWith(".cmd") ? normalizedEntryName.slice(0, -".cmd".length) : null;
|
|
92796
92884
|
}
|
|
92797
92885
|
async function isManagedCodexBin(linkPath, platform, binName) {
|
|
92798
|
-
const entryStat = await
|
|
92886
|
+
const entryStat = await lstat13(linkPath).catch((error) => {
|
|
92799
92887
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
92800
92888
|
return null;
|
|
92801
92889
|
throw error;
|
|
@@ -92811,12 +92899,12 @@ async function isManagedCodexBin(linkPath, platform, binName) {
|
|
|
92811
92899
|
}
|
|
92812
92900
|
if (!entryStat.isFile())
|
|
92813
92901
|
return false;
|
|
92814
|
-
const content = await
|
|
92902
|
+
const content = await readFile23(linkPath, "utf8");
|
|
92815
92903
|
return content.includes(RUNTIME_WRAPPER_MARKER) || content.includes(COMMAND_SHIM_MARKER);
|
|
92816
92904
|
}
|
|
92817
92905
|
|
|
92818
92906
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
92819
|
-
import { lstat as
|
|
92907
|
+
import { lstat as lstat14, mkdir as mkdir8, readFile as readFile24, writeFile as writeFile13 } from "fs/promises";
|
|
92820
92908
|
import { dirname as dirname19 } from "path";
|
|
92821
92909
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
92822
92910
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
@@ -92849,7 +92937,7 @@ function cleanupCodexLightConfigText(config) {
|
|
|
92849
92937
|
async function cleanupCodexConfig(configPath, now) {
|
|
92850
92938
|
if (!await configExists(configPath))
|
|
92851
92939
|
return { changed: false };
|
|
92852
|
-
const original = await
|
|
92940
|
+
const original = await readFile24(configPath, "utf8");
|
|
92853
92941
|
const next = cleanupCodexLightConfigText(original);
|
|
92854
92942
|
if (next === original)
|
|
92855
92943
|
return { changed: false };
|
|
@@ -92918,7 +93006,7 @@ function formatBackupTimestamp2(date) {
|
|
|
92918
93006
|
}
|
|
92919
93007
|
async function configExists(path) {
|
|
92920
93008
|
try {
|
|
92921
|
-
await
|
|
93009
|
+
await lstat14(path);
|
|
92922
93010
|
return true;
|
|
92923
93011
|
} catch (error) {
|
|
92924
93012
|
if (nodeErrorCode5(error) === "ENOENT")
|
|
@@ -92933,7 +93021,7 @@ function nodeErrorCode5(error) {
|
|
|
92933
93021
|
}
|
|
92934
93022
|
|
|
92935
93023
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
92936
|
-
import { dirname as dirname20, isAbsolute as isAbsolute10, join as
|
|
93024
|
+
import { dirname as dirname20, isAbsolute as isAbsolute10, join as join55, relative as relative5, resolve as resolve14 } from "path";
|
|
92937
93025
|
function codexHomeResolvesToFilesystemRoot(codexHome) {
|
|
92938
93026
|
const resolved = resolve14(codexHome);
|
|
92939
93027
|
return dirname20(resolved) === resolved;
|
|
@@ -92950,11 +93038,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
92950
93038
|
if (target === codexHome)
|
|
92951
93039
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
92952
93040
|
const exactManagedRoots = new Set([
|
|
92953
|
-
resolve14(
|
|
92954
|
-
resolve14(
|
|
92955
|
-
resolve14(
|
|
92956
|
-
resolve14(
|
|
92957
|
-
resolve14(
|
|
93041
|
+
resolve14(join55(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
93042
|
+
resolve14(join55(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
93043
|
+
resolve14(join55(codexHome, "runtime", "ast-grep")),
|
|
93044
|
+
resolve14(join55(codexHome, "runtime", "node")),
|
|
93045
|
+
resolve14(join55(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
92958
93046
|
]);
|
|
92959
93047
|
if (exactManagedRoots.has(target))
|
|
92960
93048
|
return null;
|
|
@@ -92984,8 +93072,8 @@ function skipped(path, reason) {
|
|
|
92984
93072
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
92985
93073
|
async function cleanupCodexLight(input = {}) {
|
|
92986
93074
|
const env = input.env ?? process.env;
|
|
92987
|
-
const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ??
|
|
92988
|
-
const configPath =
|
|
93075
|
+
const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ?? join56(homedir8(), ".codex"));
|
|
93076
|
+
const configPath = join56(codexHome, "config.toml");
|
|
92989
93077
|
const installedBinDir = await readInstalledCodexBinDir(codexHome);
|
|
92990
93078
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
92991
93079
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
@@ -93039,17 +93127,17 @@ function firstConfiguredPath(...values) {
|
|
|
93039
93127
|
}
|
|
93040
93128
|
function managedGlobalStatePaths(codexHome) {
|
|
93041
93129
|
return [
|
|
93042
|
-
|
|
93043
|
-
|
|
93044
|
-
|
|
93045
|
-
|
|
93046
|
-
|
|
93130
|
+
join56(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
93131
|
+
join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
93132
|
+
join56(codexHome, "runtime", "ast-grep"),
|
|
93133
|
+
join56(codexHome, "runtime", "node"),
|
|
93134
|
+
join56(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
93047
93135
|
];
|
|
93048
93136
|
}
|
|
93049
93137
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
93050
93138
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
93051
93139
|
const results = [];
|
|
93052
|
-
await walkForManagedBootstrapDirs(
|
|
93140
|
+
await walkForManagedBootstrapDirs(join56(codexHome, "plugins"), 0, results);
|
|
93053
93141
|
return results;
|
|
93054
93142
|
}
|
|
93055
93143
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -93061,9 +93149,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
93061
93149
|
for (const entry of entries) {
|
|
93062
93150
|
if (!entry.isDirectory())
|
|
93063
93151
|
continue;
|
|
93064
|
-
const childPath =
|
|
93152
|
+
const childPath = join56(directory, entry.name);
|
|
93065
93153
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
93066
|
-
const bootstrapDir =
|
|
93154
|
+
const bootstrapDir = join56(childPath, "bootstrap");
|
|
93067
93155
|
if (await exists6(bootstrapDir))
|
|
93068
93156
|
results.push(bootstrapDir);
|
|
93069
93157
|
continue;
|
|
@@ -93087,9 +93175,9 @@ async function removeManagedPathBestEffort(path, seams) {
|
|
|
93087
93175
|
}
|
|
93088
93176
|
async function attemptRemove(path) {
|
|
93089
93177
|
try {
|
|
93090
|
-
if (await
|
|
93178
|
+
if (await lstat15(path).catch(() => null) === null)
|
|
93091
93179
|
return false;
|
|
93092
|
-
await
|
|
93180
|
+
await rm13(path, { recursive: true, force: true });
|
|
93093
93181
|
return true;
|
|
93094
93182
|
} catch {
|
|
93095
93183
|
return false;
|
|
@@ -93097,7 +93185,7 @@ async function attemptRemove(path) {
|
|
|
93097
93185
|
}
|
|
93098
93186
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
93099
93187
|
try {
|
|
93100
|
-
await rmdir(
|
|
93188
|
+
await rmdir(join56(codexHome, "runtime"));
|
|
93101
93189
|
} catch (error) {
|
|
93102
93190
|
if (isExpectedRuntimePruneFailure(error))
|
|
93103
93191
|
return;
|
|
@@ -93109,14 +93197,14 @@ function isExpectedRuntimePruneFailure(error) {
|
|
|
93109
93197
|
}
|
|
93110
93198
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
93111
93199
|
const manifestPaths = [
|
|
93112
|
-
|
|
93200
|
+
join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
93113
93201
|
];
|
|
93114
|
-
const versionRoot =
|
|
93202
|
+
const versionRoot = join56(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
93115
93203
|
if (await exists6(versionRoot)) {
|
|
93116
93204
|
const entries = await readdir13(versionRoot, { withFileTypes: true });
|
|
93117
93205
|
for (const entry of entries) {
|
|
93118
93206
|
if (entry.isDirectory())
|
|
93119
|
-
manifestPaths.push(
|
|
93207
|
+
manifestPaths.push(join56(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
93120
93208
|
}
|
|
93121
93209
|
}
|
|
93122
93210
|
const paths = new Set;
|
|
@@ -93133,19 +93221,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
93133
93221
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
93134
93222
|
if (!await exists6(configPath))
|
|
93135
93223
|
return [];
|
|
93136
|
-
const config = await
|
|
93137
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
93224
|
+
const config = await readFile25(configPath, "utf8");
|
|
93225
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join56(codexHome, "agents", `${agentName}.toml`));
|
|
93138
93226
|
}
|
|
93139
93227
|
async function readInstalledAgentManifest(manifestPath) {
|
|
93140
93228
|
if (!await exists6(manifestPath))
|
|
93141
93229
|
return [];
|
|
93142
|
-
const parsed = JSON.parse(await
|
|
93230
|
+
const parsed = JSON.parse(await readFile25(manifestPath, "utf8"));
|
|
93143
93231
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.agents))
|
|
93144
93232
|
return [];
|
|
93145
93233
|
return parsed.agents.filter((path) => typeof path === "string");
|
|
93146
93234
|
}
|
|
93147
93235
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
93148
|
-
const agentsDir =
|
|
93236
|
+
const agentsDir = join56(codexHome, "agents");
|
|
93149
93237
|
const removed = [];
|
|
93150
93238
|
const skipped = [];
|
|
93151
93239
|
for (const path of paths) {
|
|
@@ -93160,7 +93248,7 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
93160
93248
|
skipped.push(path);
|
|
93161
93249
|
continue;
|
|
93162
93250
|
}
|
|
93163
|
-
await
|
|
93251
|
+
await rm13(path, { force: true });
|
|
93164
93252
|
removed.push(path);
|
|
93165
93253
|
}
|
|
93166
93254
|
return { removed, skipped };
|
|
@@ -93181,7 +93269,7 @@ async function exists6(path) {
|
|
|
93181
93269
|
}
|
|
93182
93270
|
async function maybeLstat2(path) {
|
|
93183
93271
|
try {
|
|
93184
|
-
return await
|
|
93272
|
+
return await lstat15(path);
|
|
93185
93273
|
} catch (error) {
|
|
93186
93274
|
if (nodeErrorCode6(error) === "ENOENT")
|
|
93187
93275
|
return null;
|
|
@@ -93197,14 +93285,14 @@ function nodeErrorCode6(error) {
|
|
|
93197
93285
|
import { execFile as execFile3 } from "child_process";
|
|
93198
93286
|
import { existsSync as existsSync30 } from "fs";
|
|
93199
93287
|
import { homedir as homedir11 } from "os";
|
|
93200
|
-
import { dirname as dirname24, join as
|
|
93288
|
+
import { dirname as dirname24, join as join61, resolve as resolve19 } from "path";
|
|
93201
93289
|
import { fileURLToPath } from "url";
|
|
93202
93290
|
import { promisify as promisify2 } from "util";
|
|
93203
93291
|
|
|
93204
93292
|
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
93205
93293
|
import { existsSync as existsSync28 } from "fs";
|
|
93206
93294
|
import { homedir as homedir9 } from "os";
|
|
93207
|
-
import { join as
|
|
93295
|
+
import { join as join57, resolve as resolve16 } from "path";
|
|
93208
93296
|
var AGENT_DIR_ENV_NAMES = [
|
|
93209
93297
|
"OMO_CODING_AGENT_DIR",
|
|
93210
93298
|
"SENPI_CODING_AGENT_DIR",
|
|
@@ -93218,25 +93306,25 @@ function resolveAgentHome(options) {
|
|
|
93218
93306
|
if (configured)
|
|
93219
93307
|
return resolve16(configured);
|
|
93220
93308
|
}
|
|
93221
|
-
const brandedHome =
|
|
93222
|
-
const canonical =
|
|
93223
|
-
if (exists(
|
|
93309
|
+
const brandedHome = join57(homeDir, ".omo");
|
|
93310
|
+
const canonical = join57(brandedHome, "agent");
|
|
93311
|
+
if (exists(join57(canonical, AGENT_HOME_SENTINEL)))
|
|
93224
93312
|
return canonical;
|
|
93225
|
-
if (exists(
|
|
93313
|
+
if (exists(join57(brandedHome, AGENT_HOME_SENTINEL)))
|
|
93226
93314
|
return brandedHome;
|
|
93227
|
-
return
|
|
93315
|
+
return join57(homeDir, ".senpi", "agent");
|
|
93228
93316
|
}
|
|
93229
93317
|
|
|
93230
93318
|
// packages/omo-senpi/src/install/local-launcher.ts
|
|
93231
93319
|
import { chmodSync as chmodSync3, existsSync as existsSync29, mkdirSync as mkdirSync10, readFileSync as readFileSync13, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
93232
93320
|
import { homedir as homedir10 } from "os";
|
|
93233
|
-
import { dirname as dirname21, join as
|
|
93321
|
+
import { dirname as dirname21, join as join58, resolve as resolve17 } from "path";
|
|
93234
93322
|
var MARKER = "omo-local-launcher";
|
|
93235
93323
|
function localLauncherPath(homeDir = homedir10()) {
|
|
93236
|
-
return
|
|
93324
|
+
return join58(homeDir, ".local", "bin", "omo");
|
|
93237
93325
|
}
|
|
93238
93326
|
function localLauncherCmdPath(homeDir = homedir10()) {
|
|
93239
|
-
return
|
|
93327
|
+
return join58(homeDir, ".local", "bin", "omo.cmd");
|
|
93240
93328
|
}
|
|
93241
93329
|
function renderLocalLauncher(options) {
|
|
93242
93330
|
const brand = {
|
|
@@ -93249,7 +93337,7 @@ function renderLocalLauncher(options) {
|
|
|
93249
93337
|
userAgent: "omo",
|
|
93250
93338
|
originator: "omo",
|
|
93251
93339
|
changelog: {
|
|
93252
|
-
path:
|
|
93340
|
+
path: join58(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
|
|
93253
93341
|
},
|
|
93254
93342
|
update: {
|
|
93255
93343
|
packageName: "omo-ai",
|
|
@@ -93316,10 +93404,10 @@ node "%~dp0omo" %*\r
|
|
|
93316
93404
|
}
|
|
93317
93405
|
|
|
93318
93406
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
93319
|
-
import { createHash as
|
|
93407
|
+
import { createHash as createHash6 } from "crypto";
|
|
93320
93408
|
import { constants as constants9 } from "fs";
|
|
93321
|
-
import { access as access2, readFile as
|
|
93322
|
-
import { dirname as dirname23, join as
|
|
93409
|
+
import { access as access2, readFile as readFile27, stat as stat6 } from "fs/promises";
|
|
93410
|
+
import { dirname as dirname23, join as join60 } from "path";
|
|
93323
93411
|
|
|
93324
93412
|
// packages/memory-core/src/personas/manifest.ts
|
|
93325
93413
|
var PERSONA_ASSET_FILENAMES = {
|
|
@@ -93337,18 +93425,18 @@ var PERSONA_ASSET_FILES = [
|
|
|
93337
93425
|
|
|
93338
93426
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
93339
93427
|
import { constants as constants8 } from "fs";
|
|
93340
|
-
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as
|
|
93341
|
-
import { basename as basename9, dirname as dirname22, join as
|
|
93428
|
+
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile26, rename as rename5, writeFile as writeFile14 } from "fs/promises";
|
|
93429
|
+
import { basename as basename9, dirname as dirname22, join as join59, resolve as resolve18 } from "path";
|
|
93342
93430
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
93343
93431
|
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
|
|
93344
93432
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
93345
|
-
|
|
93346
|
-
|
|
93433
|
+
join59("packages", "pi-goal"),
|
|
93434
|
+
join59("packages", "pi-webfetch")
|
|
93347
93435
|
];
|
|
93348
93436
|
async function readSettings(settingsPath) {
|
|
93349
93437
|
let raw;
|
|
93350
93438
|
try {
|
|
93351
|
-
raw = await
|
|
93439
|
+
raw = await readFile26(settingsPath, "utf8");
|
|
93352
93440
|
} catch (error) {
|
|
93353
93441
|
if (isErrno(error, "ENOENT"))
|
|
93354
93442
|
return {};
|
|
@@ -93422,7 +93510,7 @@ function isRecord13(value) {
|
|
|
93422
93510
|
async function readPackageName(packagePath) {
|
|
93423
93511
|
let raw;
|
|
93424
93512
|
try {
|
|
93425
|
-
raw = await
|
|
93513
|
+
raw = await readFile26(join59(packagePath, "package.json"), "utf8");
|
|
93426
93514
|
} catch (error) {
|
|
93427
93515
|
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
|
|
93428
93516
|
return;
|
|
@@ -93454,50 +93542,50 @@ function isErrno(error, code) {
|
|
|
93454
93542
|
|
|
93455
93543
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
93456
93544
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
93457
|
-
|
|
93458
|
-
|
|
93459
|
-
|
|
93460
|
-
|
|
93461
|
-
|
|
93462
|
-
...PERSONA_ASSET_FILES.map((filename) =>
|
|
93463
|
-
|
|
93464
|
-
|
|
93465
|
-
|
|
93466
|
-
|
|
93467
|
-
|
|
93468
|
-
|
|
93469
|
-
|
|
93470
|
-
|
|
93471
|
-
|
|
93472
|
-
|
|
93473
|
-
|
|
93474
|
-
|
|
93475
|
-
|
|
93476
|
-
|
|
93477
|
-
|
|
93478
|
-
|
|
93479
|
-
|
|
93480
|
-
|
|
93481
|
-
|
|
93482
|
-
|
|
93483
|
-
|
|
93484
|
-
|
|
93485
|
-
|
|
93486
|
-
|
|
93487
|
-
|
|
93488
|
-
|
|
93489
|
-
|
|
93490
|
-
|
|
93545
|
+
join60("extensions", "omo.js"),
|
|
93546
|
+
join60("extensions", "omo-task.js"),
|
|
93547
|
+
join60("extensions", "omo-member.js"),
|
|
93548
|
+
join60("extensions", "omo-agent-toolkit.js"),
|
|
93549
|
+
join60("extensions", "memory-run-supervisor.mjs"),
|
|
93550
|
+
...PERSONA_ASSET_FILES.map((filename) => join60("extensions", filename)),
|
|
93551
|
+
join60("skills", "ast-grep", "SKILL.md"),
|
|
93552
|
+
join60("skills", "coding-agent-sessions", "SKILL.md"),
|
|
93553
|
+
join60("skills", "debugging", "SKILL.md"),
|
|
93554
|
+
join60("skills", "frontend", "SKILL.md"),
|
|
93555
|
+
join60("skills", "git-master", "SKILL.md"),
|
|
93556
|
+
join60("skills", "init-deep", "SKILL.md"),
|
|
93557
|
+
join60("skills", "lsp-setup", "SKILL.md"),
|
|
93558
|
+
join60("skills", "programming", "SKILL.md"),
|
|
93559
|
+
join60("skills", "refactor", "SKILL.md"),
|
|
93560
|
+
join60("skills", "remove-ai-slops", "SKILL.md"),
|
|
93561
|
+
join60("skills", "review-work", "SKILL.md"),
|
|
93562
|
+
join60("skills", "ultimate-browsing", "SKILL.md"),
|
|
93563
|
+
join60("skills", "ultrawork", "SKILL.md"),
|
|
93564
|
+
join60("skills", "ulw-execute", "SKILL.md"),
|
|
93565
|
+
join60("skills", "ulw-loop", "SKILL.md"),
|
|
93566
|
+
join60("skills", "ulw-plan", "SKILL.md"),
|
|
93567
|
+
join60("skills", "ulw-research", "SKILL.md"),
|
|
93568
|
+
join60("skills", "visual-qa", "SKILL.md"),
|
|
93569
|
+
join60("skills-conditional", "x-search", "SKILL.md"),
|
|
93570
|
+
join60("runtime", "ast-grep-mcp", "cli.js"),
|
|
93571
|
+
join60("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
93572
|
+
join60("runtime", "lsp-daemon", "dist", "index.js"),
|
|
93573
|
+
join60("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
93574
|
+
join60("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
93575
|
+
join60("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
93576
|
+
join60("runtime", "lsp-daemon", "dist", "package.json"),
|
|
93577
|
+
join60("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
93578
|
+
join60("scripts", "install.mjs")
|
|
93491
93579
|
];
|
|
93492
93580
|
async function ensurePluginArtifacts(context) {
|
|
93493
93581
|
if (context.allowBuild) {
|
|
93494
|
-
await context.runCommand("node", [
|
|
93495
|
-
await context.runCommand("node", [
|
|
93496
|
-
await context.runCommand("node", [
|
|
93497
|
-
await context.runCommand("node", [
|
|
93498
|
-
await context.runCommand("node", [
|
|
93499
|
-
await context.runCommand("node", [
|
|
93500
|
-
await context.runCommand("node", [
|
|
93582
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
93583
|
+
await context.runCommand("node", [join60("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
93584
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
93585
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
93586
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
93587
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
93588
|
+
await context.runCommand("node", [join60(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
|
|
93501
93589
|
}
|
|
93502
93590
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
93503
93591
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -93506,14 +93594,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
93506
93594
|
}
|
|
93507
93595
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
93508
93596
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
93509
|
-
if (!await fileExists2(
|
|
93597
|
+
if (!await fileExists2(join60(pluginPath, artifact)))
|
|
93510
93598
|
return true;
|
|
93511
93599
|
}
|
|
93512
93600
|
return false;
|
|
93513
93601
|
}
|
|
93514
93602
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
93515
|
-
const runtimeEntry =
|
|
93516
|
-
const manifestPath =
|
|
93603
|
+
const runtimeEntry = join60(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
93604
|
+
const manifestPath = join60(dirname23(runtimeEntry), "manifest.json");
|
|
93517
93605
|
let runtimeStat;
|
|
93518
93606
|
try {
|
|
93519
93607
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -93528,7 +93616,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
93528
93616
|
}
|
|
93529
93617
|
let manifest;
|
|
93530
93618
|
try {
|
|
93531
|
-
manifest = JSON.parse(await
|
|
93619
|
+
manifest = JSON.parse(await readFile27(manifestPath, "utf8"));
|
|
93532
93620
|
} catch (error) {
|
|
93533
93621
|
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
|
|
93534
93622
|
}
|
|
@@ -93537,7 +93625,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
93537
93625
|
}
|
|
93538
93626
|
let actualSha256;
|
|
93539
93627
|
try {
|
|
93540
|
-
actualSha256 =
|
|
93628
|
+
actualSha256 = createHash6("sha256").update(await readFile27(runtimeEntry)).digest("hex");
|
|
93541
93629
|
} catch (error) {
|
|
93542
93630
|
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
|
|
93543
93631
|
}
|
|
@@ -93588,7 +93676,7 @@ async function runSenpiInstaller(options = {}) {
|
|
|
93588
93676
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
93589
93677
|
const launcherPath = installLocalLauncher({
|
|
93590
93678
|
pluginPath: context.pluginPath,
|
|
93591
|
-
senpiCliPath:
|
|
93679
|
+
senpiCliPath: join61(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
|
|
93592
93680
|
homeDir: context.homeDir
|
|
93593
93681
|
});
|
|
93594
93682
|
return {
|
|
@@ -93608,13 +93696,13 @@ function resolveInstallContext(options) {
|
|
|
93608
93696
|
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname24(fileURLToPath(import.meta.url))) : dirname24(resolve19(options.pluginPath))));
|
|
93609
93697
|
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
|
|
93610
93698
|
const agentDir = resolve19(options.agentDir ?? resolveAgentHome({ env, homeDir }));
|
|
93611
|
-
const pluginPath = resolve19(options.pluginPath ??
|
|
93699
|
+
const pluginPath = resolve19(options.pluginPath ?? join61(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
93612
93700
|
return {
|
|
93613
93701
|
env,
|
|
93614
93702
|
repoRoot,
|
|
93615
93703
|
agentDir,
|
|
93616
93704
|
homeDir,
|
|
93617
|
-
settingsPath:
|
|
93705
|
+
settingsPath: join61(agentDir, "settings.json"),
|
|
93618
93706
|
pluginPath,
|
|
93619
93707
|
platform: options.platform ?? process.platform,
|
|
93620
93708
|
allowBuild,
|
|
@@ -93631,7 +93719,7 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
93631
93719
|
function findRepoRoot2(importerDir) {
|
|
93632
93720
|
let current = importerDir;
|
|
93633
93721
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
93634
|
-
if (fileExistsSync(
|
|
93722
|
+
if (fileExistsSync(join61(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
93635
93723
|
return current;
|
|
93636
93724
|
current = resolve19(current, "..");
|
|
93637
93725
|
}
|
|
@@ -93675,19 +93763,19 @@ init_provider_availability();
|
|
|
93675
93763
|
|
|
93676
93764
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
93677
93765
|
import { existsSync as existsSync32, mkdirSync as mkdirSync11, readFileSync as readFileSync15 } from "fs";
|
|
93678
|
-
import { join as
|
|
93766
|
+
import { join as join63 } from "path";
|
|
93679
93767
|
|
|
93680
93768
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
93681
93769
|
init_shared();
|
|
93682
93770
|
import { existsSync as existsSync31, readFileSync as readFileSync14 } from "fs";
|
|
93683
|
-
import { join as
|
|
93771
|
+
import { join as join62 } from "path";
|
|
93684
93772
|
var TUI_SUBPATH = "tui";
|
|
93685
93773
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
93686
93774
|
function fileEntryPackageJsonPath(entry) {
|
|
93687
93775
|
let path = entry.slice("file:".length);
|
|
93688
93776
|
if (path.startsWith("//"))
|
|
93689
93777
|
path = path.slice(2);
|
|
93690
|
-
return
|
|
93778
|
+
return join62(path, "package.json");
|
|
93691
93779
|
}
|
|
93692
93780
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
93693
93781
|
if (!existsSync31(pkgJsonPath))
|
|
@@ -93725,7 +93813,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
93725
93813
|
const packageName = packageNameFromServerEntry(entry);
|
|
93726
93814
|
if (packageName === null)
|
|
93727
93815
|
return null;
|
|
93728
|
-
return packageJsonExportsTui(
|
|
93816
|
+
return packageJsonExportsTui(join62(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
93729
93817
|
}
|
|
93730
93818
|
function isOurFilePluginEntry(entry) {
|
|
93731
93819
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -93790,7 +93878,7 @@ function detectServerPluginRegistration() {
|
|
|
93790
93878
|
}
|
|
93791
93879
|
}
|
|
93792
93880
|
function detectTuiPluginRegistration() {
|
|
93793
|
-
const tuiJsonPath =
|
|
93881
|
+
const tuiJsonPath = join62(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
93794
93882
|
if (!existsSync31(tuiJsonPath)) {
|
|
93795
93883
|
return {
|
|
93796
93884
|
registered: false,
|
|
@@ -93946,10 +94034,10 @@ function readConfig(path) {
|
|
|
93946
94034
|
return null;
|
|
93947
94035
|
}
|
|
93948
94036
|
function readServerConfig(configDir) {
|
|
93949
|
-
const jsoncPath =
|
|
94037
|
+
const jsoncPath = join63(configDir, "opencode.jsonc");
|
|
93950
94038
|
if (existsSync32(jsoncPath))
|
|
93951
94039
|
return readConfig(jsoncPath);
|
|
93952
|
-
const jsonPath =
|
|
94040
|
+
const jsonPath = join63(configDir, "opencode.json");
|
|
93953
94041
|
if (existsSync32(jsonPath))
|
|
93954
94042
|
return readConfig(jsonPath);
|
|
93955
94043
|
return null;
|
|
@@ -93991,7 +94079,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
93991
94079
|
if (!desiredEntry) {
|
|
93992
94080
|
return { changed: false, reason: "no-server-entry" };
|
|
93993
94081
|
}
|
|
93994
|
-
const tuiJsonPath =
|
|
94082
|
+
const tuiJsonPath = join63(configDir, "tui.json");
|
|
93995
94083
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
93996
94084
|
if (malformed) {
|
|
93997
94085
|
return { changed: false, reason: "malformed" };
|
|
@@ -94007,7 +94095,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
94007
94095
|
|
|
94008
94096
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
94009
94097
|
import { homedir as homedir12 } from "os";
|
|
94010
|
-
import { join as
|
|
94098
|
+
import { join as join64 } from "path";
|
|
94011
94099
|
|
|
94012
94100
|
// packages/shared-skills/index.mjs
|
|
94013
94101
|
import { existsSync as existsSync33 } from "fs";
|
|
@@ -94029,9 +94117,9 @@ function describeResult2(result) {
|
|
|
94029
94117
|
}
|
|
94030
94118
|
async function installAstGrepForOpenCode(options = {}) {
|
|
94031
94119
|
const platform = options.platform ?? process.platform;
|
|
94032
|
-
const baseDir =
|
|
94120
|
+
const baseDir = join64(options.homeDir ?? homedir12(), ".omo");
|
|
94033
94121
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
94034
|
-
const skillDir =
|
|
94122
|
+
const skillDir = join64(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
94035
94123
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
94036
94124
|
try {
|
|
94037
94125
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -98252,9 +98340,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
98252
98340
|
}
|
|
98253
98341
|
// packages/boulder-state/src/storage/path.ts
|
|
98254
98342
|
import { existsSync as existsSync35 } from "fs";
|
|
98255
|
-
import { isAbsolute as isAbsolute12, join as
|
|
98343
|
+
import { isAbsolute as isAbsolute12, join as join65, relative as relative8, resolve as resolve20 } from "path";
|
|
98256
98344
|
function getBoulderFilePath(directory) {
|
|
98257
|
-
return
|
|
98345
|
+
return join65(directory, BOULDER_DIR, BOULDER_FILE);
|
|
98258
98346
|
}
|
|
98259
98347
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
98260
98348
|
return isAbsolute12(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
|
|
@@ -98437,9 +98525,9 @@ init_state();
|
|
|
98437
98525
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
98438
98526
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
98439
98527
|
import { existsSync as existsSync38, mkdirSync as mkdirSync12, readFileSync as readFileSync19, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "fs";
|
|
98440
|
-
import { join as
|
|
98528
|
+
import { join as join66 } from "path";
|
|
98441
98529
|
function getMarkerPath(directory, sessionID) {
|
|
98442
|
-
return
|
|
98530
|
+
return join66(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
98443
98531
|
}
|
|
98444
98532
|
function readContinuationMarker(directory, sessionID) {
|
|
98445
98533
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -98512,7 +98600,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
98512
98600
|
init_shared();
|
|
98513
98601
|
init_compaction_marker();
|
|
98514
98602
|
import { readFileSync as readFileSync20, readdirSync as readdirSync8 } from "fs";
|
|
98515
|
-
import { join as
|
|
98603
|
+
import { join as join67 } from "path";
|
|
98516
98604
|
var defaultSessionLastAgentDeps = {
|
|
98517
98605
|
getMessageDir,
|
|
98518
98606
|
isSqliteBackend,
|
|
@@ -98572,7 +98660,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
98572
98660
|
try {
|
|
98573
98661
|
const messages = readdirSync8(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
98574
98662
|
try {
|
|
98575
|
-
const content = readFileSync20(
|
|
98663
|
+
const content = readFileSync20(join67(messageDir, fileName), "utf-8");
|
|
98576
98664
|
const parsed = JSON.parse(content);
|
|
98577
98665
|
return {
|
|
98578
98666
|
fileName,
|
|
@@ -98616,7 +98704,7 @@ init_agent_display_names();
|
|
|
98616
98704
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
98617
98705
|
init_frontmatter2();
|
|
98618
98706
|
import { existsSync as existsSync39, readFileSync as readFileSync21, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "fs";
|
|
98619
|
-
import { dirname as dirname26, join as
|
|
98707
|
+
import { dirname as dirname26, join as join68 } from "path";
|
|
98620
98708
|
|
|
98621
98709
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
98622
98710
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -98625,7 +98713,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
98625
98713
|
|
|
98626
98714
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
98627
98715
|
function getStateFilePath(directory, customPath) {
|
|
98628
|
-
return customPath ?
|
|
98716
|
+
return customPath ? join68(directory, customPath) : join68(directory, DEFAULT_STATE_FILE);
|
|
98629
98717
|
}
|
|
98630
98718
|
function readState(directory, customPath) {
|
|
98631
98719
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -99732,7 +99820,7 @@ init_extract_semver();
|
|
|
99732
99820
|
init_bun_which_shim();
|
|
99733
99821
|
import { existsSync as existsSync47, accessSync as accessSync4, constants as constants12 } from "fs";
|
|
99734
99822
|
import { homedir as homedir15 } from "os";
|
|
99735
|
-
import { join as
|
|
99823
|
+
import { join as join75 } from "path";
|
|
99736
99824
|
|
|
99737
99825
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
99738
99826
|
init_spawn_with_windows_hide();
|
|
@@ -99824,17 +99912,17 @@ function getDesktopAppPaths(platform) {
|
|
|
99824
99912
|
case "darwin":
|
|
99825
99913
|
return [
|
|
99826
99914
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
99827
|
-
|
|
99915
|
+
join75(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
99828
99916
|
];
|
|
99829
99917
|
case "win32": {
|
|
99830
99918
|
const programFiles = process.env.ProgramFiles;
|
|
99831
99919
|
const localAppData = process.env.LOCALAPPDATA;
|
|
99832
99920
|
const paths = [];
|
|
99833
99921
|
if (programFiles) {
|
|
99834
|
-
paths.push(
|
|
99922
|
+
paths.push(join75(programFiles, "OpenCode", "OpenCode.exe"));
|
|
99835
99923
|
}
|
|
99836
99924
|
if (localAppData) {
|
|
99837
|
-
paths.push(
|
|
99925
|
+
paths.push(join75(localAppData, "OpenCode", "OpenCode.exe"));
|
|
99838
99926
|
}
|
|
99839
99927
|
return paths;
|
|
99840
99928
|
}
|
|
@@ -99842,8 +99930,8 @@ function getDesktopAppPaths(platform) {
|
|
|
99842
99930
|
return [
|
|
99843
99931
|
"/usr/bin/opencode",
|
|
99844
99932
|
"/usr/lib/opencode/opencode",
|
|
99845
|
-
|
|
99846
|
-
|
|
99933
|
+
join75(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
99934
|
+
join75(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
99847
99935
|
];
|
|
99848
99936
|
default:
|
|
99849
99937
|
return [];
|
|
@@ -99875,7 +99963,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
99875
99963
|
const candidates = getCommandCandidates2(platform);
|
|
99876
99964
|
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
|
|
99877
99965
|
for (const command of candidates) {
|
|
99878
|
-
const fullPath =
|
|
99966
|
+
const fullPath = join75(entry, command);
|
|
99879
99967
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
99880
99968
|
return { binary: command, path: fullPath };
|
|
99881
99969
|
}
|
|
@@ -100019,22 +100107,22 @@ init_package_json_locator();
|
|
|
100019
100107
|
import { existsSync as existsSync49, readFileSync as readFileSync30, readdirSync as readdirSync10 } from "fs";
|
|
100020
100108
|
import { createRequire } from "module";
|
|
100021
100109
|
import { homedir as homedir16 } from "os";
|
|
100022
|
-
import { join as
|
|
100110
|
+
import { join as join76 } from "path";
|
|
100023
100111
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
100024
100112
|
init_shared();
|
|
100025
100113
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
100026
100114
|
if (platform === "darwin")
|
|
100027
|
-
return
|
|
100115
|
+
return join76(homedir16(), "Library", "Caches");
|
|
100028
100116
|
if (platform === "win32")
|
|
100029
|
-
return process.env.LOCALAPPDATA ??
|
|
100030
|
-
return
|
|
100117
|
+
return process.env.LOCALAPPDATA ?? join76(homedir16(), "AppData", "Local");
|
|
100118
|
+
return join76(homedir16(), ".cache");
|
|
100031
100119
|
}
|
|
100032
100120
|
function resolveOpenCodeCacheDir() {
|
|
100033
100121
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
100034
100122
|
if (xdgCacheHome)
|
|
100035
|
-
return
|
|
100123
|
+
return join76(xdgCacheHome, "opencode");
|
|
100036
100124
|
const fromShared = getOpenCodeCacheDir();
|
|
100037
|
-
const platformDefault =
|
|
100125
|
+
const platformDefault = join76(getPlatformDefaultCacheDir(), "opencode");
|
|
100038
100126
|
if (existsSync49(fromShared) || !existsSync49(platformDefault))
|
|
100039
100127
|
return fromShared;
|
|
100040
100128
|
return platformDefault;
|
|
@@ -100066,11 +100154,11 @@ function normalizeVersion(value) {
|
|
|
100066
100154
|
function createPackageCandidates(rootDir) {
|
|
100067
100155
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
100068
100156
|
packageName,
|
|
100069
|
-
installedPackagePath:
|
|
100157
|
+
installedPackagePath: join76(rootDir, "node_modules", packageName, "package.json")
|
|
100070
100158
|
}));
|
|
100071
100159
|
}
|
|
100072
100160
|
function createTaggedInstallCandidates(rootDir) {
|
|
100073
|
-
const packagesDir =
|
|
100161
|
+
const packagesDir = join76(rootDir, "packages");
|
|
100074
100162
|
if (!existsSync49(packagesDir))
|
|
100075
100163
|
return [];
|
|
100076
100164
|
const candidates = [];
|
|
@@ -100078,14 +100166,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
100078
100166
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
100079
100167
|
if (packageName === undefined)
|
|
100080
100168
|
continue;
|
|
100081
|
-
const installDir =
|
|
100169
|
+
const installDir = join76(packagesDir, entryName);
|
|
100082
100170
|
candidates.push({
|
|
100083
100171
|
cacheDir: installDir,
|
|
100084
|
-
cachePackagePath:
|
|
100172
|
+
cachePackagePath: join76(installDir, "package.json"),
|
|
100085
100173
|
packageCandidates: [
|
|
100086
100174
|
{
|
|
100087
100175
|
packageName,
|
|
100088
|
-
installedPackagePath:
|
|
100176
|
+
installedPackagePath: join76(installDir, "node_modules", packageName, "package.json")
|
|
100089
100177
|
}
|
|
100090
100178
|
]
|
|
100091
100179
|
});
|
|
@@ -100130,13 +100218,13 @@ function getLoadedPluginVersion() {
|
|
|
100130
100218
|
const candidates = [
|
|
100131
100219
|
{
|
|
100132
100220
|
cacheDir: configDir,
|
|
100133
|
-
cachePackagePath:
|
|
100221
|
+
cachePackagePath: join76(configDir, "package.json"),
|
|
100134
100222
|
packageCandidates: createPackageCandidates(configDir)
|
|
100135
100223
|
},
|
|
100136
100224
|
...createTaggedInstallCandidates(configDir),
|
|
100137
100225
|
{
|
|
100138
100226
|
cacheDir,
|
|
100139
|
-
cachePackagePath:
|
|
100227
|
+
cachePackagePath: join76(cacheDir, "package.json"),
|
|
100140
100228
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
100141
100229
|
},
|
|
100142
100230
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -100330,18 +100418,18 @@ async function checkSystem(deps = defaultDeps5) {
|
|
|
100330
100418
|
init_shared();
|
|
100331
100419
|
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "fs";
|
|
100332
100420
|
import { homedir as homedir17 } from "os";
|
|
100333
|
-
import { join as
|
|
100421
|
+
import { join as join77 } from "path";
|
|
100334
100422
|
function getUserConfigDir2() {
|
|
100335
100423
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
100336
100424
|
if (xdgConfig)
|
|
100337
|
-
return
|
|
100338
|
-
return
|
|
100425
|
+
return join77(xdgConfig, "opencode");
|
|
100426
|
+
return join77(homedir17(), ".config", "opencode");
|
|
100339
100427
|
}
|
|
100340
100428
|
function loadCustomProviderNames() {
|
|
100341
100429
|
const configDir = getUserConfigDir2();
|
|
100342
100430
|
const candidatePaths = [
|
|
100343
|
-
|
|
100344
|
-
|
|
100431
|
+
join77(configDir, "opencode.json"),
|
|
100432
|
+
join77(configDir, "opencode.jsonc")
|
|
100345
100433
|
];
|
|
100346
100434
|
for (const configPath of candidatePaths) {
|
|
100347
100435
|
if (!existsSync51(configPath))
|
|
@@ -100362,7 +100450,7 @@ function loadCustomProviderNames() {
|
|
|
100362
100450
|
return [];
|
|
100363
100451
|
}
|
|
100364
100452
|
function loadAvailableModelsFromCache() {
|
|
100365
|
-
const cacheFile =
|
|
100453
|
+
const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
|
|
100366
100454
|
const customProviders = loadCustomProviderNames();
|
|
100367
100455
|
if (!existsSync51(cacheFile)) {
|
|
100368
100456
|
if (customProviders.length > 0) {
|
|
@@ -100424,7 +100512,7 @@ function loadOmoConfig2() {
|
|
|
100424
100512
|
|
|
100425
100513
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
100426
100514
|
init_shared();
|
|
100427
|
-
import { join as
|
|
100515
|
+
import { join as join78 } from "path";
|
|
100428
100516
|
|
|
100429
100517
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
100430
100518
|
function formatModelWithVariant(model, variant) {
|
|
@@ -100466,7 +100554,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
100466
100554
|
}
|
|
100467
100555
|
function buildModelResolutionDetails(options) {
|
|
100468
100556
|
const details = [];
|
|
100469
|
-
const cacheFile =
|
|
100557
|
+
const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
|
|
100470
100558
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
100471
100559
|
details.push("");
|
|
100472
100560
|
if (options.available.cacheExists) {
|
|
@@ -100778,7 +100866,7 @@ init_src4();
|
|
|
100778
100866
|
init_main();
|
|
100779
100867
|
init_config_migration();
|
|
100780
100868
|
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
|
|
100781
|
-
import { join as
|
|
100869
|
+
import { join as join79 } from "path";
|
|
100782
100870
|
var CANONICAL_REPLACEMENT = new Map([
|
|
100783
100871
|
["variant", "reasoning"],
|
|
100784
100872
|
["reasoningEffort", "reasoning"],
|
|
@@ -100839,7 +100927,7 @@ function userConfigPaths() {
|
|
|
100839
100927
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
100840
100928
|
if (home === undefined || home.length === 0)
|
|
100841
100929
|
return [];
|
|
100842
|
-
return [
|
|
100930
|
+
return [join79(home, ".omo", "omo.jsonc"), join79(home, ".omo", "omo.json")];
|
|
100843
100931
|
}
|
|
100844
100932
|
async function checkDeprecatedReasoningKeys() {
|
|
100845
100933
|
const issues = [];
|
|
@@ -100865,25 +100953,25 @@ init_src();
|
|
|
100865
100953
|
import { existsSync as existsSync53 } from "fs";
|
|
100866
100954
|
import { createRequire as createRequire2 } from "module";
|
|
100867
100955
|
import { homedir as homedir19 } from "os";
|
|
100868
|
-
import { dirname as dirname31, join as
|
|
100956
|
+
import { dirname as dirname31, join as join81 } from "path";
|
|
100869
100957
|
|
|
100870
100958
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
100871
|
-
import { join as
|
|
100959
|
+
import { join as join80 } from "path";
|
|
100872
100960
|
import { homedir as homedir18, tmpdir as tmpdir4 } from "os";
|
|
100873
100961
|
init_binary_downloader();
|
|
100874
100962
|
init_logger2();
|
|
100875
100963
|
init_plugin_identity();
|
|
100876
100964
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
100877
|
-
var DEBUG_FILE =
|
|
100965
|
+
var DEBUG_FILE = join80(tmpdir4(), "comment-checker-debug.log");
|
|
100878
100966
|
function getCacheDir2() {
|
|
100879
100967
|
if (process.platform === "win32") {
|
|
100880
100968
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
100881
|
-
const base = localAppData ||
|
|
100882
|
-
return
|
|
100969
|
+
const base = localAppData || join80(homedir18(), "AppData", "Local");
|
|
100970
|
+
return join80(base, CACHE_DIR_NAME, "bin");
|
|
100883
100971
|
}
|
|
100884
100972
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
100885
|
-
const base = xdgCache ||
|
|
100886
|
-
return
|
|
100973
|
+
const base = xdgCache || join80(homedir18(), ".cache");
|
|
100974
|
+
return join80(base, CACHE_DIR_NAME, "bin");
|
|
100887
100975
|
}
|
|
100888
100976
|
function getBinaryName() {
|
|
100889
100977
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -100933,7 +101021,7 @@ async function getBinaryVersion(binary) {
|
|
|
100933
101021
|
}
|
|
100934
101022
|
}
|
|
100935
101023
|
async function checkAstGrepCli() {
|
|
100936
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
101024
|
+
const runtimeDir = astGrepRuntimeDir(join81(homedir19(), ".omo"));
|
|
100937
101025
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
100938
101026
|
if (sgPath === null) {
|
|
100939
101027
|
return {
|
|
@@ -100963,10 +101051,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
100963
101051
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
100964
101052
|
try {
|
|
100965
101053
|
const packageDir = baseDirOverride ?? dirname31(resolvePackageJsonPath());
|
|
100966
|
-
const vendorPath =
|
|
101054
|
+
const vendorPath = join81(packageDir, "vendor", platformKey, binaryName);
|
|
100967
101055
|
if (existsSync53(vendorPath))
|
|
100968
101056
|
return vendorPath;
|
|
100969
|
-
const binPath =
|
|
101057
|
+
const binPath = join81(packageDir, "bin", binaryName);
|
|
100970
101058
|
if (existsSync53(binPath))
|
|
100971
101059
|
return binPath;
|
|
100972
101060
|
} catch (error) {
|
|
@@ -101342,13 +101430,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
101342
101430
|
init_shared();
|
|
101343
101431
|
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "fs";
|
|
101344
101432
|
import { homedir as homedir20 } from "os";
|
|
101345
|
-
import { join as
|
|
101433
|
+
import { join as join82 } from "path";
|
|
101346
101434
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
101347
101435
|
function getMcpConfigPaths() {
|
|
101348
101436
|
return [
|
|
101349
|
-
|
|
101350
|
-
|
|
101351
|
-
|
|
101437
|
+
join82(homedir20(), ".claude", ".mcp.json"),
|
|
101438
|
+
join82(process.cwd(), ".mcp.json"),
|
|
101439
|
+
join82(process.cwd(), ".claude", ".mcp.json")
|
|
101352
101440
|
];
|
|
101353
101441
|
}
|
|
101354
101442
|
function loadUserMcpConfig() {
|
|
@@ -101628,9 +101716,9 @@ async function pathExists(dir) {
|
|
|
101628
101716
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
101629
101717
|
init_src();
|
|
101630
101718
|
import { existsSync as existsSync57 } from "fs";
|
|
101631
|
-
import { lstat as
|
|
101719
|
+
import { lstat as lstat16, readdir as readdir14, readFile as readFile28 } from "fs/promises";
|
|
101632
101720
|
import { homedir as homedir22 } from "os";
|
|
101633
|
-
import { basename as basename11, join as
|
|
101721
|
+
import { basename as basename11, join as join83, resolve as resolve23 } from "path";
|
|
101634
101722
|
// packages/omo-opencode/package.json
|
|
101635
101723
|
var package_default3 = {
|
|
101636
101724
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -101696,13 +101784,13 @@ var CODEX_BIN_NAMES = [
|
|
|
101696
101784
|
"omo-git-bash-hook"
|
|
101697
101785
|
];
|
|
101698
101786
|
async function gatherCodexSummary(deps = {}) {
|
|
101699
|
-
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
101787
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join83(homedir22(), ".codex"));
|
|
101700
101788
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
101701
101789
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
101702
101790
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
101703
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
101704
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
101705
|
-
const configPath =
|
|
101791
|
+
const manifest = pluginRoot === null ? null : await readJson(join83(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
101792
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join83(pluginRoot, "lazycodex-install.json"));
|
|
101793
|
+
const configPath = join83(codexHome, "config.toml");
|
|
101706
101794
|
const pluginVersion = stringField(manifest, "version");
|
|
101707
101795
|
return {
|
|
101708
101796
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -101759,7 +101847,7 @@ function buildCodexIssues(summary) {
|
|
|
101759
101847
|
if (summary.pluginRoot === null) {
|
|
101760
101848
|
issues.push({
|
|
101761
101849
|
title: "OMO Codex plugin is not installed",
|
|
101762
|
-
description: `Expected cached plugin at ${
|
|
101850
|
+
description: `Expected cached plugin at ${join83("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
101763
101851
|
fix: "Run: npx lazycodex-ai install",
|
|
101764
101852
|
severity: "error",
|
|
101765
101853
|
affects: ["plugin loading"]
|
|
@@ -101824,12 +101912,12 @@ function buildCodexIssues(summary) {
|
|
|
101824
101912
|
return issues;
|
|
101825
101913
|
}
|
|
101826
101914
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
101827
|
-
const pluginRoot =
|
|
101915
|
+
const pluginRoot = join83(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
101828
101916
|
if (!existsSync57(pluginRoot))
|
|
101829
101917
|
return null;
|
|
101830
101918
|
const versions = await readdir14(pluginRoot, { withFileTypes: true });
|
|
101831
101919
|
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
101832
|
-
return candidates.length === 0 ? null :
|
|
101920
|
+
return candidates.length === 0 ? null : join83(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
101833
101921
|
}
|
|
101834
101922
|
async function readCodexConfigSummary(configPath) {
|
|
101835
101923
|
if (!existsSync57(configPath)) {
|
|
@@ -101843,7 +101931,7 @@ async function readCodexConfigSummary(configPath) {
|
|
|
101843
101931
|
companionLifecycleHookStateEvents: []
|
|
101844
101932
|
};
|
|
101845
101933
|
}
|
|
101846
|
-
const content = await
|
|
101934
|
+
const content = await readFile28(configPath, "utf8");
|
|
101847
101935
|
return {
|
|
101848
101936
|
exists: true,
|
|
101849
101937
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -101857,13 +101945,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
101857
101945
|
async function readLinkedBins(binDir) {
|
|
101858
101946
|
const linked = [];
|
|
101859
101947
|
for (const name of CODEX_BIN_NAMES) {
|
|
101860
|
-
if (await pathExists2(
|
|
101948
|
+
if (await pathExists2(join83(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
101861
101949
|
linked.push(name);
|
|
101862
101950
|
}
|
|
101863
101951
|
return linked;
|
|
101864
101952
|
}
|
|
101865
101953
|
async function readLinkedAgents(codexHome) {
|
|
101866
|
-
const agentsDir =
|
|
101954
|
+
const agentsDir = join83(codexHome, "agents");
|
|
101867
101955
|
if (!existsSync57(agentsDir))
|
|
101868
101956
|
return [];
|
|
101869
101957
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
@@ -101871,7 +101959,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
101871
101959
|
}
|
|
101872
101960
|
async function readJson(path) {
|
|
101873
101961
|
try {
|
|
101874
|
-
const parsed = JSON.parse(await
|
|
101962
|
+
const parsed = JSON.parse(await readFile28(path, "utf8"));
|
|
101875
101963
|
return isPlainRecord(parsed) ? parsed : null;
|
|
101876
101964
|
} catch (error) {
|
|
101877
101965
|
if (error instanceof Error)
|
|
@@ -101966,7 +102054,7 @@ function compareVersionsDescending(left, right) {
|
|
|
101966
102054
|
}
|
|
101967
102055
|
async function pathExists2(path) {
|
|
101968
102056
|
try {
|
|
101969
|
-
await
|
|
102057
|
+
await lstat16(path);
|
|
101970
102058
|
return true;
|
|
101971
102059
|
} catch (error) {
|
|
101972
102060
|
if (error instanceof Error)
|
|
@@ -101995,9 +102083,9 @@ function resolveLatestVersion(input) {
|
|
|
101995
102083
|
|
|
101996
102084
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
101997
102085
|
init_src();
|
|
101998
|
-
import { readdir as readdir15, readFile as
|
|
102086
|
+
import { readdir as readdir15, readFile as readFile29, stat as stat7 } from "fs/promises";
|
|
101999
102087
|
import { homedir as homedir23 } from "os";
|
|
102000
|
-
import { dirname as dirname33, isAbsolute as isAbsolute13, join as
|
|
102088
|
+
import { dirname as dirname33, isAbsolute as isAbsolute13, join as join84, relative as relative9, resolve as resolve24, sep as sep9 } from "path";
|
|
102001
102089
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
102002
102090
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
102003
102091
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -102007,7 +102095,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
102007
102095
|
const env = deps.env ?? process.env;
|
|
102008
102096
|
const platform = deps.platform ?? process.platform;
|
|
102009
102097
|
const arch = deps.arch ?? process.arch;
|
|
102010
|
-
const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ??
|
|
102098
|
+
const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ?? join84(homedir23(), ".codex"));
|
|
102011
102099
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
102012
102100
|
if (summary.pluginRoot === null) {
|
|
102013
102101
|
return {
|
|
@@ -102032,7 +102120,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
102032
102120
|
});
|
|
102033
102121
|
}
|
|
102034
102122
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
102035
|
-
const runtimeSgPath =
|
|
102123
|
+
const runtimeSgPath = join84(runtimeSgDir, sgBinaryName(platform));
|
|
102036
102124
|
const sg = findSgBinarySync({
|
|
102037
102125
|
arch,
|
|
102038
102126
|
env,
|
|
@@ -102144,7 +102232,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
102144
102232
|
for (const entry of entries) {
|
|
102145
102233
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
102146
102234
|
continue;
|
|
102147
|
-
const entryPath =
|
|
102235
|
+
const entryPath = join84(root, entry.name);
|
|
102148
102236
|
if (entry.isDirectory()) {
|
|
102149
102237
|
paths.push(...await findManifestPaths(entryPath, manifestName));
|
|
102150
102238
|
continue;
|
|
@@ -102188,18 +102276,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
102188
102276
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute13(arg));
|
|
102189
102277
|
}
|
|
102190
102278
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
102191
|
-
return
|
|
102279
|
+
return join84(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
102192
102280
|
}
|
|
102193
102281
|
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
|
|
102194
102282
|
const override = env[SG_PATH_ENV_KEY]?.trim();
|
|
102195
102283
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
102196
102284
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
102197
|
-
if (sgPath ===
|
|
102285
|
+
if (sgPath === join84(runtimeSgDir, sgBinaryName(platform)))
|
|
102198
102286
|
return "runtime dir";
|
|
102199
102287
|
return "PATH";
|
|
102200
102288
|
}
|
|
102201
102289
|
async function readBootstrapStateSummary(codexHome) {
|
|
102202
|
-
const statePath =
|
|
102290
|
+
const statePath = join84(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
102203
102291
|
const raw = await readJson2(statePath);
|
|
102204
102292
|
if (raw === null)
|
|
102205
102293
|
return null;
|
|
@@ -102248,7 +102336,7 @@ function degradedDetailLines(entries) {
|
|
|
102248
102336
|
}
|
|
102249
102337
|
async function readJson2(path) {
|
|
102250
102338
|
try {
|
|
102251
|
-
const parsed = JSON.parse(await
|
|
102339
|
+
const parsed = JSON.parse(await readFile29(path, "utf8"));
|
|
102252
102340
|
return isRecord15(parsed) ? parsed : null;
|
|
102253
102341
|
} catch (error) {
|
|
102254
102342
|
if (error instanceof Error)
|
|
@@ -102276,18 +102364,18 @@ function isRecord15(value) {
|
|
|
102276
102364
|
|
|
102277
102365
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
102278
102366
|
import { existsSync as existsSync58 } from "fs";
|
|
102279
|
-
import { readFile as
|
|
102367
|
+
import { readFile as readFile30 } from "fs/promises";
|
|
102280
102368
|
import { homedir as homedir24 } from "os";
|
|
102281
|
-
import { join as
|
|
102369
|
+
import { join as join85, resolve as resolve25 } from "path";
|
|
102282
102370
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
102283
102371
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
102284
102372
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
102285
102373
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
102286
|
-
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
102374
|
+
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join85(homedir24(), ".codex"));
|
|
102287
102375
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
102288
102376
|
const platform = deps.platform ?? process.platform;
|
|
102289
|
-
const wrapperPath =
|
|
102290
|
-
const legacyWrapperPath =
|
|
102377
|
+
const wrapperPath = join85(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
102378
|
+
const legacyWrapperPath = join85(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
102291
102379
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
102292
102380
|
const issues = [];
|
|
102293
102381
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -102321,7 +102409,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
102321
102409
|
}
|
|
102322
102410
|
async function readRuntimeWrapper(path) {
|
|
102323
102411
|
try {
|
|
102324
|
-
return await
|
|
102412
|
+
return await readFile30(path, "utf8");
|
|
102325
102413
|
} catch (error) {
|
|
102326
102414
|
if (error instanceof Error)
|
|
102327
102415
|
return null;
|
|
@@ -102811,7 +102899,7 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
102811
102899
|
}
|
|
102812
102900
|
|
|
102813
102901
|
// packages/mcp-client-core/src/mcp-oauth/storage.ts
|
|
102814
|
-
import { createHash as
|
|
102902
|
+
import { createHash as createHash7 } from "crypto";
|
|
102815
102903
|
import {
|
|
102816
102904
|
chmodSync as chmodSync5,
|
|
102817
102905
|
existsSync as existsSync61,
|
|
@@ -102822,12 +102910,12 @@ import {
|
|
|
102822
102910
|
unlinkSync as unlinkSync9,
|
|
102823
102911
|
writeFileSync as writeFileSync12
|
|
102824
102912
|
} from "fs";
|
|
102825
|
-
import { basename as basename12, dirname as dirname34, join as
|
|
102913
|
+
import { basename as basename12, dirname as dirname34, join as join88 } from "path";
|
|
102826
102914
|
|
|
102827
102915
|
// packages/mcp-client-core/src/config-dir.ts
|
|
102828
102916
|
import { existsSync as existsSync59, realpathSync as realpathSync8 } from "fs";
|
|
102829
102917
|
import { homedir as homedir25 } from "os";
|
|
102830
|
-
import { join as
|
|
102918
|
+
import { join as join86, resolve as resolve26 } from "path";
|
|
102831
102919
|
function resolveConfigPath2(pathValue) {
|
|
102832
102920
|
const resolvedPath = resolve26(pathValue);
|
|
102833
102921
|
if (!existsSync59(resolvedPath))
|
|
@@ -102845,13 +102933,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
102845
102933
|
if (customConfigDir) {
|
|
102846
102934
|
return resolveConfigPath2(customConfigDir);
|
|
102847
102935
|
}
|
|
102848
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
102849
|
-
return resolveConfigPath2(
|
|
102936
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join86(homedir25(), ".config");
|
|
102937
|
+
return resolveConfigPath2(join86(xdgConfigDir, "opencode"));
|
|
102850
102938
|
}
|
|
102851
102939
|
|
|
102852
102940
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
102853
102941
|
import { chmodSync as chmodSync4, existsSync as existsSync60, readFileSync as readFileSync37, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "fs";
|
|
102854
|
-
import { join as
|
|
102942
|
+
import { join as join87 } from "path";
|
|
102855
102943
|
var INDEX_FILE_NAME = "index.json";
|
|
102856
102944
|
function isTokenIndex(value) {
|
|
102857
102945
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -102859,7 +102947,7 @@ function isTokenIndex(value) {
|
|
|
102859
102947
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
102860
102948
|
}
|
|
102861
102949
|
function getIndexPath(storageDir) {
|
|
102862
|
-
return
|
|
102950
|
+
return join87(storageDir, INDEX_FILE_NAME);
|
|
102863
102951
|
}
|
|
102864
102952
|
function readTokenIndex(storageDir) {
|
|
102865
102953
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -102903,16 +102991,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
|
|
|
102903
102991
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
102904
102992
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
102905
102993
|
function getMcpOauthStorageDir() {
|
|
102906
|
-
return
|
|
102994
|
+
return join88(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
102907
102995
|
}
|
|
102908
102996
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
102909
|
-
return
|
|
102997
|
+
return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
102910
102998
|
}
|
|
102911
102999
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
102912
|
-
return
|
|
103000
|
+
return join88(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
102913
103001
|
}
|
|
102914
103002
|
function getLegacyStoragePath() {
|
|
102915
|
-
return
|
|
103003
|
+
return join88(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
102916
103004
|
}
|
|
102917
103005
|
function normalizeHost2(serverHost) {
|
|
102918
103006
|
let host = serverHost.trim();
|
|
@@ -103091,7 +103179,7 @@ function listTokensByHost(serverHost) {
|
|
|
103091
103179
|
for (const [hash, indexedKey] of Object.entries(index)) {
|
|
103092
103180
|
if (!indexedKey.startsWith(prefix))
|
|
103093
103181
|
continue;
|
|
103094
|
-
const indexedToken = readTokenFile(
|
|
103182
|
+
const indexedToken = readTokenFile(join88(getMcpOauthStorageDir(), `${hash}.json`));
|
|
103095
103183
|
if (indexedToken)
|
|
103096
103184
|
result[indexedKey] = indexedToken;
|
|
103097
103185
|
}
|
|
@@ -103106,7 +103194,7 @@ function listAllTokens() {
|
|
|
103106
103194
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
103107
103195
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
103108
103196
|
continue;
|
|
103109
|
-
const token = readTokenFile(
|
|
103197
|
+
const token = readTokenFile(join88(dir, entry.name));
|
|
103110
103198
|
const hash = basename12(entry.name, ".json");
|
|
103111
103199
|
if (token)
|
|
103112
103200
|
result[index[hash] ?? hash] = token;
|
|
@@ -103280,13 +103368,13 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
|
|
|
103280
103368
|
|
|
103281
103369
|
// packages/mcp-client-core/src/mcp-oauth/oauth-authorization-flow.ts
|
|
103282
103370
|
import { spawn as spawn4 } from "child_process";
|
|
103283
|
-
import { createHash as
|
|
103371
|
+
import { createHash as createHash8, randomBytes as randomBytes2 } from "crypto";
|
|
103284
103372
|
import { createServer as createServer2 } from "http";
|
|
103285
103373
|
function generateCodeVerifier() {
|
|
103286
103374
|
return randomBytes2(32).toString("base64url");
|
|
103287
103375
|
}
|
|
103288
103376
|
function generateCodeChallenge(verifier) {
|
|
103289
|
-
return
|
|
103377
|
+
return createHash8("sha256").update(verifier).digest("base64url");
|
|
103290
103378
|
}
|
|
103291
103379
|
function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
103292
103380
|
const url = new URL(authorizationEndpoint);
|