oh-my-opencode 4.16.2 → 4.16.3
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/.agents/skills/pre-publish-review/SKILL.md +3 -0
- package/README.md +2 -2
- package/dist/agents/hephaestus/agent.d.ts +1 -1
- package/dist/agents/hephaestus/gpt-5-6.d.ts +2 -0
- package/dist/agents/momus-gpt-5-6.d.ts +1 -0
- package/dist/agents/types.d.ts +2 -0
- package/dist/cli/index.js +800 -536
- package/dist/cli-node/index.js +800 -536
- package/dist/features/background-agent/error-classifier.d.ts +5 -0
- package/dist/features/builtin-commands/templates/refactor-sections/intro-and-analysis.d.ts +1 -1
- package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -1
- package/dist/index.js +416 -37
- package/dist/shared/live-server-route.d.ts +1 -1
- package/dist/skills/review-work/SKILL.md +1 -1
- package/dist/skills/ulw-plan/references/full-workflow.md +1 -1
- package/dist/skills/ulw-research/SKILL.md +2 -2
- package/dist/skills/visual-qa/SKILL.md +1 -1
- package/dist/tui.js +125 -13
- package/package.json +13 -13
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +398 -246
- 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/codegraph/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus/gpt-5.6.md +93 -0
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +43 -24
- 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/rules/src/codex-hook.ts +2 -1
- package/packages/omo-codex/plugin/components/rules/src/dynamic-target-fingerprints.ts +15 -6
- package/packages/omo-codex/plugin/components/rules/src/rules-engine-factory.ts +7 -2
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +2 -2
- package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +32 -0
- package/packages/omo-codex/plugin/components/rules/test/hephaestus-model-variant.test.ts +106 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/AGENTS.md +12 -9
- 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/teammode/skills/teammode/SKILL.md +136 -76
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-guide.mjs +94 -23
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-state.mjs +94 -14
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-transport.mjs +55 -0
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team.mjs +72 -18
- package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +23 -0
- 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/agents/explorer.toml +24 -41
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-clone-fidelity-reviewer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-code-reviewer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-executor.toml +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-gate-reviewer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-qa-executor.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +21 -49
- package/packages/omo-codex/plugin/components/ultrawork/agents/metis.toml +17 -29
- package/packages/omo-codex/plugin/components/ultrawork/agents/momus.toml +20 -50
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +18 -39
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +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-codegraph-init-guidance.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/pre-tool-use-enforcing-unlimited-goal-budget.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-checking-codegraph-bootstrap.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-start-work-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.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 +13 -13
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +9 -2
- package/packages/omo-codex/plugin/scripts/entry-guard.mjs +26 -0
- package/packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs +3 -1
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +39 -4
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/subagent-limit-guard.mjs +24 -4
- package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +3 -3
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +2 -2
- package/packages/omo-codex/plugin/scripts/sync-hook-status-messages.mjs +2 -2
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +6 -4
- package/packages/omo-codex/plugin/scripts/sync-version.mjs +4 -2
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/teammode/SKILL.md +136 -76
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-guide.mjs +94 -23
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-state.mjs +94 -14
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-transport.mjs +55 -0
- package/packages/omo-codex/plugin/skills/teammode/scripts/team.mjs +72 -18
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +2 -2
- package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +47 -1
- package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +4 -2
- package/packages/omo-codex/plugin/test/auto-update-restart-notice.test.mjs +33 -0
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +146 -9
- package/packages/omo-codex/plugin/test/multi-agent-v2-regression.test.mjs +71 -0
- package/packages/omo-codex/plugin/test/subagent-limit-migration.test.mjs +32 -0
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +9 -2
- package/packages/omo-codex/plugin/test/teammode-transport.test.mjs +345 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +436 -284
- package/packages/omo-codex/scripts/install-generated-bundle.test.mjs +111 -1
- package/packages/shared-skills/skills/review-work/SKILL.md +1 -1
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/shared-skills/skills/ulw-research/SKILL.md +2 -2
- package/packages/shared-skills/skills/visual-qa/SKILL.md +1 -1
- /package/packages/omo-codex/plugin/components/rules/bundled-rules/{hephaestus.md → hephaestus/gpt-5.5.md} +0 -0
package/dist/cli/index.js
CHANGED
|
@@ -2145,7 +2145,7 @@ var package_default;
|
|
|
2145
2145
|
var init_package = __esm(() => {
|
|
2146
2146
|
package_default = {
|
|
2147
2147
|
name: "oh-my-opencode",
|
|
2148
|
-
version: "4.16.
|
|
2148
|
+
version: "4.16.3",
|
|
2149
2149
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2150
2150
|
main: "./dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -2355,18 +2355,18 @@ var init_package = __esm(() => {
|
|
|
2355
2355
|
typescript: "^6.0.3"
|
|
2356
2356
|
},
|
|
2357
2357
|
optionalDependencies: {
|
|
2358
|
-
"oh-my-opencode-darwin-arm64": "4.16.
|
|
2359
|
-
"oh-my-opencode-darwin-x64": "4.16.
|
|
2360
|
-
"oh-my-opencode-darwin-x64-baseline": "4.16.
|
|
2361
|
-
"oh-my-opencode-linux-arm64": "4.16.
|
|
2362
|
-
"oh-my-opencode-linux-arm64-musl": "4.16.
|
|
2363
|
-
"oh-my-opencode-linux-x64": "4.16.
|
|
2364
|
-
"oh-my-opencode-linux-x64-baseline": "4.16.
|
|
2365
|
-
"oh-my-opencode-linux-x64-musl": "4.16.
|
|
2366
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.16.
|
|
2367
|
-
"oh-my-opencode-windows-arm64": "4.16.
|
|
2368
|
-
"oh-my-opencode-windows-x64": "4.16.
|
|
2369
|
-
"oh-my-opencode-windows-x64-baseline": "4.16.
|
|
2358
|
+
"oh-my-opencode-darwin-arm64": "4.16.3",
|
|
2359
|
+
"oh-my-opencode-darwin-x64": "4.16.3",
|
|
2360
|
+
"oh-my-opencode-darwin-x64-baseline": "4.16.3",
|
|
2361
|
+
"oh-my-opencode-linux-arm64": "4.16.3",
|
|
2362
|
+
"oh-my-opencode-linux-arm64-musl": "4.16.3",
|
|
2363
|
+
"oh-my-opencode-linux-x64": "4.16.3",
|
|
2364
|
+
"oh-my-opencode-linux-x64-baseline": "4.16.3",
|
|
2365
|
+
"oh-my-opencode-linux-x64-musl": "4.16.3",
|
|
2366
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.16.3",
|
|
2367
|
+
"oh-my-opencode-windows-arm64": "4.16.3",
|
|
2368
|
+
"oh-my-opencode-windows-x64": "4.16.3",
|
|
2369
|
+
"oh-my-opencode-windows-x64-baseline": "4.16.3"
|
|
2370
2370
|
},
|
|
2371
2371
|
overrides: {
|
|
2372
2372
|
"@earendil-works/pi-agent-core": "0.80.3",
|
|
@@ -9219,6 +9219,11 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9219
9219
|
},
|
|
9220
9220
|
hephaestus: {
|
|
9221
9221
|
fallbackChain: [
|
|
9222
|
+
{
|
|
9223
|
+
providers: ["openai", "vercel"],
|
|
9224
|
+
model: "gpt-5.6-sol",
|
|
9225
|
+
variant: "medium"
|
|
9226
|
+
},
|
|
9222
9227
|
{
|
|
9223
9228
|
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
9224
9229
|
model: "gpt-5.5",
|
|
@@ -9245,7 +9250,7 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9245
9250
|
model: "claude-opus-4-7",
|
|
9246
9251
|
variant: "max"
|
|
9247
9252
|
},
|
|
9248
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9253
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9249
9254
|
]
|
|
9250
9255
|
},
|
|
9251
9256
|
librarian: {
|
|
@@ -9292,7 +9297,7 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9292
9297
|
model: "gpt-5.5",
|
|
9293
9298
|
variant: "high"
|
|
9294
9299
|
},
|
|
9295
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9300
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9296
9301
|
{
|
|
9297
9302
|
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
9298
9303
|
model: "gemini-3.1-pro"
|
|
@@ -9315,12 +9320,17 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9315
9320
|
model: "gpt-5.5",
|
|
9316
9321
|
variant: "high"
|
|
9317
9322
|
},
|
|
9318
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9323
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9319
9324
|
{ providers: ["kimi-for-coding"], model: "k2p5" }
|
|
9320
9325
|
]
|
|
9321
9326
|
},
|
|
9322
9327
|
momus: {
|
|
9323
9328
|
fallbackChain: [
|
|
9329
|
+
{
|
|
9330
|
+
providers: ["openai", "vercel"],
|
|
9331
|
+
model: "gpt-5.6-sol",
|
|
9332
|
+
variant: "xhigh"
|
|
9333
|
+
},
|
|
9324
9334
|
{
|
|
9325
9335
|
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
9326
9336
|
model: "gpt-5.5",
|
|
@@ -9336,7 +9346,7 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9336
9346
|
model: "gemini-3.1-pro",
|
|
9337
9347
|
variant: "high"
|
|
9338
9348
|
},
|
|
9339
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9349
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9340
9350
|
]
|
|
9341
9351
|
},
|
|
9342
9352
|
atlas: {
|
|
@@ -9388,12 +9398,17 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9388
9398
|
model: "claude-opus-4-7",
|
|
9389
9399
|
variant: "max"
|
|
9390
9400
|
},
|
|
9391
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9401
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9392
9402
|
{ providers: ["kimi-for-coding"], model: "k2p5" }
|
|
9393
9403
|
]
|
|
9394
9404
|
},
|
|
9395
9405
|
ultrabrain: {
|
|
9396
9406
|
fallbackChain: [
|
|
9407
|
+
{
|
|
9408
|
+
providers: ["openai", "vercel"],
|
|
9409
|
+
model: "gpt-5.6-sol",
|
|
9410
|
+
variant: "xhigh"
|
|
9411
|
+
},
|
|
9397
9412
|
{
|
|
9398
9413
|
providers: ["openai", "opencode", "vercel"],
|
|
9399
9414
|
model: "gpt-5.5",
|
|
@@ -9409,11 +9424,16 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9409
9424
|
model: "claude-opus-4-7",
|
|
9410
9425
|
variant: "max"
|
|
9411
9426
|
},
|
|
9412
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9427
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9413
9428
|
]
|
|
9414
9429
|
},
|
|
9415
9430
|
deep: {
|
|
9416
9431
|
fallbackChain: [
|
|
9432
|
+
{
|
|
9433
|
+
providers: ["openai", "vercel"],
|
|
9434
|
+
model: "gpt-5.6-sol",
|
|
9435
|
+
variant: "high"
|
|
9436
|
+
},
|
|
9417
9437
|
{
|
|
9418
9438
|
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
9419
9439
|
model: "gpt-5.5",
|
|
@@ -9430,7 +9450,7 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9430
9450
|
variant: "high"
|
|
9431
9451
|
},
|
|
9432
9452
|
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.6" },
|
|
9433
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9453
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9434
9454
|
]
|
|
9435
9455
|
},
|
|
9436
9456
|
artistry: {
|
|
@@ -9447,7 +9467,7 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9447
9467
|
},
|
|
9448
9468
|
{ providers: ["openai", "github-copilot", "opencode", "vercel"], model: "gpt-5.5" },
|
|
9449
9469
|
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.6" },
|
|
9450
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9470
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9451
9471
|
]
|
|
9452
9472
|
},
|
|
9453
9473
|
quick: {
|
|
@@ -9505,7 +9525,7 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9505
9525
|
},
|
|
9506
9526
|
{ providers: ["zai-coding-plan", "opencode", "bailian-coding-plan", "vercel"], model: "glm-5" },
|
|
9507
9527
|
{ providers: ["kimi-for-coding"], model: "k2p5" },
|
|
9508
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9528
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9509
9529
|
{ providers: ["opencode", "bailian-coding-plan", "vercel"], model: "kimi-k2.5" },
|
|
9510
9530
|
{
|
|
9511
9531
|
providers: [
|
|
@@ -10043,6 +10063,22 @@ var init_supplemental_entries = __esm(() => {
|
|
|
10043
10063
|
output: 262144
|
|
10044
10064
|
}
|
|
10045
10065
|
},
|
|
10066
|
+
"gpt-5.6-sol": {
|
|
10067
|
+
id: "gpt-5.6-sol",
|
|
10068
|
+
family: "gpt",
|
|
10069
|
+
reasoning: true,
|
|
10070
|
+
temperature: false,
|
|
10071
|
+
toolCall: true,
|
|
10072
|
+
modalities: {
|
|
10073
|
+
input: ["text", "image", "pdf"],
|
|
10074
|
+
output: ["text"]
|
|
10075
|
+
},
|
|
10076
|
+
limit: {
|
|
10077
|
+
context: 1050000,
|
|
10078
|
+
input: 922000,
|
|
10079
|
+
output: 128000
|
|
10080
|
+
}
|
|
10081
|
+
},
|
|
10046
10082
|
"gpt-5.5": {
|
|
10047
10083
|
id: "gpt-5.5",
|
|
10048
10084
|
family: "gpt",
|
|
@@ -10867,11 +10903,15 @@ function isGpt5_5Model(model) {
|
|
|
10867
10903
|
const modelName = extractModelName(model).toLowerCase();
|
|
10868
10904
|
return modelName.includes("gpt-5.5") || modelName.includes("gpt-5-5");
|
|
10869
10905
|
}
|
|
10906
|
+
function isGpt5_6Model(model) {
|
|
10907
|
+
const modelName = extractModelName(model).toLowerCase();
|
|
10908
|
+
return modelName.includes("gpt-5.6") || modelName.includes("gpt-5-6");
|
|
10909
|
+
}
|
|
10870
10910
|
var init_types = () => {};
|
|
10871
10911
|
|
|
10872
10912
|
// packages/omo-opencode/src/tools/delegate-task/openai-categories.ts
|
|
10873
10913
|
function resolveDeepCategoryPromptAppend(model) {
|
|
10874
|
-
if (model && isGpt5_5Model(model)) {
|
|
10914
|
+
if (model && (isGpt5_5Model(model) || isGpt5_6Model(model))) {
|
|
10875
10915
|
return DEEP_CATEGORY_PROMPT_APPEND_GPT_5_5;
|
|
10876
10916
|
}
|
|
10877
10917
|
return DEEP_CATEGORY_PROMPT_APPEND;
|
|
@@ -10990,13 +11030,13 @@ var init_openai_categories = __esm(() => {
|
|
|
10990
11030
|
OPENAI_CATEGORIES = [
|
|
10991
11031
|
{
|
|
10992
11032
|
name: "ultrabrain",
|
|
10993
|
-
config: { model: "openai/gpt-5.
|
|
11033
|
+
config: { model: "openai/gpt-5.6-sol", variant: "xhigh" },
|
|
10994
11034
|
description: "Use ONLY for genuinely hard, logic-heavy tasks. Give clear goals only, not step-by-step instructions.",
|
|
10995
11035
|
promptAppend: ULTRABRAIN_CATEGORY_PROMPT_APPEND
|
|
10996
11036
|
},
|
|
10997
11037
|
{
|
|
10998
11038
|
name: "deep",
|
|
10999
|
-
config: { model: "openai/gpt-5.
|
|
11039
|
+
config: { model: "openai/gpt-5.6-sol", variant: "high" },
|
|
11000
11040
|
description: "Goal-oriented autonomous problem-solving on hairy problems requiring deep research. ONE goal + ONE deliverable per call \u2014 multiple goals must fan out as parallel `deep` calls, never bundled into one.",
|
|
11001
11041
|
promptAppend: DEEP_CATEGORY_PROMPT_APPEND,
|
|
11002
11042
|
resolvePromptAppend: resolveDeepCategoryPromptAppend
|
|
@@ -64593,6 +64633,66 @@ async function probe(registration) {
|
|
|
64593
64633
|
return false;
|
|
64594
64634
|
}
|
|
64595
64635
|
}
|
|
64636
|
+
async function probeSessionAffinity(registration, sessionID) {
|
|
64637
|
+
if (!registration.serverUrl) {
|
|
64638
|
+
return;
|
|
64639
|
+
}
|
|
64640
|
+
const probeUrl = new URL(`/session/${sessionID}`, registration.serverUrl);
|
|
64641
|
+
const authHeader = getServerBasicAuthHeader();
|
|
64642
|
+
const headers = authHeader ? { Authorization: authHeader } : {};
|
|
64643
|
+
try {
|
|
64644
|
+
const controller = new AbortController;
|
|
64645
|
+
const timeoutId = setTimeout(() => controller.abort(), PROBE_ABORT_MS);
|
|
64646
|
+
let response;
|
|
64647
|
+
try {
|
|
64648
|
+
response = await getFetch()(probeUrl, { headers, signal: controller.signal });
|
|
64649
|
+
} finally {
|
|
64650
|
+
clearTimeout(timeoutId);
|
|
64651
|
+
}
|
|
64652
|
+
if (response.ok) {
|
|
64653
|
+
setSessionAffinity(registration, sessionID, true);
|
|
64654
|
+
return true;
|
|
64655
|
+
}
|
|
64656
|
+
if (response.status === 404) {
|
|
64657
|
+
setSessionAffinity(registration, sessionID, false);
|
|
64658
|
+
log2("[live-server-route] live listener does not own session; falling back to in-process client", { sessionID });
|
|
64659
|
+
return false;
|
|
64660
|
+
}
|
|
64661
|
+
return;
|
|
64662
|
+
} catch {
|
|
64663
|
+
return;
|
|
64664
|
+
}
|
|
64665
|
+
}
|
|
64666
|
+
function setSessionAffinity(registration, sessionID, owned) {
|
|
64667
|
+
const now = Date.now();
|
|
64668
|
+
for (const [key, entry] of registration.sessionAffinity) {
|
|
64669
|
+
if (now - entry.timestamp >= AFFINITY_TTL_MS) {
|
|
64670
|
+
registration.sessionAffinity.delete(key);
|
|
64671
|
+
}
|
|
64672
|
+
}
|
|
64673
|
+
registration.sessionAffinity.set(sessionID, { owned, timestamp: now });
|
|
64674
|
+
}
|
|
64675
|
+
function getFreshSessionAffinity(registration, sessionID) {
|
|
64676
|
+
const entry = registration.sessionAffinity.get(sessionID);
|
|
64677
|
+
if (!entry || Date.now() - entry.timestamp >= AFFINITY_TTL_MS) {
|
|
64678
|
+
return;
|
|
64679
|
+
}
|
|
64680
|
+
return entry.owned;
|
|
64681
|
+
}
|
|
64682
|
+
async function resolveSessionAffinity(registration, sessionID) {
|
|
64683
|
+
const cached = getFreshSessionAffinity(registration, sessionID);
|
|
64684
|
+
if (cached !== undefined) {
|
|
64685
|
+
return cached;
|
|
64686
|
+
}
|
|
64687
|
+
let inFlight = registration.inFlightAffinity.get(sessionID);
|
|
64688
|
+
if (!inFlight) {
|
|
64689
|
+
inFlight = probeSessionAffinity(registration, sessionID).finally(() => {
|
|
64690
|
+
registration.inFlightAffinity.delete(sessionID);
|
|
64691
|
+
});
|
|
64692
|
+
registration.inFlightAffinity.set(sessionID, inFlight);
|
|
64693
|
+
}
|
|
64694
|
+
return inFlight;
|
|
64695
|
+
}
|
|
64596
64696
|
function getFreshProbeAvailability(registration) {
|
|
64597
64697
|
const available = registration.available;
|
|
64598
64698
|
if (available === undefined || Date.now() - registration.probeTimestamp >= PROBE_TTL_MS) {
|
|
@@ -64645,6 +64745,13 @@ function tryResolveDispatchClientSync2(client3, sessionID) {
|
|
|
64645
64745
|
if (!freshAvailability) {
|
|
64646
64746
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
64647
64747
|
}
|
|
64748
|
+
const cachedAffinity = getFreshSessionAffinity(registration, sessionID);
|
|
64749
|
+
if (cachedAffinity === undefined) {
|
|
64750
|
+
return;
|
|
64751
|
+
}
|
|
64752
|
+
if (!cachedAffinity) {
|
|
64753
|
+
return { client: client3, route: "in-process", reason: "affinity" };
|
|
64754
|
+
}
|
|
64648
64755
|
const resolvedLiveClient = getOrBuildLiveClient(registration);
|
|
64649
64756
|
if (!resolvedLiveClient) {
|
|
64650
64757
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
@@ -64664,6 +64771,10 @@ async function resolveDispatchClient2(client3, sessionID) {
|
|
|
64664
64771
|
if (!isAvailable) {
|
|
64665
64772
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
64666
64773
|
}
|
|
64774
|
+
const affinity = await resolveSessionAffinity(registration, sessionID);
|
|
64775
|
+
if (affinity === false) {
|
|
64776
|
+
return { client: client3, route: "in-process", reason: "affinity" };
|
|
64777
|
+
}
|
|
64667
64778
|
const resolvedLiveClient = getOrBuildLiveClient(registration);
|
|
64668
64779
|
if (!resolvedLiveClient) {
|
|
64669
64780
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
@@ -64701,10 +64812,11 @@ function markLiveRouteUnavailable2(reason) {
|
|
|
64701
64812
|
for (const registration of registrations.values()) {
|
|
64702
64813
|
registration.available = false;
|
|
64703
64814
|
registration.probeTimestamp = Date.now();
|
|
64815
|
+
registration.sessionAffinity.clear();
|
|
64704
64816
|
}
|
|
64705
64817
|
log2(`[live-server-route] marked unavailable: ${reason}`);
|
|
64706
64818
|
}
|
|
64707
|
-
var PROBE_TTL_MS = 60000, PROBE_ABORT_MS = 1500, registrations, liveParentWakeRoutingDisabled = false, fetchImplementationForTesting;
|
|
64819
|
+
var PROBE_TTL_MS = 60000, PROBE_ABORT_MS = 1500, AFFINITY_TTL_MS = 60000, registrations, liveParentWakeRoutingDisabled = false, fetchImplementationForTesting;
|
|
64708
64820
|
var init_live_server_route = __esm(() => {
|
|
64709
64821
|
init_dist();
|
|
64710
64822
|
init_state();
|
|
@@ -66633,21 +66745,21 @@ var init_config_manager = __esm(() => {
|
|
|
66633
66745
|
});
|
|
66634
66746
|
|
|
66635
66747
|
// packages/telemetry-core/src/activity-state.ts
|
|
66636
|
-
import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as
|
|
66637
|
-
import { basename as basename10, join as
|
|
66748
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as readFileSync14 } from "fs";
|
|
66749
|
+
import { basename as basename10, join as join53 } from "path";
|
|
66638
66750
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
66639
66751
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
66640
66752
|
env: options.env,
|
|
66641
66753
|
osProvider: options.osProvider
|
|
66642
66754
|
});
|
|
66643
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
66755
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join53(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
66644
66756
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename10(dataDir) === product.cacheDirName) {
|
|
66645
66757
|
return dataDir;
|
|
66646
66758
|
}
|
|
66647
|
-
return
|
|
66759
|
+
return join53(dataDir, product.cacheDirName);
|
|
66648
66760
|
}
|
|
66649
66761
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
66650
|
-
return
|
|
66762
|
+
return join53(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
66651
66763
|
}
|
|
66652
66764
|
function getDailyActiveCaptureState(input) {
|
|
66653
66765
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -66676,7 +66788,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
66676
66788
|
return {};
|
|
66677
66789
|
}
|
|
66678
66790
|
try {
|
|
66679
|
-
const stateContent =
|
|
66791
|
+
const stateContent = readFileSync14(stateFilePath, "utf-8");
|
|
66680
66792
|
const stateJson = JSON.parse(stateContent);
|
|
66681
66793
|
if (!isPostHogActivityState(stateJson)) {
|
|
66682
66794
|
return {};
|
|
@@ -66717,10 +66829,10 @@ var init_activity_state = __esm(() => {
|
|
|
66717
66829
|
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74";
|
|
66718
66830
|
|
|
66719
66831
|
// packages/telemetry-core/src/diagnostics.ts
|
|
66720
|
-
import { appendFileSync as appendFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync9, readFileSync as
|
|
66721
|
-
import { join as
|
|
66832
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync9, readFileSync as readFileSync15 } from "fs";
|
|
66833
|
+
import { join as join54 } from "path";
|
|
66722
66834
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
66723
|
-
return
|
|
66835
|
+
return join54(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
66724
66836
|
}
|
|
66725
66837
|
function writeTelemetryDiagnostic(input, options) {
|
|
66726
66838
|
const now = options.now ?? new Date;
|
|
@@ -66743,7 +66855,7 @@ function cleanupTelemetryDiagnostics(options) {
|
|
|
66743
66855
|
}
|
|
66744
66856
|
try {
|
|
66745
66857
|
const cutoffMs = (options.now ?? new Date).getTime() - DIAGNOSTICS_RETENTION_MS;
|
|
66746
|
-
const retainedLines = trimToMaxBytes(
|
|
66858
|
+
const retainedLines = trimToMaxBytes(readFileSync15(diagnosticsFilePath, "utf-8").split(`
|
|
66747
66859
|
`).filter((line) => shouldRetainLine(line, cutoffMs)));
|
|
66748
66860
|
writeFileAtomically(diagnosticsFilePath, retainedLines.length === 0 ? "" : `${retainedLines.join(`
|
|
66749
66861
|
`)}
|
|
@@ -66795,7 +66907,7 @@ function shouldRetainLine(line, cutoffMs) {
|
|
|
66795
66907
|
function parseDiagnosticLine(line) {
|
|
66796
66908
|
try {
|
|
66797
66909
|
const parsed = JSON.parse(line);
|
|
66798
|
-
if (!
|
|
66910
|
+
if (!isRecord5(parsed)) {
|
|
66799
66911
|
return null;
|
|
66800
66912
|
}
|
|
66801
66913
|
return parsed;
|
|
@@ -66806,7 +66918,7 @@ function parseDiagnosticLine(line) {
|
|
|
66806
66918
|
throw error;
|
|
66807
66919
|
}
|
|
66808
66920
|
}
|
|
66809
|
-
function
|
|
66921
|
+
function isRecord5(value) {
|
|
66810
66922
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
66811
66923
|
}
|
|
66812
66924
|
function trimToMaxBytes(lines) {
|
|
@@ -66886,7 +66998,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
66886
66998
|
var init_machine_id = () => {};
|
|
66887
66999
|
|
|
66888
67000
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
66889
|
-
import { dirname as
|
|
67001
|
+
import { dirname as dirname18, posix as posix2, sep as sep7 } from "path";
|
|
66890
67002
|
function createModulerModifier() {
|
|
66891
67003
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
66892
67004
|
return async (frames) => {
|
|
@@ -66895,7 +67007,7 @@ function createModulerModifier() {
|
|
|
66895
67007
|
return frames;
|
|
66896
67008
|
};
|
|
66897
67009
|
}
|
|
66898
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
67010
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname18(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
66899
67011
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
66900
67012
|
return (filename) => {
|
|
66901
67013
|
if (!filename)
|
|
@@ -69916,7 +70028,7 @@ var init_context_lines_node = __esm(() => {
|
|
|
69916
70028
|
});
|
|
69917
70029
|
|
|
69918
70030
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
|
|
69919
|
-
import { isAbsolute as
|
|
70031
|
+
import { isAbsolute as isAbsolute9, relative as relative5, sep as sep8 } from "path";
|
|
69920
70032
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
69921
70033
|
const isWindows = sep8 === "\\";
|
|
69922
70034
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
@@ -69924,7 +70036,7 @@ function createRelativePathModifier(basePath = process.cwd()) {
|
|
|
69924
70036
|
return async (frames) => {
|
|
69925
70037
|
for (const frame of frames)
|
|
69926
70038
|
if (!(!frame.filename || frame.filename.startsWith("node:") || frame.filename.startsWith("data:"))) {
|
|
69927
|
-
if (
|
|
70039
|
+
if (isAbsolute9(frame.filename))
|
|
69928
70040
|
frame.filename = toUnix(relative5(normalizedBase, toUnix(frame.filename)));
|
|
69929
70041
|
}
|
|
69930
70042
|
return frames;
|
|
@@ -72441,7 +72553,7 @@ var package_default2;
|
|
|
72441
72553
|
var init_package2 = __esm(() => {
|
|
72442
72554
|
package_default2 = {
|
|
72443
72555
|
name: "@oh-my-opencode/omo-codex",
|
|
72444
|
-
version: "4.16.
|
|
72556
|
+
version: "4.16.2",
|
|
72445
72557
|
type: "module",
|
|
72446
72558
|
private: true,
|
|
72447
72559
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -73411,19 +73523,19 @@ var init_update_toasts = __esm(() => {
|
|
|
73411
73523
|
|
|
73412
73524
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
73413
73525
|
import { existsSync as existsSync49 } from "fs";
|
|
73414
|
-
import { dirname as
|
|
73526
|
+
import { dirname as dirname28, join as join72 } from "path";
|
|
73415
73527
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
73416
73528
|
function defaultGetModuleHostingWorkspace() {
|
|
73417
73529
|
try {
|
|
73418
|
-
const currentDir =
|
|
73530
|
+
const currentDir = dirname28(fileURLToPath5(import.meta.url));
|
|
73419
73531
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
73420
73532
|
if (!pkgJsonPath)
|
|
73421
73533
|
return null;
|
|
73422
|
-
const pkgDir =
|
|
73423
|
-
const nodeModulesDir =
|
|
73534
|
+
const pkgDir = dirname28(pkgJsonPath);
|
|
73535
|
+
const nodeModulesDir = dirname28(pkgDir);
|
|
73424
73536
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
73425
73537
|
return null;
|
|
73426
|
-
return
|
|
73538
|
+
return dirname28(nodeModulesDir);
|
|
73427
73539
|
} catch (error51) {
|
|
73428
73540
|
if (error51 instanceof Error) {
|
|
73429
73541
|
return null;
|
|
@@ -73565,7 +73677,7 @@ var init_background_update_check = __esm(() => {
|
|
|
73565
73677
|
init_update_toasts();
|
|
73566
73678
|
defaultDeps4 = {
|
|
73567
73679
|
existsSync: existsSync49,
|
|
73568
|
-
join:
|
|
73680
|
+
join: join72,
|
|
73569
73681
|
runBunInstallWithDetails,
|
|
73570
73682
|
log: log2,
|
|
73571
73683
|
getOpenCodeCacheDir,
|
|
@@ -74174,7 +74286,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
74174
74286
|
}
|
|
74175
74287
|
|
|
74176
74288
|
// packages/omo-codex/src/install/install-codex.ts
|
|
74177
|
-
import { join as
|
|
74289
|
+
import { join as join55, resolve as resolve15 } from "path";
|
|
74178
74290
|
import { existsSync as existsSync30 } from "fs";
|
|
74179
74291
|
import { homedir as homedir6 } from "os";
|
|
74180
74292
|
|
|
@@ -75464,7 +75576,7 @@ async function shouldBuildSourcePackages(repoRoot) {
|
|
|
75464
75576
|
|
|
75465
75577
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
75466
75578
|
import { mkdir as mkdir5, readFile as readFile11 } from "fs/promises";
|
|
75467
|
-
import { dirname as
|
|
75579
|
+
import { dirname as dirname16 } from "path";
|
|
75468
75580
|
|
|
75469
75581
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
75470
75582
|
function findTomlSection(config, header) {
|
|
@@ -76301,30 +76413,87 @@ function isRootSetting2(line, key) {
|
|
|
76301
76413
|
}
|
|
76302
76414
|
|
|
76303
76415
|
// packages/omo-codex/src/install/codex-multi-agent-v2-config.ts
|
|
76416
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
76417
|
+
import { dirname as dirname15, isAbsolute as isAbsolute8, join as join39 } from "path";
|
|
76304
76418
|
var CODEX_AGENTS_HEADER = "agents";
|
|
76305
76419
|
var CODEX_MULTI_AGENT_V2_HEADER = "features.multi_agent_v2";
|
|
76306
76420
|
var CODEX_SUBAGENT_THREAD_LIMIT = 1000;
|
|
76307
|
-
function ensureCodexMultiAgentV2Config(config) {
|
|
76421
|
+
function ensureCodexMultiAgentV2Config(config, options = {}) {
|
|
76308
76422
|
const featureFlag = removeFeatureFlagSetting(config, "multi_agent_v2");
|
|
76309
|
-
const
|
|
76310
|
-
const
|
|
76423
|
+
const v2Preferred = options.multiAgentVersion === "v2";
|
|
76424
|
+
const modelKnown = options.multiAgentVersion != null || readRootModel(featureFlag.config) !== null;
|
|
76425
|
+
const agentsConfig = v2Preferred ? removeAgentsMaxThreads(featureFlag.config) : modelKnown ? ensureAgentsMaxThreads(featureFlag.config) : raiseExistingAgentsMaxThreads(featureFlag.config);
|
|
76311
76426
|
const maxThreadsValue = CODEX_SUBAGENT_THREAD_LIMIT.toString();
|
|
76427
|
+
const preserveDisable = featureFlag.value === false && !v2Preferred;
|
|
76428
|
+
const featureConfig = preserveDisable ? setMultiAgentV2Disable(agentsConfig) : v2Preferred ? removeMultiAgentV2Disable(agentsConfig) : agentsConfig;
|
|
76429
|
+
const section = findTomlSection(featureConfig, CODEX_MULTI_AGENT_V2_HEADER);
|
|
76312
76430
|
if (!section) {
|
|
76313
|
-
const enabledSetting =
|
|
76431
|
+
const enabledSetting = preserveDisable ? `enabled = false
|
|
76314
76432
|
` : "";
|
|
76315
|
-
return appendBlock(
|
|
76433
|
+
return appendBlock(featureConfig, `[${CODEX_MULTI_AGENT_V2_HEADER}]
|
|
76316
76434
|
${enabledSetting}max_concurrent_threads_per_session = ${maxThreadsValue}
|
|
76317
76435
|
`);
|
|
76318
76436
|
}
|
|
76319
|
-
|
|
76320
|
-
|
|
76321
|
-
|
|
76322
|
-
|
|
76323
|
-
|
|
76324
|
-
|
|
76325
|
-
|
|
76437
|
+
return replaceOrInsertSetting(featureConfig, section, "max_concurrent_threads_per_session", maxThreadsValue);
|
|
76438
|
+
}
|
|
76439
|
+
function resolveCodexMultiAgentVersion(config, configPath) {
|
|
76440
|
+
const model = readRootModel(config);
|
|
76441
|
+
if (model === null)
|
|
76442
|
+
return null;
|
|
76443
|
+
const catalogPath = resolveCatalogPath(readRootModelCatalogPath(config), configPath);
|
|
76444
|
+
const catalogVersion = readCatalogMultiAgentVersion(model, catalogPath);
|
|
76445
|
+
if (catalogVersion !== null)
|
|
76446
|
+
return catalogVersion;
|
|
76447
|
+
return /^gpt-5\.6\b/i.test(model) ? "v2" : null;
|
|
76448
|
+
}
|
|
76449
|
+
function resolveCatalogPath(configuredPath, configPath) {
|
|
76450
|
+
if (configuredPath === null)
|
|
76451
|
+
return join39(dirname15(configPath), "models_cache.json");
|
|
76452
|
+
return isAbsolute8(configuredPath) ? configuredPath : join39(dirname15(configPath), configuredPath);
|
|
76453
|
+
}
|
|
76454
|
+
function readCatalogMultiAgentVersion(model, cachePath) {
|
|
76455
|
+
let raw;
|
|
76456
|
+
try {
|
|
76457
|
+
raw = readFileSync13(cachePath, "utf8");
|
|
76458
|
+
} catch {
|
|
76459
|
+
return null;
|
|
76460
|
+
}
|
|
76461
|
+
let cache;
|
|
76462
|
+
try {
|
|
76463
|
+
cache = JSON.parse(raw);
|
|
76464
|
+
} catch {
|
|
76465
|
+
return null;
|
|
76466
|
+
}
|
|
76467
|
+
if (!isRecord4(cache) || !Array.isArray(cache.models))
|
|
76468
|
+
return null;
|
|
76469
|
+
for (const entry of cache.models) {
|
|
76470
|
+
if (!isRecord4(entry))
|
|
76471
|
+
continue;
|
|
76472
|
+
if (entry.slug !== model && entry.id !== model)
|
|
76473
|
+
continue;
|
|
76474
|
+
const version = entry.multi_agent_version;
|
|
76475
|
+
if (version === "v1" || version === "v2")
|
|
76476
|
+
return version;
|
|
76477
|
+
return null;
|
|
76326
76478
|
}
|
|
76327
|
-
return
|
|
76479
|
+
return null;
|
|
76480
|
+
}
|
|
76481
|
+
function readRootModel(config) {
|
|
76482
|
+
const double = config.match(/^\s*model\s*=\s*"([^"]+)"/m);
|
|
76483
|
+
if (double !== null)
|
|
76484
|
+
return double[1] ?? null;
|
|
76485
|
+
const single = config.match(/^\s*model\s*=\s*'([^']+)'/m);
|
|
76486
|
+
return single?.[1] ?? null;
|
|
76487
|
+
}
|
|
76488
|
+
function readRootModelCatalogPath(config) {
|
|
76489
|
+
const double = config.match(/^\s*model_catalog_json\s*=\s*"([^"]+)"/m);
|
|
76490
|
+
if (double !== null)
|
|
76491
|
+
return double[1] ?? null;
|
|
76492
|
+
const single = config.match(/^\s*model_catalog_json\s*=\s*'([^']+)'/m);
|
|
76493
|
+
return single?.[1] ?? null;
|
|
76494
|
+
}
|
|
76495
|
+
function isRecord4(value) {
|
|
76496
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
76328
76497
|
}
|
|
76329
76498
|
function removeFeatureFlagSetting(config, featureName) {
|
|
76330
76499
|
const section = findTomlSection(config, "features");
|
|
@@ -76345,6 +76514,36 @@ max_threads = ${maxThreadsValue}
|
|
|
76345
76514
|
}
|
|
76346
76515
|
return replaceOrInsertSetting(config, section, "max_threads", maxThreadsValue);
|
|
76347
76516
|
}
|
|
76517
|
+
function removeAgentsMaxThreads(config) {
|
|
76518
|
+
const section = findTomlSection(config, CODEX_AGENTS_HEADER);
|
|
76519
|
+
if (!section)
|
|
76520
|
+
return config;
|
|
76521
|
+
if (!/^\s*max_threads\s*=/m.test(section.text))
|
|
76522
|
+
return config;
|
|
76523
|
+
return removeSetting(config, section, "max_threads");
|
|
76524
|
+
}
|
|
76525
|
+
function removeMultiAgentV2Disable(config) {
|
|
76526
|
+
const section = findTomlSection(config, CODEX_MULTI_AGENT_V2_HEADER);
|
|
76527
|
+
if (!section)
|
|
76528
|
+
return config;
|
|
76529
|
+
if (!/^\s*enabled\s*=\s*false(?:\s*#.*)?$/m.test(section.text))
|
|
76530
|
+
return config;
|
|
76531
|
+
return removeSetting(config, section, "enabled");
|
|
76532
|
+
}
|
|
76533
|
+
function setMultiAgentV2Disable(config) {
|
|
76534
|
+
const section = findTomlSection(config, CODEX_MULTI_AGENT_V2_HEADER);
|
|
76535
|
+
if (!section)
|
|
76536
|
+
return config;
|
|
76537
|
+
return replaceOrInsertSetting(config, section, "enabled", "false");
|
|
76538
|
+
}
|
|
76539
|
+
function raiseExistingAgentsMaxThreads(config) {
|
|
76540
|
+
const section = findTomlSection(config, CODEX_AGENTS_HEADER);
|
|
76541
|
+
if (!section)
|
|
76542
|
+
return config;
|
|
76543
|
+
if (!/^\s*max_threads\s*=/m.test(section.text))
|
|
76544
|
+
return config;
|
|
76545
|
+
return replaceOrInsertSetting(config, section, "max_threads", CODEX_SUBAGENT_THREAD_LIMIT.toString());
|
|
76546
|
+
}
|
|
76348
76547
|
function readBooleanSetting(sectionText, key) {
|
|
76349
76548
|
const match = new RegExp(`^\\s*${escapeRegExp(key)}\\s*=\\s*(true|false)\\s*(?:#.*)?$`, "m").exec(sectionText);
|
|
76350
76549
|
if (!match)
|
|
@@ -76354,7 +76553,7 @@ function readBooleanSetting(sectionText, key) {
|
|
|
76354
76553
|
|
|
76355
76554
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
76356
76555
|
async function updateCodexConfig(input) {
|
|
76357
|
-
await mkdir5(
|
|
76556
|
+
await mkdir5(dirname16(input.configPath), { recursive: true });
|
|
76358
76557
|
let config;
|
|
76359
76558
|
try {
|
|
76360
76559
|
config = await readFile11(input.configPath, "utf8");
|
|
@@ -76377,7 +76576,9 @@ async function updateCodexConfig(input) {
|
|
|
76377
76576
|
config = ensureFeatureEnabled(config, "multi_agent");
|
|
76378
76577
|
config = removeUnsupportedCodexMultiAgentModeConfig(config);
|
|
76379
76578
|
config = ensureCodexReasoningConfig(config, await readCodexModelCatalog(input.repoRoot));
|
|
76380
|
-
config = ensureCodexMultiAgentV2Config(config
|
|
76579
|
+
config = ensureCodexMultiAgentV2Config(config, {
|
|
76580
|
+
multiAgentVersion: resolveCodexMultiAgentVersion(config, input.configPath)
|
|
76581
|
+
});
|
|
76381
76582
|
if (input.autonomousPermissions === true)
|
|
76382
76583
|
config = ensureAutonomousPermissions(config);
|
|
76383
76584
|
if (!(input.preserveMarketplaceSource === true && hasMarketplaceBlock(config, input.marketplaceName))) {
|
|
@@ -76403,7 +76604,7 @@ function isMissingFileError(error) {
|
|
|
76403
76604
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
76404
76605
|
import { createHash as createHash2 } from "crypto";
|
|
76405
76606
|
import { readFile as readFile12 } from "fs/promises";
|
|
76406
|
-
import { join as
|
|
76607
|
+
import { join as join40 } from "path";
|
|
76407
76608
|
var EVENT_LABELS = new Map([
|
|
76408
76609
|
["PreToolUse", "pre_tool_use"],
|
|
76409
76610
|
["PermissionRequest", "permission_request"],
|
|
@@ -76417,7 +76618,7 @@ var EVENT_LABELS = new Map([
|
|
|
76417
76618
|
["Stop", "stop"]
|
|
76418
76619
|
]);
|
|
76419
76620
|
async function trustedHookStatesForPlugin(input) {
|
|
76420
|
-
const manifestPath =
|
|
76621
|
+
const manifestPath = join40(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
76421
76622
|
if (!await exists(manifestPath))
|
|
76422
76623
|
return [];
|
|
76423
76624
|
const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
|
|
@@ -76425,7 +76626,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
76425
76626
|
return [];
|
|
76426
76627
|
const states = [];
|
|
76427
76628
|
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
76428
|
-
const hooksPath =
|
|
76629
|
+
const hooksPath = join40(input.pluginRoot, hookPath);
|
|
76429
76630
|
if (!await exists(hooksPath))
|
|
76430
76631
|
continue;
|
|
76431
76632
|
const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
|
|
@@ -76551,207 +76752,125 @@ function toCodexResolution(resolution) {
|
|
|
76551
76752
|
}
|
|
76552
76753
|
|
|
76553
76754
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
76554
|
-
import { copyFile, lstat as
|
|
76555
|
-
import { basename as basename9, join as
|
|
76755
|
+
import { copyFile, lstat as lstat9, mkdir as mkdir6, readdir as readdir7, rm as rm8, writeFile as writeFile7 } from "fs/promises";
|
|
76756
|
+
import { basename as basename9, join as join43 } from "path";
|
|
76556
76757
|
|
|
76557
|
-
// packages/omo-codex/src/install/
|
|
76558
|
-
import { lstat as lstat7, readFile as readFile13,
|
|
76559
|
-
import { join as
|
|
76560
|
-
|
|
76561
|
-
|
|
76562
|
-
|
|
76563
|
-
|
|
76564
|
-
|
|
76565
|
-
|
|
76566
|
-
|
|
76567
|
-
|
|
76568
|
-
|
|
76569
|
-
]
|
|
76570
|
-
|
|
76571
|
-
|
|
76572
|
-
|
|
76573
|
-
|
|
76574
|
-
|
|
76575
|
-
|
|
76576
|
-
|
|
76577
|
-
|
|
76578
|
-
|
|
76579
|
-
|
|
76580
|
-
|
|
76581
|
-
|
|
76582
|
-
|
|
76583
|
-
|
|
76584
|
-
|
|
76585
|
-
|
|
76586
|
-
|
|
76587
|
-
|
|
76588
|
-
|
|
76589
|
-
}
|
|
76590
|
-
async function readTextIfExists(path7) {
|
|
76591
|
-
try {
|
|
76592
|
-
return await readFile13(path7, "utf8");
|
|
76593
|
-
} catch (error) {
|
|
76594
|
-
if (nodeErrorCode(error) === "ENOENT")
|
|
76595
|
-
return null;
|
|
76596
|
-
throw error;
|
|
76597
|
-
}
|
|
76598
|
-
}
|
|
76599
|
-
async function exists2(path7) {
|
|
76600
|
-
try {
|
|
76601
|
-
await lstat7(path7);
|
|
76602
|
-
return true;
|
|
76603
|
-
} catch (error) {
|
|
76604
|
-
if (nodeErrorCode(error) !== "ENOENT")
|
|
76605
|
-
throw error;
|
|
76606
|
-
return false;
|
|
76758
|
+
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
76759
|
+
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile6 } from "fs/promises";
|
|
76760
|
+
import { join as join41 } from "path";
|
|
76761
|
+
|
|
76762
|
+
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
|
|
76763
|
+
var MANAGED_REASONING_DEFAULT_UPGRADES = new Map([
|
|
76764
|
+
[
|
|
76765
|
+
"explorer",
|
|
76766
|
+
{
|
|
76767
|
+
previous: { model: "gpt-5.4-mini", effort: "low" },
|
|
76768
|
+
current: { model: "gpt-5.6-terra", effort: "medium" }
|
|
76769
|
+
}
|
|
76770
|
+
],
|
|
76771
|
+
[
|
|
76772
|
+
"librarian",
|
|
76773
|
+
{
|
|
76774
|
+
previous: { model: "gpt-5.4-mini", effort: "low" },
|
|
76775
|
+
current: { model: "gpt-5.6-terra", effort: "medium" }
|
|
76776
|
+
}
|
|
76777
|
+
],
|
|
76778
|
+
[
|
|
76779
|
+
"momus",
|
|
76780
|
+
{
|
|
76781
|
+
previous: { model: "gpt-5.5", effort: "xhigh" },
|
|
76782
|
+
current: { model: "gpt-5.6-sol", effort: "ultra" }
|
|
76783
|
+
}
|
|
76784
|
+
]
|
|
76785
|
+
]);
|
|
76786
|
+
function resolveManagedAgentReasoning(input) {
|
|
76787
|
+
const upgrade = MANAGED_REASONING_DEFAULT_UPGRADES.get(input.agentName);
|
|
76788
|
+
if (upgrade !== undefined && input.preserved.model === upgrade.previous.model && input.preserved.effort === upgrade.previous.effort && input.bundledModel === upgrade.current.model && input.bundledEffort === upgrade.current.effort) {
|
|
76789
|
+
return upgrade.current.effort;
|
|
76607
76790
|
}
|
|
76608
|
-
|
|
76609
|
-
function nodeErrorCode(error) {
|
|
76610
|
-
if (!(error instanceof Error) || !("code" in error))
|
|
76611
|
-
return null;
|
|
76612
|
-
return typeof error.code === "string" ? error.code : null;
|
|
76791
|
+
return input.preserved.effort;
|
|
76613
76792
|
}
|
|
76614
76793
|
|
|
76615
|
-
// packages/omo-codex/src/install/
|
|
76616
|
-
var MANIFEST_FILE = ".installed-agents.json";
|
|
76794
|
+
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
76617
76795
|
async function capturePreservedAgentReasoning(input) {
|
|
76618
76796
|
const agentsDir = join41(input.codexHome, "agents");
|
|
76619
|
-
if (!await
|
|
76797
|
+
if (!await exists2(agentsDir))
|
|
76620
76798
|
return new Map;
|
|
76621
76799
|
const preserved = new Map;
|
|
76622
76800
|
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
76623
76801
|
for (const entry of agentEntries) {
|
|
76624
76802
|
if (!entry.name.endsWith(".toml"))
|
|
76625
76803
|
continue;
|
|
76626
|
-
const content = await
|
|
76804
|
+
const content = await readTextIfExists(join41(agentsDir, entry.name));
|
|
76627
76805
|
if (content === null)
|
|
76628
76806
|
continue;
|
|
76629
76807
|
const effort = extractReasoningEffort(content);
|
|
76630
|
-
if (effort !== null)
|
|
76631
|
-
preserved.set(agentNameFromToml(entry.name),
|
|
76808
|
+
if (effort !== null) {
|
|
76809
|
+
preserved.set(agentNameFromToml(entry.name), {
|
|
76810
|
+
model: extractModel(content),
|
|
76811
|
+
effort
|
|
76812
|
+
});
|
|
76813
|
+
}
|
|
76632
76814
|
}
|
|
76633
76815
|
return preserved;
|
|
76634
76816
|
}
|
|
76635
76817
|
async function capturePreservedAgentServiceTier(input) {
|
|
76636
76818
|
const agentsDir = join41(input.codexHome, "agents");
|
|
76637
|
-
if (!await
|
|
76819
|
+
if (!await exists2(agentsDir))
|
|
76638
76820
|
return new Map;
|
|
76639
76821
|
const preserved = new Map;
|
|
76640
76822
|
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
76641
76823
|
for (const entry of agentEntries) {
|
|
76642
76824
|
if (!entry.name.endsWith(".toml"))
|
|
76643
76825
|
continue;
|
|
76644
|
-
const content = await
|
|
76826
|
+
const content = await readTextIfExists(join41(agentsDir, entry.name));
|
|
76645
76827
|
if (content === null)
|
|
76646
76828
|
continue;
|
|
76647
76829
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
76648
76830
|
}
|
|
76649
76831
|
return preserved;
|
|
76650
76832
|
}
|
|
76651
|
-
async function
|
|
76652
|
-
|
|
76653
|
-
await purgeRetiredManagedAgentFiles({ codexHome: input.codexHome });
|
|
76654
|
-
if (bundledAgents.length === 0) {
|
|
76655
|
-
await writeManifest(input.pluginRoot, []);
|
|
76656
|
-
return [];
|
|
76657
|
-
}
|
|
76658
|
-
const agentsDir = join41(input.codexHome, "agents");
|
|
76659
|
-
await mkdir6(agentsDir, { recursive: true });
|
|
76660
|
-
const linked = [];
|
|
76661
|
-
for (const agentPath of bundledAgents) {
|
|
76662
|
-
const agentFileName = basename9(agentPath);
|
|
76663
|
-
const agentName = agentNameFromToml(agentFileName);
|
|
76664
|
-
const linkPath = join41(agentsDir, agentFileName);
|
|
76665
|
-
await replaceWithCopy(linkPath, agentPath);
|
|
76666
|
-
await restorePreservedReasoning({
|
|
76667
|
-
agentName,
|
|
76668
|
-
linkPath,
|
|
76669
|
-
target: agentPath,
|
|
76670
|
-
value: input.preservedReasoning?.get(agentName)
|
|
76671
|
-
});
|
|
76672
|
-
await restorePreservedServiceTier({
|
|
76673
|
-
linkPath,
|
|
76674
|
-
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
76675
|
-
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
76676
|
-
});
|
|
76677
|
-
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
76678
|
-
}
|
|
76679
|
-
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
76680
|
-
return linked;
|
|
76681
|
-
}
|
|
76682
|
-
async function restorePreservedServiceTier(input) {
|
|
76683
|
-
if (!input.preserved)
|
|
76833
|
+
async function restorePreservedReasoning(input) {
|
|
76834
|
+
if (input.value === undefined)
|
|
76684
76835
|
return;
|
|
76685
|
-
const content = await
|
|
76686
|
-
|
|
76836
|
+
const content = await readFile13(input.target, "utf8");
|
|
76837
|
+
const bundledEffort = extractReasoningEffort(content);
|
|
76838
|
+
const effort = resolveManagedAgentReasoning({
|
|
76839
|
+
agentName: input.agentName,
|
|
76840
|
+
bundledModel: extractModel(content),
|
|
76841
|
+
bundledEffort,
|
|
76842
|
+
preserved: input.value
|
|
76843
|
+
});
|
|
76844
|
+
if (bundledEffort === effort)
|
|
76687
76845
|
return;
|
|
76688
|
-
const replacement =
|
|
76846
|
+
const replacement = replaceTopLevelStringSetting(content, "model_reasoning_effort", effort, { insertIfMissing: false });
|
|
76689
76847
|
if (!replacement.replaced)
|
|
76690
76848
|
return;
|
|
76691
76849
|
await writeFile6(input.linkPath, replacement.content);
|
|
76692
76850
|
}
|
|
76693
|
-
async function
|
|
76694
|
-
|
|
76695
|
-
if (!await exists3(componentsRoot))
|
|
76696
|
-
return [];
|
|
76697
|
-
const componentEntries = await readdir6(componentsRoot, { withFileTypes: true });
|
|
76698
|
-
const agents = [];
|
|
76699
|
-
for (const entry of componentEntries) {
|
|
76700
|
-
if (!entry.isDirectory())
|
|
76701
|
-
continue;
|
|
76702
|
-
const agentsRoot = join41(componentsRoot, entry.name, "agents");
|
|
76703
|
-
if (!await exists3(agentsRoot))
|
|
76704
|
-
continue;
|
|
76705
|
-
const agentEntries = await readdir6(agentsRoot, { withFileTypes: true });
|
|
76706
|
-
for (const file2 of agentEntries) {
|
|
76707
|
-
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
76708
|
-
continue;
|
|
76709
|
-
agents.push(join41(agentsRoot, file2.name));
|
|
76710
|
-
}
|
|
76711
|
-
}
|
|
76712
|
-
agents.sort();
|
|
76713
|
-
return agents;
|
|
76714
|
-
}
|
|
76715
|
-
async function replaceWithCopy(linkPath, target) {
|
|
76716
|
-
await prepareReplacement(linkPath);
|
|
76717
|
-
await copyFile(target, linkPath);
|
|
76718
|
-
}
|
|
76719
|
-
async function prepareReplacement(linkPath) {
|
|
76720
|
-
if (!await exists3(linkPath))
|
|
76721
|
-
return;
|
|
76722
|
-
const entryStat = await lstat8(linkPath);
|
|
76723
|
-
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
76724
|
-
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
76725
|
-
}
|
|
76726
|
-
await rm8(linkPath, { force: true });
|
|
76727
|
-
}
|
|
76728
|
-
async function writeManifest(pluginRoot, agentPaths) {
|
|
76729
|
-
const manifestPath = join41(pluginRoot, MANIFEST_FILE);
|
|
76730
|
-
const payload = { agents: [...agentPaths].sort() };
|
|
76731
|
-
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
76732
|
-
`);
|
|
76733
|
-
}
|
|
76734
|
-
async function restorePreservedReasoning(input) {
|
|
76735
|
-
if (input.value === undefined)
|
|
76851
|
+
async function restorePreservedServiceTier(input) {
|
|
76852
|
+
if (!input.preserved)
|
|
76736
76853
|
return;
|
|
76737
|
-
const content = await
|
|
76738
|
-
|
|
76739
|
-
if (bundledEffort === input.value)
|
|
76854
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
76855
|
+
if (extractServiceTier(content) === input.value)
|
|
76740
76856
|
return;
|
|
76741
|
-
const replacement =
|
|
76857
|
+
const replacement = replaceTopLevelStringSetting(content, "service_tier", input.value, { insertIfMissing: true });
|
|
76742
76858
|
if (!replacement.replaced)
|
|
76743
76859
|
return;
|
|
76744
76860
|
await writeFile6(input.linkPath, replacement.content);
|
|
76745
76861
|
}
|
|
76746
|
-
async function
|
|
76862
|
+
async function readTextIfExists(path7) {
|
|
76747
76863
|
try {
|
|
76748
|
-
return await
|
|
76864
|
+
return await readFile13(path7, "utf8");
|
|
76749
76865
|
} catch (error) {
|
|
76750
|
-
if (
|
|
76866
|
+
if (nodeErrorCode(error) === "ENOENT")
|
|
76751
76867
|
return null;
|
|
76752
76868
|
throw error;
|
|
76753
76869
|
}
|
|
76754
76870
|
}
|
|
76871
|
+
function extractModel(content) {
|
|
76872
|
+
return extractTopLevelStringSetting(content, "model");
|
|
76873
|
+
}
|
|
76755
76874
|
function extractReasoningEffort(content) {
|
|
76756
76875
|
return extractTopLevelStringSetting(content, "model_reasoning_effort");
|
|
76757
76876
|
}
|
|
@@ -76771,12 +76890,6 @@ function extractTopLevelStringSetting(content, key) {
|
|
|
76771
76890
|
}
|
|
76772
76891
|
return null;
|
|
76773
76892
|
}
|
|
76774
|
-
function replaceReasoningEffort(content, value) {
|
|
76775
|
-
return replaceTopLevelStringSetting(content, "model_reasoning_effort", value, { insertIfMissing: false });
|
|
76776
|
-
}
|
|
76777
|
-
function replaceServiceTier(content, value) {
|
|
76778
|
-
return replaceTopLevelStringSetting(content, "service_tier", value, { insertIfMissing: true });
|
|
76779
|
-
}
|
|
76780
76893
|
function replaceTopLevelStringSetting(content, key, value, options) {
|
|
76781
76894
|
const lines = content.split(/\n/);
|
|
76782
76895
|
for (let index = 0;index < lines.length; index += 1) {
|
|
@@ -76836,6 +76949,64 @@ function parseJsonString(value) {
|
|
|
76836
76949
|
return null;
|
|
76837
76950
|
}
|
|
76838
76951
|
}
|
|
76952
|
+
async function exists2(path7) {
|
|
76953
|
+
try {
|
|
76954
|
+
await lstat7(path7);
|
|
76955
|
+
return true;
|
|
76956
|
+
} catch (error) {
|
|
76957
|
+
if (nodeErrorCode(error) !== "ENOENT")
|
|
76958
|
+
throw error;
|
|
76959
|
+
return false;
|
|
76960
|
+
}
|
|
76961
|
+
}
|
|
76962
|
+
function nodeErrorCode(error) {
|
|
76963
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
76964
|
+
return null;
|
|
76965
|
+
return typeof error.code === "string" ? error.code : null;
|
|
76966
|
+
}
|
|
76967
|
+
|
|
76968
|
+
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
76969
|
+
import { lstat as lstat8, readFile as readFile14, rm as rm7 } from "fs/promises";
|
|
76970
|
+
import { join as join42 } from "path";
|
|
76971
|
+
var RETIRED_MANAGED_AGENT_FILES = [
|
|
76972
|
+
{
|
|
76973
|
+
fileName: "codex-ultrawork-reviewer.toml",
|
|
76974
|
+
requiredMarkers: [
|
|
76975
|
+
'name = "codex-ultrawork-reviewer"',
|
|
76976
|
+
'description = "Strict ultrawork verification reviewer.',
|
|
76977
|
+
'developer_instructions = """You are the ultrawork verification reviewer.'
|
|
76978
|
+
]
|
|
76979
|
+
}
|
|
76980
|
+
];
|
|
76981
|
+
async function purgeRetiredManagedAgentFiles(input) {
|
|
76982
|
+
const agentsDir = join42(input.codexHome, "agents");
|
|
76983
|
+
if (!await exists3(agentsDir))
|
|
76984
|
+
return;
|
|
76985
|
+
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
76986
|
+
const agentPath = join42(agentsDir, retiredAgent.fileName);
|
|
76987
|
+
if (!await exists3(agentPath))
|
|
76988
|
+
continue;
|
|
76989
|
+
const agentStat = await lstat8(agentPath);
|
|
76990
|
+
if (agentStat.isDirectory() && !agentStat.isSymbolicLink())
|
|
76991
|
+
continue;
|
|
76992
|
+
const content = await readTextIfExists2(agentPath);
|
|
76993
|
+
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
76994
|
+
continue;
|
|
76995
|
+
await rm7(agentPath, { force: true });
|
|
76996
|
+
}
|
|
76997
|
+
}
|
|
76998
|
+
function hasRequiredMarkers(content, markers) {
|
|
76999
|
+
return markers.every((marker) => content.includes(marker));
|
|
77000
|
+
}
|
|
77001
|
+
async function readTextIfExists2(path7) {
|
|
77002
|
+
try {
|
|
77003
|
+
return await readFile14(path7, "utf8");
|
|
77004
|
+
} catch (error) {
|
|
77005
|
+
if (nodeErrorCode2(error) === "ENOENT")
|
|
77006
|
+
return null;
|
|
77007
|
+
throw error;
|
|
77008
|
+
}
|
|
77009
|
+
}
|
|
76839
77010
|
async function exists3(path7) {
|
|
76840
77011
|
try {
|
|
76841
77012
|
await lstat8(path7);
|
|
@@ -76852,12 +77023,105 @@ function nodeErrorCode2(error) {
|
|
|
76852
77023
|
return typeof error.code === "string" ? error.code : null;
|
|
76853
77024
|
}
|
|
76854
77025
|
|
|
77026
|
+
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
77027
|
+
var MANIFEST_FILE = ".installed-agents.json";
|
|
77028
|
+
async function linkCachedPluginAgents(input) {
|
|
77029
|
+
const bundledAgents = await discoverBundledAgents(input.pluginRoot);
|
|
77030
|
+
await purgeRetiredManagedAgentFiles({ codexHome: input.codexHome });
|
|
77031
|
+
if (bundledAgents.length === 0) {
|
|
77032
|
+
await writeManifest(input.pluginRoot, []);
|
|
77033
|
+
return [];
|
|
77034
|
+
}
|
|
77035
|
+
const agentsDir = join43(input.codexHome, "agents");
|
|
77036
|
+
await mkdir6(agentsDir, { recursive: true });
|
|
77037
|
+
const linked = [];
|
|
77038
|
+
for (const agentPath of bundledAgents) {
|
|
77039
|
+
const agentFileName = basename9(agentPath);
|
|
77040
|
+
const agentName = agentNameFromToml2(agentFileName);
|
|
77041
|
+
const linkPath = join43(agentsDir, agentFileName);
|
|
77042
|
+
await replaceWithCopy(linkPath, agentPath);
|
|
77043
|
+
await restorePreservedReasoning({
|
|
77044
|
+
agentName,
|
|
77045
|
+
linkPath,
|
|
77046
|
+
target: agentPath,
|
|
77047
|
+
value: input.preservedReasoning?.get(agentName)
|
|
77048
|
+
});
|
|
77049
|
+
await restorePreservedServiceTier({
|
|
77050
|
+
linkPath,
|
|
77051
|
+
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
77052
|
+
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
77053
|
+
});
|
|
77054
|
+
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
77055
|
+
}
|
|
77056
|
+
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
77057
|
+
return linked;
|
|
77058
|
+
}
|
|
77059
|
+
async function discoverBundledAgents(pluginRoot) {
|
|
77060
|
+
const componentsRoot = join43(pluginRoot, "components");
|
|
77061
|
+
if (!await exists4(componentsRoot))
|
|
77062
|
+
return [];
|
|
77063
|
+
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
77064
|
+
const agents = [];
|
|
77065
|
+
for (const entry of componentEntries) {
|
|
77066
|
+
if (!entry.isDirectory())
|
|
77067
|
+
continue;
|
|
77068
|
+
const agentsRoot = join43(componentsRoot, entry.name, "agents");
|
|
77069
|
+
if (!await exists4(agentsRoot))
|
|
77070
|
+
continue;
|
|
77071
|
+
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
77072
|
+
for (const file2 of agentEntries) {
|
|
77073
|
+
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
77074
|
+
continue;
|
|
77075
|
+
agents.push(join43(agentsRoot, file2.name));
|
|
77076
|
+
}
|
|
77077
|
+
}
|
|
77078
|
+
agents.sort();
|
|
77079
|
+
return agents;
|
|
77080
|
+
}
|
|
77081
|
+
async function replaceWithCopy(linkPath, target) {
|
|
77082
|
+
await prepareReplacement(linkPath);
|
|
77083
|
+
await copyFile(target, linkPath);
|
|
77084
|
+
}
|
|
77085
|
+
async function prepareReplacement(linkPath) {
|
|
77086
|
+
if (!await exists4(linkPath))
|
|
77087
|
+
return;
|
|
77088
|
+
const entryStat = await lstat9(linkPath);
|
|
77089
|
+
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
77090
|
+
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
77091
|
+
}
|
|
77092
|
+
await rm8(linkPath, { force: true });
|
|
77093
|
+
}
|
|
77094
|
+
async function writeManifest(pluginRoot, agentPaths) {
|
|
77095
|
+
const manifestPath = join43(pluginRoot, MANIFEST_FILE);
|
|
77096
|
+
const payload = { agents: [...agentPaths].sort() };
|
|
77097
|
+
await writeFile7(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
77098
|
+
`);
|
|
77099
|
+
}
|
|
77100
|
+
function agentNameFromToml2(fileName) {
|
|
77101
|
+
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
77102
|
+
}
|
|
77103
|
+
async function exists4(path7) {
|
|
77104
|
+
try {
|
|
77105
|
+
await lstat9(path7);
|
|
77106
|
+
return true;
|
|
77107
|
+
} catch (error) {
|
|
77108
|
+
if (nodeErrorCode3(error) !== "ENOENT")
|
|
77109
|
+
throw error;
|
|
77110
|
+
return false;
|
|
77111
|
+
}
|
|
77112
|
+
}
|
|
77113
|
+
function nodeErrorCode3(error) {
|
|
77114
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
77115
|
+
return null;
|
|
77116
|
+
return typeof error.code === "string" ? error.code : null;
|
|
77117
|
+
}
|
|
77118
|
+
|
|
76855
77119
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
76856
77120
|
import { readFile as readFile15 } from "fs/promises";
|
|
76857
|
-
import { join as
|
|
77121
|
+
import { join as join44 } from "path";
|
|
76858
77122
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
76859
77123
|
async function readMarketplace(repoRoot, options) {
|
|
76860
|
-
const marketplacePath = options?.marketplacePath ??
|
|
77124
|
+
const marketplacePath = options?.marketplacePath ?? join44(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
76861
77125
|
const raw = await readFile15(marketplacePath, "utf8");
|
|
76862
77126
|
const parsed = JSON.parse(raw);
|
|
76863
77127
|
if (!isPlainRecord3(parsed))
|
|
@@ -76876,10 +77140,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
76876
77140
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
76877
77141
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
76878
77142
|
const relativePath = sourcePath.slice(2);
|
|
76879
|
-
return
|
|
77143
|
+
return join44(repoRoot, ...relativePath.split(/[\\/]/));
|
|
76880
77144
|
}
|
|
76881
77145
|
async function readPluginManifest(pluginRoot) {
|
|
76882
|
-
const raw = await readFile15(
|
|
77146
|
+
const raw = await readFile15(join44(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
76883
77147
|
const parsed = JSON.parse(raw);
|
|
76884
77148
|
if (!isPlainRecord3(parsed))
|
|
76885
77149
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -76960,8 +77224,8 @@ function validateLocalSourcePath(path7) {
|
|
|
76960
77224
|
}
|
|
76961
77225
|
|
|
76962
77226
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
76963
|
-
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as
|
|
76964
|
-
import { join as
|
|
77227
|
+
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as writeFile8 } from "fs/promises";
|
|
77228
|
+
import { join as join45, sep as sep6 } from "path";
|
|
76965
77229
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
76966
77230
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
76967
77231
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -76974,21 +77238,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
76974
77238
|
return snapshotPlugins;
|
|
76975
77239
|
}
|
|
76976
77240
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
76977
|
-
return
|
|
77241
|
+
return join45(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
76978
77242
|
}
|
|
76979
77243
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
76980
|
-
const manifestDir =
|
|
77244
|
+
const manifestDir = join45(marketplaceRoot, ".agents", "plugins");
|
|
76981
77245
|
await mkdir7(manifestDir, { recursive: true });
|
|
76982
|
-
const tempPath =
|
|
76983
|
-
await
|
|
77246
|
+
const tempPath = join45(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
77247
|
+
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
76984
77248
|
`);
|
|
76985
|
-
await rename4(tempPath,
|
|
77249
|
+
await rename4(tempPath, join45(manifestDir, "marketplace.json"));
|
|
76986
77250
|
}
|
|
76987
77251
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
76988
|
-
const pluginsDir =
|
|
77252
|
+
const pluginsDir = join45(marketplaceRoot, "plugins");
|
|
76989
77253
|
await mkdir7(pluginsDir, { recursive: true });
|
|
76990
|
-
const targetPath =
|
|
76991
|
-
const tempPath =
|
|
77254
|
+
const targetPath = join45(pluginsDir, plugin.name);
|
|
77255
|
+
const tempPath = join45(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
76992
77256
|
await rm9(tempPath, { recursive: true, force: true });
|
|
76993
77257
|
await cp3(plugin.sourcePath, tempPath, {
|
|
76994
77258
|
recursive: true,
|
|
@@ -77009,11 +77273,11 @@ function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
|
77009
77273
|
}
|
|
77010
77274
|
|
|
77011
77275
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
77012
|
-
import { readdir as
|
|
77013
|
-
import { join as
|
|
77276
|
+
import { readdir as readdir8, readFile as readFile16, writeFile as writeFile9 } from "fs/promises";
|
|
77277
|
+
import { join as join46 } from "path";
|
|
77014
77278
|
async function readDistributionManifest(repoRoot) {
|
|
77015
77279
|
try {
|
|
77016
|
-
const parsed = JSON.parse(await readFile16(
|
|
77280
|
+
const parsed = JSON.parse(await readFile16(join46(repoRoot, "package.json"), "utf8"));
|
|
77017
77281
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
77018
77282
|
return;
|
|
77019
77283
|
return {
|
|
@@ -77033,19 +77297,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
77033
77297
|
return input.manifestVersion ?? "local";
|
|
77034
77298
|
}
|
|
77035
77299
|
async function stampLazyCodexPluginVersion(input) {
|
|
77036
|
-
const manifestPath =
|
|
77300
|
+
const manifestPath = join46(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
77037
77301
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
77038
77302
|
await stampJsonVersion(manifestPath, input.version);
|
|
77039
|
-
await stampJsonVersion(
|
|
77303
|
+
await stampJsonVersion(join46(input.pluginRoot, "package.json"), input.version);
|
|
77040
77304
|
for (const hookPath of hookPaths) {
|
|
77041
|
-
await stampHookStatusMessages(
|
|
77305
|
+
await stampHookStatusMessages(join46(input.pluginRoot, hookPath), input.version);
|
|
77042
77306
|
}
|
|
77043
77307
|
await stampComponentVersions(input);
|
|
77044
77308
|
}
|
|
77045
77309
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
77046
77310
|
if (input.distributionManifest === undefined)
|
|
77047
77311
|
return;
|
|
77048
|
-
await
|
|
77312
|
+
await writeFile9(join46(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
77049
77313
|
packageName: input.distributionManifest.name,
|
|
77050
77314
|
version: input.distributionManifest.version
|
|
77051
77315
|
}, null, "\t")}
|
|
@@ -77057,7 +77321,7 @@ async function stampJsonVersion(path7, version) {
|
|
|
77057
77321
|
if (!isPlainRecord3(parsed))
|
|
77058
77322
|
return;
|
|
77059
77323
|
parsed.version = version;
|
|
77060
|
-
await
|
|
77324
|
+
await writeFile9(path7, `${JSON.stringify(parsed, null, "\t")}
|
|
77061
77325
|
`);
|
|
77062
77326
|
} catch (error) {
|
|
77063
77327
|
if (error instanceof Error)
|
|
@@ -77091,7 +77355,7 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
77091
77355
|
if (!isPlainRecord3(parsed))
|
|
77092
77356
|
return;
|
|
77093
77357
|
stampHookGroups(parsed.hooks, version);
|
|
77094
|
-
await
|
|
77358
|
+
await writeFile9(path7, `${JSON.stringify(parsed, null, "\t")}
|
|
77095
77359
|
`);
|
|
77096
77360
|
} catch (error) {
|
|
77097
77361
|
if (error instanceof Error)
|
|
@@ -77102,16 +77366,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
77102
77366
|
async function stampComponentVersions(input) {
|
|
77103
77367
|
let entries;
|
|
77104
77368
|
try {
|
|
77105
|
-
entries = await
|
|
77369
|
+
entries = await readdir8(join46(input.pluginRoot, "components"));
|
|
77106
77370
|
} catch (error) {
|
|
77107
77371
|
if (error instanceof Error)
|
|
77108
77372
|
return;
|
|
77109
77373
|
throw error;
|
|
77110
77374
|
}
|
|
77111
77375
|
for (const entry of entries) {
|
|
77112
|
-
const componentRoot =
|
|
77113
|
-
await stampJsonVersion(
|
|
77114
|
-
await stampHookStatusMessages(
|
|
77376
|
+
const componentRoot = join46(input.pluginRoot, "components", entry);
|
|
77377
|
+
await stampJsonVersion(join46(componentRoot, "package.json"), input.version);
|
|
77378
|
+
await stampHookStatusMessages(join46(componentRoot, "hooks", "hooks.json"), input.version);
|
|
77115
77379
|
}
|
|
77116
77380
|
}
|
|
77117
77381
|
function stampHookGroups(hooks, version) {
|
|
@@ -77168,8 +77432,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
77168
77432
|
};
|
|
77169
77433
|
|
|
77170
77434
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
77171
|
-
import { copyFile as copyFile2, lstat as
|
|
77172
|
-
import { dirname as
|
|
77435
|
+
import { copyFile as copyFile2, lstat as lstat10, readFile as readFile17, writeFile as writeFile10 } from "fs/promises";
|
|
77436
|
+
import { dirname as dirname17, join as join47, resolve as resolve13 } from "path";
|
|
77173
77437
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
77174
77438
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
77175
77439
|
".codex/hooks.json",
|
|
@@ -77201,7 +77465,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
77201
77465
|
}
|
|
77202
77466
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp(input.now?.() ?? new Date)}`;
|
|
77203
77467
|
await copyFile2(configPath, backupPath);
|
|
77204
|
-
await
|
|
77468
|
+
await writeFile10(configPath, `${repair.config.trimEnd()}
|
|
77205
77469
|
`);
|
|
77206
77470
|
configs.push({
|
|
77207
77471
|
projectRoot: project.projectRoot,
|
|
@@ -77272,37 +77536,37 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
77272
77536
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
77273
77537
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
77274
77538
|
}
|
|
77275
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
77539
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join47(resolve13(codexHome), "config.toml");
|
|
77276
77540
|
let current = resolve13(startDirectory);
|
|
77277
77541
|
const configPathsFromCwd = [];
|
|
77278
77542
|
while (true) {
|
|
77279
|
-
const configPath =
|
|
77543
|
+
const configPath = join47(current, ".codex", "config.toml");
|
|
77280
77544
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
77281
77545
|
if (codexHomeConfigPath === null || resolve13(configPath) !== codexHomeConfigPath) {
|
|
77282
77546
|
configPathsFromCwd.push(configPath);
|
|
77283
77547
|
}
|
|
77284
77548
|
}
|
|
77285
|
-
if (await
|
|
77549
|
+
if (await exists5(join47(current, ".git"))) {
|
|
77286
77550
|
return configPathsFromCwd.length === 0 ? null : {
|
|
77287
77551
|
projectRoot: current,
|
|
77288
77552
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
77289
77553
|
artifactRoots: artifactRootsForConfigPaths(configPathsFromCwd)
|
|
77290
77554
|
};
|
|
77291
77555
|
}
|
|
77292
|
-
const parent =
|
|
77556
|
+
const parent = dirname17(current);
|
|
77293
77557
|
if (parent === current) {
|
|
77294
77558
|
const nearestConfigPath = configPathsFromCwd[0];
|
|
77295
77559
|
return nearestConfigPath === undefined ? null : {
|
|
77296
|
-
projectRoot:
|
|
77560
|
+
projectRoot: dirname17(dirname17(nearestConfigPath)),
|
|
77297
77561
|
configPaths: [nearestConfigPath],
|
|
77298
|
-
artifactRoots: [
|
|
77562
|
+
artifactRoots: [dirname17(dirname17(nearestConfigPath))]
|
|
77299
77563
|
};
|
|
77300
77564
|
}
|
|
77301
77565
|
current = parent;
|
|
77302
77566
|
}
|
|
77303
77567
|
}
|
|
77304
77568
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
77305
|
-
const codexDirStat = await maybeLstat(
|
|
77569
|
+
const codexDirStat = await maybeLstat(join47(directory, ".codex"));
|
|
77306
77570
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
77307
77571
|
return false;
|
|
77308
77572
|
const configStat = await maybeLstat(configPath);
|
|
@@ -77311,7 +77575,7 @@ async function isRegularProjectLocalConfig(directory, configPath) {
|
|
|
77311
77575
|
function artifactRootsForConfigPaths(configPaths) {
|
|
77312
77576
|
const roots = [];
|
|
77313
77577
|
for (const configPath of configPaths) {
|
|
77314
|
-
const root =
|
|
77578
|
+
const root = dirname17(dirname17(configPath));
|
|
77315
77579
|
if (!roots.includes(root))
|
|
77316
77580
|
roots.push(root);
|
|
77317
77581
|
}
|
|
@@ -77322,7 +77586,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
77322
77586
|
const seenPaths = new Set;
|
|
77323
77587
|
for (const projectRoot of projectRoots) {
|
|
77324
77588
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
77325
|
-
const artifactPath =
|
|
77589
|
+
const artifactPath = join47(projectRoot, relativePath);
|
|
77326
77590
|
if (seenPaths.has(artifactPath))
|
|
77327
77591
|
continue;
|
|
77328
77592
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -77356,17 +77620,17 @@ function formatBackupTimestamp(date) {
|
|
|
77356
77620
|
}
|
|
77357
77621
|
async function maybeLstat(path7) {
|
|
77358
77622
|
try {
|
|
77359
|
-
return await
|
|
77623
|
+
return await lstat10(path7);
|
|
77360
77624
|
} catch (error) {
|
|
77361
|
-
if (
|
|
77625
|
+
if (nodeErrorCode4(error) === "ENOENT")
|
|
77362
77626
|
return null;
|
|
77363
77627
|
throw error;
|
|
77364
77628
|
}
|
|
77365
77629
|
}
|
|
77366
|
-
async function
|
|
77630
|
+
async function exists5(path7) {
|
|
77367
77631
|
return await maybeLstat(path7) !== null;
|
|
77368
77632
|
}
|
|
77369
|
-
function
|
|
77633
|
+
function nodeErrorCode4(error) {
|
|
77370
77634
|
if (!(error instanceof Error) || !("code" in error))
|
|
77371
77635
|
return null;
|
|
77372
77636
|
return typeof error.code === "string" ? error.code : null;
|
|
@@ -77397,24 +77661,24 @@ function formatUnknownError(error) {
|
|
|
77397
77661
|
}
|
|
77398
77662
|
|
|
77399
77663
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
77400
|
-
import { readFile as readFile18, readdir as
|
|
77664
|
+
import { readFile as readFile18, readdir as readdir9, rm as rm10 } from "fs/promises";
|
|
77401
77665
|
import { connect } from "net";
|
|
77402
|
-
import { join as
|
|
77666
|
+
import { join as join48 } from "path";
|
|
77403
77667
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
77404
77668
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
77405
77669
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
77406
|
-
const daemonRoot =
|
|
77670
|
+
const daemonRoot = join48(codexHome, "codex-lsp", "daemon");
|
|
77407
77671
|
const reaped = [];
|
|
77408
77672
|
let entries;
|
|
77409
77673
|
try {
|
|
77410
|
-
entries = await
|
|
77674
|
+
entries = await readdir9(daemonRoot);
|
|
77411
77675
|
} catch {
|
|
77412
77676
|
return reaped;
|
|
77413
77677
|
}
|
|
77414
77678
|
for (const entry of entries) {
|
|
77415
|
-
const versionDir =
|
|
77416
|
-
const pid = await readPidFile(
|
|
77417
|
-
const socketPath = await readEndpointFile(
|
|
77679
|
+
const versionDir = join48(daemonRoot, entry);
|
|
77680
|
+
const pid = await readPidFile(join48(versionDir, "daemon.pid"));
|
|
77681
|
+
const socketPath = await readEndpointFile(join48(versionDir, "daemon.endpoint"));
|
|
77418
77682
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
77419
77683
|
reaped.push(pid);
|
|
77420
77684
|
}
|
|
@@ -77468,7 +77732,7 @@ function sendSigterm(pid) {
|
|
|
77468
77732
|
|
|
77469
77733
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
77470
77734
|
import { homedir as homedir5 } from "os";
|
|
77471
|
-
import { join as
|
|
77735
|
+
import { join as join49, resolve as resolve14 } from "path";
|
|
77472
77736
|
function resolveCodexInstallerBinDir(input) {
|
|
77473
77737
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
77474
77738
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -77477,13 +77741,13 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
77477
77741
|
const defaultCodexHome = resolve14(homeDir, ".codex");
|
|
77478
77742
|
const resolvedCodexHome = resolve14(input.codexHome);
|
|
77479
77743
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
77480
|
-
return
|
|
77744
|
+
return join49(resolvedCodexHome, "bin");
|
|
77481
77745
|
return resolve14(homeDir, ".local", "bin");
|
|
77482
77746
|
}
|
|
77483
77747
|
|
|
77484
77748
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
77485
|
-
import { readFile as readFile19, writeFile as
|
|
77486
|
-
import { join as
|
|
77749
|
+
import { readFile as readFile19, writeFile as writeFile11 } from "fs/promises";
|
|
77750
|
+
import { join as join50 } from "path";
|
|
77487
77751
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
77488
77752
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
77489
77753
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -77491,22 +77755,22 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
77491
77755
|
async function removeGitBashHooksOffWindows(input) {
|
|
77492
77756
|
if (input.platform === "win32")
|
|
77493
77757
|
return;
|
|
77494
|
-
const manifestPath =
|
|
77758
|
+
const manifestPath = join50(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
77495
77759
|
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
77496
77760
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.hooks))
|
|
77497
77761
|
return;
|
|
77498
77762
|
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
|
|
77499
77763
|
if (hooks.length === parsed.hooks.length)
|
|
77500
77764
|
return;
|
|
77501
|
-
await
|
|
77765
|
+
await writeFile11(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
|
|
77502
77766
|
`);
|
|
77503
77767
|
}
|
|
77504
77768
|
|
|
77505
77769
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
77506
|
-
import { join as
|
|
77770
|
+
import { join as join51 } from "path";
|
|
77507
77771
|
async function seedAndMigrateOmoSot(input) {
|
|
77508
77772
|
const commandEnv = { ...input.env };
|
|
77509
|
-
const scriptPath =
|
|
77773
|
+
const scriptPath = join51(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
77510
77774
|
try {
|
|
77511
77775
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
77512
77776
|
cwd: input.repoRoot,
|
|
@@ -77521,7 +77785,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
77521
77785
|
|
|
77522
77786
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
77523
77787
|
init_src();
|
|
77524
|
-
import { join as
|
|
77788
|
+
import { join as join52 } from "path";
|
|
77525
77789
|
function describeResult(result) {
|
|
77526
77790
|
if (result.kind === "succeeded")
|
|
77527
77791
|
return null;
|
|
@@ -77535,7 +77799,7 @@ async function installAstGrepForCodex(options) {
|
|
|
77535
77799
|
return;
|
|
77536
77800
|
const platform = options.platform ?? process.platform;
|
|
77537
77801
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
77538
|
-
const skillDir =
|
|
77802
|
+
const skillDir = join52(plugin.path, "skills", "ast-grep");
|
|
77539
77803
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
77540
77804
|
try {
|
|
77541
77805
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -77569,7 +77833,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77569
77833
|
const env3 = options.env ?? process.env;
|
|
77570
77834
|
const platform = options.platform ?? process.platform;
|
|
77571
77835
|
const repoRoot = resolve15(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
77572
|
-
const codexHome = resolve15(options.codexHome ?? env3.CODEX_HOME ??
|
|
77836
|
+
const codexHome = resolve15(options.codexHome ?? env3.CODEX_HOME ?? join55(homedir6(), ".codex"));
|
|
77573
77837
|
const projectDirectory = resolve15(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
77574
77838
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
77575
77839
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -77585,9 +77849,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
77585
77849
|
if (!gitBashResolution.found) {
|
|
77586
77850
|
throw new Error(gitBashResolution.installHint);
|
|
77587
77851
|
}
|
|
77588
|
-
const codexPackageRoot =
|
|
77852
|
+
const codexPackageRoot = join55(repoRoot, "packages", "omo-codex");
|
|
77589
77853
|
const marketplace = await readMarketplace(repoRoot, {
|
|
77590
|
-
marketplacePath:
|
|
77854
|
+
marketplacePath: join55(codexPackageRoot, "marketplace.json")
|
|
77591
77855
|
});
|
|
77592
77856
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
77593
77857
|
const installed = [];
|
|
@@ -77630,7 +77894,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77630
77894
|
if (runtimeLink !== null)
|
|
77631
77895
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
77632
77896
|
else
|
|
77633
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
77897
|
+
log4(`Warning: skipped the omo runtime wrapper because ${join55(repoRoot, "dist", "cli", "index.js")} is missing; omo ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
77634
77898
|
}
|
|
77635
77899
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
77636
77900
|
installed.push(plugin);
|
|
@@ -77661,7 +77925,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77661
77925
|
});
|
|
77662
77926
|
for (const link of agentLinks) {
|
|
77663
77927
|
log4(`Linked agent ${link.name} -> ${link.target}`);
|
|
77664
|
-
const agentName =
|
|
77928
|
+
const agentName = agentNameFromToml3(link.name);
|
|
77665
77929
|
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
77666
77930
|
}
|
|
77667
77931
|
}
|
|
@@ -77684,13 +77948,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
77684
77948
|
});
|
|
77685
77949
|
}
|
|
77686
77950
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
77687
|
-
const marketplaceRoot =
|
|
77951
|
+
const marketplaceRoot = join55(codexHome, "plugins", "cache", marketplace.name);
|
|
77688
77952
|
await writeCachedMarketplaceManifest({
|
|
77689
77953
|
marketplaceName: marketplace.name,
|
|
77690
77954
|
marketplaceRoot,
|
|
77691
77955
|
plugins: installed
|
|
77692
77956
|
});
|
|
77693
|
-
const configPath =
|
|
77957
|
+
const configPath = join55(codexHome, "config.toml");
|
|
77694
77958
|
await updateCodexConfig({
|
|
77695
77959
|
configPath,
|
|
77696
77960
|
repoRoot: codexPackageRoot,
|
|
@@ -77728,7 +77992,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77728
77992
|
projectCleanup
|
|
77729
77993
|
};
|
|
77730
77994
|
}
|
|
77731
|
-
function
|
|
77995
|
+
function agentNameFromToml3(fileName) {
|
|
77732
77996
|
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
77733
77997
|
}
|
|
77734
77998
|
async function agentSourceRootsForInstall(input) {
|
|
@@ -77750,7 +78014,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
77750
78014
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
77751
78015
|
if (isRepoRootWithCodexPlugin(current))
|
|
77752
78016
|
return current;
|
|
77753
|
-
for (const wrapperPackageRoot of [
|
|
78017
|
+
for (const wrapperPackageRoot of [join55(current, "node_modules", "oh-my-openagent"), join55(current, "oh-my-openagent")]) {
|
|
77754
78018
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
77755
78019
|
return wrapperPackageRoot;
|
|
77756
78020
|
}
|
|
@@ -77768,7 +78032,7 @@ function findRepoRoot(input) {
|
|
|
77768
78032
|
return findRepoRootFromImporter(input.importerDir);
|
|
77769
78033
|
}
|
|
77770
78034
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
77771
|
-
return existsSync30(
|
|
78035
|
+
return existsSync30(join55(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
77772
78036
|
}
|
|
77773
78037
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
77774
78038
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -77789,19 +78053,19 @@ async function detectCodexInstallation(input = {}) {
|
|
|
77789
78053
|
const platform = input.platform ?? process.platform;
|
|
77790
78054
|
const env3 = input.env ?? process.env;
|
|
77791
78055
|
const homeDir = input.homeDir ?? homedir7();
|
|
77792
|
-
const
|
|
78056
|
+
const exists6 = input.exists ?? existsSync31;
|
|
77793
78057
|
const which2 = input.which ?? bunWhich;
|
|
77794
78058
|
const checkedPaths = [CODEX_PATH_CHECK_LABEL];
|
|
77795
78059
|
const cliPath = nonEmptyValue2(which2("codex"));
|
|
77796
78060
|
if (cliPath !== undefined)
|
|
77797
78061
|
return { found: true, source: "cli", path: cliPath };
|
|
77798
78062
|
if (platform === "darwin") {
|
|
77799
|
-
return detectMacCodexInstallation({ homeDir, exists:
|
|
78063
|
+
return detectMacCodexInstallation({ homeDir, exists: exists6, checkedPaths });
|
|
77800
78064
|
}
|
|
77801
78065
|
if (platform === "win32") {
|
|
77802
78066
|
return detectWindowsCodexInstallation({
|
|
77803
78067
|
env: env3,
|
|
77804
|
-
exists:
|
|
78068
|
+
exists: exists6,
|
|
77805
78069
|
checkedPaths,
|
|
77806
78070
|
runCommand: input.runCommand ?? defaultRunCommand2
|
|
77807
78071
|
});
|
|
@@ -77903,13 +78167,13 @@ function defaultRunCommand2(command, args) {
|
|
|
77903
78167
|
});
|
|
77904
78168
|
}
|
|
77905
78169
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
77906
|
-
import { lstat as
|
|
78170
|
+
import { lstat as lstat12, readFile as readFile21, readdir as readdir10, rm as rm11, rmdir } from "fs/promises";
|
|
77907
78171
|
import { homedir as homedir8 } from "os";
|
|
77908
|
-
import { isAbsolute as
|
|
78172
|
+
import { isAbsolute as isAbsolute11, join as join57, relative as relative7, resolve as resolve17 } from "path";
|
|
77909
78173
|
|
|
77910
78174
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
77911
|
-
import { lstat as
|
|
77912
|
-
import { dirname as
|
|
78175
|
+
import { lstat as lstat11, mkdir as mkdir8, readFile as readFile20, writeFile as writeFile12 } from "fs/promises";
|
|
78176
|
+
import { dirname as dirname19 } from "path";
|
|
77913
78177
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
77914
78178
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
77915
78179
|
var CURRENT_MANAGED_CODEX_AGENT_NAMES2 = [
|
|
@@ -77943,9 +78207,9 @@ async function cleanupCodexConfig(configPath, now) {
|
|
|
77943
78207
|
if (next === original)
|
|
77944
78208
|
return { changed: false };
|
|
77945
78209
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
77946
|
-
await mkdir8(
|
|
77947
|
-
await
|
|
77948
|
-
await
|
|
78210
|
+
await mkdir8(dirname19(configPath), { recursive: true });
|
|
78211
|
+
await writeFile12(backupPath, original);
|
|
78212
|
+
await writeFile12(configPath, `${next.trimEnd()}
|
|
77949
78213
|
`);
|
|
77950
78214
|
return { changed: true, backupPath };
|
|
77951
78215
|
}
|
|
@@ -78007,27 +78271,27 @@ function formatBackupTimestamp2(date) {
|
|
|
78007
78271
|
}
|
|
78008
78272
|
async function configExists(path7) {
|
|
78009
78273
|
try {
|
|
78010
|
-
await
|
|
78274
|
+
await lstat11(path7);
|
|
78011
78275
|
return true;
|
|
78012
78276
|
} catch (error) {
|
|
78013
|
-
if (
|
|
78277
|
+
if (nodeErrorCode5(error) === "ENOENT")
|
|
78014
78278
|
return false;
|
|
78015
78279
|
throw error;
|
|
78016
78280
|
}
|
|
78017
78281
|
}
|
|
78018
|
-
function
|
|
78282
|
+
function nodeErrorCode5(error) {
|
|
78019
78283
|
if (!(error instanceof Error) || !("code" in error))
|
|
78020
78284
|
return null;
|
|
78021
78285
|
return typeof error.code === "string" ? error.code : null;
|
|
78022
78286
|
}
|
|
78023
78287
|
|
|
78024
78288
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
78025
|
-
import { dirname as
|
|
78289
|
+
import { dirname as dirname20, isAbsolute as isAbsolute10, join as join56, relative as relative6, resolve as resolve16 } from "path";
|
|
78026
78290
|
function validateManagedCleanupTarget(input) {
|
|
78027
|
-
if (!
|
|
78291
|
+
if (!isAbsolute10(input.path))
|
|
78028
78292
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78029
78293
|
const codexHome = resolve16(input.codexHome);
|
|
78030
|
-
if (
|
|
78294
|
+
if (dirname20(codexHome) === codexHome)
|
|
78031
78295
|
return skipped(input.path, "Codex home resolves to a filesystem root");
|
|
78032
78296
|
const target = resolve16(input.path);
|
|
78033
78297
|
if (!isWithinDirectory(codexHome, target))
|
|
@@ -78035,11 +78299,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
78035
78299
|
if (target === codexHome)
|
|
78036
78300
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78037
78301
|
const exactManagedRoots = new Set([
|
|
78038
|
-
resolve16(
|
|
78039
|
-
resolve16(
|
|
78040
|
-
resolve16(
|
|
78041
|
-
resolve16(
|
|
78042
|
-
resolve16(
|
|
78302
|
+
resolve16(join56(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
78303
|
+
resolve16(join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
78304
|
+
resolve16(join56(codexHome, "runtime", "ast-grep")),
|
|
78305
|
+
resolve16(join56(codexHome, "runtime", "node")),
|
|
78306
|
+
resolve16(join56(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
78043
78307
|
]);
|
|
78044
78308
|
if (exactManagedRoots.has(target))
|
|
78045
78309
|
return null;
|
|
@@ -78049,7 +78313,7 @@ function validateManagedCleanupTarget(input) {
|
|
|
78049
78313
|
}
|
|
78050
78314
|
function isWithinDirectory(parent, child) {
|
|
78051
78315
|
const relativePath = relative6(parent, child);
|
|
78052
|
-
return relativePath === "" || !relativePath.startsWith("..") && !
|
|
78316
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute10(relativePath);
|
|
78053
78317
|
}
|
|
78054
78318
|
function isManagedBootstrapDriftPath(codexHome, target) {
|
|
78055
78319
|
const relativePath = relative6(codexHome, target);
|
|
@@ -78069,8 +78333,8 @@ function skipped(path7, reason) {
|
|
|
78069
78333
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
78070
78334
|
async function cleanupCodexLight(input = {}) {
|
|
78071
78335
|
const env3 = input.env ?? process.env;
|
|
78072
|
-
const codexHome = resolve17(input.codexHome ?? env3.CODEX_HOME ??
|
|
78073
|
-
const configPath =
|
|
78336
|
+
const codexHome = resolve17(input.codexHome ?? env3.CODEX_HOME ?? join57(homedir8(), ".codex"));
|
|
78337
|
+
const configPath = join57(codexHome, "config.toml");
|
|
78074
78338
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
78075
78339
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
78076
78340
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
@@ -78109,32 +78373,32 @@ async function cleanupCodexLight(input = {}) {
|
|
|
78109
78373
|
}
|
|
78110
78374
|
function managedGlobalStatePaths(codexHome) {
|
|
78111
78375
|
return [
|
|
78112
|
-
|
|
78113
|
-
|
|
78114
|
-
|
|
78115
|
-
|
|
78116
|
-
|
|
78376
|
+
join57(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
78377
|
+
join57(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
78378
|
+
join57(codexHome, "runtime", "ast-grep"),
|
|
78379
|
+
join57(codexHome, "runtime", "node"),
|
|
78380
|
+
join57(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
78117
78381
|
];
|
|
78118
78382
|
}
|
|
78119
78383
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
78120
78384
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
78121
78385
|
const results = [];
|
|
78122
|
-
await walkForManagedBootstrapDirs(
|
|
78386
|
+
await walkForManagedBootstrapDirs(join57(codexHome, "plugins"), 0, results);
|
|
78123
78387
|
return results;
|
|
78124
78388
|
}
|
|
78125
78389
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
78126
78390
|
if (depth > BOOTSTRAP_DATA_GLOB_MAX_DEPTH)
|
|
78127
78391
|
return;
|
|
78128
|
-
const entries = await
|
|
78392
|
+
const entries = await readdir10(directory, { withFileTypes: true }).catch(() => null);
|
|
78129
78393
|
if (entries === null)
|
|
78130
78394
|
return;
|
|
78131
78395
|
for (const entry of entries) {
|
|
78132
78396
|
if (!entry.isDirectory())
|
|
78133
78397
|
continue;
|
|
78134
|
-
const childPath =
|
|
78398
|
+
const childPath = join57(directory, entry.name);
|
|
78135
78399
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
78136
|
-
const bootstrapDir =
|
|
78137
|
-
if (await
|
|
78400
|
+
const bootstrapDir = join57(childPath, "bootstrap");
|
|
78401
|
+
if (await exists6(bootstrapDir))
|
|
78138
78402
|
results.push(bootstrapDir);
|
|
78139
78403
|
continue;
|
|
78140
78404
|
}
|
|
@@ -78157,7 +78421,7 @@ async function removeManagedPathBestEffort(path7, seams) {
|
|
|
78157
78421
|
}
|
|
78158
78422
|
async function attemptRemove(path7) {
|
|
78159
78423
|
try {
|
|
78160
|
-
if (await
|
|
78424
|
+
if (await lstat12(path7).catch(() => null) === null)
|
|
78161
78425
|
return false;
|
|
78162
78426
|
await rm11(path7, { recursive: true, force: true });
|
|
78163
78427
|
return true;
|
|
@@ -78167,7 +78431,7 @@ async function attemptRemove(path7) {
|
|
|
78167
78431
|
}
|
|
78168
78432
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
78169
78433
|
try {
|
|
78170
|
-
await rmdir(
|
|
78434
|
+
await rmdir(join57(codexHome, "runtime"));
|
|
78171
78435
|
} catch (error) {
|
|
78172
78436
|
if (isExpectedRuntimePruneFailure(error))
|
|
78173
78437
|
return;
|
|
@@ -78175,18 +78439,18 @@ async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
|
78175
78439
|
}
|
|
78176
78440
|
}
|
|
78177
78441
|
function isExpectedRuntimePruneFailure(error) {
|
|
78178
|
-
return ["ENOENT", "ENOTEMPTY", "EEXIST", "EPERM", "EBUSY", "ENOTDIR"].includes(
|
|
78442
|
+
return ["ENOENT", "ENOTEMPTY", "EEXIST", "EPERM", "EBUSY", "ENOTDIR"].includes(nodeErrorCode6(error) ?? "");
|
|
78179
78443
|
}
|
|
78180
78444
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
78181
78445
|
const manifestPaths = [
|
|
78182
|
-
|
|
78446
|
+
join57(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
78183
78447
|
];
|
|
78184
|
-
const versionRoot =
|
|
78185
|
-
if (await
|
|
78186
|
-
const entries = await
|
|
78448
|
+
const versionRoot = join57(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
78449
|
+
if (await exists6(versionRoot)) {
|
|
78450
|
+
const entries = await readdir10(versionRoot, { withFileTypes: true });
|
|
78187
78451
|
for (const entry of entries) {
|
|
78188
78452
|
if (entry.isDirectory())
|
|
78189
|
-
manifestPaths.push(
|
|
78453
|
+
manifestPaths.push(join57(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
78190
78454
|
}
|
|
78191
78455
|
}
|
|
78192
78456
|
const paths = new Set;
|
|
@@ -78201,13 +78465,13 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
78201
78465
|
return [...paths].sort();
|
|
78202
78466
|
}
|
|
78203
78467
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
78204
|
-
if (!await
|
|
78468
|
+
if (!await exists6(configPath))
|
|
78205
78469
|
return [];
|
|
78206
78470
|
const config = await readFile21(configPath, "utf8");
|
|
78207
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
78471
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join57(codexHome, "agents", `${agentName}.toml`));
|
|
78208
78472
|
}
|
|
78209
78473
|
async function readInstalledAgentManifest(manifestPath) {
|
|
78210
|
-
if (!await
|
|
78474
|
+
if (!await exists6(manifestPath))
|
|
78211
78475
|
return [];
|
|
78212
78476
|
const parsed = JSON.parse(await readFile21(manifestPath, "utf8"));
|
|
78213
78477
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.agents))
|
|
@@ -78215,7 +78479,7 @@ async function readInstalledAgentManifest(manifestPath) {
|
|
|
78215
78479
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
78216
78480
|
}
|
|
78217
78481
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
78218
|
-
const agentsDir =
|
|
78482
|
+
const agentsDir = join57(codexHome, "agents");
|
|
78219
78483
|
const removed = [];
|
|
78220
78484
|
const skipped2 = [];
|
|
78221
78485
|
for (const path7 of paths) {
|
|
@@ -78236,29 +78500,29 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
78236
78500
|
return { removed, skipped: skipped2 };
|
|
78237
78501
|
}
|
|
78238
78502
|
function isSafeManagedAgentPath(agentsDir, path7) {
|
|
78239
|
-
if (!
|
|
78503
|
+
if (!isAbsolute11(path7))
|
|
78240
78504
|
return false;
|
|
78241
78505
|
const relativePath = relative7(agentsDir, path7);
|
|
78242
|
-
if (relativePath === "" || relativePath.startsWith("..") ||
|
|
78506
|
+
if (relativePath === "" || relativePath.startsWith("..") || isAbsolute11(relativePath))
|
|
78243
78507
|
return false;
|
|
78244
78508
|
const fileName = relativePath.split(/[\\/]/).pop();
|
|
78245
78509
|
if (fileName === undefined)
|
|
78246
78510
|
return false;
|
|
78247
78511
|
return MANAGED_CODEX_AGENT_NAMES2.some((agentName) => fileName === `${agentName}.toml`);
|
|
78248
78512
|
}
|
|
78249
|
-
async function
|
|
78513
|
+
async function exists6(path7) {
|
|
78250
78514
|
return await maybeLstat2(path7) !== null;
|
|
78251
78515
|
}
|
|
78252
78516
|
async function maybeLstat2(path7) {
|
|
78253
78517
|
try {
|
|
78254
|
-
return await
|
|
78518
|
+
return await lstat12(path7);
|
|
78255
78519
|
} catch (error) {
|
|
78256
|
-
if (
|
|
78520
|
+
if (nodeErrorCode6(error) === "ENOENT")
|
|
78257
78521
|
return null;
|
|
78258
78522
|
throw error;
|
|
78259
78523
|
}
|
|
78260
78524
|
}
|
|
78261
|
-
function
|
|
78525
|
+
function nodeErrorCode6(error) {
|
|
78262
78526
|
if (!(error instanceof Error) || !("code" in error))
|
|
78263
78527
|
return null;
|
|
78264
78528
|
return typeof error.code === "string" ? error.code : null;
|
|
@@ -78268,16 +78532,16 @@ var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", ".
|
|
|
78268
78532
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
78269
78533
|
import { execFile as execFile3 } from "child_process";
|
|
78270
78534
|
import { constants as constants7, existsSync as existsSync32 } from "fs";
|
|
78271
|
-
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile22, rename as rename5, writeFile as
|
|
78535
|
+
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile22, rename as rename5, writeFile as writeFile13 } from "fs/promises";
|
|
78272
78536
|
import { homedir as homedir9 } from "os";
|
|
78273
|
-
import { dirname as
|
|
78537
|
+
import { dirname as dirname21, join as join58, resolve as resolve18 } from "path";
|
|
78274
78538
|
import { fileURLToPath } from "url";
|
|
78275
78539
|
import { promisify as promisify2 } from "util";
|
|
78276
78540
|
var execFileAsync2 = promisify2(execFile3);
|
|
78277
78541
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
78278
|
-
|
|
78279
|
-
|
|
78280
|
-
|
|
78542
|
+
join58("extensions", "omo.js"),
|
|
78543
|
+
join58("skills", "ultrawork", "SKILL.md"),
|
|
78544
|
+
join58("skills", "ulw-loop", "SKILL.md")
|
|
78281
78545
|
];
|
|
78282
78546
|
async function runSenpiInstaller(options = {}) {
|
|
78283
78547
|
const context = resolveInstallContext(options);
|
|
@@ -78301,14 +78565,14 @@ async function runSenpiInstaller(options = {}) {
|
|
|
78301
78565
|
}
|
|
78302
78566
|
function resolveInstallContext(options) {
|
|
78303
78567
|
const env3 = options.env ?? process.env;
|
|
78304
|
-
const repoRoot = resolve18(options.repoRoot ?? findRepoRoot2(
|
|
78305
|
-
const agentDir = resolve18(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ??
|
|
78306
|
-
const pluginPath = resolve18(options.pluginPath ??
|
|
78568
|
+
const repoRoot = resolve18(options.repoRoot ?? findRepoRoot2(dirname21(fileURLToPath(import.meta.url))));
|
|
78569
|
+
const agentDir = resolve18(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ?? join58(homedir9(), ".senpi", "agent"));
|
|
78570
|
+
const pluginPath = resolve18(options.pluginPath ?? join58(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
78307
78571
|
return {
|
|
78308
78572
|
env: env3,
|
|
78309
78573
|
repoRoot,
|
|
78310
78574
|
agentDir,
|
|
78311
|
-
settingsPath:
|
|
78575
|
+
settingsPath: join58(agentDir, "settings.json"),
|
|
78312
78576
|
pluginPath,
|
|
78313
78577
|
runCommand: options.runCommand ?? defaultRunCommand3
|
|
78314
78578
|
};
|
|
@@ -78317,12 +78581,12 @@ async function ensurePluginArtifacts(context) {
|
|
|
78317
78581
|
const missing = await hasMissingPluginArtifact(context.pluginPath);
|
|
78318
78582
|
if (!missing)
|
|
78319
78583
|
return;
|
|
78320
|
-
await context.runCommand("node", [
|
|
78321
|
-
await context.runCommand("node", [
|
|
78584
|
+
await context.runCommand("node", [join58(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
78585
|
+
await context.runCommand("node", [join58(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
78322
78586
|
}
|
|
78323
78587
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
78324
78588
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
78325
|
-
if (!await fileExists(
|
|
78589
|
+
if (!await fileExists(join58(pluginPath, artifact)))
|
|
78326
78590
|
return true;
|
|
78327
78591
|
}
|
|
78328
78592
|
return false;
|
|
@@ -78361,16 +78625,16 @@ function dedupePackages(packages) {
|
|
|
78361
78625
|
return [...new Set(packages)];
|
|
78362
78626
|
}
|
|
78363
78627
|
async function writeSettingsAtomically(settingsPath, settings) {
|
|
78364
|
-
await mkdir9(
|
|
78628
|
+
await mkdir9(dirname21(settingsPath), { recursive: true });
|
|
78365
78629
|
const backupPath = await nextBackupPath(settingsPath);
|
|
78366
78630
|
if (await fileExists(settingsPath)) {
|
|
78367
78631
|
await copyFile3(settingsPath, backupPath);
|
|
78368
78632
|
} else {
|
|
78369
|
-
await
|
|
78633
|
+
await writeFile13(backupPath, `{}
|
|
78370
78634
|
`, "utf8");
|
|
78371
78635
|
}
|
|
78372
78636
|
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
|
|
78373
|
-
await
|
|
78637
|
+
await writeFile13(tempPath, `${JSON.stringify(settings, null, 2)}
|
|
78374
78638
|
`, "utf8");
|
|
78375
78639
|
await rename5(tempPath, settingsPath);
|
|
78376
78640
|
return backupPath;
|
|
@@ -78390,7 +78654,7 @@ function timestampForBackup() {
|
|
|
78390
78654
|
function findRepoRoot2(importerDir) {
|
|
78391
78655
|
let current = importerDir;
|
|
78392
78656
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
78393
|
-
if (fileExistsSync(
|
|
78657
|
+
if (fileExistsSync(join58(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
78394
78658
|
return current;
|
|
78395
78659
|
current = resolve18(current, "..");
|
|
78396
78660
|
}
|
|
@@ -78449,26 +78713,26 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
78449
78713
|
init_provider_availability();
|
|
78450
78714
|
|
|
78451
78715
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
78452
|
-
import { existsSync as existsSync34, mkdirSync as mkdirSync10, readFileSync as
|
|
78453
|
-
import { join as
|
|
78716
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync10, readFileSync as readFileSync17 } from "fs";
|
|
78717
|
+
import { join as join60 } from "path";
|
|
78454
78718
|
|
|
78455
78719
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
78456
78720
|
init_shared();
|
|
78457
|
-
import { existsSync as existsSync33, readFileSync as
|
|
78458
|
-
import { join as
|
|
78721
|
+
import { existsSync as existsSync33, readFileSync as readFileSync16 } from "fs";
|
|
78722
|
+
import { join as join59 } from "path";
|
|
78459
78723
|
var TUI_SUBPATH = "tui";
|
|
78460
78724
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
78461
78725
|
function fileEntryPackageJsonPath(entry) {
|
|
78462
78726
|
let path7 = entry.slice("file:".length);
|
|
78463
78727
|
if (path7.startsWith("//"))
|
|
78464
78728
|
path7 = path7.slice(2);
|
|
78465
|
-
return
|
|
78729
|
+
return join59(path7, "package.json");
|
|
78466
78730
|
}
|
|
78467
78731
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
78468
78732
|
if (!existsSync33(pkgJsonPath))
|
|
78469
78733
|
return null;
|
|
78470
78734
|
try {
|
|
78471
|
-
const parsed = JSON.parse(
|
|
78735
|
+
const parsed = JSON.parse(readFileSync16(pkgJsonPath, "utf-8"));
|
|
78472
78736
|
if (parsed.exports === undefined)
|
|
78473
78737
|
return null;
|
|
78474
78738
|
if (typeof parsed.exports === "string")
|
|
@@ -78500,7 +78764,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
78500
78764
|
const packageName = packageNameFromServerEntry(entry);
|
|
78501
78765
|
if (packageName === null)
|
|
78502
78766
|
return null;
|
|
78503
|
-
return packageJsonExportsTui(
|
|
78767
|
+
return packageJsonExportsTui(join59(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
78504
78768
|
}
|
|
78505
78769
|
function isOurFilePluginEntry(entry) {
|
|
78506
78770
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -78509,7 +78773,7 @@ function isOurFilePluginEntry(entry) {
|
|
|
78509
78773
|
const pkgJsonPath = fileEntryPackageJsonPath(entry);
|
|
78510
78774
|
if (!existsSync33(pkgJsonPath))
|
|
78511
78775
|
return false;
|
|
78512
|
-
const parsed = JSON.parse(
|
|
78776
|
+
const parsed = JSON.parse(readFileSync16(pkgJsonPath, "utf-8"));
|
|
78513
78777
|
return typeof parsed.name === "string" && ACCEPTED_PACKAGE_NAMES.includes(parsed.name);
|
|
78514
78778
|
} catch (error) {
|
|
78515
78779
|
log2("[tui-plugin-config] Failed to inspect file plugin package", {
|
|
@@ -78547,7 +78811,7 @@ function detectServerPluginRegistration() {
|
|
|
78547
78811
|
return { registered: false, configPath: null, entry: null, packageExportsTui: null };
|
|
78548
78812
|
}
|
|
78549
78813
|
try {
|
|
78550
|
-
const parsed = parseJsonc(
|
|
78814
|
+
const parsed = parseJsonc(readFileSync16(configPath, "utf-8"));
|
|
78551
78815
|
const plugins = parsed.plugin ?? [];
|
|
78552
78816
|
const serverEntry = plugins.find(isServerPluginEntry);
|
|
78553
78817
|
return {
|
|
@@ -78565,7 +78829,7 @@ function detectServerPluginRegistration() {
|
|
|
78565
78829
|
}
|
|
78566
78830
|
}
|
|
78567
78831
|
function detectTuiPluginRegistration() {
|
|
78568
|
-
const tuiJsonPath =
|
|
78832
|
+
const tuiJsonPath = join59(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
78569
78833
|
if (!existsSync33(tuiJsonPath)) {
|
|
78570
78834
|
return {
|
|
78571
78835
|
registered: false,
|
|
@@ -78577,7 +78841,7 @@ function detectTuiPluginRegistration() {
|
|
|
78577
78841
|
};
|
|
78578
78842
|
}
|
|
78579
78843
|
try {
|
|
78580
|
-
const parsed = parseJsonc(
|
|
78844
|
+
const parsed = parseJsonc(readFileSync16(tuiJsonPath, "utf-8"));
|
|
78581
78845
|
const plugins = parsed.plugin ?? [];
|
|
78582
78846
|
return {
|
|
78583
78847
|
registered: plugins.some(isTuiPluginEntry),
|
|
@@ -78710,7 +78974,7 @@ init_shared();
|
|
|
78710
78974
|
init_write_file_atomically2();
|
|
78711
78975
|
function readConfig(path7) {
|
|
78712
78976
|
try {
|
|
78713
|
-
const parsed = parseJsonc(
|
|
78977
|
+
const parsed = parseJsonc(readFileSync17(path7, "utf-8"));
|
|
78714
78978
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
78715
78979
|
return parsed;
|
|
78716
78980
|
}
|
|
@@ -78721,10 +78985,10 @@ function readConfig(path7) {
|
|
|
78721
78985
|
return null;
|
|
78722
78986
|
}
|
|
78723
78987
|
function readServerConfig(configDir) {
|
|
78724
|
-
const jsoncPath =
|
|
78988
|
+
const jsoncPath = join60(configDir, "opencode.jsonc");
|
|
78725
78989
|
if (existsSync34(jsoncPath))
|
|
78726
78990
|
return readConfig(jsoncPath);
|
|
78727
|
-
const jsonPath =
|
|
78991
|
+
const jsonPath = join60(configDir, "opencode.json");
|
|
78728
78992
|
if (existsSync34(jsonPath))
|
|
78729
78993
|
return readConfig(jsonPath);
|
|
78730
78994
|
return null;
|
|
@@ -78766,7 +79030,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
78766
79030
|
if (!desiredEntry) {
|
|
78767
79031
|
return { changed: false, reason: "no-server-entry" };
|
|
78768
79032
|
}
|
|
78769
|
-
const tuiJsonPath =
|
|
79033
|
+
const tuiJsonPath = join60(configDir, "tui.json");
|
|
78770
79034
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
78771
79035
|
if (malformed) {
|
|
78772
79036
|
return { changed: false, reason: "malformed" };
|
|
@@ -78782,7 +79046,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
78782
79046
|
|
|
78783
79047
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
78784
79048
|
import { homedir as homedir10 } from "os";
|
|
78785
|
-
import { join as
|
|
79049
|
+
import { join as join61 } from "path";
|
|
78786
79050
|
|
|
78787
79051
|
// packages/shared-skills/index.mjs
|
|
78788
79052
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -78801,9 +79065,9 @@ function describeResult2(result) {
|
|
|
78801
79065
|
}
|
|
78802
79066
|
async function installAstGrepForOpenCode(options = {}) {
|
|
78803
79067
|
const platform = options.platform ?? process.platform;
|
|
78804
|
-
const baseDir =
|
|
79068
|
+
const baseDir = join61(options.homeDir ?? homedir10(), ".omo");
|
|
78805
79069
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
78806
|
-
const skillDir =
|
|
79070
|
+
const skillDir = join61(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
78807
79071
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
78808
79072
|
try {
|
|
78809
79073
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -96798,7 +97062,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
96798
97062
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
96799
97063
|
init_bun_which_shim();
|
|
96800
97064
|
init_spawn_with_windows_hide();
|
|
96801
|
-
import { delimiter as delimiter2, dirname as
|
|
97065
|
+
import { delimiter as delimiter2, dirname as dirname23, posix as posix4, win32 as win324 } from "path";
|
|
96802
97066
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
96803
97067
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
96804
97068
|
function getCommandCandidates(platform) {
|
|
@@ -96856,7 +97120,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
96856
97120
|
return null;
|
|
96857
97121
|
}
|
|
96858
97122
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
96859
|
-
const preferredDir =
|
|
97123
|
+
const preferredDir = dirname23(binaryPath);
|
|
96860
97124
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
96861
97125
|
return [preferredDir, ...existing].join(delimiter2);
|
|
96862
97126
|
}
|
|
@@ -97249,7 +97513,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
97249
97513
|
var NOTEPAD_DIR = "notepads";
|
|
97250
97514
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
97251
97515
|
// packages/boulder-state/src/top-level-task.ts
|
|
97252
|
-
import { existsSync as existsSync37, readFileSync as
|
|
97516
|
+
import { existsSync as existsSync37, readFileSync as readFileSync19 } from "fs";
|
|
97253
97517
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
97254
97518
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
97255
97519
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -97276,7 +97540,7 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
97276
97540
|
return null;
|
|
97277
97541
|
}
|
|
97278
97542
|
try {
|
|
97279
|
-
const content =
|
|
97543
|
+
const content = readFileSync19(planPath, "utf-8");
|
|
97280
97544
|
const lines = content.split(/\r?\n/);
|
|
97281
97545
|
let section = "other";
|
|
97282
97546
|
for (const line of lines) {
|
|
@@ -97302,12 +97566,12 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
97302
97566
|
}
|
|
97303
97567
|
// packages/boulder-state/src/storage/path.ts
|
|
97304
97568
|
import { existsSync as existsSync38 } from "fs";
|
|
97305
|
-
import { isAbsolute as
|
|
97569
|
+
import { isAbsolute as isAbsolute12, join as join63, relative as relative8, resolve as resolve19 } from "path";
|
|
97306
97570
|
function getBoulderFilePath(directory) {
|
|
97307
|
-
return
|
|
97571
|
+
return join63(directory, BOULDER_DIR, BOULDER_FILE);
|
|
97308
97572
|
}
|
|
97309
97573
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
97310
|
-
return
|
|
97574
|
+
return isAbsolute12(trackedPath) ? resolve19(trackedPath) : resolve19(baseDirectory, trackedPath);
|
|
97311
97575
|
}
|
|
97312
97576
|
function resolveBoulderPlanPath(directory, state) {
|
|
97313
97577
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -97317,7 +97581,7 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
97317
97581
|
}
|
|
97318
97582
|
const absoluteDirectory = resolve19(directory);
|
|
97319
97583
|
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
97320
|
-
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") ||
|
|
97584
|
+
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute12(relativePlanPath)) {
|
|
97321
97585
|
return absolutePlanPath;
|
|
97322
97586
|
}
|
|
97323
97587
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
@@ -97328,7 +97592,7 @@ function resolveBoulderPlanPathForWork(directory, work) {
|
|
|
97328
97592
|
return resolveBoulderPlanPath(directory, work);
|
|
97329
97593
|
}
|
|
97330
97594
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
97331
|
-
import { existsSync as existsSync39, readFileSync as
|
|
97595
|
+
import { existsSync as existsSync39, readFileSync as readFileSync20, readdirSync as readdirSync5, statSync as statSync5 } from "fs";
|
|
97332
97596
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
97333
97597
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
97334
97598
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -97341,7 +97605,7 @@ function getPlanProgress(planPath) {
|
|
|
97341
97605
|
return { total: 0, completed: 0, isComplete: false };
|
|
97342
97606
|
}
|
|
97343
97607
|
try {
|
|
97344
|
-
const content =
|
|
97608
|
+
const content = readFileSync20(planPath, "utf-8");
|
|
97345
97609
|
const lines = content.split(/\r?\n/);
|
|
97346
97610
|
const hasStructuredSections = lines.some((line) => TODO_HEADING_PATTERN2.test(line) || FINAL_VERIFICATION_HEADING_PATTERN2.test(line));
|
|
97347
97611
|
if (hasStructuredSections) {
|
|
@@ -97457,14 +97721,14 @@ function selectMirrorWork(state) {
|
|
|
97457
97721
|
return sorted[0] ?? null;
|
|
97458
97722
|
}
|
|
97459
97723
|
// packages/boulder-state/src/storage/read-state.ts
|
|
97460
|
-
import { existsSync as existsSync40, readFileSync as
|
|
97724
|
+
import { existsSync as existsSync40, readFileSync as readFileSync21 } from "fs";
|
|
97461
97725
|
function readBoulderState(directory) {
|
|
97462
97726
|
const filePath = getBoulderFilePath(directory);
|
|
97463
97727
|
if (!existsSync40(filePath)) {
|
|
97464
97728
|
return null;
|
|
97465
97729
|
}
|
|
97466
97730
|
try {
|
|
97467
|
-
const content =
|
|
97731
|
+
const content = readFileSync21(filePath, "utf-8");
|
|
97468
97732
|
const parsed = JSON.parse(content);
|
|
97469
97733
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
97470
97734
|
return null;
|
|
@@ -97530,17 +97794,17 @@ init_state();
|
|
|
97530
97794
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
97531
97795
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
97532
97796
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
97533
|
-
import { existsSync as existsSync41, mkdirSync as mkdirSync11, readFileSync as
|
|
97534
|
-
import { join as
|
|
97797
|
+
import { existsSync as existsSync41, mkdirSync as mkdirSync11, readFileSync as readFileSync22, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
97798
|
+
import { join as join64 } from "path";
|
|
97535
97799
|
function getMarkerPath(directory, sessionID) {
|
|
97536
|
-
return
|
|
97800
|
+
return join64(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
97537
97801
|
}
|
|
97538
97802
|
function readContinuationMarker(directory, sessionID) {
|
|
97539
97803
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
97540
97804
|
if (!existsSync41(markerPath))
|
|
97541
97805
|
return null;
|
|
97542
97806
|
try {
|
|
97543
|
-
const raw =
|
|
97807
|
+
const raw = readFileSync22(markerPath, "utf-8");
|
|
97544
97808
|
const parsed = JSON.parse(raw);
|
|
97545
97809
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
97546
97810
|
return null;
|
|
@@ -97605,8 +97869,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
97605
97869
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
97606
97870
|
init_shared();
|
|
97607
97871
|
init_compaction_marker();
|
|
97608
|
-
import { readFileSync as
|
|
97609
|
-
import { join as
|
|
97872
|
+
import { readFileSync as readFileSync23, readdirSync as readdirSync6 } from "fs";
|
|
97873
|
+
import { join as join65 } from "path";
|
|
97610
97874
|
var defaultSessionLastAgentDeps = {
|
|
97611
97875
|
getMessageDir,
|
|
97612
97876
|
isSqliteBackend,
|
|
@@ -97666,7 +97930,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
97666
97930
|
try {
|
|
97667
97931
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
97668
97932
|
try {
|
|
97669
|
-
const content =
|
|
97933
|
+
const content = readFileSync23(join65(messageDir, fileName), "utf-8");
|
|
97670
97934
|
const parsed = JSON.parse(content);
|
|
97671
97935
|
return {
|
|
97672
97936
|
fileName,
|
|
@@ -97709,8 +97973,8 @@ init_agent_display_names();
|
|
|
97709
97973
|
|
|
97710
97974
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
97711
97975
|
init_frontmatter2();
|
|
97712
|
-
import { existsSync as existsSync42, readFileSync as
|
|
97713
|
-
import { dirname as
|
|
97976
|
+
import { existsSync as existsSync42, readFileSync as readFileSync24, writeFileSync as writeFileSync7, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "fs";
|
|
97977
|
+
import { dirname as dirname24, join as join66 } from "path";
|
|
97714
97978
|
|
|
97715
97979
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
97716
97980
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -97719,7 +97983,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
97719
97983
|
|
|
97720
97984
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
97721
97985
|
function getStateFilePath(directory, customPath) {
|
|
97722
|
-
return customPath ?
|
|
97986
|
+
return customPath ? join66(directory, customPath) : join66(directory, DEFAULT_STATE_FILE);
|
|
97723
97987
|
}
|
|
97724
97988
|
function readState(directory, customPath) {
|
|
97725
97989
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -97727,7 +97991,7 @@ function readState(directory, customPath) {
|
|
|
97727
97991
|
return null;
|
|
97728
97992
|
}
|
|
97729
97993
|
try {
|
|
97730
|
-
const content =
|
|
97994
|
+
const content = readFileSync24(filePath, "utf-8");
|
|
97731
97995
|
const { data, body } = parseFrontmatter(content);
|
|
97732
97996
|
const active = data.active;
|
|
97733
97997
|
const iteration = data.iteration;
|
|
@@ -98802,14 +99066,14 @@ async function getLocalVersion(options = {}) {
|
|
|
98802
99066
|
}
|
|
98803
99067
|
}
|
|
98804
99068
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
98805
|
-
import { existsSync as existsSync53, readFileSync as
|
|
99069
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34 } from "fs";
|
|
98806
99070
|
|
|
98807
99071
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
98808
99072
|
init_extract_semver();
|
|
98809
99073
|
init_bun_which_shim();
|
|
98810
99074
|
import { existsSync as existsSync50, accessSync as accessSync4, constants as constants10 } from "fs";
|
|
98811
99075
|
import { homedir as homedir14 } from "os";
|
|
98812
|
-
import { join as
|
|
99076
|
+
import { join as join73 } from "path";
|
|
98813
99077
|
|
|
98814
99078
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
98815
99079
|
init_spawn_with_windows_hide();
|
|
@@ -98901,17 +99165,17 @@ function getDesktopAppPaths(platform) {
|
|
|
98901
99165
|
case "darwin":
|
|
98902
99166
|
return [
|
|
98903
99167
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
98904
|
-
|
|
99168
|
+
join73(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
98905
99169
|
];
|
|
98906
99170
|
case "win32": {
|
|
98907
99171
|
const programFiles = process.env.ProgramFiles;
|
|
98908
99172
|
const localAppData = process.env.LOCALAPPDATA;
|
|
98909
99173
|
const paths = [];
|
|
98910
99174
|
if (programFiles) {
|
|
98911
|
-
paths.push(
|
|
99175
|
+
paths.push(join73(programFiles, "OpenCode", "OpenCode.exe"));
|
|
98912
99176
|
}
|
|
98913
99177
|
if (localAppData) {
|
|
98914
|
-
paths.push(
|
|
99178
|
+
paths.push(join73(localAppData, "OpenCode", "OpenCode.exe"));
|
|
98915
99179
|
}
|
|
98916
99180
|
return paths;
|
|
98917
99181
|
}
|
|
@@ -98919,8 +99183,8 @@ function getDesktopAppPaths(platform) {
|
|
|
98919
99183
|
return [
|
|
98920
99184
|
"/usr/bin/opencode",
|
|
98921
99185
|
"/usr/lib/opencode/opencode",
|
|
98922
|
-
|
|
98923
|
-
|
|
99186
|
+
join73(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
99187
|
+
join73(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
98924
99188
|
];
|
|
98925
99189
|
default:
|
|
98926
99190
|
return [];
|
|
@@ -98952,7 +99216,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
98952
99216
|
const candidates = getCommandCandidates2(platform);
|
|
98953
99217
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
98954
99218
|
for (const command of candidates) {
|
|
98955
|
-
const fullPath =
|
|
99219
|
+
const fullPath = join73(entry, command);
|
|
98956
99220
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
98957
99221
|
return { binary: command, path: fullPath };
|
|
98958
99222
|
}
|
|
@@ -98998,7 +99262,7 @@ function compareVersions3(current, minimum) {
|
|
|
98998
99262
|
|
|
98999
99263
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
99000
99264
|
init_shared();
|
|
99001
|
-
import { existsSync as existsSync51, readFileSync as
|
|
99265
|
+
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "fs";
|
|
99002
99266
|
function detectConfigPath() {
|
|
99003
99267
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
99004
99268
|
if (existsSync51(paths.configJsonc))
|
|
@@ -99049,7 +99313,7 @@ function getPluginInfo() {
|
|
|
99049
99313
|
};
|
|
99050
99314
|
}
|
|
99051
99315
|
try {
|
|
99052
|
-
const content =
|
|
99316
|
+
const content = readFileSync32(configPath, "utf-8");
|
|
99053
99317
|
const parsedConfig = parseJsonc(content);
|
|
99054
99318
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
99055
99319
|
if (!pluginEntry) {
|
|
@@ -99091,25 +99355,25 @@ init_file_utils2();
|
|
|
99091
99355
|
init_checker();
|
|
99092
99356
|
init_auto_update_checker();
|
|
99093
99357
|
init_package_json_locator();
|
|
99094
|
-
import { existsSync as existsSync52, readFileSync as
|
|
99358
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33, readdirSync as readdirSync8 } from "fs";
|
|
99095
99359
|
import { createRequire as createRequire2 } from "module";
|
|
99096
99360
|
import { homedir as homedir15 } from "os";
|
|
99097
|
-
import { join as
|
|
99361
|
+
import { join as join74 } from "path";
|
|
99098
99362
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
99099
99363
|
init_shared();
|
|
99100
99364
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
99101
99365
|
if (platform === "darwin")
|
|
99102
|
-
return
|
|
99366
|
+
return join74(homedir15(), "Library", "Caches");
|
|
99103
99367
|
if (platform === "win32")
|
|
99104
|
-
return process.env.LOCALAPPDATA ??
|
|
99105
|
-
return
|
|
99368
|
+
return process.env.LOCALAPPDATA ?? join74(homedir15(), "AppData", "Local");
|
|
99369
|
+
return join74(homedir15(), ".cache");
|
|
99106
99370
|
}
|
|
99107
99371
|
function resolveOpenCodeCacheDir() {
|
|
99108
99372
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
99109
99373
|
if (xdgCacheHome)
|
|
99110
|
-
return
|
|
99374
|
+
return join74(xdgCacheHome, "opencode");
|
|
99111
99375
|
const fromShared = getOpenCodeCacheDir();
|
|
99112
|
-
const platformDefault =
|
|
99376
|
+
const platformDefault = join74(getPlatformDefaultCacheDir(), "opencode");
|
|
99113
99377
|
if (existsSync52(fromShared) || !existsSync52(platformDefault))
|
|
99114
99378
|
return fromShared;
|
|
99115
99379
|
return platformDefault;
|
|
@@ -99123,7 +99387,7 @@ function readPackageJson(filePath) {
|
|
|
99123
99387
|
if (!existsSync52(filePath))
|
|
99124
99388
|
return null;
|
|
99125
99389
|
try {
|
|
99126
|
-
const content =
|
|
99390
|
+
const content = readFileSync33(filePath, "utf-8");
|
|
99127
99391
|
return parseJsonc(content);
|
|
99128
99392
|
} catch (error51) {
|
|
99129
99393
|
if (!(error51 instanceof Error)) {
|
|
@@ -99141,11 +99405,11 @@ function normalizeVersion(value) {
|
|
|
99141
99405
|
function createPackageCandidates(rootDir) {
|
|
99142
99406
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
99143
99407
|
packageName,
|
|
99144
|
-
installedPackagePath:
|
|
99408
|
+
installedPackagePath: join74(rootDir, "node_modules", packageName, "package.json")
|
|
99145
99409
|
}));
|
|
99146
99410
|
}
|
|
99147
99411
|
function createTaggedInstallCandidates(rootDir) {
|
|
99148
|
-
const packagesDir =
|
|
99412
|
+
const packagesDir = join74(rootDir, "packages");
|
|
99149
99413
|
if (!existsSync52(packagesDir))
|
|
99150
99414
|
return [];
|
|
99151
99415
|
const candidates = [];
|
|
@@ -99153,14 +99417,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
99153
99417
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
99154
99418
|
if (packageName === undefined)
|
|
99155
99419
|
continue;
|
|
99156
|
-
const installDir =
|
|
99420
|
+
const installDir = join74(packagesDir, entryName);
|
|
99157
99421
|
candidates.push({
|
|
99158
99422
|
cacheDir: installDir,
|
|
99159
|
-
cachePackagePath:
|
|
99423
|
+
cachePackagePath: join74(installDir, "package.json"),
|
|
99160
99424
|
packageCandidates: [
|
|
99161
99425
|
{
|
|
99162
99426
|
packageName,
|
|
99163
|
-
installedPackagePath:
|
|
99427
|
+
installedPackagePath: join74(installDir, "node_modules", packageName, "package.json")
|
|
99164
99428
|
}
|
|
99165
99429
|
]
|
|
99166
99430
|
});
|
|
@@ -99205,13 +99469,13 @@ function getLoadedPluginVersion() {
|
|
|
99205
99469
|
const candidates = [
|
|
99206
99470
|
{
|
|
99207
99471
|
cacheDir: configDir,
|
|
99208
|
-
cachePackagePath:
|
|
99472
|
+
cachePackagePath: join74(configDir, "package.json"),
|
|
99209
99473
|
packageCandidates: createPackageCandidates(configDir)
|
|
99210
99474
|
},
|
|
99211
99475
|
...createTaggedInstallCandidates(configDir),
|
|
99212
99476
|
{
|
|
99213
99477
|
cacheDir,
|
|
99214
|
-
cachePackagePath:
|
|
99478
|
+
cachePackagePath: join74(cacheDir, "package.json"),
|
|
99215
99479
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
99216
99480
|
},
|
|
99217
99481
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -99257,7 +99521,7 @@ var defaultDeps6 = {
|
|
|
99257
99521
|
getLatestPluginVersion,
|
|
99258
99522
|
getSuggestedInstallTag,
|
|
99259
99523
|
configExists: existsSync53,
|
|
99260
|
-
readConfigFile: (path14) =>
|
|
99524
|
+
readConfigFile: (path14) => readFileSync34(path14, "utf-8"),
|
|
99261
99525
|
parseConfigContent: (content) => parseJsonc(content)
|
|
99262
99526
|
};
|
|
99263
99527
|
var BUN_POSTINSTALL_HELPER_PACKAGE_NAME = "@code-yeongyu/comment-checker";
|
|
@@ -99402,9 +99666,9 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
99402
99666
|
|
|
99403
99667
|
// packages/omo-opencode/src/config/validate.ts
|
|
99404
99668
|
init_src();
|
|
99405
|
-
import { readFileSync as
|
|
99669
|
+
import { readFileSync as readFileSync35 } from "fs";
|
|
99406
99670
|
import { homedir as homedir16 } from "os";
|
|
99407
|
-
import { dirname as
|
|
99671
|
+
import { dirname as dirname29, relative as relative9 } from "path";
|
|
99408
99672
|
init_shared();
|
|
99409
99673
|
init_plugin_identity();
|
|
99410
99674
|
function resolveHomeDirectory2() {
|
|
@@ -99428,7 +99692,7 @@ function discoverProjectLayersNearestFirst(directory) {
|
|
|
99428
99692
|
const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
|
|
99429
99693
|
return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
|
|
99430
99694
|
path: configPath,
|
|
99431
|
-
configDir:
|
|
99695
|
+
configDir: dirname29(configPath)
|
|
99432
99696
|
}));
|
|
99433
99697
|
}
|
|
99434
99698
|
function shortPath(configPath) {
|
|
@@ -99447,12 +99711,12 @@ function schemaMessages(configPath, rawConfig) {
|
|
|
99447
99711
|
}
|
|
99448
99712
|
function parseLayerConfig(configPath) {
|
|
99449
99713
|
try {
|
|
99450
|
-
const content =
|
|
99714
|
+
const content = readFileSync35(configPath, "utf-8");
|
|
99451
99715
|
const rawConfig = parseJsonc(content);
|
|
99452
99716
|
if (!isPlainRecord(rawConfig)) {
|
|
99453
99717
|
return {
|
|
99454
99718
|
path: configPath,
|
|
99455
|
-
configDir:
|
|
99719
|
+
configDir: dirname29(configPath),
|
|
99456
99720
|
config: null,
|
|
99457
99721
|
messages: [`${shortPath(configPath)}: <root>: Expected object`]
|
|
99458
99722
|
};
|
|
@@ -99460,7 +99724,7 @@ function parseLayerConfig(configPath) {
|
|
|
99460
99724
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
99461
99725
|
return {
|
|
99462
99726
|
path: configPath,
|
|
99463
|
-
configDir:
|
|
99727
|
+
configDir: dirname29(configPath),
|
|
99464
99728
|
config: result.success ? result.data : parseConfigPartially(rawConfig),
|
|
99465
99729
|
messages: schemaMessages(configPath, rawConfig)
|
|
99466
99730
|
};
|
|
@@ -99470,7 +99734,7 @@ function parseLayerConfig(configPath) {
|
|
|
99470
99734
|
}
|
|
99471
99735
|
return {
|
|
99472
99736
|
path: configPath,
|
|
99473
|
-
configDir:
|
|
99737
|
+
configDir: dirname29(configPath),
|
|
99474
99738
|
config: null,
|
|
99475
99739
|
messages: [`${shortPath(configPath)}: ${error51.message}`]
|
|
99476
99740
|
};
|
|
@@ -99516,26 +99780,26 @@ function validatePluginConfig(directory) {
|
|
|
99516
99780
|
|
|
99517
99781
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
99518
99782
|
init_shared();
|
|
99519
|
-
import { existsSync as existsSync54, readFileSync as
|
|
99783
|
+
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "fs";
|
|
99520
99784
|
import { homedir as homedir17 } from "os";
|
|
99521
|
-
import { join as
|
|
99785
|
+
import { join as join75 } from "path";
|
|
99522
99786
|
function getUserConfigDir2() {
|
|
99523
99787
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
99524
99788
|
if (xdgConfig)
|
|
99525
|
-
return
|
|
99526
|
-
return
|
|
99789
|
+
return join75(xdgConfig, "opencode");
|
|
99790
|
+
return join75(homedir17(), ".config", "opencode");
|
|
99527
99791
|
}
|
|
99528
99792
|
function loadCustomProviderNames() {
|
|
99529
99793
|
const configDir = getUserConfigDir2();
|
|
99530
99794
|
const candidatePaths = [
|
|
99531
|
-
|
|
99532
|
-
|
|
99795
|
+
join75(configDir, "opencode.json"),
|
|
99796
|
+
join75(configDir, "opencode.jsonc")
|
|
99533
99797
|
];
|
|
99534
99798
|
for (const configPath of candidatePaths) {
|
|
99535
99799
|
if (!existsSync54(configPath))
|
|
99536
99800
|
continue;
|
|
99537
99801
|
try {
|
|
99538
|
-
const content =
|
|
99802
|
+
const content = readFileSync36(configPath, "utf-8");
|
|
99539
99803
|
const data = parseJsonc(content);
|
|
99540
99804
|
if (data?.provider && typeof data.provider === "object") {
|
|
99541
99805
|
return Object.keys(data.provider);
|
|
@@ -99550,7 +99814,7 @@ function loadCustomProviderNames() {
|
|
|
99550
99814
|
return [];
|
|
99551
99815
|
}
|
|
99552
99816
|
function loadAvailableModelsFromCache() {
|
|
99553
|
-
const cacheFile =
|
|
99817
|
+
const cacheFile = join75(getOpenCodeCacheDir(), "models.json");
|
|
99554
99818
|
const customProviders = loadCustomProviderNames();
|
|
99555
99819
|
if (!existsSync54(cacheFile)) {
|
|
99556
99820
|
if (customProviders.length > 0) {
|
|
@@ -99559,7 +99823,7 @@ function loadAvailableModelsFromCache() {
|
|
|
99559
99823
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
99560
99824
|
}
|
|
99561
99825
|
try {
|
|
99562
|
-
const content =
|
|
99826
|
+
const content = readFileSync36(cacheFile, "utf-8");
|
|
99563
99827
|
const data = parseJsonc(content);
|
|
99564
99828
|
const cacheProviders = Object.keys(data);
|
|
99565
99829
|
let modelCount = 0;
|
|
@@ -99586,9 +99850,9 @@ init_model_capabilities2();
|
|
|
99586
99850
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-config.ts
|
|
99587
99851
|
init_shared();
|
|
99588
99852
|
init_plugin_identity();
|
|
99589
|
-
import { readFileSync as
|
|
99590
|
-
import { join as
|
|
99591
|
-
var PROJECT_CONFIG_DIR =
|
|
99853
|
+
import { readFileSync as readFileSync37 } from "fs";
|
|
99854
|
+
import { join as join76 } from "path";
|
|
99855
|
+
var PROJECT_CONFIG_DIR = join76(process.cwd(), ".opencode");
|
|
99592
99856
|
function loadOmoConfig() {
|
|
99593
99857
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
99594
99858
|
basenames: [CONFIG_BASENAME],
|
|
@@ -99596,7 +99860,7 @@ function loadOmoConfig() {
|
|
|
99596
99860
|
});
|
|
99597
99861
|
if (projectDetected.format !== "none") {
|
|
99598
99862
|
try {
|
|
99599
|
-
const content =
|
|
99863
|
+
const content = readFileSync37(projectDetected.path, "utf-8");
|
|
99600
99864
|
return parseJsonc(content);
|
|
99601
99865
|
} catch (error51) {
|
|
99602
99866
|
if (error51 instanceof Error) {
|
|
@@ -99612,7 +99876,7 @@ function loadOmoConfig() {
|
|
|
99612
99876
|
});
|
|
99613
99877
|
if (userDetected.format !== "none") {
|
|
99614
99878
|
try {
|
|
99615
|
-
const content =
|
|
99879
|
+
const content = readFileSync37(userDetected.path, "utf-8");
|
|
99616
99880
|
return parseJsonc(content);
|
|
99617
99881
|
} catch (error51) {
|
|
99618
99882
|
if (error51 instanceof Error) {
|
|
@@ -99626,7 +99890,7 @@ function loadOmoConfig() {
|
|
|
99626
99890
|
|
|
99627
99891
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
99628
99892
|
init_shared();
|
|
99629
|
-
import { join as
|
|
99893
|
+
import { join as join77 } from "path";
|
|
99630
99894
|
|
|
99631
99895
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
99632
99896
|
function formatModelWithVariant(model, variant) {
|
|
@@ -99668,7 +99932,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
99668
99932
|
}
|
|
99669
99933
|
function buildModelResolutionDetails(options) {
|
|
99670
99934
|
const details = [];
|
|
99671
|
-
const cacheFile =
|
|
99935
|
+
const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
|
|
99672
99936
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
99673
99937
|
details.push("");
|
|
99674
99938
|
if (options.available.cacheExists) {
|
|
@@ -99947,25 +100211,25 @@ init_src();
|
|
|
99947
100211
|
import { existsSync as existsSync55 } from "fs";
|
|
99948
100212
|
import { createRequire as createRequire3 } from "module";
|
|
99949
100213
|
import { homedir as homedir19 } from "os";
|
|
99950
|
-
import { dirname as
|
|
100214
|
+
import { dirname as dirname30, join as join79 } from "path";
|
|
99951
100215
|
|
|
99952
100216
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
99953
|
-
import { join as
|
|
100217
|
+
import { join as join78 } from "path";
|
|
99954
100218
|
import { homedir as homedir18, tmpdir as tmpdir3 } from "os";
|
|
99955
100219
|
init_binary_downloader();
|
|
99956
100220
|
init_logger2();
|
|
99957
100221
|
init_plugin_identity();
|
|
99958
100222
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
99959
|
-
var DEBUG_FILE =
|
|
100223
|
+
var DEBUG_FILE = join78(tmpdir3(), "comment-checker-debug.log");
|
|
99960
100224
|
function getCacheDir2() {
|
|
99961
100225
|
if (process.platform === "win32") {
|
|
99962
100226
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
99963
|
-
const base2 = localAppData ||
|
|
99964
|
-
return
|
|
100227
|
+
const base2 = localAppData || join78(homedir18(), "AppData", "Local");
|
|
100228
|
+
return join78(base2, CACHE_DIR_NAME, "bin");
|
|
99965
100229
|
}
|
|
99966
100230
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
99967
|
-
const base = xdgCache ||
|
|
99968
|
-
return
|
|
100231
|
+
const base = xdgCache || join78(homedir18(), ".cache");
|
|
100232
|
+
return join78(base, CACHE_DIR_NAME, "bin");
|
|
99969
100233
|
}
|
|
99970
100234
|
function getBinaryName() {
|
|
99971
100235
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -100015,7 +100279,7 @@ async function getBinaryVersion(binary) {
|
|
|
100015
100279
|
}
|
|
100016
100280
|
}
|
|
100017
100281
|
async function checkAstGrepCli() {
|
|
100018
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
100282
|
+
const runtimeDir = astGrepRuntimeDir(join79(homedir19(), ".omo"));
|
|
100019
100283
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
100020
100284
|
if (sgPath === null) {
|
|
100021
100285
|
return {
|
|
@@ -100044,11 +100308,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
100044
100308
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
100045
100309
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
100046
100310
|
try {
|
|
100047
|
-
const packageDir = baseDirOverride ??
|
|
100048
|
-
const vendorPath =
|
|
100311
|
+
const packageDir = baseDirOverride ?? dirname30(resolvePackageJsonPath());
|
|
100312
|
+
const vendorPath = join79(packageDir, "vendor", platformKey, binaryName);
|
|
100049
100313
|
if (existsSync55(vendorPath))
|
|
100050
100314
|
return vendorPath;
|
|
100051
|
-
const binPath =
|
|
100315
|
+
const binPath = join79(packageDir, "bin", binaryName);
|
|
100052
100316
|
if (existsSync55(binPath))
|
|
100053
100317
|
return binPath;
|
|
100054
100318
|
} catch (error51) {
|
|
@@ -100193,12 +100457,12 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
100193
100457
|
}
|
|
100194
100458
|
|
|
100195
100459
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
100196
|
-
import { readFileSync as
|
|
100197
|
-
import { join as
|
|
100460
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
100461
|
+
import { join as join80 } from "path";
|
|
100198
100462
|
|
|
100199
100463
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
100200
100464
|
import { existsSync as existsSync56 } from "fs";
|
|
100201
|
-
import { delimiter as delimiter3, dirname as
|
|
100465
|
+
import { delimiter as delimiter3, dirname as dirname31, resolve as resolve21 } from "path";
|
|
100202
100466
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
100203
100467
|
|
|
100204
100468
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -100320,7 +100584,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
100320
100584
|
].join(";");
|
|
100321
100585
|
function getModuleDirectory(moduleUrl) {
|
|
100322
100586
|
try {
|
|
100323
|
-
return
|
|
100587
|
+
return dirname31(fileURLToPath7(moduleUrl));
|
|
100324
100588
|
} catch (error51) {
|
|
100325
100589
|
if (!(error51 instanceof Error))
|
|
100326
100590
|
throw error51;
|
|
@@ -100390,7 +100654,7 @@ function readOmoConfig(configDirectory) {
|
|
|
100390
100654
|
return null;
|
|
100391
100655
|
}
|
|
100392
100656
|
try {
|
|
100393
|
-
const content =
|
|
100657
|
+
const content = readFileSync38(detected.path, "utf-8");
|
|
100394
100658
|
return parseJsonc(content);
|
|
100395
100659
|
} catch (error51) {
|
|
100396
100660
|
if (!(error51 instanceof Error)) {
|
|
@@ -100401,7 +100665,7 @@ function readOmoConfig(configDirectory) {
|
|
|
100401
100665
|
}
|
|
100402
100666
|
function isLspMcpDisabled(options) {
|
|
100403
100667
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
100404
|
-
const projectConfigDirectory =
|
|
100668
|
+
const projectConfigDirectory = join80(options.cwd ?? process.cwd(), ".opencode");
|
|
100405
100669
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
100406
100670
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
100407
100671
|
const disabledMcps = new Set([
|
|
@@ -100420,15 +100684,15 @@ function getInstalledLspServers(options = {}) {
|
|
|
100420
100684
|
|
|
100421
100685
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
100422
100686
|
init_shared();
|
|
100423
|
-
import { existsSync as existsSync57, readFileSync as
|
|
100687
|
+
import { existsSync as existsSync57, readFileSync as readFileSync39 } from "fs";
|
|
100424
100688
|
import { homedir as homedir20 } from "os";
|
|
100425
|
-
import { join as
|
|
100689
|
+
import { join as join81 } from "path";
|
|
100426
100690
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
100427
100691
|
function getMcpConfigPaths() {
|
|
100428
100692
|
return [
|
|
100429
|
-
|
|
100430
|
-
|
|
100431
|
-
|
|
100693
|
+
join81(homedir20(), ".claude", ".mcp.json"),
|
|
100694
|
+
join81(process.cwd(), ".mcp.json"),
|
|
100695
|
+
join81(process.cwd(), ".claude", ".mcp.json")
|
|
100432
100696
|
];
|
|
100433
100697
|
}
|
|
100434
100698
|
function loadUserMcpConfig() {
|
|
@@ -100437,7 +100701,7 @@ function loadUserMcpConfig() {
|
|
|
100437
100701
|
if (!existsSync57(configPath))
|
|
100438
100702
|
continue;
|
|
100439
100703
|
try {
|
|
100440
|
-
const content =
|
|
100704
|
+
const content = readFileSync39(configPath, "utf-8");
|
|
100441
100705
|
const config3 = parseJsonc(content);
|
|
100442
100706
|
if (config3.mcpServers) {
|
|
100443
100707
|
Object.assign(servers, config3.mcpServers);
|
|
@@ -100572,7 +100836,7 @@ async function checkTools() {
|
|
|
100572
100836
|
|
|
100573
100837
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
100574
100838
|
init_src4();
|
|
100575
|
-
import { existsSync as existsSync58, readFileSync as
|
|
100839
|
+
import { existsSync as existsSync58, readFileSync as readFileSync40 } from "fs";
|
|
100576
100840
|
function isTelemetryState(value) {
|
|
100577
100841
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
100578
100842
|
}
|
|
@@ -100582,7 +100846,7 @@ function readLastActiveDay(stateFilePath) {
|
|
|
100582
100846
|
}
|
|
100583
100847
|
let parsed;
|
|
100584
100848
|
try {
|
|
100585
|
-
parsed = JSON.parse(
|
|
100849
|
+
parsed = JSON.parse(readFileSync40(stateFilePath, "utf-8"));
|
|
100586
100850
|
} catch (error51) {
|
|
100587
100851
|
if (error51 instanceof Error) {
|
|
100588
100852
|
return "unreadable";
|
|
@@ -100657,7 +100921,7 @@ function expandHomeDirectory(directoryPath) {
|
|
|
100657
100921
|
// packages/omo-opencode/src/cli/doctor/checks/team-mode.ts
|
|
100658
100922
|
init_shared();
|
|
100659
100923
|
init_plugin_identity();
|
|
100660
|
-
import { readFileSync as
|
|
100924
|
+
import { readFileSync as readFileSync41, promises as fs13 } from "fs";
|
|
100661
100925
|
import path15 from "path";
|
|
100662
100926
|
async function checkTeamMode() {
|
|
100663
100927
|
const config3 = loadTeamModeConfig();
|
|
@@ -100694,7 +100958,7 @@ function loadTeamModeConfig() {
|
|
|
100694
100958
|
if (!configPath)
|
|
100695
100959
|
return { team_mode: undefined };
|
|
100696
100960
|
try {
|
|
100697
|
-
return parseJsonc(
|
|
100961
|
+
return parseJsonc(readFileSync41(configPath, "utf-8"));
|
|
100698
100962
|
} catch (error51) {
|
|
100699
100963
|
if (error51 instanceof Error) {
|
|
100700
100964
|
return { team_mode: undefined };
|
|
@@ -100728,9 +100992,9 @@ async function pathExists(dir) {
|
|
|
100728
100992
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
100729
100993
|
init_src();
|
|
100730
100994
|
import { existsSync as existsSync59 } from "fs";
|
|
100731
|
-
import { lstat as
|
|
100995
|
+
import { lstat as lstat13, readdir as readdir11, readFile as readFile23 } from "fs/promises";
|
|
100732
100996
|
import { homedir as homedir22 } from "os";
|
|
100733
|
-
import { basename as basename13, join as
|
|
100997
|
+
import { basename as basename13, join as join82, resolve as resolve22 } from "path";
|
|
100734
100998
|
// packages/omo-opencode/package.json
|
|
100735
100999
|
var package_default3 = {
|
|
100736
101000
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -100788,13 +101052,13 @@ var CODEX_BIN_NAMES = [
|
|
|
100788
101052
|
"omo-git-bash-hook"
|
|
100789
101053
|
];
|
|
100790
101054
|
async function gatherCodexSummary(deps = {}) {
|
|
100791
|
-
const codexHome = resolve22(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
101055
|
+
const codexHome = resolve22(deps.codexHome ?? process.env.CODEX_HOME ?? join82(homedir22(), ".codex"));
|
|
100792
101056
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
100793
101057
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
100794
101058
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
100795
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
100796
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
100797
|
-
const configPath =
|
|
101059
|
+
const manifest = pluginRoot === null ? null : await readJson(join82(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
101060
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join82(pluginRoot, "lazycodex-install.json"));
|
|
101061
|
+
const configPath = join82(codexHome, "config.toml");
|
|
100798
101062
|
const pluginVersion = stringField(manifest, "version");
|
|
100799
101063
|
return {
|
|
100800
101064
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -100851,7 +101115,7 @@ function buildCodexIssues(summary) {
|
|
|
100851
101115
|
if (summary.pluginRoot === null) {
|
|
100852
101116
|
issues.push({
|
|
100853
101117
|
title: "OMO Codex plugin is not installed",
|
|
100854
|
-
description: `Expected cached plugin at ${
|
|
101118
|
+
description: `Expected cached plugin at ${join82("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
100855
101119
|
fix: "Run: npx lazycodex-ai install",
|
|
100856
101120
|
severity: "error",
|
|
100857
101121
|
affects: ["plugin loading"]
|
|
@@ -100916,12 +101180,12 @@ function buildCodexIssues(summary) {
|
|
|
100916
101180
|
return issues;
|
|
100917
101181
|
}
|
|
100918
101182
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
100919
|
-
const pluginRoot =
|
|
101183
|
+
const pluginRoot = join82(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
100920
101184
|
if (!existsSync59(pluginRoot))
|
|
100921
101185
|
return null;
|
|
100922
|
-
const versions2 = await
|
|
101186
|
+
const versions2 = await readdir11(pluginRoot, { withFileTypes: true });
|
|
100923
101187
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
100924
|
-
return candidates.length === 0 ? null :
|
|
101188
|
+
return candidates.length === 0 ? null : join82(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
100925
101189
|
}
|
|
100926
101190
|
async function readCodexConfigSummary(configPath) {
|
|
100927
101191
|
if (!existsSync59(configPath)) {
|
|
@@ -100949,16 +101213,16 @@ async function readCodexConfigSummary(configPath) {
|
|
|
100949
101213
|
async function readLinkedBins(binDir) {
|
|
100950
101214
|
const linked = [];
|
|
100951
101215
|
for (const name of CODEX_BIN_NAMES) {
|
|
100952
|
-
if (await pathExists2(
|
|
101216
|
+
if (await pathExists2(join82(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
100953
101217
|
linked.push(name);
|
|
100954
101218
|
}
|
|
100955
101219
|
return linked;
|
|
100956
101220
|
}
|
|
100957
101221
|
async function readLinkedAgents(codexHome) {
|
|
100958
|
-
const agentsDir =
|
|
101222
|
+
const agentsDir = join82(codexHome, "agents");
|
|
100959
101223
|
if (!existsSync59(agentsDir))
|
|
100960
101224
|
return [];
|
|
100961
|
-
const entries = await
|
|
101225
|
+
const entries = await readdir11(agentsDir, { withFileTypes: true });
|
|
100962
101226
|
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename13(entry.name, ".toml")).sort();
|
|
100963
101227
|
}
|
|
100964
101228
|
async function readJson(path16) {
|
|
@@ -101058,7 +101322,7 @@ function compareVersionsDescending(left, right) {
|
|
|
101058
101322
|
}
|
|
101059
101323
|
async function pathExists2(path16) {
|
|
101060
101324
|
try {
|
|
101061
|
-
await
|
|
101325
|
+
await lstat13(path16);
|
|
101062
101326
|
return true;
|
|
101063
101327
|
} catch (error51) {
|
|
101064
101328
|
if (error51 instanceof Error)
|
|
@@ -101069,9 +101333,9 @@ async function pathExists2(path16) {
|
|
|
101069
101333
|
|
|
101070
101334
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
101071
101335
|
init_src();
|
|
101072
|
-
import { readdir as
|
|
101336
|
+
import { readdir as readdir12, readFile as readFile24, stat as stat6 } from "fs/promises";
|
|
101073
101337
|
import { homedir as homedir23 } from "os";
|
|
101074
|
-
import { dirname as
|
|
101338
|
+
import { dirname as dirname32, isAbsolute as isAbsolute13, join as join83, relative as relative10, resolve as resolve23, sep as sep9 } from "path";
|
|
101075
101339
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
101076
101340
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
101077
101341
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -101081,7 +101345,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
101081
101345
|
const env3 = deps.env ?? process.env;
|
|
101082
101346
|
const platform = deps.platform ?? process.platform;
|
|
101083
101347
|
const arch = deps.arch ?? process.arch;
|
|
101084
|
-
const codexHome = resolve23(deps.codexHome ?? env3["CODEX_HOME"] ??
|
|
101348
|
+
const codexHome = resolve23(deps.codexHome ?? env3["CODEX_HOME"] ?? join83(homedir23(), ".codex"));
|
|
101085
101349
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
101086
101350
|
if (summary.pluginRoot === null) {
|
|
101087
101351
|
return {
|
|
@@ -101106,7 +101370,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
101106
101370
|
});
|
|
101107
101371
|
}
|
|
101108
101372
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
101109
|
-
const runtimeSgPath =
|
|
101373
|
+
const runtimeSgPath = join83(runtimeSgDir, sgBinaryName(platform));
|
|
101110
101374
|
const sg = findSgBinarySync({
|
|
101111
101375
|
arch,
|
|
101112
101376
|
env: env3,
|
|
@@ -101143,12 +101407,12 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
101143
101407
|
let referencedCount = 0;
|
|
101144
101408
|
for (const manifestPath of await findManifestPaths(pluginRoot, ".mcp.json")) {
|
|
101145
101409
|
const manifest = await readJson2(manifestPath);
|
|
101146
|
-
if (manifest === null || !
|
|
101410
|
+
if (manifest === null || !isRecord6(manifest["mcpServers"]))
|
|
101147
101411
|
continue;
|
|
101148
|
-
const manifestRoot =
|
|
101412
|
+
const manifestRoot = dirname32(manifestPath);
|
|
101149
101413
|
const isRootManifest = resolve23(manifestRoot) === resolve23(pluginRoot);
|
|
101150
101414
|
for (const server2 of Object.values(manifest["mcpServers"])) {
|
|
101151
|
-
if (!
|
|
101415
|
+
if (!isRecord6(server2) || !Array.isArray(server2["args"]))
|
|
101152
101416
|
continue;
|
|
101153
101417
|
for (const arg of server2["args"]) {
|
|
101154
101418
|
if (typeof arg !== "string" || !isPluginRuntimePathArg(arg))
|
|
@@ -101166,7 +101430,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
101166
101430
|
continue;
|
|
101167
101431
|
const commands2 = [];
|
|
101168
101432
|
collectHookCommands(manifest, commands2);
|
|
101169
|
-
const hookPluginRoot =
|
|
101433
|
+
const hookPluginRoot = dirname32(dirname32(hookManifestPath));
|
|
101170
101434
|
for (const command of commands2) {
|
|
101171
101435
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
101172
101436
|
referencedCount += 1;
|
|
@@ -101205,12 +101469,12 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
101205
101469
|
}
|
|
101206
101470
|
async function findHookManifestPaths(root) {
|
|
101207
101471
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
101208
|
-
return paths2.filter((path16) =>
|
|
101472
|
+
return paths2.filter((path16) => dirname32(path16).endsWith(`${sep9}hooks`));
|
|
101209
101473
|
}
|
|
101210
101474
|
async function findManifestPaths(root, manifestName) {
|
|
101211
101475
|
let entries;
|
|
101212
101476
|
try {
|
|
101213
|
-
entries = await
|
|
101477
|
+
entries = await readdir12(root, { withFileTypes: true });
|
|
101214
101478
|
} catch {
|
|
101215
101479
|
return [];
|
|
101216
101480
|
}
|
|
@@ -101218,7 +101482,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
101218
101482
|
for (const entry of entries) {
|
|
101219
101483
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
101220
101484
|
continue;
|
|
101221
|
-
const entryPath =
|
|
101485
|
+
const entryPath = join83(root, entry.name);
|
|
101222
101486
|
if (entry.isDirectory()) {
|
|
101223
101487
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
101224
101488
|
continue;
|
|
@@ -101234,7 +101498,7 @@ function collectHookCommands(value, commands2) {
|
|
|
101234
101498
|
collectHookCommands(item, commands2);
|
|
101235
101499
|
return;
|
|
101236
101500
|
}
|
|
101237
|
-
if (!
|
|
101501
|
+
if (!isRecord6(value))
|
|
101238
101502
|
return;
|
|
101239
101503
|
if (value["type"] === "command") {
|
|
101240
101504
|
if (typeof value["command"] === "string")
|
|
@@ -101259,21 +101523,21 @@ function extractPluginRootPaths(command) {
|
|
|
101259
101523
|
}
|
|
101260
101524
|
function isPluginRuntimePathArg(arg) {
|
|
101261
101525
|
const normalized = normalizePathSeparators(arg);
|
|
101262
|
-
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") ||
|
|
101526
|
+
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute13(arg));
|
|
101263
101527
|
}
|
|
101264
101528
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
101265
|
-
return
|
|
101529
|
+
return join83(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
101266
101530
|
}
|
|
101267
101531
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
101268
101532
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
101269
101533
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
101270
101534
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
101271
|
-
if (sgPath ===
|
|
101535
|
+
if (sgPath === join83(runtimeSgDir, sgBinaryName(platform)))
|
|
101272
101536
|
return "runtime dir";
|
|
101273
101537
|
return "PATH";
|
|
101274
101538
|
}
|
|
101275
101539
|
async function readBootstrapStateSummary(codexHome) {
|
|
101276
|
-
const statePath =
|
|
101540
|
+
const statePath = join83(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
101277
101541
|
const raw = await readJson2(statePath);
|
|
101278
101542
|
if (raw === null)
|
|
101279
101543
|
return null;
|
|
@@ -101289,7 +101553,7 @@ function parseDegradedEntries(value) {
|
|
|
101289
101553
|
return [];
|
|
101290
101554
|
const entries = [];
|
|
101291
101555
|
for (const item of value) {
|
|
101292
|
-
if (!
|
|
101556
|
+
if (!isRecord6(item))
|
|
101293
101557
|
continue;
|
|
101294
101558
|
if (typeof item["component"] !== "string" || typeof item["reason"] !== "string")
|
|
101295
101559
|
continue;
|
|
@@ -101323,7 +101587,7 @@ function degradedDetailLines(entries) {
|
|
|
101323
101587
|
async function readJson2(path16) {
|
|
101324
101588
|
try {
|
|
101325
101589
|
const parsed = JSON.parse(await readFile24(path16, "utf8"));
|
|
101326
|
-
return
|
|
101590
|
+
return isRecord6(parsed) ? parsed : null;
|
|
101327
101591
|
} catch (error51) {
|
|
101328
101592
|
if (error51 instanceof Error)
|
|
101329
101593
|
return null;
|
|
@@ -101344,7 +101608,7 @@ function normalizeRelative(root, target) {
|
|
|
101344
101608
|
function normalizePathSeparators(path16) {
|
|
101345
101609
|
return path16.split("\\").join("/");
|
|
101346
101610
|
}
|
|
101347
|
-
function
|
|
101611
|
+
function isRecord6(value) {
|
|
101348
101612
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
101349
101613
|
}
|
|
101350
101614
|
|
|
@@ -101352,15 +101616,15 @@ function isRecord5(value) {
|
|
|
101352
101616
|
import { existsSync as existsSync60 } from "fs";
|
|
101353
101617
|
import { readFile as readFile25 } from "fs/promises";
|
|
101354
101618
|
import { homedir as homedir24 } from "os";
|
|
101355
|
-
import { join as
|
|
101619
|
+
import { join as join84, resolve as resolve24 } from "path";
|
|
101356
101620
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
101357
101621
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
101358
101622
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
101359
101623
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
101360
|
-
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
101624
|
+
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ?? join84(homedir24(), ".codex"));
|
|
101361
101625
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
101362
101626
|
const platform = deps.platform ?? process.platform;
|
|
101363
|
-
const wrapperPath =
|
|
101627
|
+
const wrapperPath = join84(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
101364
101628
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
101365
101629
|
const issues = [];
|
|
101366
101630
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -101867,17 +102131,17 @@ import {
|
|
|
101867
102131
|
existsSync as existsSync63,
|
|
101868
102132
|
mkdirSync as mkdirSync14,
|
|
101869
102133
|
readdirSync as readdirSync9,
|
|
101870
|
-
readFileSync as
|
|
102134
|
+
readFileSync as readFileSync43,
|
|
101871
102135
|
renameSync as renameSync7,
|
|
101872
102136
|
unlinkSync as unlinkSync8,
|
|
101873
102137
|
writeFileSync as writeFileSync11
|
|
101874
102138
|
} from "fs";
|
|
101875
|
-
import { basename as basename14, dirname as
|
|
102139
|
+
import { basename as basename14, dirname as dirname33, join as join87 } from "path";
|
|
101876
102140
|
|
|
101877
102141
|
// packages/mcp-client-core/src/config-dir.ts
|
|
101878
102142
|
import { existsSync as existsSync61, realpathSync as realpathSync8 } from "fs";
|
|
101879
102143
|
import { homedir as homedir25 } from "os";
|
|
101880
|
-
import { join as
|
|
102144
|
+
import { join as join85, resolve as resolve25 } from "path";
|
|
101881
102145
|
function resolveConfigPath2(pathValue) {
|
|
101882
102146
|
const resolvedPath = resolve25(pathValue);
|
|
101883
102147
|
if (!existsSync61(resolvedPath))
|
|
@@ -101895,13 +102159,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
101895
102159
|
if (customConfigDir) {
|
|
101896
102160
|
return resolveConfigPath2(customConfigDir);
|
|
101897
102161
|
}
|
|
101898
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
101899
|
-
return resolveConfigPath2(
|
|
102162
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join85(homedir25(), ".config");
|
|
102163
|
+
return resolveConfigPath2(join85(xdgConfigDir, "opencode"));
|
|
101900
102164
|
}
|
|
101901
102165
|
|
|
101902
102166
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
101903
|
-
import { chmodSync as chmodSync3, existsSync as existsSync62, readFileSync as
|
|
101904
|
-
import { join as
|
|
102167
|
+
import { chmodSync as chmodSync3, existsSync as existsSync62, readFileSync as readFileSync42, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "fs";
|
|
102168
|
+
import { join as join86 } from "path";
|
|
101905
102169
|
var INDEX_FILE_NAME = "index.json";
|
|
101906
102170
|
function isTokenIndex(value) {
|
|
101907
102171
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -101909,14 +102173,14 @@ function isTokenIndex(value) {
|
|
|
101909
102173
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
101910
102174
|
}
|
|
101911
102175
|
function getIndexPath(storageDir) {
|
|
101912
|
-
return
|
|
102176
|
+
return join86(storageDir, INDEX_FILE_NAME);
|
|
101913
102177
|
}
|
|
101914
102178
|
function readTokenIndex(storageDir) {
|
|
101915
102179
|
const indexPath = getIndexPath(storageDir);
|
|
101916
102180
|
if (!existsSync62(indexPath))
|
|
101917
102181
|
return {};
|
|
101918
102182
|
try {
|
|
101919
|
-
const parsed = JSON.parse(
|
|
102183
|
+
const parsed = JSON.parse(readFileSync42(indexPath, "utf-8"));
|
|
101920
102184
|
return isTokenIndex(parsed) ? parsed : {};
|
|
101921
102185
|
} catch (readError) {
|
|
101922
102186
|
if (!(readError instanceof Error))
|
|
@@ -101953,16 +102217,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
101953
102217
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
101954
102218
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
101955
102219
|
function getMcpOauthStorageDir() {
|
|
101956
|
-
return
|
|
102220
|
+
return join87(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
101957
102221
|
}
|
|
101958
102222
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
101959
102223
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
101960
102224
|
}
|
|
101961
102225
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
101962
|
-
return
|
|
102226
|
+
return join87(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
101963
102227
|
}
|
|
101964
102228
|
function getLegacyStoragePath() {
|
|
101965
|
-
return
|
|
102229
|
+
return join87(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
101966
102230
|
}
|
|
101967
102231
|
function normalizeHost2(serverHost) {
|
|
101968
102232
|
let host = serverHost.trim();
|
|
@@ -102026,7 +102290,7 @@ function readTokenFile(filePath) {
|
|
|
102026
102290
|
if (!existsSync63(filePath))
|
|
102027
102291
|
return null;
|
|
102028
102292
|
try {
|
|
102029
|
-
const parsed = JSON.parse(
|
|
102293
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
102030
102294
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
102031
102295
|
} catch (readError) {
|
|
102032
102296
|
if (!(readError instanceof Error))
|
|
@@ -102039,7 +102303,7 @@ function readLegacyStore() {
|
|
|
102039
102303
|
if (!existsSync63(filePath))
|
|
102040
102304
|
return null;
|
|
102041
102305
|
try {
|
|
102042
|
-
const parsed = JSON.parse(
|
|
102306
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
102043
102307
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
102044
102308
|
return null;
|
|
102045
102309
|
const result = {};
|
|
@@ -102056,7 +102320,7 @@ function readLegacyStore() {
|
|
|
102056
102320
|
}
|
|
102057
102321
|
function writeTokenFile(filePath, token) {
|
|
102058
102322
|
try {
|
|
102059
|
-
const dir =
|
|
102323
|
+
const dir = dirname33(filePath);
|
|
102060
102324
|
if (!existsSync63(dir)) {
|
|
102061
102325
|
mkdirSync14(dir, { recursive: true });
|
|
102062
102326
|
}
|
|
@@ -102141,7 +102405,7 @@ function listTokensByHost(serverHost) {
|
|
|
102141
102405
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
102142
102406
|
if (!indexedKey.startsWith(prefix))
|
|
102143
102407
|
continue;
|
|
102144
|
-
const indexedToken = readTokenFile(
|
|
102408
|
+
const indexedToken = readTokenFile(join87(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
102145
102409
|
if (indexedToken)
|
|
102146
102410
|
result[indexedKey] = indexedToken;
|
|
102147
102411
|
}
|
|
@@ -102156,7 +102420,7 @@ function listAllTokens() {
|
|
|
102156
102420
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
102157
102421
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
102158
102422
|
continue;
|
|
102159
|
-
const token = readTokenFile(
|
|
102423
|
+
const token = readTokenFile(join87(dir, entry.name));
|
|
102160
102424
|
const hash2 = basename14(entry.name, ".json");
|
|
102161
102425
|
if (token)
|
|
102162
102426
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -102880,7 +103144,7 @@ async function boulder(options) {
|
|
|
102880
103144
|
}
|
|
102881
103145
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
102882
103146
|
import { spawn as spawn5 } from "child_process";
|
|
102883
|
-
import { existsSync as existsSync65, readFileSync as
|
|
103147
|
+
import { existsSync as existsSync65, readFileSync as readFileSync44, realpathSync as realpathSync9 } from "fs";
|
|
102884
103148
|
import { homedir as homedir26 } from "os";
|
|
102885
103149
|
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
|
|
102886
103150
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
@@ -102930,7 +103194,7 @@ function resolveLegacyLocalOmoBin(env3, homeDir, currentExecutablePaths) {
|
|
|
102930
103194
|
}
|
|
102931
103195
|
function isGeneratedRuntimeWrapper(candidate) {
|
|
102932
103196
|
try {
|
|
102933
|
-
return
|
|
103197
|
+
return readFileSync44(candidate, "utf8").includes(RUNTIME_WRAPPER_MARKER);
|
|
102934
103198
|
} catch (error51) {
|
|
102935
103199
|
if (error51 instanceof Error)
|
|
102936
103200
|
return false;
|