lazycodex-ai 5.0.0-beta.57 → 5.0.0-beta.61
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 +420 -336
- package/dist/cli-node/index.js +420 -336
- 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/checkpoint-template.d.ts +5 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-template.js +4 -3
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.d.ts +5 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.d.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.js +38 -39
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +220 -40
- package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/factory.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/factory.js +141 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/manifest.d.ts +46 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/manifest.js +28 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/types.d.ts +127 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/types.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk.d.ts +3 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk.js +3 -0
- 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/skills/ulw-loop/SKILL.md +4 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-template.ts +8 -2
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +6 -2
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-subcommands.ts +50 -48
- package/packages/omo-codex/plugin/components/ulw-loop/src/sdk/factory.ts +183 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/sdk/manifest.ts +42 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/sdk/types.ts +140 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/sdk.ts +3 -0
- 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-contract.test.ts +137 -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/sdk-session-context.test.ts +148 -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 +7 -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/packages/shared-skills/skills/ulw-plan/scripts/scaffold-plan.mjs +1 -1
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.61",
|
|
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",
|
|
@@ -178,8 +178,8 @@ var init_package = __esm(() => {
|
|
|
178
178
|
"install:codex-dev": "bun run script/build-codex-install.ts && bun run script/install-codex-dev.ts",
|
|
179
179
|
"build:codex-plugin": "npm --prefix packages/omo-codex/plugin ci && bun run --cwd packages/omo-codex/plugin build",
|
|
180
180
|
"build:senpi-plugin": "bun run build:lsp-daemon && bun run build:ast-grep-mcp && bun run build:senpi-plugin:stage",
|
|
181
|
-
"build:senpi-plugin:native": "node packages/omo-senpi/plugin/scripts/stage-lsp-daemon-runtime.mjs && node packages/omo-senpi/plugin/scripts/stage-ast-grep-mcp-runtime.mjs && node packages/omo-senpi/plugin/scripts/stage-
|
|
182
|
-
"build:senpi-plugin:stage": "bun run build:materialize-frontend && node packages/omo-senpi/plugin/scripts/stage-lsp-daemon-runtime.mjs && node packages/omo-senpi/plugin/scripts/stage-ast-grep-mcp-runtime.mjs && node packages/omo-senpi/plugin/scripts/stage-
|
|
181
|
+
"build:senpi-plugin:native": "node packages/omo-senpi/plugin/scripts/stage-lsp-daemon-runtime.mjs && node packages/omo-senpi/plugin/scripts/stage-ast-grep-mcp-runtime.mjs && node packages/omo-senpi/plugin/scripts/stage-x-search-skill.mjs && node packages/omo-senpi/plugin/scripts/build-extension.mjs && node packages/omo-senpi/plugin/scripts/sync-skills.mjs && node packages/omo-senpi/plugin/scripts/embed-directive.mjs --check && node packages/omo-senpi/plugin/scripts/build-install.mjs",
|
|
182
|
+
"build:senpi-plugin:stage": "bun run build:materialize-frontend && node packages/omo-senpi/plugin/scripts/stage-lsp-daemon-runtime.mjs && node packages/omo-senpi/plugin/scripts/stage-ast-grep-mcp-runtime.mjs && node packages/omo-senpi/plugin/scripts/stage-x-search-skill.mjs && node packages/omo-senpi/plugin/scripts/build-extension.mjs && node packages/omo-senpi/plugin/scripts/sync-skills.mjs && node packages/omo-senpi/plugin/scripts/embed-directive.mjs --check && node packages/omo-senpi/plugin/scripts/build-install.mjs",
|
|
183
183
|
"build:materialize-frontend": "node packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs --strict",
|
|
184
184
|
"build:shared-skills-assets": "bun run build:materialize-frontend && rm -rf dist/skills && cp -R packages/shared-skills/skills dist/skills",
|
|
185
185
|
"build:lsp-tools-mcp": "npm --prefix packages/lsp-tools-mcp ci && npm --prefix packages/lsp-tools-mcp run build",
|
|
@@ -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.12",
|
|
252
|
+
"@code-yeongyu/senpi": "2026.9.12-2",
|
|
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.61",
|
|
294
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.61",
|
|
295
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.61",
|
|
296
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.61",
|
|
297
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.61",
|
|
298
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.61",
|
|
299
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.61",
|
|
300
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.61",
|
|
301
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.61",
|
|
302
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.61",
|
|
303
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.61",
|
|
304
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.61"
|
|
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.60",
|
|
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,54 +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
|
-
|
|
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
|
-
|
|
93491
|
-
join59("runtime", "lsp-daemon", "dist", "package.json"),
|
|
93492
|
-
join59("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
93493
|
-
join59("scripts", "install.mjs")
|
|
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")
|
|
93494
93579
|
];
|
|
93495
93580
|
async function ensurePluginArtifacts(context) {
|
|
93496
93581
|
if (context.allowBuild) {
|
|
93497
|
-
await context.runCommand("node", [
|
|
93498
|
-
await context.runCommand("node", [
|
|
93499
|
-
await context.runCommand("node", [
|
|
93500
|
-
await context.runCommand("node", [
|
|
93501
|
-
await context.runCommand("node", [
|
|
93502
|
-
await context.runCommand("node", [
|
|
93503
|
-
await context.runCommand("node", [
|
|
93504
|
-
await context.runCommand("node", [join59(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
|
|
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 });
|
|
93505
93589
|
}
|
|
93506
93590
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
93507
93591
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -93510,14 +93594,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
93510
93594
|
}
|
|
93511
93595
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
93512
93596
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
93513
|
-
if (!await fileExists2(
|
|
93597
|
+
if (!await fileExists2(join60(pluginPath, artifact)))
|
|
93514
93598
|
return true;
|
|
93515
93599
|
}
|
|
93516
93600
|
return false;
|
|
93517
93601
|
}
|
|
93518
93602
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
93519
|
-
const runtimeEntry =
|
|
93520
|
-
const manifestPath =
|
|
93603
|
+
const runtimeEntry = join60(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
93604
|
+
const manifestPath = join60(dirname23(runtimeEntry), "manifest.json");
|
|
93521
93605
|
let runtimeStat;
|
|
93522
93606
|
try {
|
|
93523
93607
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -93532,7 +93616,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
93532
93616
|
}
|
|
93533
93617
|
let manifest;
|
|
93534
93618
|
try {
|
|
93535
|
-
manifest = JSON.parse(await
|
|
93619
|
+
manifest = JSON.parse(await readFile27(manifestPath, "utf8"));
|
|
93536
93620
|
} catch (error) {
|
|
93537
93621
|
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
|
|
93538
93622
|
}
|
|
@@ -93541,7 +93625,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
93541
93625
|
}
|
|
93542
93626
|
let actualSha256;
|
|
93543
93627
|
try {
|
|
93544
|
-
actualSha256 =
|
|
93628
|
+
actualSha256 = createHash6("sha256").update(await readFile27(runtimeEntry)).digest("hex");
|
|
93545
93629
|
} catch (error) {
|
|
93546
93630
|
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
|
|
93547
93631
|
}
|
|
@@ -93592,7 +93676,7 @@ async function runSenpiInstaller(options = {}) {
|
|
|
93592
93676
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
93593
93677
|
const launcherPath = installLocalLauncher({
|
|
93594
93678
|
pluginPath: context.pluginPath,
|
|
93595
|
-
senpiCliPath:
|
|
93679
|
+
senpiCliPath: join61(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
|
|
93596
93680
|
homeDir: context.homeDir
|
|
93597
93681
|
});
|
|
93598
93682
|
return {
|
|
@@ -93612,13 +93696,13 @@ function resolveInstallContext(options) {
|
|
|
93612
93696
|
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname24(fileURLToPath(import.meta.url))) : dirname24(resolve19(options.pluginPath))));
|
|
93613
93697
|
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
|
|
93614
93698
|
const agentDir = resolve19(options.agentDir ?? resolveAgentHome({ env, homeDir }));
|
|
93615
|
-
const pluginPath = resolve19(options.pluginPath ??
|
|
93699
|
+
const pluginPath = resolve19(options.pluginPath ?? join61(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
93616
93700
|
return {
|
|
93617
93701
|
env,
|
|
93618
93702
|
repoRoot,
|
|
93619
93703
|
agentDir,
|
|
93620
93704
|
homeDir,
|
|
93621
|
-
settingsPath:
|
|
93705
|
+
settingsPath: join61(agentDir, "settings.json"),
|
|
93622
93706
|
pluginPath,
|
|
93623
93707
|
platform: options.platform ?? process.platform,
|
|
93624
93708
|
allowBuild,
|
|
@@ -93635,7 +93719,7 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
93635
93719
|
function findRepoRoot2(importerDir) {
|
|
93636
93720
|
let current = importerDir;
|
|
93637
93721
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
93638
|
-
if (fileExistsSync(
|
|
93722
|
+
if (fileExistsSync(join61(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
93639
93723
|
return current;
|
|
93640
93724
|
current = resolve19(current, "..");
|
|
93641
93725
|
}
|
|
@@ -93679,19 +93763,19 @@ init_provider_availability();
|
|
|
93679
93763
|
|
|
93680
93764
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
93681
93765
|
import { existsSync as existsSync32, mkdirSync as mkdirSync11, readFileSync as readFileSync15 } from "fs";
|
|
93682
|
-
import { join as
|
|
93766
|
+
import { join as join63 } from "path";
|
|
93683
93767
|
|
|
93684
93768
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
93685
93769
|
init_shared();
|
|
93686
93770
|
import { existsSync as existsSync31, readFileSync as readFileSync14 } from "fs";
|
|
93687
|
-
import { join as
|
|
93771
|
+
import { join as join62 } from "path";
|
|
93688
93772
|
var TUI_SUBPATH = "tui";
|
|
93689
93773
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
93690
93774
|
function fileEntryPackageJsonPath(entry) {
|
|
93691
93775
|
let path = entry.slice("file:".length);
|
|
93692
93776
|
if (path.startsWith("//"))
|
|
93693
93777
|
path = path.slice(2);
|
|
93694
|
-
return
|
|
93778
|
+
return join62(path, "package.json");
|
|
93695
93779
|
}
|
|
93696
93780
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
93697
93781
|
if (!existsSync31(pkgJsonPath))
|
|
@@ -93729,7 +93813,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
93729
93813
|
const packageName = packageNameFromServerEntry(entry);
|
|
93730
93814
|
if (packageName === null)
|
|
93731
93815
|
return null;
|
|
93732
|
-
return packageJsonExportsTui(
|
|
93816
|
+
return packageJsonExportsTui(join62(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
93733
93817
|
}
|
|
93734
93818
|
function isOurFilePluginEntry(entry) {
|
|
93735
93819
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -93794,7 +93878,7 @@ function detectServerPluginRegistration() {
|
|
|
93794
93878
|
}
|
|
93795
93879
|
}
|
|
93796
93880
|
function detectTuiPluginRegistration() {
|
|
93797
|
-
const tuiJsonPath =
|
|
93881
|
+
const tuiJsonPath = join62(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
93798
93882
|
if (!existsSync31(tuiJsonPath)) {
|
|
93799
93883
|
return {
|
|
93800
93884
|
registered: false,
|
|
@@ -93950,10 +94034,10 @@ function readConfig(path) {
|
|
|
93950
94034
|
return null;
|
|
93951
94035
|
}
|
|
93952
94036
|
function readServerConfig(configDir) {
|
|
93953
|
-
const jsoncPath =
|
|
94037
|
+
const jsoncPath = join63(configDir, "opencode.jsonc");
|
|
93954
94038
|
if (existsSync32(jsoncPath))
|
|
93955
94039
|
return readConfig(jsoncPath);
|
|
93956
|
-
const jsonPath =
|
|
94040
|
+
const jsonPath = join63(configDir, "opencode.json");
|
|
93957
94041
|
if (existsSync32(jsonPath))
|
|
93958
94042
|
return readConfig(jsonPath);
|
|
93959
94043
|
return null;
|
|
@@ -93995,7 +94079,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
93995
94079
|
if (!desiredEntry) {
|
|
93996
94080
|
return { changed: false, reason: "no-server-entry" };
|
|
93997
94081
|
}
|
|
93998
|
-
const tuiJsonPath =
|
|
94082
|
+
const tuiJsonPath = join63(configDir, "tui.json");
|
|
93999
94083
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
94000
94084
|
if (malformed) {
|
|
94001
94085
|
return { changed: false, reason: "malformed" };
|
|
@@ -94011,7 +94095,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
94011
94095
|
|
|
94012
94096
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
94013
94097
|
import { homedir as homedir12 } from "os";
|
|
94014
|
-
import { join as
|
|
94098
|
+
import { join as join64 } from "path";
|
|
94015
94099
|
|
|
94016
94100
|
// packages/shared-skills/index.mjs
|
|
94017
94101
|
import { existsSync as existsSync33 } from "fs";
|
|
@@ -94033,9 +94117,9 @@ function describeResult2(result) {
|
|
|
94033
94117
|
}
|
|
94034
94118
|
async function installAstGrepForOpenCode(options = {}) {
|
|
94035
94119
|
const platform = options.platform ?? process.platform;
|
|
94036
|
-
const baseDir =
|
|
94120
|
+
const baseDir = join64(options.homeDir ?? homedir12(), ".omo");
|
|
94037
94121
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
94038
|
-
const skillDir =
|
|
94122
|
+
const skillDir = join64(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
94039
94123
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
94040
94124
|
try {
|
|
94041
94125
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -98256,9 +98340,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
98256
98340
|
}
|
|
98257
98341
|
// packages/boulder-state/src/storage/path.ts
|
|
98258
98342
|
import { existsSync as existsSync35 } from "fs";
|
|
98259
|
-
import { isAbsolute as isAbsolute12, join as
|
|
98343
|
+
import { isAbsolute as isAbsolute12, join as join65, relative as relative8, resolve as resolve20 } from "path";
|
|
98260
98344
|
function getBoulderFilePath(directory) {
|
|
98261
|
-
return
|
|
98345
|
+
return join65(directory, BOULDER_DIR, BOULDER_FILE);
|
|
98262
98346
|
}
|
|
98263
98347
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
98264
98348
|
return isAbsolute12(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
|
|
@@ -98441,9 +98525,9 @@ init_state();
|
|
|
98441
98525
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
98442
98526
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
98443
98527
|
import { existsSync as existsSync38, mkdirSync as mkdirSync12, readFileSync as readFileSync19, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "fs";
|
|
98444
|
-
import { join as
|
|
98528
|
+
import { join as join66 } from "path";
|
|
98445
98529
|
function getMarkerPath(directory, sessionID) {
|
|
98446
|
-
return
|
|
98530
|
+
return join66(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
98447
98531
|
}
|
|
98448
98532
|
function readContinuationMarker(directory, sessionID) {
|
|
98449
98533
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -98516,7 +98600,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
98516
98600
|
init_shared();
|
|
98517
98601
|
init_compaction_marker();
|
|
98518
98602
|
import { readFileSync as readFileSync20, readdirSync as readdirSync8 } from "fs";
|
|
98519
|
-
import { join as
|
|
98603
|
+
import { join as join67 } from "path";
|
|
98520
98604
|
var defaultSessionLastAgentDeps = {
|
|
98521
98605
|
getMessageDir,
|
|
98522
98606
|
isSqliteBackend,
|
|
@@ -98576,7 +98660,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
98576
98660
|
try {
|
|
98577
98661
|
const messages = readdirSync8(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
98578
98662
|
try {
|
|
98579
|
-
const content = readFileSync20(
|
|
98663
|
+
const content = readFileSync20(join67(messageDir, fileName), "utf-8");
|
|
98580
98664
|
const parsed = JSON.parse(content);
|
|
98581
98665
|
return {
|
|
98582
98666
|
fileName,
|
|
@@ -98620,7 +98704,7 @@ init_agent_display_names();
|
|
|
98620
98704
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
98621
98705
|
init_frontmatter2();
|
|
98622
98706
|
import { existsSync as existsSync39, readFileSync as readFileSync21, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "fs";
|
|
98623
|
-
import { dirname as dirname26, join as
|
|
98707
|
+
import { dirname as dirname26, join as join68 } from "path";
|
|
98624
98708
|
|
|
98625
98709
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
98626
98710
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -98629,7 +98713,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
98629
98713
|
|
|
98630
98714
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
98631
98715
|
function getStateFilePath(directory, customPath) {
|
|
98632
|
-
return customPath ?
|
|
98716
|
+
return customPath ? join68(directory, customPath) : join68(directory, DEFAULT_STATE_FILE);
|
|
98633
98717
|
}
|
|
98634
98718
|
function readState(directory, customPath) {
|
|
98635
98719
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -99736,7 +99820,7 @@ init_extract_semver();
|
|
|
99736
99820
|
init_bun_which_shim();
|
|
99737
99821
|
import { existsSync as existsSync47, accessSync as accessSync4, constants as constants12 } from "fs";
|
|
99738
99822
|
import { homedir as homedir15 } from "os";
|
|
99739
|
-
import { join as
|
|
99823
|
+
import { join as join75 } from "path";
|
|
99740
99824
|
|
|
99741
99825
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
99742
99826
|
init_spawn_with_windows_hide();
|
|
@@ -99828,17 +99912,17 @@ function getDesktopAppPaths(platform) {
|
|
|
99828
99912
|
case "darwin":
|
|
99829
99913
|
return [
|
|
99830
99914
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
99831
|
-
|
|
99915
|
+
join75(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
99832
99916
|
];
|
|
99833
99917
|
case "win32": {
|
|
99834
99918
|
const programFiles = process.env.ProgramFiles;
|
|
99835
99919
|
const localAppData = process.env.LOCALAPPDATA;
|
|
99836
99920
|
const paths = [];
|
|
99837
99921
|
if (programFiles) {
|
|
99838
|
-
paths.push(
|
|
99922
|
+
paths.push(join75(programFiles, "OpenCode", "OpenCode.exe"));
|
|
99839
99923
|
}
|
|
99840
99924
|
if (localAppData) {
|
|
99841
|
-
paths.push(
|
|
99925
|
+
paths.push(join75(localAppData, "OpenCode", "OpenCode.exe"));
|
|
99842
99926
|
}
|
|
99843
99927
|
return paths;
|
|
99844
99928
|
}
|
|
@@ -99846,8 +99930,8 @@ function getDesktopAppPaths(platform) {
|
|
|
99846
99930
|
return [
|
|
99847
99931
|
"/usr/bin/opencode",
|
|
99848
99932
|
"/usr/lib/opencode/opencode",
|
|
99849
|
-
|
|
99850
|
-
|
|
99933
|
+
join75(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
99934
|
+
join75(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
99851
99935
|
];
|
|
99852
99936
|
default:
|
|
99853
99937
|
return [];
|
|
@@ -99879,7 +99963,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
99879
99963
|
const candidates = getCommandCandidates2(platform);
|
|
99880
99964
|
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
|
|
99881
99965
|
for (const command of candidates) {
|
|
99882
|
-
const fullPath =
|
|
99966
|
+
const fullPath = join75(entry, command);
|
|
99883
99967
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
99884
99968
|
return { binary: command, path: fullPath };
|
|
99885
99969
|
}
|
|
@@ -100023,22 +100107,22 @@ init_package_json_locator();
|
|
|
100023
100107
|
import { existsSync as existsSync49, readFileSync as readFileSync30, readdirSync as readdirSync10 } from "fs";
|
|
100024
100108
|
import { createRequire } from "module";
|
|
100025
100109
|
import { homedir as homedir16 } from "os";
|
|
100026
|
-
import { join as
|
|
100110
|
+
import { join as join76 } from "path";
|
|
100027
100111
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
100028
100112
|
init_shared();
|
|
100029
100113
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
100030
100114
|
if (platform === "darwin")
|
|
100031
|
-
return
|
|
100115
|
+
return join76(homedir16(), "Library", "Caches");
|
|
100032
100116
|
if (platform === "win32")
|
|
100033
|
-
return process.env.LOCALAPPDATA ??
|
|
100034
|
-
return
|
|
100117
|
+
return process.env.LOCALAPPDATA ?? join76(homedir16(), "AppData", "Local");
|
|
100118
|
+
return join76(homedir16(), ".cache");
|
|
100035
100119
|
}
|
|
100036
100120
|
function resolveOpenCodeCacheDir() {
|
|
100037
100121
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
100038
100122
|
if (xdgCacheHome)
|
|
100039
|
-
return
|
|
100123
|
+
return join76(xdgCacheHome, "opencode");
|
|
100040
100124
|
const fromShared = getOpenCodeCacheDir();
|
|
100041
|
-
const platformDefault =
|
|
100125
|
+
const platformDefault = join76(getPlatformDefaultCacheDir(), "opencode");
|
|
100042
100126
|
if (existsSync49(fromShared) || !existsSync49(platformDefault))
|
|
100043
100127
|
return fromShared;
|
|
100044
100128
|
return platformDefault;
|
|
@@ -100070,11 +100154,11 @@ function normalizeVersion(value) {
|
|
|
100070
100154
|
function createPackageCandidates(rootDir) {
|
|
100071
100155
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
100072
100156
|
packageName,
|
|
100073
|
-
installedPackagePath:
|
|
100157
|
+
installedPackagePath: join76(rootDir, "node_modules", packageName, "package.json")
|
|
100074
100158
|
}));
|
|
100075
100159
|
}
|
|
100076
100160
|
function createTaggedInstallCandidates(rootDir) {
|
|
100077
|
-
const packagesDir =
|
|
100161
|
+
const packagesDir = join76(rootDir, "packages");
|
|
100078
100162
|
if (!existsSync49(packagesDir))
|
|
100079
100163
|
return [];
|
|
100080
100164
|
const candidates = [];
|
|
@@ -100082,14 +100166,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
100082
100166
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
100083
100167
|
if (packageName === undefined)
|
|
100084
100168
|
continue;
|
|
100085
|
-
const installDir =
|
|
100169
|
+
const installDir = join76(packagesDir, entryName);
|
|
100086
100170
|
candidates.push({
|
|
100087
100171
|
cacheDir: installDir,
|
|
100088
|
-
cachePackagePath:
|
|
100172
|
+
cachePackagePath: join76(installDir, "package.json"),
|
|
100089
100173
|
packageCandidates: [
|
|
100090
100174
|
{
|
|
100091
100175
|
packageName,
|
|
100092
|
-
installedPackagePath:
|
|
100176
|
+
installedPackagePath: join76(installDir, "node_modules", packageName, "package.json")
|
|
100093
100177
|
}
|
|
100094
100178
|
]
|
|
100095
100179
|
});
|
|
@@ -100134,13 +100218,13 @@ function getLoadedPluginVersion() {
|
|
|
100134
100218
|
const candidates = [
|
|
100135
100219
|
{
|
|
100136
100220
|
cacheDir: configDir,
|
|
100137
|
-
cachePackagePath:
|
|
100221
|
+
cachePackagePath: join76(configDir, "package.json"),
|
|
100138
100222
|
packageCandidates: createPackageCandidates(configDir)
|
|
100139
100223
|
},
|
|
100140
100224
|
...createTaggedInstallCandidates(configDir),
|
|
100141
100225
|
{
|
|
100142
100226
|
cacheDir,
|
|
100143
|
-
cachePackagePath:
|
|
100227
|
+
cachePackagePath: join76(cacheDir, "package.json"),
|
|
100144
100228
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
100145
100229
|
},
|
|
100146
100230
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -100334,18 +100418,18 @@ async function checkSystem(deps = defaultDeps5) {
|
|
|
100334
100418
|
init_shared();
|
|
100335
100419
|
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "fs";
|
|
100336
100420
|
import { homedir as homedir17 } from "os";
|
|
100337
|
-
import { join as
|
|
100421
|
+
import { join as join77 } from "path";
|
|
100338
100422
|
function getUserConfigDir2() {
|
|
100339
100423
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
100340
100424
|
if (xdgConfig)
|
|
100341
|
-
return
|
|
100342
|
-
return
|
|
100425
|
+
return join77(xdgConfig, "opencode");
|
|
100426
|
+
return join77(homedir17(), ".config", "opencode");
|
|
100343
100427
|
}
|
|
100344
100428
|
function loadCustomProviderNames() {
|
|
100345
100429
|
const configDir = getUserConfigDir2();
|
|
100346
100430
|
const candidatePaths = [
|
|
100347
|
-
|
|
100348
|
-
|
|
100431
|
+
join77(configDir, "opencode.json"),
|
|
100432
|
+
join77(configDir, "opencode.jsonc")
|
|
100349
100433
|
];
|
|
100350
100434
|
for (const configPath of candidatePaths) {
|
|
100351
100435
|
if (!existsSync51(configPath))
|
|
@@ -100366,7 +100450,7 @@ function loadCustomProviderNames() {
|
|
|
100366
100450
|
return [];
|
|
100367
100451
|
}
|
|
100368
100452
|
function loadAvailableModelsFromCache() {
|
|
100369
|
-
const cacheFile =
|
|
100453
|
+
const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
|
|
100370
100454
|
const customProviders = loadCustomProviderNames();
|
|
100371
100455
|
if (!existsSync51(cacheFile)) {
|
|
100372
100456
|
if (customProviders.length > 0) {
|
|
@@ -100428,7 +100512,7 @@ function loadOmoConfig2() {
|
|
|
100428
100512
|
|
|
100429
100513
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
100430
100514
|
init_shared();
|
|
100431
|
-
import { join as
|
|
100515
|
+
import { join as join78 } from "path";
|
|
100432
100516
|
|
|
100433
100517
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
100434
100518
|
function formatModelWithVariant(model, variant) {
|
|
@@ -100470,7 +100554,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
100470
100554
|
}
|
|
100471
100555
|
function buildModelResolutionDetails(options) {
|
|
100472
100556
|
const details = [];
|
|
100473
|
-
const cacheFile =
|
|
100557
|
+
const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
|
|
100474
100558
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
100475
100559
|
details.push("");
|
|
100476
100560
|
if (options.available.cacheExists) {
|
|
@@ -100782,7 +100866,7 @@ init_src4();
|
|
|
100782
100866
|
init_main();
|
|
100783
100867
|
init_config_migration();
|
|
100784
100868
|
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
|
|
100785
|
-
import { join as
|
|
100869
|
+
import { join as join79 } from "path";
|
|
100786
100870
|
var CANONICAL_REPLACEMENT = new Map([
|
|
100787
100871
|
["variant", "reasoning"],
|
|
100788
100872
|
["reasoningEffort", "reasoning"],
|
|
@@ -100843,7 +100927,7 @@ function userConfigPaths() {
|
|
|
100843
100927
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
100844
100928
|
if (home === undefined || home.length === 0)
|
|
100845
100929
|
return [];
|
|
100846
|
-
return [
|
|
100930
|
+
return [join79(home, ".omo", "omo.jsonc"), join79(home, ".omo", "omo.json")];
|
|
100847
100931
|
}
|
|
100848
100932
|
async function checkDeprecatedReasoningKeys() {
|
|
100849
100933
|
const issues = [];
|
|
@@ -100869,25 +100953,25 @@ init_src();
|
|
|
100869
100953
|
import { existsSync as existsSync53 } from "fs";
|
|
100870
100954
|
import { createRequire as createRequire2 } from "module";
|
|
100871
100955
|
import { homedir as homedir19 } from "os";
|
|
100872
|
-
import { dirname as dirname31, join as
|
|
100956
|
+
import { dirname as dirname31, join as join81 } from "path";
|
|
100873
100957
|
|
|
100874
100958
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
100875
|
-
import { join as
|
|
100959
|
+
import { join as join80 } from "path";
|
|
100876
100960
|
import { homedir as homedir18, tmpdir as tmpdir4 } from "os";
|
|
100877
100961
|
init_binary_downloader();
|
|
100878
100962
|
init_logger2();
|
|
100879
100963
|
init_plugin_identity();
|
|
100880
100964
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
100881
|
-
var DEBUG_FILE =
|
|
100965
|
+
var DEBUG_FILE = join80(tmpdir4(), "comment-checker-debug.log");
|
|
100882
100966
|
function getCacheDir2() {
|
|
100883
100967
|
if (process.platform === "win32") {
|
|
100884
100968
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
100885
|
-
const base = localAppData ||
|
|
100886
|
-
return
|
|
100969
|
+
const base = localAppData || join80(homedir18(), "AppData", "Local");
|
|
100970
|
+
return join80(base, CACHE_DIR_NAME, "bin");
|
|
100887
100971
|
}
|
|
100888
100972
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
100889
|
-
const base = xdgCache ||
|
|
100890
|
-
return
|
|
100973
|
+
const base = xdgCache || join80(homedir18(), ".cache");
|
|
100974
|
+
return join80(base, CACHE_DIR_NAME, "bin");
|
|
100891
100975
|
}
|
|
100892
100976
|
function getBinaryName() {
|
|
100893
100977
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -100937,7 +101021,7 @@ async function getBinaryVersion(binary) {
|
|
|
100937
101021
|
}
|
|
100938
101022
|
}
|
|
100939
101023
|
async function checkAstGrepCli() {
|
|
100940
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
101024
|
+
const runtimeDir = astGrepRuntimeDir(join81(homedir19(), ".omo"));
|
|
100941
101025
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
100942
101026
|
if (sgPath === null) {
|
|
100943
101027
|
return {
|
|
@@ -100967,10 +101051,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
100967
101051
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
100968
101052
|
try {
|
|
100969
101053
|
const packageDir = baseDirOverride ?? dirname31(resolvePackageJsonPath());
|
|
100970
|
-
const vendorPath =
|
|
101054
|
+
const vendorPath = join81(packageDir, "vendor", platformKey, binaryName);
|
|
100971
101055
|
if (existsSync53(vendorPath))
|
|
100972
101056
|
return vendorPath;
|
|
100973
|
-
const binPath =
|
|
101057
|
+
const binPath = join81(packageDir, "bin", binaryName);
|
|
100974
101058
|
if (existsSync53(binPath))
|
|
100975
101059
|
return binPath;
|
|
100976
101060
|
} catch (error) {
|
|
@@ -101346,13 +101430,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
101346
101430
|
init_shared();
|
|
101347
101431
|
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "fs";
|
|
101348
101432
|
import { homedir as homedir20 } from "os";
|
|
101349
|
-
import { join as
|
|
101433
|
+
import { join as join82 } from "path";
|
|
101350
101434
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
101351
101435
|
function getMcpConfigPaths() {
|
|
101352
101436
|
return [
|
|
101353
|
-
|
|
101354
|
-
|
|
101355
|
-
|
|
101437
|
+
join82(homedir20(), ".claude", ".mcp.json"),
|
|
101438
|
+
join82(process.cwd(), ".mcp.json"),
|
|
101439
|
+
join82(process.cwd(), ".claude", ".mcp.json")
|
|
101356
101440
|
];
|
|
101357
101441
|
}
|
|
101358
101442
|
function loadUserMcpConfig() {
|
|
@@ -101632,9 +101716,9 @@ async function pathExists(dir) {
|
|
|
101632
101716
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
101633
101717
|
init_src();
|
|
101634
101718
|
import { existsSync as existsSync57 } from "fs";
|
|
101635
|
-
import { lstat as
|
|
101719
|
+
import { lstat as lstat16, readdir as readdir14, readFile as readFile28 } from "fs/promises";
|
|
101636
101720
|
import { homedir as homedir22 } from "os";
|
|
101637
|
-
import { basename as basename11, join as
|
|
101721
|
+
import { basename as basename11, join as join83, resolve as resolve23 } from "path";
|
|
101638
101722
|
// packages/omo-opencode/package.json
|
|
101639
101723
|
var package_default3 = {
|
|
101640
101724
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -101700,13 +101784,13 @@ var CODEX_BIN_NAMES = [
|
|
|
101700
101784
|
"omo-git-bash-hook"
|
|
101701
101785
|
];
|
|
101702
101786
|
async function gatherCodexSummary(deps = {}) {
|
|
101703
|
-
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
101787
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join83(homedir22(), ".codex"));
|
|
101704
101788
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
101705
101789
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
101706
101790
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
101707
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
101708
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
101709
|
-
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");
|
|
101710
101794
|
const pluginVersion = stringField(manifest, "version");
|
|
101711
101795
|
return {
|
|
101712
101796
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -101763,7 +101847,7 @@ function buildCodexIssues(summary) {
|
|
|
101763
101847
|
if (summary.pluginRoot === null) {
|
|
101764
101848
|
issues.push({
|
|
101765
101849
|
title: "OMO Codex plugin is not installed",
|
|
101766
|
-
description: `Expected cached plugin at ${
|
|
101850
|
+
description: `Expected cached plugin at ${join83("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
101767
101851
|
fix: "Run: npx lazycodex-ai install",
|
|
101768
101852
|
severity: "error",
|
|
101769
101853
|
affects: ["plugin loading"]
|
|
@@ -101828,12 +101912,12 @@ function buildCodexIssues(summary) {
|
|
|
101828
101912
|
return issues;
|
|
101829
101913
|
}
|
|
101830
101914
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
101831
|
-
const pluginRoot =
|
|
101915
|
+
const pluginRoot = join83(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
101832
101916
|
if (!existsSync57(pluginRoot))
|
|
101833
101917
|
return null;
|
|
101834
101918
|
const versions = await readdir14(pluginRoot, { withFileTypes: true });
|
|
101835
101919
|
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
101836
|
-
return candidates.length === 0 ? null :
|
|
101920
|
+
return candidates.length === 0 ? null : join83(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
101837
101921
|
}
|
|
101838
101922
|
async function readCodexConfigSummary(configPath) {
|
|
101839
101923
|
if (!existsSync57(configPath)) {
|
|
@@ -101847,7 +101931,7 @@ async function readCodexConfigSummary(configPath) {
|
|
|
101847
101931
|
companionLifecycleHookStateEvents: []
|
|
101848
101932
|
};
|
|
101849
101933
|
}
|
|
101850
|
-
const content = await
|
|
101934
|
+
const content = await readFile28(configPath, "utf8");
|
|
101851
101935
|
return {
|
|
101852
101936
|
exists: true,
|
|
101853
101937
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -101861,13 +101945,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
101861
101945
|
async function readLinkedBins(binDir) {
|
|
101862
101946
|
const linked = [];
|
|
101863
101947
|
for (const name of CODEX_BIN_NAMES) {
|
|
101864
|
-
if (await pathExists2(
|
|
101948
|
+
if (await pathExists2(join83(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
101865
101949
|
linked.push(name);
|
|
101866
101950
|
}
|
|
101867
101951
|
return linked;
|
|
101868
101952
|
}
|
|
101869
101953
|
async function readLinkedAgents(codexHome) {
|
|
101870
|
-
const agentsDir =
|
|
101954
|
+
const agentsDir = join83(codexHome, "agents");
|
|
101871
101955
|
if (!existsSync57(agentsDir))
|
|
101872
101956
|
return [];
|
|
101873
101957
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
@@ -101875,7 +101959,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
101875
101959
|
}
|
|
101876
101960
|
async function readJson(path) {
|
|
101877
101961
|
try {
|
|
101878
|
-
const parsed = JSON.parse(await
|
|
101962
|
+
const parsed = JSON.parse(await readFile28(path, "utf8"));
|
|
101879
101963
|
return isPlainRecord(parsed) ? parsed : null;
|
|
101880
101964
|
} catch (error) {
|
|
101881
101965
|
if (error instanceof Error)
|
|
@@ -101970,7 +102054,7 @@ function compareVersionsDescending(left, right) {
|
|
|
101970
102054
|
}
|
|
101971
102055
|
async function pathExists2(path) {
|
|
101972
102056
|
try {
|
|
101973
|
-
await
|
|
102057
|
+
await lstat16(path);
|
|
101974
102058
|
return true;
|
|
101975
102059
|
} catch (error) {
|
|
101976
102060
|
if (error instanceof Error)
|
|
@@ -101999,9 +102083,9 @@ function resolveLatestVersion(input) {
|
|
|
101999
102083
|
|
|
102000
102084
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
102001
102085
|
init_src();
|
|
102002
|
-
import { readdir as readdir15, readFile as
|
|
102086
|
+
import { readdir as readdir15, readFile as readFile29, stat as stat7 } from "fs/promises";
|
|
102003
102087
|
import { homedir as homedir23 } from "os";
|
|
102004
|
-
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";
|
|
102005
102089
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
102006
102090
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
102007
102091
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -102011,7 +102095,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
102011
102095
|
const env = deps.env ?? process.env;
|
|
102012
102096
|
const platform = deps.platform ?? process.platform;
|
|
102013
102097
|
const arch = deps.arch ?? process.arch;
|
|
102014
|
-
const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ??
|
|
102098
|
+
const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ?? join84(homedir23(), ".codex"));
|
|
102015
102099
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
102016
102100
|
if (summary.pluginRoot === null) {
|
|
102017
102101
|
return {
|
|
@@ -102036,7 +102120,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
102036
102120
|
});
|
|
102037
102121
|
}
|
|
102038
102122
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
102039
|
-
const runtimeSgPath =
|
|
102123
|
+
const runtimeSgPath = join84(runtimeSgDir, sgBinaryName(platform));
|
|
102040
102124
|
const sg = findSgBinarySync({
|
|
102041
102125
|
arch,
|
|
102042
102126
|
env,
|
|
@@ -102148,7 +102232,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
102148
102232
|
for (const entry of entries) {
|
|
102149
102233
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
102150
102234
|
continue;
|
|
102151
|
-
const entryPath =
|
|
102235
|
+
const entryPath = join84(root, entry.name);
|
|
102152
102236
|
if (entry.isDirectory()) {
|
|
102153
102237
|
paths.push(...await findManifestPaths(entryPath, manifestName));
|
|
102154
102238
|
continue;
|
|
@@ -102192,18 +102276,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
102192
102276
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute13(arg));
|
|
102193
102277
|
}
|
|
102194
102278
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
102195
|
-
return
|
|
102279
|
+
return join84(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
102196
102280
|
}
|
|
102197
102281
|
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
|
|
102198
102282
|
const override = env[SG_PATH_ENV_KEY]?.trim();
|
|
102199
102283
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
102200
102284
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
102201
|
-
if (sgPath ===
|
|
102285
|
+
if (sgPath === join84(runtimeSgDir, sgBinaryName(platform)))
|
|
102202
102286
|
return "runtime dir";
|
|
102203
102287
|
return "PATH";
|
|
102204
102288
|
}
|
|
102205
102289
|
async function readBootstrapStateSummary(codexHome) {
|
|
102206
|
-
const statePath =
|
|
102290
|
+
const statePath = join84(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
102207
102291
|
const raw = await readJson2(statePath);
|
|
102208
102292
|
if (raw === null)
|
|
102209
102293
|
return null;
|
|
@@ -102252,7 +102336,7 @@ function degradedDetailLines(entries) {
|
|
|
102252
102336
|
}
|
|
102253
102337
|
async function readJson2(path) {
|
|
102254
102338
|
try {
|
|
102255
|
-
const parsed = JSON.parse(await
|
|
102339
|
+
const parsed = JSON.parse(await readFile29(path, "utf8"));
|
|
102256
102340
|
return isRecord15(parsed) ? parsed : null;
|
|
102257
102341
|
} catch (error) {
|
|
102258
102342
|
if (error instanceof Error)
|
|
@@ -102280,18 +102364,18 @@ function isRecord15(value) {
|
|
|
102280
102364
|
|
|
102281
102365
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
102282
102366
|
import { existsSync as existsSync58 } from "fs";
|
|
102283
|
-
import { readFile as
|
|
102367
|
+
import { readFile as readFile30 } from "fs/promises";
|
|
102284
102368
|
import { homedir as homedir24 } from "os";
|
|
102285
|
-
import { join as
|
|
102369
|
+
import { join as join85, resolve as resolve25 } from "path";
|
|
102286
102370
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
102287
102371
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
102288
102372
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
102289
102373
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
102290
|
-
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
102374
|
+
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join85(homedir24(), ".codex"));
|
|
102291
102375
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
102292
102376
|
const platform = deps.platform ?? process.platform;
|
|
102293
|
-
const wrapperPath =
|
|
102294
|
-
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");
|
|
102295
102379
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
102296
102380
|
const issues = [];
|
|
102297
102381
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -102325,7 +102409,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
102325
102409
|
}
|
|
102326
102410
|
async function readRuntimeWrapper(path) {
|
|
102327
102411
|
try {
|
|
102328
|
-
return await
|
|
102412
|
+
return await readFile30(path, "utf8");
|
|
102329
102413
|
} catch (error) {
|
|
102330
102414
|
if (error instanceof Error)
|
|
102331
102415
|
return null;
|
|
@@ -102815,7 +102899,7 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
102815
102899
|
}
|
|
102816
102900
|
|
|
102817
102901
|
// packages/mcp-client-core/src/mcp-oauth/storage.ts
|
|
102818
|
-
import { createHash as
|
|
102902
|
+
import { createHash as createHash7 } from "crypto";
|
|
102819
102903
|
import {
|
|
102820
102904
|
chmodSync as chmodSync5,
|
|
102821
102905
|
existsSync as existsSync61,
|
|
@@ -102826,12 +102910,12 @@ import {
|
|
|
102826
102910
|
unlinkSync as unlinkSync9,
|
|
102827
102911
|
writeFileSync as writeFileSync12
|
|
102828
102912
|
} from "fs";
|
|
102829
|
-
import { basename as basename12, dirname as dirname34, join as
|
|
102913
|
+
import { basename as basename12, dirname as dirname34, join as join88 } from "path";
|
|
102830
102914
|
|
|
102831
102915
|
// packages/mcp-client-core/src/config-dir.ts
|
|
102832
102916
|
import { existsSync as existsSync59, realpathSync as realpathSync8 } from "fs";
|
|
102833
102917
|
import { homedir as homedir25 } from "os";
|
|
102834
|
-
import { join as
|
|
102918
|
+
import { join as join86, resolve as resolve26 } from "path";
|
|
102835
102919
|
function resolveConfigPath2(pathValue) {
|
|
102836
102920
|
const resolvedPath = resolve26(pathValue);
|
|
102837
102921
|
if (!existsSync59(resolvedPath))
|
|
@@ -102849,13 +102933,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
102849
102933
|
if (customConfigDir) {
|
|
102850
102934
|
return resolveConfigPath2(customConfigDir);
|
|
102851
102935
|
}
|
|
102852
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
102853
|
-
return resolveConfigPath2(
|
|
102936
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join86(homedir25(), ".config");
|
|
102937
|
+
return resolveConfigPath2(join86(xdgConfigDir, "opencode"));
|
|
102854
102938
|
}
|
|
102855
102939
|
|
|
102856
102940
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
102857
102941
|
import { chmodSync as chmodSync4, existsSync as existsSync60, readFileSync as readFileSync37, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "fs";
|
|
102858
|
-
import { join as
|
|
102942
|
+
import { join as join87 } from "path";
|
|
102859
102943
|
var INDEX_FILE_NAME = "index.json";
|
|
102860
102944
|
function isTokenIndex(value) {
|
|
102861
102945
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -102863,7 +102947,7 @@ function isTokenIndex(value) {
|
|
|
102863
102947
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
102864
102948
|
}
|
|
102865
102949
|
function getIndexPath(storageDir) {
|
|
102866
|
-
return
|
|
102950
|
+
return join87(storageDir, INDEX_FILE_NAME);
|
|
102867
102951
|
}
|
|
102868
102952
|
function readTokenIndex(storageDir) {
|
|
102869
102953
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -102907,16 +102991,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
|
|
|
102907
102991
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
102908
102992
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
102909
102993
|
function getMcpOauthStorageDir() {
|
|
102910
|
-
return
|
|
102994
|
+
return join88(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
102911
102995
|
}
|
|
102912
102996
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
102913
|
-
return
|
|
102997
|
+
return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
102914
102998
|
}
|
|
102915
102999
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
102916
|
-
return
|
|
103000
|
+
return join88(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
102917
103001
|
}
|
|
102918
103002
|
function getLegacyStoragePath() {
|
|
102919
|
-
return
|
|
103003
|
+
return join88(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
102920
103004
|
}
|
|
102921
103005
|
function normalizeHost2(serverHost) {
|
|
102922
103006
|
let host = serverHost.trim();
|
|
@@ -103095,7 +103179,7 @@ function listTokensByHost(serverHost) {
|
|
|
103095
103179
|
for (const [hash, indexedKey] of Object.entries(index)) {
|
|
103096
103180
|
if (!indexedKey.startsWith(prefix))
|
|
103097
103181
|
continue;
|
|
103098
|
-
const indexedToken = readTokenFile(
|
|
103182
|
+
const indexedToken = readTokenFile(join88(getMcpOauthStorageDir(), `${hash}.json`));
|
|
103099
103183
|
if (indexedToken)
|
|
103100
103184
|
result[indexedKey] = indexedToken;
|
|
103101
103185
|
}
|
|
@@ -103110,7 +103194,7 @@ function listAllTokens() {
|
|
|
103110
103194
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
103111
103195
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
103112
103196
|
continue;
|
|
103113
|
-
const token = readTokenFile(
|
|
103197
|
+
const token = readTokenFile(join88(dir, entry.name));
|
|
103114
103198
|
const hash = basename12(entry.name, ".json");
|
|
103115
103199
|
if (token)
|
|
103116
103200
|
result[index[hash] ?? hash] = token;
|
|
@@ -103284,13 +103368,13 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
|
|
|
103284
103368
|
|
|
103285
103369
|
// packages/mcp-client-core/src/mcp-oauth/oauth-authorization-flow.ts
|
|
103286
103370
|
import { spawn as spawn4 } from "child_process";
|
|
103287
|
-
import { createHash as
|
|
103371
|
+
import { createHash as createHash8, randomBytes as randomBytes2 } from "crypto";
|
|
103288
103372
|
import { createServer as createServer2 } from "http";
|
|
103289
103373
|
function generateCodeVerifier() {
|
|
103290
103374
|
return randomBytes2(32).toString("base64url");
|
|
103291
103375
|
}
|
|
103292
103376
|
function generateCodeChallenge(verifier) {
|
|
103293
|
-
return
|
|
103377
|
+
return createHash8("sha256").update(verifier).digest("base64url");
|
|
103294
103378
|
}
|
|
103295
103379
|
function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
103296
103380
|
const url = new URL(authorizationEndpoint);
|