oh-my-opencode 4.16.2 → 4.17.0
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/command/omomomo.md +1 -1
- package/.agents/skills/hyperplan/SKILL.md +3 -3
- package/.agents/skills/omomomo/SKILL.md +1 -1
- package/.agents/skills/pre-publish-review/SKILL.md +3 -0
- package/.opencode/command/omomomo.md +1 -1
- package/.opencode/skills/hyperplan/SKILL.md +3 -3
- package/.opencode/skills/pre-publish-review/SKILL.md +3 -0
- package/README.ja.md +4 -4
- package/README.ko.md +4 -4
- package/README.md +4 -4
- package/README.ru.md +4 -4
- package/README.zh-cn.md +4 -4
- 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 +947 -567
- package/dist/cli-node/index.js +947 -567
- 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/features/team-mode/test-support/async-test-helpers.d.ts +2 -2
- package/dist/index.js +523 -81
- package/dist/plugin/chat-message/types.d.ts +4 -0
- package/dist/plugin/command-execute-before.d.ts +1 -0
- package/dist/plugin/stop-continuation.d.ts +17 -0
- package/dist/shared/live-server-route.d.ts +1 -1
- package/dist/skills/remove-ai-slops/SKILL.md +2 -2
- package/dist/skills/review-work/SKILL.md +1 -1
- package/dist/skills/start-work/SKILL.md +5 -2
- package/dist/skills/ulw-plan/references/full-workflow.md +1 -1
- package/dist/skills/ulw-plan/scripts/scaffold-plan.mjs +2 -2
- package/dist/skills/ulw-research/SKILL.md +2 -2
- package/dist/skills/visual-qa/SKILL.md +1 -1
- package/dist/tui.js +195 -41
- package/package.json +15 -14
- package/packages/git-bash-mcp/package.json +27 -0
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +3 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +465 -248
- 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/AGENTS.md +2 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/cli.js +6 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.js +6 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/codex-hook.ts +6 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/cli.test.ts +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +67 -2
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +0 -13
- 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/start-work-continuation/test/codex-hook.test.ts +1 -79
- 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 +23 -40
- 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 +3 -3
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-gate-reviewer.toml +7 -7
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-qa-executor.toml +5 -5
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-high.toml +26 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/{lazycodex-executor.toml → lazycodex-worker-low.toml} +7 -5
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-medium.toml +26 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +20 -48
- 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 +22 -43
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +55 -28
- 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/ultrawork/SKILL.md +55 -28
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/scripts/scaffold-plan.mjs +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +22 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +0 -68
- package/packages/omo-codex/plugin/components/ulw-loop/AGENTS.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/CHANGELOG.md +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/README.md +3 -1
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +55 -28
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +6 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.d.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.js +13 -2
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +405 -25
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +12 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +4 -2
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.d.ts +7 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.js +16 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-verdicts.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-verdicts.js +20 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +12 -9
- package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.d.ts +3 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.js +148 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/stop-resume-hook.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/stop-resume-hook.js +209 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +25 -2
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +14 -15
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +29 -27
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +6 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-subcommands.ts +14 -3
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +10 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +12 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/domain-types.ts +4 -2
- package/packages/omo-codex/plugin/components/ulw-loop/src/paths.ts +27 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/plan-crud.ts +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-verdicts.ts +23 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +16 -9
- package/packages/omo-codex/plugin/components/ulw-loop/src/spawn-guard.ts +138 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/stop-resume-hook.ts +208 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-create-goals.test.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +4 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +8 -35
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/quality-gate-builder.ts +24 -13
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +5 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/paths.test.ts +43 -8
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +55 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/spawn-guard.test.ts +228 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/stop-resume-hook.test.ts +193 -0
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-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-guarding-ulw-loop-spawns.json +18 -0
- 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/stop-checking-ulw-loop-resume.json +17 -0
- 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 +2 -2
- 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/model-catalog.json +16 -7
- 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/catalog.mjs +16 -7
- 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 +14 -6
- package/packages/omo-codex/plugin/scripts/sync-version.mjs +4 -2
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +5 -5
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +9 -3
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +6 -3
- 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/ultrawork/SKILL.md +55 -28
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +14 -15
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +29 -27
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/scripts/scaffold-plan.mjs +2 -2
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +4 -4
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +4 -4
- package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +116 -10
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +23 -2
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/aggregate-model-catalog.test.mjs +4 -4
- 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/auto-update.test.mjs +4 -4
- package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +2 -2
- package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +4 -101
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +160 -23
- 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 +20 -2
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +1 -1
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +4 -2
- package/packages/omo-codex/plugin/test/teammode-transport.test.mjs +345 -0
- package/packages/omo-codex/plugin/test/ulw-plan-skill-contract.test.mjs +9 -40
- package/packages/omo-codex/plugin/test/ulw-research-skill-contract.test.mjs +4 -277
- package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +5 -5
- package/packages/omo-codex/scripts/install-config.test.mjs +22 -3
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +508 -286
- package/packages/omo-codex/scripts/install-generated-bundle.test.mjs +111 -1
- package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +2 -2
- package/packages/shared-skills/skills/review-work/SKILL.md +1 -1
- package/packages/shared-skills/skills/start-work/SKILL.md +5 -2
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/shared-skills/skills/ulw-plan/scripts/scaffold-plan.mjs +2 -2
- package/packages/shared-skills/skills/ulw-research/SKILL.md +2 -2
- package/packages/shared-skills/skills/visual-qa/SKILL.md +1 -1
- package/dist/skills/visual-qa/scripts/skill-prompt-contract.test.ts +0 -296
- package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +0 -70
- package/packages/omo-codex/plugin/test/ulw-research-epistemic-contract.test.mjs +0 -98
- package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +0 -296
- /package/packages/omo-codex/plugin/components/rules/bundled-rules/{hephaestus.md → hephaestus/gpt-5.5.md} +0 -0
package/dist/cli-node/index.js
CHANGED
|
@@ -2146,7 +2146,7 @@ var package_default;
|
|
|
2146
2146
|
var init_package = __esm(() => {
|
|
2147
2147
|
package_default = {
|
|
2148
2148
|
name: "oh-my-opencode",
|
|
2149
|
-
version: "4.
|
|
2149
|
+
version: "4.17.0",
|
|
2150
2150
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2151
2151
|
main: "./dist/index.js",
|
|
2152
2152
|
types: "dist/index.d.ts",
|
|
@@ -2209,6 +2209,7 @@ var init_package = __esm(() => {
|
|
|
2209
2209
|
"packages/lsp-tools-mcp/dist",
|
|
2210
2210
|
"packages/lsp-daemon/package.json",
|
|
2211
2211
|
"packages/lsp-daemon/dist",
|
|
2212
|
+
"packages/git-bash-mcp/package.json",
|
|
2212
2213
|
"packages/git-bash-mcp/dist",
|
|
2213
2214
|
"packages/shared-skills/package.json",
|
|
2214
2215
|
"packages/shared-skills/index.mjs",
|
|
@@ -2274,7 +2275,7 @@ var init_package = __esm(() => {
|
|
|
2274
2275
|
"typecheck:packages": "tsgo --noEmit -p packages/rules-engine/tsconfig.json && tsgo --noEmit -p packages/delegate-core/tsconfig.json && tsgo --noEmit -p packages/mcp-stdio-core/tsconfig.json && tsgo --noEmit -p packages/mcp-client-core/tsconfig.json && tsgo --noEmit -p packages/git-bash-mcp/tsconfig.json && tsgo --noEmit -p packages/lsp-core/tsconfig.json && tsgo --noEmit -p packages/utils/tsconfig.json && tsgo --noEmit -p packages/model-core/tsconfig.json && tsgo --noEmit -p packages/omo-config-core/tsconfig.json && tsgo --noEmit -p packages/prompts-core/tsconfig.json && tsgo --noEmit -p packages/comment-checker-core/tsconfig.json && tsgo --noEmit -p packages/hashline-core/tsconfig.json && tsgo --noEmit -p packages/tmux-core/tsconfig.json && tsgo --noEmit -p packages/team-core/tsconfig.json && tsgo --noEmit -p packages/openclaw-core/tsconfig.json && tsgo --noEmit -p packages/boulder-state/tsconfig.json && tsgo --noEmit -p packages/telemetry-core/tsconfig.json && tsgo --noEmit -p packages/claude-code-compat-core/tsconfig.json && tsgo --noEmit -p packages/skills-loader-core/tsconfig.json && tsgo --noEmit -p packages/agents-md-core/tsconfig.json && tsgo --noEmit -p packages/omo-codex/plugin/shared/tsconfig.json && tsgo --noEmit -p packages/omo-codex/tsconfig.json && tsgo --noEmit -p packages/omo-senpi/tsconfig.json && tsgo --noEmit -p packages/senpi-task/tsconfig.json && tsgo --noEmit -p packages/pi-goal/tsconfig.json && tsgo --noEmit -p packages/pi-webfetch/tsconfig.json && tsgo --noEmit -p packages/omo-opencode/tsconfig.json",
|
|
2275
2276
|
"typecheck:script": "tsgo --noEmit -p script/tsconfig.json",
|
|
2276
2277
|
test: "bun test",
|
|
2277
|
-
"test:codex": "bun run build:codex-install && bun run build:git-bash-mcp && bun run build:lsp-tools-mcp && bun run build:lsp-daemon && npm --prefix packages/lsp-tools-mcp test && npm --prefix packages/omo-codex/plugin ci && bun run --cwd packages/omo-codex/plugin build && npm --prefix packages/omo-codex/plugin/components/codegraph run typecheck && npm --prefix packages/omo-codex/plugin/components/codegraph test && node scripts/check-third-party-notices.mjs --ship && bun test packages/omo-opencode/src/cli/cli-installer.platform.test.ts packages/omo-codex/src/install/codex-cache.test.ts packages/omo-codex/src/install/codex-cleanup.test.ts packages/omo-codex/src/install/codex-config-agent-cleanup.test.ts packages/omo-codex/src/install/codex-config-autonomous-features.test.ts packages/omo-codex/src/install/codex-config-reasoning.test.ts packages/omo-codex/src/install/codex-config-toml.test.ts packages/omo-codex/src/install/codex-project-local-cleanup.test.ts packages/omo-codex/src/install/install-codex-project-local-cleanup.test.ts packages/omo-codex/src/install/install-codex.test.ts packages/omo-codex/src/install/install-codex-packaged.test.ts packages/omo-codex/src/install/link-cached-plugin-agents.test.ts packages/omo-codex/src/**/*.test.ts packages/utils/src/jsonc-parser.test.ts packages/utils/src/frontmatter.test.ts packages/hashline-core/src/hash-computation.test.ts packages/hashline-core/src/smoke-untested-modules.test.ts packages/rules-engine/src/index.test.ts packages/rules-engine/src/security-boundary.test.ts packages/agents-md-core/src/injector.test.ts packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts && node --test packages/omo-codex/plugin/test/*.test.mjs packages/omo-codex/scripts/install-cache-copy.test.mjs packages/omo-codex/scripts/install-cli-args.test.mjs packages/omo-codex/scripts/install-delegated-command.test.mjs packages/omo-codex/scripts/install-config-autonomous-features.test.mjs packages/omo-codex/scripts/install-config-autonomous.test.mjs packages/omo-codex/scripts/install-config-reasoning.test.mjs packages/omo-codex/scripts/install-config.test.mjs packages/omo-codex/scripts/install-hook-targets.test.mjs packages/omo-codex/scripts/install-project-local-cleanup.test.mjs packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs packages/omo-codex/scripts/install-local-entrypoint.test.mjs packages/omo-codex/scripts/install-local-git-bash-preflight.test.mjs packages/omo-codex/scripts/install-local.test.mjs packages/omo-codex/scripts/install-marketplace-cache.test.mjs packages/omo-codex/scripts/install-mcp-context7-runtime.test.mjs packages/omo-codex/scripts/install-mcp-runtime.test.mjs packages/omo-codex/scripts/install-packaged-local.test.mjs packages/omo-codex/scripts/install-generated-bundle.test.mjs packages/omo-codex/scripts/install-agent-links.test.mjs packages/omo-codex/scripts/install-bin-links.test.mjs",
|
|
2278
|
+
"test:codex": "bun run build:codex-install && bun run build:git-bash-mcp && bun run build:lsp-tools-mcp && bun run build:lsp-daemon && npm --prefix packages/lsp-tools-mcp test && npm --prefix packages/omo-codex/plugin ci && npm --prefix packages/omo-codex/plugin/components/ulw-loop test && bun run --cwd packages/omo-codex/plugin build && npm --prefix packages/omo-codex/plugin/components/codegraph run typecheck && npm --prefix packages/omo-codex/plugin/components/codegraph test && node scripts/check-third-party-notices.mjs --ship && bun test packages/omo-opencode/src/cli/cli-installer.platform.test.ts packages/omo-codex/src/install/codex-cache.test.ts packages/omo-codex/src/install/codex-cleanup.test.ts packages/omo-codex/src/install/codex-config-agent-cleanup.test.ts packages/omo-codex/src/install/codex-config-autonomous-features.test.ts packages/omo-codex/src/install/codex-config-reasoning.test.ts packages/omo-codex/src/install/codex-config-toml.test.ts packages/omo-codex/src/install/codex-project-local-cleanup.test.ts packages/omo-codex/src/install/install-codex-project-local-cleanup.test.ts packages/omo-codex/src/install/install-codex.test.ts packages/omo-codex/src/install/install-codex-packaged.test.ts packages/omo-codex/src/install/link-cached-plugin-agents.test.ts packages/omo-codex/src/**/*.test.ts packages/utils/src/jsonc-parser.test.ts packages/utils/src/frontmatter.test.ts packages/hashline-core/src/hash-computation.test.ts packages/hashline-core/src/smoke-untested-modules.test.ts packages/rules-engine/src/index.test.ts packages/rules-engine/src/security-boundary.test.ts packages/agents-md-core/src/injector.test.ts packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts && node --test packages/omo-codex/plugin/test/*.test.mjs packages/omo-codex/scripts/install-cache-copy.test.mjs packages/omo-codex/scripts/install-cli-args.test.mjs packages/omo-codex/scripts/install-delegated-command.test.mjs packages/omo-codex/scripts/install-config-autonomous-features.test.mjs packages/omo-codex/scripts/install-config-autonomous.test.mjs packages/omo-codex/scripts/install-config-reasoning.test.mjs packages/omo-codex/scripts/install-config.test.mjs packages/omo-codex/scripts/install-hook-targets.test.mjs packages/omo-codex/scripts/install-project-local-cleanup.test.mjs packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs packages/omo-codex/scripts/install-local-entrypoint.test.mjs packages/omo-codex/scripts/install-local-git-bash-preflight.test.mjs packages/omo-codex/scripts/install-local.test.mjs packages/omo-codex/scripts/install-marketplace-cache.test.mjs packages/omo-codex/scripts/install-mcp-context7-runtime.test.mjs packages/omo-codex/scripts/install-mcp-runtime.test.mjs packages/omo-codex/scripts/install-packaged-local.test.mjs packages/omo-codex/scripts/install-generated-bundle.test.mjs packages/omo-codex/scripts/install-agent-links.test.mjs packages/omo-codex/scripts/install-bin-links.test.mjs",
|
|
2278
2279
|
"test:senpi": "node packages/omo-senpi/plugin/scripts/build-extension.mjs && node packages/omo-senpi/plugin/scripts/sync-skills.mjs && node packages/omo-senpi/plugin/scripts/embed-directive.mjs --check && bun test packages/omo-senpi",
|
|
2279
2280
|
"test:windows-codex": "bun run test:codex",
|
|
2280
2281
|
"build:git-bash-mcp": "bun run --cwd packages/git-bash-mcp build"
|
|
@@ -2356,18 +2357,18 @@ var init_package = __esm(() => {
|
|
|
2356
2357
|
typescript: "^6.0.3"
|
|
2357
2358
|
},
|
|
2358
2359
|
optionalDependencies: {
|
|
2359
|
-
"oh-my-opencode-darwin-arm64": "4.
|
|
2360
|
-
"oh-my-opencode-darwin-x64": "4.
|
|
2361
|
-
"oh-my-opencode-darwin-x64-baseline": "4.
|
|
2362
|
-
"oh-my-opencode-linux-arm64": "4.
|
|
2363
|
-
"oh-my-opencode-linux-arm64-musl": "4.
|
|
2364
|
-
"oh-my-opencode-linux-x64": "4.
|
|
2365
|
-
"oh-my-opencode-linux-x64-baseline": "4.
|
|
2366
|
-
"oh-my-opencode-linux-x64-musl": "4.
|
|
2367
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.
|
|
2368
|
-
"oh-my-opencode-windows-arm64": "4.
|
|
2369
|
-
"oh-my-opencode-windows-x64": "4.
|
|
2370
|
-
"oh-my-opencode-windows-x64-baseline": "4.
|
|
2360
|
+
"oh-my-opencode-darwin-arm64": "4.17.0",
|
|
2361
|
+
"oh-my-opencode-darwin-x64": "4.17.0",
|
|
2362
|
+
"oh-my-opencode-darwin-x64-baseline": "4.17.0",
|
|
2363
|
+
"oh-my-opencode-linux-arm64": "4.17.0",
|
|
2364
|
+
"oh-my-opencode-linux-arm64-musl": "4.17.0",
|
|
2365
|
+
"oh-my-opencode-linux-x64": "4.17.0",
|
|
2366
|
+
"oh-my-opencode-linux-x64-baseline": "4.17.0",
|
|
2367
|
+
"oh-my-opencode-linux-x64-musl": "4.17.0",
|
|
2368
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.17.0",
|
|
2369
|
+
"oh-my-opencode-windows-arm64": "4.17.0",
|
|
2370
|
+
"oh-my-opencode-windows-x64": "4.17.0",
|
|
2371
|
+
"oh-my-opencode-windows-x64-baseline": "4.17.0"
|
|
2371
2372
|
},
|
|
2372
2373
|
overrides: {
|
|
2373
2374
|
"@earendil-works/pi-agent-core": "0.80.3",
|
|
@@ -9220,6 +9221,11 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9220
9221
|
},
|
|
9221
9222
|
hephaestus: {
|
|
9222
9223
|
fallbackChain: [
|
|
9224
|
+
{
|
|
9225
|
+
providers: ["openai", "vercel"],
|
|
9226
|
+
model: "gpt-5.6-sol",
|
|
9227
|
+
variant: "medium"
|
|
9228
|
+
},
|
|
9223
9229
|
{
|
|
9224
9230
|
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
9225
9231
|
model: "gpt-5.5",
|
|
@@ -9246,7 +9252,7 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9246
9252
|
model: "claude-opus-4-7",
|
|
9247
9253
|
variant: "max"
|
|
9248
9254
|
},
|
|
9249
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9255
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9250
9256
|
]
|
|
9251
9257
|
},
|
|
9252
9258
|
librarian: {
|
|
@@ -9293,7 +9299,7 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9293
9299
|
model: "gpt-5.5",
|
|
9294
9300
|
variant: "high"
|
|
9295
9301
|
},
|
|
9296
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9302
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9297
9303
|
{
|
|
9298
9304
|
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
9299
9305
|
model: "gemini-3.1-pro"
|
|
@@ -9316,12 +9322,17 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9316
9322
|
model: "gpt-5.5",
|
|
9317
9323
|
variant: "high"
|
|
9318
9324
|
},
|
|
9319
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9325
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9320
9326
|
{ providers: ["kimi-for-coding"], model: "k2p5" }
|
|
9321
9327
|
]
|
|
9322
9328
|
},
|
|
9323
9329
|
momus: {
|
|
9324
9330
|
fallbackChain: [
|
|
9331
|
+
{
|
|
9332
|
+
providers: ["openai", "vercel"],
|
|
9333
|
+
model: "gpt-5.6-sol",
|
|
9334
|
+
variant: "xhigh"
|
|
9335
|
+
},
|
|
9325
9336
|
{
|
|
9326
9337
|
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
9327
9338
|
model: "gpt-5.5",
|
|
@@ -9337,7 +9348,7 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9337
9348
|
model: "gemini-3.1-pro",
|
|
9338
9349
|
variant: "high"
|
|
9339
9350
|
},
|
|
9340
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9351
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9341
9352
|
]
|
|
9342
9353
|
},
|
|
9343
9354
|
atlas: {
|
|
@@ -9389,12 +9400,17 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9389
9400
|
model: "claude-opus-4-7",
|
|
9390
9401
|
variant: "max"
|
|
9391
9402
|
},
|
|
9392
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9403
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9393
9404
|
{ providers: ["kimi-for-coding"], model: "k2p5" }
|
|
9394
9405
|
]
|
|
9395
9406
|
},
|
|
9396
9407
|
ultrabrain: {
|
|
9397
9408
|
fallbackChain: [
|
|
9409
|
+
{
|
|
9410
|
+
providers: ["openai", "vercel"],
|
|
9411
|
+
model: "gpt-5.6-sol",
|
|
9412
|
+
variant: "xhigh"
|
|
9413
|
+
},
|
|
9398
9414
|
{
|
|
9399
9415
|
providers: ["openai", "opencode", "vercel"],
|
|
9400
9416
|
model: "gpt-5.5",
|
|
@@ -9410,11 +9426,21 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9410
9426
|
model: "claude-opus-4-7",
|
|
9411
9427
|
variant: "max"
|
|
9412
9428
|
},
|
|
9413
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9429
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9414
9430
|
]
|
|
9415
9431
|
},
|
|
9416
9432
|
deep: {
|
|
9417
9433
|
fallbackChain: [
|
|
9434
|
+
{
|
|
9435
|
+
providers: ["openai", "vercel"],
|
|
9436
|
+
model: "gpt-5.6-terra",
|
|
9437
|
+
variant: "xhigh"
|
|
9438
|
+
},
|
|
9439
|
+
{
|
|
9440
|
+
providers: ["openai", "vercel"],
|
|
9441
|
+
model: "gpt-5.6-sol",
|
|
9442
|
+
variant: "high"
|
|
9443
|
+
},
|
|
9418
9444
|
{
|
|
9419
9445
|
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
9420
9446
|
model: "gpt-5.5",
|
|
@@ -9431,7 +9457,7 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9431
9457
|
variant: "high"
|
|
9432
9458
|
},
|
|
9433
9459
|
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.6" },
|
|
9434
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9460
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9435
9461
|
]
|
|
9436
9462
|
},
|
|
9437
9463
|
artistry: {
|
|
@@ -9448,7 +9474,7 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9448
9474
|
},
|
|
9449
9475
|
{ providers: ["openai", "github-copilot", "opencode", "vercel"], model: "gpt-5.5" },
|
|
9450
9476
|
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.6" },
|
|
9451
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9477
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9452
9478
|
]
|
|
9453
9479
|
},
|
|
9454
9480
|
quick: {
|
|
@@ -9473,6 +9499,11 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9473
9499
|
},
|
|
9474
9500
|
"unspecified-low": {
|
|
9475
9501
|
fallbackChain: [
|
|
9502
|
+
{
|
|
9503
|
+
providers: ["openai", "vercel"],
|
|
9504
|
+
model: "gpt-5.6-luna",
|
|
9505
|
+
variant: "xhigh"
|
|
9506
|
+
},
|
|
9476
9507
|
{
|
|
9477
9508
|
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
9478
9509
|
model: "claude-sonnet-4-6"
|
|
@@ -9506,7 +9537,7 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9506
9537
|
},
|
|
9507
9538
|
{ providers: ["zai-coding-plan", "opencode", "bailian-coding-plan", "vercel"], model: "glm-5" },
|
|
9508
9539
|
{ providers: ["kimi-for-coding"], model: "k2p5" },
|
|
9509
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9540
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9510
9541
|
{ providers: ["opencode", "bailian-coding-plan", "vercel"], model: "kimi-k2.5" },
|
|
9511
9542
|
{
|
|
9512
9543
|
providers: [
|
|
@@ -10044,6 +10075,54 @@ var init_supplemental_entries = __esm(() => {
|
|
|
10044
10075
|
output: 262144
|
|
10045
10076
|
}
|
|
10046
10077
|
},
|
|
10078
|
+
"gpt-5.6-sol": {
|
|
10079
|
+
id: "gpt-5.6-sol",
|
|
10080
|
+
family: "gpt",
|
|
10081
|
+
reasoning: true,
|
|
10082
|
+
temperature: false,
|
|
10083
|
+
toolCall: true,
|
|
10084
|
+
modalities: {
|
|
10085
|
+
input: ["text", "image", "pdf"],
|
|
10086
|
+
output: ["text"]
|
|
10087
|
+
},
|
|
10088
|
+
limit: {
|
|
10089
|
+
context: 1050000,
|
|
10090
|
+
input: 922000,
|
|
10091
|
+
output: 128000
|
|
10092
|
+
}
|
|
10093
|
+
},
|
|
10094
|
+
"gpt-5.6-terra": {
|
|
10095
|
+
id: "gpt-5.6-terra",
|
|
10096
|
+
family: "gpt-mini",
|
|
10097
|
+
reasoning: true,
|
|
10098
|
+
temperature: false,
|
|
10099
|
+
toolCall: true,
|
|
10100
|
+
modalities: {
|
|
10101
|
+
input: ["text", "image", "pdf"],
|
|
10102
|
+
output: ["text"]
|
|
10103
|
+
},
|
|
10104
|
+
limit: {
|
|
10105
|
+
context: 1050000,
|
|
10106
|
+
input: 922000,
|
|
10107
|
+
output: 128000
|
|
10108
|
+
}
|
|
10109
|
+
},
|
|
10110
|
+
"gpt-5.6-luna": {
|
|
10111
|
+
id: "gpt-5.6-luna",
|
|
10112
|
+
family: "gpt-nano",
|
|
10113
|
+
reasoning: true,
|
|
10114
|
+
temperature: false,
|
|
10115
|
+
toolCall: true,
|
|
10116
|
+
modalities: {
|
|
10117
|
+
input: ["text", "image", "pdf"],
|
|
10118
|
+
output: ["text"]
|
|
10119
|
+
},
|
|
10120
|
+
limit: {
|
|
10121
|
+
context: 1050000,
|
|
10122
|
+
input: 922000,
|
|
10123
|
+
output: 128000
|
|
10124
|
+
}
|
|
10125
|
+
},
|
|
10047
10126
|
"gpt-5.5": {
|
|
10048
10127
|
id: "gpt-5.5",
|
|
10049
10128
|
family: "gpt",
|
|
@@ -10650,28 +10729,7 @@ var init_agent_display_names = __esm(() => {
|
|
|
10650
10729
|
};
|
|
10651
10730
|
});
|
|
10652
10731
|
// packages/omo-opencode/src/tools/delegate-task/anthropic-categories.ts
|
|
10653
|
-
var
|
|
10654
|
-
You are working on tasks that don't fit specific categories but require moderate effort.
|
|
10655
|
-
|
|
10656
|
-
<Selection_Gate>
|
|
10657
|
-
BEFORE selecting this category, VERIFY ALL conditions:
|
|
10658
|
-
1. Task does NOT fit: quick (trivial), visual-engineering (UI), ultrabrain (deep logic), artistry (creative), writing (docs)
|
|
10659
|
-
2. Task requires more than trivial effort but is NOT system-wide
|
|
10660
|
-
3. Scope is contained within a few files/modules
|
|
10661
|
-
|
|
10662
|
-
If task fits ANY other category, DO NOT select unspecified-low.
|
|
10663
|
-
This is NOT a default choice - it's for genuinely unclassifiable moderate-effort work.
|
|
10664
|
-
</Selection_Gate>
|
|
10665
|
-
</Category_Context>
|
|
10666
|
-
|
|
10667
|
-
<Caller_Warning>
|
|
10668
|
-
THIS CATEGORY USES A MID-TIER MODEL (claude-sonnet-4-6).
|
|
10669
|
-
|
|
10670
|
-
**PROVIDE CLEAR STRUCTURE:**
|
|
10671
|
-
1. MUST DO: Enumerate required actions explicitly
|
|
10672
|
-
2. MUST NOT DO: State forbidden actions to prevent scope creep
|
|
10673
|
-
3. EXPECTED OUTPUT: Define concrete success criteria
|
|
10674
|
-
</Caller_Warning>`, UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
|
10732
|
+
var UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
|
10675
10733
|
You are working on tasks that don't fit specific categories but require substantial effort.
|
|
10676
10734
|
|
|
10677
10735
|
<Selection_Gate>
|
|
@@ -10687,12 +10745,6 @@ If task is unclassifiable but moderate-effort, use unspecified-low instead.
|
|
|
10687
10745
|
</Category_Context>`, ANTHROPIC_CATEGORIES;
|
|
10688
10746
|
var init_anthropic_categories = __esm(() => {
|
|
10689
10747
|
ANTHROPIC_CATEGORIES = [
|
|
10690
|
-
{
|
|
10691
|
-
name: "unspecified-low",
|
|
10692
|
-
config: { model: "anthropic/claude-sonnet-4-6" },
|
|
10693
|
-
description: "Tasks that don't fit other categories, low effort required",
|
|
10694
|
-
promptAppend: UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND
|
|
10695
|
-
},
|
|
10696
10748
|
{
|
|
10697
10749
|
name: "unspecified-high",
|
|
10698
10750
|
config: { model: "anthropic/claude-opus-4-7", variant: "max" },
|
|
@@ -10868,11 +10920,15 @@ function isGpt5_5Model(model) {
|
|
|
10868
10920
|
const modelName = extractModelName(model).toLowerCase();
|
|
10869
10921
|
return modelName.includes("gpt-5.5") || modelName.includes("gpt-5-5");
|
|
10870
10922
|
}
|
|
10923
|
+
function isGpt5_6Model(model) {
|
|
10924
|
+
const modelName = extractModelName(model).toLowerCase();
|
|
10925
|
+
return modelName.includes("gpt-5.6") || modelName.includes("gpt-5-6");
|
|
10926
|
+
}
|
|
10871
10927
|
var init_types = () => {};
|
|
10872
10928
|
|
|
10873
10929
|
// packages/omo-opencode/src/tools/delegate-task/openai-categories.ts
|
|
10874
10930
|
function resolveDeepCategoryPromptAppend(model) {
|
|
10875
|
-
if (model && isGpt5_5Model(model)) {
|
|
10931
|
+
if (model && (isGpt5_5Model(model) || isGpt5_6Model(model))) {
|
|
10876
10932
|
return DEEP_CATEGORY_PROMPT_APPEND_GPT_5_5;
|
|
10877
10933
|
}
|
|
10878
10934
|
return DEEP_CATEGORY_PROMPT_APPEND;
|
|
@@ -10985,19 +11041,40 @@ EXPECTED OUTPUT:
|
|
|
10985
11041
|
\`\`\`
|
|
10986
11042
|
|
|
10987
11043
|
If your prompt lacks this structure, REWRITE IT before delegating.
|
|
11044
|
+
</Caller_Warning>`, UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
|
11045
|
+
You are working on tasks that don't fit specific categories but require moderate effort.
|
|
11046
|
+
|
|
11047
|
+
<Selection_Gate>
|
|
11048
|
+
BEFORE selecting this category, VERIFY ALL conditions:
|
|
11049
|
+
1. Task does NOT fit: quick (trivial), visual-engineering (UI), ultrabrain (deep logic), artistry (creative), writing (docs)
|
|
11050
|
+
2. Task requires more than trivial effort but is NOT system-wide
|
|
11051
|
+
3. Scope is contained within a few files/modules
|
|
11052
|
+
|
|
11053
|
+
If task fits ANY other category, DO NOT select unspecified-low.
|
|
11054
|
+
This is NOT a default choice - it's for genuinely unclassifiable moderate-effort work.
|
|
11055
|
+
</Selection_Gate>
|
|
11056
|
+
</Category_Context>
|
|
11057
|
+
|
|
11058
|
+
<Caller_Warning>
|
|
11059
|
+
THIS CATEGORY USES A LIGHTWEIGHT MODEL (gpt-5.6-luna).
|
|
11060
|
+
|
|
11061
|
+
**PROVIDE CLEAR STRUCTURE:**
|
|
11062
|
+
1. MUST DO: Enumerate required actions explicitly
|
|
11063
|
+
2. MUST NOT DO: State forbidden actions to prevent scope creep
|
|
11064
|
+
3. EXPECTED OUTPUT: Define concrete success criteria
|
|
10988
11065
|
</Caller_Warning>`, OPENAI_CATEGORIES;
|
|
10989
11066
|
var init_openai_categories = __esm(() => {
|
|
10990
11067
|
init_types();
|
|
10991
11068
|
OPENAI_CATEGORIES = [
|
|
10992
11069
|
{
|
|
10993
11070
|
name: "ultrabrain",
|
|
10994
|
-
config: { model: "openai/gpt-5.
|
|
11071
|
+
config: { model: "openai/gpt-5.6-sol", variant: "xhigh" },
|
|
10995
11072
|
description: "Use ONLY for genuinely hard, logic-heavy tasks. Give clear goals only, not step-by-step instructions.",
|
|
10996
11073
|
promptAppend: ULTRABRAIN_CATEGORY_PROMPT_APPEND
|
|
10997
11074
|
},
|
|
10998
11075
|
{
|
|
10999
11076
|
name: "deep",
|
|
11000
|
-
config: { model: "openai/gpt-5.
|
|
11077
|
+
config: { model: "openai/gpt-5.6-terra", variant: "xhigh" },
|
|
11001
11078
|
description: "Goal-oriented autonomous problem-solving on hairy problems requiring deep research. ONE goal + ONE deliverable per call — multiple goals must fan out as parallel `deep` calls, never bundled into one.",
|
|
11002
11079
|
promptAppend: DEEP_CATEGORY_PROMPT_APPEND,
|
|
11003
11080
|
resolvePromptAppend: resolveDeepCategoryPromptAppend
|
|
@@ -11007,6 +11084,12 @@ var init_openai_categories = __esm(() => {
|
|
|
11007
11084
|
config: { model: "openai/gpt-5.4-mini" },
|
|
11008
11085
|
description: "Trivial tasks - single file changes, typo fixes, simple modifications",
|
|
11009
11086
|
promptAppend: QUICK_CATEGORY_PROMPT_APPEND
|
|
11087
|
+
},
|
|
11088
|
+
{
|
|
11089
|
+
name: "unspecified-low",
|
|
11090
|
+
config: { model: "openai/gpt-5.6-luna", variant: "xhigh" },
|
|
11091
|
+
description: "Tasks that don't fit other categories, low effort required",
|
|
11092
|
+
promptAppend: UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND
|
|
11010
11093
|
}
|
|
11011
11094
|
];
|
|
11012
11095
|
});
|
|
@@ -64594,6 +64677,66 @@ async function probe(registration) {
|
|
|
64594
64677
|
return false;
|
|
64595
64678
|
}
|
|
64596
64679
|
}
|
|
64680
|
+
async function probeSessionAffinity(registration, sessionID) {
|
|
64681
|
+
if (!registration.serverUrl) {
|
|
64682
|
+
return;
|
|
64683
|
+
}
|
|
64684
|
+
const probeUrl = new URL(`/session/${sessionID}`, registration.serverUrl);
|
|
64685
|
+
const authHeader = getServerBasicAuthHeader();
|
|
64686
|
+
const headers = authHeader ? { Authorization: authHeader } : {};
|
|
64687
|
+
try {
|
|
64688
|
+
const controller = new AbortController;
|
|
64689
|
+
const timeoutId = setTimeout(() => controller.abort(), PROBE_ABORT_MS);
|
|
64690
|
+
let response;
|
|
64691
|
+
try {
|
|
64692
|
+
response = await getFetch()(probeUrl, { headers, signal: controller.signal });
|
|
64693
|
+
} finally {
|
|
64694
|
+
clearTimeout(timeoutId);
|
|
64695
|
+
}
|
|
64696
|
+
if (response.ok) {
|
|
64697
|
+
setSessionAffinity(registration, sessionID, true);
|
|
64698
|
+
return true;
|
|
64699
|
+
}
|
|
64700
|
+
if (response.status === 404) {
|
|
64701
|
+
setSessionAffinity(registration, sessionID, false);
|
|
64702
|
+
log2("[live-server-route] live listener does not own session; falling back to in-process client", { sessionID });
|
|
64703
|
+
return false;
|
|
64704
|
+
}
|
|
64705
|
+
return;
|
|
64706
|
+
} catch {
|
|
64707
|
+
return;
|
|
64708
|
+
}
|
|
64709
|
+
}
|
|
64710
|
+
function setSessionAffinity(registration, sessionID, owned) {
|
|
64711
|
+
const now = Date.now();
|
|
64712
|
+
for (const [key, entry] of registration.sessionAffinity) {
|
|
64713
|
+
if (now - entry.timestamp >= AFFINITY_TTL_MS) {
|
|
64714
|
+
registration.sessionAffinity.delete(key);
|
|
64715
|
+
}
|
|
64716
|
+
}
|
|
64717
|
+
registration.sessionAffinity.set(sessionID, { owned, timestamp: now });
|
|
64718
|
+
}
|
|
64719
|
+
function getFreshSessionAffinity(registration, sessionID) {
|
|
64720
|
+
const entry = registration.sessionAffinity.get(sessionID);
|
|
64721
|
+
if (!entry || Date.now() - entry.timestamp >= AFFINITY_TTL_MS) {
|
|
64722
|
+
return;
|
|
64723
|
+
}
|
|
64724
|
+
return entry.owned;
|
|
64725
|
+
}
|
|
64726
|
+
async function resolveSessionAffinity(registration, sessionID) {
|
|
64727
|
+
const cached = getFreshSessionAffinity(registration, sessionID);
|
|
64728
|
+
if (cached !== undefined) {
|
|
64729
|
+
return cached;
|
|
64730
|
+
}
|
|
64731
|
+
let inFlight = registration.inFlightAffinity.get(sessionID);
|
|
64732
|
+
if (!inFlight) {
|
|
64733
|
+
inFlight = probeSessionAffinity(registration, sessionID).finally(() => {
|
|
64734
|
+
registration.inFlightAffinity.delete(sessionID);
|
|
64735
|
+
});
|
|
64736
|
+
registration.inFlightAffinity.set(sessionID, inFlight);
|
|
64737
|
+
}
|
|
64738
|
+
return inFlight;
|
|
64739
|
+
}
|
|
64597
64740
|
function getFreshProbeAvailability(registration) {
|
|
64598
64741
|
const available = registration.available;
|
|
64599
64742
|
if (available === undefined || Date.now() - registration.probeTimestamp >= PROBE_TTL_MS) {
|
|
@@ -64646,6 +64789,13 @@ function tryResolveDispatchClientSync2(client3, sessionID) {
|
|
|
64646
64789
|
if (!freshAvailability) {
|
|
64647
64790
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
64648
64791
|
}
|
|
64792
|
+
const cachedAffinity = getFreshSessionAffinity(registration, sessionID);
|
|
64793
|
+
if (cachedAffinity === undefined) {
|
|
64794
|
+
return;
|
|
64795
|
+
}
|
|
64796
|
+
if (!cachedAffinity) {
|
|
64797
|
+
return { client: client3, route: "in-process", reason: "affinity" };
|
|
64798
|
+
}
|
|
64649
64799
|
const resolvedLiveClient = getOrBuildLiveClient(registration);
|
|
64650
64800
|
if (!resolvedLiveClient) {
|
|
64651
64801
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
@@ -64665,6 +64815,10 @@ async function resolveDispatchClient2(client3, sessionID) {
|
|
|
64665
64815
|
if (!isAvailable) {
|
|
64666
64816
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
64667
64817
|
}
|
|
64818
|
+
const affinity = await resolveSessionAffinity(registration, sessionID);
|
|
64819
|
+
if (affinity === false) {
|
|
64820
|
+
return { client: client3, route: "in-process", reason: "affinity" };
|
|
64821
|
+
}
|
|
64668
64822
|
const resolvedLiveClient = getOrBuildLiveClient(registration);
|
|
64669
64823
|
if (!resolvedLiveClient) {
|
|
64670
64824
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
@@ -64702,10 +64856,11 @@ function markLiveRouteUnavailable2(reason) {
|
|
|
64702
64856
|
for (const registration of registrations.values()) {
|
|
64703
64857
|
registration.available = false;
|
|
64704
64858
|
registration.probeTimestamp = Date.now();
|
|
64859
|
+
registration.sessionAffinity.clear();
|
|
64705
64860
|
}
|
|
64706
64861
|
log2(`[live-server-route] marked unavailable: ${reason}`);
|
|
64707
64862
|
}
|
|
64708
|
-
var PROBE_TTL_MS = 60000, PROBE_ABORT_MS = 1500, registrations, liveParentWakeRoutingDisabled = false, fetchImplementationForTesting;
|
|
64863
|
+
var PROBE_TTL_MS = 60000, PROBE_ABORT_MS = 1500, AFFINITY_TTL_MS = 60000, registrations, liveParentWakeRoutingDisabled = false, fetchImplementationForTesting;
|
|
64709
64864
|
var init_live_server_route = __esm(() => {
|
|
64710
64865
|
init_dist();
|
|
64711
64866
|
init_state();
|
|
@@ -66689,21 +66844,21 @@ var init_config_manager = __esm(() => {
|
|
|
66689
66844
|
});
|
|
66690
66845
|
|
|
66691
66846
|
// packages/telemetry-core/src/activity-state.ts
|
|
66692
|
-
import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as
|
|
66693
|
-
import { basename as basename10, join as
|
|
66847
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as readFileSync14 } from "node:fs";
|
|
66848
|
+
import { basename as basename10, join as join53 } from "node:path";
|
|
66694
66849
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
66695
66850
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
66696
66851
|
env: options.env,
|
|
66697
66852
|
osProvider: options.osProvider
|
|
66698
66853
|
});
|
|
66699
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
66854
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join53(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
66700
66855
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename10(dataDir) === product.cacheDirName) {
|
|
66701
66856
|
return dataDir;
|
|
66702
66857
|
}
|
|
66703
|
-
return
|
|
66858
|
+
return join53(dataDir, product.cacheDirName);
|
|
66704
66859
|
}
|
|
66705
66860
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
66706
|
-
return
|
|
66861
|
+
return join53(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
66707
66862
|
}
|
|
66708
66863
|
function getDailyActiveCaptureState(input) {
|
|
66709
66864
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -66732,7 +66887,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
66732
66887
|
return {};
|
|
66733
66888
|
}
|
|
66734
66889
|
try {
|
|
66735
|
-
const stateContent =
|
|
66890
|
+
const stateContent = readFileSync14(stateFilePath, "utf-8");
|
|
66736
66891
|
const stateJson = JSON.parse(stateContent);
|
|
66737
66892
|
if (!isPostHogActivityState(stateJson)) {
|
|
66738
66893
|
return {};
|
|
@@ -66773,10 +66928,10 @@ var init_activity_state = __esm(() => {
|
|
|
66773
66928
|
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74";
|
|
66774
66929
|
|
|
66775
66930
|
// packages/telemetry-core/src/diagnostics.ts
|
|
66776
|
-
import { appendFileSync as appendFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync9, readFileSync as
|
|
66777
|
-
import { join as
|
|
66931
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync9, readFileSync as readFileSync15 } from "node:fs";
|
|
66932
|
+
import { join as join54 } from "node:path";
|
|
66778
66933
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
66779
|
-
return
|
|
66934
|
+
return join54(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
66780
66935
|
}
|
|
66781
66936
|
function writeTelemetryDiagnostic(input, options) {
|
|
66782
66937
|
const now = options.now ?? new Date;
|
|
@@ -66799,7 +66954,7 @@ function cleanupTelemetryDiagnostics(options) {
|
|
|
66799
66954
|
}
|
|
66800
66955
|
try {
|
|
66801
66956
|
const cutoffMs = (options.now ?? new Date).getTime() - DIAGNOSTICS_RETENTION_MS;
|
|
66802
|
-
const retainedLines = trimToMaxBytes(
|
|
66957
|
+
const retainedLines = trimToMaxBytes(readFileSync15(diagnosticsFilePath, "utf-8").split(`
|
|
66803
66958
|
`).filter((line) => shouldRetainLine(line, cutoffMs)));
|
|
66804
66959
|
writeFileAtomically(diagnosticsFilePath, retainedLines.length === 0 ? "" : `${retainedLines.join(`
|
|
66805
66960
|
`)}
|
|
@@ -66851,7 +67006,7 @@ function shouldRetainLine(line, cutoffMs) {
|
|
|
66851
67006
|
function parseDiagnosticLine(line) {
|
|
66852
67007
|
try {
|
|
66853
67008
|
const parsed = JSON.parse(line);
|
|
66854
|
-
if (!
|
|
67009
|
+
if (!isRecord5(parsed)) {
|
|
66855
67010
|
return null;
|
|
66856
67011
|
}
|
|
66857
67012
|
return parsed;
|
|
@@ -66862,7 +67017,7 @@ function parseDiagnosticLine(line) {
|
|
|
66862
67017
|
throw error;
|
|
66863
67018
|
}
|
|
66864
67019
|
}
|
|
66865
|
-
function
|
|
67020
|
+
function isRecord5(value) {
|
|
66866
67021
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
66867
67022
|
}
|
|
66868
67023
|
function trimToMaxBytes(lines) {
|
|
@@ -66942,7 +67097,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
66942
67097
|
var init_machine_id = () => {};
|
|
66943
67098
|
|
|
66944
67099
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
66945
|
-
import { dirname as
|
|
67100
|
+
import { dirname as dirname18, posix as posix2, sep as sep7 } from "path";
|
|
66946
67101
|
function createModulerModifier() {
|
|
66947
67102
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
66948
67103
|
return async (frames) => {
|
|
@@ -66951,7 +67106,7 @@ function createModulerModifier() {
|
|
|
66951
67106
|
return frames;
|
|
66952
67107
|
};
|
|
66953
67108
|
}
|
|
66954
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
67109
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname18(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
66955
67110
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
66956
67111
|
return (filename) => {
|
|
66957
67112
|
if (!filename)
|
|
@@ -69972,7 +70127,7 @@ var init_context_lines_node = __esm(() => {
|
|
|
69972
70127
|
});
|
|
69973
70128
|
|
|
69974
70129
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
|
|
69975
|
-
import { isAbsolute as
|
|
70130
|
+
import { isAbsolute as isAbsolute9, relative as relative5, sep as sep8 } from "path";
|
|
69976
70131
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
69977
70132
|
const isWindows = sep8 === "\\";
|
|
69978
70133
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
@@ -69980,7 +70135,7 @@ function createRelativePathModifier(basePath = process.cwd()) {
|
|
|
69980
70135
|
return async (frames) => {
|
|
69981
70136
|
for (const frame of frames)
|
|
69982
70137
|
if (!(!frame.filename || frame.filename.startsWith("node:") || frame.filename.startsWith("data:"))) {
|
|
69983
|
-
if (
|
|
70138
|
+
if (isAbsolute9(frame.filename))
|
|
69984
70139
|
frame.filename = toUnix(relative5(normalizedBase, toUnix(frame.filename)));
|
|
69985
70140
|
}
|
|
69986
70141
|
return frames;
|
|
@@ -72497,7 +72652,7 @@ var package_default2;
|
|
|
72497
72652
|
var init_package2 = __esm(() => {
|
|
72498
72653
|
package_default2 = {
|
|
72499
72654
|
name: "@oh-my-opencode/omo-codex",
|
|
72500
|
-
version: "4.16.
|
|
72655
|
+
version: "4.16.3",
|
|
72501
72656
|
type: "module",
|
|
72502
72657
|
private: true,
|
|
72503
72658
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -73467,19 +73622,19 @@ var init_update_toasts = __esm(() => {
|
|
|
73467
73622
|
|
|
73468
73623
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
73469
73624
|
import { existsSync as existsSync49 } from "node:fs";
|
|
73470
|
-
import { dirname as
|
|
73625
|
+
import { dirname as dirname28, join as join72 } from "node:path";
|
|
73471
73626
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
73472
73627
|
function defaultGetModuleHostingWorkspace() {
|
|
73473
73628
|
try {
|
|
73474
|
-
const currentDir =
|
|
73629
|
+
const currentDir = dirname28(fileURLToPath5(import.meta.url));
|
|
73475
73630
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
73476
73631
|
if (!pkgJsonPath)
|
|
73477
73632
|
return null;
|
|
73478
|
-
const pkgDir =
|
|
73479
|
-
const nodeModulesDir =
|
|
73633
|
+
const pkgDir = dirname28(pkgJsonPath);
|
|
73634
|
+
const nodeModulesDir = dirname28(pkgDir);
|
|
73480
73635
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
73481
73636
|
return null;
|
|
73482
|
-
return
|
|
73637
|
+
return dirname28(nodeModulesDir);
|
|
73483
73638
|
} catch (error51) {
|
|
73484
73639
|
if (error51 instanceof Error) {
|
|
73485
73640
|
return null;
|
|
@@ -73621,7 +73776,7 @@ var init_background_update_check = __esm(() => {
|
|
|
73621
73776
|
init_update_toasts();
|
|
73622
73777
|
defaultDeps4 = {
|
|
73623
73778
|
existsSync: existsSync49,
|
|
73624
|
-
join:
|
|
73779
|
+
join: join72,
|
|
73625
73780
|
runBunInstallWithDetails,
|
|
73626
73781
|
log: log2,
|
|
73627
73782
|
getOpenCodeCacheDir,
|
|
@@ -74230,7 +74385,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
74230
74385
|
}
|
|
74231
74386
|
|
|
74232
74387
|
// packages/omo-codex/src/install/install-codex.ts
|
|
74233
|
-
import { join as
|
|
74388
|
+
import { join as join55, resolve as resolve15 } from "node:path";
|
|
74234
74389
|
import { existsSync as existsSync30 } from "node:fs";
|
|
74235
74390
|
import { homedir as homedir6 } from "node:os";
|
|
74236
74391
|
|
|
@@ -75314,7 +75469,12 @@ function shouldCopyPluginPath(path7, root) {
|
|
|
75314
75469
|
if (relative5 === "")
|
|
75315
75470
|
return true;
|
|
75316
75471
|
const parts = relative5.split(sep5);
|
|
75317
|
-
|
|
75472
|
+
if (parts.some((part) => part === ".git" || part === "node_modules"))
|
|
75473
|
+
return false;
|
|
75474
|
+
return !isNestedComponentMcpManifest(parts);
|
|
75475
|
+
}
|
|
75476
|
+
function isNestedComponentMcpManifest(parts) {
|
|
75477
|
+
return parts.length > 1 && parts.at(-1) === ".mcp.json";
|
|
75318
75478
|
}
|
|
75319
75479
|
var removedSparkshellReferencePattern = /\b(?:sparkshell|spark[-_\s]+shell)\b/i;
|
|
75320
75480
|
var removedSparkshellPromptSurfaceDirs = new Set([".codex-plugin", "agents", "bundled-rules", "hooks", "skills"]);
|
|
@@ -75520,7 +75680,7 @@ async function shouldBuildSourcePackages(repoRoot) {
|
|
|
75520
75680
|
|
|
75521
75681
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
75522
75682
|
import { mkdir as mkdir5, readFile as readFile11 } from "node:fs/promises";
|
|
75523
|
-
import { dirname as
|
|
75683
|
+
import { dirname as dirname16 } from "node:path";
|
|
75524
75684
|
|
|
75525
75685
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
75526
75686
|
function findTomlSection(config, header) {
|
|
@@ -75841,6 +76001,9 @@ function stripTomlLineComment(line) {
|
|
|
75841
76001
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE = ["codex-ultrawork-reviewer"];
|
|
75842
76002
|
var CURRENT_MANAGED_CODEX_AGENT_NAMES = [
|
|
75843
76003
|
"explorer",
|
|
76004
|
+
"lazycodex-worker-high",
|
|
76005
|
+
"lazycodex-worker-low",
|
|
76006
|
+
"lazycodex-worker-medium",
|
|
75844
76007
|
"librarian",
|
|
75845
76008
|
"metis",
|
|
75846
76009
|
"momus",
|
|
@@ -76258,12 +76421,18 @@ import { readFile as readFile10 } from "node:fs/promises";
|
|
|
76258
76421
|
import { join as join38 } from "node:path";
|
|
76259
76422
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
76260
76423
|
current: {
|
|
76261
|
-
model: "gpt-5.
|
|
76262
|
-
modelContextWindow:
|
|
76424
|
+
model: "gpt-5.6-sol",
|
|
76425
|
+
modelContextWindow: 372000,
|
|
76263
76426
|
modelReasoningEffort: "high",
|
|
76264
76427
|
planModeReasoningEffort: "xhigh"
|
|
76265
76428
|
},
|
|
76266
76429
|
managedProfiles: [
|
|
76430
|
+
{
|
|
76431
|
+
model: "gpt-5.5",
|
|
76432
|
+
modelContextWindow: 400000,
|
|
76433
|
+
modelReasoningEffort: "high",
|
|
76434
|
+
planModeReasoningEffort: "xhigh"
|
|
76435
|
+
},
|
|
76267
76436
|
{
|
|
76268
76437
|
model: "gpt-5.5",
|
|
76269
76438
|
modelContextWindow: 1e6,
|
|
@@ -76357,30 +76526,87 @@ function isRootSetting2(line, key) {
|
|
|
76357
76526
|
}
|
|
76358
76527
|
|
|
76359
76528
|
// packages/omo-codex/src/install/codex-multi-agent-v2-config.ts
|
|
76529
|
+
import { readFileSync as readFileSync13 } from "node:fs";
|
|
76530
|
+
import { dirname as dirname15, isAbsolute as isAbsolute8, join as join39 } from "node:path";
|
|
76360
76531
|
var CODEX_AGENTS_HEADER = "agents";
|
|
76361
76532
|
var CODEX_MULTI_AGENT_V2_HEADER = "features.multi_agent_v2";
|
|
76362
76533
|
var CODEX_SUBAGENT_THREAD_LIMIT = 1000;
|
|
76363
|
-
function ensureCodexMultiAgentV2Config(config) {
|
|
76534
|
+
function ensureCodexMultiAgentV2Config(config, options = {}) {
|
|
76364
76535
|
const featureFlag = removeFeatureFlagSetting(config, "multi_agent_v2");
|
|
76365
|
-
const
|
|
76366
|
-
const
|
|
76536
|
+
const v2Preferred = options.multiAgentVersion === "v2";
|
|
76537
|
+
const modelKnown = options.multiAgentVersion != null || readRootModel(featureFlag.config) !== null;
|
|
76538
|
+
const agentsConfig = v2Preferred ? removeAgentsMaxThreads(featureFlag.config) : modelKnown ? ensureAgentsMaxThreads(featureFlag.config) : raiseExistingAgentsMaxThreads(featureFlag.config);
|
|
76367
76539
|
const maxThreadsValue = CODEX_SUBAGENT_THREAD_LIMIT.toString();
|
|
76540
|
+
const preserveDisable = featureFlag.value === false && !v2Preferred;
|
|
76541
|
+
const featureConfig = preserveDisable ? setMultiAgentV2Disable(agentsConfig) : v2Preferred ? removeMultiAgentV2Disable(agentsConfig) : agentsConfig;
|
|
76542
|
+
const section = findTomlSection(featureConfig, CODEX_MULTI_AGENT_V2_HEADER);
|
|
76368
76543
|
if (!section) {
|
|
76369
|
-
const enabledSetting =
|
|
76544
|
+
const enabledSetting = preserveDisable ? `enabled = false
|
|
76370
76545
|
` : "";
|
|
76371
|
-
return appendBlock(
|
|
76546
|
+
return appendBlock(featureConfig, `[${CODEX_MULTI_AGENT_V2_HEADER}]
|
|
76372
76547
|
${enabledSetting}max_concurrent_threads_per_session = ${maxThreadsValue}
|
|
76373
76548
|
`);
|
|
76374
76549
|
}
|
|
76375
|
-
|
|
76376
|
-
|
|
76377
|
-
|
|
76378
|
-
|
|
76379
|
-
|
|
76380
|
-
|
|
76381
|
-
|
|
76550
|
+
return replaceOrInsertSetting(featureConfig, section, "max_concurrent_threads_per_session", maxThreadsValue);
|
|
76551
|
+
}
|
|
76552
|
+
function resolveCodexMultiAgentVersion(config, configPath) {
|
|
76553
|
+
const model = readRootModel(config);
|
|
76554
|
+
if (model === null)
|
|
76555
|
+
return null;
|
|
76556
|
+
const catalogPath = resolveCatalogPath(readRootModelCatalogPath(config), configPath);
|
|
76557
|
+
const catalogVersion = readCatalogMultiAgentVersion(model, catalogPath);
|
|
76558
|
+
if (catalogVersion !== null)
|
|
76559
|
+
return catalogVersion;
|
|
76560
|
+
return /^gpt-5\.6\b/i.test(model) ? "v2" : null;
|
|
76561
|
+
}
|
|
76562
|
+
function resolveCatalogPath(configuredPath, configPath) {
|
|
76563
|
+
if (configuredPath === null)
|
|
76564
|
+
return join39(dirname15(configPath), "models_cache.json");
|
|
76565
|
+
return isAbsolute8(configuredPath) ? configuredPath : join39(dirname15(configPath), configuredPath);
|
|
76566
|
+
}
|
|
76567
|
+
function readCatalogMultiAgentVersion(model, cachePath) {
|
|
76568
|
+
let raw;
|
|
76569
|
+
try {
|
|
76570
|
+
raw = readFileSync13(cachePath, "utf8");
|
|
76571
|
+
} catch {
|
|
76572
|
+
return null;
|
|
76573
|
+
}
|
|
76574
|
+
let cache;
|
|
76575
|
+
try {
|
|
76576
|
+
cache = JSON.parse(raw);
|
|
76577
|
+
} catch {
|
|
76578
|
+
return null;
|
|
76579
|
+
}
|
|
76580
|
+
if (!isRecord4(cache) || !Array.isArray(cache.models))
|
|
76581
|
+
return null;
|
|
76582
|
+
for (const entry of cache.models) {
|
|
76583
|
+
if (!isRecord4(entry))
|
|
76584
|
+
continue;
|
|
76585
|
+
if (entry.slug !== model && entry.id !== model)
|
|
76586
|
+
continue;
|
|
76587
|
+
const version = entry.multi_agent_version;
|
|
76588
|
+
if (version === "v1" || version === "v2")
|
|
76589
|
+
return version;
|
|
76590
|
+
return null;
|
|
76382
76591
|
}
|
|
76383
|
-
return
|
|
76592
|
+
return null;
|
|
76593
|
+
}
|
|
76594
|
+
function readRootModel(config) {
|
|
76595
|
+
const double = config.match(/^\s*model\s*=\s*"([^"]+)"/m);
|
|
76596
|
+
if (double !== null)
|
|
76597
|
+
return double[1] ?? null;
|
|
76598
|
+
const single = config.match(/^\s*model\s*=\s*'([^']+)'/m);
|
|
76599
|
+
return single?.[1] ?? null;
|
|
76600
|
+
}
|
|
76601
|
+
function readRootModelCatalogPath(config) {
|
|
76602
|
+
const double = config.match(/^\s*model_catalog_json\s*=\s*"([^"]+)"/m);
|
|
76603
|
+
if (double !== null)
|
|
76604
|
+
return double[1] ?? null;
|
|
76605
|
+
const single = config.match(/^\s*model_catalog_json\s*=\s*'([^']+)'/m);
|
|
76606
|
+
return single?.[1] ?? null;
|
|
76607
|
+
}
|
|
76608
|
+
function isRecord4(value) {
|
|
76609
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
76384
76610
|
}
|
|
76385
76611
|
function removeFeatureFlagSetting(config, featureName) {
|
|
76386
76612
|
const section = findTomlSection(config, "features");
|
|
@@ -76401,6 +76627,36 @@ max_threads = ${maxThreadsValue}
|
|
|
76401
76627
|
}
|
|
76402
76628
|
return replaceOrInsertSetting(config, section, "max_threads", maxThreadsValue);
|
|
76403
76629
|
}
|
|
76630
|
+
function removeAgentsMaxThreads(config) {
|
|
76631
|
+
const section = findTomlSection(config, CODEX_AGENTS_HEADER);
|
|
76632
|
+
if (!section)
|
|
76633
|
+
return config;
|
|
76634
|
+
if (!/^\s*max_threads\s*=/m.test(section.text))
|
|
76635
|
+
return config;
|
|
76636
|
+
return removeSetting(config, section, "max_threads");
|
|
76637
|
+
}
|
|
76638
|
+
function removeMultiAgentV2Disable(config) {
|
|
76639
|
+
const section = findTomlSection(config, CODEX_MULTI_AGENT_V2_HEADER);
|
|
76640
|
+
if (!section)
|
|
76641
|
+
return config;
|
|
76642
|
+
if (!/^\s*enabled\s*=\s*false(?:\s*#.*)?$/m.test(section.text))
|
|
76643
|
+
return config;
|
|
76644
|
+
return removeSetting(config, section, "enabled");
|
|
76645
|
+
}
|
|
76646
|
+
function setMultiAgentV2Disable(config) {
|
|
76647
|
+
const section = findTomlSection(config, CODEX_MULTI_AGENT_V2_HEADER);
|
|
76648
|
+
if (!section)
|
|
76649
|
+
return config;
|
|
76650
|
+
return replaceOrInsertSetting(config, section, "enabled", "false");
|
|
76651
|
+
}
|
|
76652
|
+
function raiseExistingAgentsMaxThreads(config) {
|
|
76653
|
+
const section = findTomlSection(config, CODEX_AGENTS_HEADER);
|
|
76654
|
+
if (!section)
|
|
76655
|
+
return config;
|
|
76656
|
+
if (!/^\s*max_threads\s*=/m.test(section.text))
|
|
76657
|
+
return config;
|
|
76658
|
+
return replaceOrInsertSetting(config, section, "max_threads", CODEX_SUBAGENT_THREAD_LIMIT.toString());
|
|
76659
|
+
}
|
|
76404
76660
|
function readBooleanSetting(sectionText, key) {
|
|
76405
76661
|
const match = new RegExp(`^\\s*${escapeRegExp(key)}\\s*=\\s*(true|false)\\s*(?:#.*)?$`, "m").exec(sectionText);
|
|
76406
76662
|
if (!match)
|
|
@@ -76410,7 +76666,7 @@ function readBooleanSetting(sectionText, key) {
|
|
|
76410
76666
|
|
|
76411
76667
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
76412
76668
|
async function updateCodexConfig(input) {
|
|
76413
|
-
await mkdir5(
|
|
76669
|
+
await mkdir5(dirname16(input.configPath), { recursive: true });
|
|
76414
76670
|
let config;
|
|
76415
76671
|
try {
|
|
76416
76672
|
config = await readFile11(input.configPath, "utf8");
|
|
@@ -76433,7 +76689,9 @@ async function updateCodexConfig(input) {
|
|
|
76433
76689
|
config = ensureFeatureEnabled(config, "multi_agent");
|
|
76434
76690
|
config = removeUnsupportedCodexMultiAgentModeConfig(config);
|
|
76435
76691
|
config = ensureCodexReasoningConfig(config, await readCodexModelCatalog(input.repoRoot));
|
|
76436
|
-
config = ensureCodexMultiAgentV2Config(config
|
|
76692
|
+
config = ensureCodexMultiAgentV2Config(config, {
|
|
76693
|
+
multiAgentVersion: resolveCodexMultiAgentVersion(config, input.configPath)
|
|
76694
|
+
});
|
|
76437
76695
|
if (input.autonomousPermissions === true)
|
|
76438
76696
|
config = ensureAutonomousPermissions(config);
|
|
76439
76697
|
if (!(input.preserveMarketplaceSource === true && hasMarketplaceBlock(config, input.marketplaceName))) {
|
|
@@ -76459,7 +76717,7 @@ function isMissingFileError(error) {
|
|
|
76459
76717
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
76460
76718
|
import { createHash as createHash2 } from "node:crypto";
|
|
76461
76719
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
76462
|
-
import { join as
|
|
76720
|
+
import { join as join40 } from "node:path";
|
|
76463
76721
|
var EVENT_LABELS = new Map([
|
|
76464
76722
|
["PreToolUse", "pre_tool_use"],
|
|
76465
76723
|
["PermissionRequest", "permission_request"],
|
|
@@ -76473,7 +76731,7 @@ var EVENT_LABELS = new Map([
|
|
|
76473
76731
|
["Stop", "stop"]
|
|
76474
76732
|
]);
|
|
76475
76733
|
async function trustedHookStatesForPlugin(input) {
|
|
76476
|
-
const manifestPath =
|
|
76734
|
+
const manifestPath = join40(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
76477
76735
|
if (!await exists(manifestPath))
|
|
76478
76736
|
return [];
|
|
76479
76737
|
const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
|
|
@@ -76481,7 +76739,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
76481
76739
|
return [];
|
|
76482
76740
|
const states = [];
|
|
76483
76741
|
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
76484
|
-
const hooksPath =
|
|
76742
|
+
const hooksPath = join40(input.pluginRoot, hookPath);
|
|
76485
76743
|
if (!await exists(hooksPath))
|
|
76486
76744
|
continue;
|
|
76487
76745
|
const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
|
|
@@ -76607,207 +76865,181 @@ function toCodexResolution(resolution) {
|
|
|
76607
76865
|
}
|
|
76608
76866
|
|
|
76609
76867
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
76610
|
-
import { copyFile, lstat as
|
|
76611
|
-
import { basename as basename9, join as
|
|
76868
|
+
import { copyFile, lstat as lstat9, mkdir as mkdir6, readdir as readdir7, rm as rm8, writeFile as writeFile7 } from "node:fs/promises";
|
|
76869
|
+
import { basename as basename9, join as join43 } from "node:path";
|
|
76612
76870
|
|
|
76613
|
-
// packages/omo-codex/src/install/
|
|
76614
|
-
import { lstat as lstat7, readFile as readFile13,
|
|
76615
|
-
import { join as
|
|
76616
|
-
|
|
76617
|
-
|
|
76618
|
-
|
|
76619
|
-
|
|
76620
|
-
|
|
76621
|
-
|
|
76622
|
-
|
|
76871
|
+
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
76872
|
+
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
76873
|
+
import { join as join41 } from "node:path";
|
|
76874
|
+
|
|
76875
|
+
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
|
|
76876
|
+
var MANAGED_REASONING_DEFAULT_UPGRADES = new Map([
|
|
76877
|
+
[
|
|
76878
|
+
"explorer",
|
|
76879
|
+
[
|
|
76880
|
+
{
|
|
76881
|
+
previous: { model: "gpt-5.4-mini", effort: "low" },
|
|
76882
|
+
current: { model: "gpt-5.6-terra", effort: "medium" }
|
|
76883
|
+
},
|
|
76884
|
+
{
|
|
76885
|
+
previous: { model: "gpt-5.6-terra", effort: "medium" },
|
|
76886
|
+
current: { model: "gpt-5.6-luna", effort: "low" }
|
|
76887
|
+
}
|
|
76623
76888
|
]
|
|
76889
|
+
],
|
|
76890
|
+
[
|
|
76891
|
+
"librarian",
|
|
76892
|
+
[
|
|
76893
|
+
{
|
|
76894
|
+
previous: { model: "gpt-5.4-mini", effort: "low" },
|
|
76895
|
+
current: { model: "gpt-5.6-terra", effort: "medium" }
|
|
76896
|
+
},
|
|
76897
|
+
{
|
|
76898
|
+
previous: { model: "gpt-5.6-terra", effort: "medium" },
|
|
76899
|
+
current: { model: "gpt-5.6-luna", effort: "low" }
|
|
76900
|
+
}
|
|
76901
|
+
]
|
|
76902
|
+
],
|
|
76903
|
+
[
|
|
76904
|
+
"momus",
|
|
76905
|
+
[
|
|
76906
|
+
{
|
|
76907
|
+
previous: { model: "gpt-5.5", effort: "xhigh" },
|
|
76908
|
+
current: { model: "gpt-5.6-sol", effort: "ultra" }
|
|
76909
|
+
}
|
|
76910
|
+
]
|
|
76911
|
+
],
|
|
76912
|
+
[
|
|
76913
|
+
"plan",
|
|
76914
|
+
[
|
|
76915
|
+
{
|
|
76916
|
+
previous: { model: "gpt-5.6-sol", effort: "xhigh" },
|
|
76917
|
+
current: { model: "gpt-5.6-sol", effort: "max" }
|
|
76918
|
+
}
|
|
76919
|
+
]
|
|
76920
|
+
],
|
|
76921
|
+
[
|
|
76922
|
+
"lazycodex-worker-medium",
|
|
76923
|
+
[
|
|
76924
|
+
{
|
|
76925
|
+
previous: { model: "gpt-5.6-sol", effort: "high" },
|
|
76926
|
+
current: { model: "gpt-5.6-luna", effort: "max" }
|
|
76927
|
+
}
|
|
76928
|
+
]
|
|
76929
|
+
],
|
|
76930
|
+
[
|
|
76931
|
+
"lazycodex-qa-executor",
|
|
76932
|
+
[
|
|
76933
|
+
{
|
|
76934
|
+
previous: { model: "gpt-5.6-terra", effort: "medium" },
|
|
76935
|
+
current: { model: "gpt-5.6-luna", effort: "high" }
|
|
76936
|
+
}
|
|
76937
|
+
]
|
|
76938
|
+
],
|
|
76939
|
+
[
|
|
76940
|
+
"lazycodex-gate-reviewer",
|
|
76941
|
+
[
|
|
76942
|
+
{
|
|
76943
|
+
previous: { model: "gpt-5.6-sol", effort: "xhigh" },
|
|
76944
|
+
current: { model: "gpt-5.6-sol", effort: "high" }
|
|
76945
|
+
}
|
|
76946
|
+
]
|
|
76947
|
+
]
|
|
76948
|
+
]);
|
|
76949
|
+
function resolveManagedAgentReasoning(input) {
|
|
76950
|
+
const steps = MANAGED_REASONING_DEFAULT_UPGRADES.get(input.agentName);
|
|
76951
|
+
if (steps === undefined)
|
|
76952
|
+
return input.preserved.effort;
|
|
76953
|
+
const latest = steps[steps.length - 1];
|
|
76954
|
+
if (latest === undefined)
|
|
76955
|
+
return input.preserved.effort;
|
|
76956
|
+
if (input.bundledModel !== latest.current.model || input.bundledEffort !== latest.current.effort) {
|
|
76957
|
+
return input.preserved.effort;
|
|
76624
76958
|
}
|
|
76625
|
-
|
|
76626
|
-
|
|
76627
|
-
const agentsDir = join40(input.codexHome, "agents");
|
|
76628
|
-
if (!await exists2(agentsDir))
|
|
76629
|
-
return;
|
|
76630
|
-
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
76631
|
-
const agentPath = join40(agentsDir, retiredAgent.fileName);
|
|
76632
|
-
if (!await exists2(agentPath))
|
|
76633
|
-
continue;
|
|
76634
|
-
const agentStat = await lstat7(agentPath);
|
|
76635
|
-
if (agentStat.isDirectory() && !agentStat.isSymbolicLink())
|
|
76636
|
-
continue;
|
|
76637
|
-
const content = await readTextIfExists(agentPath);
|
|
76638
|
-
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
76639
|
-
continue;
|
|
76640
|
-
await rm7(agentPath, { force: true });
|
|
76641
|
-
}
|
|
76642
|
-
}
|
|
76643
|
-
function hasRequiredMarkers(content, markers) {
|
|
76644
|
-
return markers.every((marker) => content.includes(marker));
|
|
76645
|
-
}
|
|
76646
|
-
async function readTextIfExists(path7) {
|
|
76647
|
-
try {
|
|
76648
|
-
return await readFile13(path7, "utf8");
|
|
76649
|
-
} catch (error) {
|
|
76650
|
-
if (nodeErrorCode(error) === "ENOENT")
|
|
76651
|
-
return null;
|
|
76652
|
-
throw error;
|
|
76653
|
-
}
|
|
76654
|
-
}
|
|
76655
|
-
async function exists2(path7) {
|
|
76656
|
-
try {
|
|
76657
|
-
await lstat7(path7);
|
|
76658
|
-
return true;
|
|
76659
|
-
} catch (error) {
|
|
76660
|
-
if (nodeErrorCode(error) !== "ENOENT")
|
|
76661
|
-
throw error;
|
|
76662
|
-
return false;
|
|
76663
|
-
}
|
|
76664
|
-
}
|
|
76665
|
-
function nodeErrorCode(error) {
|
|
76666
|
-
if (!(error instanceof Error) || !("code" in error))
|
|
76667
|
-
return null;
|
|
76668
|
-
return typeof error.code === "string" ? error.code : null;
|
|
76959
|
+
const preservedMatchesAnyStep = steps.some((step) => input.preserved.model === step.previous.model && input.preserved.effort === step.previous.effort);
|
|
76960
|
+
return preservedMatchesAnyStep ? latest.current.effort : input.preserved.effort;
|
|
76669
76961
|
}
|
|
76670
76962
|
|
|
76671
|
-
// packages/omo-codex/src/install/
|
|
76672
|
-
var MANIFEST_FILE = ".installed-agents.json";
|
|
76963
|
+
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
76673
76964
|
async function capturePreservedAgentReasoning(input) {
|
|
76674
76965
|
const agentsDir = join41(input.codexHome, "agents");
|
|
76675
|
-
if (!await
|
|
76966
|
+
if (!await exists2(agentsDir))
|
|
76676
76967
|
return new Map;
|
|
76677
76968
|
const preserved = new Map;
|
|
76678
76969
|
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
76679
76970
|
for (const entry of agentEntries) {
|
|
76680
76971
|
if (!entry.name.endsWith(".toml"))
|
|
76681
76972
|
continue;
|
|
76682
|
-
const content = await
|
|
76973
|
+
const content = await readTextIfExists(join41(agentsDir, entry.name));
|
|
76683
76974
|
if (content === null)
|
|
76684
76975
|
continue;
|
|
76685
76976
|
const effort = extractReasoningEffort(content);
|
|
76686
|
-
if (effort !== null)
|
|
76687
|
-
preserved.set(agentNameFromToml(entry.name),
|
|
76977
|
+
if (effort !== null) {
|
|
76978
|
+
preserved.set(agentNameFromToml(entry.name), {
|
|
76979
|
+
model: extractModel(content),
|
|
76980
|
+
effort
|
|
76981
|
+
});
|
|
76982
|
+
}
|
|
76688
76983
|
}
|
|
76689
76984
|
return preserved;
|
|
76690
76985
|
}
|
|
76691
76986
|
async function capturePreservedAgentServiceTier(input) {
|
|
76692
76987
|
const agentsDir = join41(input.codexHome, "agents");
|
|
76693
|
-
if (!await
|
|
76988
|
+
if (!await exists2(agentsDir))
|
|
76694
76989
|
return new Map;
|
|
76695
76990
|
const preserved = new Map;
|
|
76696
76991
|
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
76697
76992
|
for (const entry of agentEntries) {
|
|
76698
76993
|
if (!entry.name.endsWith(".toml"))
|
|
76699
76994
|
continue;
|
|
76700
|
-
const content = await
|
|
76995
|
+
const content = await readTextIfExists(join41(agentsDir, entry.name));
|
|
76701
76996
|
if (content === null)
|
|
76702
76997
|
continue;
|
|
76703
76998
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
76704
76999
|
}
|
|
76705
77000
|
return preserved;
|
|
76706
77001
|
}
|
|
76707
|
-
async function
|
|
76708
|
-
|
|
76709
|
-
await purgeRetiredManagedAgentFiles({ codexHome: input.codexHome });
|
|
76710
|
-
if (bundledAgents.length === 0) {
|
|
76711
|
-
await writeManifest(input.pluginRoot, []);
|
|
76712
|
-
return [];
|
|
76713
|
-
}
|
|
76714
|
-
const agentsDir = join41(input.codexHome, "agents");
|
|
76715
|
-
await mkdir6(agentsDir, { recursive: true });
|
|
76716
|
-
const linked = [];
|
|
76717
|
-
for (const agentPath of bundledAgents) {
|
|
76718
|
-
const agentFileName = basename9(agentPath);
|
|
76719
|
-
const agentName = agentNameFromToml(agentFileName);
|
|
76720
|
-
const linkPath = join41(agentsDir, agentFileName);
|
|
76721
|
-
await replaceWithCopy(linkPath, agentPath);
|
|
76722
|
-
await restorePreservedReasoning({
|
|
76723
|
-
agentName,
|
|
76724
|
-
linkPath,
|
|
76725
|
-
target: agentPath,
|
|
76726
|
-
value: input.preservedReasoning?.get(agentName)
|
|
76727
|
-
});
|
|
76728
|
-
await restorePreservedServiceTier({
|
|
76729
|
-
linkPath,
|
|
76730
|
-
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
76731
|
-
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
76732
|
-
});
|
|
76733
|
-
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
76734
|
-
}
|
|
76735
|
-
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
76736
|
-
return linked;
|
|
76737
|
-
}
|
|
76738
|
-
async function restorePreservedServiceTier(input) {
|
|
76739
|
-
if (!input.preserved)
|
|
77002
|
+
async function restorePreservedReasoning(input) {
|
|
77003
|
+
if (input.value === undefined)
|
|
76740
77004
|
return;
|
|
76741
|
-
const content = await
|
|
76742
|
-
|
|
77005
|
+
const content = await readFile13(input.target, "utf8");
|
|
77006
|
+
const bundledEffort = extractReasoningEffort(content);
|
|
77007
|
+
const effort = resolveManagedAgentReasoning({
|
|
77008
|
+
agentName: input.agentName,
|
|
77009
|
+
bundledModel: extractModel(content),
|
|
77010
|
+
bundledEffort,
|
|
77011
|
+
preserved: input.value
|
|
77012
|
+
});
|
|
77013
|
+
if (bundledEffort === effort)
|
|
76743
77014
|
return;
|
|
76744
|
-
const replacement =
|
|
77015
|
+
const replacement = replaceTopLevelStringSetting(content, "model_reasoning_effort", effort, { insertIfMissing: false });
|
|
76745
77016
|
if (!replacement.replaced)
|
|
76746
77017
|
return;
|
|
76747
77018
|
await writeFile6(input.linkPath, replacement.content);
|
|
76748
77019
|
}
|
|
76749
|
-
async function
|
|
76750
|
-
|
|
76751
|
-
if (!await exists3(componentsRoot))
|
|
76752
|
-
return [];
|
|
76753
|
-
const componentEntries = await readdir6(componentsRoot, { withFileTypes: true });
|
|
76754
|
-
const agents = [];
|
|
76755
|
-
for (const entry of componentEntries) {
|
|
76756
|
-
if (!entry.isDirectory())
|
|
76757
|
-
continue;
|
|
76758
|
-
const agentsRoot = join41(componentsRoot, entry.name, "agents");
|
|
76759
|
-
if (!await exists3(agentsRoot))
|
|
76760
|
-
continue;
|
|
76761
|
-
const agentEntries = await readdir6(agentsRoot, { withFileTypes: true });
|
|
76762
|
-
for (const file2 of agentEntries) {
|
|
76763
|
-
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
76764
|
-
continue;
|
|
76765
|
-
agents.push(join41(agentsRoot, file2.name));
|
|
76766
|
-
}
|
|
76767
|
-
}
|
|
76768
|
-
agents.sort();
|
|
76769
|
-
return agents;
|
|
76770
|
-
}
|
|
76771
|
-
async function replaceWithCopy(linkPath, target) {
|
|
76772
|
-
await prepareReplacement(linkPath);
|
|
76773
|
-
await copyFile(target, linkPath);
|
|
76774
|
-
}
|
|
76775
|
-
async function prepareReplacement(linkPath) {
|
|
76776
|
-
if (!await exists3(linkPath))
|
|
76777
|
-
return;
|
|
76778
|
-
const entryStat = await lstat8(linkPath);
|
|
76779
|
-
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
76780
|
-
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
76781
|
-
}
|
|
76782
|
-
await rm8(linkPath, { force: true });
|
|
76783
|
-
}
|
|
76784
|
-
async function writeManifest(pluginRoot, agentPaths) {
|
|
76785
|
-
const manifestPath = join41(pluginRoot, MANIFEST_FILE);
|
|
76786
|
-
const payload = { agents: [...agentPaths].sort() };
|
|
76787
|
-
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
76788
|
-
`);
|
|
76789
|
-
}
|
|
76790
|
-
async function restorePreservedReasoning(input) {
|
|
76791
|
-
if (input.value === undefined)
|
|
77020
|
+
async function restorePreservedServiceTier(input) {
|
|
77021
|
+
if (!input.preserved)
|
|
76792
77022
|
return;
|
|
76793
|
-
const content = await
|
|
76794
|
-
|
|
76795
|
-
if (bundledEffort === input.value)
|
|
77023
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
77024
|
+
if (extractServiceTier(content) === input.value)
|
|
76796
77025
|
return;
|
|
76797
|
-
const replacement =
|
|
77026
|
+
const replacement = replaceTopLevelStringSetting(content, "service_tier", input.value, { insertIfMissing: true });
|
|
76798
77027
|
if (!replacement.replaced)
|
|
76799
77028
|
return;
|
|
76800
77029
|
await writeFile6(input.linkPath, replacement.content);
|
|
76801
77030
|
}
|
|
76802
|
-
async function
|
|
77031
|
+
async function readTextIfExists(path7) {
|
|
76803
77032
|
try {
|
|
76804
|
-
return await
|
|
77033
|
+
return await readFile13(path7, "utf8");
|
|
76805
77034
|
} catch (error) {
|
|
76806
|
-
if (
|
|
77035
|
+
if (nodeErrorCode(error) === "ENOENT")
|
|
76807
77036
|
return null;
|
|
76808
77037
|
throw error;
|
|
76809
77038
|
}
|
|
76810
77039
|
}
|
|
77040
|
+
function extractModel(content) {
|
|
77041
|
+
return extractTopLevelStringSetting(content, "model");
|
|
77042
|
+
}
|
|
76811
77043
|
function extractReasoningEffort(content) {
|
|
76812
77044
|
return extractTopLevelStringSetting(content, "model_reasoning_effort");
|
|
76813
77045
|
}
|
|
@@ -76827,12 +77059,6 @@ function extractTopLevelStringSetting(content, key) {
|
|
|
76827
77059
|
}
|
|
76828
77060
|
return null;
|
|
76829
77061
|
}
|
|
76830
|
-
function replaceReasoningEffort(content, value) {
|
|
76831
|
-
return replaceTopLevelStringSetting(content, "model_reasoning_effort", value, { insertIfMissing: false });
|
|
76832
|
-
}
|
|
76833
|
-
function replaceServiceTier(content, value) {
|
|
76834
|
-
return replaceTopLevelStringSetting(content, "service_tier", value, { insertIfMissing: true });
|
|
76835
|
-
}
|
|
76836
77062
|
function replaceTopLevelStringSetting(content, key, value, options) {
|
|
76837
77063
|
const lines = content.split(/\n/);
|
|
76838
77064
|
for (let index = 0;index < lines.length; index += 1) {
|
|
@@ -76892,6 +77118,64 @@ function parseJsonString(value) {
|
|
|
76892
77118
|
return null;
|
|
76893
77119
|
}
|
|
76894
77120
|
}
|
|
77121
|
+
async function exists2(path7) {
|
|
77122
|
+
try {
|
|
77123
|
+
await lstat7(path7);
|
|
77124
|
+
return true;
|
|
77125
|
+
} catch (error) {
|
|
77126
|
+
if (nodeErrorCode(error) !== "ENOENT")
|
|
77127
|
+
throw error;
|
|
77128
|
+
return false;
|
|
77129
|
+
}
|
|
77130
|
+
}
|
|
77131
|
+
function nodeErrorCode(error) {
|
|
77132
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
77133
|
+
return null;
|
|
77134
|
+
return typeof error.code === "string" ? error.code : null;
|
|
77135
|
+
}
|
|
77136
|
+
|
|
77137
|
+
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
77138
|
+
import { lstat as lstat8, readFile as readFile14, rm as rm7 } from "node:fs/promises";
|
|
77139
|
+
import { join as join42 } from "node:path";
|
|
77140
|
+
var RETIRED_MANAGED_AGENT_FILES = [
|
|
77141
|
+
{
|
|
77142
|
+
fileName: "codex-ultrawork-reviewer.toml",
|
|
77143
|
+
requiredMarkers: [
|
|
77144
|
+
'name = "codex-ultrawork-reviewer"',
|
|
77145
|
+
'description = "Strict ultrawork verification reviewer.',
|
|
77146
|
+
'developer_instructions = """You are the ultrawork verification reviewer.'
|
|
77147
|
+
]
|
|
77148
|
+
}
|
|
77149
|
+
];
|
|
77150
|
+
async function purgeRetiredManagedAgentFiles(input) {
|
|
77151
|
+
const agentsDir = join42(input.codexHome, "agents");
|
|
77152
|
+
if (!await exists3(agentsDir))
|
|
77153
|
+
return;
|
|
77154
|
+
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
77155
|
+
const agentPath = join42(agentsDir, retiredAgent.fileName);
|
|
77156
|
+
if (!await exists3(agentPath))
|
|
77157
|
+
continue;
|
|
77158
|
+
const agentStat = await lstat8(agentPath);
|
|
77159
|
+
if (agentStat.isDirectory() && !agentStat.isSymbolicLink())
|
|
77160
|
+
continue;
|
|
77161
|
+
const content = await readTextIfExists2(agentPath);
|
|
77162
|
+
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
77163
|
+
continue;
|
|
77164
|
+
await rm7(agentPath, { force: true });
|
|
77165
|
+
}
|
|
77166
|
+
}
|
|
77167
|
+
function hasRequiredMarkers(content, markers) {
|
|
77168
|
+
return markers.every((marker) => content.includes(marker));
|
|
77169
|
+
}
|
|
77170
|
+
async function readTextIfExists2(path7) {
|
|
77171
|
+
try {
|
|
77172
|
+
return await readFile14(path7, "utf8");
|
|
77173
|
+
} catch (error) {
|
|
77174
|
+
if (nodeErrorCode2(error) === "ENOENT")
|
|
77175
|
+
return null;
|
|
77176
|
+
throw error;
|
|
77177
|
+
}
|
|
77178
|
+
}
|
|
76895
77179
|
async function exists3(path7) {
|
|
76896
77180
|
try {
|
|
76897
77181
|
await lstat8(path7);
|
|
@@ -76908,12 +77192,105 @@ function nodeErrorCode2(error) {
|
|
|
76908
77192
|
return typeof error.code === "string" ? error.code : null;
|
|
76909
77193
|
}
|
|
76910
77194
|
|
|
77195
|
+
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
77196
|
+
var MANIFEST_FILE = ".installed-agents.json";
|
|
77197
|
+
async function linkCachedPluginAgents(input) {
|
|
77198
|
+
const bundledAgents = await discoverBundledAgents(input.pluginRoot);
|
|
77199
|
+
await purgeRetiredManagedAgentFiles({ codexHome: input.codexHome });
|
|
77200
|
+
if (bundledAgents.length === 0) {
|
|
77201
|
+
await writeManifest(input.pluginRoot, []);
|
|
77202
|
+
return [];
|
|
77203
|
+
}
|
|
77204
|
+
const agentsDir = join43(input.codexHome, "agents");
|
|
77205
|
+
await mkdir6(agentsDir, { recursive: true });
|
|
77206
|
+
const linked = [];
|
|
77207
|
+
for (const agentPath of bundledAgents) {
|
|
77208
|
+
const agentFileName = basename9(agentPath);
|
|
77209
|
+
const agentName = agentNameFromToml2(agentFileName);
|
|
77210
|
+
const linkPath = join43(agentsDir, agentFileName);
|
|
77211
|
+
await replaceWithCopy(linkPath, agentPath);
|
|
77212
|
+
await restorePreservedReasoning({
|
|
77213
|
+
agentName,
|
|
77214
|
+
linkPath,
|
|
77215
|
+
target: agentPath,
|
|
77216
|
+
value: input.preservedReasoning?.get(agentName)
|
|
77217
|
+
});
|
|
77218
|
+
await restorePreservedServiceTier({
|
|
77219
|
+
linkPath,
|
|
77220
|
+
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
77221
|
+
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
77222
|
+
});
|
|
77223
|
+
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
77224
|
+
}
|
|
77225
|
+
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
77226
|
+
return linked;
|
|
77227
|
+
}
|
|
77228
|
+
async function discoverBundledAgents(pluginRoot) {
|
|
77229
|
+
const componentsRoot = join43(pluginRoot, "components");
|
|
77230
|
+
if (!await exists4(componentsRoot))
|
|
77231
|
+
return [];
|
|
77232
|
+
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
77233
|
+
const agents = [];
|
|
77234
|
+
for (const entry of componentEntries) {
|
|
77235
|
+
if (!entry.isDirectory())
|
|
77236
|
+
continue;
|
|
77237
|
+
const agentsRoot = join43(componentsRoot, entry.name, "agents");
|
|
77238
|
+
if (!await exists4(agentsRoot))
|
|
77239
|
+
continue;
|
|
77240
|
+
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
77241
|
+
for (const file2 of agentEntries) {
|
|
77242
|
+
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
77243
|
+
continue;
|
|
77244
|
+
agents.push(join43(agentsRoot, file2.name));
|
|
77245
|
+
}
|
|
77246
|
+
}
|
|
77247
|
+
agents.sort();
|
|
77248
|
+
return agents;
|
|
77249
|
+
}
|
|
77250
|
+
async function replaceWithCopy(linkPath, target) {
|
|
77251
|
+
await prepareReplacement(linkPath);
|
|
77252
|
+
await copyFile(target, linkPath);
|
|
77253
|
+
}
|
|
77254
|
+
async function prepareReplacement(linkPath) {
|
|
77255
|
+
if (!await exists4(linkPath))
|
|
77256
|
+
return;
|
|
77257
|
+
const entryStat = await lstat9(linkPath);
|
|
77258
|
+
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
77259
|
+
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
77260
|
+
}
|
|
77261
|
+
await rm8(linkPath, { force: true });
|
|
77262
|
+
}
|
|
77263
|
+
async function writeManifest(pluginRoot, agentPaths) {
|
|
77264
|
+
const manifestPath = join43(pluginRoot, MANIFEST_FILE);
|
|
77265
|
+
const payload = { agents: [...agentPaths].sort() };
|
|
77266
|
+
await writeFile7(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
77267
|
+
`);
|
|
77268
|
+
}
|
|
77269
|
+
function agentNameFromToml2(fileName) {
|
|
77270
|
+
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
77271
|
+
}
|
|
77272
|
+
async function exists4(path7) {
|
|
77273
|
+
try {
|
|
77274
|
+
await lstat9(path7);
|
|
77275
|
+
return true;
|
|
77276
|
+
} catch (error) {
|
|
77277
|
+
if (nodeErrorCode3(error) !== "ENOENT")
|
|
77278
|
+
throw error;
|
|
77279
|
+
return false;
|
|
77280
|
+
}
|
|
77281
|
+
}
|
|
77282
|
+
function nodeErrorCode3(error) {
|
|
77283
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
77284
|
+
return null;
|
|
77285
|
+
return typeof error.code === "string" ? error.code : null;
|
|
77286
|
+
}
|
|
77287
|
+
|
|
76911
77288
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
76912
77289
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
76913
|
-
import { join as
|
|
77290
|
+
import { join as join44 } from "node:path";
|
|
76914
77291
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
76915
77292
|
async function readMarketplace(repoRoot, options) {
|
|
76916
|
-
const marketplacePath = options?.marketplacePath ??
|
|
77293
|
+
const marketplacePath = options?.marketplacePath ?? join44(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
76917
77294
|
const raw = await readFile15(marketplacePath, "utf8");
|
|
76918
77295
|
const parsed = JSON.parse(raw);
|
|
76919
77296
|
if (!isPlainRecord3(parsed))
|
|
@@ -76932,10 +77309,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
76932
77309
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
76933
77310
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
76934
77311
|
const relativePath = sourcePath.slice(2);
|
|
76935
|
-
return
|
|
77312
|
+
return join44(repoRoot, ...relativePath.split(/[\\/]/));
|
|
76936
77313
|
}
|
|
76937
77314
|
async function readPluginManifest(pluginRoot) {
|
|
76938
|
-
const raw = await readFile15(
|
|
77315
|
+
const raw = await readFile15(join44(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
76939
77316
|
const parsed = JSON.parse(raw);
|
|
76940
77317
|
if (!isPlainRecord3(parsed))
|
|
76941
77318
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -77016,8 +77393,8 @@ function validateLocalSourcePath(path7) {
|
|
|
77016
77393
|
}
|
|
77017
77394
|
|
|
77018
77395
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
77019
|
-
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as
|
|
77020
|
-
import { join as
|
|
77396
|
+
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as writeFile8 } from "node:fs/promises";
|
|
77397
|
+
import { join as join45, sep as sep6 } from "node:path";
|
|
77021
77398
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
77022
77399
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
77023
77400
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -77030,21 +77407,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
77030
77407
|
return snapshotPlugins;
|
|
77031
77408
|
}
|
|
77032
77409
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
77033
|
-
return
|
|
77410
|
+
return join45(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
77034
77411
|
}
|
|
77035
77412
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
77036
|
-
const manifestDir =
|
|
77413
|
+
const manifestDir = join45(marketplaceRoot, ".agents", "plugins");
|
|
77037
77414
|
await mkdir7(manifestDir, { recursive: true });
|
|
77038
|
-
const tempPath =
|
|
77039
|
-
await
|
|
77415
|
+
const tempPath = join45(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
77416
|
+
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
77040
77417
|
`);
|
|
77041
|
-
await rename4(tempPath,
|
|
77418
|
+
await rename4(tempPath, join45(manifestDir, "marketplace.json"));
|
|
77042
77419
|
}
|
|
77043
77420
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
77044
|
-
const pluginsDir =
|
|
77421
|
+
const pluginsDir = join45(marketplaceRoot, "plugins");
|
|
77045
77422
|
await mkdir7(pluginsDir, { recursive: true });
|
|
77046
|
-
const targetPath =
|
|
77047
|
-
const tempPath =
|
|
77423
|
+
const targetPath = join45(pluginsDir, plugin.name);
|
|
77424
|
+
const tempPath = join45(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
77048
77425
|
await rm9(tempPath, { recursive: true, force: true });
|
|
77049
77426
|
await cp3(plugin.sourcePath, tempPath, {
|
|
77050
77427
|
recursive: true,
|
|
@@ -77065,11 +77442,11 @@ function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
|
77065
77442
|
}
|
|
77066
77443
|
|
|
77067
77444
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
77068
|
-
import { readdir as
|
|
77069
|
-
import { join as
|
|
77445
|
+
import { readdir as readdir8, readFile as readFile16, writeFile as writeFile9 } from "node:fs/promises";
|
|
77446
|
+
import { join as join46 } from "node:path";
|
|
77070
77447
|
async function readDistributionManifest(repoRoot) {
|
|
77071
77448
|
try {
|
|
77072
|
-
const parsed = JSON.parse(await readFile16(
|
|
77449
|
+
const parsed = JSON.parse(await readFile16(join46(repoRoot, "package.json"), "utf8"));
|
|
77073
77450
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
77074
77451
|
return;
|
|
77075
77452
|
return {
|
|
@@ -77089,19 +77466,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
77089
77466
|
return input.manifestVersion ?? "local";
|
|
77090
77467
|
}
|
|
77091
77468
|
async function stampLazyCodexPluginVersion(input) {
|
|
77092
|
-
const manifestPath =
|
|
77469
|
+
const manifestPath = join46(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
77093
77470
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
77094
77471
|
await stampJsonVersion(manifestPath, input.version);
|
|
77095
|
-
await stampJsonVersion(
|
|
77472
|
+
await stampJsonVersion(join46(input.pluginRoot, "package.json"), input.version);
|
|
77096
77473
|
for (const hookPath of hookPaths) {
|
|
77097
|
-
await stampHookStatusMessages(
|
|
77474
|
+
await stampHookStatusMessages(join46(input.pluginRoot, hookPath), input.version);
|
|
77098
77475
|
}
|
|
77099
77476
|
await stampComponentVersions(input);
|
|
77100
77477
|
}
|
|
77101
77478
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
77102
77479
|
if (input.distributionManifest === undefined)
|
|
77103
77480
|
return;
|
|
77104
|
-
await
|
|
77481
|
+
await writeFile9(join46(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
77105
77482
|
packageName: input.distributionManifest.name,
|
|
77106
77483
|
version: input.distributionManifest.version
|
|
77107
77484
|
}, null, "\t")}
|
|
@@ -77113,7 +77490,7 @@ async function stampJsonVersion(path7, version) {
|
|
|
77113
77490
|
if (!isPlainRecord3(parsed))
|
|
77114
77491
|
return;
|
|
77115
77492
|
parsed.version = version;
|
|
77116
|
-
await
|
|
77493
|
+
await writeFile9(path7, `${JSON.stringify(parsed, null, "\t")}
|
|
77117
77494
|
`);
|
|
77118
77495
|
} catch (error) {
|
|
77119
77496
|
if (error instanceof Error)
|
|
@@ -77147,7 +77524,7 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
77147
77524
|
if (!isPlainRecord3(parsed))
|
|
77148
77525
|
return;
|
|
77149
77526
|
stampHookGroups(parsed.hooks, version);
|
|
77150
|
-
await
|
|
77527
|
+
await writeFile9(path7, `${JSON.stringify(parsed, null, "\t")}
|
|
77151
77528
|
`);
|
|
77152
77529
|
} catch (error) {
|
|
77153
77530
|
if (error instanceof Error)
|
|
@@ -77158,16 +77535,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
77158
77535
|
async function stampComponentVersions(input) {
|
|
77159
77536
|
let entries;
|
|
77160
77537
|
try {
|
|
77161
|
-
entries = await
|
|
77538
|
+
entries = await readdir8(join46(input.pluginRoot, "components"));
|
|
77162
77539
|
} catch (error) {
|
|
77163
77540
|
if (error instanceof Error)
|
|
77164
77541
|
return;
|
|
77165
77542
|
throw error;
|
|
77166
77543
|
}
|
|
77167
77544
|
for (const entry of entries) {
|
|
77168
|
-
const componentRoot =
|
|
77169
|
-
await stampJsonVersion(
|
|
77170
|
-
await stampHookStatusMessages(
|
|
77545
|
+
const componentRoot = join46(input.pluginRoot, "components", entry);
|
|
77546
|
+
await stampJsonVersion(join46(componentRoot, "package.json"), input.version);
|
|
77547
|
+
await stampHookStatusMessages(join46(componentRoot, "hooks", "hooks.json"), input.version);
|
|
77171
77548
|
}
|
|
77172
77549
|
}
|
|
77173
77550
|
function stampHookGroups(hooks, version) {
|
|
@@ -77224,8 +77601,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
77224
77601
|
};
|
|
77225
77602
|
|
|
77226
77603
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
77227
|
-
import { copyFile as copyFile2, lstat as
|
|
77228
|
-
import { dirname as
|
|
77604
|
+
import { copyFile as copyFile2, lstat as lstat10, readFile as readFile17, writeFile as writeFile10 } from "node:fs/promises";
|
|
77605
|
+
import { dirname as dirname17, join as join47, resolve as resolve13 } from "node:path";
|
|
77229
77606
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
77230
77607
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
77231
77608
|
".codex/hooks.json",
|
|
@@ -77257,7 +77634,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
77257
77634
|
}
|
|
77258
77635
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp(input.now?.() ?? new Date)}`;
|
|
77259
77636
|
await copyFile2(configPath, backupPath);
|
|
77260
|
-
await
|
|
77637
|
+
await writeFile10(configPath, `${repair.config.trimEnd()}
|
|
77261
77638
|
`);
|
|
77262
77639
|
configs.push({
|
|
77263
77640
|
projectRoot: project.projectRoot,
|
|
@@ -77328,37 +77705,37 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
77328
77705
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
77329
77706
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
77330
77707
|
}
|
|
77331
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
77708
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join47(resolve13(codexHome), "config.toml");
|
|
77332
77709
|
let current = resolve13(startDirectory);
|
|
77333
77710
|
const configPathsFromCwd = [];
|
|
77334
77711
|
while (true) {
|
|
77335
|
-
const configPath =
|
|
77712
|
+
const configPath = join47(current, ".codex", "config.toml");
|
|
77336
77713
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
77337
77714
|
if (codexHomeConfigPath === null || resolve13(configPath) !== codexHomeConfigPath) {
|
|
77338
77715
|
configPathsFromCwd.push(configPath);
|
|
77339
77716
|
}
|
|
77340
77717
|
}
|
|
77341
|
-
if (await
|
|
77718
|
+
if (await exists5(join47(current, ".git"))) {
|
|
77342
77719
|
return configPathsFromCwd.length === 0 ? null : {
|
|
77343
77720
|
projectRoot: current,
|
|
77344
77721
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
77345
77722
|
artifactRoots: artifactRootsForConfigPaths(configPathsFromCwd)
|
|
77346
77723
|
};
|
|
77347
77724
|
}
|
|
77348
|
-
const parent =
|
|
77725
|
+
const parent = dirname17(current);
|
|
77349
77726
|
if (parent === current) {
|
|
77350
77727
|
const nearestConfigPath = configPathsFromCwd[0];
|
|
77351
77728
|
return nearestConfigPath === undefined ? null : {
|
|
77352
|
-
projectRoot:
|
|
77729
|
+
projectRoot: dirname17(dirname17(nearestConfigPath)),
|
|
77353
77730
|
configPaths: [nearestConfigPath],
|
|
77354
|
-
artifactRoots: [
|
|
77731
|
+
artifactRoots: [dirname17(dirname17(nearestConfigPath))]
|
|
77355
77732
|
};
|
|
77356
77733
|
}
|
|
77357
77734
|
current = parent;
|
|
77358
77735
|
}
|
|
77359
77736
|
}
|
|
77360
77737
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
77361
|
-
const codexDirStat = await maybeLstat(
|
|
77738
|
+
const codexDirStat = await maybeLstat(join47(directory, ".codex"));
|
|
77362
77739
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
77363
77740
|
return false;
|
|
77364
77741
|
const configStat = await maybeLstat(configPath);
|
|
@@ -77367,7 +77744,7 @@ async function isRegularProjectLocalConfig(directory, configPath) {
|
|
|
77367
77744
|
function artifactRootsForConfigPaths(configPaths) {
|
|
77368
77745
|
const roots = [];
|
|
77369
77746
|
for (const configPath of configPaths) {
|
|
77370
|
-
const root =
|
|
77747
|
+
const root = dirname17(dirname17(configPath));
|
|
77371
77748
|
if (!roots.includes(root))
|
|
77372
77749
|
roots.push(root);
|
|
77373
77750
|
}
|
|
@@ -77378,7 +77755,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
77378
77755
|
const seenPaths = new Set;
|
|
77379
77756
|
for (const projectRoot of projectRoots) {
|
|
77380
77757
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
77381
|
-
const artifactPath =
|
|
77758
|
+
const artifactPath = join47(projectRoot, relativePath);
|
|
77382
77759
|
if (seenPaths.has(artifactPath))
|
|
77383
77760
|
continue;
|
|
77384
77761
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -77412,17 +77789,17 @@ function formatBackupTimestamp(date) {
|
|
|
77412
77789
|
}
|
|
77413
77790
|
async function maybeLstat(path7) {
|
|
77414
77791
|
try {
|
|
77415
|
-
return await
|
|
77792
|
+
return await lstat10(path7);
|
|
77416
77793
|
} catch (error) {
|
|
77417
|
-
if (
|
|
77794
|
+
if (nodeErrorCode4(error) === "ENOENT")
|
|
77418
77795
|
return null;
|
|
77419
77796
|
throw error;
|
|
77420
77797
|
}
|
|
77421
77798
|
}
|
|
77422
|
-
async function
|
|
77799
|
+
async function exists5(path7) {
|
|
77423
77800
|
return await maybeLstat(path7) !== null;
|
|
77424
77801
|
}
|
|
77425
|
-
function
|
|
77802
|
+
function nodeErrorCode4(error) {
|
|
77426
77803
|
if (!(error instanceof Error) || !("code" in error))
|
|
77427
77804
|
return null;
|
|
77428
77805
|
return typeof error.code === "string" ? error.code : null;
|
|
@@ -77453,24 +77830,24 @@ function formatUnknownError(error) {
|
|
|
77453
77830
|
}
|
|
77454
77831
|
|
|
77455
77832
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
77456
|
-
import { readFile as readFile18, readdir as
|
|
77833
|
+
import { readFile as readFile18, readdir as readdir9, rm as rm10 } from "node:fs/promises";
|
|
77457
77834
|
import { connect } from "node:net";
|
|
77458
|
-
import { join as
|
|
77835
|
+
import { join as join48 } from "node:path";
|
|
77459
77836
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
77460
77837
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
77461
77838
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
77462
|
-
const daemonRoot =
|
|
77839
|
+
const daemonRoot = join48(codexHome, "codex-lsp", "daemon");
|
|
77463
77840
|
const reaped = [];
|
|
77464
77841
|
let entries;
|
|
77465
77842
|
try {
|
|
77466
|
-
entries = await
|
|
77843
|
+
entries = await readdir9(daemonRoot);
|
|
77467
77844
|
} catch {
|
|
77468
77845
|
return reaped;
|
|
77469
77846
|
}
|
|
77470
77847
|
for (const entry of entries) {
|
|
77471
|
-
const versionDir =
|
|
77472
|
-
const pid = await readPidFile(
|
|
77473
|
-
const socketPath = await readEndpointFile(
|
|
77848
|
+
const versionDir = join48(daemonRoot, entry);
|
|
77849
|
+
const pid = await readPidFile(join48(versionDir, "daemon.pid"));
|
|
77850
|
+
const socketPath = await readEndpointFile(join48(versionDir, "daemon.endpoint"));
|
|
77474
77851
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
77475
77852
|
reaped.push(pid);
|
|
77476
77853
|
}
|
|
@@ -77524,7 +77901,7 @@ function sendSigterm(pid) {
|
|
|
77524
77901
|
|
|
77525
77902
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
77526
77903
|
import { homedir as homedir5 } from "node:os";
|
|
77527
|
-
import { join as
|
|
77904
|
+
import { join as join49, resolve as resolve14 } from "node:path";
|
|
77528
77905
|
function resolveCodexInstallerBinDir(input) {
|
|
77529
77906
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
77530
77907
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -77533,13 +77910,13 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
77533
77910
|
const defaultCodexHome = resolve14(homeDir, ".codex");
|
|
77534
77911
|
const resolvedCodexHome = resolve14(input.codexHome);
|
|
77535
77912
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
77536
|
-
return
|
|
77913
|
+
return join49(resolvedCodexHome, "bin");
|
|
77537
77914
|
return resolve14(homeDir, ".local", "bin");
|
|
77538
77915
|
}
|
|
77539
77916
|
|
|
77540
77917
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
77541
|
-
import { readFile as readFile19, writeFile as
|
|
77542
|
-
import { join as
|
|
77918
|
+
import { readFile as readFile19, writeFile as writeFile11 } from "node:fs/promises";
|
|
77919
|
+
import { join as join50 } from "node:path";
|
|
77543
77920
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
77544
77921
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
77545
77922
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -77547,22 +77924,22 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
77547
77924
|
async function removeGitBashHooksOffWindows(input) {
|
|
77548
77925
|
if (input.platform === "win32")
|
|
77549
77926
|
return;
|
|
77550
|
-
const manifestPath =
|
|
77927
|
+
const manifestPath = join50(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
77551
77928
|
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
77552
77929
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.hooks))
|
|
77553
77930
|
return;
|
|
77554
77931
|
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
|
|
77555
77932
|
if (hooks.length === parsed.hooks.length)
|
|
77556
77933
|
return;
|
|
77557
|
-
await
|
|
77934
|
+
await writeFile11(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
|
|
77558
77935
|
`);
|
|
77559
77936
|
}
|
|
77560
77937
|
|
|
77561
77938
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
77562
|
-
import { join as
|
|
77939
|
+
import { join as join51 } from "node:path";
|
|
77563
77940
|
async function seedAndMigrateOmoSot(input) {
|
|
77564
77941
|
const commandEnv = { ...input.env };
|
|
77565
|
-
const scriptPath =
|
|
77942
|
+
const scriptPath = join51(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
77566
77943
|
try {
|
|
77567
77944
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
77568
77945
|
cwd: input.repoRoot,
|
|
@@ -77577,7 +77954,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
77577
77954
|
|
|
77578
77955
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
77579
77956
|
init_src();
|
|
77580
|
-
import { join as
|
|
77957
|
+
import { join as join52 } from "node:path";
|
|
77581
77958
|
function describeResult(result) {
|
|
77582
77959
|
if (result.kind === "succeeded")
|
|
77583
77960
|
return null;
|
|
@@ -77591,7 +77968,7 @@ async function installAstGrepForCodex(options) {
|
|
|
77591
77968
|
return;
|
|
77592
77969
|
const platform = options.platform ?? process.platform;
|
|
77593
77970
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
77594
|
-
const skillDir =
|
|
77971
|
+
const skillDir = join52(plugin.path, "skills", "ast-grep");
|
|
77595
77972
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
77596
77973
|
try {
|
|
77597
77974
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -77625,7 +78002,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77625
78002
|
const env3 = options.env ?? process.env;
|
|
77626
78003
|
const platform = options.platform ?? process.platform;
|
|
77627
78004
|
const repoRoot = resolve15(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
77628
|
-
const codexHome = resolve15(options.codexHome ?? env3.CODEX_HOME ??
|
|
78005
|
+
const codexHome = resolve15(options.codexHome ?? env3.CODEX_HOME ?? join55(homedir6(), ".codex"));
|
|
77629
78006
|
const projectDirectory = resolve15(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
77630
78007
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
77631
78008
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -77641,9 +78018,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
77641
78018
|
if (!gitBashResolution.found) {
|
|
77642
78019
|
throw new Error(gitBashResolution.installHint);
|
|
77643
78020
|
}
|
|
77644
|
-
const codexPackageRoot =
|
|
78021
|
+
const codexPackageRoot = join55(repoRoot, "packages", "omo-codex");
|
|
77645
78022
|
const marketplace = await readMarketplace(repoRoot, {
|
|
77646
|
-
marketplacePath:
|
|
78023
|
+
marketplacePath: join55(codexPackageRoot, "marketplace.json")
|
|
77647
78024
|
});
|
|
77648
78025
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
77649
78026
|
const installed = [];
|
|
@@ -77686,7 +78063,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77686
78063
|
if (runtimeLink !== null)
|
|
77687
78064
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
77688
78065
|
else
|
|
77689
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
78066
|
+
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`);
|
|
77690
78067
|
}
|
|
77691
78068
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
77692
78069
|
installed.push(plugin);
|
|
@@ -77717,7 +78094,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77717
78094
|
});
|
|
77718
78095
|
for (const link of agentLinks) {
|
|
77719
78096
|
log4(`Linked agent ${link.name} -> ${link.target}`);
|
|
77720
|
-
const agentName =
|
|
78097
|
+
const agentName = agentNameFromToml3(link.name);
|
|
77721
78098
|
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
77722
78099
|
}
|
|
77723
78100
|
}
|
|
@@ -77740,13 +78117,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
77740
78117
|
});
|
|
77741
78118
|
}
|
|
77742
78119
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
77743
|
-
const marketplaceRoot =
|
|
78120
|
+
const marketplaceRoot = join55(codexHome, "plugins", "cache", marketplace.name);
|
|
77744
78121
|
await writeCachedMarketplaceManifest({
|
|
77745
78122
|
marketplaceName: marketplace.name,
|
|
77746
78123
|
marketplaceRoot,
|
|
77747
78124
|
plugins: installed
|
|
77748
78125
|
});
|
|
77749
|
-
const configPath =
|
|
78126
|
+
const configPath = join55(codexHome, "config.toml");
|
|
77750
78127
|
await updateCodexConfig({
|
|
77751
78128
|
configPath,
|
|
77752
78129
|
repoRoot: codexPackageRoot,
|
|
@@ -77784,7 +78161,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77784
78161
|
projectCleanup
|
|
77785
78162
|
};
|
|
77786
78163
|
}
|
|
77787
|
-
function
|
|
78164
|
+
function agentNameFromToml3(fileName) {
|
|
77788
78165
|
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
77789
78166
|
}
|
|
77790
78167
|
async function agentSourceRootsForInstall(input) {
|
|
@@ -77806,7 +78183,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
77806
78183
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
77807
78184
|
if (isRepoRootWithCodexPlugin(current))
|
|
77808
78185
|
return current;
|
|
77809
|
-
for (const wrapperPackageRoot of [
|
|
78186
|
+
for (const wrapperPackageRoot of [join55(current, "node_modules", "oh-my-openagent"), join55(current, "oh-my-openagent")]) {
|
|
77810
78187
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
77811
78188
|
return wrapperPackageRoot;
|
|
77812
78189
|
}
|
|
@@ -77824,7 +78201,7 @@ function findRepoRoot(input) {
|
|
|
77824
78201
|
return findRepoRootFromImporter(input.importerDir);
|
|
77825
78202
|
}
|
|
77826
78203
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
77827
|
-
return existsSync30(
|
|
78204
|
+
return existsSync30(join55(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
77828
78205
|
}
|
|
77829
78206
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
77830
78207
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -77845,19 +78222,19 @@ async function detectCodexInstallation(input = {}) {
|
|
|
77845
78222
|
const platform = input.platform ?? process.platform;
|
|
77846
78223
|
const env3 = input.env ?? process.env;
|
|
77847
78224
|
const homeDir = input.homeDir ?? homedir7();
|
|
77848
|
-
const
|
|
78225
|
+
const exists6 = input.exists ?? existsSync31;
|
|
77849
78226
|
const which2 = input.which ?? bunWhich;
|
|
77850
78227
|
const checkedPaths = [CODEX_PATH_CHECK_LABEL];
|
|
77851
78228
|
const cliPath = nonEmptyValue2(which2("codex"));
|
|
77852
78229
|
if (cliPath !== undefined)
|
|
77853
78230
|
return { found: true, source: "cli", path: cliPath };
|
|
77854
78231
|
if (platform === "darwin") {
|
|
77855
|
-
return detectMacCodexInstallation({ homeDir, exists:
|
|
78232
|
+
return detectMacCodexInstallation({ homeDir, exists: exists6, checkedPaths });
|
|
77856
78233
|
}
|
|
77857
78234
|
if (platform === "win32") {
|
|
77858
78235
|
return detectWindowsCodexInstallation({
|
|
77859
78236
|
env: env3,
|
|
77860
|
-
exists:
|
|
78237
|
+
exists: exists6,
|
|
77861
78238
|
checkedPaths,
|
|
77862
78239
|
runCommand: input.runCommand ?? defaultRunCommand2
|
|
77863
78240
|
});
|
|
@@ -77959,17 +78336,20 @@ function defaultRunCommand2(command, args) {
|
|
|
77959
78336
|
});
|
|
77960
78337
|
}
|
|
77961
78338
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
77962
|
-
import { lstat as
|
|
78339
|
+
import { lstat as lstat12, readFile as readFile21, readdir as readdir10, rm as rm11, rmdir } from "node:fs/promises";
|
|
77963
78340
|
import { homedir as homedir8 } from "node:os";
|
|
77964
|
-
import { isAbsolute as
|
|
78341
|
+
import { isAbsolute as isAbsolute11, join as join57, relative as relative7, resolve as resolve17 } from "node:path";
|
|
77965
78342
|
|
|
77966
78343
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
77967
|
-
import { lstat as
|
|
77968
|
-
import { dirname as
|
|
78344
|
+
import { lstat as lstat11, mkdir as mkdir8, readFile as readFile20, writeFile as writeFile12 } from "node:fs/promises";
|
|
78345
|
+
import { dirname as dirname19 } from "node:path";
|
|
77969
78346
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
77970
78347
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
77971
78348
|
var CURRENT_MANAGED_CODEX_AGENT_NAMES2 = [
|
|
77972
78349
|
"explorer",
|
|
78350
|
+
"lazycodex-worker-high",
|
|
78351
|
+
"lazycodex-worker-low",
|
|
78352
|
+
"lazycodex-worker-medium",
|
|
77973
78353
|
"librarian",
|
|
77974
78354
|
"metis",
|
|
77975
78355
|
"momus",
|
|
@@ -77999,9 +78379,9 @@ async function cleanupCodexConfig(configPath, now) {
|
|
|
77999
78379
|
if (next === original)
|
|
78000
78380
|
return { changed: false };
|
|
78001
78381
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
78002
|
-
await mkdir8(
|
|
78003
|
-
await
|
|
78004
|
-
await
|
|
78382
|
+
await mkdir8(dirname19(configPath), { recursive: true });
|
|
78383
|
+
await writeFile12(backupPath, original);
|
|
78384
|
+
await writeFile12(configPath, `${next.trimEnd()}
|
|
78005
78385
|
`);
|
|
78006
78386
|
return { changed: true, backupPath };
|
|
78007
78387
|
}
|
|
@@ -78063,27 +78443,27 @@ function formatBackupTimestamp2(date) {
|
|
|
78063
78443
|
}
|
|
78064
78444
|
async function configExists(path7) {
|
|
78065
78445
|
try {
|
|
78066
|
-
await
|
|
78446
|
+
await lstat11(path7);
|
|
78067
78447
|
return true;
|
|
78068
78448
|
} catch (error) {
|
|
78069
|
-
if (
|
|
78449
|
+
if (nodeErrorCode5(error) === "ENOENT")
|
|
78070
78450
|
return false;
|
|
78071
78451
|
throw error;
|
|
78072
78452
|
}
|
|
78073
78453
|
}
|
|
78074
|
-
function
|
|
78454
|
+
function nodeErrorCode5(error) {
|
|
78075
78455
|
if (!(error instanceof Error) || !("code" in error))
|
|
78076
78456
|
return null;
|
|
78077
78457
|
return typeof error.code === "string" ? error.code : null;
|
|
78078
78458
|
}
|
|
78079
78459
|
|
|
78080
78460
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
78081
|
-
import { dirname as
|
|
78461
|
+
import { dirname as dirname20, isAbsolute as isAbsolute10, join as join56, relative as relative6, resolve as resolve16 } from "node:path";
|
|
78082
78462
|
function validateManagedCleanupTarget(input) {
|
|
78083
|
-
if (!
|
|
78463
|
+
if (!isAbsolute10(input.path))
|
|
78084
78464
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78085
78465
|
const codexHome = resolve16(input.codexHome);
|
|
78086
|
-
if (
|
|
78466
|
+
if (dirname20(codexHome) === codexHome)
|
|
78087
78467
|
return skipped(input.path, "Codex home resolves to a filesystem root");
|
|
78088
78468
|
const target = resolve16(input.path);
|
|
78089
78469
|
if (!isWithinDirectory(codexHome, target))
|
|
@@ -78091,11 +78471,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
78091
78471
|
if (target === codexHome)
|
|
78092
78472
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78093
78473
|
const exactManagedRoots = new Set([
|
|
78094
|
-
resolve16(
|
|
78095
|
-
resolve16(
|
|
78096
|
-
resolve16(
|
|
78097
|
-
resolve16(
|
|
78098
|
-
resolve16(
|
|
78474
|
+
resolve16(join56(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
78475
|
+
resolve16(join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
78476
|
+
resolve16(join56(codexHome, "runtime", "ast-grep")),
|
|
78477
|
+
resolve16(join56(codexHome, "runtime", "node")),
|
|
78478
|
+
resolve16(join56(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
78099
78479
|
]);
|
|
78100
78480
|
if (exactManagedRoots.has(target))
|
|
78101
78481
|
return null;
|
|
@@ -78105,7 +78485,7 @@ function validateManagedCleanupTarget(input) {
|
|
|
78105
78485
|
}
|
|
78106
78486
|
function isWithinDirectory(parent, child) {
|
|
78107
78487
|
const relativePath = relative6(parent, child);
|
|
78108
|
-
return relativePath === "" || !relativePath.startsWith("..") && !
|
|
78488
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute10(relativePath);
|
|
78109
78489
|
}
|
|
78110
78490
|
function isManagedBootstrapDriftPath(codexHome, target) {
|
|
78111
78491
|
const relativePath = relative6(codexHome, target);
|
|
@@ -78125,8 +78505,8 @@ function skipped(path7, reason) {
|
|
|
78125
78505
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
78126
78506
|
async function cleanupCodexLight(input = {}) {
|
|
78127
78507
|
const env3 = input.env ?? process.env;
|
|
78128
|
-
const codexHome = resolve17(input.codexHome ?? env3.CODEX_HOME ??
|
|
78129
|
-
const configPath =
|
|
78508
|
+
const codexHome = resolve17(input.codexHome ?? env3.CODEX_HOME ?? join57(homedir8(), ".codex"));
|
|
78509
|
+
const configPath = join57(codexHome, "config.toml");
|
|
78130
78510
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
78131
78511
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
78132
78512
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
@@ -78165,32 +78545,32 @@ async function cleanupCodexLight(input = {}) {
|
|
|
78165
78545
|
}
|
|
78166
78546
|
function managedGlobalStatePaths(codexHome) {
|
|
78167
78547
|
return [
|
|
78168
|
-
|
|
78169
|
-
|
|
78170
|
-
|
|
78171
|
-
|
|
78172
|
-
|
|
78548
|
+
join57(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
78549
|
+
join57(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
78550
|
+
join57(codexHome, "runtime", "ast-grep"),
|
|
78551
|
+
join57(codexHome, "runtime", "node"),
|
|
78552
|
+
join57(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
78173
78553
|
];
|
|
78174
78554
|
}
|
|
78175
78555
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
78176
78556
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
78177
78557
|
const results = [];
|
|
78178
|
-
await walkForManagedBootstrapDirs(
|
|
78558
|
+
await walkForManagedBootstrapDirs(join57(codexHome, "plugins"), 0, results);
|
|
78179
78559
|
return results;
|
|
78180
78560
|
}
|
|
78181
78561
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
78182
78562
|
if (depth > BOOTSTRAP_DATA_GLOB_MAX_DEPTH)
|
|
78183
78563
|
return;
|
|
78184
|
-
const entries = await
|
|
78564
|
+
const entries = await readdir10(directory, { withFileTypes: true }).catch(() => null);
|
|
78185
78565
|
if (entries === null)
|
|
78186
78566
|
return;
|
|
78187
78567
|
for (const entry of entries) {
|
|
78188
78568
|
if (!entry.isDirectory())
|
|
78189
78569
|
continue;
|
|
78190
|
-
const childPath =
|
|
78570
|
+
const childPath = join57(directory, entry.name);
|
|
78191
78571
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
78192
|
-
const bootstrapDir =
|
|
78193
|
-
if (await
|
|
78572
|
+
const bootstrapDir = join57(childPath, "bootstrap");
|
|
78573
|
+
if (await exists6(bootstrapDir))
|
|
78194
78574
|
results.push(bootstrapDir);
|
|
78195
78575
|
continue;
|
|
78196
78576
|
}
|
|
@@ -78213,7 +78593,7 @@ async function removeManagedPathBestEffort(path7, seams) {
|
|
|
78213
78593
|
}
|
|
78214
78594
|
async function attemptRemove(path7) {
|
|
78215
78595
|
try {
|
|
78216
|
-
if (await
|
|
78596
|
+
if (await lstat12(path7).catch(() => null) === null)
|
|
78217
78597
|
return false;
|
|
78218
78598
|
await rm11(path7, { recursive: true, force: true });
|
|
78219
78599
|
return true;
|
|
@@ -78223,7 +78603,7 @@ async function attemptRemove(path7) {
|
|
|
78223
78603
|
}
|
|
78224
78604
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
78225
78605
|
try {
|
|
78226
|
-
await rmdir(
|
|
78606
|
+
await rmdir(join57(codexHome, "runtime"));
|
|
78227
78607
|
} catch (error) {
|
|
78228
78608
|
if (isExpectedRuntimePruneFailure(error))
|
|
78229
78609
|
return;
|
|
@@ -78231,18 +78611,18 @@ async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
|
78231
78611
|
}
|
|
78232
78612
|
}
|
|
78233
78613
|
function isExpectedRuntimePruneFailure(error) {
|
|
78234
|
-
return ["ENOENT", "ENOTEMPTY", "EEXIST", "EPERM", "EBUSY", "ENOTDIR"].includes(
|
|
78614
|
+
return ["ENOENT", "ENOTEMPTY", "EEXIST", "EPERM", "EBUSY", "ENOTDIR"].includes(nodeErrorCode6(error) ?? "");
|
|
78235
78615
|
}
|
|
78236
78616
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
78237
78617
|
const manifestPaths = [
|
|
78238
|
-
|
|
78618
|
+
join57(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
78239
78619
|
];
|
|
78240
|
-
const versionRoot =
|
|
78241
|
-
if (await
|
|
78242
|
-
const entries = await
|
|
78620
|
+
const versionRoot = join57(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
78621
|
+
if (await exists6(versionRoot)) {
|
|
78622
|
+
const entries = await readdir10(versionRoot, { withFileTypes: true });
|
|
78243
78623
|
for (const entry of entries) {
|
|
78244
78624
|
if (entry.isDirectory())
|
|
78245
|
-
manifestPaths.push(
|
|
78625
|
+
manifestPaths.push(join57(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
78246
78626
|
}
|
|
78247
78627
|
}
|
|
78248
78628
|
const paths = new Set;
|
|
@@ -78257,13 +78637,13 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
78257
78637
|
return [...paths].sort();
|
|
78258
78638
|
}
|
|
78259
78639
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
78260
|
-
if (!await
|
|
78640
|
+
if (!await exists6(configPath))
|
|
78261
78641
|
return [];
|
|
78262
78642
|
const config = await readFile21(configPath, "utf8");
|
|
78263
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
78643
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join57(codexHome, "agents", `${agentName}.toml`));
|
|
78264
78644
|
}
|
|
78265
78645
|
async function readInstalledAgentManifest(manifestPath) {
|
|
78266
|
-
if (!await
|
|
78646
|
+
if (!await exists6(manifestPath))
|
|
78267
78647
|
return [];
|
|
78268
78648
|
const parsed = JSON.parse(await readFile21(manifestPath, "utf8"));
|
|
78269
78649
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.agents))
|
|
@@ -78271,7 +78651,7 @@ async function readInstalledAgentManifest(manifestPath) {
|
|
|
78271
78651
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
78272
78652
|
}
|
|
78273
78653
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
78274
|
-
const agentsDir =
|
|
78654
|
+
const agentsDir = join57(codexHome, "agents");
|
|
78275
78655
|
const removed = [];
|
|
78276
78656
|
const skipped2 = [];
|
|
78277
78657
|
for (const path7 of paths) {
|
|
@@ -78292,29 +78672,29 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
78292
78672
|
return { removed, skipped: skipped2 };
|
|
78293
78673
|
}
|
|
78294
78674
|
function isSafeManagedAgentPath(agentsDir, path7) {
|
|
78295
|
-
if (!
|
|
78675
|
+
if (!isAbsolute11(path7))
|
|
78296
78676
|
return false;
|
|
78297
78677
|
const relativePath = relative7(agentsDir, path7);
|
|
78298
|
-
if (relativePath === "" || relativePath.startsWith("..") ||
|
|
78678
|
+
if (relativePath === "" || relativePath.startsWith("..") || isAbsolute11(relativePath))
|
|
78299
78679
|
return false;
|
|
78300
78680
|
const fileName = relativePath.split(/[\\/]/).pop();
|
|
78301
78681
|
if (fileName === undefined)
|
|
78302
78682
|
return false;
|
|
78303
78683
|
return MANAGED_CODEX_AGENT_NAMES2.some((agentName) => fileName === `${agentName}.toml`);
|
|
78304
78684
|
}
|
|
78305
|
-
async function
|
|
78685
|
+
async function exists6(path7) {
|
|
78306
78686
|
return await maybeLstat2(path7) !== null;
|
|
78307
78687
|
}
|
|
78308
78688
|
async function maybeLstat2(path7) {
|
|
78309
78689
|
try {
|
|
78310
|
-
return await
|
|
78690
|
+
return await lstat12(path7);
|
|
78311
78691
|
} catch (error) {
|
|
78312
|
-
if (
|
|
78692
|
+
if (nodeErrorCode6(error) === "ENOENT")
|
|
78313
78693
|
return null;
|
|
78314
78694
|
throw error;
|
|
78315
78695
|
}
|
|
78316
78696
|
}
|
|
78317
|
-
function
|
|
78697
|
+
function nodeErrorCode6(error) {
|
|
78318
78698
|
if (!(error instanceof Error) || !("code" in error))
|
|
78319
78699
|
return null;
|
|
78320
78700
|
return typeof error.code === "string" ? error.code : null;
|
|
@@ -78324,16 +78704,16 @@ var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", ".
|
|
|
78324
78704
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
78325
78705
|
import { execFile as execFile3 } from "node:child_process";
|
|
78326
78706
|
import { constants as constants7, existsSync as existsSync32 } from "node:fs";
|
|
78327
|
-
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile22, rename as rename5, writeFile as
|
|
78707
|
+
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile22, rename as rename5, writeFile as writeFile13 } from "node:fs/promises";
|
|
78328
78708
|
import { homedir as homedir9 } from "node:os";
|
|
78329
|
-
import { dirname as
|
|
78709
|
+
import { dirname as dirname21, join as join58, resolve as resolve18 } from "node:path";
|
|
78330
78710
|
import { fileURLToPath } from "node:url";
|
|
78331
78711
|
import { promisify as promisify2 } from "node:util";
|
|
78332
78712
|
var execFileAsync2 = promisify2(execFile3);
|
|
78333
78713
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
78334
|
-
|
|
78335
|
-
|
|
78336
|
-
|
|
78714
|
+
join58("extensions", "omo.js"),
|
|
78715
|
+
join58("skills", "ultrawork", "SKILL.md"),
|
|
78716
|
+
join58("skills", "ulw-loop", "SKILL.md")
|
|
78337
78717
|
];
|
|
78338
78718
|
async function runSenpiInstaller(options = {}) {
|
|
78339
78719
|
const context = resolveInstallContext(options);
|
|
@@ -78357,14 +78737,14 @@ async function runSenpiInstaller(options = {}) {
|
|
|
78357
78737
|
}
|
|
78358
78738
|
function resolveInstallContext(options) {
|
|
78359
78739
|
const env3 = options.env ?? process.env;
|
|
78360
|
-
const repoRoot = resolve18(options.repoRoot ?? findRepoRoot2(
|
|
78361
|
-
const agentDir = resolve18(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ??
|
|
78362
|
-
const pluginPath = resolve18(options.pluginPath ??
|
|
78740
|
+
const repoRoot = resolve18(options.repoRoot ?? findRepoRoot2(dirname21(fileURLToPath(import.meta.url))));
|
|
78741
|
+
const agentDir = resolve18(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ?? join58(homedir9(), ".senpi", "agent"));
|
|
78742
|
+
const pluginPath = resolve18(options.pluginPath ?? join58(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
78363
78743
|
return {
|
|
78364
78744
|
env: env3,
|
|
78365
78745
|
repoRoot,
|
|
78366
78746
|
agentDir,
|
|
78367
|
-
settingsPath:
|
|
78747
|
+
settingsPath: join58(agentDir, "settings.json"),
|
|
78368
78748
|
pluginPath,
|
|
78369
78749
|
runCommand: options.runCommand ?? defaultRunCommand3
|
|
78370
78750
|
};
|
|
@@ -78373,12 +78753,12 @@ async function ensurePluginArtifacts(context) {
|
|
|
78373
78753
|
const missing = await hasMissingPluginArtifact(context.pluginPath);
|
|
78374
78754
|
if (!missing)
|
|
78375
78755
|
return;
|
|
78376
|
-
await context.runCommand("node", [
|
|
78377
|
-
await context.runCommand("node", [
|
|
78756
|
+
await context.runCommand("node", [join58(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
78757
|
+
await context.runCommand("node", [join58(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
78378
78758
|
}
|
|
78379
78759
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
78380
78760
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
78381
|
-
if (!await fileExists(
|
|
78761
|
+
if (!await fileExists(join58(pluginPath, artifact)))
|
|
78382
78762
|
return true;
|
|
78383
78763
|
}
|
|
78384
78764
|
return false;
|
|
@@ -78417,16 +78797,16 @@ function dedupePackages(packages) {
|
|
|
78417
78797
|
return [...new Set(packages)];
|
|
78418
78798
|
}
|
|
78419
78799
|
async function writeSettingsAtomically(settingsPath, settings) {
|
|
78420
|
-
await mkdir9(
|
|
78800
|
+
await mkdir9(dirname21(settingsPath), { recursive: true });
|
|
78421
78801
|
const backupPath = await nextBackupPath(settingsPath);
|
|
78422
78802
|
if (await fileExists(settingsPath)) {
|
|
78423
78803
|
await copyFile3(settingsPath, backupPath);
|
|
78424
78804
|
} else {
|
|
78425
|
-
await
|
|
78805
|
+
await writeFile13(backupPath, `{}
|
|
78426
78806
|
`, "utf8");
|
|
78427
78807
|
}
|
|
78428
78808
|
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
|
|
78429
|
-
await
|
|
78809
|
+
await writeFile13(tempPath, `${JSON.stringify(settings, null, 2)}
|
|
78430
78810
|
`, "utf8");
|
|
78431
78811
|
await rename5(tempPath, settingsPath);
|
|
78432
78812
|
return backupPath;
|
|
@@ -78446,7 +78826,7 @@ function timestampForBackup() {
|
|
|
78446
78826
|
function findRepoRoot2(importerDir) {
|
|
78447
78827
|
let current = importerDir;
|
|
78448
78828
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
78449
|
-
if (fileExistsSync(
|
|
78829
|
+
if (fileExistsSync(join58(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
78450
78830
|
return current;
|
|
78451
78831
|
current = resolve18(current, "..");
|
|
78452
78832
|
}
|
|
@@ -78505,26 +78885,26 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
78505
78885
|
init_provider_availability();
|
|
78506
78886
|
|
|
78507
78887
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
78508
|
-
import { existsSync as existsSync34, mkdirSync as mkdirSync10, readFileSync as
|
|
78509
|
-
import { join as
|
|
78888
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync10, readFileSync as readFileSync17 } from "node:fs";
|
|
78889
|
+
import { join as join60 } from "node:path";
|
|
78510
78890
|
|
|
78511
78891
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
78512
78892
|
init_shared();
|
|
78513
|
-
import { existsSync as existsSync33, readFileSync as
|
|
78514
|
-
import { join as
|
|
78893
|
+
import { existsSync as existsSync33, readFileSync as readFileSync16 } from "node:fs";
|
|
78894
|
+
import { join as join59 } from "node:path";
|
|
78515
78895
|
var TUI_SUBPATH = "tui";
|
|
78516
78896
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
78517
78897
|
function fileEntryPackageJsonPath(entry) {
|
|
78518
78898
|
let path7 = entry.slice("file:".length);
|
|
78519
78899
|
if (path7.startsWith("//"))
|
|
78520
78900
|
path7 = path7.slice(2);
|
|
78521
|
-
return
|
|
78901
|
+
return join59(path7, "package.json");
|
|
78522
78902
|
}
|
|
78523
78903
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
78524
78904
|
if (!existsSync33(pkgJsonPath))
|
|
78525
78905
|
return null;
|
|
78526
78906
|
try {
|
|
78527
|
-
const parsed = JSON.parse(
|
|
78907
|
+
const parsed = JSON.parse(readFileSync16(pkgJsonPath, "utf-8"));
|
|
78528
78908
|
if (parsed.exports === undefined)
|
|
78529
78909
|
return null;
|
|
78530
78910
|
if (typeof parsed.exports === "string")
|
|
@@ -78556,7 +78936,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
78556
78936
|
const packageName = packageNameFromServerEntry(entry);
|
|
78557
78937
|
if (packageName === null)
|
|
78558
78938
|
return null;
|
|
78559
|
-
return packageJsonExportsTui(
|
|
78939
|
+
return packageJsonExportsTui(join59(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
78560
78940
|
}
|
|
78561
78941
|
function isOurFilePluginEntry(entry) {
|
|
78562
78942
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -78565,7 +78945,7 @@ function isOurFilePluginEntry(entry) {
|
|
|
78565
78945
|
const pkgJsonPath = fileEntryPackageJsonPath(entry);
|
|
78566
78946
|
if (!existsSync33(pkgJsonPath))
|
|
78567
78947
|
return false;
|
|
78568
|
-
const parsed = JSON.parse(
|
|
78948
|
+
const parsed = JSON.parse(readFileSync16(pkgJsonPath, "utf-8"));
|
|
78569
78949
|
return typeof parsed.name === "string" && ACCEPTED_PACKAGE_NAMES.includes(parsed.name);
|
|
78570
78950
|
} catch (error) {
|
|
78571
78951
|
log2("[tui-plugin-config] Failed to inspect file plugin package", {
|
|
@@ -78603,7 +78983,7 @@ function detectServerPluginRegistration() {
|
|
|
78603
78983
|
return { registered: false, configPath: null, entry: null, packageExportsTui: null };
|
|
78604
78984
|
}
|
|
78605
78985
|
try {
|
|
78606
|
-
const parsed = parseJsonc(
|
|
78986
|
+
const parsed = parseJsonc(readFileSync16(configPath, "utf-8"));
|
|
78607
78987
|
const plugins = parsed.plugin ?? [];
|
|
78608
78988
|
const serverEntry = plugins.find(isServerPluginEntry);
|
|
78609
78989
|
return {
|
|
@@ -78621,7 +79001,7 @@ function detectServerPluginRegistration() {
|
|
|
78621
79001
|
}
|
|
78622
79002
|
}
|
|
78623
79003
|
function detectTuiPluginRegistration() {
|
|
78624
|
-
const tuiJsonPath =
|
|
79004
|
+
const tuiJsonPath = join59(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
78625
79005
|
if (!existsSync33(tuiJsonPath)) {
|
|
78626
79006
|
return {
|
|
78627
79007
|
registered: false,
|
|
@@ -78633,7 +79013,7 @@ function detectTuiPluginRegistration() {
|
|
|
78633
79013
|
};
|
|
78634
79014
|
}
|
|
78635
79015
|
try {
|
|
78636
|
-
const parsed = parseJsonc(
|
|
79016
|
+
const parsed = parseJsonc(readFileSync16(tuiJsonPath, "utf-8"));
|
|
78637
79017
|
const plugins = parsed.plugin ?? [];
|
|
78638
79018
|
return {
|
|
78639
79019
|
registered: plugins.some(isTuiPluginEntry),
|
|
@@ -78766,7 +79146,7 @@ init_shared();
|
|
|
78766
79146
|
init_write_file_atomically2();
|
|
78767
79147
|
function readConfig(path7) {
|
|
78768
79148
|
try {
|
|
78769
|
-
const parsed = parseJsonc(
|
|
79149
|
+
const parsed = parseJsonc(readFileSync17(path7, "utf-8"));
|
|
78770
79150
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
78771
79151
|
return parsed;
|
|
78772
79152
|
}
|
|
@@ -78777,10 +79157,10 @@ function readConfig(path7) {
|
|
|
78777
79157
|
return null;
|
|
78778
79158
|
}
|
|
78779
79159
|
function readServerConfig(configDir) {
|
|
78780
|
-
const jsoncPath =
|
|
79160
|
+
const jsoncPath = join60(configDir, "opencode.jsonc");
|
|
78781
79161
|
if (existsSync34(jsoncPath))
|
|
78782
79162
|
return readConfig(jsoncPath);
|
|
78783
|
-
const jsonPath =
|
|
79163
|
+
const jsonPath = join60(configDir, "opencode.json");
|
|
78784
79164
|
if (existsSync34(jsonPath))
|
|
78785
79165
|
return readConfig(jsonPath);
|
|
78786
79166
|
return null;
|
|
@@ -78822,7 +79202,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
78822
79202
|
if (!desiredEntry) {
|
|
78823
79203
|
return { changed: false, reason: "no-server-entry" };
|
|
78824
79204
|
}
|
|
78825
|
-
const tuiJsonPath =
|
|
79205
|
+
const tuiJsonPath = join60(configDir, "tui.json");
|
|
78826
79206
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
78827
79207
|
if (malformed) {
|
|
78828
79208
|
return { changed: false, reason: "malformed" };
|
|
@@ -78838,7 +79218,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
78838
79218
|
|
|
78839
79219
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
78840
79220
|
import { homedir as homedir10 } from "node:os";
|
|
78841
|
-
import { join as
|
|
79221
|
+
import { join as join61 } from "node:path";
|
|
78842
79222
|
|
|
78843
79223
|
// packages/shared-skills/index.mjs
|
|
78844
79224
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -78857,9 +79237,9 @@ function describeResult2(result) {
|
|
|
78857
79237
|
}
|
|
78858
79238
|
async function installAstGrepForOpenCode(options = {}) {
|
|
78859
79239
|
const platform = options.platform ?? process.platform;
|
|
78860
|
-
const baseDir =
|
|
79240
|
+
const baseDir = join61(options.homeDir ?? homedir10(), ".omo");
|
|
78861
79241
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
78862
|
-
const skillDir =
|
|
79242
|
+
const skillDir = join61(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
78863
79243
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
78864
79244
|
try {
|
|
78865
79245
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -96854,7 +97234,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
96854
97234
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
96855
97235
|
init_bun_which_shim();
|
|
96856
97236
|
init_spawn_with_windows_hide();
|
|
96857
|
-
import { delimiter as delimiter2, dirname as
|
|
97237
|
+
import { delimiter as delimiter2, dirname as dirname23, posix as posix4, win32 as win324 } from "node:path";
|
|
96858
97238
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
96859
97239
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
96860
97240
|
function getCommandCandidates(platform) {
|
|
@@ -96912,7 +97292,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
96912
97292
|
return null;
|
|
96913
97293
|
}
|
|
96914
97294
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
96915
|
-
const preferredDir =
|
|
97295
|
+
const preferredDir = dirname23(binaryPath);
|
|
96916
97296
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
96917
97297
|
return [preferredDir, ...existing].join(delimiter2);
|
|
96918
97298
|
}
|
|
@@ -97305,7 +97685,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
97305
97685
|
var NOTEPAD_DIR = "notepads";
|
|
97306
97686
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
97307
97687
|
// packages/boulder-state/src/top-level-task.ts
|
|
97308
|
-
import { existsSync as existsSync37, readFileSync as
|
|
97688
|
+
import { existsSync as existsSync37, readFileSync as readFileSync19 } from "node:fs";
|
|
97309
97689
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
97310
97690
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
97311
97691
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -97332,7 +97712,7 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
97332
97712
|
return null;
|
|
97333
97713
|
}
|
|
97334
97714
|
try {
|
|
97335
|
-
const content =
|
|
97715
|
+
const content = readFileSync19(planPath, "utf-8");
|
|
97336
97716
|
const lines = content.split(/\r?\n/);
|
|
97337
97717
|
let section = "other";
|
|
97338
97718
|
for (const line of lines) {
|
|
@@ -97358,12 +97738,12 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
97358
97738
|
}
|
|
97359
97739
|
// packages/boulder-state/src/storage/path.ts
|
|
97360
97740
|
import { existsSync as existsSync38 } from "node:fs";
|
|
97361
|
-
import { isAbsolute as
|
|
97741
|
+
import { isAbsolute as isAbsolute12, join as join63, relative as relative8, resolve as resolve19 } from "node:path";
|
|
97362
97742
|
function getBoulderFilePath(directory) {
|
|
97363
|
-
return
|
|
97743
|
+
return join63(directory, BOULDER_DIR, BOULDER_FILE);
|
|
97364
97744
|
}
|
|
97365
97745
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
97366
|
-
return
|
|
97746
|
+
return isAbsolute12(trackedPath) ? resolve19(trackedPath) : resolve19(baseDirectory, trackedPath);
|
|
97367
97747
|
}
|
|
97368
97748
|
function resolveBoulderPlanPath(directory, state) {
|
|
97369
97749
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -97373,7 +97753,7 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
97373
97753
|
}
|
|
97374
97754
|
const absoluteDirectory = resolve19(directory);
|
|
97375
97755
|
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
97376
|
-
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") ||
|
|
97756
|
+
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute12(relativePlanPath)) {
|
|
97377
97757
|
return absolutePlanPath;
|
|
97378
97758
|
}
|
|
97379
97759
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
@@ -97384,7 +97764,7 @@ function resolveBoulderPlanPathForWork(directory, work) {
|
|
|
97384
97764
|
return resolveBoulderPlanPath(directory, work);
|
|
97385
97765
|
}
|
|
97386
97766
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
97387
|
-
import { existsSync as existsSync39, readFileSync as
|
|
97767
|
+
import { existsSync as existsSync39, readFileSync as readFileSync20, readdirSync as readdirSync5, statSync as statSync5 } from "node:fs";
|
|
97388
97768
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
97389
97769
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
97390
97770
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -97397,7 +97777,7 @@ function getPlanProgress(planPath) {
|
|
|
97397
97777
|
return { total: 0, completed: 0, isComplete: false };
|
|
97398
97778
|
}
|
|
97399
97779
|
try {
|
|
97400
|
-
const content =
|
|
97780
|
+
const content = readFileSync20(planPath, "utf-8");
|
|
97401
97781
|
const lines = content.split(/\r?\n/);
|
|
97402
97782
|
const hasStructuredSections = lines.some((line) => TODO_HEADING_PATTERN2.test(line) || FINAL_VERIFICATION_HEADING_PATTERN2.test(line));
|
|
97403
97783
|
if (hasStructuredSections) {
|
|
@@ -97513,14 +97893,14 @@ function selectMirrorWork(state) {
|
|
|
97513
97893
|
return sorted[0] ?? null;
|
|
97514
97894
|
}
|
|
97515
97895
|
// packages/boulder-state/src/storage/read-state.ts
|
|
97516
|
-
import { existsSync as existsSync40, readFileSync as
|
|
97896
|
+
import { existsSync as existsSync40, readFileSync as readFileSync21 } from "node:fs";
|
|
97517
97897
|
function readBoulderState(directory) {
|
|
97518
97898
|
const filePath = getBoulderFilePath(directory);
|
|
97519
97899
|
if (!existsSync40(filePath)) {
|
|
97520
97900
|
return null;
|
|
97521
97901
|
}
|
|
97522
97902
|
try {
|
|
97523
|
-
const content =
|
|
97903
|
+
const content = readFileSync21(filePath, "utf-8");
|
|
97524
97904
|
const parsed = JSON.parse(content);
|
|
97525
97905
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
97526
97906
|
return null;
|
|
@@ -97586,17 +97966,17 @@ init_state();
|
|
|
97586
97966
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
97587
97967
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
97588
97968
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
97589
|
-
import { existsSync as existsSync41, mkdirSync as mkdirSync11, readFileSync as
|
|
97590
|
-
import { join as
|
|
97969
|
+
import { existsSync as existsSync41, mkdirSync as mkdirSync11, readFileSync as readFileSync22, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
97970
|
+
import { join as join64 } from "node:path";
|
|
97591
97971
|
function getMarkerPath(directory, sessionID) {
|
|
97592
|
-
return
|
|
97972
|
+
return join64(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
97593
97973
|
}
|
|
97594
97974
|
function readContinuationMarker(directory, sessionID) {
|
|
97595
97975
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
97596
97976
|
if (!existsSync41(markerPath))
|
|
97597
97977
|
return null;
|
|
97598
97978
|
try {
|
|
97599
|
-
const raw =
|
|
97979
|
+
const raw = readFileSync22(markerPath, "utf-8");
|
|
97600
97980
|
const parsed = JSON.parse(raw);
|
|
97601
97981
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
97602
97982
|
return null;
|
|
@@ -97661,8 +98041,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
97661
98041
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
97662
98042
|
init_shared();
|
|
97663
98043
|
init_compaction_marker();
|
|
97664
|
-
import { readFileSync as
|
|
97665
|
-
import { join as
|
|
98044
|
+
import { readFileSync as readFileSync23, readdirSync as readdirSync6 } from "node:fs";
|
|
98045
|
+
import { join as join65 } from "node:path";
|
|
97666
98046
|
var defaultSessionLastAgentDeps = {
|
|
97667
98047
|
getMessageDir,
|
|
97668
98048
|
isSqliteBackend,
|
|
@@ -97722,7 +98102,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
97722
98102
|
try {
|
|
97723
98103
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
97724
98104
|
try {
|
|
97725
|
-
const content =
|
|
98105
|
+
const content = readFileSync23(join65(messageDir, fileName), "utf-8");
|
|
97726
98106
|
const parsed = JSON.parse(content);
|
|
97727
98107
|
return {
|
|
97728
98108
|
fileName,
|
|
@@ -97765,8 +98145,8 @@ init_agent_display_names();
|
|
|
97765
98145
|
|
|
97766
98146
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
97767
98147
|
init_frontmatter2();
|
|
97768
|
-
import { existsSync as existsSync42, readFileSync as
|
|
97769
|
-
import { dirname as
|
|
98148
|
+
import { existsSync as existsSync42, readFileSync as readFileSync24, writeFileSync as writeFileSync7, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "node:fs";
|
|
98149
|
+
import { dirname as dirname24, join as join66 } from "node:path";
|
|
97770
98150
|
|
|
97771
98151
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
97772
98152
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -97775,7 +98155,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
97775
98155
|
|
|
97776
98156
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
97777
98157
|
function getStateFilePath(directory, customPath) {
|
|
97778
|
-
return customPath ?
|
|
98158
|
+
return customPath ? join66(directory, customPath) : join66(directory, DEFAULT_STATE_FILE);
|
|
97779
98159
|
}
|
|
97780
98160
|
function readState(directory, customPath) {
|
|
97781
98161
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -97783,7 +98163,7 @@ function readState(directory, customPath) {
|
|
|
97783
98163
|
return null;
|
|
97784
98164
|
}
|
|
97785
98165
|
try {
|
|
97786
|
-
const content =
|
|
98166
|
+
const content = readFileSync24(filePath, "utf-8");
|
|
97787
98167
|
const { data, body } = parseFrontmatter(content);
|
|
97788
98168
|
const active = data.active;
|
|
97789
98169
|
const iteration = data.iteration;
|
|
@@ -98858,14 +99238,14 @@ async function getLocalVersion(options = {}) {
|
|
|
98858
99238
|
}
|
|
98859
99239
|
}
|
|
98860
99240
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
98861
|
-
import { existsSync as existsSync53, readFileSync as
|
|
99241
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34 } from "node:fs";
|
|
98862
99242
|
|
|
98863
99243
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
98864
99244
|
init_extract_semver();
|
|
98865
99245
|
init_bun_which_shim();
|
|
98866
99246
|
import { existsSync as existsSync50, accessSync as accessSync4, constants as constants10 } from "node:fs";
|
|
98867
99247
|
import { homedir as homedir14 } from "node:os";
|
|
98868
|
-
import { join as
|
|
99248
|
+
import { join as join73 } from "node:path";
|
|
98869
99249
|
|
|
98870
99250
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
98871
99251
|
init_spawn_with_windows_hide();
|
|
@@ -98957,17 +99337,17 @@ function getDesktopAppPaths(platform) {
|
|
|
98957
99337
|
case "darwin":
|
|
98958
99338
|
return [
|
|
98959
99339
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
98960
|
-
|
|
99340
|
+
join73(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
98961
99341
|
];
|
|
98962
99342
|
case "win32": {
|
|
98963
99343
|
const programFiles = process.env.ProgramFiles;
|
|
98964
99344
|
const localAppData = process.env.LOCALAPPDATA;
|
|
98965
99345
|
const paths = [];
|
|
98966
99346
|
if (programFiles) {
|
|
98967
|
-
paths.push(
|
|
99347
|
+
paths.push(join73(programFiles, "OpenCode", "OpenCode.exe"));
|
|
98968
99348
|
}
|
|
98969
99349
|
if (localAppData) {
|
|
98970
|
-
paths.push(
|
|
99350
|
+
paths.push(join73(localAppData, "OpenCode", "OpenCode.exe"));
|
|
98971
99351
|
}
|
|
98972
99352
|
return paths;
|
|
98973
99353
|
}
|
|
@@ -98975,8 +99355,8 @@ function getDesktopAppPaths(platform) {
|
|
|
98975
99355
|
return [
|
|
98976
99356
|
"/usr/bin/opencode",
|
|
98977
99357
|
"/usr/lib/opencode/opencode",
|
|
98978
|
-
|
|
98979
|
-
|
|
99358
|
+
join73(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
99359
|
+
join73(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
98980
99360
|
];
|
|
98981
99361
|
default:
|
|
98982
99362
|
return [];
|
|
@@ -99008,7 +99388,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
99008
99388
|
const candidates = getCommandCandidates2(platform);
|
|
99009
99389
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
99010
99390
|
for (const command of candidates) {
|
|
99011
|
-
const fullPath =
|
|
99391
|
+
const fullPath = join73(entry, command);
|
|
99012
99392
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
99013
99393
|
return { binary: command, path: fullPath };
|
|
99014
99394
|
}
|
|
@@ -99054,7 +99434,7 @@ function compareVersions3(current, minimum) {
|
|
|
99054
99434
|
|
|
99055
99435
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
99056
99436
|
init_shared();
|
|
99057
|
-
import { existsSync as existsSync51, readFileSync as
|
|
99437
|
+
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "node:fs";
|
|
99058
99438
|
function detectConfigPath() {
|
|
99059
99439
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
99060
99440
|
if (existsSync51(paths.configJsonc))
|
|
@@ -99105,7 +99485,7 @@ function getPluginInfo() {
|
|
|
99105
99485
|
};
|
|
99106
99486
|
}
|
|
99107
99487
|
try {
|
|
99108
|
-
const content =
|
|
99488
|
+
const content = readFileSync32(configPath, "utf-8");
|
|
99109
99489
|
const parsedConfig = parseJsonc(content);
|
|
99110
99490
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
99111
99491
|
if (!pluginEntry) {
|
|
@@ -99147,25 +99527,25 @@ init_file_utils2();
|
|
|
99147
99527
|
init_checker();
|
|
99148
99528
|
init_auto_update_checker();
|
|
99149
99529
|
init_package_json_locator();
|
|
99150
|
-
import { existsSync as existsSync52, readFileSync as
|
|
99530
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33, readdirSync as readdirSync8 } from "node:fs";
|
|
99151
99531
|
import { createRequire as createRequire3 } from "node:module";
|
|
99152
99532
|
import { homedir as homedir15 } from "node:os";
|
|
99153
|
-
import { join as
|
|
99533
|
+
import { join as join74 } from "node:path";
|
|
99154
99534
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
99155
99535
|
init_shared();
|
|
99156
99536
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
99157
99537
|
if (platform === "darwin")
|
|
99158
|
-
return
|
|
99538
|
+
return join74(homedir15(), "Library", "Caches");
|
|
99159
99539
|
if (platform === "win32")
|
|
99160
|
-
return process.env.LOCALAPPDATA ??
|
|
99161
|
-
return
|
|
99540
|
+
return process.env.LOCALAPPDATA ?? join74(homedir15(), "AppData", "Local");
|
|
99541
|
+
return join74(homedir15(), ".cache");
|
|
99162
99542
|
}
|
|
99163
99543
|
function resolveOpenCodeCacheDir() {
|
|
99164
99544
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
99165
99545
|
if (xdgCacheHome)
|
|
99166
|
-
return
|
|
99546
|
+
return join74(xdgCacheHome, "opencode");
|
|
99167
99547
|
const fromShared = getOpenCodeCacheDir();
|
|
99168
|
-
const platformDefault =
|
|
99548
|
+
const platformDefault = join74(getPlatformDefaultCacheDir(), "opencode");
|
|
99169
99549
|
if (existsSync52(fromShared) || !existsSync52(platformDefault))
|
|
99170
99550
|
return fromShared;
|
|
99171
99551
|
return platformDefault;
|
|
@@ -99179,7 +99559,7 @@ function readPackageJson(filePath) {
|
|
|
99179
99559
|
if (!existsSync52(filePath))
|
|
99180
99560
|
return null;
|
|
99181
99561
|
try {
|
|
99182
|
-
const content =
|
|
99562
|
+
const content = readFileSync33(filePath, "utf-8");
|
|
99183
99563
|
return parseJsonc(content);
|
|
99184
99564
|
} catch (error51) {
|
|
99185
99565
|
if (!(error51 instanceof Error)) {
|
|
@@ -99197,11 +99577,11 @@ function normalizeVersion(value) {
|
|
|
99197
99577
|
function createPackageCandidates(rootDir) {
|
|
99198
99578
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
99199
99579
|
packageName,
|
|
99200
|
-
installedPackagePath:
|
|
99580
|
+
installedPackagePath: join74(rootDir, "node_modules", packageName, "package.json")
|
|
99201
99581
|
}));
|
|
99202
99582
|
}
|
|
99203
99583
|
function createTaggedInstallCandidates(rootDir) {
|
|
99204
|
-
const packagesDir =
|
|
99584
|
+
const packagesDir = join74(rootDir, "packages");
|
|
99205
99585
|
if (!existsSync52(packagesDir))
|
|
99206
99586
|
return [];
|
|
99207
99587
|
const candidates = [];
|
|
@@ -99209,14 +99589,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
99209
99589
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
99210
99590
|
if (packageName === undefined)
|
|
99211
99591
|
continue;
|
|
99212
|
-
const installDir =
|
|
99592
|
+
const installDir = join74(packagesDir, entryName);
|
|
99213
99593
|
candidates.push({
|
|
99214
99594
|
cacheDir: installDir,
|
|
99215
|
-
cachePackagePath:
|
|
99595
|
+
cachePackagePath: join74(installDir, "package.json"),
|
|
99216
99596
|
packageCandidates: [
|
|
99217
99597
|
{
|
|
99218
99598
|
packageName,
|
|
99219
|
-
installedPackagePath:
|
|
99599
|
+
installedPackagePath: join74(installDir, "node_modules", packageName, "package.json")
|
|
99220
99600
|
}
|
|
99221
99601
|
]
|
|
99222
99602
|
});
|
|
@@ -99261,13 +99641,13 @@ function getLoadedPluginVersion() {
|
|
|
99261
99641
|
const candidates = [
|
|
99262
99642
|
{
|
|
99263
99643
|
cacheDir: configDir,
|
|
99264
|
-
cachePackagePath:
|
|
99644
|
+
cachePackagePath: join74(configDir, "package.json"),
|
|
99265
99645
|
packageCandidates: createPackageCandidates(configDir)
|
|
99266
99646
|
},
|
|
99267
99647
|
...createTaggedInstallCandidates(configDir),
|
|
99268
99648
|
{
|
|
99269
99649
|
cacheDir,
|
|
99270
|
-
cachePackagePath:
|
|
99650
|
+
cachePackagePath: join74(cacheDir, "package.json"),
|
|
99271
99651
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
99272
99652
|
},
|
|
99273
99653
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -99313,7 +99693,7 @@ var defaultDeps6 = {
|
|
|
99313
99693
|
getLatestPluginVersion,
|
|
99314
99694
|
getSuggestedInstallTag,
|
|
99315
99695
|
configExists: existsSync53,
|
|
99316
|
-
readConfigFile: (path14) =>
|
|
99696
|
+
readConfigFile: (path14) => readFileSync34(path14, "utf-8"),
|
|
99317
99697
|
parseConfigContent: (content) => parseJsonc(content)
|
|
99318
99698
|
};
|
|
99319
99699
|
var BUN_POSTINSTALL_HELPER_PACKAGE_NAME = "@code-yeongyu/comment-checker";
|
|
@@ -99458,9 +99838,9 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
99458
99838
|
|
|
99459
99839
|
// packages/omo-opencode/src/config/validate.ts
|
|
99460
99840
|
init_src();
|
|
99461
|
-
import { readFileSync as
|
|
99841
|
+
import { readFileSync as readFileSync35 } from "node:fs";
|
|
99462
99842
|
import { homedir as homedir16 } from "node:os";
|
|
99463
|
-
import { dirname as
|
|
99843
|
+
import { dirname as dirname29, relative as relative9 } from "node:path";
|
|
99464
99844
|
init_shared();
|
|
99465
99845
|
init_plugin_identity();
|
|
99466
99846
|
function resolveHomeDirectory2() {
|
|
@@ -99484,7 +99864,7 @@ function discoverProjectLayersNearestFirst(directory) {
|
|
|
99484
99864
|
const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
|
|
99485
99865
|
return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
|
|
99486
99866
|
path: configPath,
|
|
99487
|
-
configDir:
|
|
99867
|
+
configDir: dirname29(configPath)
|
|
99488
99868
|
}));
|
|
99489
99869
|
}
|
|
99490
99870
|
function shortPath(configPath) {
|
|
@@ -99503,12 +99883,12 @@ function schemaMessages(configPath, rawConfig) {
|
|
|
99503
99883
|
}
|
|
99504
99884
|
function parseLayerConfig(configPath) {
|
|
99505
99885
|
try {
|
|
99506
|
-
const content =
|
|
99886
|
+
const content = readFileSync35(configPath, "utf-8");
|
|
99507
99887
|
const rawConfig = parseJsonc(content);
|
|
99508
99888
|
if (!isPlainRecord(rawConfig)) {
|
|
99509
99889
|
return {
|
|
99510
99890
|
path: configPath,
|
|
99511
|
-
configDir:
|
|
99891
|
+
configDir: dirname29(configPath),
|
|
99512
99892
|
config: null,
|
|
99513
99893
|
messages: [`${shortPath(configPath)}: <root>: Expected object`]
|
|
99514
99894
|
};
|
|
@@ -99516,7 +99896,7 @@ function parseLayerConfig(configPath) {
|
|
|
99516
99896
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
99517
99897
|
return {
|
|
99518
99898
|
path: configPath,
|
|
99519
|
-
configDir:
|
|
99899
|
+
configDir: dirname29(configPath),
|
|
99520
99900
|
config: result.success ? result.data : parseConfigPartially(rawConfig),
|
|
99521
99901
|
messages: schemaMessages(configPath, rawConfig)
|
|
99522
99902
|
};
|
|
@@ -99526,7 +99906,7 @@ function parseLayerConfig(configPath) {
|
|
|
99526
99906
|
}
|
|
99527
99907
|
return {
|
|
99528
99908
|
path: configPath,
|
|
99529
|
-
configDir:
|
|
99909
|
+
configDir: dirname29(configPath),
|
|
99530
99910
|
config: null,
|
|
99531
99911
|
messages: [`${shortPath(configPath)}: ${error51.message}`]
|
|
99532
99912
|
};
|
|
@@ -99572,26 +99952,26 @@ function validatePluginConfig(directory) {
|
|
|
99572
99952
|
|
|
99573
99953
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
99574
99954
|
init_shared();
|
|
99575
|
-
import { existsSync as existsSync54, readFileSync as
|
|
99955
|
+
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "node:fs";
|
|
99576
99956
|
import { homedir as homedir17 } from "node:os";
|
|
99577
|
-
import { join as
|
|
99957
|
+
import { join as join75 } from "node:path";
|
|
99578
99958
|
function getUserConfigDir2() {
|
|
99579
99959
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
99580
99960
|
if (xdgConfig)
|
|
99581
|
-
return
|
|
99582
|
-
return
|
|
99961
|
+
return join75(xdgConfig, "opencode");
|
|
99962
|
+
return join75(homedir17(), ".config", "opencode");
|
|
99583
99963
|
}
|
|
99584
99964
|
function loadCustomProviderNames() {
|
|
99585
99965
|
const configDir = getUserConfigDir2();
|
|
99586
99966
|
const candidatePaths = [
|
|
99587
|
-
|
|
99588
|
-
|
|
99967
|
+
join75(configDir, "opencode.json"),
|
|
99968
|
+
join75(configDir, "opencode.jsonc")
|
|
99589
99969
|
];
|
|
99590
99970
|
for (const configPath of candidatePaths) {
|
|
99591
99971
|
if (!existsSync54(configPath))
|
|
99592
99972
|
continue;
|
|
99593
99973
|
try {
|
|
99594
|
-
const content =
|
|
99974
|
+
const content = readFileSync36(configPath, "utf-8");
|
|
99595
99975
|
const data = parseJsonc(content);
|
|
99596
99976
|
if (data?.provider && typeof data.provider === "object") {
|
|
99597
99977
|
return Object.keys(data.provider);
|
|
@@ -99606,7 +99986,7 @@ function loadCustomProviderNames() {
|
|
|
99606
99986
|
return [];
|
|
99607
99987
|
}
|
|
99608
99988
|
function loadAvailableModelsFromCache() {
|
|
99609
|
-
const cacheFile =
|
|
99989
|
+
const cacheFile = join75(getOpenCodeCacheDir(), "models.json");
|
|
99610
99990
|
const customProviders = loadCustomProviderNames();
|
|
99611
99991
|
if (!existsSync54(cacheFile)) {
|
|
99612
99992
|
if (customProviders.length > 0) {
|
|
@@ -99615,7 +99995,7 @@ function loadAvailableModelsFromCache() {
|
|
|
99615
99995
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
99616
99996
|
}
|
|
99617
99997
|
try {
|
|
99618
|
-
const content =
|
|
99998
|
+
const content = readFileSync36(cacheFile, "utf-8");
|
|
99619
99999
|
const data = parseJsonc(content);
|
|
99620
100000
|
const cacheProviders = Object.keys(data);
|
|
99621
100001
|
let modelCount = 0;
|
|
@@ -99642,9 +100022,9 @@ init_model_capabilities2();
|
|
|
99642
100022
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-config.ts
|
|
99643
100023
|
init_shared();
|
|
99644
100024
|
init_plugin_identity();
|
|
99645
|
-
import { readFileSync as
|
|
99646
|
-
import { join as
|
|
99647
|
-
var PROJECT_CONFIG_DIR =
|
|
100025
|
+
import { readFileSync as readFileSync37 } from "node:fs";
|
|
100026
|
+
import { join as join76 } from "node:path";
|
|
100027
|
+
var PROJECT_CONFIG_DIR = join76(process.cwd(), ".opencode");
|
|
99648
100028
|
function loadOmoConfig() {
|
|
99649
100029
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
99650
100030
|
basenames: [CONFIG_BASENAME],
|
|
@@ -99652,7 +100032,7 @@ function loadOmoConfig() {
|
|
|
99652
100032
|
});
|
|
99653
100033
|
if (projectDetected.format !== "none") {
|
|
99654
100034
|
try {
|
|
99655
|
-
const content =
|
|
100035
|
+
const content = readFileSync37(projectDetected.path, "utf-8");
|
|
99656
100036
|
return parseJsonc(content);
|
|
99657
100037
|
} catch (error51) {
|
|
99658
100038
|
if (error51 instanceof Error) {
|
|
@@ -99668,7 +100048,7 @@ function loadOmoConfig() {
|
|
|
99668
100048
|
});
|
|
99669
100049
|
if (userDetected.format !== "none") {
|
|
99670
100050
|
try {
|
|
99671
|
-
const content =
|
|
100051
|
+
const content = readFileSync37(userDetected.path, "utf-8");
|
|
99672
100052
|
return parseJsonc(content);
|
|
99673
100053
|
} catch (error51) {
|
|
99674
100054
|
if (error51 instanceof Error) {
|
|
@@ -99682,7 +100062,7 @@ function loadOmoConfig() {
|
|
|
99682
100062
|
|
|
99683
100063
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
99684
100064
|
init_shared();
|
|
99685
|
-
import { join as
|
|
100065
|
+
import { join as join77 } from "node:path";
|
|
99686
100066
|
|
|
99687
100067
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
99688
100068
|
function formatModelWithVariant(model, variant) {
|
|
@@ -99724,7 +100104,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
99724
100104
|
}
|
|
99725
100105
|
function buildModelResolutionDetails(options) {
|
|
99726
100106
|
const details = [];
|
|
99727
|
-
const cacheFile =
|
|
100107
|
+
const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
|
|
99728
100108
|
details.push("═══ Available Models (from cache) ═══");
|
|
99729
100109
|
details.push("");
|
|
99730
100110
|
if (options.available.cacheExists) {
|
|
@@ -100003,25 +100383,25 @@ init_src();
|
|
|
100003
100383
|
import { existsSync as existsSync55 } from "node:fs";
|
|
100004
100384
|
import { createRequire as createRequire4 } from "node:module";
|
|
100005
100385
|
import { homedir as homedir19 } from "node:os";
|
|
100006
|
-
import { dirname as
|
|
100386
|
+
import { dirname as dirname30, join as join79 } from "node:path";
|
|
100007
100387
|
|
|
100008
100388
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
100009
|
-
import { join as
|
|
100389
|
+
import { join as join78 } from "path";
|
|
100010
100390
|
import { homedir as homedir18, tmpdir as tmpdir3 } from "os";
|
|
100011
100391
|
init_binary_downloader();
|
|
100012
100392
|
init_logger2();
|
|
100013
100393
|
init_plugin_identity();
|
|
100014
100394
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
100015
|
-
var DEBUG_FILE =
|
|
100395
|
+
var DEBUG_FILE = join78(tmpdir3(), "comment-checker-debug.log");
|
|
100016
100396
|
function getCacheDir2() {
|
|
100017
100397
|
if (process.platform === "win32") {
|
|
100018
100398
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
100019
|
-
const base2 = localAppData ||
|
|
100020
|
-
return
|
|
100399
|
+
const base2 = localAppData || join78(homedir18(), "AppData", "Local");
|
|
100400
|
+
return join78(base2, CACHE_DIR_NAME, "bin");
|
|
100021
100401
|
}
|
|
100022
100402
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
100023
|
-
const base = xdgCache ||
|
|
100024
|
-
return
|
|
100403
|
+
const base = xdgCache || join78(homedir18(), ".cache");
|
|
100404
|
+
return join78(base, CACHE_DIR_NAME, "bin");
|
|
100025
100405
|
}
|
|
100026
100406
|
function getBinaryName() {
|
|
100027
100407
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -100071,7 +100451,7 @@ async function getBinaryVersion(binary) {
|
|
|
100071
100451
|
}
|
|
100072
100452
|
}
|
|
100073
100453
|
async function checkAstGrepCli() {
|
|
100074
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
100454
|
+
const runtimeDir = astGrepRuntimeDir(join79(homedir19(), ".omo"));
|
|
100075
100455
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
100076
100456
|
if (sgPath === null) {
|
|
100077
100457
|
return {
|
|
@@ -100100,11 +100480,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
100100
100480
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
100101
100481
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
100102
100482
|
try {
|
|
100103
|
-
const packageDir = baseDirOverride ??
|
|
100104
|
-
const vendorPath =
|
|
100483
|
+
const packageDir = baseDirOverride ?? dirname30(resolvePackageJsonPath());
|
|
100484
|
+
const vendorPath = join79(packageDir, "vendor", platformKey, binaryName);
|
|
100105
100485
|
if (existsSync55(vendorPath))
|
|
100106
100486
|
return vendorPath;
|
|
100107
|
-
const binPath =
|
|
100487
|
+
const binPath = join79(packageDir, "bin", binaryName);
|
|
100108
100488
|
if (existsSync55(binPath))
|
|
100109
100489
|
return binPath;
|
|
100110
100490
|
} catch (error51) {
|
|
@@ -100249,12 +100629,12 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
100249
100629
|
}
|
|
100250
100630
|
|
|
100251
100631
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
100252
|
-
import { readFileSync as
|
|
100253
|
-
import { join as
|
|
100632
|
+
import { readFileSync as readFileSync38 } from "node:fs";
|
|
100633
|
+
import { join as join80 } from "node:path";
|
|
100254
100634
|
|
|
100255
100635
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
100256
100636
|
import { existsSync as existsSync56 } from "node:fs";
|
|
100257
|
-
import { delimiter as delimiter3, dirname as
|
|
100637
|
+
import { delimiter as delimiter3, dirname as dirname31, resolve as resolve21 } from "node:path";
|
|
100258
100638
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
100259
100639
|
|
|
100260
100640
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -100376,7 +100756,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
100376
100756
|
].join(";");
|
|
100377
100757
|
function getModuleDirectory(moduleUrl) {
|
|
100378
100758
|
try {
|
|
100379
|
-
return
|
|
100759
|
+
return dirname31(fileURLToPath7(moduleUrl));
|
|
100380
100760
|
} catch (error51) {
|
|
100381
100761
|
if (!(error51 instanceof Error))
|
|
100382
100762
|
throw error51;
|
|
@@ -100446,7 +100826,7 @@ function readOmoConfig(configDirectory) {
|
|
|
100446
100826
|
return null;
|
|
100447
100827
|
}
|
|
100448
100828
|
try {
|
|
100449
|
-
const content =
|
|
100829
|
+
const content = readFileSync38(detected.path, "utf-8");
|
|
100450
100830
|
return parseJsonc(content);
|
|
100451
100831
|
} catch (error51) {
|
|
100452
100832
|
if (!(error51 instanceof Error)) {
|
|
@@ -100457,7 +100837,7 @@ function readOmoConfig(configDirectory) {
|
|
|
100457
100837
|
}
|
|
100458
100838
|
function isLspMcpDisabled(options) {
|
|
100459
100839
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
100460
|
-
const projectConfigDirectory =
|
|
100840
|
+
const projectConfigDirectory = join80(options.cwd ?? process.cwd(), ".opencode");
|
|
100461
100841
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
100462
100842
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
100463
100843
|
const disabledMcps = new Set([
|
|
@@ -100476,15 +100856,15 @@ function getInstalledLspServers(options = {}) {
|
|
|
100476
100856
|
|
|
100477
100857
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
100478
100858
|
init_shared();
|
|
100479
|
-
import { existsSync as existsSync57, readFileSync as
|
|
100859
|
+
import { existsSync as existsSync57, readFileSync as readFileSync39 } from "node:fs";
|
|
100480
100860
|
import { homedir as homedir20 } from "node:os";
|
|
100481
|
-
import { join as
|
|
100861
|
+
import { join as join81 } from "node:path";
|
|
100482
100862
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
100483
100863
|
function getMcpConfigPaths() {
|
|
100484
100864
|
return [
|
|
100485
|
-
|
|
100486
|
-
|
|
100487
|
-
|
|
100865
|
+
join81(homedir20(), ".claude", ".mcp.json"),
|
|
100866
|
+
join81(process.cwd(), ".mcp.json"),
|
|
100867
|
+
join81(process.cwd(), ".claude", ".mcp.json")
|
|
100488
100868
|
];
|
|
100489
100869
|
}
|
|
100490
100870
|
function loadUserMcpConfig() {
|
|
@@ -100493,7 +100873,7 @@ function loadUserMcpConfig() {
|
|
|
100493
100873
|
if (!existsSync57(configPath))
|
|
100494
100874
|
continue;
|
|
100495
100875
|
try {
|
|
100496
|
-
const content =
|
|
100876
|
+
const content = readFileSync39(configPath, "utf-8");
|
|
100497
100877
|
const config3 = parseJsonc(content);
|
|
100498
100878
|
if (config3.mcpServers) {
|
|
100499
100879
|
Object.assign(servers, config3.mcpServers);
|
|
@@ -100628,7 +101008,7 @@ async function checkTools() {
|
|
|
100628
101008
|
|
|
100629
101009
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
100630
101010
|
init_src4();
|
|
100631
|
-
import { existsSync as existsSync58, readFileSync as
|
|
101011
|
+
import { existsSync as existsSync58, readFileSync as readFileSync40 } from "node:fs";
|
|
100632
101012
|
function isTelemetryState(value) {
|
|
100633
101013
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
100634
101014
|
}
|
|
@@ -100638,7 +101018,7 @@ function readLastActiveDay(stateFilePath) {
|
|
|
100638
101018
|
}
|
|
100639
101019
|
let parsed;
|
|
100640
101020
|
try {
|
|
100641
|
-
parsed = JSON.parse(
|
|
101021
|
+
parsed = JSON.parse(readFileSync40(stateFilePath, "utf-8"));
|
|
100642
101022
|
} catch (error51) {
|
|
100643
101023
|
if (error51 instanceof Error) {
|
|
100644
101024
|
return "unreadable";
|
|
@@ -100713,7 +101093,7 @@ function expandHomeDirectory(directoryPath) {
|
|
|
100713
101093
|
// packages/omo-opencode/src/cli/doctor/checks/team-mode.ts
|
|
100714
101094
|
init_shared();
|
|
100715
101095
|
init_plugin_identity();
|
|
100716
|
-
import { readFileSync as
|
|
101096
|
+
import { readFileSync as readFileSync41, promises as fs13 } from "node:fs";
|
|
100717
101097
|
import path15 from "node:path";
|
|
100718
101098
|
async function checkTeamMode() {
|
|
100719
101099
|
const config3 = loadTeamModeConfig();
|
|
@@ -100750,7 +101130,7 @@ function loadTeamModeConfig() {
|
|
|
100750
101130
|
if (!configPath)
|
|
100751
101131
|
return { team_mode: undefined };
|
|
100752
101132
|
try {
|
|
100753
|
-
return parseJsonc(
|
|
101133
|
+
return parseJsonc(readFileSync41(configPath, "utf-8"));
|
|
100754
101134
|
} catch (error51) {
|
|
100755
101135
|
if (error51 instanceof Error) {
|
|
100756
101136
|
return { team_mode: undefined };
|
|
@@ -100784,9 +101164,9 @@ async function pathExists(dir) {
|
|
|
100784
101164
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
100785
101165
|
init_src();
|
|
100786
101166
|
import { existsSync as existsSync59 } from "node:fs";
|
|
100787
|
-
import { lstat as
|
|
101167
|
+
import { lstat as lstat13, readdir as readdir11, readFile as readFile23 } from "node:fs/promises";
|
|
100788
101168
|
import { homedir as homedir22 } from "node:os";
|
|
100789
|
-
import { basename as basename13, join as
|
|
101169
|
+
import { basename as basename13, join as join82, resolve as resolve22 } from "node:path";
|
|
100790
101170
|
// packages/omo-opencode/package.json
|
|
100791
101171
|
var package_default3 = {
|
|
100792
101172
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -100844,13 +101224,13 @@ var CODEX_BIN_NAMES = [
|
|
|
100844
101224
|
"omo-git-bash-hook"
|
|
100845
101225
|
];
|
|
100846
101226
|
async function gatherCodexSummary(deps = {}) {
|
|
100847
|
-
const codexHome = resolve22(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
101227
|
+
const codexHome = resolve22(deps.codexHome ?? process.env.CODEX_HOME ?? join82(homedir22(), ".codex"));
|
|
100848
101228
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
100849
101229
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
100850
101230
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
100851
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
100852
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
100853
|
-
const configPath =
|
|
101231
|
+
const manifest = pluginRoot === null ? null : await readJson(join82(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
101232
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join82(pluginRoot, "lazycodex-install.json"));
|
|
101233
|
+
const configPath = join82(codexHome, "config.toml");
|
|
100854
101234
|
const pluginVersion = stringField(manifest, "version");
|
|
100855
101235
|
return {
|
|
100856
101236
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -100907,7 +101287,7 @@ function buildCodexIssues(summary) {
|
|
|
100907
101287
|
if (summary.pluginRoot === null) {
|
|
100908
101288
|
issues.push({
|
|
100909
101289
|
title: "OMO Codex plugin is not installed",
|
|
100910
|
-
description: `Expected cached plugin at ${
|
|
101290
|
+
description: `Expected cached plugin at ${join82("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
100911
101291
|
fix: "Run: npx lazycodex-ai install",
|
|
100912
101292
|
severity: "error",
|
|
100913
101293
|
affects: ["plugin loading"]
|
|
@@ -100972,12 +101352,12 @@ function buildCodexIssues(summary) {
|
|
|
100972
101352
|
return issues;
|
|
100973
101353
|
}
|
|
100974
101354
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
100975
|
-
const pluginRoot =
|
|
101355
|
+
const pluginRoot = join82(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
100976
101356
|
if (!existsSync59(pluginRoot))
|
|
100977
101357
|
return null;
|
|
100978
|
-
const versions2 = await
|
|
101358
|
+
const versions2 = await readdir11(pluginRoot, { withFileTypes: true });
|
|
100979
101359
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
100980
|
-
return candidates.length === 0 ? null :
|
|
101360
|
+
return candidates.length === 0 ? null : join82(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
100981
101361
|
}
|
|
100982
101362
|
async function readCodexConfigSummary(configPath) {
|
|
100983
101363
|
if (!existsSync59(configPath)) {
|
|
@@ -101005,16 +101385,16 @@ async function readCodexConfigSummary(configPath) {
|
|
|
101005
101385
|
async function readLinkedBins(binDir) {
|
|
101006
101386
|
const linked = [];
|
|
101007
101387
|
for (const name of CODEX_BIN_NAMES) {
|
|
101008
|
-
if (await pathExists2(
|
|
101388
|
+
if (await pathExists2(join82(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
101009
101389
|
linked.push(name);
|
|
101010
101390
|
}
|
|
101011
101391
|
return linked;
|
|
101012
101392
|
}
|
|
101013
101393
|
async function readLinkedAgents(codexHome) {
|
|
101014
|
-
const agentsDir =
|
|
101394
|
+
const agentsDir = join82(codexHome, "agents");
|
|
101015
101395
|
if (!existsSync59(agentsDir))
|
|
101016
101396
|
return [];
|
|
101017
|
-
const entries = await
|
|
101397
|
+
const entries = await readdir11(agentsDir, { withFileTypes: true });
|
|
101018
101398
|
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename13(entry.name, ".toml")).sort();
|
|
101019
101399
|
}
|
|
101020
101400
|
async function readJson(path16) {
|
|
@@ -101114,7 +101494,7 @@ function compareVersionsDescending(left, right) {
|
|
|
101114
101494
|
}
|
|
101115
101495
|
async function pathExists2(path16) {
|
|
101116
101496
|
try {
|
|
101117
|
-
await
|
|
101497
|
+
await lstat13(path16);
|
|
101118
101498
|
return true;
|
|
101119
101499
|
} catch (error51) {
|
|
101120
101500
|
if (error51 instanceof Error)
|
|
@@ -101125,9 +101505,9 @@ async function pathExists2(path16) {
|
|
|
101125
101505
|
|
|
101126
101506
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
101127
101507
|
init_src();
|
|
101128
|
-
import { readdir as
|
|
101508
|
+
import { readdir as readdir12, readFile as readFile24, stat as stat6 } from "node:fs/promises";
|
|
101129
101509
|
import { homedir as homedir23 } from "node:os";
|
|
101130
|
-
import { dirname as
|
|
101510
|
+
import { dirname as dirname32, isAbsolute as isAbsolute13, join as join83, relative as relative10, resolve as resolve23, sep as sep9 } from "node:path";
|
|
101131
101511
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
101132
101512
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
101133
101513
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -101137,7 +101517,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
101137
101517
|
const env3 = deps.env ?? process.env;
|
|
101138
101518
|
const platform = deps.platform ?? process.platform;
|
|
101139
101519
|
const arch = deps.arch ?? process.arch;
|
|
101140
|
-
const codexHome = resolve23(deps.codexHome ?? env3["CODEX_HOME"] ??
|
|
101520
|
+
const codexHome = resolve23(deps.codexHome ?? env3["CODEX_HOME"] ?? join83(homedir23(), ".codex"));
|
|
101141
101521
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
101142
101522
|
if (summary.pluginRoot === null) {
|
|
101143
101523
|
return {
|
|
@@ -101162,7 +101542,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
101162
101542
|
});
|
|
101163
101543
|
}
|
|
101164
101544
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
101165
|
-
const runtimeSgPath =
|
|
101545
|
+
const runtimeSgPath = join83(runtimeSgDir, sgBinaryName(platform));
|
|
101166
101546
|
const sg = findSgBinarySync({
|
|
101167
101547
|
arch,
|
|
101168
101548
|
env: env3,
|
|
@@ -101199,12 +101579,12 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
101199
101579
|
let referencedCount = 0;
|
|
101200
101580
|
for (const manifestPath of await findManifestPaths(pluginRoot, ".mcp.json")) {
|
|
101201
101581
|
const manifest = await readJson2(manifestPath);
|
|
101202
|
-
if (manifest === null || !
|
|
101582
|
+
if (manifest === null || !isRecord6(manifest["mcpServers"]))
|
|
101203
101583
|
continue;
|
|
101204
|
-
const manifestRoot =
|
|
101584
|
+
const manifestRoot = dirname32(manifestPath);
|
|
101205
101585
|
const isRootManifest = resolve23(manifestRoot) === resolve23(pluginRoot);
|
|
101206
101586
|
for (const server2 of Object.values(manifest["mcpServers"])) {
|
|
101207
|
-
if (!
|
|
101587
|
+
if (!isRecord6(server2) || !Array.isArray(server2["args"]))
|
|
101208
101588
|
continue;
|
|
101209
101589
|
for (const arg of server2["args"]) {
|
|
101210
101590
|
if (typeof arg !== "string" || !isPluginRuntimePathArg(arg))
|
|
@@ -101222,7 +101602,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
101222
101602
|
continue;
|
|
101223
101603
|
const commands2 = [];
|
|
101224
101604
|
collectHookCommands(manifest, commands2);
|
|
101225
|
-
const hookPluginRoot =
|
|
101605
|
+
const hookPluginRoot = dirname32(dirname32(hookManifestPath));
|
|
101226
101606
|
for (const command of commands2) {
|
|
101227
101607
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
101228
101608
|
referencedCount += 1;
|
|
@@ -101261,12 +101641,12 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
101261
101641
|
}
|
|
101262
101642
|
async function findHookManifestPaths(root) {
|
|
101263
101643
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
101264
|
-
return paths2.filter((path16) =>
|
|
101644
|
+
return paths2.filter((path16) => dirname32(path16).endsWith(`${sep9}hooks`));
|
|
101265
101645
|
}
|
|
101266
101646
|
async function findManifestPaths(root, manifestName) {
|
|
101267
101647
|
let entries;
|
|
101268
101648
|
try {
|
|
101269
|
-
entries = await
|
|
101649
|
+
entries = await readdir12(root, { withFileTypes: true });
|
|
101270
101650
|
} catch {
|
|
101271
101651
|
return [];
|
|
101272
101652
|
}
|
|
@@ -101274,7 +101654,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
101274
101654
|
for (const entry of entries) {
|
|
101275
101655
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
101276
101656
|
continue;
|
|
101277
|
-
const entryPath =
|
|
101657
|
+
const entryPath = join83(root, entry.name);
|
|
101278
101658
|
if (entry.isDirectory()) {
|
|
101279
101659
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
101280
101660
|
continue;
|
|
@@ -101290,7 +101670,7 @@ function collectHookCommands(value, commands2) {
|
|
|
101290
101670
|
collectHookCommands(item, commands2);
|
|
101291
101671
|
return;
|
|
101292
101672
|
}
|
|
101293
|
-
if (!
|
|
101673
|
+
if (!isRecord6(value))
|
|
101294
101674
|
return;
|
|
101295
101675
|
if (value["type"] === "command") {
|
|
101296
101676
|
if (typeof value["command"] === "string")
|
|
@@ -101315,21 +101695,21 @@ function extractPluginRootPaths(command) {
|
|
|
101315
101695
|
}
|
|
101316
101696
|
function isPluginRuntimePathArg(arg) {
|
|
101317
101697
|
const normalized = normalizePathSeparators(arg);
|
|
101318
|
-
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") ||
|
|
101698
|
+
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute13(arg));
|
|
101319
101699
|
}
|
|
101320
101700
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
101321
|
-
return
|
|
101701
|
+
return join83(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
101322
101702
|
}
|
|
101323
101703
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
101324
101704
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
101325
101705
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
101326
101706
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
101327
|
-
if (sgPath ===
|
|
101707
|
+
if (sgPath === join83(runtimeSgDir, sgBinaryName(platform)))
|
|
101328
101708
|
return "runtime dir";
|
|
101329
101709
|
return "PATH";
|
|
101330
101710
|
}
|
|
101331
101711
|
async function readBootstrapStateSummary(codexHome) {
|
|
101332
|
-
const statePath =
|
|
101712
|
+
const statePath = join83(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
101333
101713
|
const raw = await readJson2(statePath);
|
|
101334
101714
|
if (raw === null)
|
|
101335
101715
|
return null;
|
|
@@ -101345,7 +101725,7 @@ function parseDegradedEntries(value) {
|
|
|
101345
101725
|
return [];
|
|
101346
101726
|
const entries = [];
|
|
101347
101727
|
for (const item of value) {
|
|
101348
|
-
if (!
|
|
101728
|
+
if (!isRecord6(item))
|
|
101349
101729
|
continue;
|
|
101350
101730
|
if (typeof item["component"] !== "string" || typeof item["reason"] !== "string")
|
|
101351
101731
|
continue;
|
|
@@ -101379,7 +101759,7 @@ function degradedDetailLines(entries) {
|
|
|
101379
101759
|
async function readJson2(path16) {
|
|
101380
101760
|
try {
|
|
101381
101761
|
const parsed = JSON.parse(await readFile24(path16, "utf8"));
|
|
101382
|
-
return
|
|
101762
|
+
return isRecord6(parsed) ? parsed : null;
|
|
101383
101763
|
} catch (error51) {
|
|
101384
101764
|
if (error51 instanceof Error)
|
|
101385
101765
|
return null;
|
|
@@ -101400,7 +101780,7 @@ function normalizeRelative(root, target) {
|
|
|
101400
101780
|
function normalizePathSeparators(path16) {
|
|
101401
101781
|
return path16.split("\\").join("/");
|
|
101402
101782
|
}
|
|
101403
|
-
function
|
|
101783
|
+
function isRecord6(value) {
|
|
101404
101784
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
101405
101785
|
}
|
|
101406
101786
|
|
|
@@ -101408,15 +101788,15 @@ function isRecord5(value) {
|
|
|
101408
101788
|
import { existsSync as existsSync60 } from "node:fs";
|
|
101409
101789
|
import { readFile as readFile25 } from "node:fs/promises";
|
|
101410
101790
|
import { homedir as homedir24 } from "node:os";
|
|
101411
|
-
import { join as
|
|
101791
|
+
import { join as join84, resolve as resolve24 } from "node:path";
|
|
101412
101792
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
101413
101793
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
101414
101794
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
101415
101795
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
101416
|
-
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
101796
|
+
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ?? join84(homedir24(), ".codex"));
|
|
101417
101797
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
101418
101798
|
const platform = deps.platform ?? process.platform;
|
|
101419
|
-
const wrapperPath =
|
|
101799
|
+
const wrapperPath = join84(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
101420
101800
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
101421
101801
|
const issues = [];
|
|
101422
101802
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -101923,17 +102303,17 @@ import {
|
|
|
101923
102303
|
existsSync as existsSync63,
|
|
101924
102304
|
mkdirSync as mkdirSync14,
|
|
101925
102305
|
readdirSync as readdirSync9,
|
|
101926
|
-
readFileSync as
|
|
102306
|
+
readFileSync as readFileSync43,
|
|
101927
102307
|
renameSync as renameSync7,
|
|
101928
102308
|
unlinkSync as unlinkSync8,
|
|
101929
102309
|
writeFileSync as writeFileSync11
|
|
101930
102310
|
} from "node:fs";
|
|
101931
|
-
import { basename as basename14, dirname as
|
|
102311
|
+
import { basename as basename14, dirname as dirname33, join as join87 } from "node:path";
|
|
101932
102312
|
|
|
101933
102313
|
// packages/mcp-client-core/src/config-dir.ts
|
|
101934
102314
|
import { existsSync as existsSync61, realpathSync as realpathSync8 } from "node:fs";
|
|
101935
102315
|
import { homedir as homedir25 } from "node:os";
|
|
101936
|
-
import { join as
|
|
102316
|
+
import { join as join85, resolve as resolve25 } from "node:path";
|
|
101937
102317
|
function resolveConfigPath2(pathValue) {
|
|
101938
102318
|
const resolvedPath = resolve25(pathValue);
|
|
101939
102319
|
if (!existsSync61(resolvedPath))
|
|
@@ -101951,13 +102331,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
101951
102331
|
if (customConfigDir) {
|
|
101952
102332
|
return resolveConfigPath2(customConfigDir);
|
|
101953
102333
|
}
|
|
101954
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
101955
|
-
return resolveConfigPath2(
|
|
102334
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join85(homedir25(), ".config");
|
|
102335
|
+
return resolveConfigPath2(join85(xdgConfigDir, "opencode"));
|
|
101956
102336
|
}
|
|
101957
102337
|
|
|
101958
102338
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
101959
|
-
import { chmodSync as chmodSync3, existsSync as existsSync62, readFileSync as
|
|
101960
|
-
import { join as
|
|
102339
|
+
import { chmodSync as chmodSync3, existsSync as existsSync62, readFileSync as readFileSync42, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "node:fs";
|
|
102340
|
+
import { join as join86 } from "node:path";
|
|
101961
102341
|
var INDEX_FILE_NAME = "index.json";
|
|
101962
102342
|
function isTokenIndex(value) {
|
|
101963
102343
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -101965,14 +102345,14 @@ function isTokenIndex(value) {
|
|
|
101965
102345
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
101966
102346
|
}
|
|
101967
102347
|
function getIndexPath(storageDir) {
|
|
101968
|
-
return
|
|
102348
|
+
return join86(storageDir, INDEX_FILE_NAME);
|
|
101969
102349
|
}
|
|
101970
102350
|
function readTokenIndex(storageDir) {
|
|
101971
102351
|
const indexPath = getIndexPath(storageDir);
|
|
101972
102352
|
if (!existsSync62(indexPath))
|
|
101973
102353
|
return {};
|
|
101974
102354
|
try {
|
|
101975
|
-
const parsed = JSON.parse(
|
|
102355
|
+
const parsed = JSON.parse(readFileSync42(indexPath, "utf-8"));
|
|
101976
102356
|
return isTokenIndex(parsed) ? parsed : {};
|
|
101977
102357
|
} catch (readError) {
|
|
101978
102358
|
if (!(readError instanceof Error))
|
|
@@ -102009,16 +102389,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
102009
102389
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
102010
102390
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
102011
102391
|
function getMcpOauthStorageDir() {
|
|
102012
|
-
return
|
|
102392
|
+
return join87(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
102013
102393
|
}
|
|
102014
102394
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
102015
102395
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
102016
102396
|
}
|
|
102017
102397
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
102018
|
-
return
|
|
102398
|
+
return join87(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
102019
102399
|
}
|
|
102020
102400
|
function getLegacyStoragePath() {
|
|
102021
|
-
return
|
|
102401
|
+
return join87(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
102022
102402
|
}
|
|
102023
102403
|
function normalizeHost2(serverHost) {
|
|
102024
102404
|
let host = serverHost.trim();
|
|
@@ -102082,7 +102462,7 @@ function readTokenFile(filePath) {
|
|
|
102082
102462
|
if (!existsSync63(filePath))
|
|
102083
102463
|
return null;
|
|
102084
102464
|
try {
|
|
102085
|
-
const parsed = JSON.parse(
|
|
102465
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
102086
102466
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
102087
102467
|
} catch (readError) {
|
|
102088
102468
|
if (!(readError instanceof Error))
|
|
@@ -102095,7 +102475,7 @@ function readLegacyStore() {
|
|
|
102095
102475
|
if (!existsSync63(filePath))
|
|
102096
102476
|
return null;
|
|
102097
102477
|
try {
|
|
102098
|
-
const parsed = JSON.parse(
|
|
102478
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
102099
102479
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
102100
102480
|
return null;
|
|
102101
102481
|
const result = {};
|
|
@@ -102112,7 +102492,7 @@ function readLegacyStore() {
|
|
|
102112
102492
|
}
|
|
102113
102493
|
function writeTokenFile(filePath, token) {
|
|
102114
102494
|
try {
|
|
102115
|
-
const dir =
|
|
102495
|
+
const dir = dirname33(filePath);
|
|
102116
102496
|
if (!existsSync63(dir)) {
|
|
102117
102497
|
mkdirSync14(dir, { recursive: true });
|
|
102118
102498
|
}
|
|
@@ -102197,7 +102577,7 @@ function listTokensByHost(serverHost) {
|
|
|
102197
102577
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
102198
102578
|
if (!indexedKey.startsWith(prefix))
|
|
102199
102579
|
continue;
|
|
102200
|
-
const indexedToken = readTokenFile(
|
|
102580
|
+
const indexedToken = readTokenFile(join87(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
102201
102581
|
if (indexedToken)
|
|
102202
102582
|
result[indexedKey] = indexedToken;
|
|
102203
102583
|
}
|
|
@@ -102212,7 +102592,7 @@ function listAllTokens() {
|
|
|
102212
102592
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
102213
102593
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
102214
102594
|
continue;
|
|
102215
|
-
const token = readTokenFile(
|
|
102595
|
+
const token = readTokenFile(join87(dir, entry.name));
|
|
102216
102596
|
const hash2 = basename14(entry.name, ".json");
|
|
102217
102597
|
if (token)
|
|
102218
102598
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -102936,7 +103316,7 @@ async function boulder(options) {
|
|
|
102936
103316
|
}
|
|
102937
103317
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
102938
103318
|
import { spawn as spawn5 } from "node:child_process";
|
|
102939
|
-
import { existsSync as existsSync65, readFileSync as
|
|
103319
|
+
import { existsSync as existsSync65, readFileSync as readFileSync44, realpathSync as realpathSync9 } from "node:fs";
|
|
102940
103320
|
import { homedir as homedir26 } from "node:os";
|
|
102941
103321
|
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
|
|
102942
103322
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
@@ -102986,7 +103366,7 @@ function resolveLegacyLocalOmoBin(env3, homeDir, currentExecutablePaths) {
|
|
|
102986
103366
|
}
|
|
102987
103367
|
function isGeneratedRuntimeWrapper(candidate) {
|
|
102988
103368
|
try {
|
|
102989
|
-
return
|
|
103369
|
+
return readFileSync44(candidate, "utf8").includes(RUNTIME_WRAPPER_MARKER);
|
|
102990
103370
|
} catch (error51) {
|
|
102991
103371
|
if (error51 instanceof Error)
|
|
102992
103372
|
return false;
|