lazycodex-ai 5.1.0 → 5.1.2
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/README.ja.md +3 -3
- package/README.ko.md +3 -3
- package/README.md +6 -4
- package/README.ru.md +3 -3
- package/README.zh-cn.md +3 -3
- package/dist/cli/index.js +685 -482
- package/dist/cli-node/index.js +685 -482
- package/package.json +1 -5
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +315 -154
- 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 -4
- 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/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +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/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-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/skills/browser/runtime/omowright/manifest.json +1 -1
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +1 -0
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +1 -0
- package/packages/omo-codex/plugin/skills/ulw-execute/SKILL.md +1 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +10441 -10269
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +1 -1
- package/packages/shared-skills/skills/refactor/SKILL.md +1 -0
- package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +1 -0
- package/packages/shared-skills/skills/ulw-execute/SKILL.md +1 -0
package/dist/cli-node/index.js
CHANGED
|
@@ -65,7 +65,7 @@ var package_default;
|
|
|
65
65
|
var init_package = __esm(() => {
|
|
66
66
|
package_default = {
|
|
67
67
|
name: "oh-my-opencode",
|
|
68
|
-
version: "5.1.
|
|
68
|
+
version: "5.1.2",
|
|
69
69
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
70
70
|
main: "./dist/index.js",
|
|
71
71
|
types: "dist/index.d.ts",
|
|
@@ -236,25 +236,14 @@ var init_package = __esm(() => {
|
|
|
236
236
|
},
|
|
237
237
|
homepage: "https://github.com/code-yeongyu/oh-my-openagent#readme",
|
|
238
238
|
dependencies: {
|
|
239
|
-
"@clack/prompts": "^1.8.1",
|
|
240
|
-
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
241
|
-
"@opencode-ai/plugin": "1.18.31",
|
|
242
|
-
"@opencode-ai/sdk": "1.18.31",
|
|
243
|
-
"@opentui/core": "^0.5.11",
|
|
244
|
-
"@opentui/keymap": "^0.5.11",
|
|
245
239
|
"@opentui/solid": "^0.5.11",
|
|
246
|
-
commander: "^15.0.0",
|
|
247
240
|
"detect-libc": "^2.1.2",
|
|
248
|
-
diff: "^9.0.0",
|
|
249
|
-
"js-yaml": "^5.4.2",
|
|
250
|
-
"jsonc-parser": "^3.3.1",
|
|
251
|
-
picocolors: "^1.1.1",
|
|
252
|
-
picomatch: "^4.0.7",
|
|
253
|
-
"posthog-node": "^5.52.4",
|
|
254
241
|
zod: "^4.6.5"
|
|
255
242
|
},
|
|
256
243
|
devDependencies: {
|
|
257
|
-
"@
|
|
244
|
+
"@clack/prompts": "^1.8.1",
|
|
245
|
+
"@code-yeongyu/senpi": "2026.9.29-3",
|
|
246
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
258
247
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
259
248
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
260
249
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -288,36 +277,43 @@ var init_package = __esm(() => {
|
|
|
288
277
|
"@oh-my-opencode/telemetry-core": "workspace:*",
|
|
289
278
|
"@oh-my-opencode/tmux-core": "workspace:*",
|
|
290
279
|
"@oh-my-opencode/utils": "workspace:*",
|
|
280
|
+
"@opencode-ai/plugin": "1.18.31",
|
|
281
|
+
"@opencode-ai/sdk": "1.18.31",
|
|
282
|
+
"@opentui/core": "^0.5.11",
|
|
283
|
+
"@opentui/keymap": "^0.5.11",
|
|
291
284
|
"@types/js-yaml": "^4.0.9",
|
|
292
285
|
"@types/picomatch": "^4.0.3",
|
|
293
286
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
294
287
|
"@xterm/addon-unicode11": "^0.9.0",
|
|
295
288
|
"@xterm/xterm": "^6.0.0",
|
|
296
289
|
"bun-types": "1.4.2",
|
|
290
|
+
commander: "^15.0.0",
|
|
291
|
+
diff: "^9.0.0",
|
|
292
|
+
"js-yaml": "^5.4.2",
|
|
293
|
+
"jsonc-parser": "^3.3.1",
|
|
297
294
|
"node-pty": "^1.1.0",
|
|
298
295
|
omowright: "github:code-yeongyu/omowright#293ca5002cbd4c8b0c104c5934683385ef7e0d3a",
|
|
296
|
+
picocolors: "^1.1.1",
|
|
297
|
+
picomatch: "^4.0.7",
|
|
298
|
+
"posthog-node": "^5.52.4",
|
|
299
299
|
"puppeteer-core": "^25.11.0",
|
|
300
300
|
typescript: "^7.0.2"
|
|
301
301
|
},
|
|
302
302
|
optionalDependencies: {
|
|
303
|
-
"oh-my-opencode-darwin-arm64": "5.1.
|
|
304
|
-
"oh-my-opencode-darwin-x64": "5.1.
|
|
305
|
-
"oh-my-opencode-darwin-x64-baseline": "5.1.
|
|
306
|
-
"oh-my-opencode-linux-arm64": "5.1.
|
|
307
|
-
"oh-my-opencode-linux-arm64-musl": "5.1.
|
|
308
|
-
"oh-my-opencode-linux-x64": "5.1.
|
|
309
|
-
"oh-my-opencode-linux-x64-baseline": "5.1.
|
|
310
|
-
"oh-my-opencode-linux-x64-musl": "5.1.
|
|
311
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.1.
|
|
312
|
-
"oh-my-opencode-windows-arm64": "5.1.
|
|
313
|
-
"oh-my-opencode-windows-x64": "5.1.
|
|
314
|
-
"oh-my-opencode-windows-x64-baseline": "5.1.
|
|
303
|
+
"oh-my-opencode-darwin-arm64": "5.1.2",
|
|
304
|
+
"oh-my-opencode-darwin-x64": "5.1.2",
|
|
305
|
+
"oh-my-opencode-darwin-x64-baseline": "5.1.2",
|
|
306
|
+
"oh-my-opencode-linux-arm64": "5.1.2",
|
|
307
|
+
"oh-my-opencode-linux-arm64-musl": "5.1.2",
|
|
308
|
+
"oh-my-opencode-linux-x64": "5.1.2",
|
|
309
|
+
"oh-my-opencode-linux-x64-baseline": "5.1.2",
|
|
310
|
+
"oh-my-opencode-linux-x64-musl": "5.1.2",
|
|
311
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.1.2",
|
|
312
|
+
"oh-my-opencode-windows-arm64": "5.1.2",
|
|
313
|
+
"oh-my-opencode-windows-x64": "5.1.2",
|
|
314
|
+
"oh-my-opencode-windows-x64-baseline": "5.1.2"
|
|
315
315
|
},
|
|
316
316
|
overrides: {
|
|
317
|
-
"@earendil-works/pi-agent-core": "0.84.2",
|
|
318
|
-
"@earendil-works/pi-ai": "0.84.2",
|
|
319
|
-
"@earendil-works/pi-coding-agent": "0.84.2",
|
|
320
|
-
"@earendil-works/pi-tui": "0.84.2",
|
|
321
317
|
hono: "^4.13.8",
|
|
322
318
|
"@hono/node-server": "2.1.1",
|
|
323
319
|
"express-rate-limit": "^8.7.0",
|
|
@@ -7397,12 +7393,12 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7397
7393
|
},
|
|
7398
7394
|
"deep-low": {
|
|
7399
7395
|
fallbackChain: [
|
|
7400
|
-
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.6-sol-fast", variant: "medium" },
|
|
7401
7396
|
{
|
|
7402
7397
|
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
7403
7398
|
model: "gpt-5.6-sol",
|
|
7404
7399
|
variant: "medium"
|
|
7405
|
-
}
|
|
7400
|
+
},
|
|
7401
|
+
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.6-sol-fast", variant: "medium" }
|
|
7406
7402
|
]
|
|
7407
7403
|
},
|
|
7408
7404
|
"deep-high": {
|
|
@@ -7454,6 +7450,11 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7454
7450
|
},
|
|
7455
7451
|
"unspecified-low": {
|
|
7456
7452
|
fallbackChain: [
|
|
7453
|
+
{
|
|
7454
|
+
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
7455
|
+
model: "claude-sonnet-5-5",
|
|
7456
|
+
variant: "medium"
|
|
7457
|
+
},
|
|
7457
7458
|
{ providers: ["xiaomi", "opencode-go"], model: "mimo-v2.6-pro", variant: "max" },
|
|
7458
7459
|
{ providers: ["xai", "github-copilot", "opencode-go"], model: "grok-4.7", variant: "xhigh" },
|
|
7459
7460
|
{
|
|
@@ -8390,6 +8391,36 @@ var init_supplemental_entries = __esm(() => {
|
|
|
8390
8391
|
output: 32768
|
|
8391
8392
|
}
|
|
8392
8393
|
},
|
|
8394
|
+
"claude-sonnet-5-5": {
|
|
8395
|
+
id: "claude-sonnet-5-5",
|
|
8396
|
+
family: "claude-sonnet",
|
|
8397
|
+
reasoning: true,
|
|
8398
|
+
temperature: false,
|
|
8399
|
+
toolCall: true,
|
|
8400
|
+
modalities: {
|
|
8401
|
+
input: ["text", "image", "pdf"],
|
|
8402
|
+
output: ["text"]
|
|
8403
|
+
},
|
|
8404
|
+
limit: {
|
|
8405
|
+
context: 1e6,
|
|
8406
|
+
output: 128000
|
|
8407
|
+
}
|
|
8408
|
+
},
|
|
8409
|
+
"anthropic/claude-sonnet-5-5": {
|
|
8410
|
+
id: "anthropic/claude-sonnet-5-5",
|
|
8411
|
+
family: "claude-sonnet",
|
|
8412
|
+
reasoning: true,
|
|
8413
|
+
temperature: false,
|
|
8414
|
+
toolCall: true,
|
|
8415
|
+
modalities: {
|
|
8416
|
+
input: ["text", "image", "pdf"],
|
|
8417
|
+
output: ["text"]
|
|
8418
|
+
},
|
|
8419
|
+
limit: {
|
|
8420
|
+
context: 1e6,
|
|
8421
|
+
output: 128000
|
|
8422
|
+
}
|
|
8423
|
+
},
|
|
8393
8424
|
"grok-4.7": {
|
|
8394
8425
|
id: "grok-4.7",
|
|
8395
8426
|
family: "grok",
|
|
@@ -9435,7 +9466,7 @@ var init_openai_categories = __esm(() => {
|
|
|
9435
9466
|
},
|
|
9436
9467
|
{
|
|
9437
9468
|
name: "deep-low",
|
|
9438
|
-
config: { model: "openai/gpt-5.6-sol
|
|
9469
|
+
config: { model: "openai/gpt-5.6-sol", variant: "medium" },
|
|
9439
9470
|
description: "Default deep lane: one goal, one deliverable, decisions the child can settle from what it reads. **3D graphics, computer/browser use, CAPTCHA, multimodal, backend, logic, and algorithm work is routed here.** Multiple goals fan out as parallel calls.",
|
|
9440
9471
|
callerGuidance: DEEP_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
9441
9472
|
promptAppend: DEEP_LOW_CATEGORY_PROMPT_APPEND,
|
|
@@ -9460,7 +9491,7 @@ var init_openai_categories = __esm(() => {
|
|
|
9460
9491
|
},
|
|
9461
9492
|
{
|
|
9462
9493
|
name: "unspecified-low",
|
|
9463
|
-
config: { model: "
|
|
9494
|
+
config: { model: "anthropic/claude-sonnet-5-5", variant: "medium" },
|
|
9464
9495
|
description: "Tasks that don't fit other categories, low effort required",
|
|
9465
9496
|
callerGuidance: UNSPECIFIED_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
9466
9497
|
promptAppend: UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND
|
|
@@ -74781,6 +74812,7 @@ var init_task = __esm(() => {
|
|
|
74781
74812
|
process_runner: _enum(["host", "child-process"]).default("host"),
|
|
74782
74813
|
host_engine_policy: _enum(["upgrade", "fallback"]).default("upgrade"),
|
|
74783
74814
|
host_idle_exit_ms: number2().int().positive().optional(),
|
|
74815
|
+
host_shard_prewarm: _enum(["off", "first-turn", "session-start"]).default("first-turn"),
|
|
74784
74816
|
default_concurrency: number2().int().nonnegative().default(5),
|
|
74785
74817
|
global_concurrency: number2().int().nonnegative().default(8),
|
|
74786
74818
|
provider_concurrency: record(string2(), number2().int().nonnegative()).optional(),
|
|
@@ -74830,6 +74862,7 @@ var init_task = __esm(() => {
|
|
|
74830
74862
|
process_runner: _enum(["host", "child-process"]).optional(),
|
|
74831
74863
|
host_engine_policy: _enum(["upgrade", "fallback"]).optional(),
|
|
74832
74864
|
host_idle_exit_ms: number2().int().positive().optional(),
|
|
74865
|
+
host_shard_prewarm: _enum(["off", "first-turn", "session-start"]).optional(),
|
|
74833
74866
|
default_concurrency: number2().int().nonnegative().optional(),
|
|
74834
74867
|
global_concurrency: number2().int().nonnegative().optional(),
|
|
74835
74868
|
provider_concurrency: record(string2(), number2().int().nonnegative()).optional(),
|
|
@@ -79190,9 +79223,9 @@ function extractChannel(version) {
|
|
|
79190
79223
|
|
|
79191
79224
|
// packages/telemetry-core/src/day-claim.ts
|
|
79192
79225
|
import { closeSync as closeSync3, mkdirSync as mkdirSync9, openSync as openSync3, readdirSync as readdirSync8, rmSync as rmSync3 } from "node:fs";
|
|
79193
|
-
import { join as
|
|
79226
|
+
import { join as join53 } from "node:path";
|
|
79194
79227
|
function getTelemetryDayClaimFilePath(stateDir, dayUTC) {
|
|
79195
|
-
return
|
|
79228
|
+
return join53(stateDir, `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`);
|
|
79196
79229
|
}
|
|
79197
79230
|
function claimUtcDay(stateDir, dayUTC) {
|
|
79198
79231
|
try {
|
|
@@ -79218,7 +79251,7 @@ function pruneSupersededClaims(stateDir, dayUTC) {
|
|
|
79218
79251
|
if (!entry.startsWith(CLAIM_PREFIX) || !entry.endsWith(CLAIM_SUFFIX))
|
|
79219
79252
|
continue;
|
|
79220
79253
|
try {
|
|
79221
|
-
rmSync3(
|
|
79254
|
+
rmSync3(join53(stateDir, entry), { force: true });
|
|
79222
79255
|
} catch {}
|
|
79223
79256
|
}
|
|
79224
79257
|
}
|
|
@@ -79227,20 +79260,20 @@ var init_day_claim = () => {};
|
|
|
79227
79260
|
|
|
79228
79261
|
// packages/telemetry-core/src/activity-state.ts
|
|
79229
79262
|
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync12 } from "node:fs";
|
|
79230
|
-
import { basename as basename9, join as
|
|
79263
|
+
import { basename as basename9, join as join54 } from "node:path";
|
|
79231
79264
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
79232
79265
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
79233
79266
|
env: options.env,
|
|
79234
79267
|
osProvider: options.osProvider
|
|
79235
79268
|
});
|
|
79236
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
79269
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join54(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
79237
79270
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename9(dataDir) === product.cacheDirName) {
|
|
79238
79271
|
return dataDir;
|
|
79239
79272
|
}
|
|
79240
|
-
return
|
|
79273
|
+
return join54(dataDir, product.cacheDirName);
|
|
79241
79274
|
}
|
|
79242
79275
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
79243
|
-
return
|
|
79276
|
+
return join54(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
79244
79277
|
}
|
|
79245
79278
|
function getDailyActiveCaptureState(input) {
|
|
79246
79279
|
const dayUTC = getUtcDayString(input.now ?? new Date);
|
|
@@ -79321,9 +79354,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
79321
79354
|
|
|
79322
79355
|
// packages/telemetry-core/src/diagnostics.ts
|
|
79323
79356
|
import { appendFileSync as appendFileSync2, existsSync as existsSync26, mkdirSync as mkdirSync11, readFileSync as readFileSync13 } from "node:fs";
|
|
79324
|
-
import { join as
|
|
79357
|
+
import { join as join55 } from "node:path";
|
|
79325
79358
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
79326
|
-
return
|
|
79359
|
+
return join55(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
79327
79360
|
}
|
|
79328
79361
|
function writeTelemetryDiagnostic(input, options) {
|
|
79329
79362
|
const now = options.now ?? new Date;
|
|
@@ -89066,7 +89099,7 @@ var package_default2;
|
|
|
89066
89099
|
var init_package2 = __esm(() => {
|
|
89067
89100
|
package_default2 = {
|
|
89068
89101
|
name: "@oh-my-opencode/omo-codex",
|
|
89069
|
-
version: "5.1.
|
|
89102
|
+
version: "5.1.2",
|
|
89070
89103
|
type: "module",
|
|
89071
89104
|
private: true,
|
|
89072
89105
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -90038,7 +90071,7 @@ var init_update_toasts = __esm(() => {
|
|
|
90038
90071
|
|
|
90039
90072
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
90040
90073
|
import { existsSync as existsSync48 } from "node:fs";
|
|
90041
|
-
import { dirname as dirname32, join as
|
|
90074
|
+
import { dirname as dirname32, join as join79 } from "node:path";
|
|
90042
90075
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
90043
90076
|
function defaultGetModuleHostingWorkspace() {
|
|
90044
90077
|
try {
|
|
@@ -90198,7 +90231,7 @@ var init_background_update_check = __esm(() => {
|
|
|
90198
90231
|
init_update_toasts();
|
|
90199
90232
|
defaultDeps4 = {
|
|
90200
90233
|
existsSync: existsSync48,
|
|
90201
|
-
join:
|
|
90234
|
+
join: join79,
|
|
90202
90235
|
runBunInstallWithDetails,
|
|
90203
90236
|
log: log2,
|
|
90204
90237
|
getOpenCodeCacheDir,
|
|
@@ -92654,19 +92687,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
92654
92687
|
}
|
|
92655
92688
|
|
|
92656
92689
|
// packages/omo-codex/src/install/install-codex.ts
|
|
92657
|
-
import { join as
|
|
92658
|
-
|
|
92659
|
-
// packages/omo-codex/src/install/codex-default-role-config.ts
|
|
92660
|
-
init_src4();
|
|
92661
|
-
function readDefaultRoleConfig(options = {}) {
|
|
92662
|
-
const result = loadOmoConfig({ ...options, harness: "codex" });
|
|
92663
|
-
return {
|
|
92664
|
-
enabled: result.config.agents?.default?.disable !== true,
|
|
92665
|
-
warnings: result.diagnostics.map((diagnostic) => diagnostic.message)
|
|
92666
|
-
};
|
|
92667
|
-
}
|
|
92668
|
-
|
|
92669
|
-
// packages/omo-codex/src/install/install-codex.ts
|
|
92690
|
+
import { join as join56, resolve as resolve13 } from "node:path";
|
|
92670
92691
|
import { existsSync as existsSync27 } from "node:fs";
|
|
92671
92692
|
import { homedir as homedir6 } from "node:os";
|
|
92672
92693
|
|
|
@@ -95567,13 +95588,126 @@ function toCodexResolution(resolution) {
|
|
|
95567
95588
|
};
|
|
95568
95589
|
}
|
|
95569
95590
|
|
|
95591
|
+
// packages/omo-codex/src/install/codex-agent-config.ts
|
|
95592
|
+
init_src4();
|
|
95593
|
+
init_reasoning_vocabulary();
|
|
95594
|
+
function readCodexAgentConfig(options = {}) {
|
|
95595
|
+
const result = loadOmoConfig({ ...options, harness: "codex" });
|
|
95596
|
+
const overrides = readAgentOverrides(result);
|
|
95597
|
+
return {
|
|
95598
|
+
defaultRoleEnabled: result.config.agents?.default?.disable !== true,
|
|
95599
|
+
agentOverrides: overrides.agentOverrides,
|
|
95600
|
+
warnings: [...result.diagnostics.map((diagnostic) => diagnostic.message), ...overrides.warnings]
|
|
95601
|
+
};
|
|
95602
|
+
}
|
|
95603
|
+
function unmanagedAgentOverrideWarnings(agentOverrides, managedAgentNames) {
|
|
95604
|
+
return [...agentOverrides.keys()].filter((name) => !managedAgentNames.has(name)).map((name) => `[codex].agents.${name} does not name a LazyCodex-managed agent role; its model override was not applied`);
|
|
95605
|
+
}
|
|
95606
|
+
function readAgentOverrides(result) {
|
|
95607
|
+
let merged = {};
|
|
95608
|
+
for (const layer of result.layers)
|
|
95609
|
+
merged = mergeOmoConfigRecords(merged, layer.config);
|
|
95610
|
+
const profile = result.profile === undefined ? undefined : recordAt2(recordAt2(merged, "profiles"), result.profile);
|
|
95611
|
+
let agents = {};
|
|
95612
|
+
for (const scope of [merged, profile]) {
|
|
95613
|
+
agents = mergeOmoConfigRecords(agents, recordAt2(recordAt2(scope, "[codex]"), "agents") ?? {});
|
|
95614
|
+
}
|
|
95615
|
+
const agentOverrides = new Map;
|
|
95616
|
+
const warnings = [];
|
|
95617
|
+
for (const [name, value] of Object.entries(agents)) {
|
|
95618
|
+
if (name === "default")
|
|
95619
|
+
continue;
|
|
95620
|
+
const parsed = OmoAgentDefSchema.safeParse(value);
|
|
95621
|
+
if (!parsed.success) {
|
|
95622
|
+
warnings.push(`[codex].agents.${name} is invalid and was ignored: ${parsed.error.issues[0]?.message ?? "unknown error"}`);
|
|
95623
|
+
continue;
|
|
95624
|
+
}
|
|
95625
|
+
const override = toCodexAgentOverride(parsed.data.model, parsed.data.reasoning);
|
|
95626
|
+
if (override.model !== undefined || override.reasoningEffort !== undefined)
|
|
95627
|
+
agentOverrides.set(name, override);
|
|
95628
|
+
}
|
|
95629
|
+
return { agentOverrides, warnings };
|
|
95630
|
+
}
|
|
95631
|
+
function toCodexAgentOverride(model, reasoning) {
|
|
95632
|
+
const split = model === undefined ? undefined : splitReasoningSuffix2(model);
|
|
95633
|
+
const effort = codexReasoningEffort(reasoning ?? split?.level);
|
|
95634
|
+
return {
|
|
95635
|
+
...split === undefined || split.base === "" ? {} : { model: split.base },
|
|
95636
|
+
...effort === undefined ? {} : { reasoningEffort: effort }
|
|
95637
|
+
};
|
|
95638
|
+
}
|
|
95639
|
+
function codexReasoningEffort(reasoning) {
|
|
95640
|
+
if (reasoning === undefined || reasoning === "auto")
|
|
95641
|
+
return;
|
|
95642
|
+
return reasoning === "off" ? "none" : reasoning;
|
|
95643
|
+
}
|
|
95644
|
+
function recordAt2(value, key) {
|
|
95645
|
+
if (!isPlainRecord4(value))
|
|
95646
|
+
return;
|
|
95647
|
+
const child = value[key];
|
|
95648
|
+
return isPlainRecord4(child) ? child : undefined;
|
|
95649
|
+
}
|
|
95650
|
+
|
|
95651
|
+
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
95652
|
+
import { cp as cp3, mkdir as mkdir6, rename as rename4, rm as rm7, writeFile as writeFile6 } from "node:fs/promises";
|
|
95653
|
+
import { join as join39, sep as sep6 } from "node:path";
|
|
95654
|
+
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
95655
|
+
async function writeInstalledMarketplaceSnapshot(input) {
|
|
95656
|
+
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
95657
|
+
await mkdir6(marketplaceRoot, { recursive: true });
|
|
95658
|
+
await writeMarketplaceManifest(marketplaceRoot, input.marketplace);
|
|
95659
|
+
const snapshotPlugins = [];
|
|
95660
|
+
for (const plugin of input.plugins) {
|
|
95661
|
+
snapshotPlugins.push(await writeSnapshotPlugin(marketplaceRoot, plugin));
|
|
95662
|
+
}
|
|
95663
|
+
return snapshotPlugins;
|
|
95664
|
+
}
|
|
95665
|
+
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
95666
|
+
return join39(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
95667
|
+
}
|
|
95668
|
+
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
95669
|
+
const manifestDir = join39(marketplaceRoot, ".agents", "plugins");
|
|
95670
|
+
await mkdir6(manifestDir, { recursive: true });
|
|
95671
|
+
const tempPath = join39(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
95672
|
+
await writeFile6(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
95673
|
+
`);
|
|
95674
|
+
await rename4(tempPath, join39(manifestDir, "marketplace.json"));
|
|
95675
|
+
}
|
|
95676
|
+
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
95677
|
+
const pluginsDir = join39(marketplaceRoot, "plugins");
|
|
95678
|
+
await mkdir6(pluginsDir, { recursive: true });
|
|
95679
|
+
const targetPath = join39(pluginsDir, plugin.name);
|
|
95680
|
+
const tempPath = join39(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
95681
|
+
await rm7(tempPath, { recursive: true, force: true });
|
|
95682
|
+
await cp3(plugin.sourcePath, tempPath, {
|
|
95683
|
+
recursive: true,
|
|
95684
|
+
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
95685
|
+
});
|
|
95686
|
+
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
95687
|
+
await rm7(targetPath, { recursive: true, force: true });
|
|
95688
|
+
await rename4(tempPath, targetPath);
|
|
95689
|
+
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
95690
|
+
return { name: plugin.name, path: targetPath };
|
|
95691
|
+
}
|
|
95692
|
+
function shouldCopyMarketplaceSourcePath(path, root) {
|
|
95693
|
+
const relative = path === root ? "" : path.slice(root.length + sep6.length);
|
|
95694
|
+
if (relative === "")
|
|
95695
|
+
return true;
|
|
95696
|
+
const parts = relative.split(sep6);
|
|
95697
|
+
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
95698
|
+
}
|
|
95699
|
+
|
|
95570
95700
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
95571
|
-
import { copyFile, lstat as lstat10, mkdir as
|
|
95572
|
-
import { basename as basename7, join as
|
|
95701
|
+
import { copyFile, lstat as lstat10, mkdir as mkdir7, readdir as readdir7, readFile as readFile17, rm as rm11, writeFile as writeFile9 } from "node:fs/promises";
|
|
95702
|
+
import { basename as basename7, join as join44 } from "node:path";
|
|
95703
|
+
|
|
95704
|
+
// packages/omo-codex/src/install/agent-model-overrides.ts
|
|
95705
|
+
import { readFile as readFile14, rm as rm8, writeFile as writeFile8 } from "node:fs/promises";
|
|
95706
|
+
import { join as join41 } from "node:path";
|
|
95573
95707
|
|
|
95574
95708
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
95575
|
-
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as
|
|
95576
|
-
import { join as
|
|
95709
|
+
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile7 } from "node:fs/promises";
|
|
95710
|
+
import { join as join40 } from "node:path";
|
|
95577
95711
|
|
|
95578
95712
|
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
|
|
95579
95713
|
var MANAGED_REASONING_DEFAULT_UPGRADES = new Map([
|
|
@@ -95766,7 +95900,7 @@ function resolveManagedAgentReasoning(input) {
|
|
|
95766
95900
|
|
|
95767
95901
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
95768
95902
|
async function capturePreservedAgentReasoning(input) {
|
|
95769
|
-
const agentsDir =
|
|
95903
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
95770
95904
|
if (!await exists2(agentsDir))
|
|
95771
95905
|
return new Map;
|
|
95772
95906
|
const preserved = new Map;
|
|
@@ -95774,7 +95908,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
95774
95908
|
for (const entry of agentEntries) {
|
|
95775
95909
|
if (!entry.name.endsWith(".toml"))
|
|
95776
95910
|
continue;
|
|
95777
|
-
const content = await readTextIfExists(
|
|
95911
|
+
const content = await readTextIfExists(join40(agentsDir, entry.name));
|
|
95778
95912
|
if (content === null)
|
|
95779
95913
|
continue;
|
|
95780
95914
|
const effort = extractReasoningEffort(content);
|
|
@@ -95788,7 +95922,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
95788
95922
|
return preserved;
|
|
95789
95923
|
}
|
|
95790
95924
|
async function capturePreservedAgentServiceTier(input) {
|
|
95791
|
-
const agentsDir =
|
|
95925
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
95792
95926
|
if (!await exists2(agentsDir))
|
|
95793
95927
|
return new Map;
|
|
95794
95928
|
const preserved = new Map;
|
|
@@ -95796,7 +95930,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
95796
95930
|
for (const entry of agentEntries) {
|
|
95797
95931
|
if (!entry.name.endsWith(".toml"))
|
|
95798
95932
|
continue;
|
|
95799
|
-
const content = await readTextIfExists(
|
|
95933
|
+
const content = await readTextIfExists(join40(agentsDir, entry.name));
|
|
95800
95934
|
if (content === null)
|
|
95801
95935
|
continue;
|
|
95802
95936
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -95819,7 +95953,7 @@ async function restorePreservedReasoning(input) {
|
|
|
95819
95953
|
const replacement = replaceTopLevelStringSetting(content, "model_reasoning_effort", effort, { insertIfMissing: false });
|
|
95820
95954
|
if (!replacement.replaced)
|
|
95821
95955
|
return;
|
|
95822
|
-
await
|
|
95956
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95823
95957
|
}
|
|
95824
95958
|
async function restorePreservedServiceTier(input) {
|
|
95825
95959
|
if (!input.preserved)
|
|
@@ -95830,7 +95964,18 @@ async function restorePreservedServiceTier(input) {
|
|
|
95830
95964
|
const replacement = replaceTopLevelStringSetting(content, "service_tier", input.value, { insertIfMissing: true });
|
|
95831
95965
|
if (!replacement.replaced)
|
|
95832
95966
|
return;
|
|
95833
|
-
await
|
|
95967
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95968
|
+
}
|
|
95969
|
+
async function restorePreservedModel(input) {
|
|
95970
|
+
if (input.value === null)
|
|
95971
|
+
return;
|
|
95972
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
95973
|
+
if (extractModel(content) === input.value)
|
|
95974
|
+
return;
|
|
95975
|
+
const replacement = replaceTopLevelStringSetting(content, "model", input.value, { insertIfMissing: true });
|
|
95976
|
+
if (!replacement.replaced)
|
|
95977
|
+
return;
|
|
95978
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95834
95979
|
}
|
|
95835
95980
|
async function readTextIfExists(path) {
|
|
95836
95981
|
try {
|
|
@@ -95928,9 +96073,86 @@ function nodeErrorCode(error) {
|
|
|
95928
96073
|
return typeof error.code === "string" ? error.code : null;
|
|
95929
96074
|
}
|
|
95930
96075
|
|
|
96076
|
+
// packages/omo-codex/src/install/agent-model-overrides.ts
|
|
96077
|
+
var RECEIPT_FILE = ".lazycodex-agent-models.json";
|
|
96078
|
+
async function readAgentModelReceipts(codexHome) {
|
|
96079
|
+
const content = await readTextIfExists(receiptPath(codexHome));
|
|
96080
|
+
if (content === null)
|
|
96081
|
+
return new Map;
|
|
96082
|
+
const parsed = parseJson(content);
|
|
96083
|
+
if (!isPlainRecord4(parsed))
|
|
96084
|
+
return new Map;
|
|
96085
|
+
const receipts = new Map;
|
|
96086
|
+
for (const [name, value] of Object.entries(parsed)) {
|
|
96087
|
+
if (!isPlainRecord4(value))
|
|
96088
|
+
continue;
|
|
96089
|
+
const model = value["model"];
|
|
96090
|
+
const reasoningEffort = value["reasoningEffort"];
|
|
96091
|
+
receipts.set(name, {
|
|
96092
|
+
...typeof model === "string" ? { model } : {},
|
|
96093
|
+
...typeof reasoningEffort === "string" ? { reasoningEffort } : {}
|
|
96094
|
+
});
|
|
96095
|
+
}
|
|
96096
|
+
return receipts;
|
|
96097
|
+
}
|
|
96098
|
+
async function writeAgentModelReceipts(codexHome, receipts) {
|
|
96099
|
+
const path = receiptPath(codexHome);
|
|
96100
|
+
if (receipts.size === 0) {
|
|
96101
|
+
await rm8(path, { force: true });
|
|
96102
|
+
return;
|
|
96103
|
+
}
|
|
96104
|
+
await writeFile8(path, `${JSON.stringify(Object.fromEntries(receipts), null, "\t")}
|
|
96105
|
+
`);
|
|
96106
|
+
}
|
|
96107
|
+
async function applyAgentOverride(input) {
|
|
96108
|
+
if (input.override === undefined)
|
|
96109
|
+
return;
|
|
96110
|
+
let content = await readFile14(input.linkPath, "utf8");
|
|
96111
|
+
if (input.override.model !== undefined) {
|
|
96112
|
+
content = replaceTopLevelStringSetting(content, "model", input.override.model, { insertIfMissing: true }).content;
|
|
96113
|
+
}
|
|
96114
|
+
if (input.override.reasoningEffort !== undefined) {
|
|
96115
|
+
content = replaceTopLevelStringSetting(content, "model_reasoning_effort", input.override.reasoningEffort, {
|
|
96116
|
+
insertIfMissing: true
|
|
96117
|
+
}).content;
|
|
96118
|
+
}
|
|
96119
|
+
await writeFile8(input.linkPath, content);
|
|
96120
|
+
}
|
|
96121
|
+
function receiptPath(codexHome) {
|
|
96122
|
+
return join41(codexHome, "agents", RECEIPT_FILE);
|
|
96123
|
+
}
|
|
96124
|
+
function parseJson(content) {
|
|
96125
|
+
try {
|
|
96126
|
+
return JSON.parse(content);
|
|
96127
|
+
} catch (error) {
|
|
96128
|
+
if (error instanceof SyntaxError)
|
|
96129
|
+
return null;
|
|
96130
|
+
throw error;
|
|
96131
|
+
}
|
|
96132
|
+
}
|
|
96133
|
+
|
|
96134
|
+
// packages/omo-codex/src/install/managed-agent-model-defaults.ts
|
|
96135
|
+
var PREVIOUSLY_BUNDLED_AGENT_MODELS = new Set([
|
|
96136
|
+
"gpt-5.2",
|
|
96137
|
+
"gpt-5.4-mini",
|
|
96138
|
+
"gpt-5.5",
|
|
96139
|
+
"gpt-5.6-luna",
|
|
96140
|
+
"gpt-5.6-luna-fast",
|
|
96141
|
+
"gpt-5.6-sol",
|
|
96142
|
+
"gpt-5.6-terra",
|
|
96143
|
+
"gpt-6-astra"
|
|
96144
|
+
]);
|
|
96145
|
+
function handEditedAgentModel(installedModel, receipt) {
|
|
96146
|
+
if (installedModel === null)
|
|
96147
|
+
return null;
|
|
96148
|
+
if (receipt?.model !== undefined)
|
|
96149
|
+
return installedModel === receipt.model ? null : installedModel;
|
|
96150
|
+
return PREVIOUSLY_BUNDLED_AGENT_MODELS.has(installedModel) ? null : installedModel;
|
|
96151
|
+
}
|
|
96152
|
+
|
|
95931
96153
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
95932
|
-
import { lstat as lstat8, readFile as
|
|
95933
|
-
import { join as
|
|
96154
|
+
import { lstat as lstat8, readFile as readFile15, rm as rm9 } from "node:fs/promises";
|
|
96155
|
+
import { join as join42 } from "node:path";
|
|
95934
96156
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
95935
96157
|
{
|
|
95936
96158
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -95942,11 +96164,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
95942
96164
|
}
|
|
95943
96165
|
];
|
|
95944
96166
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
95945
|
-
const agentsDir =
|
|
96167
|
+
const agentsDir = join42(input.codexHome, "agents");
|
|
95946
96168
|
if (!await exists3(agentsDir))
|
|
95947
96169
|
return;
|
|
95948
96170
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
95949
|
-
const agentPath =
|
|
96171
|
+
const agentPath = join42(agentsDir, retiredAgent.fileName);
|
|
95950
96172
|
if (!await exists3(agentPath))
|
|
95951
96173
|
continue;
|
|
95952
96174
|
const agentStat = await lstat8(agentPath);
|
|
@@ -95955,7 +96177,7 @@ async function purgeRetiredManagedAgentFiles(input) {
|
|
|
95955
96177
|
const content = await readTextIfExists2(agentPath);
|
|
95956
96178
|
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
95957
96179
|
continue;
|
|
95958
|
-
await
|
|
96180
|
+
await rm9(agentPath, { force: true });
|
|
95959
96181
|
}
|
|
95960
96182
|
}
|
|
95961
96183
|
function hasRequiredMarkers(content, markers) {
|
|
@@ -95963,7 +96185,7 @@ function hasRequiredMarkers(content, markers) {
|
|
|
95963
96185
|
}
|
|
95964
96186
|
async function readTextIfExists2(path) {
|
|
95965
96187
|
try {
|
|
95966
|
-
return await
|
|
96188
|
+
return await readFile15(path, "utf8");
|
|
95967
96189
|
} catch (error) {
|
|
95968
96190
|
if (nodeErrorCode2(error) === "ENOENT")
|
|
95969
96191
|
return null;
|
|
@@ -95988,13 +96210,13 @@ function nodeErrorCode2(error) {
|
|
|
95988
96210
|
|
|
95989
96211
|
// packages/omo-codex/src/install/default-agent-role.ts
|
|
95990
96212
|
import { createHash as createHash3 } from "node:crypto";
|
|
95991
|
-
import { lstat as lstat9, readFile as
|
|
95992
|
-
import { join as
|
|
96213
|
+
import { lstat as lstat9, readFile as readFile16, rm as rm10 } from "node:fs/promises";
|
|
96214
|
+
import { join as join43 } from "node:path";
|
|
95993
96215
|
var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
|
|
95994
96216
|
async function installDefaultAgentRole(input) {
|
|
95995
|
-
const target =
|
|
95996
|
-
const receipt =
|
|
95997
|
-
const configPath =
|
|
96217
|
+
const target = join43(input.codexHome, "agents", "default.toml");
|
|
96218
|
+
const receipt = join43(input.codexHome, "agents", ".lazycodex-default.sha256");
|
|
96219
|
+
const configPath = join43(input.codexHome, "config.toml");
|
|
95998
96220
|
const config = await readIfPresent(configPath);
|
|
95999
96221
|
const entry = await lstat9(target).catch((error) => {
|
|
96000
96222
|
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
@@ -96017,15 +96239,15 @@ async function installDefaultAgentRole(input) {
|
|
|
96017
96239
|
if (next !== config)
|
|
96018
96240
|
await writeFileAtomic(configPath, next);
|
|
96019
96241
|
}
|
|
96020
|
-
await
|
|
96021
|
-
await
|
|
96242
|
+
await rm10(target);
|
|
96243
|
+
await rm10(receipt);
|
|
96022
96244
|
}
|
|
96023
96245
|
return null;
|
|
96024
96246
|
}
|
|
96025
96247
|
if (foreign || existing !== null && !owned) {
|
|
96026
96248
|
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.");
|
|
96027
96249
|
}
|
|
96028
|
-
const worker = await
|
|
96250
|
+
const worker = await readFile16(input.worker.path, "utf8");
|
|
96029
96251
|
const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
|
|
96030
96252
|
if (content === worker)
|
|
96031
96253
|
throw new Error("Cannot derive default: medium worker has no matching internal name");
|
|
@@ -96035,7 +96257,7 @@ async function installDefaultAgentRole(input) {
|
|
|
96035
96257
|
}
|
|
96036
96258
|
async function readIfPresent(path) {
|
|
96037
96259
|
try {
|
|
96038
|
-
return await
|
|
96260
|
+
return await readFile16(path, "utf8");
|
|
96039
96261
|
} catch (error) {
|
|
96040
96262
|
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
96041
96263
|
return null;
|
|
@@ -96055,27 +96277,19 @@ async function linkCachedPluginAgents(input) {
|
|
|
96055
96277
|
await writeManifest(input.pluginRoot, []);
|
|
96056
96278
|
return [];
|
|
96057
96279
|
}
|
|
96058
|
-
const agentsDir =
|
|
96059
|
-
await
|
|
96280
|
+
const agentsDir = join44(input.codexHome, "agents");
|
|
96281
|
+
await mkdir7(agentsDir, { recursive: true });
|
|
96282
|
+
const previousReceipts = await readAgentModelReceipts(input.codexHome);
|
|
96283
|
+
const receipts = new Map;
|
|
96060
96284
|
const linked = [];
|
|
96061
96285
|
for (const agentPath of bundledAgents) {
|
|
96062
96286
|
const agentFileName = basename7(agentPath);
|
|
96063
96287
|
const agentName = agentNameFromToml2(agentFileName);
|
|
96064
|
-
const linkPath =
|
|
96065
|
-
await
|
|
96066
|
-
await restorePreservedReasoning({
|
|
96067
|
-
agentName,
|
|
96068
|
-
linkPath,
|
|
96069
|
-
target: agentPath,
|
|
96070
|
-
value: input.preservedReasoning?.get(agentName)
|
|
96071
|
-
});
|
|
96072
|
-
await restorePreservedServiceTier({
|
|
96073
|
-
linkPath,
|
|
96074
|
-
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
96075
|
-
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
96076
|
-
});
|
|
96288
|
+
const linkPath = join44(agentsDir, agentFileName);
|
|
96289
|
+
receipts.set(agentName, await syncAgentFile({ ...input, agentName, agentPath, linkPath, previousReceipt: previousReceipts.get(agentName) }));
|
|
96077
96290
|
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
96078
96291
|
}
|
|
96292
|
+
await writeAgentModelReceipts(input.codexHome, receipts);
|
|
96079
96293
|
const worker = linked.find((entry) => entry.name === "lazycodex-worker-medium.toml");
|
|
96080
96294
|
if (worker !== undefined) {
|
|
96081
96295
|
const fallback = await installDefaultAgentRole({ codexHome: input.codexHome, worker, enabled: input.defaultRoleEnabled !== false });
|
|
@@ -96085,8 +96299,33 @@ async function linkCachedPluginAgents(input) {
|
|
|
96085
96299
|
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
96086
96300
|
return linked;
|
|
96087
96301
|
}
|
|
96302
|
+
async function syncAgentFile(input) {
|
|
96303
|
+
const installed = await readTextIfExists(input.linkPath);
|
|
96304
|
+
const installedModel = installed === null ? null : extractModel(installed);
|
|
96305
|
+
const preservedReasoning = input.preservedReasoning?.get(input.agentName);
|
|
96306
|
+
const override = input.agentOverrides?.get(input.agentName);
|
|
96307
|
+
await replaceWithCopy(input.linkPath, input.agentPath);
|
|
96308
|
+
await restorePreservedModel({ linkPath: input.linkPath, value: handEditedAgentModel(installedModel, input.previousReceipt) });
|
|
96309
|
+
await restorePreservedReasoning({
|
|
96310
|
+
agentName: input.agentName,
|
|
96311
|
+
linkPath: input.linkPath,
|
|
96312
|
+
target: input.agentPath,
|
|
96313
|
+
value: preservedReasoning?.effort === input.previousReceipt?.reasoningEffort ? undefined : preservedReasoning
|
|
96314
|
+
});
|
|
96315
|
+
await restorePreservedServiceTier({
|
|
96316
|
+
linkPath: input.linkPath,
|
|
96317
|
+
preserved: input.preservedServiceTier?.has(input.agentName) ?? false,
|
|
96318
|
+
value: input.preservedServiceTier?.get(input.agentName) ?? null
|
|
96319
|
+
});
|
|
96320
|
+
await applyAgentOverride({ linkPath: input.linkPath, override });
|
|
96321
|
+
const model = override?.model ?? extractModel(await readFile17(input.agentPath, "utf8"));
|
|
96322
|
+
return {
|
|
96323
|
+
...model === null ? {} : { model },
|
|
96324
|
+
...override?.reasoningEffort === undefined ? {} : { reasoningEffort: override.reasoningEffort }
|
|
96325
|
+
};
|
|
96326
|
+
}
|
|
96088
96327
|
async function discoverBundledAgents(pluginRoot) {
|
|
96089
|
-
const componentsRoot =
|
|
96328
|
+
const componentsRoot = join44(pluginRoot, "components");
|
|
96090
96329
|
if (!await exists4(componentsRoot))
|
|
96091
96330
|
return [];
|
|
96092
96331
|
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
@@ -96094,14 +96333,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
96094
96333
|
for (const entry of componentEntries) {
|
|
96095
96334
|
if (!entry.isDirectory())
|
|
96096
96335
|
continue;
|
|
96097
|
-
const agentsRoot =
|
|
96336
|
+
const agentsRoot = join44(componentsRoot, entry.name, "agents");
|
|
96098
96337
|
if (!await exists4(agentsRoot))
|
|
96099
96338
|
continue;
|
|
96100
96339
|
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
96101
96340
|
for (const file of agentEntries) {
|
|
96102
96341
|
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
96103
96342
|
continue;
|
|
96104
|
-
agents.push(
|
|
96343
|
+
agents.push(join44(agentsRoot, file.name));
|
|
96105
96344
|
}
|
|
96106
96345
|
}
|
|
96107
96346
|
agents.sort();
|
|
@@ -96118,12 +96357,12 @@ async function prepareReplacement(linkPath) {
|
|
|
96118
96357
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
96119
96358
|
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
96120
96359
|
}
|
|
96121
|
-
await
|
|
96360
|
+
await rm11(linkPath, { force: true });
|
|
96122
96361
|
}
|
|
96123
96362
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
96124
|
-
const manifestPath =
|
|
96363
|
+
const manifestPath = join44(pluginRoot, MANIFEST_FILE);
|
|
96125
96364
|
const payload = { agents: [...agentPaths].sort() };
|
|
96126
|
-
await
|
|
96365
|
+
await writeFile9(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
96127
96366
|
`);
|
|
96128
96367
|
}
|
|
96129
96368
|
function agentNameFromToml2(fileName) {
|
|
@@ -96145,13 +96384,59 @@ function nodeErrorCode3(error) {
|
|
|
96145
96384
|
return typeof error.code === "string" ? error.code : null;
|
|
96146
96385
|
}
|
|
96147
96386
|
|
|
96387
|
+
// packages/omo-codex/src/install/install-codex-agents.ts
|
|
96388
|
+
async function linkInstalledPluginAgents(input) {
|
|
96389
|
+
const { codexHome, log } = input;
|
|
96390
|
+
const preservedReasoning = await capturePreservedAgentReasoning({ codexHome });
|
|
96391
|
+
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome });
|
|
96392
|
+
const agentSourceRoots = await agentSourceRootsForInstall(input);
|
|
96393
|
+
const omoConfig = readCodexAgentConfig({ cwd: input.projectDirectory, env: input.env });
|
|
96394
|
+
for (const warning of omoConfig.warnings)
|
|
96395
|
+
log(`Warning: ${warning}`);
|
|
96396
|
+
const agentConfigs = new Map;
|
|
96397
|
+
for (const plugin of input.installed) {
|
|
96398
|
+
const agentLinks = await linkCachedPluginAgents({
|
|
96399
|
+
codexHome,
|
|
96400
|
+
pluginRoot: agentSourceRoots.get(plugin.name) ?? plugin.path,
|
|
96401
|
+
platform: input.platform,
|
|
96402
|
+
preservedReasoning,
|
|
96403
|
+
preservedServiceTier,
|
|
96404
|
+
defaultRoleEnabled: omoConfig.defaultRoleEnabled,
|
|
96405
|
+
agentOverrides: omoConfig.agentOverrides
|
|
96406
|
+
});
|
|
96407
|
+
for (const link of agentLinks) {
|
|
96408
|
+
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
96409
|
+
const agentName = agentNameFromToml3(link.name);
|
|
96410
|
+
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
96411
|
+
}
|
|
96412
|
+
}
|
|
96413
|
+
for (const warning of unmanagedAgentOverrideWarnings(omoConfig.agentOverrides, new Set(agentConfigs.keys()))) {
|
|
96414
|
+
log(`Warning: ${warning}`);
|
|
96415
|
+
}
|
|
96416
|
+
return [...agentConfigs.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
96417
|
+
}
|
|
96418
|
+
async function agentSourceRootsForInstall(input) {
|
|
96419
|
+
if (input.marketplace.name !== "sisyphuslabs") {
|
|
96420
|
+
return new Map(input.installed.map((plugin) => [plugin.name, plugin.path]));
|
|
96421
|
+
}
|
|
96422
|
+
const snapshotPlugins = await writeInstalledMarketplaceSnapshot({
|
|
96423
|
+
codexHome: input.codexHome,
|
|
96424
|
+
marketplace: input.marketplace,
|
|
96425
|
+
plugins: input.pluginSources
|
|
96426
|
+
});
|
|
96427
|
+
return new Map(snapshotPlugins.map((plugin) => [plugin.name, plugin.path]));
|
|
96428
|
+
}
|
|
96429
|
+
function agentNameFromToml3(fileName) {
|
|
96430
|
+
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
96431
|
+
}
|
|
96432
|
+
|
|
96148
96433
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
96149
|
-
import { readFile as
|
|
96150
|
-
import { join as
|
|
96434
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
96435
|
+
import { join as join45 } from "node:path";
|
|
96151
96436
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
96152
96437
|
async function readMarketplace(repoRoot, options) {
|
|
96153
|
-
const marketplacePath = options?.marketplacePath ??
|
|
96154
|
-
const raw = await
|
|
96438
|
+
const marketplacePath = options?.marketplacePath ?? join45(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
96439
|
+
const raw = await readFile18(marketplacePath, "utf8");
|
|
96155
96440
|
const parsed = JSON.parse(raw);
|
|
96156
96441
|
if (!isPlainRecord4(parsed))
|
|
96157
96442
|
throw new Error("marketplace.json must be an object");
|
|
@@ -96169,10 +96454,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
96169
96454
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
96170
96455
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
96171
96456
|
const relativePath = sourcePath.slice(2);
|
|
96172
|
-
return
|
|
96457
|
+
return join45(repoRoot, ...relativePath.split(/[\\/]/));
|
|
96173
96458
|
}
|
|
96174
96459
|
async function readPluginManifest(pluginRoot) {
|
|
96175
|
-
const raw = await
|
|
96460
|
+
const raw = await readFile18(join45(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
96176
96461
|
const parsed = JSON.parse(raw);
|
|
96177
96462
|
if (!isPlainRecord4(parsed))
|
|
96178
96463
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -96252,61 +96537,12 @@ function validateLocalSourcePath(path) {
|
|
|
96252
96537
|
return path;
|
|
96253
96538
|
}
|
|
96254
96539
|
|
|
96255
|
-
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
96256
|
-
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm10, writeFile as writeFile8 } from "node:fs/promises";
|
|
96257
|
-
import { join as join44, sep as sep6 } from "node:path";
|
|
96258
|
-
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
96259
|
-
async function writeInstalledMarketplaceSnapshot(input) {
|
|
96260
|
-
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
96261
|
-
await mkdir7(marketplaceRoot, { recursive: true });
|
|
96262
|
-
await writeMarketplaceManifest(marketplaceRoot, input.marketplace);
|
|
96263
|
-
const snapshotPlugins = [];
|
|
96264
|
-
for (const plugin of input.plugins) {
|
|
96265
|
-
snapshotPlugins.push(await writeSnapshotPlugin(marketplaceRoot, plugin));
|
|
96266
|
-
}
|
|
96267
|
-
return snapshotPlugins;
|
|
96268
|
-
}
|
|
96269
|
-
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
96270
|
-
return join44(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
96271
|
-
}
|
|
96272
|
-
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
96273
|
-
const manifestDir = join44(marketplaceRoot, ".agents", "plugins");
|
|
96274
|
-
await mkdir7(manifestDir, { recursive: true });
|
|
96275
|
-
const tempPath = join44(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
96276
|
-
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
96277
|
-
`);
|
|
96278
|
-
await rename4(tempPath, join44(manifestDir, "marketplace.json"));
|
|
96279
|
-
}
|
|
96280
|
-
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
96281
|
-
const pluginsDir = join44(marketplaceRoot, "plugins");
|
|
96282
|
-
await mkdir7(pluginsDir, { recursive: true });
|
|
96283
|
-
const targetPath = join44(pluginsDir, plugin.name);
|
|
96284
|
-
const tempPath = join44(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
96285
|
-
await rm10(tempPath, { recursive: true, force: true });
|
|
96286
|
-
await cp3(plugin.sourcePath, tempPath, {
|
|
96287
|
-
recursive: true,
|
|
96288
|
-
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
96289
|
-
});
|
|
96290
|
-
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
96291
|
-
await rm10(targetPath, { recursive: true, force: true });
|
|
96292
|
-
await rename4(tempPath, targetPath);
|
|
96293
|
-
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
96294
|
-
return { name: plugin.name, path: targetPath };
|
|
96295
|
-
}
|
|
96296
|
-
function shouldCopyMarketplaceSourcePath(path, root) {
|
|
96297
|
-
const relative = path === root ? "" : path.slice(root.length + sep6.length);
|
|
96298
|
-
if (relative === "")
|
|
96299
|
-
return true;
|
|
96300
|
-
const parts = relative.split(sep6);
|
|
96301
|
-
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
96302
|
-
}
|
|
96303
|
-
|
|
96304
96540
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
96305
|
-
import { readdir as readdir8, readFile as
|
|
96306
|
-
import { join as
|
|
96541
|
+
import { readdir as readdir8, readFile as readFile19, writeFile as writeFile10 } from "node:fs/promises";
|
|
96542
|
+
import { join as join46 } from "node:path";
|
|
96307
96543
|
async function readDistributionManifest(repoRoot) {
|
|
96308
96544
|
try {
|
|
96309
|
-
const parsed = JSON.parse(await
|
|
96545
|
+
const parsed = JSON.parse(await readFile19(join46(repoRoot, "package.json"), "utf8"));
|
|
96310
96546
|
if (!isPlainRecord4(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
96311
96547
|
return;
|
|
96312
96548
|
return {
|
|
@@ -96330,19 +96566,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
96330
96566
|
return input.manifestVersion ?? "local";
|
|
96331
96567
|
}
|
|
96332
96568
|
async function stampLazyCodexPluginVersion(input) {
|
|
96333
|
-
const manifestPath =
|
|
96569
|
+
const manifestPath = join46(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
96334
96570
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
96335
96571
|
await stampJsonVersion(manifestPath, input.version);
|
|
96336
|
-
await stampJsonVersion(
|
|
96572
|
+
await stampJsonVersion(join46(input.pluginRoot, "package.json"), input.version);
|
|
96337
96573
|
for (const hookPath of hookPaths) {
|
|
96338
|
-
await stampHookStatusMessages(
|
|
96574
|
+
await stampHookStatusMessages(join46(input.pluginRoot, hookPath), input.version);
|
|
96339
96575
|
}
|
|
96340
96576
|
await stampComponentVersions(input);
|
|
96341
96577
|
}
|
|
96342
96578
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
96343
96579
|
if (input.distributionManifest === undefined)
|
|
96344
96580
|
return;
|
|
96345
|
-
await
|
|
96581
|
+
await writeFile10(join46(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
96346
96582
|
packageName: input.distributionManifest.name,
|
|
96347
96583
|
version: input.distributionManifest.version
|
|
96348
96584
|
}, null, "\t")}
|
|
@@ -96350,11 +96586,11 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
96350
96586
|
}
|
|
96351
96587
|
async function stampJsonVersion(path, version) {
|
|
96352
96588
|
try {
|
|
96353
|
-
const parsed = JSON.parse(await
|
|
96589
|
+
const parsed = JSON.parse(await readFile19(path, "utf8"));
|
|
96354
96590
|
if (!isPlainRecord4(parsed))
|
|
96355
96591
|
return;
|
|
96356
96592
|
parsed.version = version;
|
|
96357
|
-
await
|
|
96593
|
+
await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
|
|
96358
96594
|
`);
|
|
96359
96595
|
} catch (error) {
|
|
96360
96596
|
if (error instanceof Error)
|
|
@@ -96364,7 +96600,7 @@ async function stampJsonVersion(path, version) {
|
|
|
96364
96600
|
}
|
|
96365
96601
|
async function readPluginHookPaths(manifestPath) {
|
|
96366
96602
|
try {
|
|
96367
|
-
const parsed = JSON.parse(await
|
|
96603
|
+
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
96368
96604
|
if (!isPlainRecord4(parsed))
|
|
96369
96605
|
return [];
|
|
96370
96606
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
@@ -96384,11 +96620,11 @@ function stripDotSlash3(path) {
|
|
|
96384
96620
|
}
|
|
96385
96621
|
async function stampHookStatusMessages(path, version) {
|
|
96386
96622
|
try {
|
|
96387
|
-
const parsed = JSON.parse(await
|
|
96623
|
+
const parsed = JSON.parse(await readFile19(path, "utf8"));
|
|
96388
96624
|
if (!isPlainRecord4(parsed))
|
|
96389
96625
|
return;
|
|
96390
96626
|
stampHookGroups(parsed.hooks, version);
|
|
96391
|
-
await
|
|
96627
|
+
await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
|
|
96392
96628
|
`);
|
|
96393
96629
|
} catch (error) {
|
|
96394
96630
|
if (error instanceof Error)
|
|
@@ -96399,16 +96635,16 @@ async function stampHookStatusMessages(path, version) {
|
|
|
96399
96635
|
async function stampComponentVersions(input) {
|
|
96400
96636
|
let entries;
|
|
96401
96637
|
try {
|
|
96402
|
-
entries = await readdir8(
|
|
96638
|
+
entries = await readdir8(join46(input.pluginRoot, "components"));
|
|
96403
96639
|
} catch (error) {
|
|
96404
96640
|
if (error instanceof Error)
|
|
96405
96641
|
return;
|
|
96406
96642
|
throw error;
|
|
96407
96643
|
}
|
|
96408
96644
|
for (const entry of entries) {
|
|
96409
|
-
const componentRoot =
|
|
96410
|
-
await stampJsonVersion(
|
|
96411
|
-
await stampHookStatusMessages(
|
|
96645
|
+
const componentRoot = join46(input.pluginRoot, "components", entry);
|
|
96646
|
+
await stampJsonVersion(join46(componentRoot, "package.json"), input.version);
|
|
96647
|
+
await stampHookStatusMessages(join46(componentRoot, "hooks", "hooks.json"), input.version);
|
|
96412
96648
|
}
|
|
96413
96649
|
}
|
|
96414
96650
|
function stampHookGroups(hooks, version) {
|
|
@@ -96465,8 +96701,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
96465
96701
|
};
|
|
96466
96702
|
|
|
96467
96703
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
96468
|
-
import { copyFile as copyFile2, lstat as lstat11, readFile as
|
|
96469
|
-
import { dirname as dirname17, join as
|
|
96704
|
+
import { copyFile as copyFile2, lstat as lstat11, readFile as readFile20, writeFile as writeFile11 } from "node:fs/promises";
|
|
96705
|
+
import { dirname as dirname17, join as join47, resolve as resolve11 } from "node:path";
|
|
96470
96706
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
96471
96707
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
96472
96708
|
".codex/hooks.json",
|
|
@@ -96485,7 +96721,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
96485
96721
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
96486
96722
|
const configs = [];
|
|
96487
96723
|
for (const configPath of project.configPaths) {
|
|
96488
|
-
const original = await
|
|
96724
|
+
const original = await readFile20(configPath, "utf8");
|
|
96489
96725
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
96490
96726
|
if (!repair.changed) {
|
|
96491
96727
|
configs.push({
|
|
@@ -96498,7 +96734,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
96498
96734
|
}
|
|
96499
96735
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp(input.now?.() ?? new Date)}`;
|
|
96500
96736
|
await copyFile2(configPath, backupPath);
|
|
96501
|
-
await
|
|
96737
|
+
await writeFile11(configPath, `${repair.config.trimEnd()}
|
|
96502
96738
|
`);
|
|
96503
96739
|
configs.push({
|
|
96504
96740
|
projectRoot: project.projectRoot,
|
|
@@ -96569,17 +96805,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
96569
96805
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
96570
96806
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
96571
96807
|
}
|
|
96572
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
96808
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join47(resolve11(codexHome), "config.toml");
|
|
96573
96809
|
let current = resolve11(startDirectory);
|
|
96574
96810
|
const configPathsFromCwd = [];
|
|
96575
96811
|
while (true) {
|
|
96576
|
-
const configPath =
|
|
96812
|
+
const configPath = join47(current, ".codex", "config.toml");
|
|
96577
96813
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
96578
96814
|
if (codexHomeConfigPath === null || resolve11(configPath) !== codexHomeConfigPath) {
|
|
96579
96815
|
configPathsFromCwd.push(configPath);
|
|
96580
96816
|
}
|
|
96581
96817
|
}
|
|
96582
|
-
if (await exists5(
|
|
96818
|
+
if (await exists5(join47(current, ".git"))) {
|
|
96583
96819
|
return configPathsFromCwd.length === 0 ? null : {
|
|
96584
96820
|
projectRoot: current,
|
|
96585
96821
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
@@ -96599,7 +96835,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
96599
96835
|
}
|
|
96600
96836
|
}
|
|
96601
96837
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
96602
|
-
const codexDirStat = await maybeLstat(
|
|
96838
|
+
const codexDirStat = await maybeLstat(join47(directory, ".codex"));
|
|
96603
96839
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
96604
96840
|
return false;
|
|
96605
96841
|
const configStat = await maybeLstat(configPath);
|
|
@@ -96619,7 +96855,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
96619
96855
|
const seenPaths = new Set;
|
|
96620
96856
|
for (const projectRoot of projectRoots) {
|
|
96621
96857
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
96622
|
-
const artifactPath =
|
|
96858
|
+
const artifactPath = join47(projectRoot, relativePath);
|
|
96623
96859
|
if (seenPaths.has(artifactPath))
|
|
96624
96860
|
continue;
|
|
96625
96861
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -96695,13 +96931,13 @@ function formatUnknownError(error) {
|
|
|
96695
96931
|
|
|
96696
96932
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
96697
96933
|
import { createHash as createHash4 } from "node:crypto";
|
|
96698
|
-
import { lstat as lstat12, readFile as
|
|
96934
|
+
import { lstat as lstat12, readFile as readFile22, readdir as readdir10, rm as rm12 } from "node:fs/promises";
|
|
96699
96935
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
96700
|
-
import { join as
|
|
96936
|
+
import { join as join48, posix as posix6 } from "node:path";
|
|
96701
96937
|
|
|
96702
96938
|
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
|
|
96703
96939
|
import { execFile } from "node:child_process";
|
|
96704
|
-
import { readFile as
|
|
96940
|
+
import { readFile as readFile21, readdir as readdir9, readlink as readlink5 } from "node:fs/promises";
|
|
96705
96941
|
import { connect } from "node:net";
|
|
96706
96942
|
import { basename as basename8 } from "node:path";
|
|
96707
96943
|
var PROBE_TIMEOUT_MS = 500;
|
|
@@ -96743,7 +96979,7 @@ async function attestLegacyDaemonOwnership(input, deps = {}) {
|
|
|
96743
96979
|
return false;
|
|
96744
96980
|
}
|
|
96745
96981
|
async function attestLinuxOwnership(input, deps) {
|
|
96746
|
-
const readFileImpl = deps.readFile ??
|
|
96982
|
+
const readFileImpl = deps.readFile ?? readFile21;
|
|
96747
96983
|
const readDirImpl = deps.readDir ?? readdir9;
|
|
96748
96984
|
const readLinkImpl = deps.readLink ?? readlink5;
|
|
96749
96985
|
const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
|
|
@@ -96870,7 +97106,7 @@ async function readBinary(readFileImpl, path) {
|
|
|
96870
97106
|
var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
|
|
96871
97107
|
var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
96872
97108
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
96873
|
-
const daemonRoot =
|
|
97109
|
+
const daemonRoot = join48(codexHome, "codex-lsp", "daemon");
|
|
96874
97110
|
const platform = deps.platform ?? process.platform;
|
|
96875
97111
|
const tmpDir = deps.tmpDir ?? tmpdir3();
|
|
96876
97112
|
const probe = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
|
|
@@ -96880,7 +97116,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
96880
97116
|
const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
|
|
96881
97117
|
const results = [];
|
|
96882
97118
|
for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
|
|
96883
|
-
const versionPath =
|
|
97119
|
+
const versionPath = join48(daemonRoot, entry.name);
|
|
96884
97120
|
const parsedVersion = parseVersionEntry(entry.name);
|
|
96885
97121
|
if (parsedVersion === null || !entry.isDirectory()) {
|
|
96886
97122
|
await removeVersionDir(versionPath);
|
|
@@ -96928,7 +97164,7 @@ function parseVersionEntry(entryName) {
|
|
|
96928
97164
|
return LEGACY_VERSION_PATTERN.test(version) ? version : null;
|
|
96929
97165
|
}
|
|
96930
97166
|
async function readLegacyMetadata(input) {
|
|
96931
|
-
const pidText = await readRegularTrimmedFile(
|
|
97167
|
+
const pidText = await readRegularTrimmedFile(join48(input.versionPath, "daemon.pid"));
|
|
96932
97168
|
if (pidText === "non_regular")
|
|
96933
97169
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
96934
97170
|
if (pidText === null)
|
|
@@ -96936,7 +97172,7 @@ async function readLegacyMetadata(input) {
|
|
|
96936
97172
|
const pid = Number.parseInt(pidText, 10);
|
|
96937
97173
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
96938
97174
|
return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
|
|
96939
|
-
const endpointText = await readRegularTrimmedFile(
|
|
97175
|
+
const endpointText = await readRegularTrimmedFile(join48(input.versionPath, "daemon.endpoint"));
|
|
96940
97176
|
if (endpointText === "non_regular")
|
|
96941
97177
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
96942
97178
|
if (endpointText === null)
|
|
@@ -96968,14 +97204,14 @@ async function readRegularTrimmedFile(path) {
|
|
|
96968
97204
|
return null;
|
|
96969
97205
|
if (!stats.isFile())
|
|
96970
97206
|
return "non_regular";
|
|
96971
|
-
const content = (await
|
|
97207
|
+
const content = (await readFile22(path, "utf8")).trim();
|
|
96972
97208
|
return content.length > 0 ? content : null;
|
|
96973
97209
|
}
|
|
96974
97210
|
function shortDigest(value) {
|
|
96975
97211
|
return createHash4("sha256").update(value).digest("hex").slice(0, 16);
|
|
96976
97212
|
}
|
|
96977
97213
|
async function removeVersionDir(path) {
|
|
96978
|
-
await
|
|
97214
|
+
await rm12(path, { recursive: true, force: true });
|
|
96979
97215
|
}
|
|
96980
97216
|
function removed(version, reason) {
|
|
96981
97217
|
return { version, status: "removed", reason };
|
|
@@ -97015,7 +97251,7 @@ function processIsRunning(pid) {
|
|
|
97015
97251
|
|
|
97016
97252
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
97017
97253
|
import { homedir as homedir5 } from "node:os";
|
|
97018
|
-
import { join as
|
|
97254
|
+
import { join as join49, resolve as resolve12 } from "node:path";
|
|
97019
97255
|
function resolveCodexInstallerBinDir(input) {
|
|
97020
97256
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
97021
97257
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -97024,16 +97260,16 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
97024
97260
|
const defaultCodexHome = resolve12(homeDir, ".codex");
|
|
97025
97261
|
const resolvedCodexHome = resolve12(input.codexHome);
|
|
97026
97262
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
97027
|
-
return
|
|
97263
|
+
return join49(resolvedCodexHome, "bin");
|
|
97028
97264
|
return resolve12(homeDir, ".local", "bin");
|
|
97029
97265
|
}
|
|
97030
97266
|
|
|
97031
97267
|
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
|
|
97032
|
-
import { readFile as
|
|
97033
|
-
import { join as
|
|
97268
|
+
import { readFile as readFile23, readdir as readdir11, writeFile as writeFile12 } from "node:fs/promises";
|
|
97269
|
+
import { join as join50 } from "node:path";
|
|
97034
97270
|
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
|
|
97035
97271
|
async function writeInstalledCodexBinDir(input) {
|
|
97036
|
-
await
|
|
97272
|
+
await writeFile12(join50(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
|
|
97037
97273
|
`);
|
|
97038
97274
|
}
|
|
97039
97275
|
async function readInstalledCodexBinDir(codexHome) {
|
|
@@ -97046,20 +97282,20 @@ async function readInstalledCodexBinDir(codexHome) {
|
|
|
97046
97282
|
}
|
|
97047
97283
|
async function installedBinDirManifestPaths(codexHome) {
|
|
97048
97284
|
const paths = [
|
|
97049
|
-
|
|
97285
|
+
join50(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_BIN_DIR_MANIFEST)
|
|
97050
97286
|
];
|
|
97051
|
-
const versionRoot =
|
|
97287
|
+
const versionRoot = join50(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
97052
97288
|
const entries = await readdir11(versionRoot, { withFileTypes: true }).catch(() => null);
|
|
97053
97289
|
if (entries !== null) {
|
|
97054
97290
|
for (const entry of entries) {
|
|
97055
97291
|
if (entry.isDirectory())
|
|
97056
|
-
paths.push(
|
|
97292
|
+
paths.push(join50(versionRoot, entry.name, INSTALLED_BIN_DIR_MANIFEST));
|
|
97057
97293
|
}
|
|
97058
97294
|
}
|
|
97059
97295
|
return paths;
|
|
97060
97296
|
}
|
|
97061
97297
|
async function readBinDirFromManifest(manifestPath) {
|
|
97062
|
-
const raw = await
|
|
97298
|
+
const raw = await readFile23(manifestPath, "utf8").catch(() => null);
|
|
97063
97299
|
if (raw === null)
|
|
97064
97300
|
return null;
|
|
97065
97301
|
let parsed;
|
|
@@ -97077,8 +97313,8 @@ async function readBinDirFromManifest(manifestPath) {
|
|
|
97077
97313
|
}
|
|
97078
97314
|
|
|
97079
97315
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
97080
|
-
import { readFile as
|
|
97081
|
-
import { join as
|
|
97316
|
+
import { readFile as readFile24, writeFile as writeFile13 } from "node:fs/promises";
|
|
97317
|
+
import { join as join51 } from "node:path";
|
|
97082
97318
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
97083
97319
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
97084
97320
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -97086,20 +97322,20 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
97086
97322
|
async function removeGitBashHooksOffWindows(input) {
|
|
97087
97323
|
if (input.platform === "win32")
|
|
97088
97324
|
return;
|
|
97089
|
-
const manifestPath =
|
|
97090
|
-
const parsed = JSON.parse(await
|
|
97325
|
+
const manifestPath = join51(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
97326
|
+
const parsed = JSON.parse(await readFile24(manifestPath, "utf8"));
|
|
97091
97327
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.hooks))
|
|
97092
97328
|
return;
|
|
97093
97329
|
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
|
|
97094
97330
|
if (hooks.length === parsed.hooks.length)
|
|
97095
97331
|
return;
|
|
97096
|
-
await
|
|
97332
|
+
await writeFile13(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
|
|
97097
97333
|
`);
|
|
97098
97334
|
}
|
|
97099
97335
|
|
|
97100
97336
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
97101
97337
|
init_src();
|
|
97102
|
-
import { join as
|
|
97338
|
+
import { join as join52 } from "node:path";
|
|
97103
97339
|
function describeResult(result) {
|
|
97104
97340
|
if (result.kind === "succeeded")
|
|
97105
97341
|
return null;
|
|
@@ -97113,7 +97349,7 @@ async function installAstGrepForCodex(options) {
|
|
|
97113
97349
|
return;
|
|
97114
97350
|
const platform = options.platform ?? process.platform;
|
|
97115
97351
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
97116
|
-
const skillDir =
|
|
97352
|
+
const skillDir = join52(plugin.path, "skills", "ast-grep");
|
|
97117
97353
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
97118
97354
|
try {
|
|
97119
97355
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -97146,7 +97382,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97146
97382
|
const env = options.env ?? process.env;
|
|
97147
97383
|
const platform = options.platform ?? process.platform;
|
|
97148
97384
|
const repoRoot = resolve13(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env }));
|
|
97149
|
-
const codexHome = resolve13(options.codexHome ?? env.CODEX_HOME ??
|
|
97385
|
+
const codexHome = resolve13(options.codexHome ?? env.CODEX_HOME ?? join56(homedir6(), ".codex"));
|
|
97150
97386
|
const projectDirectory = resolve13(options.projectDirectory ?? env.OMO_CODEX_PROJECT ?? process.cwd());
|
|
97151
97387
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env });
|
|
97152
97388
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -97163,14 +97399,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
97163
97399
|
if (!gitBashResolution.found) {
|
|
97164
97400
|
throw new Error(gitBashResolution.installHint);
|
|
97165
97401
|
}
|
|
97166
|
-
const codexPackageRoot =
|
|
97402
|
+
const codexPackageRoot = join56(repoRoot, "packages", "omo-codex");
|
|
97167
97403
|
const marketplace = await readMarketplace(repoRoot, {
|
|
97168
|
-
marketplacePath:
|
|
97404
|
+
marketplacePath: join56(codexPackageRoot, "marketplace.json")
|
|
97169
97405
|
});
|
|
97170
97406
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
97171
97407
|
const installed = [];
|
|
97172
97408
|
const pluginSources = [];
|
|
97173
|
-
const agentConfigs = new Map;
|
|
97174
97409
|
for (const entry of marketplace.plugins) {
|
|
97175
97410
|
const sourcePath = resolvePluginSource(codexPackageRoot, entry, { pathOverride: "./plugin" });
|
|
97176
97411
|
const manifest = await readPluginManifest(sourcePath);
|
|
@@ -97211,7 +97446,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97211
97446
|
if (runtimeLink !== null)
|
|
97212
97447
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
97213
97448
|
else
|
|
97214
|
-
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${
|
|
97449
|
+
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${join56(repoRoot, "dist", "cli", "index.js")} is missing; omo-agent-toolkit ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
97215
97450
|
}
|
|
97216
97451
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
97217
97452
|
installed.push(plugin);
|
|
@@ -97223,33 +97458,16 @@ async function runCodexInstaller(options = {}) {
|
|
|
97223
97458
|
log,
|
|
97224
97459
|
platform
|
|
97225
97460
|
});
|
|
97226
|
-
const
|
|
97227
|
-
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome });
|
|
97228
|
-
const agentSourceRoots = await agentSourceRootsForInstall({
|
|
97461
|
+
const agentConfigs = await linkInstalledPluginAgents({
|
|
97229
97462
|
codexHome,
|
|
97463
|
+
projectDirectory,
|
|
97464
|
+
env,
|
|
97465
|
+
platform,
|
|
97466
|
+
log,
|
|
97230
97467
|
marketplace,
|
|
97231
97468
|
installed,
|
|
97232
97469
|
pluginSources
|
|
97233
97470
|
});
|
|
97234
|
-
const omoConfig = readDefaultRoleConfig({ cwd: projectDirectory, env });
|
|
97235
|
-
for (const warning of omoConfig.warnings)
|
|
97236
|
-
log(`Warning: ${warning}`);
|
|
97237
|
-
for (const plugin of installed) {
|
|
97238
|
-
const pluginRoot = agentSourceRoots.get(plugin.name) ?? plugin.path;
|
|
97239
|
-
const agentLinks = await linkCachedPluginAgents({
|
|
97240
|
-
codexHome,
|
|
97241
|
-
pluginRoot,
|
|
97242
|
-
platform,
|
|
97243
|
-
preservedReasoning,
|
|
97244
|
-
preservedServiceTier,
|
|
97245
|
-
defaultRoleEnabled: omoConfig.enabled
|
|
97246
|
-
});
|
|
97247
|
-
for (const link of agentLinks) {
|
|
97248
|
-
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
97249
|
-
const agentName = agentNameFromToml3(link.name);
|
|
97250
|
-
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
97251
|
-
}
|
|
97252
|
-
}
|
|
97253
97471
|
const trustedHookStates = (await Promise.all(installed.map((plugin) => trustedHookStatesForPlugin({
|
|
97254
97472
|
marketplaceName: marketplace.name,
|
|
97255
97473
|
platform,
|
|
@@ -97278,13 +97496,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
97278
97496
|
continue;
|
|
97279
97497
|
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
|
|
97280
97498
|
}
|
|
97281
|
-
const marketplaceRoot =
|
|
97499
|
+
const marketplaceRoot = join56(codexHome, "plugins", "cache", marketplace.name);
|
|
97282
97500
|
await writeCachedMarketplaceManifest({
|
|
97283
97501
|
marketplaceName: marketplace.name,
|
|
97284
97502
|
marketplaceRoot,
|
|
97285
97503
|
plugins: installed
|
|
97286
97504
|
});
|
|
97287
|
-
const configPath =
|
|
97505
|
+
const configPath = join56(codexHome, "config.toml");
|
|
97288
97506
|
await updateCodexConfig({
|
|
97289
97507
|
configPath,
|
|
97290
97508
|
repoRoot: codexPackageRoot,
|
|
@@ -97294,7 +97512,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97294
97512
|
platform,
|
|
97295
97513
|
gitBashEnabled: platform === "win32" && gitBashResolution.found,
|
|
97296
97514
|
trustedHookStates,
|
|
97297
|
-
agentConfigs
|
|
97515
|
+
agentConfigs,
|
|
97298
97516
|
autonomousPermissions: options.autonomousPermissions !== false,
|
|
97299
97517
|
...options.reasoning === undefined ? {} : { reasoning: options.reasoning }
|
|
97300
97518
|
});
|
|
@@ -97321,20 +97539,6 @@ async function runCodexInstaller(options = {}) {
|
|
|
97321
97539
|
projectCleanup
|
|
97322
97540
|
};
|
|
97323
97541
|
}
|
|
97324
|
-
function agentNameFromToml3(fileName) {
|
|
97325
|
-
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
97326
|
-
}
|
|
97327
|
-
async function agentSourceRootsForInstall(input) {
|
|
97328
|
-
if (input.marketplace.name !== "sisyphuslabs") {
|
|
97329
|
-
return new Map(input.installed.map((plugin) => [plugin.name, plugin.path]));
|
|
97330
|
-
}
|
|
97331
|
-
const snapshotPlugins = await writeInstalledMarketplaceSnapshot({
|
|
97332
|
-
codexHome: input.codexHome,
|
|
97333
|
-
marketplace: input.marketplace,
|
|
97334
|
-
plugins: input.pluginSources
|
|
97335
|
-
});
|
|
97336
|
-
return new Map(snapshotPlugins.map((plugin) => [plugin.name, plugin.path]));
|
|
97337
|
-
}
|
|
97338
97542
|
function legacyCacheMarketplaces(marketplaceName) {
|
|
97339
97543
|
return marketplaceName === "sisyphuslabs" ? SISYPHUS_LEGACY_CACHE_MARKETPLACES : [];
|
|
97340
97544
|
}
|
|
@@ -97343,7 +97547,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
97343
97547
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
97344
97548
|
if (isRepoRootWithCodexPlugin(current))
|
|
97345
97549
|
return current;
|
|
97346
|
-
for (const wrapperPackageRoot of [
|
|
97550
|
+
for (const wrapperPackageRoot of [join56(current, "node_modules", "oh-my-openagent"), join56(current, "oh-my-openagent")]) {
|
|
97347
97551
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
97348
97552
|
return wrapperPackageRoot;
|
|
97349
97553
|
}
|
|
@@ -97361,7 +97565,7 @@ function findRepoRoot(input) {
|
|
|
97361
97565
|
return findRepoRootFromImporter(input.importerDir);
|
|
97362
97566
|
}
|
|
97363
97567
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
97364
|
-
return existsSync27(
|
|
97568
|
+
return existsSync27(join56(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
97365
97569
|
}
|
|
97366
97570
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
97367
97571
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -97496,13 +97700,13 @@ function defaultRunCommand2(command, args) {
|
|
|
97496
97700
|
});
|
|
97497
97701
|
}
|
|
97498
97702
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
97499
|
-
import { lstat as lstat15, readFile as
|
|
97703
|
+
import { lstat as lstat15, readFile as readFile27, readdir as readdir13, rm as rm14, rmdir } from "node:fs/promises";
|
|
97500
97704
|
import { homedir as homedir8 } from "node:os";
|
|
97501
|
-
import { isAbsolute as isAbsolute11, join as
|
|
97705
|
+
import { isAbsolute as isAbsolute11, join as join59, relative as relative6, resolve as resolve16 } from "node:path";
|
|
97502
97706
|
|
|
97503
97707
|
// packages/omo-codex/src/install/codex-cleanup-bins.ts
|
|
97504
|
-
import { lstat as lstat13, readFile as
|
|
97505
|
-
import { dirname as dirname19, isAbsolute as isAbsolute9, join as
|
|
97708
|
+
import { lstat as lstat13, readFile as readFile25, readdir as readdir12, readlink as readlink6, rm as rm13 } from "node:fs/promises";
|
|
97709
|
+
import { dirname as dirname19, isAbsolute as isAbsolute9, join as join57, resolve as resolve14 } from "node:path";
|
|
97506
97710
|
var ROOT_RUNTIME_BIN_NAME = "omo";
|
|
97507
97711
|
var MANAGED_CODEX_BIN_NAMES = new Set([
|
|
97508
97712
|
ROOT_RUNTIME_BIN_NAME,
|
|
@@ -97532,9 +97736,9 @@ async function removeManagedCodexBins(binDir, platform) {
|
|
|
97532
97736
|
const binName = managedBinNameForEntry2(entry.name, platform);
|
|
97533
97737
|
if (binName === null || !MANAGED_CODEX_BIN_NAMES.has(binName))
|
|
97534
97738
|
continue;
|
|
97535
|
-
const linkPath =
|
|
97739
|
+
const linkPath = join57(binDir, entry.name);
|
|
97536
97740
|
if (await isManagedCodexBin(linkPath, platform, binName)) {
|
|
97537
|
-
await
|
|
97741
|
+
await rm13(linkPath, { force: true });
|
|
97538
97742
|
removed.push(linkPath);
|
|
97539
97743
|
}
|
|
97540
97744
|
}
|
|
@@ -97563,12 +97767,12 @@ async function isManagedCodexBin(linkPath, platform, binName) {
|
|
|
97563
97767
|
}
|
|
97564
97768
|
if (!entryStat.isFile())
|
|
97565
97769
|
return false;
|
|
97566
|
-
const content = await
|
|
97770
|
+
const content = await readFile25(linkPath, "utf8");
|
|
97567
97771
|
return content.includes(RUNTIME_WRAPPER_MARKER) || content.includes(COMMAND_SHIM_MARKER);
|
|
97568
97772
|
}
|
|
97569
97773
|
|
|
97570
97774
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
97571
|
-
import { lstat as lstat14, mkdir as mkdir8, readFile as
|
|
97775
|
+
import { lstat as lstat14, mkdir as mkdir8, readFile as readFile26, writeFile as writeFile14 } from "node:fs/promises";
|
|
97572
97776
|
import { dirname as dirname20 } from "node:path";
|
|
97573
97777
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
97574
97778
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
@@ -97601,14 +97805,14 @@ function cleanupCodexLightConfigText(config) {
|
|
|
97601
97805
|
async function cleanupCodexConfig(configPath, now) {
|
|
97602
97806
|
if (!await configExists(configPath))
|
|
97603
97807
|
return { changed: false };
|
|
97604
|
-
const original = await
|
|
97808
|
+
const original = await readFile26(configPath, "utf8");
|
|
97605
97809
|
const next = cleanupCodexLightConfigText(original);
|
|
97606
97810
|
if (next === original)
|
|
97607
97811
|
return { changed: false };
|
|
97608
97812
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
97609
97813
|
await mkdir8(dirname20(configPath), { recursive: true });
|
|
97610
|
-
await
|
|
97611
|
-
await
|
|
97814
|
+
await writeFile14(backupPath, original);
|
|
97815
|
+
await writeFile14(configPath, `${next.trimEnd()}
|
|
97612
97816
|
`);
|
|
97613
97817
|
return { changed: true, backupPath };
|
|
97614
97818
|
}
|
|
@@ -97685,7 +97889,7 @@ function nodeErrorCode5(error) {
|
|
|
97685
97889
|
}
|
|
97686
97890
|
|
|
97687
97891
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
97688
|
-
import { dirname as dirname21, isAbsolute as isAbsolute10, join as
|
|
97892
|
+
import { dirname as dirname21, isAbsolute as isAbsolute10, join as join58, relative as relative5, resolve as resolve15 } from "node:path";
|
|
97689
97893
|
function codexHomeResolvesToFilesystemRoot(codexHome) {
|
|
97690
97894
|
const resolved = resolve15(codexHome);
|
|
97691
97895
|
return dirname21(resolved) === resolved;
|
|
@@ -97702,11 +97906,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
97702
97906
|
if (target === codexHome)
|
|
97703
97907
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
97704
97908
|
const exactManagedRoots = new Set([
|
|
97705
|
-
resolve15(
|
|
97706
|
-
resolve15(
|
|
97707
|
-
resolve15(
|
|
97708
|
-
resolve15(
|
|
97709
|
-
resolve15(
|
|
97909
|
+
resolve15(join58(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
97910
|
+
resolve15(join58(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
97911
|
+
resolve15(join58(codexHome, "runtime", "ast-grep")),
|
|
97912
|
+
resolve15(join58(codexHome, "runtime", "node")),
|
|
97913
|
+
resolve15(join58(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
97710
97914
|
]);
|
|
97711
97915
|
if (exactManagedRoots.has(target))
|
|
97712
97916
|
return null;
|
|
@@ -97736,8 +97940,8 @@ function skipped(path, reason) {
|
|
|
97736
97940
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
97737
97941
|
async function cleanupCodexLight(input = {}) {
|
|
97738
97942
|
const env = input.env ?? process.env;
|
|
97739
|
-
const codexHome = resolve16(input.codexHome ?? env.CODEX_HOME ??
|
|
97740
|
-
const configPath =
|
|
97943
|
+
const codexHome = resolve16(input.codexHome ?? env.CODEX_HOME ?? join59(homedir8(), ".codex"));
|
|
97944
|
+
const configPath = join59(codexHome, "config.toml");
|
|
97741
97945
|
const installedBinDir = await readInstalledCodexBinDir(codexHome);
|
|
97742
97946
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
97743
97947
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
@@ -97791,17 +97995,17 @@ function firstConfiguredPath(...values) {
|
|
|
97791
97995
|
}
|
|
97792
97996
|
function managedGlobalStatePaths(codexHome) {
|
|
97793
97997
|
return [
|
|
97794
|
-
|
|
97795
|
-
|
|
97796
|
-
|
|
97797
|
-
|
|
97798
|
-
|
|
97998
|
+
join59(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
97999
|
+
join59(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
98000
|
+
join59(codexHome, "runtime", "ast-grep"),
|
|
98001
|
+
join59(codexHome, "runtime", "node"),
|
|
98002
|
+
join59(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
97799
98003
|
];
|
|
97800
98004
|
}
|
|
97801
98005
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
97802
98006
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
97803
98007
|
const results = [];
|
|
97804
|
-
await walkForManagedBootstrapDirs(
|
|
98008
|
+
await walkForManagedBootstrapDirs(join59(codexHome, "plugins"), 0, results);
|
|
97805
98009
|
return results;
|
|
97806
98010
|
}
|
|
97807
98011
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -97813,9 +98017,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
97813
98017
|
for (const entry of entries) {
|
|
97814
98018
|
if (!entry.isDirectory())
|
|
97815
98019
|
continue;
|
|
97816
|
-
const childPath =
|
|
98020
|
+
const childPath = join59(directory, entry.name);
|
|
97817
98021
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
97818
|
-
const bootstrapDir =
|
|
98022
|
+
const bootstrapDir = join59(childPath, "bootstrap");
|
|
97819
98023
|
if (await exists6(bootstrapDir))
|
|
97820
98024
|
results.push(bootstrapDir);
|
|
97821
98025
|
continue;
|
|
@@ -97841,7 +98045,7 @@ async function attemptRemove(path) {
|
|
|
97841
98045
|
try {
|
|
97842
98046
|
if (await lstat15(path).catch(() => null) === null)
|
|
97843
98047
|
return false;
|
|
97844
|
-
await
|
|
98048
|
+
await rm14(path, { recursive: true, force: true });
|
|
97845
98049
|
return true;
|
|
97846
98050
|
} catch {
|
|
97847
98051
|
return false;
|
|
@@ -97849,7 +98053,7 @@ async function attemptRemove(path) {
|
|
|
97849
98053
|
}
|
|
97850
98054
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
97851
98055
|
try {
|
|
97852
|
-
await rmdir(
|
|
98056
|
+
await rmdir(join59(codexHome, "runtime"));
|
|
97853
98057
|
} catch (error) {
|
|
97854
98058
|
if (isExpectedRuntimePruneFailure(error))
|
|
97855
98059
|
return;
|
|
@@ -97861,14 +98065,14 @@ function isExpectedRuntimePruneFailure(error) {
|
|
|
97861
98065
|
}
|
|
97862
98066
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
97863
98067
|
const manifestPaths = [
|
|
97864
|
-
|
|
98068
|
+
join59(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
97865
98069
|
];
|
|
97866
|
-
const versionRoot =
|
|
98070
|
+
const versionRoot = join59(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
97867
98071
|
if (await exists6(versionRoot)) {
|
|
97868
98072
|
const entries = await readdir13(versionRoot, { withFileTypes: true });
|
|
97869
98073
|
for (const entry of entries) {
|
|
97870
98074
|
if (entry.isDirectory())
|
|
97871
|
-
manifestPaths.push(
|
|
98075
|
+
manifestPaths.push(join59(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
97872
98076
|
}
|
|
97873
98077
|
}
|
|
97874
98078
|
const paths = new Set;
|
|
@@ -97885,19 +98089,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
97885
98089
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
97886
98090
|
if (!await exists6(configPath))
|
|
97887
98091
|
return [];
|
|
97888
|
-
const config = await
|
|
97889
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
98092
|
+
const config = await readFile27(configPath, "utf8");
|
|
98093
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join59(codexHome, "agents", `${agentName}.toml`));
|
|
97890
98094
|
}
|
|
97891
98095
|
async function readInstalledAgentManifest(manifestPath) {
|
|
97892
98096
|
if (!await exists6(manifestPath))
|
|
97893
98097
|
return [];
|
|
97894
|
-
const parsed = JSON.parse(await
|
|
98098
|
+
const parsed = JSON.parse(await readFile27(manifestPath, "utf8"));
|
|
97895
98099
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.agents))
|
|
97896
98100
|
return [];
|
|
97897
98101
|
return parsed.agents.filter((path) => typeof path === "string");
|
|
97898
98102
|
}
|
|
97899
98103
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
97900
|
-
const agentsDir =
|
|
98104
|
+
const agentsDir = join59(codexHome, "agents");
|
|
97901
98105
|
const removed = [];
|
|
97902
98106
|
const skipped = [];
|
|
97903
98107
|
for (const path of paths) {
|
|
@@ -97912,7 +98116,7 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
97912
98116
|
skipped.push(path);
|
|
97913
98117
|
continue;
|
|
97914
98118
|
}
|
|
97915
|
-
await
|
|
98119
|
+
await rm14(path, { force: true });
|
|
97916
98120
|
removed.push(path);
|
|
97917
98121
|
}
|
|
97918
98122
|
return { removed, skipped };
|
|
@@ -97949,14 +98153,14 @@ function nodeErrorCode6(error) {
|
|
|
97949
98153
|
import { execFile as execFile3 } from "node:child_process";
|
|
97950
98154
|
import { existsSync as existsSync31 } from "node:fs";
|
|
97951
98155
|
import { homedir as homedir11 } from "node:os";
|
|
97952
|
-
import { dirname as dirname25, join as
|
|
98156
|
+
import { dirname as dirname25, join as join64, resolve as resolve20 } from "node:path";
|
|
97953
98157
|
import { fileURLToPath } from "node:url";
|
|
97954
98158
|
import { promisify as promisify2 } from "node:util";
|
|
97955
98159
|
|
|
97956
98160
|
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
97957
98161
|
import { existsSync as existsSync29 } from "node:fs";
|
|
97958
98162
|
import { homedir as homedir9 } from "node:os";
|
|
97959
|
-
import { join as
|
|
98163
|
+
import { join as join60, resolve as resolve17 } from "node:path";
|
|
97960
98164
|
var AGENT_DIR_ENV_NAMES = [
|
|
97961
98165
|
"OMO_CODING_AGENT_DIR",
|
|
97962
98166
|
"SENPI_CODING_AGENT_DIR",
|
|
@@ -97970,25 +98174,25 @@ function resolveAgentHome(options) {
|
|
|
97970
98174
|
if (configured)
|
|
97971
98175
|
return resolve17(configured);
|
|
97972
98176
|
}
|
|
97973
|
-
const brandedHome =
|
|
97974
|
-
const canonical =
|
|
97975
|
-
if (exists(
|
|
98177
|
+
const brandedHome = join60(homeDir, ".omo");
|
|
98178
|
+
const canonical = join60(brandedHome, "agent");
|
|
98179
|
+
if (exists(join60(canonical, AGENT_HOME_SENTINEL)))
|
|
97976
98180
|
return canonical;
|
|
97977
|
-
if (exists(
|
|
98181
|
+
if (exists(join60(brandedHome, AGENT_HOME_SENTINEL)))
|
|
97978
98182
|
return brandedHome;
|
|
97979
|
-
return
|
|
98183
|
+
return join60(homeDir, ".senpi", "agent");
|
|
97980
98184
|
}
|
|
97981
98185
|
|
|
97982
98186
|
// packages/omo-senpi/src/install/local-launcher.ts
|
|
97983
98187
|
import { chmodSync as chmodSync3, existsSync as existsSync30, mkdirSync as mkdirSync12, readFileSync as readFileSync14, rmSync as rmSync4, writeFileSync as writeFileSync7 } from "node:fs";
|
|
97984
98188
|
import { homedir as homedir10 } from "node:os";
|
|
97985
|
-
import { dirname as dirname22, join as
|
|
98189
|
+
import { dirname as dirname22, join as join61, resolve as resolve18 } from "node:path";
|
|
97986
98190
|
var MARKER = "omo-local-launcher";
|
|
97987
98191
|
function localLauncherPath(homeDir = homedir10()) {
|
|
97988
|
-
return
|
|
98192
|
+
return join61(homeDir, ".local", "bin", "omo");
|
|
97989
98193
|
}
|
|
97990
98194
|
function localLauncherCmdPath(homeDir = homedir10()) {
|
|
97991
|
-
return
|
|
98195
|
+
return join61(homeDir, ".local", "bin", "omo.cmd");
|
|
97992
98196
|
}
|
|
97993
98197
|
function releaseChannel(version) {
|
|
97994
98198
|
return version !== undefined && version.includes("-") ? "beta" : "latest";
|
|
@@ -98006,7 +98210,7 @@ function renderLocalLauncher(options) {
|
|
|
98006
98210
|
userAgent: "omo",
|
|
98007
98211
|
originator: "omo",
|
|
98008
98212
|
changelog: {
|
|
98009
|
-
path:
|
|
98213
|
+
path: join61(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
|
|
98010
98214
|
},
|
|
98011
98215
|
update: {
|
|
98012
98216
|
packageName: "omo-ai",
|
|
@@ -98078,8 +98282,8 @@ node "%~dp0omo" %*\r
|
|
|
98078
98282
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
98079
98283
|
import { createHash as createHash6 } from "node:crypto";
|
|
98080
98284
|
import { constants as constants9 } from "node:fs";
|
|
98081
|
-
import { access as access2, readFile as
|
|
98082
|
-
import { dirname as dirname24, join as
|
|
98285
|
+
import { access as access2, readFile as readFile29, stat as stat6 } from "node:fs/promises";
|
|
98286
|
+
import { dirname as dirname24, join as join63 } from "node:path";
|
|
98083
98287
|
|
|
98084
98288
|
// packages/memory-core/src/personas/manifest.ts
|
|
98085
98289
|
var PERSONA_ASSET_FILENAMES = {
|
|
@@ -98097,18 +98301,18 @@ var PERSONA_ASSET_FILES = [
|
|
|
98097
98301
|
|
|
98098
98302
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
98099
98303
|
import { constants as constants8 } from "node:fs";
|
|
98100
|
-
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as
|
|
98101
|
-
import { basename as basename10, dirname as dirname23, join as
|
|
98304
|
+
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile28, rename as rename5, writeFile as writeFile15 } from "node:fs/promises";
|
|
98305
|
+
import { basename as basename10, dirname as dirname23, join as join62, resolve as resolve19 } from "node:path";
|
|
98102
98306
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
98103
98307
|
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
|
|
98104
98308
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
98105
|
-
|
|
98106
|
-
|
|
98309
|
+
join62("packages", "pi-goal"),
|
|
98310
|
+
join62("packages", "pi-webfetch")
|
|
98107
98311
|
];
|
|
98108
98312
|
async function readSettings(settingsPath) {
|
|
98109
98313
|
let raw;
|
|
98110
98314
|
try {
|
|
98111
|
-
raw = await
|
|
98315
|
+
raw = await readFile28(settingsPath, "utf8");
|
|
98112
98316
|
} catch (error) {
|
|
98113
98317
|
if (isErrno(error, "ENOENT"))
|
|
98114
98318
|
return {};
|
|
@@ -98155,11 +98359,11 @@ async function writeSettingsAtomically(settingsPath, settings) {
|
|
|
98155
98359
|
if (await fileExists(settingsPath)) {
|
|
98156
98360
|
await copyFile3(settingsPath, backupPath);
|
|
98157
98361
|
} else {
|
|
98158
|
-
await
|
|
98362
|
+
await writeFile15(backupPath, `{}
|
|
98159
98363
|
`, "utf8");
|
|
98160
98364
|
}
|
|
98161
98365
|
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
|
|
98162
|
-
await
|
|
98366
|
+
await writeFile15(tempPath, `${JSON.stringify(settings, null, 2)}
|
|
98163
98367
|
`, "utf8");
|
|
98164
98368
|
await rename5(tempPath, settingsPath);
|
|
98165
98369
|
return backupPath;
|
|
@@ -98182,7 +98386,7 @@ function isRecord15(value) {
|
|
|
98182
98386
|
async function readPackageName(packagePath) {
|
|
98183
98387
|
let raw;
|
|
98184
98388
|
try {
|
|
98185
|
-
raw = await
|
|
98389
|
+
raw = await readFile28(join62(packagePath, "package.json"), "utf8");
|
|
98186
98390
|
} catch (error) {
|
|
98187
98391
|
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
|
|
98188
98392
|
return;
|
|
@@ -98214,54 +98418,54 @@ function isErrno(error, code) {
|
|
|
98214
98418
|
|
|
98215
98419
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
98216
98420
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
98217
|
-
|
|
98218
|
-
|
|
98219
|
-
|
|
98220
|
-
|
|
98221
|
-
|
|
98222
|
-
|
|
98223
|
-
...PERSONA_ASSET_FILES.map((filename) =>
|
|
98224
|
-
|
|
98225
|
-
|
|
98226
|
-
|
|
98227
|
-
|
|
98228
|
-
|
|
98229
|
-
|
|
98230
|
-
|
|
98231
|
-
|
|
98232
|
-
|
|
98233
|
-
|
|
98234
|
-
|
|
98235
|
-
|
|
98236
|
-
|
|
98237
|
-
|
|
98238
|
-
|
|
98239
|
-
|
|
98240
|
-
|
|
98241
|
-
|
|
98242
|
-
|
|
98243
|
-
|
|
98244
|
-
|
|
98245
|
-
|
|
98246
|
-
|
|
98247
|
-
|
|
98248
|
-
|
|
98249
|
-
|
|
98250
|
-
|
|
98251
|
-
|
|
98252
|
-
|
|
98253
|
-
|
|
98421
|
+
join63("extensions", "omo.js"),
|
|
98422
|
+
join63("extensions", "omo-task.js"),
|
|
98423
|
+
join63("extensions", "omo-computer-use.js"),
|
|
98424
|
+
join63("extensions", "assets.generated.json"),
|
|
98425
|
+
join63("extensions", "omo-member.js"),
|
|
98426
|
+
join63("extensions", "memory-run-supervisor.mjs"),
|
|
98427
|
+
...PERSONA_ASSET_FILES.map((filename) => join63("extensions", filename)),
|
|
98428
|
+
join63("skills", "ast-grep", "SKILL.md"),
|
|
98429
|
+
join63("skills", "browser", "SKILL.md"),
|
|
98430
|
+
join63("skills", "coding-agent-sessions", "SKILL.md"),
|
|
98431
|
+
join63("skills", "debugging", "SKILL.md"),
|
|
98432
|
+
join63("skills", "frontend", "SKILL.md"),
|
|
98433
|
+
join63("skills", "git-master", "SKILL.md"),
|
|
98434
|
+
join63("skills", "init-deep", "SKILL.md"),
|
|
98435
|
+
join63("skills", "lsp-setup", "SKILL.md"),
|
|
98436
|
+
join63("skills", "programming", "SKILL.md"),
|
|
98437
|
+
join63("skills", "refactor", "SKILL.md"),
|
|
98438
|
+
join63("skills", "remove-ai-slops", "SKILL.md"),
|
|
98439
|
+
join63("skills", "review-work", "SKILL.md"),
|
|
98440
|
+
join63("skills", "ultimate-browsing", "SKILL.md"),
|
|
98441
|
+
join63("skills", "ultrawork", "SKILL.md"),
|
|
98442
|
+
join63("skills", "ulw-execute", "SKILL.md"),
|
|
98443
|
+
join63("skills", "ulw-loop", "SKILL.md"),
|
|
98444
|
+
join63("skills", "ulw-plan", "SKILL.md"),
|
|
98445
|
+
join63("skills", "ulw-research", "SKILL.md"),
|
|
98446
|
+
join63("skills", "visual-qa", "SKILL.md"),
|
|
98447
|
+
join63("skills-conditional", "x-search", "SKILL.md"),
|
|
98448
|
+
join63("runtime", "agent-toolkit-sdk", "sdk.js"),
|
|
98449
|
+
join63("runtime", "ast-grep-mcp", "cli.js"),
|
|
98450
|
+
join63("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
98451
|
+
join63("runtime", "lsp-daemon", "dist", "index.js"),
|
|
98452
|
+
join63("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
98453
|
+
join63("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
98454
|
+
join63("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
98455
|
+
join63("runtime", "lsp-daemon", "dist", "package.json"),
|
|
98456
|
+
join63("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
98457
|
+
join63("scripts", "install.mjs"),
|
|
98254
98458
|
"daemon-launch-spec.json"
|
|
98255
98459
|
];
|
|
98256
98460
|
async function ensurePluginArtifacts(context) {
|
|
98257
98461
|
if (context.allowBuild) {
|
|
98258
|
-
await context.runCommand("node", [
|
|
98259
|
-
await context.runCommand("node", [
|
|
98260
|
-
await context.runCommand("node", [
|
|
98261
|
-
await context.runCommand("node", [
|
|
98262
|
-
await context.runCommand("node", [
|
|
98263
|
-
await context.runCommand("node", [
|
|
98264
|
-
await context.runCommand("node", [
|
|
98462
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
98463
|
+
await context.runCommand("node", [join63("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
98464
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
98465
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
98466
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
98467
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
98468
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
|
|
98265
98469
|
}
|
|
98266
98470
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
98267
98471
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -98270,14 +98474,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
98270
98474
|
}
|
|
98271
98475
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
98272
98476
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
98273
|
-
if (!await fileExists2(
|
|
98477
|
+
if (!await fileExists2(join63(pluginPath, artifact)))
|
|
98274
98478
|
return true;
|
|
98275
98479
|
}
|
|
98276
98480
|
return false;
|
|
98277
98481
|
}
|
|
98278
98482
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
98279
|
-
const runtimeEntry =
|
|
98280
|
-
const manifestPath =
|
|
98483
|
+
const runtimeEntry = join63(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
98484
|
+
const manifestPath = join63(dirname24(runtimeEntry), "manifest.json");
|
|
98281
98485
|
let runtimeStat;
|
|
98282
98486
|
try {
|
|
98283
98487
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -98292,7 +98496,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
98292
98496
|
}
|
|
98293
98497
|
let manifest;
|
|
98294
98498
|
try {
|
|
98295
|
-
manifest = JSON.parse(await
|
|
98499
|
+
manifest = JSON.parse(await readFile29(manifestPath, "utf8"));
|
|
98296
98500
|
} catch (error) {
|
|
98297
98501
|
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
|
|
98298
98502
|
}
|
|
@@ -98301,7 +98505,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
98301
98505
|
}
|
|
98302
98506
|
let actualSha256;
|
|
98303
98507
|
try {
|
|
98304
|
-
actualSha256 = createHash6("sha256").update(await
|
|
98508
|
+
actualSha256 = createHash6("sha256").update(await readFile29(runtimeEntry)).digest("hex");
|
|
98305
98509
|
} catch (error) {
|
|
98306
98510
|
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
|
|
98307
98511
|
}
|
|
@@ -98352,7 +98556,7 @@ async function runSenpiInstaller(options = {}) {
|
|
|
98352
98556
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
98353
98557
|
const launcherPath = installLocalLauncher({
|
|
98354
98558
|
pluginPath: context.pluginPath,
|
|
98355
|
-
senpiCliPath:
|
|
98559
|
+
senpiCliPath: join64(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
|
|
98356
98560
|
homeDir: context.homeDir
|
|
98357
98561
|
});
|
|
98358
98562
|
return {
|
|
@@ -98372,13 +98576,13 @@ function resolveInstallContext(options) {
|
|
|
98372
98576
|
const repoRoot = resolve20(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname25(fileURLToPath(import.meta.url))) : dirname25(resolve20(options.pluginPath))));
|
|
98373
98577
|
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
|
|
98374
98578
|
const agentDir = resolve20(options.agentDir ?? resolveAgentHome({ env, homeDir }));
|
|
98375
|
-
const pluginPath = resolve20(options.pluginPath ??
|
|
98579
|
+
const pluginPath = resolve20(options.pluginPath ?? join64(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
98376
98580
|
return {
|
|
98377
98581
|
env,
|
|
98378
98582
|
repoRoot,
|
|
98379
98583
|
agentDir,
|
|
98380
98584
|
homeDir,
|
|
98381
|
-
settingsPath:
|
|
98585
|
+
settingsPath: join64(agentDir, "settings.json"),
|
|
98382
98586
|
pluginPath,
|
|
98383
98587
|
platform: options.platform ?? process.platform,
|
|
98384
98588
|
allowBuild,
|
|
@@ -98395,7 +98599,7 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
98395
98599
|
function findRepoRoot2(importerDir) {
|
|
98396
98600
|
let current = importerDir;
|
|
98397
98601
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
98398
|
-
if (fileExistsSync(
|
|
98602
|
+
if (fileExistsSync(join64(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
98399
98603
|
return current;
|
|
98400
98604
|
current = resolve20(current, "..");
|
|
98401
98605
|
}
|
|
@@ -98410,7 +98614,7 @@ async function runNativeDevInstaller(options) {
|
|
|
98410
98614
|
}
|
|
98411
98615
|
// packages/omo-opencode/src/cli/install-native/legacy-omo-bin.ts
|
|
98412
98616
|
import { lstatSync as lstatSync4, readFileSync as readFileSync15, realpathSync as realpathSync8, statSync as statSync4 } from "node:fs";
|
|
98413
|
-
import { dirname as dirname26, isAbsolute as isAbsolute12, join as
|
|
98617
|
+
import { dirname as dirname26, isAbsolute as isAbsolute12, join as join65, posix as posix9, win32 as win325 } from "node:path";
|
|
98414
98618
|
var NATIVE_OMO_PACKAGE = "omo-ai";
|
|
98415
98619
|
var LEGACY_OMO_BIN_PACKAGES = ["oh-my-openagent", "oh-my-opencode", "lazycodex"];
|
|
98416
98620
|
var CODEX_LIGHT_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
@@ -98475,7 +98679,7 @@ function classify(owner) {
|
|
|
98475
98679
|
}
|
|
98476
98680
|
function omoShimPathsIn(directory, isWindows) {
|
|
98477
98681
|
const suffixes = isWindows ? WINDOWS_BIN_SUFFIXES : [""];
|
|
98478
|
-
return suffixes.map((suffix) =>
|
|
98682
|
+
return suffixes.map((suffix) => join65(directory, `${OMO_BIN_NAME}${suffix}`)).filter(pathExists);
|
|
98479
98683
|
}
|
|
98480
98684
|
function pathExists(path) {
|
|
98481
98685
|
try {
|
|
@@ -98510,7 +98714,7 @@ function shimEntryPaths(shim, shimDirectory) {
|
|
|
98510
98714
|
const quoted = match[0];
|
|
98511
98715
|
const relativeToShim = quoted.match(/^(?:%~?dp0%?|\$\{?basedir\}?)[\\/]?(.*)$/)?.[1];
|
|
98512
98716
|
if (relativeToShim !== undefined)
|
|
98513
|
-
paths.push(
|
|
98717
|
+
paths.push(join65(shimDirectory, relativeToShim.replace(/\\/g, "/")));
|
|
98514
98718
|
else if (isAbsolute12(quoted))
|
|
98515
98719
|
paths.push(quoted);
|
|
98516
98720
|
}
|
|
@@ -98531,7 +98735,7 @@ function bunxEntryPaths(binPath) {
|
|
|
98531
98735
|
const end = contents.indexOf('"\x00');
|
|
98532
98736
|
if (end <= 0)
|
|
98533
98737
|
return [];
|
|
98534
|
-
return [
|
|
98738
|
+
return [join65(dirname26(dirname26(binPath)), contents.slice(0, end).replace(/\\/g, "/"))];
|
|
98535
98739
|
}
|
|
98536
98740
|
function codexLightWrapperOwner(shim) {
|
|
98537
98741
|
if (!shim.includes(CODEX_LIGHT_WRAPPER_MARKER))
|
|
@@ -98545,7 +98749,7 @@ function isInsideNodeModules(path) {
|
|
|
98545
98749
|
function ownerOfFile(file) {
|
|
98546
98750
|
let directory = dirname26(file);
|
|
98547
98751
|
for (let depth = 0;depth < OWNER_WALK_UP_LIMIT; depth += 1) {
|
|
98548
|
-
const manifest = readWholeFile(
|
|
98752
|
+
const manifest = readWholeFile(join65(directory, "package.json"));
|
|
98549
98753
|
if (manifest !== null) {
|
|
98550
98754
|
const parsed = parseManifest(manifest);
|
|
98551
98755
|
if (parsed !== null)
|
|
@@ -98843,12 +99047,12 @@ init_provider_availability();
|
|
|
98843
99047
|
|
|
98844
99048
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
98845
99049
|
import { existsSync as existsSync33, mkdirSync as mkdirSync13, readFileSync as readFileSync17 } from "node:fs";
|
|
98846
|
-
import { join as
|
|
99050
|
+
import { join as join67 } from "node:path";
|
|
98847
99051
|
|
|
98848
99052
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
98849
99053
|
init_shared();
|
|
98850
99054
|
import { existsSync as existsSync32, readFileSync as readFileSync16 } from "node:fs";
|
|
98851
|
-
import { join as
|
|
99055
|
+
import { join as join66 } from "node:path";
|
|
98852
99056
|
var TUI_SUBPATH = "tui";
|
|
98853
99057
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
98854
99058
|
function tuiPluginSpecName(entry) {
|
|
@@ -98868,7 +99072,7 @@ function fileEntryPackageJsonPath(entry) {
|
|
|
98868
99072
|
let path = entry.slice("file:".length);
|
|
98869
99073
|
if (path.startsWith("//"))
|
|
98870
99074
|
path = path.slice(2);
|
|
98871
|
-
return
|
|
99075
|
+
return join66(path, "package.json");
|
|
98872
99076
|
}
|
|
98873
99077
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
98874
99078
|
if (!existsSync32(pkgJsonPath))
|
|
@@ -98907,7 +99111,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
98907
99111
|
const packageName = packageNameFromServerEntry(entry);
|
|
98908
99112
|
if (packageName === null)
|
|
98909
99113
|
return null;
|
|
98910
|
-
return packageJsonExportsTui(
|
|
99114
|
+
return packageJsonExportsTui(join66(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
98911
99115
|
}
|
|
98912
99116
|
function isOurFilePluginEntry(entry) {
|
|
98913
99117
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -98994,7 +99198,7 @@ function detectServerPluginRegistration() {
|
|
|
98994
99198
|
}
|
|
98995
99199
|
}
|
|
98996
99200
|
function detectTuiPluginRegistration() {
|
|
98997
|
-
const tuiJsonPath =
|
|
99201
|
+
const tuiJsonPath = join66(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
98998
99202
|
if (!existsSync32(tuiJsonPath)) {
|
|
98999
99203
|
return {
|
|
99000
99204
|
registered: false,
|
|
@@ -99170,10 +99374,10 @@ function readConfig(path) {
|
|
|
99170
99374
|
return null;
|
|
99171
99375
|
}
|
|
99172
99376
|
function readServerConfig(configDir) {
|
|
99173
|
-
const jsoncPath =
|
|
99377
|
+
const jsoncPath = join67(configDir, "opencode.jsonc");
|
|
99174
99378
|
if (existsSync33(jsoncPath))
|
|
99175
99379
|
return readConfig(jsoncPath);
|
|
99176
|
-
const jsonPath =
|
|
99380
|
+
const jsonPath = join67(configDir, "opencode.json");
|
|
99177
99381
|
if (existsSync33(jsonPath))
|
|
99178
99382
|
return readConfig(jsonPath);
|
|
99179
99383
|
return null;
|
|
@@ -99230,7 +99434,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
99230
99434
|
if (!desiredEntry) {
|
|
99231
99435
|
return { changed: false, reason: "no-server-entry" };
|
|
99232
99436
|
}
|
|
99233
|
-
const tuiJsonPath =
|
|
99437
|
+
const tuiJsonPath = join67(configDir, "tui.json");
|
|
99234
99438
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
99235
99439
|
if (malformed || pluginFieldInvalid(config)) {
|
|
99236
99440
|
return { changed: false, reason: "malformed" };
|
|
@@ -99251,10 +99455,10 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
99251
99455
|
init_shared();
|
|
99252
99456
|
init_config_context();
|
|
99253
99457
|
import { existsSync as existsSync34, readFileSync as readFileSync18 } from "node:fs";
|
|
99254
|
-
import { join as
|
|
99458
|
+
import { join as join68 } from "node:path";
|
|
99255
99459
|
function readPluginEntries(configDir) {
|
|
99256
99460
|
for (const name of ["opencode.jsonc", "opencode.json"]) {
|
|
99257
|
-
const configPath =
|
|
99461
|
+
const configPath = join68(configDir, name);
|
|
99258
99462
|
if (!existsSync34(configPath))
|
|
99259
99463
|
continue;
|
|
99260
99464
|
try {
|
|
@@ -99302,7 +99506,7 @@ function refreshOpenCodePluginSandboxes(options = {}) {
|
|
|
99302
99506
|
|
|
99303
99507
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
99304
99508
|
import { homedir as homedir13 } from "node:os";
|
|
99305
|
-
import { join as
|
|
99509
|
+
import { join as join69 } from "node:path";
|
|
99306
99510
|
|
|
99307
99511
|
// packages/shared-skills/index.mjs
|
|
99308
99512
|
import { existsSync as existsSync35 } from "node:fs";
|
|
@@ -99324,9 +99528,9 @@ function describeResult2(result) {
|
|
|
99324
99528
|
}
|
|
99325
99529
|
async function installAstGrepForOpenCode(options = {}) {
|
|
99326
99530
|
const platform = options.platform ?? process.platform;
|
|
99327
|
-
const baseDir =
|
|
99531
|
+
const baseDir = join69(options.homeDir ?? homedir13(), ".omo");
|
|
99328
99532
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
99329
|
-
const skillDir =
|
|
99533
|
+
const skillDir = join69(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
99330
99534
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
99331
99535
|
try {
|
|
99332
99536
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -103689,9 +103893,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
103689
103893
|
}
|
|
103690
103894
|
// packages/boulder-state/src/storage/path.ts
|
|
103691
103895
|
import { existsSync as existsSync37 } from "node:fs";
|
|
103692
|
-
import { isAbsolute as isAbsolute13, join as
|
|
103896
|
+
import { isAbsolute as isAbsolute13, join as join70, relative as relative8, resolve as resolve21 } from "node:path";
|
|
103693
103897
|
function getBoulderFilePath(directory) {
|
|
103694
|
-
return
|
|
103898
|
+
return join70(directory, BOULDER_DIR, BOULDER_FILE);
|
|
103695
103899
|
}
|
|
103696
103900
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
103697
103901
|
return isAbsolute13(trackedPath) ? resolve21(trackedPath) : resolve21(baseDirectory, trackedPath);
|
|
@@ -103876,9 +104080,9 @@ init_state();
|
|
|
103876
104080
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
103877
104081
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
103878
104082
|
import { existsSync as existsSync40, mkdirSync as mkdirSync14, readFileSync as readFileSync22, rmSync as rmSync6, writeFileSync as writeFileSync8 } from "node:fs";
|
|
103879
|
-
import { join as
|
|
104083
|
+
import { join as join71 } from "node:path";
|
|
103880
104084
|
function getMarkerPath(directory, sessionID) {
|
|
103881
|
-
return
|
|
104085
|
+
return join71(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
103882
104086
|
}
|
|
103883
104087
|
function readContinuationMarker(directory, sessionID) {
|
|
103884
104088
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -103951,7 +104155,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
103951
104155
|
init_shared();
|
|
103952
104156
|
init_compaction_marker();
|
|
103953
104157
|
import { readFileSync as readFileSync23, readdirSync as readdirSync10 } from "node:fs";
|
|
103954
|
-
import { join as
|
|
104158
|
+
import { join as join72 } from "node:path";
|
|
103955
104159
|
var defaultSessionLastAgentDeps = {
|
|
103956
104160
|
getMessageDir,
|
|
103957
104161
|
isSqliteBackend,
|
|
@@ -104011,7 +104215,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
104011
104215
|
try {
|
|
104012
104216
|
const messages = readdirSync10(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
104013
104217
|
try {
|
|
104014
|
-
const content = readFileSync23(
|
|
104218
|
+
const content = readFileSync23(join72(messageDir, fileName), "utf-8");
|
|
104015
104219
|
const parsed = JSON.parse(content);
|
|
104016
104220
|
return {
|
|
104017
104221
|
fileName,
|
|
@@ -104055,7 +104259,7 @@ init_agent_display_names();
|
|
|
104055
104259
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
104056
104260
|
init_frontmatter2();
|
|
104057
104261
|
import { existsSync as existsSync41, readFileSync as readFileSync24, writeFileSync as writeFileSync9, unlinkSync as unlinkSync6, mkdirSync as mkdirSync15 } from "node:fs";
|
|
104058
|
-
import { dirname as dirname28, join as
|
|
104262
|
+
import { dirname as dirname28, join as join73 } from "node:path";
|
|
104059
104263
|
|
|
104060
104264
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
104061
104265
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -104064,7 +104268,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
104064
104268
|
|
|
104065
104269
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
104066
104270
|
function getStateFilePath(directory, customPath) {
|
|
104067
|
-
return customPath ?
|
|
104271
|
+
return customPath ? join73(directory, customPath) : join73(directory, DEFAULT_STATE_FILE);
|
|
104068
104272
|
}
|
|
104069
104273
|
function readState(directory, customPath) {
|
|
104070
104274
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -105171,7 +105375,7 @@ init_extract_semver();
|
|
|
105171
105375
|
init_bun_which_shim();
|
|
105172
105376
|
import { existsSync as existsSync49, accessSync as accessSync4, constants as constants12 } from "node:fs";
|
|
105173
105377
|
import { homedir as homedir16 } from "node:os";
|
|
105174
|
-
import { join as
|
|
105378
|
+
import { join as join80 } from "node:path";
|
|
105175
105379
|
|
|
105176
105380
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
105177
105381
|
init_spawn_with_windows_hide();
|
|
@@ -105263,17 +105467,17 @@ function getDesktopAppPaths(platform) {
|
|
|
105263
105467
|
case "darwin":
|
|
105264
105468
|
return [
|
|
105265
105469
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
105266
|
-
|
|
105470
|
+
join80(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
105267
105471
|
];
|
|
105268
105472
|
case "win32": {
|
|
105269
105473
|
const programFiles = process.env.ProgramFiles;
|
|
105270
105474
|
const localAppData = process.env.LOCALAPPDATA;
|
|
105271
105475
|
const paths = [];
|
|
105272
105476
|
if (programFiles) {
|
|
105273
|
-
paths.push(
|
|
105477
|
+
paths.push(join80(programFiles, "OpenCode", "OpenCode.exe"));
|
|
105274
105478
|
}
|
|
105275
105479
|
if (localAppData) {
|
|
105276
|
-
paths.push(
|
|
105480
|
+
paths.push(join80(localAppData, "OpenCode", "OpenCode.exe"));
|
|
105277
105481
|
}
|
|
105278
105482
|
return paths;
|
|
105279
105483
|
}
|
|
@@ -105281,8 +105485,8 @@ function getDesktopAppPaths(platform) {
|
|
|
105281
105485
|
return [
|
|
105282
105486
|
"/usr/bin/opencode",
|
|
105283
105487
|
"/usr/lib/opencode/opencode",
|
|
105284
|
-
|
|
105285
|
-
|
|
105488
|
+
join80(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
105489
|
+
join80(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
105286
105490
|
];
|
|
105287
105491
|
default:
|
|
105288
105492
|
return [];
|
|
@@ -105314,7 +105518,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
105314
105518
|
const candidates = getCommandCandidates2(platform);
|
|
105315
105519
|
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
|
|
105316
105520
|
for (const command of candidates) {
|
|
105317
|
-
const fullPath =
|
|
105521
|
+
const fullPath = join80(entry, command);
|
|
105318
105522
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
105319
105523
|
return { binary: command, path: fullPath };
|
|
105320
105524
|
}
|
|
@@ -105458,22 +105662,22 @@ init_package_json_locator();
|
|
|
105458
105662
|
import { existsSync as existsSync51, readFileSync as readFileSync33, readdirSync as readdirSync12 } from "node:fs";
|
|
105459
105663
|
import { createRequire as createRequire2 } from "node:module";
|
|
105460
105664
|
import { homedir as homedir17 } from "node:os";
|
|
105461
|
-
import { join as
|
|
105665
|
+
import { join as join81 } from "node:path";
|
|
105462
105666
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
105463
105667
|
init_shared();
|
|
105464
105668
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
105465
105669
|
if (platform === "darwin")
|
|
105466
|
-
return
|
|
105670
|
+
return join81(homedir17(), "Library", "Caches");
|
|
105467
105671
|
if (platform === "win32")
|
|
105468
|
-
return process.env.LOCALAPPDATA ??
|
|
105469
|
-
return
|
|
105672
|
+
return process.env.LOCALAPPDATA ?? join81(homedir17(), "AppData", "Local");
|
|
105673
|
+
return join81(homedir17(), ".cache");
|
|
105470
105674
|
}
|
|
105471
105675
|
function resolveOpenCodeCacheDir() {
|
|
105472
105676
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
105473
105677
|
if (xdgCacheHome)
|
|
105474
|
-
return
|
|
105678
|
+
return join81(xdgCacheHome, "opencode");
|
|
105475
105679
|
const fromShared = getOpenCodeCacheDir();
|
|
105476
|
-
const platformDefault =
|
|
105680
|
+
const platformDefault = join81(getPlatformDefaultCacheDir(), "opencode");
|
|
105477
105681
|
if (existsSync51(fromShared) || !existsSync51(platformDefault))
|
|
105478
105682
|
return fromShared;
|
|
105479
105683
|
return platformDefault;
|
|
@@ -105505,11 +105709,11 @@ function normalizeVersion(value) {
|
|
|
105505
105709
|
function createPackageCandidates(rootDir) {
|
|
105506
105710
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
105507
105711
|
packageName,
|
|
105508
|
-
installedPackagePath:
|
|
105712
|
+
installedPackagePath: join81(rootDir, "node_modules", packageName, "package.json")
|
|
105509
105713
|
}));
|
|
105510
105714
|
}
|
|
105511
105715
|
function createTaggedInstallCandidates(rootDir) {
|
|
105512
|
-
const packagesDir =
|
|
105716
|
+
const packagesDir = join81(rootDir, "packages");
|
|
105513
105717
|
if (!existsSync51(packagesDir))
|
|
105514
105718
|
return [];
|
|
105515
105719
|
const candidates = [];
|
|
@@ -105517,14 +105721,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
105517
105721
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
105518
105722
|
if (packageName === undefined)
|
|
105519
105723
|
continue;
|
|
105520
|
-
const installDir =
|
|
105724
|
+
const installDir = join81(packagesDir, entryName);
|
|
105521
105725
|
candidates.push({
|
|
105522
105726
|
cacheDir: installDir,
|
|
105523
|
-
cachePackagePath:
|
|
105727
|
+
cachePackagePath: join81(installDir, "package.json"),
|
|
105524
105728
|
packageCandidates: [
|
|
105525
105729
|
{
|
|
105526
105730
|
packageName,
|
|
105527
|
-
installedPackagePath:
|
|
105731
|
+
installedPackagePath: join81(installDir, "node_modules", packageName, "package.json")
|
|
105528
105732
|
}
|
|
105529
105733
|
]
|
|
105530
105734
|
});
|
|
@@ -105569,13 +105773,13 @@ function getLoadedPluginVersion() {
|
|
|
105569
105773
|
const candidates = [
|
|
105570
105774
|
{
|
|
105571
105775
|
cacheDir: configDir,
|
|
105572
|
-
cachePackagePath:
|
|
105776
|
+
cachePackagePath: join81(configDir, "package.json"),
|
|
105573
105777
|
packageCandidates: createPackageCandidates(configDir)
|
|
105574
105778
|
},
|
|
105575
105779
|
...createTaggedInstallCandidates(configDir),
|
|
105576
105780
|
{
|
|
105577
105781
|
cacheDir,
|
|
105578
|
-
cachePackagePath:
|
|
105782
|
+
cachePackagePath: join81(cacheDir, "package.json"),
|
|
105579
105783
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
105580
105784
|
},
|
|
105581
105785
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -105768,18 +105972,18 @@ async function checkSystem(deps = defaultDeps5) {
|
|
|
105768
105972
|
init_shared();
|
|
105769
105973
|
import { existsSync as existsSync53, readFileSync as readFileSync35 } from "node:fs";
|
|
105770
105974
|
import { homedir as homedir18 } from "node:os";
|
|
105771
|
-
import { join as
|
|
105975
|
+
import { join as join82 } from "node:path";
|
|
105772
105976
|
function getUserConfigDir2() {
|
|
105773
105977
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
105774
105978
|
if (xdgConfig)
|
|
105775
|
-
return
|
|
105776
|
-
return
|
|
105979
|
+
return join82(xdgConfig, "opencode");
|
|
105980
|
+
return join82(homedir18(), ".config", "opencode");
|
|
105777
105981
|
}
|
|
105778
105982
|
function loadCustomProviderNames() {
|
|
105779
105983
|
const configDir = getUserConfigDir2();
|
|
105780
105984
|
const candidatePaths = [
|
|
105781
|
-
|
|
105782
|
-
|
|
105985
|
+
join82(configDir, "opencode.json"),
|
|
105986
|
+
join82(configDir, "opencode.jsonc")
|
|
105783
105987
|
];
|
|
105784
105988
|
for (const configPath of candidatePaths) {
|
|
105785
105989
|
if (!existsSync53(configPath))
|
|
@@ -105800,7 +106004,7 @@ function loadCustomProviderNames() {
|
|
|
105800
106004
|
return [];
|
|
105801
106005
|
}
|
|
105802
106006
|
function loadAvailableModelsFromCache() {
|
|
105803
|
-
const cacheFile =
|
|
106007
|
+
const cacheFile = join82(getOpenCodeCacheDir(), "models.json");
|
|
105804
106008
|
const customProviders = loadCustomProviderNames();
|
|
105805
106009
|
if (!existsSync53(cacheFile)) {
|
|
105806
106010
|
if (customProviders.length > 0) {
|
|
@@ -105862,7 +106066,7 @@ function loadOmoConfig2() {
|
|
|
105862
106066
|
|
|
105863
106067
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
105864
106068
|
init_shared();
|
|
105865
|
-
import { join as
|
|
106069
|
+
import { join as join83 } from "node:path";
|
|
105866
106070
|
|
|
105867
106071
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
105868
106072
|
function formatModelWithVariant(model, variant) {
|
|
@@ -105904,7 +106108,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
105904
106108
|
}
|
|
105905
106109
|
function buildModelResolutionDetails(options) {
|
|
105906
106110
|
const details = [];
|
|
105907
|
-
const cacheFile =
|
|
106111
|
+
const cacheFile = join83(getOpenCodeCacheDir(), "models.json");
|
|
105908
106112
|
details.push("═══ Available Models (from cache) ═══");
|
|
105909
106113
|
details.push("");
|
|
105910
106114
|
if (options.available.cacheExists) {
|
|
@@ -106245,7 +106449,7 @@ init_src4();
|
|
|
106245
106449
|
init_main();
|
|
106246
106450
|
init_config_migration();
|
|
106247
106451
|
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "node:fs";
|
|
106248
|
-
import { join as
|
|
106452
|
+
import { join as join84 } from "node:path";
|
|
106249
106453
|
var CANONICAL_REPLACEMENT = new Map([
|
|
106250
106454
|
["variant", "reasoning"],
|
|
106251
106455
|
["reasoningEffort", "reasoning"],
|
|
@@ -106306,7 +106510,7 @@ function userConfigPaths() {
|
|
|
106306
106510
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
106307
106511
|
if (home === undefined || home.length === 0)
|
|
106308
106512
|
return [];
|
|
106309
|
-
return [
|
|
106513
|
+
return [join84(home, ".omo", "omo.jsonc"), join84(home, ".omo", "omo.json")];
|
|
106310
106514
|
}
|
|
106311
106515
|
async function checkDeprecatedReasoningKeys() {
|
|
106312
106516
|
const issues = [];
|
|
@@ -106332,13 +106536,13 @@ init_src();
|
|
|
106332
106536
|
import { existsSync as existsSync55 } from "node:fs";
|
|
106333
106537
|
import { createRequire as createRequire3 } from "node:module";
|
|
106334
106538
|
import { homedir as homedir20 } from "node:os";
|
|
106335
|
-
import { dirname as dirname33, join as
|
|
106539
|
+
import { dirname as dirname33, join as join88 } from "node:path";
|
|
106336
106540
|
|
|
106337
106541
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
106338
|
-
import { join as
|
|
106542
|
+
import { join as join87 } from "path";
|
|
106339
106543
|
import { homedir as homedir19, tmpdir as tmpdir4 } from "os";
|
|
106340
106544
|
// packages/comment-checker-core/src/release.ts
|
|
106341
|
-
import { join as
|
|
106545
|
+
import { join as join85 } from "node:path";
|
|
106342
106546
|
var COMMENT_CHECKER_RELEASE_VERSION = "0.8.0";
|
|
106343
106547
|
function commentCheckerBinaryName(platform) {
|
|
106344
106548
|
return platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -106346,19 +106550,19 @@ function commentCheckerBinaryName(platform) {
|
|
|
106346
106550
|
function commentCheckerCacheDir(input) {
|
|
106347
106551
|
if (input.platform === "win32") {
|
|
106348
106552
|
const localAppData = input.env.LOCALAPPDATA || input.env.APPDATA;
|
|
106349
|
-
const base = localAppData ||
|
|
106350
|
-
return
|
|
106553
|
+
const base = localAppData || join85(input.homedir, "AppData", "Local");
|
|
106554
|
+
return join85(base, input.cacheDirName, "bin");
|
|
106351
106555
|
}
|
|
106352
|
-
const base = input.env.XDG_CACHE_HOME ||
|
|
106353
|
-
return
|
|
106556
|
+
const base = input.env.XDG_CACHE_HOME || join85(input.homedir, ".cache");
|
|
106557
|
+
return join85(base, input.cacheDirName, "bin");
|
|
106354
106558
|
}
|
|
106355
106559
|
// packages/comment-checker-core/src/cached-release.ts
|
|
106356
106560
|
import { readFileSync as readFileSync37, writeFileSync as writeFileSync12 } from "node:fs";
|
|
106357
|
-
import { join as
|
|
106561
|
+
import { join as join86 } from "node:path";
|
|
106358
106562
|
var COMMENT_CHECKER_VERSION_MARKER = "comment-checker.version";
|
|
106359
106563
|
function isCachedCommentCheckerCurrent(cacheDir, readFile = (path) => readFileSync37(path, "utf-8")) {
|
|
106360
106564
|
try {
|
|
106361
|
-
return readFile(
|
|
106565
|
+
return readFile(join86(cacheDir, COMMENT_CHECKER_VERSION_MARKER)).trim() === COMMENT_CHECKER_RELEASE_VERSION;
|
|
106362
106566
|
} catch {
|
|
106363
106567
|
return false;
|
|
106364
106568
|
}
|
|
@@ -106368,7 +106572,7 @@ init_binary_downloader();
|
|
|
106368
106572
|
init_logger2();
|
|
106369
106573
|
init_plugin_identity();
|
|
106370
106574
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
106371
|
-
var DEBUG_FILE =
|
|
106575
|
+
var DEBUG_FILE = join87(tmpdir4(), "comment-checker-debug.log");
|
|
106372
106576
|
function getCacheDir2() {
|
|
106373
106577
|
return commentCheckerCacheDir({
|
|
106374
106578
|
platform: process.platform,
|
|
@@ -106427,7 +106631,7 @@ async function getBinaryVersion(binary) {
|
|
|
106427
106631
|
}
|
|
106428
106632
|
}
|
|
106429
106633
|
async function checkAstGrepCli() {
|
|
106430
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
106634
|
+
const runtimeDir = astGrepRuntimeDir(join88(homedir20(), ".omo"));
|
|
106431
106635
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
106432
106636
|
if (sgPath === null) {
|
|
106433
106637
|
return {
|
|
@@ -106457,10 +106661,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
106457
106661
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
106458
106662
|
try {
|
|
106459
106663
|
const packageDir = baseDirOverride ?? dirname33(resolvePackageJsonPath());
|
|
106460
|
-
const vendorPath =
|
|
106664
|
+
const vendorPath = join88(packageDir, "vendor", platformKey, binaryName);
|
|
106461
106665
|
if (existsSync55(vendorPath))
|
|
106462
106666
|
return vendorPath;
|
|
106463
|
-
const binPath =
|
|
106667
|
+
const binPath = join88(packageDir, "bin", binaryName);
|
|
106464
106668
|
if (existsSync55(binPath))
|
|
106465
106669
|
return binPath;
|
|
106466
106670
|
} catch (error) {
|
|
@@ -106836,13 +107040,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
106836
107040
|
init_shared();
|
|
106837
107041
|
import { existsSync as existsSync57, readFileSync as readFileSync39 } from "node:fs";
|
|
106838
107042
|
import { homedir as homedir21 } from "node:os";
|
|
106839
|
-
import { join as
|
|
107043
|
+
import { join as join89 } from "node:path";
|
|
106840
107044
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
106841
107045
|
function getMcpConfigPaths() {
|
|
106842
107046
|
return [
|
|
106843
|
-
|
|
106844
|
-
|
|
106845
|
-
|
|
107047
|
+
join89(homedir21(), ".claude", ".mcp.json"),
|
|
107048
|
+
join89(process.cwd(), ".mcp.json"),
|
|
107049
|
+
join89(process.cwd(), ".claude", ".mcp.json")
|
|
106846
107050
|
];
|
|
106847
107051
|
}
|
|
106848
107052
|
function loadUserMcpConfig() {
|
|
@@ -107122,9 +107326,9 @@ async function pathExists2(dir) {
|
|
|
107122
107326
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
107123
107327
|
init_src();
|
|
107124
107328
|
import { existsSync as existsSync59 } from "node:fs";
|
|
107125
|
-
import { lstat as lstat16, readdir as readdir14, readFile as
|
|
107329
|
+
import { lstat as lstat16, readdir as readdir14, readFile as readFile30 } from "node:fs/promises";
|
|
107126
107330
|
import { homedir as homedir23 } from "node:os";
|
|
107127
|
-
import { basename as basename12, join as
|
|
107331
|
+
import { basename as basename12, join as join90, resolve as resolve24 } from "node:path";
|
|
107128
107332
|
// packages/omo-opencode/package.json
|
|
107129
107333
|
var package_default3 = {
|
|
107130
107334
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -107172,7 +107376,6 @@ var package_default3 = {
|
|
|
107172
107376
|
commander: "^15.0.0",
|
|
107173
107377
|
"jsonc-parser": "^3.3.1",
|
|
107174
107378
|
picocolors: "^1.1.1",
|
|
107175
|
-
picomatch: "^4.0.7",
|
|
107176
107379
|
zod: "^4.6.5"
|
|
107177
107380
|
}
|
|
107178
107381
|
};
|
|
@@ -107194,13 +107397,13 @@ var CODEX_BIN_NAMES = [
|
|
|
107194
107397
|
"omo-git-bash-hook"
|
|
107195
107398
|
];
|
|
107196
107399
|
async function gatherCodexSummary(deps = {}) {
|
|
107197
|
-
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
107400
|
+
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ?? join90(homedir23(), ".codex"));
|
|
107198
107401
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
107199
107402
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
107200
107403
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
107201
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
107202
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
107203
|
-
const configPath =
|
|
107404
|
+
const manifest = pluginRoot === null ? null : await readJson(join90(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
107405
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join90(pluginRoot, "lazycodex-install.json"));
|
|
107406
|
+
const configPath = join90(codexHome, "config.toml");
|
|
107204
107407
|
const pluginVersion = stringField(manifest, "version");
|
|
107205
107408
|
return {
|
|
107206
107409
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -107257,7 +107460,7 @@ function buildCodexIssues(summary) {
|
|
|
107257
107460
|
if (summary.pluginRoot === null) {
|
|
107258
107461
|
issues.push({
|
|
107259
107462
|
title: "OMO Codex plugin is not installed",
|
|
107260
|
-
description: `Expected cached plugin at ${
|
|
107463
|
+
description: `Expected cached plugin at ${join90("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
107261
107464
|
fix: "Run: npx lazycodex-ai install",
|
|
107262
107465
|
severity: "error",
|
|
107263
107466
|
affects: ["plugin loading"]
|
|
@@ -107322,12 +107525,12 @@ function buildCodexIssues(summary) {
|
|
|
107322
107525
|
return issues;
|
|
107323
107526
|
}
|
|
107324
107527
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
107325
|
-
const pluginRoot =
|
|
107528
|
+
const pluginRoot = join90(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
107326
107529
|
if (!existsSync59(pluginRoot))
|
|
107327
107530
|
return null;
|
|
107328
107531
|
const versions = await readdir14(pluginRoot, { withFileTypes: true });
|
|
107329
107532
|
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
107330
|
-
return candidates.length === 0 ? null :
|
|
107533
|
+
return candidates.length === 0 ? null : join90(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
107331
107534
|
}
|
|
107332
107535
|
async function readCodexConfigSummary(configPath) {
|
|
107333
107536
|
if (!existsSync59(configPath)) {
|
|
@@ -107341,7 +107544,7 @@ async function readCodexConfigSummary(configPath) {
|
|
|
107341
107544
|
companionLifecycleHookStateEvents: []
|
|
107342
107545
|
};
|
|
107343
107546
|
}
|
|
107344
|
-
const content = await
|
|
107547
|
+
const content = await readFile30(configPath, "utf8");
|
|
107345
107548
|
return {
|
|
107346
107549
|
exists: true,
|
|
107347
107550
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -107355,13 +107558,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
107355
107558
|
async function readLinkedBins(binDir) {
|
|
107356
107559
|
const linked = [];
|
|
107357
107560
|
for (const name of CODEX_BIN_NAMES) {
|
|
107358
|
-
if (await pathExists3(
|
|
107561
|
+
if (await pathExists3(join90(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
107359
107562
|
linked.push(name);
|
|
107360
107563
|
}
|
|
107361
107564
|
return linked;
|
|
107362
107565
|
}
|
|
107363
107566
|
async function readLinkedAgents(codexHome) {
|
|
107364
|
-
const agentsDir =
|
|
107567
|
+
const agentsDir = join90(codexHome, "agents");
|
|
107365
107568
|
if (!existsSync59(agentsDir))
|
|
107366
107569
|
return [];
|
|
107367
107570
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
@@ -107369,7 +107572,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
107369
107572
|
}
|
|
107370
107573
|
async function readJson(path) {
|
|
107371
107574
|
try {
|
|
107372
|
-
const parsed = JSON.parse(await
|
|
107575
|
+
const parsed = JSON.parse(await readFile30(path, "utf8"));
|
|
107373
107576
|
return isPlainRecord(parsed) ? parsed : null;
|
|
107374
107577
|
} catch (error) {
|
|
107375
107578
|
if (error instanceof Error)
|
|
@@ -107493,9 +107696,9 @@ function resolveLatestVersion(input) {
|
|
|
107493
107696
|
|
|
107494
107697
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
107495
107698
|
init_src();
|
|
107496
|
-
import { readdir as readdir15, readFile as
|
|
107699
|
+
import { readdir as readdir15, readFile as readFile31, stat as stat7 } from "node:fs/promises";
|
|
107497
107700
|
import { homedir as homedir24 } from "node:os";
|
|
107498
|
-
import { dirname as dirname35, isAbsolute as isAbsolute14, join as
|
|
107701
|
+
import { dirname as dirname35, isAbsolute as isAbsolute14, join as join91, relative as relative9, resolve as resolve25, sep as sep9 } from "node:path";
|
|
107499
107702
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
107500
107703
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
107501
107704
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -107505,7 +107708,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
107505
107708
|
const env = deps.env ?? process.env;
|
|
107506
107709
|
const platform = deps.platform ?? process.platform;
|
|
107507
107710
|
const arch = deps.arch ?? process.arch;
|
|
107508
|
-
const codexHome = resolve25(deps.codexHome ?? env["CODEX_HOME"] ??
|
|
107711
|
+
const codexHome = resolve25(deps.codexHome ?? env["CODEX_HOME"] ?? join91(homedir24(), ".codex"));
|
|
107509
107712
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
107510
107713
|
if (summary.pluginRoot === null) {
|
|
107511
107714
|
return {
|
|
@@ -107530,7 +107733,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
107530
107733
|
});
|
|
107531
107734
|
}
|
|
107532
107735
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
107533
|
-
const runtimeSgPath =
|
|
107736
|
+
const runtimeSgPath = join91(runtimeSgDir, sgBinaryName(platform));
|
|
107534
107737
|
const sg = findSgBinarySync({
|
|
107535
107738
|
arch,
|
|
107536
107739
|
env,
|
|
@@ -107642,7 +107845,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
107642
107845
|
for (const entry of entries) {
|
|
107643
107846
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
107644
107847
|
continue;
|
|
107645
|
-
const entryPath =
|
|
107848
|
+
const entryPath = join91(root, entry.name);
|
|
107646
107849
|
if (entry.isDirectory()) {
|
|
107647
107850
|
paths.push(...await findManifestPaths(entryPath, manifestName));
|
|
107648
107851
|
continue;
|
|
@@ -107686,18 +107889,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
107686
107889
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute14(arg));
|
|
107687
107890
|
}
|
|
107688
107891
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
107689
|
-
return
|
|
107892
|
+
return join91(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
107690
107893
|
}
|
|
107691
107894
|
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
|
|
107692
107895
|
const override = env[SG_PATH_ENV_KEY]?.trim();
|
|
107693
107896
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
107694
107897
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
107695
|
-
if (sgPath ===
|
|
107898
|
+
if (sgPath === join91(runtimeSgDir, sgBinaryName(platform)))
|
|
107696
107899
|
return "runtime dir";
|
|
107697
107900
|
return "PATH";
|
|
107698
107901
|
}
|
|
107699
107902
|
async function readBootstrapStateSummary(codexHome) {
|
|
107700
|
-
const statePath =
|
|
107903
|
+
const statePath = join91(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
107701
107904
|
const raw = await readJson2(statePath);
|
|
107702
107905
|
if (raw === null)
|
|
107703
107906
|
return null;
|
|
@@ -107746,7 +107949,7 @@ function degradedDetailLines(entries) {
|
|
|
107746
107949
|
}
|
|
107747
107950
|
async function readJson2(path) {
|
|
107748
107951
|
try {
|
|
107749
|
-
const parsed = JSON.parse(await
|
|
107952
|
+
const parsed = JSON.parse(await readFile31(path, "utf8"));
|
|
107750
107953
|
return isRecord18(parsed) ? parsed : null;
|
|
107751
107954
|
} catch (error) {
|
|
107752
107955
|
if (error instanceof Error)
|
|
@@ -107774,18 +107977,18 @@ function isRecord18(value) {
|
|
|
107774
107977
|
|
|
107775
107978
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
107776
107979
|
import { existsSync as existsSync60 } from "node:fs";
|
|
107777
|
-
import { readFile as
|
|
107980
|
+
import { readFile as readFile32 } from "node:fs/promises";
|
|
107778
107981
|
import { homedir as homedir25 } from "node:os";
|
|
107779
|
-
import { join as
|
|
107982
|
+
import { join as join92, resolve as resolve26 } from "node:path";
|
|
107780
107983
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
107781
107984
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
107782
107985
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
107783
107986
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
107784
|
-
const codexHome = resolve26(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
107987
|
+
const codexHome = resolve26(deps.codexHome ?? process.env.CODEX_HOME ?? join92(homedir25(), ".codex"));
|
|
107785
107988
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
107786
107989
|
const platform = deps.platform ?? process.platform;
|
|
107787
|
-
const wrapperPath =
|
|
107788
|
-
const legacyWrapperPath =
|
|
107990
|
+
const wrapperPath = join92(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
107991
|
+
const legacyWrapperPath = join92(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
107789
107992
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
107790
107993
|
const issues = [];
|
|
107791
107994
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -107819,7 +108022,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
107819
108022
|
}
|
|
107820
108023
|
async function readRuntimeWrapper(path) {
|
|
107821
108024
|
try {
|
|
107822
|
-
return await
|
|
108025
|
+
return await readFile32(path, "utf8");
|
|
107823
108026
|
} catch (error) {
|
|
107824
108027
|
if (error instanceof Error)
|
|
107825
108028
|
return null;
|
|
@@ -108321,12 +108524,12 @@ import {
|
|
|
108321
108524
|
unlinkSync as unlinkSync9,
|
|
108322
108525
|
writeFileSync as writeFileSync14
|
|
108323
108526
|
} from "node:fs";
|
|
108324
|
-
import { basename as basename13, dirname as dirname36, join as
|
|
108527
|
+
import { basename as basename13, dirname as dirname36, join as join95 } from "node:path";
|
|
108325
108528
|
|
|
108326
108529
|
// packages/mcp-client-core/src/config-dir.ts
|
|
108327
108530
|
import { existsSync as existsSync61, realpathSync as realpathSync10 } from "node:fs";
|
|
108328
108531
|
import { homedir as homedir26 } from "node:os";
|
|
108329
|
-
import { join as
|
|
108532
|
+
import { join as join93, resolve as resolve27 } from "node:path";
|
|
108330
108533
|
function resolveConfigPath2(pathValue) {
|
|
108331
108534
|
const resolvedPath = resolve27(pathValue);
|
|
108332
108535
|
if (!existsSync61(resolvedPath))
|
|
@@ -108344,13 +108547,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
108344
108547
|
if (customConfigDir) {
|
|
108345
108548
|
return resolveConfigPath2(customConfigDir);
|
|
108346
108549
|
}
|
|
108347
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
108348
|
-
return resolveConfigPath2(
|
|
108550
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join93(homedir26(), ".config");
|
|
108551
|
+
return resolveConfigPath2(join93(xdgConfigDir, "opencode"));
|
|
108349
108552
|
}
|
|
108350
108553
|
|
|
108351
108554
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
108352
108555
|
import { chmodSync as chmodSync4, existsSync as existsSync62, readFileSync as readFileSync41, renameSync as renameSync7, writeFileSync as writeFileSync13 } from "node:fs";
|
|
108353
|
-
import { join as
|
|
108556
|
+
import { join as join94 } from "node:path";
|
|
108354
108557
|
var INDEX_FILE_NAME = "index.json";
|
|
108355
108558
|
function isTokenIndex(value) {
|
|
108356
108559
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -108358,7 +108561,7 @@ function isTokenIndex(value) {
|
|
|
108358
108561
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
108359
108562
|
}
|
|
108360
108563
|
function getIndexPath(storageDir) {
|
|
108361
|
-
return
|
|
108564
|
+
return join94(storageDir, INDEX_FILE_NAME);
|
|
108362
108565
|
}
|
|
108363
108566
|
function readTokenIndex(storageDir) {
|
|
108364
108567
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -108402,16 +108605,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
|
|
|
108402
108605
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
108403
108606
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
108404
108607
|
function getMcpOauthStorageDir() {
|
|
108405
|
-
return
|
|
108608
|
+
return join95(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
108406
108609
|
}
|
|
108407
108610
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
108408
108611
|
return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
108409
108612
|
}
|
|
108410
108613
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
108411
|
-
return
|
|
108614
|
+
return join95(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
108412
108615
|
}
|
|
108413
108616
|
function getLegacyStoragePath() {
|
|
108414
|
-
return
|
|
108617
|
+
return join95(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
108415
108618
|
}
|
|
108416
108619
|
function normalizeHost2(serverHost) {
|
|
108417
108620
|
let host = serverHost.trim();
|
|
@@ -108590,7 +108793,7 @@ function listTokensByHost(serverHost) {
|
|
|
108590
108793
|
for (const [hash, indexedKey] of Object.entries(index)) {
|
|
108591
108794
|
if (!indexedKey.startsWith(prefix))
|
|
108592
108795
|
continue;
|
|
108593
|
-
const indexedToken = readTokenFile(
|
|
108796
|
+
const indexedToken = readTokenFile(join95(getMcpOauthStorageDir(), `${hash}.json`));
|
|
108594
108797
|
if (indexedToken)
|
|
108595
108798
|
result[indexedKey] = indexedToken;
|
|
108596
108799
|
}
|
|
@@ -108605,7 +108808,7 @@ function listAllTokens() {
|
|
|
108605
108808
|
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
108606
108809
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
108607
108810
|
continue;
|
|
108608
|
-
const token = readTokenFile(
|
|
108811
|
+
const token = readTokenFile(join95(dir, entry.name));
|
|
108609
108812
|
const hash = basename13(entry.name, ".json");
|
|
108610
108813
|
if (token)
|
|
108611
108814
|
result[index[hash] ?? hash] = token;
|