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/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var package_default;
|
|
|
64
64
|
var init_package = __esm(() => {
|
|
65
65
|
package_default = {
|
|
66
66
|
name: "oh-my-opencode",
|
|
67
|
-
version: "5.1.
|
|
67
|
+
version: "5.1.2",
|
|
68
68
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
69
69
|
main: "./dist/index.js",
|
|
70
70
|
types: "dist/index.d.ts",
|
|
@@ -235,25 +235,14 @@ var init_package = __esm(() => {
|
|
|
235
235
|
},
|
|
236
236
|
homepage: "https://github.com/code-yeongyu/oh-my-openagent#readme",
|
|
237
237
|
dependencies: {
|
|
238
|
-
"@clack/prompts": "^1.8.1",
|
|
239
|
-
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
240
|
-
"@opencode-ai/plugin": "1.18.31",
|
|
241
|
-
"@opencode-ai/sdk": "1.18.31",
|
|
242
|
-
"@opentui/core": "^0.5.11",
|
|
243
|
-
"@opentui/keymap": "^0.5.11",
|
|
244
238
|
"@opentui/solid": "^0.5.11",
|
|
245
|
-
commander: "^15.0.0",
|
|
246
239
|
"detect-libc": "^2.1.2",
|
|
247
|
-
diff: "^9.0.0",
|
|
248
|
-
"js-yaml": "^5.4.2",
|
|
249
|
-
"jsonc-parser": "^3.3.1",
|
|
250
|
-
picocolors: "^1.1.1",
|
|
251
|
-
picomatch: "^4.0.7",
|
|
252
|
-
"posthog-node": "^5.52.4",
|
|
253
240
|
zod: "^4.6.5"
|
|
254
241
|
},
|
|
255
242
|
devDependencies: {
|
|
256
|
-
"@
|
|
243
|
+
"@clack/prompts": "^1.8.1",
|
|
244
|
+
"@code-yeongyu/senpi": "2026.9.29-3",
|
|
245
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
257
246
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
258
247
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
259
248
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -287,36 +276,43 @@ var init_package = __esm(() => {
|
|
|
287
276
|
"@oh-my-opencode/telemetry-core": "workspace:*",
|
|
288
277
|
"@oh-my-opencode/tmux-core": "workspace:*",
|
|
289
278
|
"@oh-my-opencode/utils": "workspace:*",
|
|
279
|
+
"@opencode-ai/plugin": "1.18.31",
|
|
280
|
+
"@opencode-ai/sdk": "1.18.31",
|
|
281
|
+
"@opentui/core": "^0.5.11",
|
|
282
|
+
"@opentui/keymap": "^0.5.11",
|
|
290
283
|
"@types/js-yaml": "^4.0.9",
|
|
291
284
|
"@types/picomatch": "^4.0.3",
|
|
292
285
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
293
286
|
"@xterm/addon-unicode11": "^0.9.0",
|
|
294
287
|
"@xterm/xterm": "^6.0.0",
|
|
295
288
|
"bun-types": "1.4.2",
|
|
289
|
+
commander: "^15.0.0",
|
|
290
|
+
diff: "^9.0.0",
|
|
291
|
+
"js-yaml": "^5.4.2",
|
|
292
|
+
"jsonc-parser": "^3.3.1",
|
|
296
293
|
"node-pty": "^1.1.0",
|
|
297
294
|
omowright: "github:code-yeongyu/omowright#293ca5002cbd4c8b0c104c5934683385ef7e0d3a",
|
|
295
|
+
picocolors: "^1.1.1",
|
|
296
|
+
picomatch: "^4.0.7",
|
|
297
|
+
"posthog-node": "^5.52.4",
|
|
298
298
|
"puppeteer-core": "^25.11.0",
|
|
299
299
|
typescript: "^7.0.2"
|
|
300
300
|
},
|
|
301
301
|
optionalDependencies: {
|
|
302
|
-
"oh-my-opencode-darwin-arm64": "5.1.
|
|
303
|
-
"oh-my-opencode-darwin-x64": "5.1.
|
|
304
|
-
"oh-my-opencode-darwin-x64-baseline": "5.1.
|
|
305
|
-
"oh-my-opencode-linux-arm64": "5.1.
|
|
306
|
-
"oh-my-opencode-linux-arm64-musl": "5.1.
|
|
307
|
-
"oh-my-opencode-linux-x64": "5.1.
|
|
308
|
-
"oh-my-opencode-linux-x64-baseline": "5.1.
|
|
309
|
-
"oh-my-opencode-linux-x64-musl": "5.1.
|
|
310
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.1.
|
|
311
|
-
"oh-my-opencode-windows-arm64": "5.1.
|
|
312
|
-
"oh-my-opencode-windows-x64": "5.1.
|
|
313
|
-
"oh-my-opencode-windows-x64-baseline": "5.1.
|
|
302
|
+
"oh-my-opencode-darwin-arm64": "5.1.2",
|
|
303
|
+
"oh-my-opencode-darwin-x64": "5.1.2",
|
|
304
|
+
"oh-my-opencode-darwin-x64-baseline": "5.1.2",
|
|
305
|
+
"oh-my-opencode-linux-arm64": "5.1.2",
|
|
306
|
+
"oh-my-opencode-linux-arm64-musl": "5.1.2",
|
|
307
|
+
"oh-my-opencode-linux-x64": "5.1.2",
|
|
308
|
+
"oh-my-opencode-linux-x64-baseline": "5.1.2",
|
|
309
|
+
"oh-my-opencode-linux-x64-musl": "5.1.2",
|
|
310
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.1.2",
|
|
311
|
+
"oh-my-opencode-windows-arm64": "5.1.2",
|
|
312
|
+
"oh-my-opencode-windows-x64": "5.1.2",
|
|
313
|
+
"oh-my-opencode-windows-x64-baseline": "5.1.2"
|
|
314
314
|
},
|
|
315
315
|
overrides: {
|
|
316
|
-
"@earendil-works/pi-agent-core": "0.84.2",
|
|
317
|
-
"@earendil-works/pi-ai": "0.84.2",
|
|
318
|
-
"@earendil-works/pi-coding-agent": "0.84.2",
|
|
319
|
-
"@earendil-works/pi-tui": "0.84.2",
|
|
320
316
|
hono: "^4.13.8",
|
|
321
317
|
"@hono/node-server": "2.1.1",
|
|
322
318
|
"express-rate-limit": "^8.7.0",
|
|
@@ -7396,12 +7392,12 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7396
7392
|
},
|
|
7397
7393
|
"deep-low": {
|
|
7398
7394
|
fallbackChain: [
|
|
7399
|
-
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.6-sol-fast", variant: "medium" },
|
|
7400
7395
|
{
|
|
7401
7396
|
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
7402
7397
|
model: "gpt-5.6-sol",
|
|
7403
7398
|
variant: "medium"
|
|
7404
|
-
}
|
|
7399
|
+
},
|
|
7400
|
+
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.6-sol-fast", variant: "medium" }
|
|
7405
7401
|
]
|
|
7406
7402
|
},
|
|
7407
7403
|
"deep-high": {
|
|
@@ -7453,6 +7449,11 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7453
7449
|
},
|
|
7454
7450
|
"unspecified-low": {
|
|
7455
7451
|
fallbackChain: [
|
|
7452
|
+
{
|
|
7453
|
+
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
7454
|
+
model: "claude-sonnet-5-5",
|
|
7455
|
+
variant: "medium"
|
|
7456
|
+
},
|
|
7456
7457
|
{ providers: ["xiaomi", "opencode-go"], model: "mimo-v2.6-pro", variant: "max" },
|
|
7457
7458
|
{ providers: ["xai", "github-copilot", "opencode-go"], model: "grok-4.7", variant: "xhigh" },
|
|
7458
7459
|
{
|
|
@@ -8389,6 +8390,36 @@ var init_supplemental_entries = __esm(() => {
|
|
|
8389
8390
|
output: 32768
|
|
8390
8391
|
}
|
|
8391
8392
|
},
|
|
8393
|
+
"claude-sonnet-5-5": {
|
|
8394
|
+
id: "claude-sonnet-5-5",
|
|
8395
|
+
family: "claude-sonnet",
|
|
8396
|
+
reasoning: true,
|
|
8397
|
+
temperature: false,
|
|
8398
|
+
toolCall: true,
|
|
8399
|
+
modalities: {
|
|
8400
|
+
input: ["text", "image", "pdf"],
|
|
8401
|
+
output: ["text"]
|
|
8402
|
+
},
|
|
8403
|
+
limit: {
|
|
8404
|
+
context: 1e6,
|
|
8405
|
+
output: 128000
|
|
8406
|
+
}
|
|
8407
|
+
},
|
|
8408
|
+
"anthropic/claude-sonnet-5-5": {
|
|
8409
|
+
id: "anthropic/claude-sonnet-5-5",
|
|
8410
|
+
family: "claude-sonnet",
|
|
8411
|
+
reasoning: true,
|
|
8412
|
+
temperature: false,
|
|
8413
|
+
toolCall: true,
|
|
8414
|
+
modalities: {
|
|
8415
|
+
input: ["text", "image", "pdf"],
|
|
8416
|
+
output: ["text"]
|
|
8417
|
+
},
|
|
8418
|
+
limit: {
|
|
8419
|
+
context: 1e6,
|
|
8420
|
+
output: 128000
|
|
8421
|
+
}
|
|
8422
|
+
},
|
|
8392
8423
|
"grok-4.7": {
|
|
8393
8424
|
id: "grok-4.7",
|
|
8394
8425
|
family: "grok",
|
|
@@ -9434,7 +9465,7 @@ var init_openai_categories = __esm(() => {
|
|
|
9434
9465
|
},
|
|
9435
9466
|
{
|
|
9436
9467
|
name: "deep-low",
|
|
9437
|
-
config: { model: "openai/gpt-5.6-sol
|
|
9468
|
+
config: { model: "openai/gpt-5.6-sol", variant: "medium" },
|
|
9438
9469
|
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.",
|
|
9439
9470
|
callerGuidance: DEEP_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
9440
9471
|
promptAppend: DEEP_LOW_CATEGORY_PROMPT_APPEND,
|
|
@@ -9459,7 +9490,7 @@ var init_openai_categories = __esm(() => {
|
|
|
9459
9490
|
},
|
|
9460
9491
|
{
|
|
9461
9492
|
name: "unspecified-low",
|
|
9462
|
-
config: { model: "
|
|
9493
|
+
config: { model: "anthropic/claude-sonnet-5-5", variant: "medium" },
|
|
9463
9494
|
description: "Tasks that don't fit other categories, low effort required",
|
|
9464
9495
|
callerGuidance: UNSPECIFIED_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
9465
9496
|
promptAppend: UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND
|
|
@@ -74702,6 +74733,7 @@ var init_task = __esm(() => {
|
|
|
74702
74733
|
process_runner: _enum(["host", "child-process"]).default("host"),
|
|
74703
74734
|
host_engine_policy: _enum(["upgrade", "fallback"]).default("upgrade"),
|
|
74704
74735
|
host_idle_exit_ms: number2().int().positive().optional(),
|
|
74736
|
+
host_shard_prewarm: _enum(["off", "first-turn", "session-start"]).default("first-turn"),
|
|
74705
74737
|
default_concurrency: number2().int().nonnegative().default(5),
|
|
74706
74738
|
global_concurrency: number2().int().nonnegative().default(8),
|
|
74707
74739
|
provider_concurrency: record(string2(), number2().int().nonnegative()).optional(),
|
|
@@ -74751,6 +74783,7 @@ var init_task = __esm(() => {
|
|
|
74751
74783
|
process_runner: _enum(["host", "child-process"]).optional(),
|
|
74752
74784
|
host_engine_policy: _enum(["upgrade", "fallback"]).optional(),
|
|
74753
74785
|
host_idle_exit_ms: number2().int().positive().optional(),
|
|
74786
|
+
host_shard_prewarm: _enum(["off", "first-turn", "session-start"]).optional(),
|
|
74754
74787
|
default_concurrency: number2().int().nonnegative().optional(),
|
|
74755
74788
|
global_concurrency: number2().int().nonnegative().optional(),
|
|
74756
74789
|
provider_concurrency: record(string2(), number2().int().nonnegative()).optional(),
|
|
@@ -79111,9 +79144,9 @@ function extractChannel(version) {
|
|
|
79111
79144
|
|
|
79112
79145
|
// packages/telemetry-core/src/day-claim.ts
|
|
79113
79146
|
import { closeSync as closeSync3, mkdirSync as mkdirSync9, openSync as openSync3, readdirSync as readdirSync8, rmSync as rmSync3 } from "fs";
|
|
79114
|
-
import { join as
|
|
79147
|
+
import { join as join53 } from "path";
|
|
79115
79148
|
function getTelemetryDayClaimFilePath(stateDir, dayUTC) {
|
|
79116
|
-
return
|
|
79149
|
+
return join53(stateDir, `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`);
|
|
79117
79150
|
}
|
|
79118
79151
|
function claimUtcDay(stateDir, dayUTC) {
|
|
79119
79152
|
try {
|
|
@@ -79139,7 +79172,7 @@ function pruneSupersededClaims(stateDir, dayUTC) {
|
|
|
79139
79172
|
if (!entry.startsWith(CLAIM_PREFIX) || !entry.endsWith(CLAIM_SUFFIX))
|
|
79140
79173
|
continue;
|
|
79141
79174
|
try {
|
|
79142
|
-
rmSync3(
|
|
79175
|
+
rmSync3(join53(stateDir, entry), { force: true });
|
|
79143
79176
|
} catch {}
|
|
79144
79177
|
}
|
|
79145
79178
|
}
|
|
@@ -79148,20 +79181,20 @@ var init_day_claim = () => {};
|
|
|
79148
79181
|
|
|
79149
79182
|
// packages/telemetry-core/src/activity-state.ts
|
|
79150
79183
|
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync12 } from "fs";
|
|
79151
|
-
import { basename as basename9, join as
|
|
79184
|
+
import { basename as basename9, join as join54 } from "path";
|
|
79152
79185
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
79153
79186
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
79154
79187
|
env: options.env,
|
|
79155
79188
|
osProvider: options.osProvider
|
|
79156
79189
|
});
|
|
79157
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
79190
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join54(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
79158
79191
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename9(dataDir) === product.cacheDirName) {
|
|
79159
79192
|
return dataDir;
|
|
79160
79193
|
}
|
|
79161
|
-
return
|
|
79194
|
+
return join54(dataDir, product.cacheDirName);
|
|
79162
79195
|
}
|
|
79163
79196
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
79164
|
-
return
|
|
79197
|
+
return join54(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
79165
79198
|
}
|
|
79166
79199
|
function getDailyActiveCaptureState(input) {
|
|
79167
79200
|
const dayUTC = getUtcDayString(input.now ?? new Date);
|
|
@@ -79242,9 +79275,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
79242
79275
|
|
|
79243
79276
|
// packages/telemetry-core/src/diagnostics.ts
|
|
79244
79277
|
import { appendFileSync as appendFileSync2, existsSync as existsSync26, mkdirSync as mkdirSync11, readFileSync as readFileSync13 } from "fs";
|
|
79245
|
-
import { join as
|
|
79278
|
+
import { join as join55 } from "path";
|
|
79246
79279
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
79247
|
-
return
|
|
79280
|
+
return join55(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
79248
79281
|
}
|
|
79249
79282
|
function writeTelemetryDiagnostic(input, options) {
|
|
79250
79283
|
const now = options.now ?? new Date;
|
|
@@ -88987,7 +89020,7 @@ var package_default2;
|
|
|
88987
89020
|
var init_package2 = __esm(() => {
|
|
88988
89021
|
package_default2 = {
|
|
88989
89022
|
name: "@oh-my-opencode/omo-codex",
|
|
88990
|
-
version: "5.1.
|
|
89023
|
+
version: "5.1.2",
|
|
88991
89024
|
type: "module",
|
|
88992
89025
|
private: true,
|
|
88993
89026
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -89959,7 +89992,7 @@ var init_update_toasts = __esm(() => {
|
|
|
89959
89992
|
|
|
89960
89993
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
89961
89994
|
import { existsSync as existsSync48 } from "fs";
|
|
89962
|
-
import { dirname as dirname32, join as
|
|
89995
|
+
import { dirname as dirname32, join as join79 } from "path";
|
|
89963
89996
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
89964
89997
|
function defaultGetModuleHostingWorkspace() {
|
|
89965
89998
|
try {
|
|
@@ -90119,7 +90152,7 @@ var init_background_update_check = __esm(() => {
|
|
|
90119
90152
|
init_update_toasts();
|
|
90120
90153
|
defaultDeps4 = {
|
|
90121
90154
|
existsSync: existsSync48,
|
|
90122
|
-
join:
|
|
90155
|
+
join: join79,
|
|
90123
90156
|
runBunInstallWithDetails,
|
|
90124
90157
|
log: log2,
|
|
90125
90158
|
getOpenCodeCacheDir,
|
|
@@ -92575,19 +92608,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
92575
92608
|
}
|
|
92576
92609
|
|
|
92577
92610
|
// packages/omo-codex/src/install/install-codex.ts
|
|
92578
|
-
import { join as
|
|
92579
|
-
|
|
92580
|
-
// packages/omo-codex/src/install/codex-default-role-config.ts
|
|
92581
|
-
init_src4();
|
|
92582
|
-
function readDefaultRoleConfig(options = {}) {
|
|
92583
|
-
const result = loadOmoConfig({ ...options, harness: "codex" });
|
|
92584
|
-
return {
|
|
92585
|
-
enabled: result.config.agents?.default?.disable !== true,
|
|
92586
|
-
warnings: result.diagnostics.map((diagnostic) => diagnostic.message)
|
|
92587
|
-
};
|
|
92588
|
-
}
|
|
92589
|
-
|
|
92590
|
-
// packages/omo-codex/src/install/install-codex.ts
|
|
92611
|
+
import { join as join56, resolve as resolve13 } from "path";
|
|
92591
92612
|
import { existsSync as existsSync27 } from "fs";
|
|
92592
92613
|
import { homedir as homedir6 } from "os";
|
|
92593
92614
|
|
|
@@ -95488,13 +95509,126 @@ function toCodexResolution(resolution) {
|
|
|
95488
95509
|
};
|
|
95489
95510
|
}
|
|
95490
95511
|
|
|
95512
|
+
// packages/omo-codex/src/install/codex-agent-config.ts
|
|
95513
|
+
init_src4();
|
|
95514
|
+
init_reasoning_vocabulary();
|
|
95515
|
+
function readCodexAgentConfig(options = {}) {
|
|
95516
|
+
const result = loadOmoConfig({ ...options, harness: "codex" });
|
|
95517
|
+
const overrides = readAgentOverrides(result);
|
|
95518
|
+
return {
|
|
95519
|
+
defaultRoleEnabled: result.config.agents?.default?.disable !== true,
|
|
95520
|
+
agentOverrides: overrides.agentOverrides,
|
|
95521
|
+
warnings: [...result.diagnostics.map((diagnostic) => diagnostic.message), ...overrides.warnings]
|
|
95522
|
+
};
|
|
95523
|
+
}
|
|
95524
|
+
function unmanagedAgentOverrideWarnings(agentOverrides, managedAgentNames) {
|
|
95525
|
+
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`);
|
|
95526
|
+
}
|
|
95527
|
+
function readAgentOverrides(result) {
|
|
95528
|
+
let merged = {};
|
|
95529
|
+
for (const layer of result.layers)
|
|
95530
|
+
merged = mergeOmoConfigRecords(merged, layer.config);
|
|
95531
|
+
const profile = result.profile === undefined ? undefined : recordAt2(recordAt2(merged, "profiles"), result.profile);
|
|
95532
|
+
let agents = {};
|
|
95533
|
+
for (const scope of [merged, profile]) {
|
|
95534
|
+
agents = mergeOmoConfigRecords(agents, recordAt2(recordAt2(scope, "[codex]"), "agents") ?? {});
|
|
95535
|
+
}
|
|
95536
|
+
const agentOverrides = new Map;
|
|
95537
|
+
const warnings = [];
|
|
95538
|
+
for (const [name, value] of Object.entries(agents)) {
|
|
95539
|
+
if (name === "default")
|
|
95540
|
+
continue;
|
|
95541
|
+
const parsed = OmoAgentDefSchema.safeParse(value);
|
|
95542
|
+
if (!parsed.success) {
|
|
95543
|
+
warnings.push(`[codex].agents.${name} is invalid and was ignored: ${parsed.error.issues[0]?.message ?? "unknown error"}`);
|
|
95544
|
+
continue;
|
|
95545
|
+
}
|
|
95546
|
+
const override = toCodexAgentOverride(parsed.data.model, parsed.data.reasoning);
|
|
95547
|
+
if (override.model !== undefined || override.reasoningEffort !== undefined)
|
|
95548
|
+
agentOverrides.set(name, override);
|
|
95549
|
+
}
|
|
95550
|
+
return { agentOverrides, warnings };
|
|
95551
|
+
}
|
|
95552
|
+
function toCodexAgentOverride(model, reasoning) {
|
|
95553
|
+
const split = model === undefined ? undefined : splitReasoningSuffix2(model);
|
|
95554
|
+
const effort = codexReasoningEffort(reasoning ?? split?.level);
|
|
95555
|
+
return {
|
|
95556
|
+
...split === undefined || split.base === "" ? {} : { model: split.base },
|
|
95557
|
+
...effort === undefined ? {} : { reasoningEffort: effort }
|
|
95558
|
+
};
|
|
95559
|
+
}
|
|
95560
|
+
function codexReasoningEffort(reasoning) {
|
|
95561
|
+
if (reasoning === undefined || reasoning === "auto")
|
|
95562
|
+
return;
|
|
95563
|
+
return reasoning === "off" ? "none" : reasoning;
|
|
95564
|
+
}
|
|
95565
|
+
function recordAt2(value, key) {
|
|
95566
|
+
if (!isPlainRecord4(value))
|
|
95567
|
+
return;
|
|
95568
|
+
const child = value[key];
|
|
95569
|
+
return isPlainRecord4(child) ? child : undefined;
|
|
95570
|
+
}
|
|
95571
|
+
|
|
95572
|
+
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
95573
|
+
import { cp as cp3, mkdir as mkdir6, rename as rename4, rm as rm7, writeFile as writeFile6 } from "fs/promises";
|
|
95574
|
+
import { join as join39, sep as sep6 } from "path";
|
|
95575
|
+
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
95576
|
+
async function writeInstalledMarketplaceSnapshot(input) {
|
|
95577
|
+
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
95578
|
+
await mkdir6(marketplaceRoot, { recursive: true });
|
|
95579
|
+
await writeMarketplaceManifest(marketplaceRoot, input.marketplace);
|
|
95580
|
+
const snapshotPlugins = [];
|
|
95581
|
+
for (const plugin of input.plugins) {
|
|
95582
|
+
snapshotPlugins.push(await writeSnapshotPlugin(marketplaceRoot, plugin));
|
|
95583
|
+
}
|
|
95584
|
+
return snapshotPlugins;
|
|
95585
|
+
}
|
|
95586
|
+
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
95587
|
+
return join39(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
95588
|
+
}
|
|
95589
|
+
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
95590
|
+
const manifestDir = join39(marketplaceRoot, ".agents", "plugins");
|
|
95591
|
+
await mkdir6(manifestDir, { recursive: true });
|
|
95592
|
+
const tempPath = join39(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
95593
|
+
await writeFile6(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
95594
|
+
`);
|
|
95595
|
+
await rename4(tempPath, join39(manifestDir, "marketplace.json"));
|
|
95596
|
+
}
|
|
95597
|
+
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
95598
|
+
const pluginsDir = join39(marketplaceRoot, "plugins");
|
|
95599
|
+
await mkdir6(pluginsDir, { recursive: true });
|
|
95600
|
+
const targetPath = join39(pluginsDir, plugin.name);
|
|
95601
|
+
const tempPath = join39(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
95602
|
+
await rm7(tempPath, { recursive: true, force: true });
|
|
95603
|
+
await cp3(plugin.sourcePath, tempPath, {
|
|
95604
|
+
recursive: true,
|
|
95605
|
+
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
95606
|
+
});
|
|
95607
|
+
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
95608
|
+
await rm7(targetPath, { recursive: true, force: true });
|
|
95609
|
+
await rename4(tempPath, targetPath);
|
|
95610
|
+
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
95611
|
+
return { name: plugin.name, path: targetPath };
|
|
95612
|
+
}
|
|
95613
|
+
function shouldCopyMarketplaceSourcePath(path, root) {
|
|
95614
|
+
const relative = path === root ? "" : path.slice(root.length + sep6.length);
|
|
95615
|
+
if (relative === "")
|
|
95616
|
+
return true;
|
|
95617
|
+
const parts = relative.split(sep6);
|
|
95618
|
+
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
95619
|
+
}
|
|
95620
|
+
|
|
95491
95621
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
95492
|
-
import { copyFile, lstat as lstat10, mkdir as
|
|
95493
|
-
import { basename as basename7, join as
|
|
95622
|
+
import { copyFile, lstat as lstat10, mkdir as mkdir7, readdir as readdir7, readFile as readFile17, rm as rm11, writeFile as writeFile9 } from "fs/promises";
|
|
95623
|
+
import { basename as basename7, join as join44 } from "path";
|
|
95624
|
+
|
|
95625
|
+
// packages/omo-codex/src/install/agent-model-overrides.ts
|
|
95626
|
+
import { readFile as readFile14, rm as rm8, writeFile as writeFile8 } from "fs/promises";
|
|
95627
|
+
import { join as join41 } from "path";
|
|
95494
95628
|
|
|
95495
95629
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
95496
|
-
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as
|
|
95497
|
-
import { join as
|
|
95630
|
+
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile7 } from "fs/promises";
|
|
95631
|
+
import { join as join40 } from "path";
|
|
95498
95632
|
|
|
95499
95633
|
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
|
|
95500
95634
|
var MANAGED_REASONING_DEFAULT_UPGRADES = new Map([
|
|
@@ -95687,7 +95821,7 @@ function resolveManagedAgentReasoning(input) {
|
|
|
95687
95821
|
|
|
95688
95822
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
95689
95823
|
async function capturePreservedAgentReasoning(input) {
|
|
95690
|
-
const agentsDir =
|
|
95824
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
95691
95825
|
if (!await exists2(agentsDir))
|
|
95692
95826
|
return new Map;
|
|
95693
95827
|
const preserved = new Map;
|
|
@@ -95695,7 +95829,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
95695
95829
|
for (const entry of agentEntries) {
|
|
95696
95830
|
if (!entry.name.endsWith(".toml"))
|
|
95697
95831
|
continue;
|
|
95698
|
-
const content = await readTextIfExists(
|
|
95832
|
+
const content = await readTextIfExists(join40(agentsDir, entry.name));
|
|
95699
95833
|
if (content === null)
|
|
95700
95834
|
continue;
|
|
95701
95835
|
const effort = extractReasoningEffort(content);
|
|
@@ -95709,7 +95843,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
95709
95843
|
return preserved;
|
|
95710
95844
|
}
|
|
95711
95845
|
async function capturePreservedAgentServiceTier(input) {
|
|
95712
|
-
const agentsDir =
|
|
95846
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
95713
95847
|
if (!await exists2(agentsDir))
|
|
95714
95848
|
return new Map;
|
|
95715
95849
|
const preserved = new Map;
|
|
@@ -95717,7 +95851,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
95717
95851
|
for (const entry of agentEntries) {
|
|
95718
95852
|
if (!entry.name.endsWith(".toml"))
|
|
95719
95853
|
continue;
|
|
95720
|
-
const content = await readTextIfExists(
|
|
95854
|
+
const content = await readTextIfExists(join40(agentsDir, entry.name));
|
|
95721
95855
|
if (content === null)
|
|
95722
95856
|
continue;
|
|
95723
95857
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -95740,7 +95874,7 @@ async function restorePreservedReasoning(input) {
|
|
|
95740
95874
|
const replacement = replaceTopLevelStringSetting(content, "model_reasoning_effort", effort, { insertIfMissing: false });
|
|
95741
95875
|
if (!replacement.replaced)
|
|
95742
95876
|
return;
|
|
95743
|
-
await
|
|
95877
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95744
95878
|
}
|
|
95745
95879
|
async function restorePreservedServiceTier(input) {
|
|
95746
95880
|
if (!input.preserved)
|
|
@@ -95751,7 +95885,18 @@ async function restorePreservedServiceTier(input) {
|
|
|
95751
95885
|
const replacement = replaceTopLevelStringSetting(content, "service_tier", input.value, { insertIfMissing: true });
|
|
95752
95886
|
if (!replacement.replaced)
|
|
95753
95887
|
return;
|
|
95754
|
-
await
|
|
95888
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95889
|
+
}
|
|
95890
|
+
async function restorePreservedModel(input) {
|
|
95891
|
+
if (input.value === null)
|
|
95892
|
+
return;
|
|
95893
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
95894
|
+
if (extractModel(content) === input.value)
|
|
95895
|
+
return;
|
|
95896
|
+
const replacement = replaceTopLevelStringSetting(content, "model", input.value, { insertIfMissing: true });
|
|
95897
|
+
if (!replacement.replaced)
|
|
95898
|
+
return;
|
|
95899
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95755
95900
|
}
|
|
95756
95901
|
async function readTextIfExists(path) {
|
|
95757
95902
|
try {
|
|
@@ -95849,9 +95994,86 @@ function nodeErrorCode(error) {
|
|
|
95849
95994
|
return typeof error.code === "string" ? error.code : null;
|
|
95850
95995
|
}
|
|
95851
95996
|
|
|
95997
|
+
// packages/omo-codex/src/install/agent-model-overrides.ts
|
|
95998
|
+
var RECEIPT_FILE = ".lazycodex-agent-models.json";
|
|
95999
|
+
async function readAgentModelReceipts(codexHome) {
|
|
96000
|
+
const content = await readTextIfExists(receiptPath(codexHome));
|
|
96001
|
+
if (content === null)
|
|
96002
|
+
return new Map;
|
|
96003
|
+
const parsed = parseJson(content);
|
|
96004
|
+
if (!isPlainRecord4(parsed))
|
|
96005
|
+
return new Map;
|
|
96006
|
+
const receipts = new Map;
|
|
96007
|
+
for (const [name, value] of Object.entries(parsed)) {
|
|
96008
|
+
if (!isPlainRecord4(value))
|
|
96009
|
+
continue;
|
|
96010
|
+
const model = value["model"];
|
|
96011
|
+
const reasoningEffort = value["reasoningEffort"];
|
|
96012
|
+
receipts.set(name, {
|
|
96013
|
+
...typeof model === "string" ? { model } : {},
|
|
96014
|
+
...typeof reasoningEffort === "string" ? { reasoningEffort } : {}
|
|
96015
|
+
});
|
|
96016
|
+
}
|
|
96017
|
+
return receipts;
|
|
96018
|
+
}
|
|
96019
|
+
async function writeAgentModelReceipts(codexHome, receipts) {
|
|
96020
|
+
const path = receiptPath(codexHome);
|
|
96021
|
+
if (receipts.size === 0) {
|
|
96022
|
+
await rm8(path, { force: true });
|
|
96023
|
+
return;
|
|
96024
|
+
}
|
|
96025
|
+
await writeFile8(path, `${JSON.stringify(Object.fromEntries(receipts), null, "\t")}
|
|
96026
|
+
`);
|
|
96027
|
+
}
|
|
96028
|
+
async function applyAgentOverride(input) {
|
|
96029
|
+
if (input.override === undefined)
|
|
96030
|
+
return;
|
|
96031
|
+
let content = await readFile14(input.linkPath, "utf8");
|
|
96032
|
+
if (input.override.model !== undefined) {
|
|
96033
|
+
content = replaceTopLevelStringSetting(content, "model", input.override.model, { insertIfMissing: true }).content;
|
|
96034
|
+
}
|
|
96035
|
+
if (input.override.reasoningEffort !== undefined) {
|
|
96036
|
+
content = replaceTopLevelStringSetting(content, "model_reasoning_effort", input.override.reasoningEffort, {
|
|
96037
|
+
insertIfMissing: true
|
|
96038
|
+
}).content;
|
|
96039
|
+
}
|
|
96040
|
+
await writeFile8(input.linkPath, content);
|
|
96041
|
+
}
|
|
96042
|
+
function receiptPath(codexHome) {
|
|
96043
|
+
return join41(codexHome, "agents", RECEIPT_FILE);
|
|
96044
|
+
}
|
|
96045
|
+
function parseJson(content) {
|
|
96046
|
+
try {
|
|
96047
|
+
return JSON.parse(content);
|
|
96048
|
+
} catch (error) {
|
|
96049
|
+
if (error instanceof SyntaxError)
|
|
96050
|
+
return null;
|
|
96051
|
+
throw error;
|
|
96052
|
+
}
|
|
96053
|
+
}
|
|
96054
|
+
|
|
96055
|
+
// packages/omo-codex/src/install/managed-agent-model-defaults.ts
|
|
96056
|
+
var PREVIOUSLY_BUNDLED_AGENT_MODELS = new Set([
|
|
96057
|
+
"gpt-5.2",
|
|
96058
|
+
"gpt-5.4-mini",
|
|
96059
|
+
"gpt-5.5",
|
|
96060
|
+
"gpt-5.6-luna",
|
|
96061
|
+
"gpt-5.6-luna-fast",
|
|
96062
|
+
"gpt-5.6-sol",
|
|
96063
|
+
"gpt-5.6-terra",
|
|
96064
|
+
"gpt-6-astra"
|
|
96065
|
+
]);
|
|
96066
|
+
function handEditedAgentModel(installedModel, receipt) {
|
|
96067
|
+
if (installedModel === null)
|
|
96068
|
+
return null;
|
|
96069
|
+
if (receipt?.model !== undefined)
|
|
96070
|
+
return installedModel === receipt.model ? null : installedModel;
|
|
96071
|
+
return PREVIOUSLY_BUNDLED_AGENT_MODELS.has(installedModel) ? null : installedModel;
|
|
96072
|
+
}
|
|
96073
|
+
|
|
95852
96074
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
95853
|
-
import { lstat as lstat8, readFile as
|
|
95854
|
-
import { join as
|
|
96075
|
+
import { lstat as lstat8, readFile as readFile15, rm as rm9 } from "fs/promises";
|
|
96076
|
+
import { join as join42 } from "path";
|
|
95855
96077
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
95856
96078
|
{
|
|
95857
96079
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -95863,11 +96085,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
95863
96085
|
}
|
|
95864
96086
|
];
|
|
95865
96087
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
95866
|
-
const agentsDir =
|
|
96088
|
+
const agentsDir = join42(input.codexHome, "agents");
|
|
95867
96089
|
if (!await exists3(agentsDir))
|
|
95868
96090
|
return;
|
|
95869
96091
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
95870
|
-
const agentPath =
|
|
96092
|
+
const agentPath = join42(agentsDir, retiredAgent.fileName);
|
|
95871
96093
|
if (!await exists3(agentPath))
|
|
95872
96094
|
continue;
|
|
95873
96095
|
const agentStat = await lstat8(agentPath);
|
|
@@ -95876,7 +96098,7 @@ async function purgeRetiredManagedAgentFiles(input) {
|
|
|
95876
96098
|
const content = await readTextIfExists2(agentPath);
|
|
95877
96099
|
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
95878
96100
|
continue;
|
|
95879
|
-
await
|
|
96101
|
+
await rm9(agentPath, { force: true });
|
|
95880
96102
|
}
|
|
95881
96103
|
}
|
|
95882
96104
|
function hasRequiredMarkers(content, markers) {
|
|
@@ -95884,7 +96106,7 @@ function hasRequiredMarkers(content, markers) {
|
|
|
95884
96106
|
}
|
|
95885
96107
|
async function readTextIfExists2(path) {
|
|
95886
96108
|
try {
|
|
95887
|
-
return await
|
|
96109
|
+
return await readFile15(path, "utf8");
|
|
95888
96110
|
} catch (error) {
|
|
95889
96111
|
if (nodeErrorCode2(error) === "ENOENT")
|
|
95890
96112
|
return null;
|
|
@@ -95909,13 +96131,13 @@ function nodeErrorCode2(error) {
|
|
|
95909
96131
|
|
|
95910
96132
|
// packages/omo-codex/src/install/default-agent-role.ts
|
|
95911
96133
|
import { createHash as createHash3 } from "crypto";
|
|
95912
|
-
import { lstat as lstat9, readFile as
|
|
95913
|
-
import { join as
|
|
96134
|
+
import { lstat as lstat9, readFile as readFile16, rm as rm10 } from "fs/promises";
|
|
96135
|
+
import { join as join43 } from "path";
|
|
95914
96136
|
var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
|
|
95915
96137
|
async function installDefaultAgentRole(input) {
|
|
95916
|
-
const target =
|
|
95917
|
-
const receipt =
|
|
95918
|
-
const configPath =
|
|
96138
|
+
const target = join43(input.codexHome, "agents", "default.toml");
|
|
96139
|
+
const receipt = join43(input.codexHome, "agents", ".lazycodex-default.sha256");
|
|
96140
|
+
const configPath = join43(input.codexHome, "config.toml");
|
|
95919
96141
|
const config = await readIfPresent(configPath);
|
|
95920
96142
|
const entry = await lstat9(target).catch((error) => {
|
|
95921
96143
|
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
@@ -95938,15 +96160,15 @@ async function installDefaultAgentRole(input) {
|
|
|
95938
96160
|
if (next !== config)
|
|
95939
96161
|
await writeFileAtomic(configPath, next);
|
|
95940
96162
|
}
|
|
95941
|
-
await
|
|
95942
|
-
await
|
|
96163
|
+
await rm10(target);
|
|
96164
|
+
await rm10(receipt);
|
|
95943
96165
|
}
|
|
95944
96166
|
return null;
|
|
95945
96167
|
}
|
|
95946
96168
|
if (foreign || existing !== null && !owned) {
|
|
95947
96169
|
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.");
|
|
95948
96170
|
}
|
|
95949
|
-
const worker = await
|
|
96171
|
+
const worker = await readFile16(input.worker.path, "utf8");
|
|
95950
96172
|
const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
|
|
95951
96173
|
if (content === worker)
|
|
95952
96174
|
throw new Error("Cannot derive default: medium worker has no matching internal name");
|
|
@@ -95956,7 +96178,7 @@ async function installDefaultAgentRole(input) {
|
|
|
95956
96178
|
}
|
|
95957
96179
|
async function readIfPresent(path) {
|
|
95958
96180
|
try {
|
|
95959
|
-
return await
|
|
96181
|
+
return await readFile16(path, "utf8");
|
|
95960
96182
|
} catch (error) {
|
|
95961
96183
|
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
95962
96184
|
return null;
|
|
@@ -95976,27 +96198,19 @@ async function linkCachedPluginAgents(input) {
|
|
|
95976
96198
|
await writeManifest(input.pluginRoot, []);
|
|
95977
96199
|
return [];
|
|
95978
96200
|
}
|
|
95979
|
-
const agentsDir =
|
|
95980
|
-
await
|
|
96201
|
+
const agentsDir = join44(input.codexHome, "agents");
|
|
96202
|
+
await mkdir7(agentsDir, { recursive: true });
|
|
96203
|
+
const previousReceipts = await readAgentModelReceipts(input.codexHome);
|
|
96204
|
+
const receipts = new Map;
|
|
95981
96205
|
const linked = [];
|
|
95982
96206
|
for (const agentPath of bundledAgents) {
|
|
95983
96207
|
const agentFileName = basename7(agentPath);
|
|
95984
96208
|
const agentName = agentNameFromToml2(agentFileName);
|
|
95985
|
-
const linkPath =
|
|
95986
|
-
await
|
|
95987
|
-
await restorePreservedReasoning({
|
|
95988
|
-
agentName,
|
|
95989
|
-
linkPath,
|
|
95990
|
-
target: agentPath,
|
|
95991
|
-
value: input.preservedReasoning?.get(agentName)
|
|
95992
|
-
});
|
|
95993
|
-
await restorePreservedServiceTier({
|
|
95994
|
-
linkPath,
|
|
95995
|
-
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
95996
|
-
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
95997
|
-
});
|
|
96209
|
+
const linkPath = join44(agentsDir, agentFileName);
|
|
96210
|
+
receipts.set(agentName, await syncAgentFile({ ...input, agentName, agentPath, linkPath, previousReceipt: previousReceipts.get(agentName) }));
|
|
95998
96211
|
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
95999
96212
|
}
|
|
96213
|
+
await writeAgentModelReceipts(input.codexHome, receipts);
|
|
96000
96214
|
const worker = linked.find((entry) => entry.name === "lazycodex-worker-medium.toml");
|
|
96001
96215
|
if (worker !== undefined) {
|
|
96002
96216
|
const fallback = await installDefaultAgentRole({ codexHome: input.codexHome, worker, enabled: input.defaultRoleEnabled !== false });
|
|
@@ -96006,8 +96220,33 @@ async function linkCachedPluginAgents(input) {
|
|
|
96006
96220
|
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
96007
96221
|
return linked;
|
|
96008
96222
|
}
|
|
96223
|
+
async function syncAgentFile(input) {
|
|
96224
|
+
const installed = await readTextIfExists(input.linkPath);
|
|
96225
|
+
const installedModel = installed === null ? null : extractModel(installed);
|
|
96226
|
+
const preservedReasoning = input.preservedReasoning?.get(input.agentName);
|
|
96227
|
+
const override = input.agentOverrides?.get(input.agentName);
|
|
96228
|
+
await replaceWithCopy(input.linkPath, input.agentPath);
|
|
96229
|
+
await restorePreservedModel({ linkPath: input.linkPath, value: handEditedAgentModel(installedModel, input.previousReceipt) });
|
|
96230
|
+
await restorePreservedReasoning({
|
|
96231
|
+
agentName: input.agentName,
|
|
96232
|
+
linkPath: input.linkPath,
|
|
96233
|
+
target: input.agentPath,
|
|
96234
|
+
value: preservedReasoning?.effort === input.previousReceipt?.reasoningEffort ? undefined : preservedReasoning
|
|
96235
|
+
});
|
|
96236
|
+
await restorePreservedServiceTier({
|
|
96237
|
+
linkPath: input.linkPath,
|
|
96238
|
+
preserved: input.preservedServiceTier?.has(input.agentName) ?? false,
|
|
96239
|
+
value: input.preservedServiceTier?.get(input.agentName) ?? null
|
|
96240
|
+
});
|
|
96241
|
+
await applyAgentOverride({ linkPath: input.linkPath, override });
|
|
96242
|
+
const model = override?.model ?? extractModel(await readFile17(input.agentPath, "utf8"));
|
|
96243
|
+
return {
|
|
96244
|
+
...model === null ? {} : { model },
|
|
96245
|
+
...override?.reasoningEffort === undefined ? {} : { reasoningEffort: override.reasoningEffort }
|
|
96246
|
+
};
|
|
96247
|
+
}
|
|
96009
96248
|
async function discoverBundledAgents(pluginRoot) {
|
|
96010
|
-
const componentsRoot =
|
|
96249
|
+
const componentsRoot = join44(pluginRoot, "components");
|
|
96011
96250
|
if (!await exists4(componentsRoot))
|
|
96012
96251
|
return [];
|
|
96013
96252
|
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
@@ -96015,14 +96254,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
96015
96254
|
for (const entry of componentEntries) {
|
|
96016
96255
|
if (!entry.isDirectory())
|
|
96017
96256
|
continue;
|
|
96018
|
-
const agentsRoot =
|
|
96257
|
+
const agentsRoot = join44(componentsRoot, entry.name, "agents");
|
|
96019
96258
|
if (!await exists4(agentsRoot))
|
|
96020
96259
|
continue;
|
|
96021
96260
|
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
96022
96261
|
for (const file of agentEntries) {
|
|
96023
96262
|
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
96024
96263
|
continue;
|
|
96025
|
-
agents.push(
|
|
96264
|
+
agents.push(join44(agentsRoot, file.name));
|
|
96026
96265
|
}
|
|
96027
96266
|
}
|
|
96028
96267
|
agents.sort();
|
|
@@ -96039,12 +96278,12 @@ async function prepareReplacement(linkPath) {
|
|
|
96039
96278
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
96040
96279
|
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
96041
96280
|
}
|
|
96042
|
-
await
|
|
96281
|
+
await rm11(linkPath, { force: true });
|
|
96043
96282
|
}
|
|
96044
96283
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
96045
|
-
const manifestPath =
|
|
96284
|
+
const manifestPath = join44(pluginRoot, MANIFEST_FILE);
|
|
96046
96285
|
const payload = { agents: [...agentPaths].sort() };
|
|
96047
|
-
await
|
|
96286
|
+
await writeFile9(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
96048
96287
|
`);
|
|
96049
96288
|
}
|
|
96050
96289
|
function agentNameFromToml2(fileName) {
|
|
@@ -96066,13 +96305,59 @@ function nodeErrorCode3(error) {
|
|
|
96066
96305
|
return typeof error.code === "string" ? error.code : null;
|
|
96067
96306
|
}
|
|
96068
96307
|
|
|
96308
|
+
// packages/omo-codex/src/install/install-codex-agents.ts
|
|
96309
|
+
async function linkInstalledPluginAgents(input) {
|
|
96310
|
+
const { codexHome, log } = input;
|
|
96311
|
+
const preservedReasoning = await capturePreservedAgentReasoning({ codexHome });
|
|
96312
|
+
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome });
|
|
96313
|
+
const agentSourceRoots = await agentSourceRootsForInstall(input);
|
|
96314
|
+
const omoConfig = readCodexAgentConfig({ cwd: input.projectDirectory, env: input.env });
|
|
96315
|
+
for (const warning of omoConfig.warnings)
|
|
96316
|
+
log(`Warning: ${warning}`);
|
|
96317
|
+
const agentConfigs = new Map;
|
|
96318
|
+
for (const plugin of input.installed) {
|
|
96319
|
+
const agentLinks = await linkCachedPluginAgents({
|
|
96320
|
+
codexHome,
|
|
96321
|
+
pluginRoot: agentSourceRoots.get(plugin.name) ?? plugin.path,
|
|
96322
|
+
platform: input.platform,
|
|
96323
|
+
preservedReasoning,
|
|
96324
|
+
preservedServiceTier,
|
|
96325
|
+
defaultRoleEnabled: omoConfig.defaultRoleEnabled,
|
|
96326
|
+
agentOverrides: omoConfig.agentOverrides
|
|
96327
|
+
});
|
|
96328
|
+
for (const link of agentLinks) {
|
|
96329
|
+
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
96330
|
+
const agentName = agentNameFromToml3(link.name);
|
|
96331
|
+
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
96332
|
+
}
|
|
96333
|
+
}
|
|
96334
|
+
for (const warning of unmanagedAgentOverrideWarnings(omoConfig.agentOverrides, new Set(agentConfigs.keys()))) {
|
|
96335
|
+
log(`Warning: ${warning}`);
|
|
96336
|
+
}
|
|
96337
|
+
return [...agentConfigs.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
96338
|
+
}
|
|
96339
|
+
async function agentSourceRootsForInstall(input) {
|
|
96340
|
+
if (input.marketplace.name !== "sisyphuslabs") {
|
|
96341
|
+
return new Map(input.installed.map((plugin) => [plugin.name, plugin.path]));
|
|
96342
|
+
}
|
|
96343
|
+
const snapshotPlugins = await writeInstalledMarketplaceSnapshot({
|
|
96344
|
+
codexHome: input.codexHome,
|
|
96345
|
+
marketplace: input.marketplace,
|
|
96346
|
+
plugins: input.pluginSources
|
|
96347
|
+
});
|
|
96348
|
+
return new Map(snapshotPlugins.map((plugin) => [plugin.name, plugin.path]));
|
|
96349
|
+
}
|
|
96350
|
+
function agentNameFromToml3(fileName) {
|
|
96351
|
+
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
96352
|
+
}
|
|
96353
|
+
|
|
96069
96354
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
96070
|
-
import { readFile as
|
|
96071
|
-
import { join as
|
|
96355
|
+
import { readFile as readFile18 } from "fs/promises";
|
|
96356
|
+
import { join as join45 } from "path";
|
|
96072
96357
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
96073
96358
|
async function readMarketplace(repoRoot, options) {
|
|
96074
|
-
const marketplacePath = options?.marketplacePath ??
|
|
96075
|
-
const raw = await
|
|
96359
|
+
const marketplacePath = options?.marketplacePath ?? join45(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
96360
|
+
const raw = await readFile18(marketplacePath, "utf8");
|
|
96076
96361
|
const parsed = JSON.parse(raw);
|
|
96077
96362
|
if (!isPlainRecord4(parsed))
|
|
96078
96363
|
throw new Error("marketplace.json must be an object");
|
|
@@ -96090,10 +96375,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
96090
96375
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
96091
96376
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
96092
96377
|
const relativePath = sourcePath.slice(2);
|
|
96093
|
-
return
|
|
96378
|
+
return join45(repoRoot, ...relativePath.split(/[\\/]/));
|
|
96094
96379
|
}
|
|
96095
96380
|
async function readPluginManifest(pluginRoot) {
|
|
96096
|
-
const raw = await
|
|
96381
|
+
const raw = await readFile18(join45(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
96097
96382
|
const parsed = JSON.parse(raw);
|
|
96098
96383
|
if (!isPlainRecord4(parsed))
|
|
96099
96384
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -96173,61 +96458,12 @@ function validateLocalSourcePath(path) {
|
|
|
96173
96458
|
return path;
|
|
96174
96459
|
}
|
|
96175
96460
|
|
|
96176
|
-
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
96177
|
-
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm10, writeFile as writeFile8 } from "fs/promises";
|
|
96178
|
-
import { join as join44, sep as sep6 } from "path";
|
|
96179
|
-
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
96180
|
-
async function writeInstalledMarketplaceSnapshot(input) {
|
|
96181
|
-
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
96182
|
-
await mkdir7(marketplaceRoot, { recursive: true });
|
|
96183
|
-
await writeMarketplaceManifest(marketplaceRoot, input.marketplace);
|
|
96184
|
-
const snapshotPlugins = [];
|
|
96185
|
-
for (const plugin of input.plugins) {
|
|
96186
|
-
snapshotPlugins.push(await writeSnapshotPlugin(marketplaceRoot, plugin));
|
|
96187
|
-
}
|
|
96188
|
-
return snapshotPlugins;
|
|
96189
|
-
}
|
|
96190
|
-
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
96191
|
-
return join44(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
96192
|
-
}
|
|
96193
|
-
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
96194
|
-
const manifestDir = join44(marketplaceRoot, ".agents", "plugins");
|
|
96195
|
-
await mkdir7(manifestDir, { recursive: true });
|
|
96196
|
-
const tempPath = join44(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
96197
|
-
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
96198
|
-
`);
|
|
96199
|
-
await rename4(tempPath, join44(manifestDir, "marketplace.json"));
|
|
96200
|
-
}
|
|
96201
|
-
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
96202
|
-
const pluginsDir = join44(marketplaceRoot, "plugins");
|
|
96203
|
-
await mkdir7(pluginsDir, { recursive: true });
|
|
96204
|
-
const targetPath = join44(pluginsDir, plugin.name);
|
|
96205
|
-
const tempPath = join44(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
96206
|
-
await rm10(tempPath, { recursive: true, force: true });
|
|
96207
|
-
await cp3(plugin.sourcePath, tempPath, {
|
|
96208
|
-
recursive: true,
|
|
96209
|
-
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
96210
|
-
});
|
|
96211
|
-
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
96212
|
-
await rm10(targetPath, { recursive: true, force: true });
|
|
96213
|
-
await rename4(tempPath, targetPath);
|
|
96214
|
-
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
96215
|
-
return { name: plugin.name, path: targetPath };
|
|
96216
|
-
}
|
|
96217
|
-
function shouldCopyMarketplaceSourcePath(path, root) {
|
|
96218
|
-
const relative = path === root ? "" : path.slice(root.length + sep6.length);
|
|
96219
|
-
if (relative === "")
|
|
96220
|
-
return true;
|
|
96221
|
-
const parts = relative.split(sep6);
|
|
96222
|
-
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
96223
|
-
}
|
|
96224
|
-
|
|
96225
96461
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
96226
|
-
import { readdir as readdir8, readFile as
|
|
96227
|
-
import { join as
|
|
96462
|
+
import { readdir as readdir8, readFile as readFile19, writeFile as writeFile10 } from "fs/promises";
|
|
96463
|
+
import { join as join46 } from "path";
|
|
96228
96464
|
async function readDistributionManifest(repoRoot) {
|
|
96229
96465
|
try {
|
|
96230
|
-
const parsed = JSON.parse(await
|
|
96466
|
+
const parsed = JSON.parse(await readFile19(join46(repoRoot, "package.json"), "utf8"));
|
|
96231
96467
|
if (!isPlainRecord4(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
96232
96468
|
return;
|
|
96233
96469
|
return {
|
|
@@ -96251,19 +96487,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
96251
96487
|
return input.manifestVersion ?? "local";
|
|
96252
96488
|
}
|
|
96253
96489
|
async function stampLazyCodexPluginVersion(input) {
|
|
96254
|
-
const manifestPath =
|
|
96490
|
+
const manifestPath = join46(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
96255
96491
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
96256
96492
|
await stampJsonVersion(manifestPath, input.version);
|
|
96257
|
-
await stampJsonVersion(
|
|
96493
|
+
await stampJsonVersion(join46(input.pluginRoot, "package.json"), input.version);
|
|
96258
96494
|
for (const hookPath of hookPaths) {
|
|
96259
|
-
await stampHookStatusMessages(
|
|
96495
|
+
await stampHookStatusMessages(join46(input.pluginRoot, hookPath), input.version);
|
|
96260
96496
|
}
|
|
96261
96497
|
await stampComponentVersions(input);
|
|
96262
96498
|
}
|
|
96263
96499
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
96264
96500
|
if (input.distributionManifest === undefined)
|
|
96265
96501
|
return;
|
|
96266
|
-
await
|
|
96502
|
+
await writeFile10(join46(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
96267
96503
|
packageName: input.distributionManifest.name,
|
|
96268
96504
|
version: input.distributionManifest.version
|
|
96269
96505
|
}, null, "\t")}
|
|
@@ -96271,11 +96507,11 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
96271
96507
|
}
|
|
96272
96508
|
async function stampJsonVersion(path, version) {
|
|
96273
96509
|
try {
|
|
96274
|
-
const parsed = JSON.parse(await
|
|
96510
|
+
const parsed = JSON.parse(await readFile19(path, "utf8"));
|
|
96275
96511
|
if (!isPlainRecord4(parsed))
|
|
96276
96512
|
return;
|
|
96277
96513
|
parsed.version = version;
|
|
96278
|
-
await
|
|
96514
|
+
await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
|
|
96279
96515
|
`);
|
|
96280
96516
|
} catch (error) {
|
|
96281
96517
|
if (error instanceof Error)
|
|
@@ -96285,7 +96521,7 @@ async function stampJsonVersion(path, version) {
|
|
|
96285
96521
|
}
|
|
96286
96522
|
async function readPluginHookPaths(manifestPath) {
|
|
96287
96523
|
try {
|
|
96288
|
-
const parsed = JSON.parse(await
|
|
96524
|
+
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
96289
96525
|
if (!isPlainRecord4(parsed))
|
|
96290
96526
|
return [];
|
|
96291
96527
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
@@ -96305,11 +96541,11 @@ function stripDotSlash3(path) {
|
|
|
96305
96541
|
}
|
|
96306
96542
|
async function stampHookStatusMessages(path, version) {
|
|
96307
96543
|
try {
|
|
96308
|
-
const parsed = JSON.parse(await
|
|
96544
|
+
const parsed = JSON.parse(await readFile19(path, "utf8"));
|
|
96309
96545
|
if (!isPlainRecord4(parsed))
|
|
96310
96546
|
return;
|
|
96311
96547
|
stampHookGroups(parsed.hooks, version);
|
|
96312
|
-
await
|
|
96548
|
+
await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
|
|
96313
96549
|
`);
|
|
96314
96550
|
} catch (error) {
|
|
96315
96551
|
if (error instanceof Error)
|
|
@@ -96320,16 +96556,16 @@ async function stampHookStatusMessages(path, version) {
|
|
|
96320
96556
|
async function stampComponentVersions(input) {
|
|
96321
96557
|
let entries;
|
|
96322
96558
|
try {
|
|
96323
|
-
entries = await readdir8(
|
|
96559
|
+
entries = await readdir8(join46(input.pluginRoot, "components"));
|
|
96324
96560
|
} catch (error) {
|
|
96325
96561
|
if (error instanceof Error)
|
|
96326
96562
|
return;
|
|
96327
96563
|
throw error;
|
|
96328
96564
|
}
|
|
96329
96565
|
for (const entry of entries) {
|
|
96330
|
-
const componentRoot =
|
|
96331
|
-
await stampJsonVersion(
|
|
96332
|
-
await stampHookStatusMessages(
|
|
96566
|
+
const componentRoot = join46(input.pluginRoot, "components", entry);
|
|
96567
|
+
await stampJsonVersion(join46(componentRoot, "package.json"), input.version);
|
|
96568
|
+
await stampHookStatusMessages(join46(componentRoot, "hooks", "hooks.json"), input.version);
|
|
96333
96569
|
}
|
|
96334
96570
|
}
|
|
96335
96571
|
function stampHookGroups(hooks, version) {
|
|
@@ -96386,8 +96622,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
96386
96622
|
};
|
|
96387
96623
|
|
|
96388
96624
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
96389
|
-
import { copyFile as copyFile2, lstat as lstat11, readFile as
|
|
96390
|
-
import { dirname as dirname17, join as
|
|
96625
|
+
import { copyFile as copyFile2, lstat as lstat11, readFile as readFile20, writeFile as writeFile11 } from "fs/promises";
|
|
96626
|
+
import { dirname as dirname17, join as join47, resolve as resolve11 } from "path";
|
|
96391
96627
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
96392
96628
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
96393
96629
|
".codex/hooks.json",
|
|
@@ -96406,7 +96642,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
96406
96642
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
96407
96643
|
const configs = [];
|
|
96408
96644
|
for (const configPath of project.configPaths) {
|
|
96409
|
-
const original = await
|
|
96645
|
+
const original = await readFile20(configPath, "utf8");
|
|
96410
96646
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
96411
96647
|
if (!repair.changed) {
|
|
96412
96648
|
configs.push({
|
|
@@ -96419,7 +96655,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
96419
96655
|
}
|
|
96420
96656
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp(input.now?.() ?? new Date)}`;
|
|
96421
96657
|
await copyFile2(configPath, backupPath);
|
|
96422
|
-
await
|
|
96658
|
+
await writeFile11(configPath, `${repair.config.trimEnd()}
|
|
96423
96659
|
`);
|
|
96424
96660
|
configs.push({
|
|
96425
96661
|
projectRoot: project.projectRoot,
|
|
@@ -96490,17 +96726,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
96490
96726
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
96491
96727
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
96492
96728
|
}
|
|
96493
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
96729
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join47(resolve11(codexHome), "config.toml");
|
|
96494
96730
|
let current = resolve11(startDirectory);
|
|
96495
96731
|
const configPathsFromCwd = [];
|
|
96496
96732
|
while (true) {
|
|
96497
|
-
const configPath =
|
|
96733
|
+
const configPath = join47(current, ".codex", "config.toml");
|
|
96498
96734
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
96499
96735
|
if (codexHomeConfigPath === null || resolve11(configPath) !== codexHomeConfigPath) {
|
|
96500
96736
|
configPathsFromCwd.push(configPath);
|
|
96501
96737
|
}
|
|
96502
96738
|
}
|
|
96503
|
-
if (await exists5(
|
|
96739
|
+
if (await exists5(join47(current, ".git"))) {
|
|
96504
96740
|
return configPathsFromCwd.length === 0 ? null : {
|
|
96505
96741
|
projectRoot: current,
|
|
96506
96742
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
@@ -96520,7 +96756,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
96520
96756
|
}
|
|
96521
96757
|
}
|
|
96522
96758
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
96523
|
-
const codexDirStat = await maybeLstat(
|
|
96759
|
+
const codexDirStat = await maybeLstat(join47(directory, ".codex"));
|
|
96524
96760
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
96525
96761
|
return false;
|
|
96526
96762
|
const configStat = await maybeLstat(configPath);
|
|
@@ -96540,7 +96776,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
96540
96776
|
const seenPaths = new Set;
|
|
96541
96777
|
for (const projectRoot of projectRoots) {
|
|
96542
96778
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
96543
|
-
const artifactPath =
|
|
96779
|
+
const artifactPath = join47(projectRoot, relativePath);
|
|
96544
96780
|
if (seenPaths.has(artifactPath))
|
|
96545
96781
|
continue;
|
|
96546
96782
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -96616,13 +96852,13 @@ function formatUnknownError(error) {
|
|
|
96616
96852
|
|
|
96617
96853
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
96618
96854
|
import { createHash as createHash4 } from "crypto";
|
|
96619
|
-
import { lstat as lstat12, readFile as
|
|
96855
|
+
import { lstat as lstat12, readFile as readFile22, readdir as readdir10, rm as rm12 } from "fs/promises";
|
|
96620
96856
|
import { tmpdir as tmpdir3 } from "os";
|
|
96621
|
-
import { join as
|
|
96857
|
+
import { join as join48, posix as posix6 } from "path";
|
|
96622
96858
|
|
|
96623
96859
|
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
|
|
96624
96860
|
import { execFile } from "child_process";
|
|
96625
|
-
import { readFile as
|
|
96861
|
+
import { readFile as readFile21, readdir as readdir9, readlink as readlink5 } from "fs/promises";
|
|
96626
96862
|
import { connect } from "net";
|
|
96627
96863
|
import { basename as basename8 } from "path";
|
|
96628
96864
|
var PROBE_TIMEOUT_MS = 500;
|
|
@@ -96664,7 +96900,7 @@ async function attestLegacyDaemonOwnership(input, deps = {}) {
|
|
|
96664
96900
|
return false;
|
|
96665
96901
|
}
|
|
96666
96902
|
async function attestLinuxOwnership(input, deps) {
|
|
96667
|
-
const readFileImpl = deps.readFile ??
|
|
96903
|
+
const readFileImpl = deps.readFile ?? readFile21;
|
|
96668
96904
|
const readDirImpl = deps.readDir ?? readdir9;
|
|
96669
96905
|
const readLinkImpl = deps.readLink ?? readlink5;
|
|
96670
96906
|
const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
|
|
@@ -96791,7 +97027,7 @@ async function readBinary(readFileImpl, path) {
|
|
|
96791
97027
|
var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
|
|
96792
97028
|
var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
96793
97029
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
96794
|
-
const daemonRoot =
|
|
97030
|
+
const daemonRoot = join48(codexHome, "codex-lsp", "daemon");
|
|
96795
97031
|
const platform = deps.platform ?? process.platform;
|
|
96796
97032
|
const tmpDir = deps.tmpDir ?? tmpdir3();
|
|
96797
97033
|
const probe = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
|
|
@@ -96801,7 +97037,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
96801
97037
|
const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
|
|
96802
97038
|
const results = [];
|
|
96803
97039
|
for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
|
|
96804
|
-
const versionPath =
|
|
97040
|
+
const versionPath = join48(daemonRoot, entry.name);
|
|
96805
97041
|
const parsedVersion = parseVersionEntry(entry.name);
|
|
96806
97042
|
if (parsedVersion === null || !entry.isDirectory()) {
|
|
96807
97043
|
await removeVersionDir(versionPath);
|
|
@@ -96849,7 +97085,7 @@ function parseVersionEntry(entryName) {
|
|
|
96849
97085
|
return LEGACY_VERSION_PATTERN.test(version) ? version : null;
|
|
96850
97086
|
}
|
|
96851
97087
|
async function readLegacyMetadata(input) {
|
|
96852
|
-
const pidText = await readRegularTrimmedFile(
|
|
97088
|
+
const pidText = await readRegularTrimmedFile(join48(input.versionPath, "daemon.pid"));
|
|
96853
97089
|
if (pidText === "non_regular")
|
|
96854
97090
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
96855
97091
|
if (pidText === null)
|
|
@@ -96857,7 +97093,7 @@ async function readLegacyMetadata(input) {
|
|
|
96857
97093
|
const pid = Number.parseInt(pidText, 10);
|
|
96858
97094
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
96859
97095
|
return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
|
|
96860
|
-
const endpointText = await readRegularTrimmedFile(
|
|
97096
|
+
const endpointText = await readRegularTrimmedFile(join48(input.versionPath, "daemon.endpoint"));
|
|
96861
97097
|
if (endpointText === "non_regular")
|
|
96862
97098
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
96863
97099
|
if (endpointText === null)
|
|
@@ -96889,14 +97125,14 @@ async function readRegularTrimmedFile(path) {
|
|
|
96889
97125
|
return null;
|
|
96890
97126
|
if (!stats.isFile())
|
|
96891
97127
|
return "non_regular";
|
|
96892
|
-
const content = (await
|
|
97128
|
+
const content = (await readFile22(path, "utf8")).trim();
|
|
96893
97129
|
return content.length > 0 ? content : null;
|
|
96894
97130
|
}
|
|
96895
97131
|
function shortDigest(value) {
|
|
96896
97132
|
return createHash4("sha256").update(value).digest("hex").slice(0, 16);
|
|
96897
97133
|
}
|
|
96898
97134
|
async function removeVersionDir(path) {
|
|
96899
|
-
await
|
|
97135
|
+
await rm12(path, { recursive: true, force: true });
|
|
96900
97136
|
}
|
|
96901
97137
|
function removed(version, reason) {
|
|
96902
97138
|
return { version, status: "removed", reason };
|
|
@@ -96936,7 +97172,7 @@ function processIsRunning(pid) {
|
|
|
96936
97172
|
|
|
96937
97173
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
96938
97174
|
import { homedir as homedir5 } from "os";
|
|
96939
|
-
import { join as
|
|
97175
|
+
import { join as join49, resolve as resolve12 } from "path";
|
|
96940
97176
|
function resolveCodexInstallerBinDir(input) {
|
|
96941
97177
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
96942
97178
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -96945,16 +97181,16 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
96945
97181
|
const defaultCodexHome = resolve12(homeDir, ".codex");
|
|
96946
97182
|
const resolvedCodexHome = resolve12(input.codexHome);
|
|
96947
97183
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
96948
|
-
return
|
|
97184
|
+
return join49(resolvedCodexHome, "bin");
|
|
96949
97185
|
return resolve12(homeDir, ".local", "bin");
|
|
96950
97186
|
}
|
|
96951
97187
|
|
|
96952
97188
|
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
|
|
96953
|
-
import { readFile as
|
|
96954
|
-
import { join as
|
|
97189
|
+
import { readFile as readFile23, readdir as readdir11, writeFile as writeFile12 } from "fs/promises";
|
|
97190
|
+
import { join as join50 } from "path";
|
|
96955
97191
|
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
|
|
96956
97192
|
async function writeInstalledCodexBinDir(input) {
|
|
96957
|
-
await
|
|
97193
|
+
await writeFile12(join50(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
|
|
96958
97194
|
`);
|
|
96959
97195
|
}
|
|
96960
97196
|
async function readInstalledCodexBinDir(codexHome) {
|
|
@@ -96967,20 +97203,20 @@ async function readInstalledCodexBinDir(codexHome) {
|
|
|
96967
97203
|
}
|
|
96968
97204
|
async function installedBinDirManifestPaths(codexHome) {
|
|
96969
97205
|
const paths = [
|
|
96970
|
-
|
|
97206
|
+
join50(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_BIN_DIR_MANIFEST)
|
|
96971
97207
|
];
|
|
96972
|
-
const versionRoot =
|
|
97208
|
+
const versionRoot = join50(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
96973
97209
|
const entries = await readdir11(versionRoot, { withFileTypes: true }).catch(() => null);
|
|
96974
97210
|
if (entries !== null) {
|
|
96975
97211
|
for (const entry of entries) {
|
|
96976
97212
|
if (entry.isDirectory())
|
|
96977
|
-
paths.push(
|
|
97213
|
+
paths.push(join50(versionRoot, entry.name, INSTALLED_BIN_DIR_MANIFEST));
|
|
96978
97214
|
}
|
|
96979
97215
|
}
|
|
96980
97216
|
return paths;
|
|
96981
97217
|
}
|
|
96982
97218
|
async function readBinDirFromManifest(manifestPath) {
|
|
96983
|
-
const raw = await
|
|
97219
|
+
const raw = await readFile23(manifestPath, "utf8").catch(() => null);
|
|
96984
97220
|
if (raw === null)
|
|
96985
97221
|
return null;
|
|
96986
97222
|
let parsed;
|
|
@@ -96998,8 +97234,8 @@ async function readBinDirFromManifest(manifestPath) {
|
|
|
96998
97234
|
}
|
|
96999
97235
|
|
|
97000
97236
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
97001
|
-
import { readFile as
|
|
97002
|
-
import { join as
|
|
97237
|
+
import { readFile as readFile24, writeFile as writeFile13 } from "fs/promises";
|
|
97238
|
+
import { join as join51 } from "path";
|
|
97003
97239
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
97004
97240
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
97005
97241
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -97007,20 +97243,20 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
97007
97243
|
async function removeGitBashHooksOffWindows(input) {
|
|
97008
97244
|
if (input.platform === "win32")
|
|
97009
97245
|
return;
|
|
97010
|
-
const manifestPath =
|
|
97011
|
-
const parsed = JSON.parse(await
|
|
97246
|
+
const manifestPath = join51(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
97247
|
+
const parsed = JSON.parse(await readFile24(manifestPath, "utf8"));
|
|
97012
97248
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.hooks))
|
|
97013
97249
|
return;
|
|
97014
97250
|
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
|
|
97015
97251
|
if (hooks.length === parsed.hooks.length)
|
|
97016
97252
|
return;
|
|
97017
|
-
await
|
|
97253
|
+
await writeFile13(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
|
|
97018
97254
|
`);
|
|
97019
97255
|
}
|
|
97020
97256
|
|
|
97021
97257
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
97022
97258
|
init_src();
|
|
97023
|
-
import { join as
|
|
97259
|
+
import { join as join52 } from "path";
|
|
97024
97260
|
function describeResult(result) {
|
|
97025
97261
|
if (result.kind === "succeeded")
|
|
97026
97262
|
return null;
|
|
@@ -97034,7 +97270,7 @@ async function installAstGrepForCodex(options) {
|
|
|
97034
97270
|
return;
|
|
97035
97271
|
const platform = options.platform ?? process.platform;
|
|
97036
97272
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
97037
|
-
const skillDir =
|
|
97273
|
+
const skillDir = join52(plugin.path, "skills", "ast-grep");
|
|
97038
97274
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
97039
97275
|
try {
|
|
97040
97276
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -97067,7 +97303,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97067
97303
|
const env = options.env ?? process.env;
|
|
97068
97304
|
const platform = options.platform ?? process.platform;
|
|
97069
97305
|
const repoRoot = resolve13(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env }));
|
|
97070
|
-
const codexHome = resolve13(options.codexHome ?? env.CODEX_HOME ??
|
|
97306
|
+
const codexHome = resolve13(options.codexHome ?? env.CODEX_HOME ?? join56(homedir6(), ".codex"));
|
|
97071
97307
|
const projectDirectory = resolve13(options.projectDirectory ?? env.OMO_CODEX_PROJECT ?? process.cwd());
|
|
97072
97308
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env });
|
|
97073
97309
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -97084,14 +97320,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
97084
97320
|
if (!gitBashResolution.found) {
|
|
97085
97321
|
throw new Error(gitBashResolution.installHint);
|
|
97086
97322
|
}
|
|
97087
|
-
const codexPackageRoot =
|
|
97323
|
+
const codexPackageRoot = join56(repoRoot, "packages", "omo-codex");
|
|
97088
97324
|
const marketplace = await readMarketplace(repoRoot, {
|
|
97089
|
-
marketplacePath:
|
|
97325
|
+
marketplacePath: join56(codexPackageRoot, "marketplace.json")
|
|
97090
97326
|
});
|
|
97091
97327
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
97092
97328
|
const installed = [];
|
|
97093
97329
|
const pluginSources = [];
|
|
97094
|
-
const agentConfigs = new Map;
|
|
97095
97330
|
for (const entry of marketplace.plugins) {
|
|
97096
97331
|
const sourcePath = resolvePluginSource(codexPackageRoot, entry, { pathOverride: "./plugin" });
|
|
97097
97332
|
const manifest = await readPluginManifest(sourcePath);
|
|
@@ -97132,7 +97367,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97132
97367
|
if (runtimeLink !== null)
|
|
97133
97368
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
97134
97369
|
else
|
|
97135
|
-
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${
|
|
97370
|
+
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`);
|
|
97136
97371
|
}
|
|
97137
97372
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
97138
97373
|
installed.push(plugin);
|
|
@@ -97144,33 +97379,16 @@ async function runCodexInstaller(options = {}) {
|
|
|
97144
97379
|
log,
|
|
97145
97380
|
platform
|
|
97146
97381
|
});
|
|
97147
|
-
const
|
|
97148
|
-
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome });
|
|
97149
|
-
const agentSourceRoots = await agentSourceRootsForInstall({
|
|
97382
|
+
const agentConfigs = await linkInstalledPluginAgents({
|
|
97150
97383
|
codexHome,
|
|
97384
|
+
projectDirectory,
|
|
97385
|
+
env,
|
|
97386
|
+
platform,
|
|
97387
|
+
log,
|
|
97151
97388
|
marketplace,
|
|
97152
97389
|
installed,
|
|
97153
97390
|
pluginSources
|
|
97154
97391
|
});
|
|
97155
|
-
const omoConfig = readDefaultRoleConfig({ cwd: projectDirectory, env });
|
|
97156
|
-
for (const warning of omoConfig.warnings)
|
|
97157
|
-
log(`Warning: ${warning}`);
|
|
97158
|
-
for (const plugin of installed) {
|
|
97159
|
-
const pluginRoot = agentSourceRoots.get(plugin.name) ?? plugin.path;
|
|
97160
|
-
const agentLinks = await linkCachedPluginAgents({
|
|
97161
|
-
codexHome,
|
|
97162
|
-
pluginRoot,
|
|
97163
|
-
platform,
|
|
97164
|
-
preservedReasoning,
|
|
97165
|
-
preservedServiceTier,
|
|
97166
|
-
defaultRoleEnabled: omoConfig.enabled
|
|
97167
|
-
});
|
|
97168
|
-
for (const link of agentLinks) {
|
|
97169
|
-
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
97170
|
-
const agentName = agentNameFromToml3(link.name);
|
|
97171
|
-
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
97172
|
-
}
|
|
97173
|
-
}
|
|
97174
97392
|
const trustedHookStates = (await Promise.all(installed.map((plugin) => trustedHookStatesForPlugin({
|
|
97175
97393
|
marketplaceName: marketplace.name,
|
|
97176
97394
|
platform,
|
|
@@ -97199,13 +97417,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
97199
97417
|
continue;
|
|
97200
97418
|
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
|
|
97201
97419
|
}
|
|
97202
|
-
const marketplaceRoot =
|
|
97420
|
+
const marketplaceRoot = join56(codexHome, "plugins", "cache", marketplace.name);
|
|
97203
97421
|
await writeCachedMarketplaceManifest({
|
|
97204
97422
|
marketplaceName: marketplace.name,
|
|
97205
97423
|
marketplaceRoot,
|
|
97206
97424
|
plugins: installed
|
|
97207
97425
|
});
|
|
97208
|
-
const configPath =
|
|
97426
|
+
const configPath = join56(codexHome, "config.toml");
|
|
97209
97427
|
await updateCodexConfig({
|
|
97210
97428
|
configPath,
|
|
97211
97429
|
repoRoot: codexPackageRoot,
|
|
@@ -97215,7 +97433,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97215
97433
|
platform,
|
|
97216
97434
|
gitBashEnabled: platform === "win32" && gitBashResolution.found,
|
|
97217
97435
|
trustedHookStates,
|
|
97218
|
-
agentConfigs
|
|
97436
|
+
agentConfigs,
|
|
97219
97437
|
autonomousPermissions: options.autonomousPermissions !== false,
|
|
97220
97438
|
...options.reasoning === undefined ? {} : { reasoning: options.reasoning }
|
|
97221
97439
|
});
|
|
@@ -97242,20 +97460,6 @@ async function runCodexInstaller(options = {}) {
|
|
|
97242
97460
|
projectCleanup
|
|
97243
97461
|
};
|
|
97244
97462
|
}
|
|
97245
|
-
function agentNameFromToml3(fileName) {
|
|
97246
|
-
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
97247
|
-
}
|
|
97248
|
-
async function agentSourceRootsForInstall(input) {
|
|
97249
|
-
if (input.marketplace.name !== "sisyphuslabs") {
|
|
97250
|
-
return new Map(input.installed.map((plugin) => [plugin.name, plugin.path]));
|
|
97251
|
-
}
|
|
97252
|
-
const snapshotPlugins = await writeInstalledMarketplaceSnapshot({
|
|
97253
|
-
codexHome: input.codexHome,
|
|
97254
|
-
marketplace: input.marketplace,
|
|
97255
|
-
plugins: input.pluginSources
|
|
97256
|
-
});
|
|
97257
|
-
return new Map(snapshotPlugins.map((plugin) => [plugin.name, plugin.path]));
|
|
97258
|
-
}
|
|
97259
97463
|
function legacyCacheMarketplaces(marketplaceName) {
|
|
97260
97464
|
return marketplaceName === "sisyphuslabs" ? SISYPHUS_LEGACY_CACHE_MARKETPLACES : [];
|
|
97261
97465
|
}
|
|
@@ -97264,7 +97468,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
97264
97468
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
97265
97469
|
if (isRepoRootWithCodexPlugin(current))
|
|
97266
97470
|
return current;
|
|
97267
|
-
for (const wrapperPackageRoot of [
|
|
97471
|
+
for (const wrapperPackageRoot of [join56(current, "node_modules", "oh-my-openagent"), join56(current, "oh-my-openagent")]) {
|
|
97268
97472
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
97269
97473
|
return wrapperPackageRoot;
|
|
97270
97474
|
}
|
|
@@ -97282,7 +97486,7 @@ function findRepoRoot(input) {
|
|
|
97282
97486
|
return findRepoRootFromImporter(input.importerDir);
|
|
97283
97487
|
}
|
|
97284
97488
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
97285
|
-
return existsSync27(
|
|
97489
|
+
return existsSync27(join56(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
97286
97490
|
}
|
|
97287
97491
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
97288
97492
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -97417,13 +97621,13 @@ function defaultRunCommand2(command, args) {
|
|
|
97417
97621
|
});
|
|
97418
97622
|
}
|
|
97419
97623
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
97420
|
-
import { lstat as lstat15, readFile as
|
|
97624
|
+
import { lstat as lstat15, readFile as readFile27, readdir as readdir13, rm as rm14, rmdir } from "fs/promises";
|
|
97421
97625
|
import { homedir as homedir8 } from "os";
|
|
97422
|
-
import { isAbsolute as isAbsolute11, join as
|
|
97626
|
+
import { isAbsolute as isAbsolute11, join as join59, relative as relative6, resolve as resolve16 } from "path";
|
|
97423
97627
|
|
|
97424
97628
|
// packages/omo-codex/src/install/codex-cleanup-bins.ts
|
|
97425
|
-
import { lstat as lstat13, readFile as
|
|
97426
|
-
import { dirname as dirname19, isAbsolute as isAbsolute9, join as
|
|
97629
|
+
import { lstat as lstat13, readFile as readFile25, readdir as readdir12, readlink as readlink6, rm as rm13 } from "fs/promises";
|
|
97630
|
+
import { dirname as dirname19, isAbsolute as isAbsolute9, join as join57, resolve as resolve14 } from "path";
|
|
97427
97631
|
var ROOT_RUNTIME_BIN_NAME = "omo";
|
|
97428
97632
|
var MANAGED_CODEX_BIN_NAMES = new Set([
|
|
97429
97633
|
ROOT_RUNTIME_BIN_NAME,
|
|
@@ -97453,9 +97657,9 @@ async function removeManagedCodexBins(binDir, platform) {
|
|
|
97453
97657
|
const binName = managedBinNameForEntry2(entry.name, platform);
|
|
97454
97658
|
if (binName === null || !MANAGED_CODEX_BIN_NAMES.has(binName))
|
|
97455
97659
|
continue;
|
|
97456
|
-
const linkPath =
|
|
97660
|
+
const linkPath = join57(binDir, entry.name);
|
|
97457
97661
|
if (await isManagedCodexBin(linkPath, platform, binName)) {
|
|
97458
|
-
await
|
|
97662
|
+
await rm13(linkPath, { force: true });
|
|
97459
97663
|
removed.push(linkPath);
|
|
97460
97664
|
}
|
|
97461
97665
|
}
|
|
@@ -97484,12 +97688,12 @@ async function isManagedCodexBin(linkPath, platform, binName) {
|
|
|
97484
97688
|
}
|
|
97485
97689
|
if (!entryStat.isFile())
|
|
97486
97690
|
return false;
|
|
97487
|
-
const content = await
|
|
97691
|
+
const content = await readFile25(linkPath, "utf8");
|
|
97488
97692
|
return content.includes(RUNTIME_WRAPPER_MARKER) || content.includes(COMMAND_SHIM_MARKER);
|
|
97489
97693
|
}
|
|
97490
97694
|
|
|
97491
97695
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
97492
|
-
import { lstat as lstat14, mkdir as mkdir8, readFile as
|
|
97696
|
+
import { lstat as lstat14, mkdir as mkdir8, readFile as readFile26, writeFile as writeFile14 } from "fs/promises";
|
|
97493
97697
|
import { dirname as dirname20 } from "path";
|
|
97494
97698
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
97495
97699
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
@@ -97522,14 +97726,14 @@ function cleanupCodexLightConfigText(config) {
|
|
|
97522
97726
|
async function cleanupCodexConfig(configPath, now) {
|
|
97523
97727
|
if (!await configExists(configPath))
|
|
97524
97728
|
return { changed: false };
|
|
97525
|
-
const original = await
|
|
97729
|
+
const original = await readFile26(configPath, "utf8");
|
|
97526
97730
|
const next = cleanupCodexLightConfigText(original);
|
|
97527
97731
|
if (next === original)
|
|
97528
97732
|
return { changed: false };
|
|
97529
97733
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
97530
97734
|
await mkdir8(dirname20(configPath), { recursive: true });
|
|
97531
|
-
await
|
|
97532
|
-
await
|
|
97735
|
+
await writeFile14(backupPath, original);
|
|
97736
|
+
await writeFile14(configPath, `${next.trimEnd()}
|
|
97533
97737
|
`);
|
|
97534
97738
|
return { changed: true, backupPath };
|
|
97535
97739
|
}
|
|
@@ -97606,7 +97810,7 @@ function nodeErrorCode5(error) {
|
|
|
97606
97810
|
}
|
|
97607
97811
|
|
|
97608
97812
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
97609
|
-
import { dirname as dirname21, isAbsolute as isAbsolute10, join as
|
|
97813
|
+
import { dirname as dirname21, isAbsolute as isAbsolute10, join as join58, relative as relative5, resolve as resolve15 } from "path";
|
|
97610
97814
|
function codexHomeResolvesToFilesystemRoot(codexHome) {
|
|
97611
97815
|
const resolved = resolve15(codexHome);
|
|
97612
97816
|
return dirname21(resolved) === resolved;
|
|
@@ -97623,11 +97827,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
97623
97827
|
if (target === codexHome)
|
|
97624
97828
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
97625
97829
|
const exactManagedRoots = new Set([
|
|
97626
|
-
resolve15(
|
|
97627
|
-
resolve15(
|
|
97628
|
-
resolve15(
|
|
97629
|
-
resolve15(
|
|
97630
|
-
resolve15(
|
|
97830
|
+
resolve15(join58(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
97831
|
+
resolve15(join58(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
97832
|
+
resolve15(join58(codexHome, "runtime", "ast-grep")),
|
|
97833
|
+
resolve15(join58(codexHome, "runtime", "node")),
|
|
97834
|
+
resolve15(join58(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
97631
97835
|
]);
|
|
97632
97836
|
if (exactManagedRoots.has(target))
|
|
97633
97837
|
return null;
|
|
@@ -97657,8 +97861,8 @@ function skipped(path, reason) {
|
|
|
97657
97861
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
97658
97862
|
async function cleanupCodexLight(input = {}) {
|
|
97659
97863
|
const env = input.env ?? process.env;
|
|
97660
|
-
const codexHome = resolve16(input.codexHome ?? env.CODEX_HOME ??
|
|
97661
|
-
const configPath =
|
|
97864
|
+
const codexHome = resolve16(input.codexHome ?? env.CODEX_HOME ?? join59(homedir8(), ".codex"));
|
|
97865
|
+
const configPath = join59(codexHome, "config.toml");
|
|
97662
97866
|
const installedBinDir = await readInstalledCodexBinDir(codexHome);
|
|
97663
97867
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
97664
97868
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
@@ -97712,17 +97916,17 @@ function firstConfiguredPath(...values) {
|
|
|
97712
97916
|
}
|
|
97713
97917
|
function managedGlobalStatePaths(codexHome) {
|
|
97714
97918
|
return [
|
|
97715
|
-
|
|
97716
|
-
|
|
97717
|
-
|
|
97718
|
-
|
|
97719
|
-
|
|
97919
|
+
join59(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
97920
|
+
join59(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
97921
|
+
join59(codexHome, "runtime", "ast-grep"),
|
|
97922
|
+
join59(codexHome, "runtime", "node"),
|
|
97923
|
+
join59(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
97720
97924
|
];
|
|
97721
97925
|
}
|
|
97722
97926
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
97723
97927
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
97724
97928
|
const results = [];
|
|
97725
|
-
await walkForManagedBootstrapDirs(
|
|
97929
|
+
await walkForManagedBootstrapDirs(join59(codexHome, "plugins"), 0, results);
|
|
97726
97930
|
return results;
|
|
97727
97931
|
}
|
|
97728
97932
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -97734,9 +97938,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
97734
97938
|
for (const entry of entries) {
|
|
97735
97939
|
if (!entry.isDirectory())
|
|
97736
97940
|
continue;
|
|
97737
|
-
const childPath =
|
|
97941
|
+
const childPath = join59(directory, entry.name);
|
|
97738
97942
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
97739
|
-
const bootstrapDir =
|
|
97943
|
+
const bootstrapDir = join59(childPath, "bootstrap");
|
|
97740
97944
|
if (await exists6(bootstrapDir))
|
|
97741
97945
|
results.push(bootstrapDir);
|
|
97742
97946
|
continue;
|
|
@@ -97762,7 +97966,7 @@ async function attemptRemove(path) {
|
|
|
97762
97966
|
try {
|
|
97763
97967
|
if (await lstat15(path).catch(() => null) === null)
|
|
97764
97968
|
return false;
|
|
97765
|
-
await
|
|
97969
|
+
await rm14(path, { recursive: true, force: true });
|
|
97766
97970
|
return true;
|
|
97767
97971
|
} catch {
|
|
97768
97972
|
return false;
|
|
@@ -97770,7 +97974,7 @@ async function attemptRemove(path) {
|
|
|
97770
97974
|
}
|
|
97771
97975
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
97772
97976
|
try {
|
|
97773
|
-
await rmdir(
|
|
97977
|
+
await rmdir(join59(codexHome, "runtime"));
|
|
97774
97978
|
} catch (error) {
|
|
97775
97979
|
if (isExpectedRuntimePruneFailure(error))
|
|
97776
97980
|
return;
|
|
@@ -97782,14 +97986,14 @@ function isExpectedRuntimePruneFailure(error) {
|
|
|
97782
97986
|
}
|
|
97783
97987
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
97784
97988
|
const manifestPaths = [
|
|
97785
|
-
|
|
97989
|
+
join59(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
97786
97990
|
];
|
|
97787
|
-
const versionRoot =
|
|
97991
|
+
const versionRoot = join59(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
97788
97992
|
if (await exists6(versionRoot)) {
|
|
97789
97993
|
const entries = await readdir13(versionRoot, { withFileTypes: true });
|
|
97790
97994
|
for (const entry of entries) {
|
|
97791
97995
|
if (entry.isDirectory())
|
|
97792
|
-
manifestPaths.push(
|
|
97996
|
+
manifestPaths.push(join59(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
97793
97997
|
}
|
|
97794
97998
|
}
|
|
97795
97999
|
const paths = new Set;
|
|
@@ -97806,19 +98010,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
97806
98010
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
97807
98011
|
if (!await exists6(configPath))
|
|
97808
98012
|
return [];
|
|
97809
|
-
const config = await
|
|
97810
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
98013
|
+
const config = await readFile27(configPath, "utf8");
|
|
98014
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join59(codexHome, "agents", `${agentName}.toml`));
|
|
97811
98015
|
}
|
|
97812
98016
|
async function readInstalledAgentManifest(manifestPath) {
|
|
97813
98017
|
if (!await exists6(manifestPath))
|
|
97814
98018
|
return [];
|
|
97815
|
-
const parsed = JSON.parse(await
|
|
98019
|
+
const parsed = JSON.parse(await readFile27(manifestPath, "utf8"));
|
|
97816
98020
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.agents))
|
|
97817
98021
|
return [];
|
|
97818
98022
|
return parsed.agents.filter((path) => typeof path === "string");
|
|
97819
98023
|
}
|
|
97820
98024
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
97821
|
-
const agentsDir =
|
|
98025
|
+
const agentsDir = join59(codexHome, "agents");
|
|
97822
98026
|
const removed = [];
|
|
97823
98027
|
const skipped = [];
|
|
97824
98028
|
for (const path of paths) {
|
|
@@ -97833,7 +98037,7 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
97833
98037
|
skipped.push(path);
|
|
97834
98038
|
continue;
|
|
97835
98039
|
}
|
|
97836
|
-
await
|
|
98040
|
+
await rm14(path, { force: true });
|
|
97837
98041
|
removed.push(path);
|
|
97838
98042
|
}
|
|
97839
98043
|
return { removed, skipped };
|
|
@@ -97870,14 +98074,14 @@ function nodeErrorCode6(error) {
|
|
|
97870
98074
|
import { execFile as execFile3 } from "child_process";
|
|
97871
98075
|
import { existsSync as existsSync31 } from "fs";
|
|
97872
98076
|
import { homedir as homedir11 } from "os";
|
|
97873
|
-
import { dirname as dirname25, join as
|
|
98077
|
+
import { dirname as dirname25, join as join64, resolve as resolve20 } from "path";
|
|
97874
98078
|
import { fileURLToPath } from "url";
|
|
97875
98079
|
import { promisify as promisify2 } from "util";
|
|
97876
98080
|
|
|
97877
98081
|
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
97878
98082
|
import { existsSync as existsSync29 } from "fs";
|
|
97879
98083
|
import { homedir as homedir9 } from "os";
|
|
97880
|
-
import { join as
|
|
98084
|
+
import { join as join60, resolve as resolve17 } from "path";
|
|
97881
98085
|
var AGENT_DIR_ENV_NAMES = [
|
|
97882
98086
|
"OMO_CODING_AGENT_DIR",
|
|
97883
98087
|
"SENPI_CODING_AGENT_DIR",
|
|
@@ -97891,25 +98095,25 @@ function resolveAgentHome(options) {
|
|
|
97891
98095
|
if (configured)
|
|
97892
98096
|
return resolve17(configured);
|
|
97893
98097
|
}
|
|
97894
|
-
const brandedHome =
|
|
97895
|
-
const canonical =
|
|
97896
|
-
if (exists(
|
|
98098
|
+
const brandedHome = join60(homeDir, ".omo");
|
|
98099
|
+
const canonical = join60(brandedHome, "agent");
|
|
98100
|
+
if (exists(join60(canonical, AGENT_HOME_SENTINEL)))
|
|
97897
98101
|
return canonical;
|
|
97898
|
-
if (exists(
|
|
98102
|
+
if (exists(join60(brandedHome, AGENT_HOME_SENTINEL)))
|
|
97899
98103
|
return brandedHome;
|
|
97900
|
-
return
|
|
98104
|
+
return join60(homeDir, ".senpi", "agent");
|
|
97901
98105
|
}
|
|
97902
98106
|
|
|
97903
98107
|
// packages/omo-senpi/src/install/local-launcher.ts
|
|
97904
98108
|
import { chmodSync as chmodSync3, existsSync as existsSync30, mkdirSync as mkdirSync12, readFileSync as readFileSync14, rmSync as rmSync4, writeFileSync as writeFileSync7 } from "fs";
|
|
97905
98109
|
import { homedir as homedir10 } from "os";
|
|
97906
|
-
import { dirname as dirname22, join as
|
|
98110
|
+
import { dirname as dirname22, join as join61, resolve as resolve18 } from "path";
|
|
97907
98111
|
var MARKER = "omo-local-launcher";
|
|
97908
98112
|
function localLauncherPath(homeDir = homedir10()) {
|
|
97909
|
-
return
|
|
98113
|
+
return join61(homeDir, ".local", "bin", "omo");
|
|
97910
98114
|
}
|
|
97911
98115
|
function localLauncherCmdPath(homeDir = homedir10()) {
|
|
97912
|
-
return
|
|
98116
|
+
return join61(homeDir, ".local", "bin", "omo.cmd");
|
|
97913
98117
|
}
|
|
97914
98118
|
function releaseChannel(version) {
|
|
97915
98119
|
return version !== undefined && version.includes("-") ? "beta" : "latest";
|
|
@@ -97927,7 +98131,7 @@ function renderLocalLauncher(options) {
|
|
|
97927
98131
|
userAgent: "omo",
|
|
97928
98132
|
originator: "omo",
|
|
97929
98133
|
changelog: {
|
|
97930
|
-
path:
|
|
98134
|
+
path: join61(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
|
|
97931
98135
|
},
|
|
97932
98136
|
update: {
|
|
97933
98137
|
packageName: "omo-ai",
|
|
@@ -97999,8 +98203,8 @@ node "%~dp0omo" %*\r
|
|
|
97999
98203
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
98000
98204
|
import { createHash as createHash6 } from "crypto";
|
|
98001
98205
|
import { constants as constants9 } from "fs";
|
|
98002
|
-
import { access as access2, readFile as
|
|
98003
|
-
import { dirname as dirname24, join as
|
|
98206
|
+
import { access as access2, readFile as readFile29, stat as stat6 } from "fs/promises";
|
|
98207
|
+
import { dirname as dirname24, join as join63 } from "path";
|
|
98004
98208
|
|
|
98005
98209
|
// packages/memory-core/src/personas/manifest.ts
|
|
98006
98210
|
var PERSONA_ASSET_FILENAMES = {
|
|
@@ -98018,18 +98222,18 @@ var PERSONA_ASSET_FILES = [
|
|
|
98018
98222
|
|
|
98019
98223
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
98020
98224
|
import { constants as constants8 } from "fs";
|
|
98021
|
-
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as
|
|
98022
|
-
import { basename as basename10, dirname as dirname23, join as
|
|
98225
|
+
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile28, rename as rename5, writeFile as writeFile15 } from "fs/promises";
|
|
98226
|
+
import { basename as basename10, dirname as dirname23, join as join62, resolve as resolve19 } from "path";
|
|
98023
98227
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
98024
98228
|
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
|
|
98025
98229
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
98026
|
-
|
|
98027
|
-
|
|
98230
|
+
join62("packages", "pi-goal"),
|
|
98231
|
+
join62("packages", "pi-webfetch")
|
|
98028
98232
|
];
|
|
98029
98233
|
async function readSettings(settingsPath) {
|
|
98030
98234
|
let raw;
|
|
98031
98235
|
try {
|
|
98032
|
-
raw = await
|
|
98236
|
+
raw = await readFile28(settingsPath, "utf8");
|
|
98033
98237
|
} catch (error) {
|
|
98034
98238
|
if (isErrno(error, "ENOENT"))
|
|
98035
98239
|
return {};
|
|
@@ -98076,11 +98280,11 @@ async function writeSettingsAtomically(settingsPath, settings) {
|
|
|
98076
98280
|
if (await fileExists(settingsPath)) {
|
|
98077
98281
|
await copyFile3(settingsPath, backupPath);
|
|
98078
98282
|
} else {
|
|
98079
|
-
await
|
|
98283
|
+
await writeFile15(backupPath, `{}
|
|
98080
98284
|
`, "utf8");
|
|
98081
98285
|
}
|
|
98082
98286
|
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
|
|
98083
|
-
await
|
|
98287
|
+
await writeFile15(tempPath, `${JSON.stringify(settings, null, 2)}
|
|
98084
98288
|
`, "utf8");
|
|
98085
98289
|
await rename5(tempPath, settingsPath);
|
|
98086
98290
|
return backupPath;
|
|
@@ -98103,7 +98307,7 @@ function isRecord15(value) {
|
|
|
98103
98307
|
async function readPackageName(packagePath) {
|
|
98104
98308
|
let raw;
|
|
98105
98309
|
try {
|
|
98106
|
-
raw = await
|
|
98310
|
+
raw = await readFile28(join62(packagePath, "package.json"), "utf8");
|
|
98107
98311
|
} catch (error) {
|
|
98108
98312
|
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
|
|
98109
98313
|
return;
|
|
@@ -98135,54 +98339,54 @@ function isErrno(error, code) {
|
|
|
98135
98339
|
|
|
98136
98340
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
98137
98341
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
98138
|
-
|
|
98139
|
-
|
|
98140
|
-
|
|
98141
|
-
|
|
98142
|
-
|
|
98143
|
-
|
|
98144
|
-
...PERSONA_ASSET_FILES.map((filename) =>
|
|
98145
|
-
|
|
98146
|
-
|
|
98147
|
-
|
|
98148
|
-
|
|
98149
|
-
|
|
98150
|
-
|
|
98151
|
-
|
|
98152
|
-
|
|
98153
|
-
|
|
98154
|
-
|
|
98155
|
-
|
|
98156
|
-
|
|
98157
|
-
|
|
98158
|
-
|
|
98159
|
-
|
|
98160
|
-
|
|
98161
|
-
|
|
98162
|
-
|
|
98163
|
-
|
|
98164
|
-
|
|
98165
|
-
|
|
98166
|
-
|
|
98167
|
-
|
|
98168
|
-
|
|
98169
|
-
|
|
98170
|
-
|
|
98171
|
-
|
|
98172
|
-
|
|
98173
|
-
|
|
98174
|
-
|
|
98342
|
+
join63("extensions", "omo.js"),
|
|
98343
|
+
join63("extensions", "omo-task.js"),
|
|
98344
|
+
join63("extensions", "omo-computer-use.js"),
|
|
98345
|
+
join63("extensions", "assets.generated.json"),
|
|
98346
|
+
join63("extensions", "omo-member.js"),
|
|
98347
|
+
join63("extensions", "memory-run-supervisor.mjs"),
|
|
98348
|
+
...PERSONA_ASSET_FILES.map((filename) => join63("extensions", filename)),
|
|
98349
|
+
join63("skills", "ast-grep", "SKILL.md"),
|
|
98350
|
+
join63("skills", "browser", "SKILL.md"),
|
|
98351
|
+
join63("skills", "coding-agent-sessions", "SKILL.md"),
|
|
98352
|
+
join63("skills", "debugging", "SKILL.md"),
|
|
98353
|
+
join63("skills", "frontend", "SKILL.md"),
|
|
98354
|
+
join63("skills", "git-master", "SKILL.md"),
|
|
98355
|
+
join63("skills", "init-deep", "SKILL.md"),
|
|
98356
|
+
join63("skills", "lsp-setup", "SKILL.md"),
|
|
98357
|
+
join63("skills", "programming", "SKILL.md"),
|
|
98358
|
+
join63("skills", "refactor", "SKILL.md"),
|
|
98359
|
+
join63("skills", "remove-ai-slops", "SKILL.md"),
|
|
98360
|
+
join63("skills", "review-work", "SKILL.md"),
|
|
98361
|
+
join63("skills", "ultimate-browsing", "SKILL.md"),
|
|
98362
|
+
join63("skills", "ultrawork", "SKILL.md"),
|
|
98363
|
+
join63("skills", "ulw-execute", "SKILL.md"),
|
|
98364
|
+
join63("skills", "ulw-loop", "SKILL.md"),
|
|
98365
|
+
join63("skills", "ulw-plan", "SKILL.md"),
|
|
98366
|
+
join63("skills", "ulw-research", "SKILL.md"),
|
|
98367
|
+
join63("skills", "visual-qa", "SKILL.md"),
|
|
98368
|
+
join63("skills-conditional", "x-search", "SKILL.md"),
|
|
98369
|
+
join63("runtime", "agent-toolkit-sdk", "sdk.js"),
|
|
98370
|
+
join63("runtime", "ast-grep-mcp", "cli.js"),
|
|
98371
|
+
join63("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
98372
|
+
join63("runtime", "lsp-daemon", "dist", "index.js"),
|
|
98373
|
+
join63("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
98374
|
+
join63("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
98375
|
+
join63("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
98376
|
+
join63("runtime", "lsp-daemon", "dist", "package.json"),
|
|
98377
|
+
join63("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
98378
|
+
join63("scripts", "install.mjs"),
|
|
98175
98379
|
"daemon-launch-spec.json"
|
|
98176
98380
|
];
|
|
98177
98381
|
async function ensurePluginArtifacts(context) {
|
|
98178
98382
|
if (context.allowBuild) {
|
|
98179
|
-
await context.runCommand("node", [
|
|
98180
|
-
await context.runCommand("node", [
|
|
98181
|
-
await context.runCommand("node", [
|
|
98182
|
-
await context.runCommand("node", [
|
|
98183
|
-
await context.runCommand("node", [
|
|
98184
|
-
await context.runCommand("node", [
|
|
98185
|
-
await context.runCommand("node", [
|
|
98383
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
98384
|
+
await context.runCommand("node", [join63("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
98385
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
98386
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
98387
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
98388
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
98389
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
|
|
98186
98390
|
}
|
|
98187
98391
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
98188
98392
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -98191,14 +98395,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
98191
98395
|
}
|
|
98192
98396
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
98193
98397
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
98194
|
-
if (!await fileExists2(
|
|
98398
|
+
if (!await fileExists2(join63(pluginPath, artifact)))
|
|
98195
98399
|
return true;
|
|
98196
98400
|
}
|
|
98197
98401
|
return false;
|
|
98198
98402
|
}
|
|
98199
98403
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
98200
|
-
const runtimeEntry =
|
|
98201
|
-
const manifestPath =
|
|
98404
|
+
const runtimeEntry = join63(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
98405
|
+
const manifestPath = join63(dirname24(runtimeEntry), "manifest.json");
|
|
98202
98406
|
let runtimeStat;
|
|
98203
98407
|
try {
|
|
98204
98408
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -98213,7 +98417,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
98213
98417
|
}
|
|
98214
98418
|
let manifest;
|
|
98215
98419
|
try {
|
|
98216
|
-
manifest = JSON.parse(await
|
|
98420
|
+
manifest = JSON.parse(await readFile29(manifestPath, "utf8"));
|
|
98217
98421
|
} catch (error) {
|
|
98218
98422
|
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
|
|
98219
98423
|
}
|
|
@@ -98222,7 +98426,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
98222
98426
|
}
|
|
98223
98427
|
let actualSha256;
|
|
98224
98428
|
try {
|
|
98225
|
-
actualSha256 = createHash6("sha256").update(await
|
|
98429
|
+
actualSha256 = createHash6("sha256").update(await readFile29(runtimeEntry)).digest("hex");
|
|
98226
98430
|
} catch (error) {
|
|
98227
98431
|
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
|
|
98228
98432
|
}
|
|
@@ -98273,7 +98477,7 @@ async function runSenpiInstaller(options = {}) {
|
|
|
98273
98477
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
98274
98478
|
const launcherPath = installLocalLauncher({
|
|
98275
98479
|
pluginPath: context.pluginPath,
|
|
98276
|
-
senpiCliPath:
|
|
98480
|
+
senpiCliPath: join64(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
|
|
98277
98481
|
homeDir: context.homeDir
|
|
98278
98482
|
});
|
|
98279
98483
|
return {
|
|
@@ -98293,13 +98497,13 @@ function resolveInstallContext(options) {
|
|
|
98293
98497
|
const repoRoot = resolve20(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname25(fileURLToPath(import.meta.url))) : dirname25(resolve20(options.pluginPath))));
|
|
98294
98498
|
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
|
|
98295
98499
|
const agentDir = resolve20(options.agentDir ?? resolveAgentHome({ env, homeDir }));
|
|
98296
|
-
const pluginPath = resolve20(options.pluginPath ??
|
|
98500
|
+
const pluginPath = resolve20(options.pluginPath ?? join64(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
98297
98501
|
return {
|
|
98298
98502
|
env,
|
|
98299
98503
|
repoRoot,
|
|
98300
98504
|
agentDir,
|
|
98301
98505
|
homeDir,
|
|
98302
|
-
settingsPath:
|
|
98506
|
+
settingsPath: join64(agentDir, "settings.json"),
|
|
98303
98507
|
pluginPath,
|
|
98304
98508
|
platform: options.platform ?? process.platform,
|
|
98305
98509
|
allowBuild,
|
|
@@ -98316,7 +98520,7 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
98316
98520
|
function findRepoRoot2(importerDir) {
|
|
98317
98521
|
let current = importerDir;
|
|
98318
98522
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
98319
|
-
if (fileExistsSync(
|
|
98523
|
+
if (fileExistsSync(join64(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
98320
98524
|
return current;
|
|
98321
98525
|
current = resolve20(current, "..");
|
|
98322
98526
|
}
|
|
@@ -98331,7 +98535,7 @@ async function runNativeDevInstaller(options) {
|
|
|
98331
98535
|
}
|
|
98332
98536
|
// packages/omo-opencode/src/cli/install-native/legacy-omo-bin.ts
|
|
98333
98537
|
import { lstatSync as lstatSync4, readFileSync as readFileSync15, realpathSync as realpathSync8, statSync as statSync4 } from "fs";
|
|
98334
|
-
import { dirname as dirname26, isAbsolute as isAbsolute12, join as
|
|
98538
|
+
import { dirname as dirname26, isAbsolute as isAbsolute12, join as join65, posix as posix9, win32 as win325 } from "path";
|
|
98335
98539
|
var NATIVE_OMO_PACKAGE = "omo-ai";
|
|
98336
98540
|
var LEGACY_OMO_BIN_PACKAGES = ["oh-my-openagent", "oh-my-opencode", "lazycodex"];
|
|
98337
98541
|
var CODEX_LIGHT_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
@@ -98396,7 +98600,7 @@ function classify(owner) {
|
|
|
98396
98600
|
}
|
|
98397
98601
|
function omoShimPathsIn(directory, isWindows) {
|
|
98398
98602
|
const suffixes = isWindows ? WINDOWS_BIN_SUFFIXES : [""];
|
|
98399
|
-
return suffixes.map((suffix) =>
|
|
98603
|
+
return suffixes.map((suffix) => join65(directory, `${OMO_BIN_NAME}${suffix}`)).filter(pathExists);
|
|
98400
98604
|
}
|
|
98401
98605
|
function pathExists(path) {
|
|
98402
98606
|
try {
|
|
@@ -98431,7 +98635,7 @@ function shimEntryPaths(shim, shimDirectory) {
|
|
|
98431
98635
|
const quoted = match[0];
|
|
98432
98636
|
const relativeToShim = quoted.match(/^(?:%~?dp0%?|\$\{?basedir\}?)[\\/]?(.*)$/)?.[1];
|
|
98433
98637
|
if (relativeToShim !== undefined)
|
|
98434
|
-
paths.push(
|
|
98638
|
+
paths.push(join65(shimDirectory, relativeToShim.replace(/\\/g, "/")));
|
|
98435
98639
|
else if (isAbsolute12(quoted))
|
|
98436
98640
|
paths.push(quoted);
|
|
98437
98641
|
}
|
|
@@ -98452,7 +98656,7 @@ function bunxEntryPaths(binPath) {
|
|
|
98452
98656
|
const end = contents.indexOf('"\x00');
|
|
98453
98657
|
if (end <= 0)
|
|
98454
98658
|
return [];
|
|
98455
|
-
return [
|
|
98659
|
+
return [join65(dirname26(dirname26(binPath)), contents.slice(0, end).replace(/\\/g, "/"))];
|
|
98456
98660
|
}
|
|
98457
98661
|
function codexLightWrapperOwner(shim) {
|
|
98458
98662
|
if (!shim.includes(CODEX_LIGHT_WRAPPER_MARKER))
|
|
@@ -98466,7 +98670,7 @@ function isInsideNodeModules(path) {
|
|
|
98466
98670
|
function ownerOfFile(file) {
|
|
98467
98671
|
let directory = dirname26(file);
|
|
98468
98672
|
for (let depth = 0;depth < OWNER_WALK_UP_LIMIT; depth += 1) {
|
|
98469
|
-
const manifest = readWholeFile(
|
|
98673
|
+
const manifest = readWholeFile(join65(directory, "package.json"));
|
|
98470
98674
|
if (manifest !== null) {
|
|
98471
98675
|
const parsed = parseManifest(manifest);
|
|
98472
98676
|
if (parsed !== null)
|
|
@@ -98764,12 +98968,12 @@ init_provider_availability();
|
|
|
98764
98968
|
|
|
98765
98969
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
98766
98970
|
import { existsSync as existsSync33, mkdirSync as mkdirSync13, readFileSync as readFileSync17 } from "fs";
|
|
98767
|
-
import { join as
|
|
98971
|
+
import { join as join67 } from "path";
|
|
98768
98972
|
|
|
98769
98973
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
98770
98974
|
init_shared();
|
|
98771
98975
|
import { existsSync as existsSync32, readFileSync as readFileSync16 } from "fs";
|
|
98772
|
-
import { join as
|
|
98976
|
+
import { join as join66 } from "path";
|
|
98773
98977
|
var TUI_SUBPATH = "tui";
|
|
98774
98978
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
98775
98979
|
function tuiPluginSpecName(entry) {
|
|
@@ -98789,7 +98993,7 @@ function fileEntryPackageJsonPath(entry) {
|
|
|
98789
98993
|
let path = entry.slice("file:".length);
|
|
98790
98994
|
if (path.startsWith("//"))
|
|
98791
98995
|
path = path.slice(2);
|
|
98792
|
-
return
|
|
98996
|
+
return join66(path, "package.json");
|
|
98793
98997
|
}
|
|
98794
98998
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
98795
98999
|
if (!existsSync32(pkgJsonPath))
|
|
@@ -98828,7 +99032,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
98828
99032
|
const packageName = packageNameFromServerEntry(entry);
|
|
98829
99033
|
if (packageName === null)
|
|
98830
99034
|
return null;
|
|
98831
|
-
return packageJsonExportsTui(
|
|
99035
|
+
return packageJsonExportsTui(join66(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
98832
99036
|
}
|
|
98833
99037
|
function isOurFilePluginEntry(entry) {
|
|
98834
99038
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -98915,7 +99119,7 @@ function detectServerPluginRegistration() {
|
|
|
98915
99119
|
}
|
|
98916
99120
|
}
|
|
98917
99121
|
function detectTuiPluginRegistration() {
|
|
98918
|
-
const tuiJsonPath =
|
|
99122
|
+
const tuiJsonPath = join66(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
98919
99123
|
if (!existsSync32(tuiJsonPath)) {
|
|
98920
99124
|
return {
|
|
98921
99125
|
registered: false,
|
|
@@ -99091,10 +99295,10 @@ function readConfig(path) {
|
|
|
99091
99295
|
return null;
|
|
99092
99296
|
}
|
|
99093
99297
|
function readServerConfig(configDir) {
|
|
99094
|
-
const jsoncPath =
|
|
99298
|
+
const jsoncPath = join67(configDir, "opencode.jsonc");
|
|
99095
99299
|
if (existsSync33(jsoncPath))
|
|
99096
99300
|
return readConfig(jsoncPath);
|
|
99097
|
-
const jsonPath =
|
|
99301
|
+
const jsonPath = join67(configDir, "opencode.json");
|
|
99098
99302
|
if (existsSync33(jsonPath))
|
|
99099
99303
|
return readConfig(jsonPath);
|
|
99100
99304
|
return null;
|
|
@@ -99151,7 +99355,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
99151
99355
|
if (!desiredEntry) {
|
|
99152
99356
|
return { changed: false, reason: "no-server-entry" };
|
|
99153
99357
|
}
|
|
99154
|
-
const tuiJsonPath =
|
|
99358
|
+
const tuiJsonPath = join67(configDir, "tui.json");
|
|
99155
99359
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
99156
99360
|
if (malformed || pluginFieldInvalid(config)) {
|
|
99157
99361
|
return { changed: false, reason: "malformed" };
|
|
@@ -99172,10 +99376,10 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
99172
99376
|
init_shared();
|
|
99173
99377
|
init_config_context();
|
|
99174
99378
|
import { existsSync as existsSync34, readFileSync as readFileSync18 } from "fs";
|
|
99175
|
-
import { join as
|
|
99379
|
+
import { join as join68 } from "path";
|
|
99176
99380
|
function readPluginEntries(configDir) {
|
|
99177
99381
|
for (const name of ["opencode.jsonc", "opencode.json"]) {
|
|
99178
|
-
const configPath =
|
|
99382
|
+
const configPath = join68(configDir, name);
|
|
99179
99383
|
if (!existsSync34(configPath))
|
|
99180
99384
|
continue;
|
|
99181
99385
|
try {
|
|
@@ -99223,7 +99427,7 @@ function refreshOpenCodePluginSandboxes(options = {}) {
|
|
|
99223
99427
|
|
|
99224
99428
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
99225
99429
|
import { homedir as homedir13 } from "os";
|
|
99226
|
-
import { join as
|
|
99430
|
+
import { join as join69 } from "path";
|
|
99227
99431
|
|
|
99228
99432
|
// packages/shared-skills/index.mjs
|
|
99229
99433
|
import { existsSync as existsSync35 } from "fs";
|
|
@@ -99245,9 +99449,9 @@ function describeResult2(result) {
|
|
|
99245
99449
|
}
|
|
99246
99450
|
async function installAstGrepForOpenCode(options = {}) {
|
|
99247
99451
|
const platform = options.platform ?? process.platform;
|
|
99248
|
-
const baseDir =
|
|
99452
|
+
const baseDir = join69(options.homeDir ?? homedir13(), ".omo");
|
|
99249
99453
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
99250
|
-
const skillDir =
|
|
99454
|
+
const skillDir = join69(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
99251
99455
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
99252
99456
|
try {
|
|
99253
99457
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -103610,9 +103814,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
103610
103814
|
}
|
|
103611
103815
|
// packages/boulder-state/src/storage/path.ts
|
|
103612
103816
|
import { existsSync as existsSync37 } from "fs";
|
|
103613
|
-
import { isAbsolute as isAbsolute13, join as
|
|
103817
|
+
import { isAbsolute as isAbsolute13, join as join70, relative as relative8, resolve as resolve21 } from "path";
|
|
103614
103818
|
function getBoulderFilePath(directory) {
|
|
103615
|
-
return
|
|
103819
|
+
return join70(directory, BOULDER_DIR, BOULDER_FILE);
|
|
103616
103820
|
}
|
|
103617
103821
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
103618
103822
|
return isAbsolute13(trackedPath) ? resolve21(trackedPath) : resolve21(baseDirectory, trackedPath);
|
|
@@ -103797,9 +104001,9 @@ init_state();
|
|
|
103797
104001
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
103798
104002
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
103799
104003
|
import { existsSync as existsSync40, mkdirSync as mkdirSync14, readFileSync as readFileSync22, rmSync as rmSync6, writeFileSync as writeFileSync8 } from "fs";
|
|
103800
|
-
import { join as
|
|
104004
|
+
import { join as join71 } from "path";
|
|
103801
104005
|
function getMarkerPath(directory, sessionID) {
|
|
103802
|
-
return
|
|
104006
|
+
return join71(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
103803
104007
|
}
|
|
103804
104008
|
function readContinuationMarker(directory, sessionID) {
|
|
103805
104009
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -103872,7 +104076,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
103872
104076
|
init_shared();
|
|
103873
104077
|
init_compaction_marker();
|
|
103874
104078
|
import { readFileSync as readFileSync23, readdirSync as readdirSync10 } from "fs";
|
|
103875
|
-
import { join as
|
|
104079
|
+
import { join as join72 } from "path";
|
|
103876
104080
|
var defaultSessionLastAgentDeps = {
|
|
103877
104081
|
getMessageDir,
|
|
103878
104082
|
isSqliteBackend,
|
|
@@ -103932,7 +104136,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
103932
104136
|
try {
|
|
103933
104137
|
const messages = readdirSync10(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
103934
104138
|
try {
|
|
103935
|
-
const content = readFileSync23(
|
|
104139
|
+
const content = readFileSync23(join72(messageDir, fileName), "utf-8");
|
|
103936
104140
|
const parsed = JSON.parse(content);
|
|
103937
104141
|
return {
|
|
103938
104142
|
fileName,
|
|
@@ -103976,7 +104180,7 @@ init_agent_display_names();
|
|
|
103976
104180
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
103977
104181
|
init_frontmatter2();
|
|
103978
104182
|
import { existsSync as existsSync41, readFileSync as readFileSync24, writeFileSync as writeFileSync9, unlinkSync as unlinkSync6, mkdirSync as mkdirSync15 } from "fs";
|
|
103979
|
-
import { dirname as dirname28, join as
|
|
104183
|
+
import { dirname as dirname28, join as join73 } from "path";
|
|
103980
104184
|
|
|
103981
104185
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
103982
104186
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -103985,7 +104189,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
103985
104189
|
|
|
103986
104190
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
103987
104191
|
function getStateFilePath(directory, customPath) {
|
|
103988
|
-
return customPath ?
|
|
104192
|
+
return customPath ? join73(directory, customPath) : join73(directory, DEFAULT_STATE_FILE);
|
|
103989
104193
|
}
|
|
103990
104194
|
function readState(directory, customPath) {
|
|
103991
104195
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -105092,7 +105296,7 @@ init_extract_semver();
|
|
|
105092
105296
|
init_bun_which_shim();
|
|
105093
105297
|
import { existsSync as existsSync49, accessSync as accessSync4, constants as constants12 } from "fs";
|
|
105094
105298
|
import { homedir as homedir16 } from "os";
|
|
105095
|
-
import { join as
|
|
105299
|
+
import { join as join80 } from "path";
|
|
105096
105300
|
|
|
105097
105301
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
105098
105302
|
init_spawn_with_windows_hide();
|
|
@@ -105184,17 +105388,17 @@ function getDesktopAppPaths(platform) {
|
|
|
105184
105388
|
case "darwin":
|
|
105185
105389
|
return [
|
|
105186
105390
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
105187
|
-
|
|
105391
|
+
join80(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
105188
105392
|
];
|
|
105189
105393
|
case "win32": {
|
|
105190
105394
|
const programFiles = process.env.ProgramFiles;
|
|
105191
105395
|
const localAppData = process.env.LOCALAPPDATA;
|
|
105192
105396
|
const paths = [];
|
|
105193
105397
|
if (programFiles) {
|
|
105194
|
-
paths.push(
|
|
105398
|
+
paths.push(join80(programFiles, "OpenCode", "OpenCode.exe"));
|
|
105195
105399
|
}
|
|
105196
105400
|
if (localAppData) {
|
|
105197
|
-
paths.push(
|
|
105401
|
+
paths.push(join80(localAppData, "OpenCode", "OpenCode.exe"));
|
|
105198
105402
|
}
|
|
105199
105403
|
return paths;
|
|
105200
105404
|
}
|
|
@@ -105202,8 +105406,8 @@ function getDesktopAppPaths(platform) {
|
|
|
105202
105406
|
return [
|
|
105203
105407
|
"/usr/bin/opencode",
|
|
105204
105408
|
"/usr/lib/opencode/opencode",
|
|
105205
|
-
|
|
105206
|
-
|
|
105409
|
+
join80(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
105410
|
+
join80(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
105207
105411
|
];
|
|
105208
105412
|
default:
|
|
105209
105413
|
return [];
|
|
@@ -105235,7 +105439,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
105235
105439
|
const candidates = getCommandCandidates2(platform);
|
|
105236
105440
|
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
|
|
105237
105441
|
for (const command of candidates) {
|
|
105238
|
-
const fullPath =
|
|
105442
|
+
const fullPath = join80(entry, command);
|
|
105239
105443
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
105240
105444
|
return { binary: command, path: fullPath };
|
|
105241
105445
|
}
|
|
@@ -105379,22 +105583,22 @@ init_package_json_locator();
|
|
|
105379
105583
|
import { existsSync as existsSync51, readFileSync as readFileSync33, readdirSync as readdirSync12 } from "fs";
|
|
105380
105584
|
import { createRequire } from "module";
|
|
105381
105585
|
import { homedir as homedir17 } from "os";
|
|
105382
|
-
import { join as
|
|
105586
|
+
import { join as join81 } from "path";
|
|
105383
105587
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
105384
105588
|
init_shared();
|
|
105385
105589
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
105386
105590
|
if (platform === "darwin")
|
|
105387
|
-
return
|
|
105591
|
+
return join81(homedir17(), "Library", "Caches");
|
|
105388
105592
|
if (platform === "win32")
|
|
105389
|
-
return process.env.LOCALAPPDATA ??
|
|
105390
|
-
return
|
|
105593
|
+
return process.env.LOCALAPPDATA ?? join81(homedir17(), "AppData", "Local");
|
|
105594
|
+
return join81(homedir17(), ".cache");
|
|
105391
105595
|
}
|
|
105392
105596
|
function resolveOpenCodeCacheDir() {
|
|
105393
105597
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
105394
105598
|
if (xdgCacheHome)
|
|
105395
|
-
return
|
|
105599
|
+
return join81(xdgCacheHome, "opencode");
|
|
105396
105600
|
const fromShared = getOpenCodeCacheDir();
|
|
105397
|
-
const platformDefault =
|
|
105601
|
+
const platformDefault = join81(getPlatformDefaultCacheDir(), "opencode");
|
|
105398
105602
|
if (existsSync51(fromShared) || !existsSync51(platformDefault))
|
|
105399
105603
|
return fromShared;
|
|
105400
105604
|
return platformDefault;
|
|
@@ -105426,11 +105630,11 @@ function normalizeVersion(value) {
|
|
|
105426
105630
|
function createPackageCandidates(rootDir) {
|
|
105427
105631
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
105428
105632
|
packageName,
|
|
105429
|
-
installedPackagePath:
|
|
105633
|
+
installedPackagePath: join81(rootDir, "node_modules", packageName, "package.json")
|
|
105430
105634
|
}));
|
|
105431
105635
|
}
|
|
105432
105636
|
function createTaggedInstallCandidates(rootDir) {
|
|
105433
|
-
const packagesDir =
|
|
105637
|
+
const packagesDir = join81(rootDir, "packages");
|
|
105434
105638
|
if (!existsSync51(packagesDir))
|
|
105435
105639
|
return [];
|
|
105436
105640
|
const candidates = [];
|
|
@@ -105438,14 +105642,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
105438
105642
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
105439
105643
|
if (packageName === undefined)
|
|
105440
105644
|
continue;
|
|
105441
|
-
const installDir =
|
|
105645
|
+
const installDir = join81(packagesDir, entryName);
|
|
105442
105646
|
candidates.push({
|
|
105443
105647
|
cacheDir: installDir,
|
|
105444
|
-
cachePackagePath:
|
|
105648
|
+
cachePackagePath: join81(installDir, "package.json"),
|
|
105445
105649
|
packageCandidates: [
|
|
105446
105650
|
{
|
|
105447
105651
|
packageName,
|
|
105448
|
-
installedPackagePath:
|
|
105652
|
+
installedPackagePath: join81(installDir, "node_modules", packageName, "package.json")
|
|
105449
105653
|
}
|
|
105450
105654
|
]
|
|
105451
105655
|
});
|
|
@@ -105490,13 +105694,13 @@ function getLoadedPluginVersion() {
|
|
|
105490
105694
|
const candidates = [
|
|
105491
105695
|
{
|
|
105492
105696
|
cacheDir: configDir,
|
|
105493
|
-
cachePackagePath:
|
|
105697
|
+
cachePackagePath: join81(configDir, "package.json"),
|
|
105494
105698
|
packageCandidates: createPackageCandidates(configDir)
|
|
105495
105699
|
},
|
|
105496
105700
|
...createTaggedInstallCandidates(configDir),
|
|
105497
105701
|
{
|
|
105498
105702
|
cacheDir,
|
|
105499
|
-
cachePackagePath:
|
|
105703
|
+
cachePackagePath: join81(cacheDir, "package.json"),
|
|
105500
105704
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
105501
105705
|
},
|
|
105502
105706
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -105689,18 +105893,18 @@ async function checkSystem(deps = defaultDeps5) {
|
|
|
105689
105893
|
init_shared();
|
|
105690
105894
|
import { existsSync as existsSync53, readFileSync as readFileSync35 } from "fs";
|
|
105691
105895
|
import { homedir as homedir18 } from "os";
|
|
105692
|
-
import { join as
|
|
105896
|
+
import { join as join82 } from "path";
|
|
105693
105897
|
function getUserConfigDir2() {
|
|
105694
105898
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
105695
105899
|
if (xdgConfig)
|
|
105696
|
-
return
|
|
105697
|
-
return
|
|
105900
|
+
return join82(xdgConfig, "opencode");
|
|
105901
|
+
return join82(homedir18(), ".config", "opencode");
|
|
105698
105902
|
}
|
|
105699
105903
|
function loadCustomProviderNames() {
|
|
105700
105904
|
const configDir = getUserConfigDir2();
|
|
105701
105905
|
const candidatePaths = [
|
|
105702
|
-
|
|
105703
|
-
|
|
105906
|
+
join82(configDir, "opencode.json"),
|
|
105907
|
+
join82(configDir, "opencode.jsonc")
|
|
105704
105908
|
];
|
|
105705
105909
|
for (const configPath of candidatePaths) {
|
|
105706
105910
|
if (!existsSync53(configPath))
|
|
@@ -105721,7 +105925,7 @@ function loadCustomProviderNames() {
|
|
|
105721
105925
|
return [];
|
|
105722
105926
|
}
|
|
105723
105927
|
function loadAvailableModelsFromCache() {
|
|
105724
|
-
const cacheFile =
|
|
105928
|
+
const cacheFile = join82(getOpenCodeCacheDir(), "models.json");
|
|
105725
105929
|
const customProviders = loadCustomProviderNames();
|
|
105726
105930
|
if (!existsSync53(cacheFile)) {
|
|
105727
105931
|
if (customProviders.length > 0) {
|
|
@@ -105783,7 +105987,7 @@ function loadOmoConfig2() {
|
|
|
105783
105987
|
|
|
105784
105988
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
105785
105989
|
init_shared();
|
|
105786
|
-
import { join as
|
|
105990
|
+
import { join as join83 } from "path";
|
|
105787
105991
|
|
|
105788
105992
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
105789
105993
|
function formatModelWithVariant(model, variant) {
|
|
@@ -105825,7 +106029,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
105825
106029
|
}
|
|
105826
106030
|
function buildModelResolutionDetails(options) {
|
|
105827
106031
|
const details = [];
|
|
105828
|
-
const cacheFile =
|
|
106032
|
+
const cacheFile = join83(getOpenCodeCacheDir(), "models.json");
|
|
105829
106033
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
105830
106034
|
details.push("");
|
|
105831
106035
|
if (options.available.cacheExists) {
|
|
@@ -106166,7 +106370,7 @@ init_src4();
|
|
|
106166
106370
|
init_main();
|
|
106167
106371
|
init_config_migration();
|
|
106168
106372
|
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "fs";
|
|
106169
|
-
import { join as
|
|
106373
|
+
import { join as join84 } from "path";
|
|
106170
106374
|
var CANONICAL_REPLACEMENT = new Map([
|
|
106171
106375
|
["variant", "reasoning"],
|
|
106172
106376
|
["reasoningEffort", "reasoning"],
|
|
@@ -106227,7 +106431,7 @@ function userConfigPaths() {
|
|
|
106227
106431
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
106228
106432
|
if (home === undefined || home.length === 0)
|
|
106229
106433
|
return [];
|
|
106230
|
-
return [
|
|
106434
|
+
return [join84(home, ".omo", "omo.jsonc"), join84(home, ".omo", "omo.json")];
|
|
106231
106435
|
}
|
|
106232
106436
|
async function checkDeprecatedReasoningKeys() {
|
|
106233
106437
|
const issues = [];
|
|
@@ -106253,13 +106457,13 @@ init_src();
|
|
|
106253
106457
|
import { existsSync as existsSync55 } from "fs";
|
|
106254
106458
|
import { createRequire as createRequire2 } from "module";
|
|
106255
106459
|
import { homedir as homedir20 } from "os";
|
|
106256
|
-
import { dirname as dirname33, join as
|
|
106460
|
+
import { dirname as dirname33, join as join88 } from "path";
|
|
106257
106461
|
|
|
106258
106462
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
106259
|
-
import { join as
|
|
106463
|
+
import { join as join87 } from "path";
|
|
106260
106464
|
import { homedir as homedir19, tmpdir as tmpdir4 } from "os";
|
|
106261
106465
|
// packages/comment-checker-core/src/release.ts
|
|
106262
|
-
import { join as
|
|
106466
|
+
import { join as join85 } from "path";
|
|
106263
106467
|
var COMMENT_CHECKER_RELEASE_VERSION = "0.8.0";
|
|
106264
106468
|
function commentCheckerBinaryName(platform) {
|
|
106265
106469
|
return platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -106267,19 +106471,19 @@ function commentCheckerBinaryName(platform) {
|
|
|
106267
106471
|
function commentCheckerCacheDir(input) {
|
|
106268
106472
|
if (input.platform === "win32") {
|
|
106269
106473
|
const localAppData = input.env.LOCALAPPDATA || input.env.APPDATA;
|
|
106270
|
-
const base = localAppData ||
|
|
106271
|
-
return
|
|
106474
|
+
const base = localAppData || join85(input.homedir, "AppData", "Local");
|
|
106475
|
+
return join85(base, input.cacheDirName, "bin");
|
|
106272
106476
|
}
|
|
106273
|
-
const base = input.env.XDG_CACHE_HOME ||
|
|
106274
|
-
return
|
|
106477
|
+
const base = input.env.XDG_CACHE_HOME || join85(input.homedir, ".cache");
|
|
106478
|
+
return join85(base, input.cacheDirName, "bin");
|
|
106275
106479
|
}
|
|
106276
106480
|
// packages/comment-checker-core/src/cached-release.ts
|
|
106277
106481
|
import { readFileSync as readFileSync37, writeFileSync as writeFileSync12 } from "fs";
|
|
106278
|
-
import { join as
|
|
106482
|
+
import { join as join86 } from "path";
|
|
106279
106483
|
var COMMENT_CHECKER_VERSION_MARKER = "comment-checker.version";
|
|
106280
106484
|
function isCachedCommentCheckerCurrent(cacheDir, readFile = (path) => readFileSync37(path, "utf-8")) {
|
|
106281
106485
|
try {
|
|
106282
|
-
return readFile(
|
|
106486
|
+
return readFile(join86(cacheDir, COMMENT_CHECKER_VERSION_MARKER)).trim() === COMMENT_CHECKER_RELEASE_VERSION;
|
|
106283
106487
|
} catch {
|
|
106284
106488
|
return false;
|
|
106285
106489
|
}
|
|
@@ -106289,7 +106493,7 @@ init_binary_downloader();
|
|
|
106289
106493
|
init_logger2();
|
|
106290
106494
|
init_plugin_identity();
|
|
106291
106495
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
106292
|
-
var DEBUG_FILE =
|
|
106496
|
+
var DEBUG_FILE = join87(tmpdir4(), "comment-checker-debug.log");
|
|
106293
106497
|
function getCacheDir2() {
|
|
106294
106498
|
return commentCheckerCacheDir({
|
|
106295
106499
|
platform: process.platform,
|
|
@@ -106348,7 +106552,7 @@ async function getBinaryVersion(binary) {
|
|
|
106348
106552
|
}
|
|
106349
106553
|
}
|
|
106350
106554
|
async function checkAstGrepCli() {
|
|
106351
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
106555
|
+
const runtimeDir = astGrepRuntimeDir(join88(homedir20(), ".omo"));
|
|
106352
106556
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
106353
106557
|
if (sgPath === null) {
|
|
106354
106558
|
return {
|
|
@@ -106378,10 +106582,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
106378
106582
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
106379
106583
|
try {
|
|
106380
106584
|
const packageDir = baseDirOverride ?? dirname33(resolvePackageJsonPath());
|
|
106381
|
-
const vendorPath =
|
|
106585
|
+
const vendorPath = join88(packageDir, "vendor", platformKey, binaryName);
|
|
106382
106586
|
if (existsSync55(vendorPath))
|
|
106383
106587
|
return vendorPath;
|
|
106384
|
-
const binPath =
|
|
106588
|
+
const binPath = join88(packageDir, "bin", binaryName);
|
|
106385
106589
|
if (existsSync55(binPath))
|
|
106386
106590
|
return binPath;
|
|
106387
106591
|
} catch (error) {
|
|
@@ -106757,13 +106961,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
106757
106961
|
init_shared();
|
|
106758
106962
|
import { existsSync as existsSync57, readFileSync as readFileSync39 } from "fs";
|
|
106759
106963
|
import { homedir as homedir21 } from "os";
|
|
106760
|
-
import { join as
|
|
106964
|
+
import { join as join89 } from "path";
|
|
106761
106965
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
106762
106966
|
function getMcpConfigPaths() {
|
|
106763
106967
|
return [
|
|
106764
|
-
|
|
106765
|
-
|
|
106766
|
-
|
|
106968
|
+
join89(homedir21(), ".claude", ".mcp.json"),
|
|
106969
|
+
join89(process.cwd(), ".mcp.json"),
|
|
106970
|
+
join89(process.cwd(), ".claude", ".mcp.json")
|
|
106767
106971
|
];
|
|
106768
106972
|
}
|
|
106769
106973
|
function loadUserMcpConfig() {
|
|
@@ -107043,9 +107247,9 @@ async function pathExists2(dir) {
|
|
|
107043
107247
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
107044
107248
|
init_src();
|
|
107045
107249
|
import { existsSync as existsSync59 } from "fs";
|
|
107046
|
-
import { lstat as lstat16, readdir as readdir14, readFile as
|
|
107250
|
+
import { lstat as lstat16, readdir as readdir14, readFile as readFile30 } from "fs/promises";
|
|
107047
107251
|
import { homedir as homedir23 } from "os";
|
|
107048
|
-
import { basename as basename12, join as
|
|
107252
|
+
import { basename as basename12, join as join90, resolve as resolve24 } from "path";
|
|
107049
107253
|
// packages/omo-opencode/package.json
|
|
107050
107254
|
var package_default3 = {
|
|
107051
107255
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -107093,7 +107297,6 @@ var package_default3 = {
|
|
|
107093
107297
|
commander: "^15.0.0",
|
|
107094
107298
|
"jsonc-parser": "^3.3.1",
|
|
107095
107299
|
picocolors: "^1.1.1",
|
|
107096
|
-
picomatch: "^4.0.7",
|
|
107097
107300
|
zod: "^4.6.5"
|
|
107098
107301
|
}
|
|
107099
107302
|
};
|
|
@@ -107115,13 +107318,13 @@ var CODEX_BIN_NAMES = [
|
|
|
107115
107318
|
"omo-git-bash-hook"
|
|
107116
107319
|
];
|
|
107117
107320
|
async function gatherCodexSummary(deps = {}) {
|
|
107118
|
-
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
107321
|
+
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ?? join90(homedir23(), ".codex"));
|
|
107119
107322
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
107120
107323
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
107121
107324
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
107122
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
107123
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
107124
|
-
const configPath =
|
|
107325
|
+
const manifest = pluginRoot === null ? null : await readJson(join90(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
107326
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join90(pluginRoot, "lazycodex-install.json"));
|
|
107327
|
+
const configPath = join90(codexHome, "config.toml");
|
|
107125
107328
|
const pluginVersion = stringField(manifest, "version");
|
|
107126
107329
|
return {
|
|
107127
107330
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -107178,7 +107381,7 @@ function buildCodexIssues(summary) {
|
|
|
107178
107381
|
if (summary.pluginRoot === null) {
|
|
107179
107382
|
issues.push({
|
|
107180
107383
|
title: "OMO Codex plugin is not installed",
|
|
107181
|
-
description: `Expected cached plugin at ${
|
|
107384
|
+
description: `Expected cached plugin at ${join90("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
107182
107385
|
fix: "Run: npx lazycodex-ai install",
|
|
107183
107386
|
severity: "error",
|
|
107184
107387
|
affects: ["plugin loading"]
|
|
@@ -107243,12 +107446,12 @@ function buildCodexIssues(summary) {
|
|
|
107243
107446
|
return issues;
|
|
107244
107447
|
}
|
|
107245
107448
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
107246
|
-
const pluginRoot =
|
|
107449
|
+
const pluginRoot = join90(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
107247
107450
|
if (!existsSync59(pluginRoot))
|
|
107248
107451
|
return null;
|
|
107249
107452
|
const versions = await readdir14(pluginRoot, { withFileTypes: true });
|
|
107250
107453
|
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
107251
|
-
return candidates.length === 0 ? null :
|
|
107454
|
+
return candidates.length === 0 ? null : join90(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
107252
107455
|
}
|
|
107253
107456
|
async function readCodexConfigSummary(configPath) {
|
|
107254
107457
|
if (!existsSync59(configPath)) {
|
|
@@ -107262,7 +107465,7 @@ async function readCodexConfigSummary(configPath) {
|
|
|
107262
107465
|
companionLifecycleHookStateEvents: []
|
|
107263
107466
|
};
|
|
107264
107467
|
}
|
|
107265
|
-
const content = await
|
|
107468
|
+
const content = await readFile30(configPath, "utf8");
|
|
107266
107469
|
return {
|
|
107267
107470
|
exists: true,
|
|
107268
107471
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -107276,13 +107479,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
107276
107479
|
async function readLinkedBins(binDir) {
|
|
107277
107480
|
const linked = [];
|
|
107278
107481
|
for (const name of CODEX_BIN_NAMES) {
|
|
107279
|
-
if (await pathExists3(
|
|
107482
|
+
if (await pathExists3(join90(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
107280
107483
|
linked.push(name);
|
|
107281
107484
|
}
|
|
107282
107485
|
return linked;
|
|
107283
107486
|
}
|
|
107284
107487
|
async function readLinkedAgents(codexHome) {
|
|
107285
|
-
const agentsDir =
|
|
107488
|
+
const agentsDir = join90(codexHome, "agents");
|
|
107286
107489
|
if (!existsSync59(agentsDir))
|
|
107287
107490
|
return [];
|
|
107288
107491
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
@@ -107290,7 +107493,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
107290
107493
|
}
|
|
107291
107494
|
async function readJson(path) {
|
|
107292
107495
|
try {
|
|
107293
|
-
const parsed = JSON.parse(await
|
|
107496
|
+
const parsed = JSON.parse(await readFile30(path, "utf8"));
|
|
107294
107497
|
return isPlainRecord(parsed) ? parsed : null;
|
|
107295
107498
|
} catch (error) {
|
|
107296
107499
|
if (error instanceof Error)
|
|
@@ -107414,9 +107617,9 @@ function resolveLatestVersion(input) {
|
|
|
107414
107617
|
|
|
107415
107618
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
107416
107619
|
init_src();
|
|
107417
|
-
import { readdir as readdir15, readFile as
|
|
107620
|
+
import { readdir as readdir15, readFile as readFile31, stat as stat7 } from "fs/promises";
|
|
107418
107621
|
import { homedir as homedir24 } from "os";
|
|
107419
|
-
import { dirname as dirname35, isAbsolute as isAbsolute14, join as
|
|
107622
|
+
import { dirname as dirname35, isAbsolute as isAbsolute14, join as join91, relative as relative9, resolve as resolve25, sep as sep9 } from "path";
|
|
107420
107623
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
107421
107624
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
107422
107625
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -107426,7 +107629,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
107426
107629
|
const env = deps.env ?? process.env;
|
|
107427
107630
|
const platform = deps.platform ?? process.platform;
|
|
107428
107631
|
const arch = deps.arch ?? process.arch;
|
|
107429
|
-
const codexHome = resolve25(deps.codexHome ?? env["CODEX_HOME"] ??
|
|
107632
|
+
const codexHome = resolve25(deps.codexHome ?? env["CODEX_HOME"] ?? join91(homedir24(), ".codex"));
|
|
107430
107633
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
107431
107634
|
if (summary.pluginRoot === null) {
|
|
107432
107635
|
return {
|
|
@@ -107451,7 +107654,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
107451
107654
|
});
|
|
107452
107655
|
}
|
|
107453
107656
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
107454
|
-
const runtimeSgPath =
|
|
107657
|
+
const runtimeSgPath = join91(runtimeSgDir, sgBinaryName(platform));
|
|
107455
107658
|
const sg = findSgBinarySync({
|
|
107456
107659
|
arch,
|
|
107457
107660
|
env,
|
|
@@ -107563,7 +107766,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
107563
107766
|
for (const entry of entries) {
|
|
107564
107767
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
107565
107768
|
continue;
|
|
107566
|
-
const entryPath =
|
|
107769
|
+
const entryPath = join91(root, entry.name);
|
|
107567
107770
|
if (entry.isDirectory()) {
|
|
107568
107771
|
paths.push(...await findManifestPaths(entryPath, manifestName));
|
|
107569
107772
|
continue;
|
|
@@ -107607,18 +107810,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
107607
107810
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute14(arg));
|
|
107608
107811
|
}
|
|
107609
107812
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
107610
|
-
return
|
|
107813
|
+
return join91(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
107611
107814
|
}
|
|
107612
107815
|
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
|
|
107613
107816
|
const override = env[SG_PATH_ENV_KEY]?.trim();
|
|
107614
107817
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
107615
107818
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
107616
|
-
if (sgPath ===
|
|
107819
|
+
if (sgPath === join91(runtimeSgDir, sgBinaryName(platform)))
|
|
107617
107820
|
return "runtime dir";
|
|
107618
107821
|
return "PATH";
|
|
107619
107822
|
}
|
|
107620
107823
|
async function readBootstrapStateSummary(codexHome) {
|
|
107621
|
-
const statePath =
|
|
107824
|
+
const statePath = join91(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
107622
107825
|
const raw = await readJson2(statePath);
|
|
107623
107826
|
if (raw === null)
|
|
107624
107827
|
return null;
|
|
@@ -107667,7 +107870,7 @@ function degradedDetailLines(entries) {
|
|
|
107667
107870
|
}
|
|
107668
107871
|
async function readJson2(path) {
|
|
107669
107872
|
try {
|
|
107670
|
-
const parsed = JSON.parse(await
|
|
107873
|
+
const parsed = JSON.parse(await readFile31(path, "utf8"));
|
|
107671
107874
|
return isRecord18(parsed) ? parsed : null;
|
|
107672
107875
|
} catch (error) {
|
|
107673
107876
|
if (error instanceof Error)
|
|
@@ -107695,18 +107898,18 @@ function isRecord18(value) {
|
|
|
107695
107898
|
|
|
107696
107899
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
107697
107900
|
import { existsSync as existsSync60 } from "fs";
|
|
107698
|
-
import { readFile as
|
|
107901
|
+
import { readFile as readFile32 } from "fs/promises";
|
|
107699
107902
|
import { homedir as homedir25 } from "os";
|
|
107700
|
-
import { join as
|
|
107903
|
+
import { join as join92, resolve as resolve26 } from "path";
|
|
107701
107904
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
107702
107905
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
107703
107906
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
107704
107907
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
107705
|
-
const codexHome = resolve26(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
107908
|
+
const codexHome = resolve26(deps.codexHome ?? process.env.CODEX_HOME ?? join92(homedir25(), ".codex"));
|
|
107706
107909
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
107707
107910
|
const platform = deps.platform ?? process.platform;
|
|
107708
|
-
const wrapperPath =
|
|
107709
|
-
const legacyWrapperPath =
|
|
107911
|
+
const wrapperPath = join92(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
107912
|
+
const legacyWrapperPath = join92(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
107710
107913
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
107711
107914
|
const issues = [];
|
|
107712
107915
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -107740,7 +107943,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
107740
107943
|
}
|
|
107741
107944
|
async function readRuntimeWrapper(path) {
|
|
107742
107945
|
try {
|
|
107743
|
-
return await
|
|
107946
|
+
return await readFile32(path, "utf8");
|
|
107744
107947
|
} catch (error) {
|
|
107745
107948
|
if (error instanceof Error)
|
|
107746
107949
|
return null;
|
|
@@ -108242,12 +108445,12 @@ import {
|
|
|
108242
108445
|
unlinkSync as unlinkSync9,
|
|
108243
108446
|
writeFileSync as writeFileSync14
|
|
108244
108447
|
} from "fs";
|
|
108245
|
-
import { basename as basename13, dirname as dirname36, join as
|
|
108448
|
+
import { basename as basename13, dirname as dirname36, join as join95 } from "path";
|
|
108246
108449
|
|
|
108247
108450
|
// packages/mcp-client-core/src/config-dir.ts
|
|
108248
108451
|
import { existsSync as existsSync61, realpathSync as realpathSync10 } from "fs";
|
|
108249
108452
|
import { homedir as homedir26 } from "os";
|
|
108250
|
-
import { join as
|
|
108453
|
+
import { join as join93, resolve as resolve27 } from "path";
|
|
108251
108454
|
function resolveConfigPath2(pathValue) {
|
|
108252
108455
|
const resolvedPath = resolve27(pathValue);
|
|
108253
108456
|
if (!existsSync61(resolvedPath))
|
|
@@ -108265,13 +108468,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
108265
108468
|
if (customConfigDir) {
|
|
108266
108469
|
return resolveConfigPath2(customConfigDir);
|
|
108267
108470
|
}
|
|
108268
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
108269
|
-
return resolveConfigPath2(
|
|
108471
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join93(homedir26(), ".config");
|
|
108472
|
+
return resolveConfigPath2(join93(xdgConfigDir, "opencode"));
|
|
108270
108473
|
}
|
|
108271
108474
|
|
|
108272
108475
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
108273
108476
|
import { chmodSync as chmodSync4, existsSync as existsSync62, readFileSync as readFileSync41, renameSync as renameSync7, writeFileSync as writeFileSync13 } from "fs";
|
|
108274
|
-
import { join as
|
|
108477
|
+
import { join as join94 } from "path";
|
|
108275
108478
|
var INDEX_FILE_NAME = "index.json";
|
|
108276
108479
|
function isTokenIndex(value) {
|
|
108277
108480
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -108279,7 +108482,7 @@ function isTokenIndex(value) {
|
|
|
108279
108482
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
108280
108483
|
}
|
|
108281
108484
|
function getIndexPath(storageDir) {
|
|
108282
|
-
return
|
|
108485
|
+
return join94(storageDir, INDEX_FILE_NAME);
|
|
108283
108486
|
}
|
|
108284
108487
|
function readTokenIndex(storageDir) {
|
|
108285
108488
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -108323,16 +108526,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
|
|
|
108323
108526
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
108324
108527
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
108325
108528
|
function getMcpOauthStorageDir() {
|
|
108326
|
-
return
|
|
108529
|
+
return join95(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
108327
108530
|
}
|
|
108328
108531
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
108329
108532
|
return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
108330
108533
|
}
|
|
108331
108534
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
108332
|
-
return
|
|
108535
|
+
return join95(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
108333
108536
|
}
|
|
108334
108537
|
function getLegacyStoragePath() {
|
|
108335
|
-
return
|
|
108538
|
+
return join95(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
108336
108539
|
}
|
|
108337
108540
|
function normalizeHost2(serverHost) {
|
|
108338
108541
|
let host = serverHost.trim();
|
|
@@ -108511,7 +108714,7 @@ function listTokensByHost(serverHost) {
|
|
|
108511
108714
|
for (const [hash, indexedKey] of Object.entries(index)) {
|
|
108512
108715
|
if (!indexedKey.startsWith(prefix))
|
|
108513
108716
|
continue;
|
|
108514
|
-
const indexedToken = readTokenFile(
|
|
108717
|
+
const indexedToken = readTokenFile(join95(getMcpOauthStorageDir(), `${hash}.json`));
|
|
108515
108718
|
if (indexedToken)
|
|
108516
108719
|
result[indexedKey] = indexedToken;
|
|
108517
108720
|
}
|
|
@@ -108526,7 +108729,7 @@ function listAllTokens() {
|
|
|
108526
108729
|
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
108527
108730
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
108528
108731
|
continue;
|
|
108529
|
-
const token = readTokenFile(
|
|
108732
|
+
const token = readTokenFile(join95(dir, entry.name));
|
|
108530
108733
|
const hash = basename13(entry.name, ".json");
|
|
108531
108734
|
if (token)
|
|
108532
108735
|
result[index[hash] ?? hash] = token;
|