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/index.js
CHANGED
|
@@ -2145,7 +2145,7 @@ var package_default;
|
|
|
2145
2145
|
var init_package = __esm(() => {
|
|
2146
2146
|
package_default = {
|
|
2147
2147
|
name: "oh-my-opencode",
|
|
2148
|
-
version: "4.
|
|
2148
|
+
version: "4.17.0",
|
|
2149
2149
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2150
2150
|
main: "./dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -2208,6 +2208,7 @@ var init_package = __esm(() => {
|
|
|
2208
2208
|
"packages/lsp-tools-mcp/dist",
|
|
2209
2209
|
"packages/lsp-daemon/package.json",
|
|
2210
2210
|
"packages/lsp-daemon/dist",
|
|
2211
|
+
"packages/git-bash-mcp/package.json",
|
|
2211
2212
|
"packages/git-bash-mcp/dist",
|
|
2212
2213
|
"packages/shared-skills/package.json",
|
|
2213
2214
|
"packages/shared-skills/index.mjs",
|
|
@@ -2273,7 +2274,7 @@ var init_package = __esm(() => {
|
|
|
2273
2274
|
"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",
|
|
2274
2275
|
"typecheck:script": "tsgo --noEmit -p script/tsconfig.json",
|
|
2275
2276
|
test: "bun test",
|
|
2276
|
-
"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",
|
|
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 && 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",
|
|
2277
2278
|
"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",
|
|
2278
2279
|
"test:windows-codex": "bun run test:codex",
|
|
2279
2280
|
"build:git-bash-mcp": "bun run --cwd packages/git-bash-mcp build"
|
|
@@ -2355,18 +2356,18 @@ var init_package = __esm(() => {
|
|
|
2355
2356
|
typescript: "^6.0.3"
|
|
2356
2357
|
},
|
|
2357
2358
|
optionalDependencies: {
|
|
2358
|
-
"oh-my-opencode-darwin-arm64": "4.
|
|
2359
|
-
"oh-my-opencode-darwin-x64": "4.
|
|
2360
|
-
"oh-my-opencode-darwin-x64-baseline": "4.
|
|
2361
|
-
"oh-my-opencode-linux-arm64": "4.
|
|
2362
|
-
"oh-my-opencode-linux-arm64-musl": "4.
|
|
2363
|
-
"oh-my-opencode-linux-x64": "4.
|
|
2364
|
-
"oh-my-opencode-linux-x64-baseline": "4.
|
|
2365
|
-
"oh-my-opencode-linux-x64-musl": "4.
|
|
2366
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.
|
|
2367
|
-
"oh-my-opencode-windows-arm64": "4.
|
|
2368
|
-
"oh-my-opencode-windows-x64": "4.
|
|
2369
|
-
"oh-my-opencode-windows-x64-baseline": "4.
|
|
2359
|
+
"oh-my-opencode-darwin-arm64": "4.17.0",
|
|
2360
|
+
"oh-my-opencode-darwin-x64": "4.17.0",
|
|
2361
|
+
"oh-my-opencode-darwin-x64-baseline": "4.17.0",
|
|
2362
|
+
"oh-my-opencode-linux-arm64": "4.17.0",
|
|
2363
|
+
"oh-my-opencode-linux-arm64-musl": "4.17.0",
|
|
2364
|
+
"oh-my-opencode-linux-x64": "4.17.0",
|
|
2365
|
+
"oh-my-opencode-linux-x64-baseline": "4.17.0",
|
|
2366
|
+
"oh-my-opencode-linux-x64-musl": "4.17.0",
|
|
2367
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.17.0",
|
|
2368
|
+
"oh-my-opencode-windows-arm64": "4.17.0",
|
|
2369
|
+
"oh-my-opencode-windows-x64": "4.17.0",
|
|
2370
|
+
"oh-my-opencode-windows-x64-baseline": "4.17.0"
|
|
2370
2371
|
},
|
|
2371
2372
|
overrides: {
|
|
2372
2373
|
"@earendil-works/pi-agent-core": "0.80.3",
|
|
@@ -9219,6 +9220,11 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9219
9220
|
},
|
|
9220
9221
|
hephaestus: {
|
|
9221
9222
|
fallbackChain: [
|
|
9223
|
+
{
|
|
9224
|
+
providers: ["openai", "vercel"],
|
|
9225
|
+
model: "gpt-5.6-sol",
|
|
9226
|
+
variant: "medium"
|
|
9227
|
+
},
|
|
9222
9228
|
{
|
|
9223
9229
|
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
9224
9230
|
model: "gpt-5.5",
|
|
@@ -9245,7 +9251,7 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9245
9251
|
model: "claude-opus-4-7",
|
|
9246
9252
|
variant: "max"
|
|
9247
9253
|
},
|
|
9248
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9254
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9249
9255
|
]
|
|
9250
9256
|
},
|
|
9251
9257
|
librarian: {
|
|
@@ -9292,7 +9298,7 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9292
9298
|
model: "gpt-5.5",
|
|
9293
9299
|
variant: "high"
|
|
9294
9300
|
},
|
|
9295
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9301
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9296
9302
|
{
|
|
9297
9303
|
providers: ["google", "github-copilot", "opencode", "vercel"],
|
|
9298
9304
|
model: "gemini-3.1-pro"
|
|
@@ -9315,12 +9321,17 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9315
9321
|
model: "gpt-5.5",
|
|
9316
9322
|
variant: "high"
|
|
9317
9323
|
},
|
|
9318
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9324
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9319
9325
|
{ providers: ["kimi-for-coding"], model: "k2p5" }
|
|
9320
9326
|
]
|
|
9321
9327
|
},
|
|
9322
9328
|
momus: {
|
|
9323
9329
|
fallbackChain: [
|
|
9330
|
+
{
|
|
9331
|
+
providers: ["openai", "vercel"],
|
|
9332
|
+
model: "gpt-5.6-sol",
|
|
9333
|
+
variant: "xhigh"
|
|
9334
|
+
},
|
|
9324
9335
|
{
|
|
9325
9336
|
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
9326
9337
|
model: "gpt-5.5",
|
|
@@ -9336,7 +9347,7 @@ var init_agent_model_requirements = __esm(() => {
|
|
|
9336
9347
|
model: "gemini-3.1-pro",
|
|
9337
9348
|
variant: "high"
|
|
9338
9349
|
},
|
|
9339
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9350
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9340
9351
|
]
|
|
9341
9352
|
},
|
|
9342
9353
|
atlas: {
|
|
@@ -9388,12 +9399,17 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9388
9399
|
model: "claude-opus-4-7",
|
|
9389
9400
|
variant: "max"
|
|
9390
9401
|
},
|
|
9391
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9402
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9392
9403
|
{ providers: ["kimi-for-coding"], model: "k2p5" }
|
|
9393
9404
|
]
|
|
9394
9405
|
},
|
|
9395
9406
|
ultrabrain: {
|
|
9396
9407
|
fallbackChain: [
|
|
9408
|
+
{
|
|
9409
|
+
providers: ["openai", "vercel"],
|
|
9410
|
+
model: "gpt-5.6-sol",
|
|
9411
|
+
variant: "xhigh"
|
|
9412
|
+
},
|
|
9397
9413
|
{
|
|
9398
9414
|
providers: ["openai", "opencode", "vercel"],
|
|
9399
9415
|
model: "gpt-5.5",
|
|
@@ -9409,11 +9425,21 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9409
9425
|
model: "claude-opus-4-7",
|
|
9410
9426
|
variant: "max"
|
|
9411
9427
|
},
|
|
9412
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9428
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9413
9429
|
]
|
|
9414
9430
|
},
|
|
9415
9431
|
deep: {
|
|
9416
9432
|
fallbackChain: [
|
|
9433
|
+
{
|
|
9434
|
+
providers: ["openai", "vercel"],
|
|
9435
|
+
model: "gpt-5.6-terra",
|
|
9436
|
+
variant: "xhigh"
|
|
9437
|
+
},
|
|
9438
|
+
{
|
|
9439
|
+
providers: ["openai", "vercel"],
|
|
9440
|
+
model: "gpt-5.6-sol",
|
|
9441
|
+
variant: "high"
|
|
9442
|
+
},
|
|
9417
9443
|
{
|
|
9418
9444
|
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
9419
9445
|
model: "gpt-5.5",
|
|
@@ -9430,7 +9456,7 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9430
9456
|
variant: "high"
|
|
9431
9457
|
},
|
|
9432
9458
|
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.6" },
|
|
9433
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9459
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9434
9460
|
]
|
|
9435
9461
|
},
|
|
9436
9462
|
artistry: {
|
|
@@ -9447,7 +9473,7 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9447
9473
|
},
|
|
9448
9474
|
{ providers: ["openai", "github-copilot", "opencode", "vercel"], model: "gpt-5.5" },
|
|
9449
9475
|
{ providers: ["opencode-go", "vercel"], model: "kimi-k2.6" },
|
|
9450
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9476
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" }
|
|
9451
9477
|
]
|
|
9452
9478
|
},
|
|
9453
9479
|
quick: {
|
|
@@ -9472,6 +9498,11 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9472
9498
|
},
|
|
9473
9499
|
"unspecified-low": {
|
|
9474
9500
|
fallbackChain: [
|
|
9501
|
+
{
|
|
9502
|
+
providers: ["openai", "vercel"],
|
|
9503
|
+
model: "gpt-5.6-luna",
|
|
9504
|
+
variant: "xhigh"
|
|
9505
|
+
},
|
|
9475
9506
|
{
|
|
9476
9507
|
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
9477
9508
|
model: "claude-sonnet-4-6"
|
|
@@ -9505,7 +9536,7 @@ var init_category_model_requirements = __esm(() => {
|
|
|
9505
9536
|
},
|
|
9506
9537
|
{ providers: ["zai-coding-plan", "opencode", "bailian-coding-plan", "vercel"], model: "glm-5" },
|
|
9507
9538
|
{ providers: ["kimi-for-coding"], model: "k2p5" },
|
|
9508
|
-
{ providers: ["opencode-go", "vercel"], model: "glm-5.
|
|
9539
|
+
{ providers: ["opencode-go", "vercel"], model: "glm-5.2" },
|
|
9509
9540
|
{ providers: ["opencode", "bailian-coding-plan", "vercel"], model: "kimi-k2.5" },
|
|
9510
9541
|
{
|
|
9511
9542
|
providers: [
|
|
@@ -10043,6 +10074,54 @@ var init_supplemental_entries = __esm(() => {
|
|
|
10043
10074
|
output: 262144
|
|
10044
10075
|
}
|
|
10045
10076
|
},
|
|
10077
|
+
"gpt-5.6-sol": {
|
|
10078
|
+
id: "gpt-5.6-sol",
|
|
10079
|
+
family: "gpt",
|
|
10080
|
+
reasoning: true,
|
|
10081
|
+
temperature: false,
|
|
10082
|
+
toolCall: true,
|
|
10083
|
+
modalities: {
|
|
10084
|
+
input: ["text", "image", "pdf"],
|
|
10085
|
+
output: ["text"]
|
|
10086
|
+
},
|
|
10087
|
+
limit: {
|
|
10088
|
+
context: 1050000,
|
|
10089
|
+
input: 922000,
|
|
10090
|
+
output: 128000
|
|
10091
|
+
}
|
|
10092
|
+
},
|
|
10093
|
+
"gpt-5.6-terra": {
|
|
10094
|
+
id: "gpt-5.6-terra",
|
|
10095
|
+
family: "gpt-mini",
|
|
10096
|
+
reasoning: true,
|
|
10097
|
+
temperature: false,
|
|
10098
|
+
toolCall: true,
|
|
10099
|
+
modalities: {
|
|
10100
|
+
input: ["text", "image", "pdf"],
|
|
10101
|
+
output: ["text"]
|
|
10102
|
+
},
|
|
10103
|
+
limit: {
|
|
10104
|
+
context: 1050000,
|
|
10105
|
+
input: 922000,
|
|
10106
|
+
output: 128000
|
|
10107
|
+
}
|
|
10108
|
+
},
|
|
10109
|
+
"gpt-5.6-luna": {
|
|
10110
|
+
id: "gpt-5.6-luna",
|
|
10111
|
+
family: "gpt-nano",
|
|
10112
|
+
reasoning: true,
|
|
10113
|
+
temperature: false,
|
|
10114
|
+
toolCall: true,
|
|
10115
|
+
modalities: {
|
|
10116
|
+
input: ["text", "image", "pdf"],
|
|
10117
|
+
output: ["text"]
|
|
10118
|
+
},
|
|
10119
|
+
limit: {
|
|
10120
|
+
context: 1050000,
|
|
10121
|
+
input: 922000,
|
|
10122
|
+
output: 128000
|
|
10123
|
+
}
|
|
10124
|
+
},
|
|
10046
10125
|
"gpt-5.5": {
|
|
10047
10126
|
id: "gpt-5.5",
|
|
10048
10127
|
family: "gpt",
|
|
@@ -10649,28 +10728,7 @@ var init_agent_display_names = __esm(() => {
|
|
|
10649
10728
|
};
|
|
10650
10729
|
});
|
|
10651
10730
|
// packages/omo-opencode/src/tools/delegate-task/anthropic-categories.ts
|
|
10652
|
-
var
|
|
10653
|
-
You are working on tasks that don't fit specific categories but require moderate effort.
|
|
10654
|
-
|
|
10655
|
-
<Selection_Gate>
|
|
10656
|
-
BEFORE selecting this category, VERIFY ALL conditions:
|
|
10657
|
-
1. Task does NOT fit: quick (trivial), visual-engineering (UI), ultrabrain (deep logic), artistry (creative), writing (docs)
|
|
10658
|
-
2. Task requires more than trivial effort but is NOT system-wide
|
|
10659
|
-
3. Scope is contained within a few files/modules
|
|
10660
|
-
|
|
10661
|
-
If task fits ANY other category, DO NOT select unspecified-low.
|
|
10662
|
-
This is NOT a default choice - it's for genuinely unclassifiable moderate-effort work.
|
|
10663
|
-
</Selection_Gate>
|
|
10664
|
-
</Category_Context>
|
|
10665
|
-
|
|
10666
|
-
<Caller_Warning>
|
|
10667
|
-
THIS CATEGORY USES A MID-TIER MODEL (claude-sonnet-4-6).
|
|
10668
|
-
|
|
10669
|
-
**PROVIDE CLEAR STRUCTURE:**
|
|
10670
|
-
1. MUST DO: Enumerate required actions explicitly
|
|
10671
|
-
2. MUST NOT DO: State forbidden actions to prevent scope creep
|
|
10672
|
-
3. EXPECTED OUTPUT: Define concrete success criteria
|
|
10673
|
-
</Caller_Warning>`, UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
|
10731
|
+
var UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
|
10674
10732
|
You are working on tasks that don't fit specific categories but require substantial effort.
|
|
10675
10733
|
|
|
10676
10734
|
<Selection_Gate>
|
|
@@ -10686,12 +10744,6 @@ If task is unclassifiable but moderate-effort, use unspecified-low instead.
|
|
|
10686
10744
|
</Category_Context>`, ANTHROPIC_CATEGORIES;
|
|
10687
10745
|
var init_anthropic_categories = __esm(() => {
|
|
10688
10746
|
ANTHROPIC_CATEGORIES = [
|
|
10689
|
-
{
|
|
10690
|
-
name: "unspecified-low",
|
|
10691
|
-
config: { model: "anthropic/claude-sonnet-4-6" },
|
|
10692
|
-
description: "Tasks that don't fit other categories, low effort required",
|
|
10693
|
-
promptAppend: UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND
|
|
10694
|
-
},
|
|
10695
10747
|
{
|
|
10696
10748
|
name: "unspecified-high",
|
|
10697
10749
|
config: { model: "anthropic/claude-opus-4-7", variant: "max" },
|
|
@@ -10867,11 +10919,15 @@ function isGpt5_5Model(model) {
|
|
|
10867
10919
|
const modelName = extractModelName(model).toLowerCase();
|
|
10868
10920
|
return modelName.includes("gpt-5.5") || modelName.includes("gpt-5-5");
|
|
10869
10921
|
}
|
|
10922
|
+
function isGpt5_6Model(model) {
|
|
10923
|
+
const modelName = extractModelName(model).toLowerCase();
|
|
10924
|
+
return modelName.includes("gpt-5.6") || modelName.includes("gpt-5-6");
|
|
10925
|
+
}
|
|
10870
10926
|
var init_types = () => {};
|
|
10871
10927
|
|
|
10872
10928
|
// packages/omo-opencode/src/tools/delegate-task/openai-categories.ts
|
|
10873
10929
|
function resolveDeepCategoryPromptAppend(model) {
|
|
10874
|
-
if (model && isGpt5_5Model(model)) {
|
|
10930
|
+
if (model && (isGpt5_5Model(model) || isGpt5_6Model(model))) {
|
|
10875
10931
|
return DEEP_CATEGORY_PROMPT_APPEND_GPT_5_5;
|
|
10876
10932
|
}
|
|
10877
10933
|
return DEEP_CATEGORY_PROMPT_APPEND;
|
|
@@ -10984,19 +11040,40 @@ EXPECTED OUTPUT:
|
|
|
10984
11040
|
\`\`\`
|
|
10985
11041
|
|
|
10986
11042
|
If your prompt lacks this structure, REWRITE IT before delegating.
|
|
11043
|
+
</Caller_Warning>`, UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
|
11044
|
+
You are working on tasks that don't fit specific categories but require moderate effort.
|
|
11045
|
+
|
|
11046
|
+
<Selection_Gate>
|
|
11047
|
+
BEFORE selecting this category, VERIFY ALL conditions:
|
|
11048
|
+
1. Task does NOT fit: quick (trivial), visual-engineering (UI), ultrabrain (deep logic), artistry (creative), writing (docs)
|
|
11049
|
+
2. Task requires more than trivial effort but is NOT system-wide
|
|
11050
|
+
3. Scope is contained within a few files/modules
|
|
11051
|
+
|
|
11052
|
+
If task fits ANY other category, DO NOT select unspecified-low.
|
|
11053
|
+
This is NOT a default choice - it's for genuinely unclassifiable moderate-effort work.
|
|
11054
|
+
</Selection_Gate>
|
|
11055
|
+
</Category_Context>
|
|
11056
|
+
|
|
11057
|
+
<Caller_Warning>
|
|
11058
|
+
THIS CATEGORY USES A LIGHTWEIGHT MODEL (gpt-5.6-luna).
|
|
11059
|
+
|
|
11060
|
+
**PROVIDE CLEAR STRUCTURE:**
|
|
11061
|
+
1. MUST DO: Enumerate required actions explicitly
|
|
11062
|
+
2. MUST NOT DO: State forbidden actions to prevent scope creep
|
|
11063
|
+
3. EXPECTED OUTPUT: Define concrete success criteria
|
|
10987
11064
|
</Caller_Warning>`, OPENAI_CATEGORIES;
|
|
10988
11065
|
var init_openai_categories = __esm(() => {
|
|
10989
11066
|
init_types();
|
|
10990
11067
|
OPENAI_CATEGORIES = [
|
|
10991
11068
|
{
|
|
10992
11069
|
name: "ultrabrain",
|
|
10993
|
-
config: { model: "openai/gpt-5.
|
|
11070
|
+
config: { model: "openai/gpt-5.6-sol", variant: "xhigh" },
|
|
10994
11071
|
description: "Use ONLY for genuinely hard, logic-heavy tasks. Give clear goals only, not step-by-step instructions.",
|
|
10995
11072
|
promptAppend: ULTRABRAIN_CATEGORY_PROMPT_APPEND
|
|
10996
11073
|
},
|
|
10997
11074
|
{
|
|
10998
11075
|
name: "deep",
|
|
10999
|
-
config: { model: "openai/gpt-5.
|
|
11076
|
+
config: { model: "openai/gpt-5.6-terra", variant: "xhigh" },
|
|
11000
11077
|
description: "Goal-oriented autonomous problem-solving on hairy problems requiring deep research. ONE goal + ONE deliverable per call \u2014 multiple goals must fan out as parallel `deep` calls, never bundled into one.",
|
|
11001
11078
|
promptAppend: DEEP_CATEGORY_PROMPT_APPEND,
|
|
11002
11079
|
resolvePromptAppend: resolveDeepCategoryPromptAppend
|
|
@@ -11006,6 +11083,12 @@ var init_openai_categories = __esm(() => {
|
|
|
11006
11083
|
config: { model: "openai/gpt-5.4-mini" },
|
|
11007
11084
|
description: "Trivial tasks - single file changes, typo fixes, simple modifications",
|
|
11008
11085
|
promptAppend: QUICK_CATEGORY_PROMPT_APPEND
|
|
11086
|
+
},
|
|
11087
|
+
{
|
|
11088
|
+
name: "unspecified-low",
|
|
11089
|
+
config: { model: "openai/gpt-5.6-luna", variant: "xhigh" },
|
|
11090
|
+
description: "Tasks that don't fit other categories, low effort required",
|
|
11091
|
+
promptAppend: UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND
|
|
11009
11092
|
}
|
|
11010
11093
|
];
|
|
11011
11094
|
});
|
|
@@ -64593,6 +64676,66 @@ async function probe(registration) {
|
|
|
64593
64676
|
return false;
|
|
64594
64677
|
}
|
|
64595
64678
|
}
|
|
64679
|
+
async function probeSessionAffinity(registration, sessionID) {
|
|
64680
|
+
if (!registration.serverUrl) {
|
|
64681
|
+
return;
|
|
64682
|
+
}
|
|
64683
|
+
const probeUrl = new URL(`/session/${sessionID}`, registration.serverUrl);
|
|
64684
|
+
const authHeader = getServerBasicAuthHeader();
|
|
64685
|
+
const headers = authHeader ? { Authorization: authHeader } : {};
|
|
64686
|
+
try {
|
|
64687
|
+
const controller = new AbortController;
|
|
64688
|
+
const timeoutId = setTimeout(() => controller.abort(), PROBE_ABORT_MS);
|
|
64689
|
+
let response;
|
|
64690
|
+
try {
|
|
64691
|
+
response = await getFetch()(probeUrl, { headers, signal: controller.signal });
|
|
64692
|
+
} finally {
|
|
64693
|
+
clearTimeout(timeoutId);
|
|
64694
|
+
}
|
|
64695
|
+
if (response.ok) {
|
|
64696
|
+
setSessionAffinity(registration, sessionID, true);
|
|
64697
|
+
return true;
|
|
64698
|
+
}
|
|
64699
|
+
if (response.status === 404) {
|
|
64700
|
+
setSessionAffinity(registration, sessionID, false);
|
|
64701
|
+
log2("[live-server-route] live listener does not own session; falling back to in-process client", { sessionID });
|
|
64702
|
+
return false;
|
|
64703
|
+
}
|
|
64704
|
+
return;
|
|
64705
|
+
} catch {
|
|
64706
|
+
return;
|
|
64707
|
+
}
|
|
64708
|
+
}
|
|
64709
|
+
function setSessionAffinity(registration, sessionID, owned) {
|
|
64710
|
+
const now = Date.now();
|
|
64711
|
+
for (const [key, entry] of registration.sessionAffinity) {
|
|
64712
|
+
if (now - entry.timestamp >= AFFINITY_TTL_MS) {
|
|
64713
|
+
registration.sessionAffinity.delete(key);
|
|
64714
|
+
}
|
|
64715
|
+
}
|
|
64716
|
+
registration.sessionAffinity.set(sessionID, { owned, timestamp: now });
|
|
64717
|
+
}
|
|
64718
|
+
function getFreshSessionAffinity(registration, sessionID) {
|
|
64719
|
+
const entry = registration.sessionAffinity.get(sessionID);
|
|
64720
|
+
if (!entry || Date.now() - entry.timestamp >= AFFINITY_TTL_MS) {
|
|
64721
|
+
return;
|
|
64722
|
+
}
|
|
64723
|
+
return entry.owned;
|
|
64724
|
+
}
|
|
64725
|
+
async function resolveSessionAffinity(registration, sessionID) {
|
|
64726
|
+
const cached = getFreshSessionAffinity(registration, sessionID);
|
|
64727
|
+
if (cached !== undefined) {
|
|
64728
|
+
return cached;
|
|
64729
|
+
}
|
|
64730
|
+
let inFlight = registration.inFlightAffinity.get(sessionID);
|
|
64731
|
+
if (!inFlight) {
|
|
64732
|
+
inFlight = probeSessionAffinity(registration, sessionID).finally(() => {
|
|
64733
|
+
registration.inFlightAffinity.delete(sessionID);
|
|
64734
|
+
});
|
|
64735
|
+
registration.inFlightAffinity.set(sessionID, inFlight);
|
|
64736
|
+
}
|
|
64737
|
+
return inFlight;
|
|
64738
|
+
}
|
|
64596
64739
|
function getFreshProbeAvailability(registration) {
|
|
64597
64740
|
const available = registration.available;
|
|
64598
64741
|
if (available === undefined || Date.now() - registration.probeTimestamp >= PROBE_TTL_MS) {
|
|
@@ -64645,6 +64788,13 @@ function tryResolveDispatchClientSync2(client3, sessionID) {
|
|
|
64645
64788
|
if (!freshAvailability) {
|
|
64646
64789
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
64647
64790
|
}
|
|
64791
|
+
const cachedAffinity = getFreshSessionAffinity(registration, sessionID);
|
|
64792
|
+
if (cachedAffinity === undefined) {
|
|
64793
|
+
return;
|
|
64794
|
+
}
|
|
64795
|
+
if (!cachedAffinity) {
|
|
64796
|
+
return { client: client3, route: "in-process", reason: "affinity" };
|
|
64797
|
+
}
|
|
64648
64798
|
const resolvedLiveClient = getOrBuildLiveClient(registration);
|
|
64649
64799
|
if (!resolvedLiveClient) {
|
|
64650
64800
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
@@ -64664,6 +64814,10 @@ async function resolveDispatchClient2(client3, sessionID) {
|
|
|
64664
64814
|
if (!isAvailable) {
|
|
64665
64815
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
64666
64816
|
}
|
|
64817
|
+
const affinity = await resolveSessionAffinity(registration, sessionID);
|
|
64818
|
+
if (affinity === false) {
|
|
64819
|
+
return { client: client3, route: "in-process", reason: "affinity" };
|
|
64820
|
+
}
|
|
64667
64821
|
const resolvedLiveClient = getOrBuildLiveClient(registration);
|
|
64668
64822
|
if (!resolvedLiveClient) {
|
|
64669
64823
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
@@ -64701,10 +64855,11 @@ function markLiveRouteUnavailable2(reason) {
|
|
|
64701
64855
|
for (const registration of registrations.values()) {
|
|
64702
64856
|
registration.available = false;
|
|
64703
64857
|
registration.probeTimestamp = Date.now();
|
|
64858
|
+
registration.sessionAffinity.clear();
|
|
64704
64859
|
}
|
|
64705
64860
|
log2(`[live-server-route] marked unavailable: ${reason}`);
|
|
64706
64861
|
}
|
|
64707
|
-
var PROBE_TTL_MS = 60000, PROBE_ABORT_MS = 1500, registrations, liveParentWakeRoutingDisabled = false, fetchImplementationForTesting;
|
|
64862
|
+
var PROBE_TTL_MS = 60000, PROBE_ABORT_MS = 1500, AFFINITY_TTL_MS = 60000, registrations, liveParentWakeRoutingDisabled = false, fetchImplementationForTesting;
|
|
64708
64863
|
var init_live_server_route = __esm(() => {
|
|
64709
64864
|
init_dist();
|
|
64710
64865
|
init_state();
|
|
@@ -66633,21 +66788,21 @@ var init_config_manager = __esm(() => {
|
|
|
66633
66788
|
});
|
|
66634
66789
|
|
|
66635
66790
|
// packages/telemetry-core/src/activity-state.ts
|
|
66636
|
-
import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as
|
|
66637
|
-
import { basename as basename10, join as
|
|
66791
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as readFileSync14 } from "fs";
|
|
66792
|
+
import { basename as basename10, join as join53 } from "path";
|
|
66638
66793
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
66639
66794
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
66640
66795
|
env: options.env,
|
|
66641
66796
|
osProvider: options.osProvider
|
|
66642
66797
|
});
|
|
66643
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
66798
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join53(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
66644
66799
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename10(dataDir) === product.cacheDirName) {
|
|
66645
66800
|
return dataDir;
|
|
66646
66801
|
}
|
|
66647
|
-
return
|
|
66802
|
+
return join53(dataDir, product.cacheDirName);
|
|
66648
66803
|
}
|
|
66649
66804
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
66650
|
-
return
|
|
66805
|
+
return join53(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
66651
66806
|
}
|
|
66652
66807
|
function getDailyActiveCaptureState(input) {
|
|
66653
66808
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -66676,7 +66831,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
66676
66831
|
return {};
|
|
66677
66832
|
}
|
|
66678
66833
|
try {
|
|
66679
|
-
const stateContent =
|
|
66834
|
+
const stateContent = readFileSync14(stateFilePath, "utf-8");
|
|
66680
66835
|
const stateJson = JSON.parse(stateContent);
|
|
66681
66836
|
if (!isPostHogActivityState(stateJson)) {
|
|
66682
66837
|
return {};
|
|
@@ -66717,10 +66872,10 @@ var init_activity_state = __esm(() => {
|
|
|
66717
66872
|
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74";
|
|
66718
66873
|
|
|
66719
66874
|
// packages/telemetry-core/src/diagnostics.ts
|
|
66720
|
-
import { appendFileSync as appendFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync9, readFileSync as
|
|
66721
|
-
import { join as
|
|
66875
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync9, readFileSync as readFileSync15 } from "fs";
|
|
66876
|
+
import { join as join54 } from "path";
|
|
66722
66877
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
66723
|
-
return
|
|
66878
|
+
return join54(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
66724
66879
|
}
|
|
66725
66880
|
function writeTelemetryDiagnostic(input, options) {
|
|
66726
66881
|
const now = options.now ?? new Date;
|
|
@@ -66743,7 +66898,7 @@ function cleanupTelemetryDiagnostics(options) {
|
|
|
66743
66898
|
}
|
|
66744
66899
|
try {
|
|
66745
66900
|
const cutoffMs = (options.now ?? new Date).getTime() - DIAGNOSTICS_RETENTION_MS;
|
|
66746
|
-
const retainedLines = trimToMaxBytes(
|
|
66901
|
+
const retainedLines = trimToMaxBytes(readFileSync15(diagnosticsFilePath, "utf-8").split(`
|
|
66747
66902
|
`).filter((line) => shouldRetainLine(line, cutoffMs)));
|
|
66748
66903
|
writeFileAtomically(diagnosticsFilePath, retainedLines.length === 0 ? "" : `${retainedLines.join(`
|
|
66749
66904
|
`)}
|
|
@@ -66795,7 +66950,7 @@ function shouldRetainLine(line, cutoffMs) {
|
|
|
66795
66950
|
function parseDiagnosticLine(line) {
|
|
66796
66951
|
try {
|
|
66797
66952
|
const parsed = JSON.parse(line);
|
|
66798
|
-
if (!
|
|
66953
|
+
if (!isRecord5(parsed)) {
|
|
66799
66954
|
return null;
|
|
66800
66955
|
}
|
|
66801
66956
|
return parsed;
|
|
@@ -66806,7 +66961,7 @@ function parseDiagnosticLine(line) {
|
|
|
66806
66961
|
throw error;
|
|
66807
66962
|
}
|
|
66808
66963
|
}
|
|
66809
|
-
function
|
|
66964
|
+
function isRecord5(value) {
|
|
66810
66965
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
66811
66966
|
}
|
|
66812
66967
|
function trimToMaxBytes(lines) {
|
|
@@ -66886,7 +67041,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
66886
67041
|
var init_machine_id = () => {};
|
|
66887
67042
|
|
|
66888
67043
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
66889
|
-
import { dirname as
|
|
67044
|
+
import { dirname as dirname18, posix as posix2, sep as sep7 } from "path";
|
|
66890
67045
|
function createModulerModifier() {
|
|
66891
67046
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
66892
67047
|
return async (frames) => {
|
|
@@ -66895,7 +67050,7 @@ function createModulerModifier() {
|
|
|
66895
67050
|
return frames;
|
|
66896
67051
|
};
|
|
66897
67052
|
}
|
|
66898
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
67053
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname18(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
66899
67054
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
66900
67055
|
return (filename) => {
|
|
66901
67056
|
if (!filename)
|
|
@@ -69916,7 +70071,7 @@ var init_context_lines_node = __esm(() => {
|
|
|
69916
70071
|
});
|
|
69917
70072
|
|
|
69918
70073
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
|
|
69919
|
-
import { isAbsolute as
|
|
70074
|
+
import { isAbsolute as isAbsolute9, relative as relative5, sep as sep8 } from "path";
|
|
69920
70075
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
69921
70076
|
const isWindows = sep8 === "\\";
|
|
69922
70077
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
@@ -69924,7 +70079,7 @@ function createRelativePathModifier(basePath = process.cwd()) {
|
|
|
69924
70079
|
return async (frames) => {
|
|
69925
70080
|
for (const frame of frames)
|
|
69926
70081
|
if (!(!frame.filename || frame.filename.startsWith("node:") || frame.filename.startsWith("data:"))) {
|
|
69927
|
-
if (
|
|
70082
|
+
if (isAbsolute9(frame.filename))
|
|
69928
70083
|
frame.filename = toUnix(relative5(normalizedBase, toUnix(frame.filename)));
|
|
69929
70084
|
}
|
|
69930
70085
|
return frames;
|
|
@@ -72441,7 +72596,7 @@ var package_default2;
|
|
|
72441
72596
|
var init_package2 = __esm(() => {
|
|
72442
72597
|
package_default2 = {
|
|
72443
72598
|
name: "@oh-my-opencode/omo-codex",
|
|
72444
|
-
version: "4.16.
|
|
72599
|
+
version: "4.16.3",
|
|
72445
72600
|
type: "module",
|
|
72446
72601
|
private: true,
|
|
72447
72602
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -73411,19 +73566,19 @@ var init_update_toasts = __esm(() => {
|
|
|
73411
73566
|
|
|
73412
73567
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
73413
73568
|
import { existsSync as existsSync49 } from "fs";
|
|
73414
|
-
import { dirname as
|
|
73569
|
+
import { dirname as dirname28, join as join72 } from "path";
|
|
73415
73570
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
73416
73571
|
function defaultGetModuleHostingWorkspace() {
|
|
73417
73572
|
try {
|
|
73418
|
-
const currentDir =
|
|
73573
|
+
const currentDir = dirname28(fileURLToPath5(import.meta.url));
|
|
73419
73574
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
73420
73575
|
if (!pkgJsonPath)
|
|
73421
73576
|
return null;
|
|
73422
|
-
const pkgDir =
|
|
73423
|
-
const nodeModulesDir =
|
|
73577
|
+
const pkgDir = dirname28(pkgJsonPath);
|
|
73578
|
+
const nodeModulesDir = dirname28(pkgDir);
|
|
73424
73579
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
73425
73580
|
return null;
|
|
73426
|
-
return
|
|
73581
|
+
return dirname28(nodeModulesDir);
|
|
73427
73582
|
} catch (error51) {
|
|
73428
73583
|
if (error51 instanceof Error) {
|
|
73429
73584
|
return null;
|
|
@@ -73565,7 +73720,7 @@ var init_background_update_check = __esm(() => {
|
|
|
73565
73720
|
init_update_toasts();
|
|
73566
73721
|
defaultDeps4 = {
|
|
73567
73722
|
existsSync: existsSync49,
|
|
73568
|
-
join:
|
|
73723
|
+
join: join72,
|
|
73569
73724
|
runBunInstallWithDetails,
|
|
73570
73725
|
log: log2,
|
|
73571
73726
|
getOpenCodeCacheDir,
|
|
@@ -74174,7 +74329,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
74174
74329
|
}
|
|
74175
74330
|
|
|
74176
74331
|
// packages/omo-codex/src/install/install-codex.ts
|
|
74177
|
-
import { join as
|
|
74332
|
+
import { join as join55, resolve as resolve15 } from "path";
|
|
74178
74333
|
import { existsSync as existsSync30 } from "fs";
|
|
74179
74334
|
import { homedir as homedir6 } from "os";
|
|
74180
74335
|
|
|
@@ -75258,7 +75413,12 @@ function shouldCopyPluginPath(path7, root) {
|
|
|
75258
75413
|
if (relative5 === "")
|
|
75259
75414
|
return true;
|
|
75260
75415
|
const parts = relative5.split(sep5);
|
|
75261
|
-
|
|
75416
|
+
if (parts.some((part) => part === ".git" || part === "node_modules"))
|
|
75417
|
+
return false;
|
|
75418
|
+
return !isNestedComponentMcpManifest(parts);
|
|
75419
|
+
}
|
|
75420
|
+
function isNestedComponentMcpManifest(parts) {
|
|
75421
|
+
return parts.length > 1 && parts.at(-1) === ".mcp.json";
|
|
75262
75422
|
}
|
|
75263
75423
|
var removedSparkshellReferencePattern = /\b(?:sparkshell|spark[-_\s]+shell)\b/i;
|
|
75264
75424
|
var removedSparkshellPromptSurfaceDirs = new Set([".codex-plugin", "agents", "bundled-rules", "hooks", "skills"]);
|
|
@@ -75464,7 +75624,7 @@ async function shouldBuildSourcePackages(repoRoot) {
|
|
|
75464
75624
|
|
|
75465
75625
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
75466
75626
|
import { mkdir as mkdir5, readFile as readFile11 } from "fs/promises";
|
|
75467
|
-
import { dirname as
|
|
75627
|
+
import { dirname as dirname16 } from "path";
|
|
75468
75628
|
|
|
75469
75629
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
75470
75630
|
function findTomlSection(config, header) {
|
|
@@ -75785,6 +75945,9 @@ function stripTomlLineComment(line) {
|
|
|
75785
75945
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE = ["codex-ultrawork-reviewer"];
|
|
75786
75946
|
var CURRENT_MANAGED_CODEX_AGENT_NAMES = [
|
|
75787
75947
|
"explorer",
|
|
75948
|
+
"lazycodex-worker-high",
|
|
75949
|
+
"lazycodex-worker-low",
|
|
75950
|
+
"lazycodex-worker-medium",
|
|
75788
75951
|
"librarian",
|
|
75789
75952
|
"metis",
|
|
75790
75953
|
"momus",
|
|
@@ -76202,12 +76365,18 @@ import { readFile as readFile10 } from "fs/promises";
|
|
|
76202
76365
|
import { join as join38 } from "path";
|
|
76203
76366
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
76204
76367
|
current: {
|
|
76205
|
-
model: "gpt-5.
|
|
76206
|
-
modelContextWindow:
|
|
76368
|
+
model: "gpt-5.6-sol",
|
|
76369
|
+
modelContextWindow: 372000,
|
|
76207
76370
|
modelReasoningEffort: "high",
|
|
76208
76371
|
planModeReasoningEffort: "xhigh"
|
|
76209
76372
|
},
|
|
76210
76373
|
managedProfiles: [
|
|
76374
|
+
{
|
|
76375
|
+
model: "gpt-5.5",
|
|
76376
|
+
modelContextWindow: 400000,
|
|
76377
|
+
modelReasoningEffort: "high",
|
|
76378
|
+
planModeReasoningEffort: "xhigh"
|
|
76379
|
+
},
|
|
76211
76380
|
{
|
|
76212
76381
|
model: "gpt-5.5",
|
|
76213
76382
|
modelContextWindow: 1e6,
|
|
@@ -76301,30 +76470,87 @@ function isRootSetting2(line, key) {
|
|
|
76301
76470
|
}
|
|
76302
76471
|
|
|
76303
76472
|
// packages/omo-codex/src/install/codex-multi-agent-v2-config.ts
|
|
76473
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
76474
|
+
import { dirname as dirname15, isAbsolute as isAbsolute8, join as join39 } from "path";
|
|
76304
76475
|
var CODEX_AGENTS_HEADER = "agents";
|
|
76305
76476
|
var CODEX_MULTI_AGENT_V2_HEADER = "features.multi_agent_v2";
|
|
76306
76477
|
var CODEX_SUBAGENT_THREAD_LIMIT = 1000;
|
|
76307
|
-
function ensureCodexMultiAgentV2Config(config) {
|
|
76478
|
+
function ensureCodexMultiAgentV2Config(config, options = {}) {
|
|
76308
76479
|
const featureFlag = removeFeatureFlagSetting(config, "multi_agent_v2");
|
|
76309
|
-
const
|
|
76310
|
-
const
|
|
76480
|
+
const v2Preferred = options.multiAgentVersion === "v2";
|
|
76481
|
+
const modelKnown = options.multiAgentVersion != null || readRootModel(featureFlag.config) !== null;
|
|
76482
|
+
const agentsConfig = v2Preferred ? removeAgentsMaxThreads(featureFlag.config) : modelKnown ? ensureAgentsMaxThreads(featureFlag.config) : raiseExistingAgentsMaxThreads(featureFlag.config);
|
|
76311
76483
|
const maxThreadsValue = CODEX_SUBAGENT_THREAD_LIMIT.toString();
|
|
76484
|
+
const preserveDisable = featureFlag.value === false && !v2Preferred;
|
|
76485
|
+
const featureConfig = preserveDisable ? setMultiAgentV2Disable(agentsConfig) : v2Preferred ? removeMultiAgentV2Disable(agentsConfig) : agentsConfig;
|
|
76486
|
+
const section = findTomlSection(featureConfig, CODEX_MULTI_AGENT_V2_HEADER);
|
|
76312
76487
|
if (!section) {
|
|
76313
|
-
const enabledSetting =
|
|
76488
|
+
const enabledSetting = preserveDisable ? `enabled = false
|
|
76314
76489
|
` : "";
|
|
76315
|
-
return appendBlock(
|
|
76490
|
+
return appendBlock(featureConfig, `[${CODEX_MULTI_AGENT_V2_HEADER}]
|
|
76316
76491
|
${enabledSetting}max_concurrent_threads_per_session = ${maxThreadsValue}
|
|
76317
76492
|
`);
|
|
76318
76493
|
}
|
|
76319
|
-
|
|
76320
|
-
|
|
76321
|
-
|
|
76322
|
-
|
|
76323
|
-
|
|
76324
|
-
|
|
76325
|
-
|
|
76494
|
+
return replaceOrInsertSetting(featureConfig, section, "max_concurrent_threads_per_session", maxThreadsValue);
|
|
76495
|
+
}
|
|
76496
|
+
function resolveCodexMultiAgentVersion(config, configPath) {
|
|
76497
|
+
const model = readRootModel(config);
|
|
76498
|
+
if (model === null)
|
|
76499
|
+
return null;
|
|
76500
|
+
const catalogPath = resolveCatalogPath(readRootModelCatalogPath(config), configPath);
|
|
76501
|
+
const catalogVersion = readCatalogMultiAgentVersion(model, catalogPath);
|
|
76502
|
+
if (catalogVersion !== null)
|
|
76503
|
+
return catalogVersion;
|
|
76504
|
+
return /^gpt-5\.6\b/i.test(model) ? "v2" : null;
|
|
76505
|
+
}
|
|
76506
|
+
function resolveCatalogPath(configuredPath, configPath) {
|
|
76507
|
+
if (configuredPath === null)
|
|
76508
|
+
return join39(dirname15(configPath), "models_cache.json");
|
|
76509
|
+
return isAbsolute8(configuredPath) ? configuredPath : join39(dirname15(configPath), configuredPath);
|
|
76510
|
+
}
|
|
76511
|
+
function readCatalogMultiAgentVersion(model, cachePath) {
|
|
76512
|
+
let raw;
|
|
76513
|
+
try {
|
|
76514
|
+
raw = readFileSync13(cachePath, "utf8");
|
|
76515
|
+
} catch {
|
|
76516
|
+
return null;
|
|
76326
76517
|
}
|
|
76327
|
-
|
|
76518
|
+
let cache;
|
|
76519
|
+
try {
|
|
76520
|
+
cache = JSON.parse(raw);
|
|
76521
|
+
} catch {
|
|
76522
|
+
return null;
|
|
76523
|
+
}
|
|
76524
|
+
if (!isRecord4(cache) || !Array.isArray(cache.models))
|
|
76525
|
+
return null;
|
|
76526
|
+
for (const entry of cache.models) {
|
|
76527
|
+
if (!isRecord4(entry))
|
|
76528
|
+
continue;
|
|
76529
|
+
if (entry.slug !== model && entry.id !== model)
|
|
76530
|
+
continue;
|
|
76531
|
+
const version = entry.multi_agent_version;
|
|
76532
|
+
if (version === "v1" || version === "v2")
|
|
76533
|
+
return version;
|
|
76534
|
+
return null;
|
|
76535
|
+
}
|
|
76536
|
+
return null;
|
|
76537
|
+
}
|
|
76538
|
+
function readRootModel(config) {
|
|
76539
|
+
const double = config.match(/^\s*model\s*=\s*"([^"]+)"/m);
|
|
76540
|
+
if (double !== null)
|
|
76541
|
+
return double[1] ?? null;
|
|
76542
|
+
const single = config.match(/^\s*model\s*=\s*'([^']+)'/m);
|
|
76543
|
+
return single?.[1] ?? null;
|
|
76544
|
+
}
|
|
76545
|
+
function readRootModelCatalogPath(config) {
|
|
76546
|
+
const double = config.match(/^\s*model_catalog_json\s*=\s*"([^"]+)"/m);
|
|
76547
|
+
if (double !== null)
|
|
76548
|
+
return double[1] ?? null;
|
|
76549
|
+
const single = config.match(/^\s*model_catalog_json\s*=\s*'([^']+)'/m);
|
|
76550
|
+
return single?.[1] ?? null;
|
|
76551
|
+
}
|
|
76552
|
+
function isRecord4(value) {
|
|
76553
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
76328
76554
|
}
|
|
76329
76555
|
function removeFeatureFlagSetting(config, featureName) {
|
|
76330
76556
|
const section = findTomlSection(config, "features");
|
|
@@ -76345,6 +76571,36 @@ max_threads = ${maxThreadsValue}
|
|
|
76345
76571
|
}
|
|
76346
76572
|
return replaceOrInsertSetting(config, section, "max_threads", maxThreadsValue);
|
|
76347
76573
|
}
|
|
76574
|
+
function removeAgentsMaxThreads(config) {
|
|
76575
|
+
const section = findTomlSection(config, CODEX_AGENTS_HEADER);
|
|
76576
|
+
if (!section)
|
|
76577
|
+
return config;
|
|
76578
|
+
if (!/^\s*max_threads\s*=/m.test(section.text))
|
|
76579
|
+
return config;
|
|
76580
|
+
return removeSetting(config, section, "max_threads");
|
|
76581
|
+
}
|
|
76582
|
+
function removeMultiAgentV2Disable(config) {
|
|
76583
|
+
const section = findTomlSection(config, CODEX_MULTI_AGENT_V2_HEADER);
|
|
76584
|
+
if (!section)
|
|
76585
|
+
return config;
|
|
76586
|
+
if (!/^\s*enabled\s*=\s*false(?:\s*#.*)?$/m.test(section.text))
|
|
76587
|
+
return config;
|
|
76588
|
+
return removeSetting(config, section, "enabled");
|
|
76589
|
+
}
|
|
76590
|
+
function setMultiAgentV2Disable(config) {
|
|
76591
|
+
const section = findTomlSection(config, CODEX_MULTI_AGENT_V2_HEADER);
|
|
76592
|
+
if (!section)
|
|
76593
|
+
return config;
|
|
76594
|
+
return replaceOrInsertSetting(config, section, "enabled", "false");
|
|
76595
|
+
}
|
|
76596
|
+
function raiseExistingAgentsMaxThreads(config) {
|
|
76597
|
+
const section = findTomlSection(config, CODEX_AGENTS_HEADER);
|
|
76598
|
+
if (!section)
|
|
76599
|
+
return config;
|
|
76600
|
+
if (!/^\s*max_threads\s*=/m.test(section.text))
|
|
76601
|
+
return config;
|
|
76602
|
+
return replaceOrInsertSetting(config, section, "max_threads", CODEX_SUBAGENT_THREAD_LIMIT.toString());
|
|
76603
|
+
}
|
|
76348
76604
|
function readBooleanSetting(sectionText, key) {
|
|
76349
76605
|
const match = new RegExp(`^\\s*${escapeRegExp(key)}\\s*=\\s*(true|false)\\s*(?:#.*)?$`, "m").exec(sectionText);
|
|
76350
76606
|
if (!match)
|
|
@@ -76354,7 +76610,7 @@ function readBooleanSetting(sectionText, key) {
|
|
|
76354
76610
|
|
|
76355
76611
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
76356
76612
|
async function updateCodexConfig(input) {
|
|
76357
|
-
await mkdir5(
|
|
76613
|
+
await mkdir5(dirname16(input.configPath), { recursive: true });
|
|
76358
76614
|
let config;
|
|
76359
76615
|
try {
|
|
76360
76616
|
config = await readFile11(input.configPath, "utf8");
|
|
@@ -76377,7 +76633,9 @@ async function updateCodexConfig(input) {
|
|
|
76377
76633
|
config = ensureFeatureEnabled(config, "multi_agent");
|
|
76378
76634
|
config = removeUnsupportedCodexMultiAgentModeConfig(config);
|
|
76379
76635
|
config = ensureCodexReasoningConfig(config, await readCodexModelCatalog(input.repoRoot));
|
|
76380
|
-
config = ensureCodexMultiAgentV2Config(config
|
|
76636
|
+
config = ensureCodexMultiAgentV2Config(config, {
|
|
76637
|
+
multiAgentVersion: resolveCodexMultiAgentVersion(config, input.configPath)
|
|
76638
|
+
});
|
|
76381
76639
|
if (input.autonomousPermissions === true)
|
|
76382
76640
|
config = ensureAutonomousPermissions(config);
|
|
76383
76641
|
if (!(input.preserveMarketplaceSource === true && hasMarketplaceBlock(config, input.marketplaceName))) {
|
|
@@ -76403,7 +76661,7 @@ function isMissingFileError(error) {
|
|
|
76403
76661
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
76404
76662
|
import { createHash as createHash2 } from "crypto";
|
|
76405
76663
|
import { readFile as readFile12 } from "fs/promises";
|
|
76406
|
-
import { join as
|
|
76664
|
+
import { join as join40 } from "path";
|
|
76407
76665
|
var EVENT_LABELS = new Map([
|
|
76408
76666
|
["PreToolUse", "pre_tool_use"],
|
|
76409
76667
|
["PermissionRequest", "permission_request"],
|
|
@@ -76417,7 +76675,7 @@ var EVENT_LABELS = new Map([
|
|
|
76417
76675
|
["Stop", "stop"]
|
|
76418
76676
|
]);
|
|
76419
76677
|
async function trustedHookStatesForPlugin(input) {
|
|
76420
|
-
const manifestPath =
|
|
76678
|
+
const manifestPath = join40(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
76421
76679
|
if (!await exists(manifestPath))
|
|
76422
76680
|
return [];
|
|
76423
76681
|
const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
|
|
@@ -76425,7 +76683,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
76425
76683
|
return [];
|
|
76426
76684
|
const states = [];
|
|
76427
76685
|
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
76428
|
-
const hooksPath =
|
|
76686
|
+
const hooksPath = join40(input.pluginRoot, hookPath);
|
|
76429
76687
|
if (!await exists(hooksPath))
|
|
76430
76688
|
continue;
|
|
76431
76689
|
const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
|
|
@@ -76551,207 +76809,181 @@ function toCodexResolution(resolution) {
|
|
|
76551
76809
|
}
|
|
76552
76810
|
|
|
76553
76811
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
76554
|
-
import { copyFile, lstat as
|
|
76555
|
-
import { basename as basename9, join as
|
|
76812
|
+
import { copyFile, lstat as lstat9, mkdir as mkdir6, readdir as readdir7, rm as rm8, writeFile as writeFile7 } from "fs/promises";
|
|
76813
|
+
import { basename as basename9, join as join43 } from "path";
|
|
76556
76814
|
|
|
76557
|
-
// packages/omo-codex/src/install/
|
|
76558
|
-
import { lstat as lstat7, readFile as readFile13,
|
|
76559
|
-
import { join as
|
|
76560
|
-
|
|
76561
|
-
|
|
76562
|
-
|
|
76563
|
-
|
|
76564
|
-
|
|
76565
|
-
|
|
76566
|
-
|
|
76815
|
+
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
76816
|
+
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile6 } from "fs/promises";
|
|
76817
|
+
import { join as join41 } from "path";
|
|
76818
|
+
|
|
76819
|
+
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
|
|
76820
|
+
var MANAGED_REASONING_DEFAULT_UPGRADES = new Map([
|
|
76821
|
+
[
|
|
76822
|
+
"explorer",
|
|
76823
|
+
[
|
|
76824
|
+
{
|
|
76825
|
+
previous: { model: "gpt-5.4-mini", effort: "low" },
|
|
76826
|
+
current: { model: "gpt-5.6-terra", effort: "medium" }
|
|
76827
|
+
},
|
|
76828
|
+
{
|
|
76829
|
+
previous: { model: "gpt-5.6-terra", effort: "medium" },
|
|
76830
|
+
current: { model: "gpt-5.6-luna", effort: "low" }
|
|
76831
|
+
}
|
|
76567
76832
|
]
|
|
76833
|
+
],
|
|
76834
|
+
[
|
|
76835
|
+
"librarian",
|
|
76836
|
+
[
|
|
76837
|
+
{
|
|
76838
|
+
previous: { model: "gpt-5.4-mini", effort: "low" },
|
|
76839
|
+
current: { model: "gpt-5.6-terra", effort: "medium" }
|
|
76840
|
+
},
|
|
76841
|
+
{
|
|
76842
|
+
previous: { model: "gpt-5.6-terra", effort: "medium" },
|
|
76843
|
+
current: { model: "gpt-5.6-luna", effort: "low" }
|
|
76844
|
+
}
|
|
76845
|
+
]
|
|
76846
|
+
],
|
|
76847
|
+
[
|
|
76848
|
+
"momus",
|
|
76849
|
+
[
|
|
76850
|
+
{
|
|
76851
|
+
previous: { model: "gpt-5.5", effort: "xhigh" },
|
|
76852
|
+
current: { model: "gpt-5.6-sol", effort: "ultra" }
|
|
76853
|
+
}
|
|
76854
|
+
]
|
|
76855
|
+
],
|
|
76856
|
+
[
|
|
76857
|
+
"plan",
|
|
76858
|
+
[
|
|
76859
|
+
{
|
|
76860
|
+
previous: { model: "gpt-5.6-sol", effort: "xhigh" },
|
|
76861
|
+
current: { model: "gpt-5.6-sol", effort: "max" }
|
|
76862
|
+
}
|
|
76863
|
+
]
|
|
76864
|
+
],
|
|
76865
|
+
[
|
|
76866
|
+
"lazycodex-worker-medium",
|
|
76867
|
+
[
|
|
76868
|
+
{
|
|
76869
|
+
previous: { model: "gpt-5.6-sol", effort: "high" },
|
|
76870
|
+
current: { model: "gpt-5.6-luna", effort: "max" }
|
|
76871
|
+
}
|
|
76872
|
+
]
|
|
76873
|
+
],
|
|
76874
|
+
[
|
|
76875
|
+
"lazycodex-qa-executor",
|
|
76876
|
+
[
|
|
76877
|
+
{
|
|
76878
|
+
previous: { model: "gpt-5.6-terra", effort: "medium" },
|
|
76879
|
+
current: { model: "gpt-5.6-luna", effort: "high" }
|
|
76880
|
+
}
|
|
76881
|
+
]
|
|
76882
|
+
],
|
|
76883
|
+
[
|
|
76884
|
+
"lazycodex-gate-reviewer",
|
|
76885
|
+
[
|
|
76886
|
+
{
|
|
76887
|
+
previous: { model: "gpt-5.6-sol", effort: "xhigh" },
|
|
76888
|
+
current: { model: "gpt-5.6-sol", effort: "high" }
|
|
76889
|
+
}
|
|
76890
|
+
]
|
|
76891
|
+
]
|
|
76892
|
+
]);
|
|
76893
|
+
function resolveManagedAgentReasoning(input) {
|
|
76894
|
+
const steps = MANAGED_REASONING_DEFAULT_UPGRADES.get(input.agentName);
|
|
76895
|
+
if (steps === undefined)
|
|
76896
|
+
return input.preserved.effort;
|
|
76897
|
+
const latest = steps[steps.length - 1];
|
|
76898
|
+
if (latest === undefined)
|
|
76899
|
+
return input.preserved.effort;
|
|
76900
|
+
if (input.bundledModel !== latest.current.model || input.bundledEffort !== latest.current.effort) {
|
|
76901
|
+
return input.preserved.effort;
|
|
76568
76902
|
}
|
|
76569
|
-
|
|
76570
|
-
|
|
76571
|
-
const agentsDir = join40(input.codexHome, "agents");
|
|
76572
|
-
if (!await exists2(agentsDir))
|
|
76573
|
-
return;
|
|
76574
|
-
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
76575
|
-
const agentPath = join40(agentsDir, retiredAgent.fileName);
|
|
76576
|
-
if (!await exists2(agentPath))
|
|
76577
|
-
continue;
|
|
76578
|
-
const agentStat = await lstat7(agentPath);
|
|
76579
|
-
if (agentStat.isDirectory() && !agentStat.isSymbolicLink())
|
|
76580
|
-
continue;
|
|
76581
|
-
const content = await readTextIfExists(agentPath);
|
|
76582
|
-
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
76583
|
-
continue;
|
|
76584
|
-
await rm7(agentPath, { force: true });
|
|
76585
|
-
}
|
|
76586
|
-
}
|
|
76587
|
-
function hasRequiredMarkers(content, markers) {
|
|
76588
|
-
return markers.every((marker) => content.includes(marker));
|
|
76589
|
-
}
|
|
76590
|
-
async function readTextIfExists(path7) {
|
|
76591
|
-
try {
|
|
76592
|
-
return await readFile13(path7, "utf8");
|
|
76593
|
-
} catch (error) {
|
|
76594
|
-
if (nodeErrorCode(error) === "ENOENT")
|
|
76595
|
-
return null;
|
|
76596
|
-
throw error;
|
|
76597
|
-
}
|
|
76598
|
-
}
|
|
76599
|
-
async function exists2(path7) {
|
|
76600
|
-
try {
|
|
76601
|
-
await lstat7(path7);
|
|
76602
|
-
return true;
|
|
76603
|
-
} catch (error) {
|
|
76604
|
-
if (nodeErrorCode(error) !== "ENOENT")
|
|
76605
|
-
throw error;
|
|
76606
|
-
return false;
|
|
76607
|
-
}
|
|
76608
|
-
}
|
|
76609
|
-
function nodeErrorCode(error) {
|
|
76610
|
-
if (!(error instanceof Error) || !("code" in error))
|
|
76611
|
-
return null;
|
|
76612
|
-
return typeof error.code === "string" ? error.code : null;
|
|
76903
|
+
const preservedMatchesAnyStep = steps.some((step) => input.preserved.model === step.previous.model && input.preserved.effort === step.previous.effort);
|
|
76904
|
+
return preservedMatchesAnyStep ? latest.current.effort : input.preserved.effort;
|
|
76613
76905
|
}
|
|
76614
76906
|
|
|
76615
|
-
// packages/omo-codex/src/install/
|
|
76616
|
-
var MANIFEST_FILE = ".installed-agents.json";
|
|
76907
|
+
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
76617
76908
|
async function capturePreservedAgentReasoning(input) {
|
|
76618
76909
|
const agentsDir = join41(input.codexHome, "agents");
|
|
76619
|
-
if (!await
|
|
76910
|
+
if (!await exists2(agentsDir))
|
|
76620
76911
|
return new Map;
|
|
76621
76912
|
const preserved = new Map;
|
|
76622
76913
|
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
76623
76914
|
for (const entry of agentEntries) {
|
|
76624
76915
|
if (!entry.name.endsWith(".toml"))
|
|
76625
76916
|
continue;
|
|
76626
|
-
const content = await
|
|
76917
|
+
const content = await readTextIfExists(join41(agentsDir, entry.name));
|
|
76627
76918
|
if (content === null)
|
|
76628
76919
|
continue;
|
|
76629
76920
|
const effort = extractReasoningEffort(content);
|
|
76630
|
-
if (effort !== null)
|
|
76631
|
-
preserved.set(agentNameFromToml(entry.name),
|
|
76921
|
+
if (effort !== null) {
|
|
76922
|
+
preserved.set(agentNameFromToml(entry.name), {
|
|
76923
|
+
model: extractModel(content),
|
|
76924
|
+
effort
|
|
76925
|
+
});
|
|
76926
|
+
}
|
|
76632
76927
|
}
|
|
76633
76928
|
return preserved;
|
|
76634
76929
|
}
|
|
76635
76930
|
async function capturePreservedAgentServiceTier(input) {
|
|
76636
76931
|
const agentsDir = join41(input.codexHome, "agents");
|
|
76637
|
-
if (!await
|
|
76932
|
+
if (!await exists2(agentsDir))
|
|
76638
76933
|
return new Map;
|
|
76639
76934
|
const preserved = new Map;
|
|
76640
76935
|
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
76641
76936
|
for (const entry of agentEntries) {
|
|
76642
76937
|
if (!entry.name.endsWith(".toml"))
|
|
76643
76938
|
continue;
|
|
76644
|
-
const content = await
|
|
76939
|
+
const content = await readTextIfExists(join41(agentsDir, entry.name));
|
|
76645
76940
|
if (content === null)
|
|
76646
76941
|
continue;
|
|
76647
76942
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
76648
76943
|
}
|
|
76649
76944
|
return preserved;
|
|
76650
76945
|
}
|
|
76651
|
-
async function
|
|
76652
|
-
|
|
76653
|
-
await purgeRetiredManagedAgentFiles({ codexHome: input.codexHome });
|
|
76654
|
-
if (bundledAgents.length === 0) {
|
|
76655
|
-
await writeManifest(input.pluginRoot, []);
|
|
76656
|
-
return [];
|
|
76657
|
-
}
|
|
76658
|
-
const agentsDir = join41(input.codexHome, "agents");
|
|
76659
|
-
await mkdir6(agentsDir, { recursive: true });
|
|
76660
|
-
const linked = [];
|
|
76661
|
-
for (const agentPath of bundledAgents) {
|
|
76662
|
-
const agentFileName = basename9(agentPath);
|
|
76663
|
-
const agentName = agentNameFromToml(agentFileName);
|
|
76664
|
-
const linkPath = join41(agentsDir, agentFileName);
|
|
76665
|
-
await replaceWithCopy(linkPath, agentPath);
|
|
76666
|
-
await restorePreservedReasoning({
|
|
76667
|
-
agentName,
|
|
76668
|
-
linkPath,
|
|
76669
|
-
target: agentPath,
|
|
76670
|
-
value: input.preservedReasoning?.get(agentName)
|
|
76671
|
-
});
|
|
76672
|
-
await restorePreservedServiceTier({
|
|
76673
|
-
linkPath,
|
|
76674
|
-
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
76675
|
-
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
76676
|
-
});
|
|
76677
|
-
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
76678
|
-
}
|
|
76679
|
-
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
76680
|
-
return linked;
|
|
76681
|
-
}
|
|
76682
|
-
async function restorePreservedServiceTier(input) {
|
|
76683
|
-
if (!input.preserved)
|
|
76946
|
+
async function restorePreservedReasoning(input) {
|
|
76947
|
+
if (input.value === undefined)
|
|
76684
76948
|
return;
|
|
76685
|
-
const content = await
|
|
76686
|
-
|
|
76949
|
+
const content = await readFile13(input.target, "utf8");
|
|
76950
|
+
const bundledEffort = extractReasoningEffort(content);
|
|
76951
|
+
const effort = resolveManagedAgentReasoning({
|
|
76952
|
+
agentName: input.agentName,
|
|
76953
|
+
bundledModel: extractModel(content),
|
|
76954
|
+
bundledEffort,
|
|
76955
|
+
preserved: input.value
|
|
76956
|
+
});
|
|
76957
|
+
if (bundledEffort === effort)
|
|
76687
76958
|
return;
|
|
76688
|
-
const replacement =
|
|
76959
|
+
const replacement = replaceTopLevelStringSetting(content, "model_reasoning_effort", effort, { insertIfMissing: false });
|
|
76689
76960
|
if (!replacement.replaced)
|
|
76690
76961
|
return;
|
|
76691
76962
|
await writeFile6(input.linkPath, replacement.content);
|
|
76692
76963
|
}
|
|
76693
|
-
async function
|
|
76694
|
-
|
|
76695
|
-
if (!await exists3(componentsRoot))
|
|
76696
|
-
return [];
|
|
76697
|
-
const componentEntries = await readdir6(componentsRoot, { withFileTypes: true });
|
|
76698
|
-
const agents = [];
|
|
76699
|
-
for (const entry of componentEntries) {
|
|
76700
|
-
if (!entry.isDirectory())
|
|
76701
|
-
continue;
|
|
76702
|
-
const agentsRoot = join41(componentsRoot, entry.name, "agents");
|
|
76703
|
-
if (!await exists3(agentsRoot))
|
|
76704
|
-
continue;
|
|
76705
|
-
const agentEntries = await readdir6(agentsRoot, { withFileTypes: true });
|
|
76706
|
-
for (const file2 of agentEntries) {
|
|
76707
|
-
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
76708
|
-
continue;
|
|
76709
|
-
agents.push(join41(agentsRoot, file2.name));
|
|
76710
|
-
}
|
|
76711
|
-
}
|
|
76712
|
-
agents.sort();
|
|
76713
|
-
return agents;
|
|
76714
|
-
}
|
|
76715
|
-
async function replaceWithCopy(linkPath, target) {
|
|
76716
|
-
await prepareReplacement(linkPath);
|
|
76717
|
-
await copyFile(target, linkPath);
|
|
76718
|
-
}
|
|
76719
|
-
async function prepareReplacement(linkPath) {
|
|
76720
|
-
if (!await exists3(linkPath))
|
|
76721
|
-
return;
|
|
76722
|
-
const entryStat = await lstat8(linkPath);
|
|
76723
|
-
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
76724
|
-
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
76725
|
-
}
|
|
76726
|
-
await rm8(linkPath, { force: true });
|
|
76727
|
-
}
|
|
76728
|
-
async function writeManifest(pluginRoot, agentPaths) {
|
|
76729
|
-
const manifestPath = join41(pluginRoot, MANIFEST_FILE);
|
|
76730
|
-
const payload = { agents: [...agentPaths].sort() };
|
|
76731
|
-
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
76732
|
-
`);
|
|
76733
|
-
}
|
|
76734
|
-
async function restorePreservedReasoning(input) {
|
|
76735
|
-
if (input.value === undefined)
|
|
76964
|
+
async function restorePreservedServiceTier(input) {
|
|
76965
|
+
if (!input.preserved)
|
|
76736
76966
|
return;
|
|
76737
|
-
const content = await
|
|
76738
|
-
|
|
76739
|
-
if (bundledEffort === input.value)
|
|
76967
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
76968
|
+
if (extractServiceTier(content) === input.value)
|
|
76740
76969
|
return;
|
|
76741
|
-
const replacement =
|
|
76970
|
+
const replacement = replaceTopLevelStringSetting(content, "service_tier", input.value, { insertIfMissing: true });
|
|
76742
76971
|
if (!replacement.replaced)
|
|
76743
76972
|
return;
|
|
76744
76973
|
await writeFile6(input.linkPath, replacement.content);
|
|
76745
76974
|
}
|
|
76746
|
-
async function
|
|
76975
|
+
async function readTextIfExists(path7) {
|
|
76747
76976
|
try {
|
|
76748
|
-
return await
|
|
76977
|
+
return await readFile13(path7, "utf8");
|
|
76749
76978
|
} catch (error) {
|
|
76750
|
-
if (
|
|
76979
|
+
if (nodeErrorCode(error) === "ENOENT")
|
|
76751
76980
|
return null;
|
|
76752
76981
|
throw error;
|
|
76753
76982
|
}
|
|
76754
76983
|
}
|
|
76984
|
+
function extractModel(content) {
|
|
76985
|
+
return extractTopLevelStringSetting(content, "model");
|
|
76986
|
+
}
|
|
76755
76987
|
function extractReasoningEffort(content) {
|
|
76756
76988
|
return extractTopLevelStringSetting(content, "model_reasoning_effort");
|
|
76757
76989
|
}
|
|
@@ -76771,12 +77003,6 @@ function extractTopLevelStringSetting(content, key) {
|
|
|
76771
77003
|
}
|
|
76772
77004
|
return null;
|
|
76773
77005
|
}
|
|
76774
|
-
function replaceReasoningEffort(content, value) {
|
|
76775
|
-
return replaceTopLevelStringSetting(content, "model_reasoning_effort", value, { insertIfMissing: false });
|
|
76776
|
-
}
|
|
76777
|
-
function replaceServiceTier(content, value) {
|
|
76778
|
-
return replaceTopLevelStringSetting(content, "service_tier", value, { insertIfMissing: true });
|
|
76779
|
-
}
|
|
76780
77006
|
function replaceTopLevelStringSetting(content, key, value, options) {
|
|
76781
77007
|
const lines = content.split(/\n/);
|
|
76782
77008
|
for (let index = 0;index < lines.length; index += 1) {
|
|
@@ -76836,6 +77062,64 @@ function parseJsonString(value) {
|
|
|
76836
77062
|
return null;
|
|
76837
77063
|
}
|
|
76838
77064
|
}
|
|
77065
|
+
async function exists2(path7) {
|
|
77066
|
+
try {
|
|
77067
|
+
await lstat7(path7);
|
|
77068
|
+
return true;
|
|
77069
|
+
} catch (error) {
|
|
77070
|
+
if (nodeErrorCode(error) !== "ENOENT")
|
|
77071
|
+
throw error;
|
|
77072
|
+
return false;
|
|
77073
|
+
}
|
|
77074
|
+
}
|
|
77075
|
+
function nodeErrorCode(error) {
|
|
77076
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
77077
|
+
return null;
|
|
77078
|
+
return typeof error.code === "string" ? error.code : null;
|
|
77079
|
+
}
|
|
77080
|
+
|
|
77081
|
+
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
77082
|
+
import { lstat as lstat8, readFile as readFile14, rm as rm7 } from "fs/promises";
|
|
77083
|
+
import { join as join42 } from "path";
|
|
77084
|
+
var RETIRED_MANAGED_AGENT_FILES = [
|
|
77085
|
+
{
|
|
77086
|
+
fileName: "codex-ultrawork-reviewer.toml",
|
|
77087
|
+
requiredMarkers: [
|
|
77088
|
+
'name = "codex-ultrawork-reviewer"',
|
|
77089
|
+
'description = "Strict ultrawork verification reviewer.',
|
|
77090
|
+
'developer_instructions = """You are the ultrawork verification reviewer.'
|
|
77091
|
+
]
|
|
77092
|
+
}
|
|
77093
|
+
];
|
|
77094
|
+
async function purgeRetiredManagedAgentFiles(input) {
|
|
77095
|
+
const agentsDir = join42(input.codexHome, "agents");
|
|
77096
|
+
if (!await exists3(agentsDir))
|
|
77097
|
+
return;
|
|
77098
|
+
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
77099
|
+
const agentPath = join42(agentsDir, retiredAgent.fileName);
|
|
77100
|
+
if (!await exists3(agentPath))
|
|
77101
|
+
continue;
|
|
77102
|
+
const agentStat = await lstat8(agentPath);
|
|
77103
|
+
if (agentStat.isDirectory() && !agentStat.isSymbolicLink())
|
|
77104
|
+
continue;
|
|
77105
|
+
const content = await readTextIfExists2(agentPath);
|
|
77106
|
+
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
77107
|
+
continue;
|
|
77108
|
+
await rm7(agentPath, { force: true });
|
|
77109
|
+
}
|
|
77110
|
+
}
|
|
77111
|
+
function hasRequiredMarkers(content, markers) {
|
|
77112
|
+
return markers.every((marker) => content.includes(marker));
|
|
77113
|
+
}
|
|
77114
|
+
async function readTextIfExists2(path7) {
|
|
77115
|
+
try {
|
|
77116
|
+
return await readFile14(path7, "utf8");
|
|
77117
|
+
} catch (error) {
|
|
77118
|
+
if (nodeErrorCode2(error) === "ENOENT")
|
|
77119
|
+
return null;
|
|
77120
|
+
throw error;
|
|
77121
|
+
}
|
|
77122
|
+
}
|
|
76839
77123
|
async function exists3(path7) {
|
|
76840
77124
|
try {
|
|
76841
77125
|
await lstat8(path7);
|
|
@@ -76852,12 +77136,105 @@ function nodeErrorCode2(error) {
|
|
|
76852
77136
|
return typeof error.code === "string" ? error.code : null;
|
|
76853
77137
|
}
|
|
76854
77138
|
|
|
77139
|
+
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
77140
|
+
var MANIFEST_FILE = ".installed-agents.json";
|
|
77141
|
+
async function linkCachedPluginAgents(input) {
|
|
77142
|
+
const bundledAgents = await discoverBundledAgents(input.pluginRoot);
|
|
77143
|
+
await purgeRetiredManagedAgentFiles({ codexHome: input.codexHome });
|
|
77144
|
+
if (bundledAgents.length === 0) {
|
|
77145
|
+
await writeManifest(input.pluginRoot, []);
|
|
77146
|
+
return [];
|
|
77147
|
+
}
|
|
77148
|
+
const agentsDir = join43(input.codexHome, "agents");
|
|
77149
|
+
await mkdir6(agentsDir, { recursive: true });
|
|
77150
|
+
const linked = [];
|
|
77151
|
+
for (const agentPath of bundledAgents) {
|
|
77152
|
+
const agentFileName = basename9(agentPath);
|
|
77153
|
+
const agentName = agentNameFromToml2(agentFileName);
|
|
77154
|
+
const linkPath = join43(agentsDir, agentFileName);
|
|
77155
|
+
await replaceWithCopy(linkPath, agentPath);
|
|
77156
|
+
await restorePreservedReasoning({
|
|
77157
|
+
agentName,
|
|
77158
|
+
linkPath,
|
|
77159
|
+
target: agentPath,
|
|
77160
|
+
value: input.preservedReasoning?.get(agentName)
|
|
77161
|
+
});
|
|
77162
|
+
await restorePreservedServiceTier({
|
|
77163
|
+
linkPath,
|
|
77164
|
+
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
77165
|
+
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
77166
|
+
});
|
|
77167
|
+
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
77168
|
+
}
|
|
77169
|
+
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
77170
|
+
return linked;
|
|
77171
|
+
}
|
|
77172
|
+
async function discoverBundledAgents(pluginRoot) {
|
|
77173
|
+
const componentsRoot = join43(pluginRoot, "components");
|
|
77174
|
+
if (!await exists4(componentsRoot))
|
|
77175
|
+
return [];
|
|
77176
|
+
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
77177
|
+
const agents = [];
|
|
77178
|
+
for (const entry of componentEntries) {
|
|
77179
|
+
if (!entry.isDirectory())
|
|
77180
|
+
continue;
|
|
77181
|
+
const agentsRoot = join43(componentsRoot, entry.name, "agents");
|
|
77182
|
+
if (!await exists4(agentsRoot))
|
|
77183
|
+
continue;
|
|
77184
|
+
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
77185
|
+
for (const file2 of agentEntries) {
|
|
77186
|
+
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
77187
|
+
continue;
|
|
77188
|
+
agents.push(join43(agentsRoot, file2.name));
|
|
77189
|
+
}
|
|
77190
|
+
}
|
|
77191
|
+
agents.sort();
|
|
77192
|
+
return agents;
|
|
77193
|
+
}
|
|
77194
|
+
async function replaceWithCopy(linkPath, target) {
|
|
77195
|
+
await prepareReplacement(linkPath);
|
|
77196
|
+
await copyFile(target, linkPath);
|
|
77197
|
+
}
|
|
77198
|
+
async function prepareReplacement(linkPath) {
|
|
77199
|
+
if (!await exists4(linkPath))
|
|
77200
|
+
return;
|
|
77201
|
+
const entryStat = await lstat9(linkPath);
|
|
77202
|
+
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
77203
|
+
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
77204
|
+
}
|
|
77205
|
+
await rm8(linkPath, { force: true });
|
|
77206
|
+
}
|
|
77207
|
+
async function writeManifest(pluginRoot, agentPaths) {
|
|
77208
|
+
const manifestPath = join43(pluginRoot, MANIFEST_FILE);
|
|
77209
|
+
const payload = { agents: [...agentPaths].sort() };
|
|
77210
|
+
await writeFile7(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
77211
|
+
`);
|
|
77212
|
+
}
|
|
77213
|
+
function agentNameFromToml2(fileName) {
|
|
77214
|
+
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
77215
|
+
}
|
|
77216
|
+
async function exists4(path7) {
|
|
77217
|
+
try {
|
|
77218
|
+
await lstat9(path7);
|
|
77219
|
+
return true;
|
|
77220
|
+
} catch (error) {
|
|
77221
|
+
if (nodeErrorCode3(error) !== "ENOENT")
|
|
77222
|
+
throw error;
|
|
77223
|
+
return false;
|
|
77224
|
+
}
|
|
77225
|
+
}
|
|
77226
|
+
function nodeErrorCode3(error) {
|
|
77227
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
77228
|
+
return null;
|
|
77229
|
+
return typeof error.code === "string" ? error.code : null;
|
|
77230
|
+
}
|
|
77231
|
+
|
|
76855
77232
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
76856
77233
|
import { readFile as readFile15 } from "fs/promises";
|
|
76857
|
-
import { join as
|
|
77234
|
+
import { join as join44 } from "path";
|
|
76858
77235
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
76859
77236
|
async function readMarketplace(repoRoot, options) {
|
|
76860
|
-
const marketplacePath = options?.marketplacePath ??
|
|
77237
|
+
const marketplacePath = options?.marketplacePath ?? join44(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
76861
77238
|
const raw = await readFile15(marketplacePath, "utf8");
|
|
76862
77239
|
const parsed = JSON.parse(raw);
|
|
76863
77240
|
if (!isPlainRecord3(parsed))
|
|
@@ -76876,10 +77253,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
76876
77253
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
76877
77254
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
76878
77255
|
const relativePath = sourcePath.slice(2);
|
|
76879
|
-
return
|
|
77256
|
+
return join44(repoRoot, ...relativePath.split(/[\\/]/));
|
|
76880
77257
|
}
|
|
76881
77258
|
async function readPluginManifest(pluginRoot) {
|
|
76882
|
-
const raw = await readFile15(
|
|
77259
|
+
const raw = await readFile15(join44(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
76883
77260
|
const parsed = JSON.parse(raw);
|
|
76884
77261
|
if (!isPlainRecord3(parsed))
|
|
76885
77262
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -76960,8 +77337,8 @@ function validateLocalSourcePath(path7) {
|
|
|
76960
77337
|
}
|
|
76961
77338
|
|
|
76962
77339
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
76963
|
-
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as
|
|
76964
|
-
import { join as
|
|
77340
|
+
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as writeFile8 } from "fs/promises";
|
|
77341
|
+
import { join as join45, sep as sep6 } from "path";
|
|
76965
77342
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
76966
77343
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
76967
77344
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -76974,21 +77351,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
76974
77351
|
return snapshotPlugins;
|
|
76975
77352
|
}
|
|
76976
77353
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
76977
|
-
return
|
|
77354
|
+
return join45(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
76978
77355
|
}
|
|
76979
77356
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
76980
|
-
const manifestDir =
|
|
77357
|
+
const manifestDir = join45(marketplaceRoot, ".agents", "plugins");
|
|
76981
77358
|
await mkdir7(manifestDir, { recursive: true });
|
|
76982
|
-
const tempPath =
|
|
76983
|
-
await
|
|
77359
|
+
const tempPath = join45(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
77360
|
+
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
76984
77361
|
`);
|
|
76985
|
-
await rename4(tempPath,
|
|
77362
|
+
await rename4(tempPath, join45(manifestDir, "marketplace.json"));
|
|
76986
77363
|
}
|
|
76987
77364
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
76988
|
-
const pluginsDir =
|
|
77365
|
+
const pluginsDir = join45(marketplaceRoot, "plugins");
|
|
76989
77366
|
await mkdir7(pluginsDir, { recursive: true });
|
|
76990
|
-
const targetPath =
|
|
76991
|
-
const tempPath =
|
|
77367
|
+
const targetPath = join45(pluginsDir, plugin.name);
|
|
77368
|
+
const tempPath = join45(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
76992
77369
|
await rm9(tempPath, { recursive: true, force: true });
|
|
76993
77370
|
await cp3(plugin.sourcePath, tempPath, {
|
|
76994
77371
|
recursive: true,
|
|
@@ -77009,11 +77386,11 @@ function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
|
77009
77386
|
}
|
|
77010
77387
|
|
|
77011
77388
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
77012
|
-
import { readdir as
|
|
77013
|
-
import { join as
|
|
77389
|
+
import { readdir as readdir8, readFile as readFile16, writeFile as writeFile9 } from "fs/promises";
|
|
77390
|
+
import { join as join46 } from "path";
|
|
77014
77391
|
async function readDistributionManifest(repoRoot) {
|
|
77015
77392
|
try {
|
|
77016
|
-
const parsed = JSON.parse(await readFile16(
|
|
77393
|
+
const parsed = JSON.parse(await readFile16(join46(repoRoot, "package.json"), "utf8"));
|
|
77017
77394
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
77018
77395
|
return;
|
|
77019
77396
|
return {
|
|
@@ -77033,19 +77410,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
77033
77410
|
return input.manifestVersion ?? "local";
|
|
77034
77411
|
}
|
|
77035
77412
|
async function stampLazyCodexPluginVersion(input) {
|
|
77036
|
-
const manifestPath =
|
|
77413
|
+
const manifestPath = join46(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
77037
77414
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
77038
77415
|
await stampJsonVersion(manifestPath, input.version);
|
|
77039
|
-
await stampJsonVersion(
|
|
77416
|
+
await stampJsonVersion(join46(input.pluginRoot, "package.json"), input.version);
|
|
77040
77417
|
for (const hookPath of hookPaths) {
|
|
77041
|
-
await stampHookStatusMessages(
|
|
77418
|
+
await stampHookStatusMessages(join46(input.pluginRoot, hookPath), input.version);
|
|
77042
77419
|
}
|
|
77043
77420
|
await stampComponentVersions(input);
|
|
77044
77421
|
}
|
|
77045
77422
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
77046
77423
|
if (input.distributionManifest === undefined)
|
|
77047
77424
|
return;
|
|
77048
|
-
await
|
|
77425
|
+
await writeFile9(join46(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
77049
77426
|
packageName: input.distributionManifest.name,
|
|
77050
77427
|
version: input.distributionManifest.version
|
|
77051
77428
|
}, null, "\t")}
|
|
@@ -77057,7 +77434,7 @@ async function stampJsonVersion(path7, version) {
|
|
|
77057
77434
|
if (!isPlainRecord3(parsed))
|
|
77058
77435
|
return;
|
|
77059
77436
|
parsed.version = version;
|
|
77060
|
-
await
|
|
77437
|
+
await writeFile9(path7, `${JSON.stringify(parsed, null, "\t")}
|
|
77061
77438
|
`);
|
|
77062
77439
|
} catch (error) {
|
|
77063
77440
|
if (error instanceof Error)
|
|
@@ -77091,7 +77468,7 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
77091
77468
|
if (!isPlainRecord3(parsed))
|
|
77092
77469
|
return;
|
|
77093
77470
|
stampHookGroups(parsed.hooks, version);
|
|
77094
|
-
await
|
|
77471
|
+
await writeFile9(path7, `${JSON.stringify(parsed, null, "\t")}
|
|
77095
77472
|
`);
|
|
77096
77473
|
} catch (error) {
|
|
77097
77474
|
if (error instanceof Error)
|
|
@@ -77102,16 +77479,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
77102
77479
|
async function stampComponentVersions(input) {
|
|
77103
77480
|
let entries;
|
|
77104
77481
|
try {
|
|
77105
|
-
entries = await
|
|
77482
|
+
entries = await readdir8(join46(input.pluginRoot, "components"));
|
|
77106
77483
|
} catch (error) {
|
|
77107
77484
|
if (error instanceof Error)
|
|
77108
77485
|
return;
|
|
77109
77486
|
throw error;
|
|
77110
77487
|
}
|
|
77111
77488
|
for (const entry of entries) {
|
|
77112
|
-
const componentRoot =
|
|
77113
|
-
await stampJsonVersion(
|
|
77114
|
-
await stampHookStatusMessages(
|
|
77489
|
+
const componentRoot = join46(input.pluginRoot, "components", entry);
|
|
77490
|
+
await stampJsonVersion(join46(componentRoot, "package.json"), input.version);
|
|
77491
|
+
await stampHookStatusMessages(join46(componentRoot, "hooks", "hooks.json"), input.version);
|
|
77115
77492
|
}
|
|
77116
77493
|
}
|
|
77117
77494
|
function stampHookGroups(hooks, version) {
|
|
@@ -77168,8 +77545,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
77168
77545
|
};
|
|
77169
77546
|
|
|
77170
77547
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
77171
|
-
import { copyFile as copyFile2, lstat as
|
|
77172
|
-
import { dirname as
|
|
77548
|
+
import { copyFile as copyFile2, lstat as lstat10, readFile as readFile17, writeFile as writeFile10 } from "fs/promises";
|
|
77549
|
+
import { dirname as dirname17, join as join47, resolve as resolve13 } from "path";
|
|
77173
77550
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
77174
77551
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
77175
77552
|
".codex/hooks.json",
|
|
@@ -77201,7 +77578,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
77201
77578
|
}
|
|
77202
77579
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp(input.now?.() ?? new Date)}`;
|
|
77203
77580
|
await copyFile2(configPath, backupPath);
|
|
77204
|
-
await
|
|
77581
|
+
await writeFile10(configPath, `${repair.config.trimEnd()}
|
|
77205
77582
|
`);
|
|
77206
77583
|
configs.push({
|
|
77207
77584
|
projectRoot: project.projectRoot,
|
|
@@ -77272,37 +77649,37 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
77272
77649
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
77273
77650
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
77274
77651
|
}
|
|
77275
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
77652
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join47(resolve13(codexHome), "config.toml");
|
|
77276
77653
|
let current = resolve13(startDirectory);
|
|
77277
77654
|
const configPathsFromCwd = [];
|
|
77278
77655
|
while (true) {
|
|
77279
|
-
const configPath =
|
|
77656
|
+
const configPath = join47(current, ".codex", "config.toml");
|
|
77280
77657
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
77281
77658
|
if (codexHomeConfigPath === null || resolve13(configPath) !== codexHomeConfigPath) {
|
|
77282
77659
|
configPathsFromCwd.push(configPath);
|
|
77283
77660
|
}
|
|
77284
77661
|
}
|
|
77285
|
-
if (await
|
|
77662
|
+
if (await exists5(join47(current, ".git"))) {
|
|
77286
77663
|
return configPathsFromCwd.length === 0 ? null : {
|
|
77287
77664
|
projectRoot: current,
|
|
77288
77665
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
77289
77666
|
artifactRoots: artifactRootsForConfigPaths(configPathsFromCwd)
|
|
77290
77667
|
};
|
|
77291
77668
|
}
|
|
77292
|
-
const parent =
|
|
77669
|
+
const parent = dirname17(current);
|
|
77293
77670
|
if (parent === current) {
|
|
77294
77671
|
const nearestConfigPath = configPathsFromCwd[0];
|
|
77295
77672
|
return nearestConfigPath === undefined ? null : {
|
|
77296
|
-
projectRoot:
|
|
77673
|
+
projectRoot: dirname17(dirname17(nearestConfigPath)),
|
|
77297
77674
|
configPaths: [nearestConfigPath],
|
|
77298
|
-
artifactRoots: [
|
|
77675
|
+
artifactRoots: [dirname17(dirname17(nearestConfigPath))]
|
|
77299
77676
|
};
|
|
77300
77677
|
}
|
|
77301
77678
|
current = parent;
|
|
77302
77679
|
}
|
|
77303
77680
|
}
|
|
77304
77681
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
77305
|
-
const codexDirStat = await maybeLstat(
|
|
77682
|
+
const codexDirStat = await maybeLstat(join47(directory, ".codex"));
|
|
77306
77683
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
77307
77684
|
return false;
|
|
77308
77685
|
const configStat = await maybeLstat(configPath);
|
|
@@ -77311,7 +77688,7 @@ async function isRegularProjectLocalConfig(directory, configPath) {
|
|
|
77311
77688
|
function artifactRootsForConfigPaths(configPaths) {
|
|
77312
77689
|
const roots = [];
|
|
77313
77690
|
for (const configPath of configPaths) {
|
|
77314
|
-
const root =
|
|
77691
|
+
const root = dirname17(dirname17(configPath));
|
|
77315
77692
|
if (!roots.includes(root))
|
|
77316
77693
|
roots.push(root);
|
|
77317
77694
|
}
|
|
@@ -77322,7 +77699,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
77322
77699
|
const seenPaths = new Set;
|
|
77323
77700
|
for (const projectRoot of projectRoots) {
|
|
77324
77701
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
77325
|
-
const artifactPath =
|
|
77702
|
+
const artifactPath = join47(projectRoot, relativePath);
|
|
77326
77703
|
if (seenPaths.has(artifactPath))
|
|
77327
77704
|
continue;
|
|
77328
77705
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -77356,17 +77733,17 @@ function formatBackupTimestamp(date) {
|
|
|
77356
77733
|
}
|
|
77357
77734
|
async function maybeLstat(path7) {
|
|
77358
77735
|
try {
|
|
77359
|
-
return await
|
|
77736
|
+
return await lstat10(path7);
|
|
77360
77737
|
} catch (error) {
|
|
77361
|
-
if (
|
|
77738
|
+
if (nodeErrorCode4(error) === "ENOENT")
|
|
77362
77739
|
return null;
|
|
77363
77740
|
throw error;
|
|
77364
77741
|
}
|
|
77365
77742
|
}
|
|
77366
|
-
async function
|
|
77743
|
+
async function exists5(path7) {
|
|
77367
77744
|
return await maybeLstat(path7) !== null;
|
|
77368
77745
|
}
|
|
77369
|
-
function
|
|
77746
|
+
function nodeErrorCode4(error) {
|
|
77370
77747
|
if (!(error instanceof Error) || !("code" in error))
|
|
77371
77748
|
return null;
|
|
77372
77749
|
return typeof error.code === "string" ? error.code : null;
|
|
@@ -77397,24 +77774,24 @@ function formatUnknownError(error) {
|
|
|
77397
77774
|
}
|
|
77398
77775
|
|
|
77399
77776
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
77400
|
-
import { readFile as readFile18, readdir as
|
|
77777
|
+
import { readFile as readFile18, readdir as readdir9, rm as rm10 } from "fs/promises";
|
|
77401
77778
|
import { connect } from "net";
|
|
77402
|
-
import { join as
|
|
77779
|
+
import { join as join48 } from "path";
|
|
77403
77780
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
77404
77781
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
77405
77782
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
77406
|
-
const daemonRoot =
|
|
77783
|
+
const daemonRoot = join48(codexHome, "codex-lsp", "daemon");
|
|
77407
77784
|
const reaped = [];
|
|
77408
77785
|
let entries;
|
|
77409
77786
|
try {
|
|
77410
|
-
entries = await
|
|
77787
|
+
entries = await readdir9(daemonRoot);
|
|
77411
77788
|
} catch {
|
|
77412
77789
|
return reaped;
|
|
77413
77790
|
}
|
|
77414
77791
|
for (const entry of entries) {
|
|
77415
|
-
const versionDir =
|
|
77416
|
-
const pid = await readPidFile(
|
|
77417
|
-
const socketPath = await readEndpointFile(
|
|
77792
|
+
const versionDir = join48(daemonRoot, entry);
|
|
77793
|
+
const pid = await readPidFile(join48(versionDir, "daemon.pid"));
|
|
77794
|
+
const socketPath = await readEndpointFile(join48(versionDir, "daemon.endpoint"));
|
|
77418
77795
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
77419
77796
|
reaped.push(pid);
|
|
77420
77797
|
}
|
|
@@ -77468,7 +77845,7 @@ function sendSigterm(pid) {
|
|
|
77468
77845
|
|
|
77469
77846
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
77470
77847
|
import { homedir as homedir5 } from "os";
|
|
77471
|
-
import { join as
|
|
77848
|
+
import { join as join49, resolve as resolve14 } from "path";
|
|
77472
77849
|
function resolveCodexInstallerBinDir(input) {
|
|
77473
77850
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
77474
77851
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -77477,13 +77854,13 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
77477
77854
|
const defaultCodexHome = resolve14(homeDir, ".codex");
|
|
77478
77855
|
const resolvedCodexHome = resolve14(input.codexHome);
|
|
77479
77856
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
77480
|
-
return
|
|
77857
|
+
return join49(resolvedCodexHome, "bin");
|
|
77481
77858
|
return resolve14(homeDir, ".local", "bin");
|
|
77482
77859
|
}
|
|
77483
77860
|
|
|
77484
77861
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
77485
|
-
import { readFile as readFile19, writeFile as
|
|
77486
|
-
import { join as
|
|
77862
|
+
import { readFile as readFile19, writeFile as writeFile11 } from "fs/promises";
|
|
77863
|
+
import { join as join50 } from "path";
|
|
77487
77864
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
77488
77865
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
77489
77866
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -77491,22 +77868,22 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
77491
77868
|
async function removeGitBashHooksOffWindows(input) {
|
|
77492
77869
|
if (input.platform === "win32")
|
|
77493
77870
|
return;
|
|
77494
|
-
const manifestPath =
|
|
77871
|
+
const manifestPath = join50(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
77495
77872
|
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
77496
77873
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.hooks))
|
|
77497
77874
|
return;
|
|
77498
77875
|
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
|
|
77499
77876
|
if (hooks.length === parsed.hooks.length)
|
|
77500
77877
|
return;
|
|
77501
|
-
await
|
|
77878
|
+
await writeFile11(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
|
|
77502
77879
|
`);
|
|
77503
77880
|
}
|
|
77504
77881
|
|
|
77505
77882
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
77506
|
-
import { join as
|
|
77883
|
+
import { join as join51 } from "path";
|
|
77507
77884
|
async function seedAndMigrateOmoSot(input) {
|
|
77508
77885
|
const commandEnv = { ...input.env };
|
|
77509
|
-
const scriptPath =
|
|
77886
|
+
const scriptPath = join51(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
77510
77887
|
try {
|
|
77511
77888
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
77512
77889
|
cwd: input.repoRoot,
|
|
@@ -77521,7 +77898,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
77521
77898
|
|
|
77522
77899
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
77523
77900
|
init_src();
|
|
77524
|
-
import { join as
|
|
77901
|
+
import { join as join52 } from "path";
|
|
77525
77902
|
function describeResult(result) {
|
|
77526
77903
|
if (result.kind === "succeeded")
|
|
77527
77904
|
return null;
|
|
@@ -77535,7 +77912,7 @@ async function installAstGrepForCodex(options) {
|
|
|
77535
77912
|
return;
|
|
77536
77913
|
const platform = options.platform ?? process.platform;
|
|
77537
77914
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
77538
|
-
const skillDir =
|
|
77915
|
+
const skillDir = join52(plugin.path, "skills", "ast-grep");
|
|
77539
77916
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
77540
77917
|
try {
|
|
77541
77918
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -77569,7 +77946,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77569
77946
|
const env3 = options.env ?? process.env;
|
|
77570
77947
|
const platform = options.platform ?? process.platform;
|
|
77571
77948
|
const repoRoot = resolve15(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
77572
|
-
const codexHome = resolve15(options.codexHome ?? env3.CODEX_HOME ??
|
|
77949
|
+
const codexHome = resolve15(options.codexHome ?? env3.CODEX_HOME ?? join55(homedir6(), ".codex"));
|
|
77573
77950
|
const projectDirectory = resolve15(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
77574
77951
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
77575
77952
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -77585,9 +77962,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
77585
77962
|
if (!gitBashResolution.found) {
|
|
77586
77963
|
throw new Error(gitBashResolution.installHint);
|
|
77587
77964
|
}
|
|
77588
|
-
const codexPackageRoot =
|
|
77965
|
+
const codexPackageRoot = join55(repoRoot, "packages", "omo-codex");
|
|
77589
77966
|
const marketplace = await readMarketplace(repoRoot, {
|
|
77590
|
-
marketplacePath:
|
|
77967
|
+
marketplacePath: join55(codexPackageRoot, "marketplace.json")
|
|
77591
77968
|
});
|
|
77592
77969
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
77593
77970
|
const installed = [];
|
|
@@ -77630,7 +78007,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77630
78007
|
if (runtimeLink !== null)
|
|
77631
78008
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
77632
78009
|
else
|
|
77633
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
78010
|
+
log4(`Warning: skipped the omo runtime wrapper because ${join55(repoRoot, "dist", "cli", "index.js")} is missing; omo ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
77634
78011
|
}
|
|
77635
78012
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
77636
78013
|
installed.push(plugin);
|
|
@@ -77661,7 +78038,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77661
78038
|
});
|
|
77662
78039
|
for (const link of agentLinks) {
|
|
77663
78040
|
log4(`Linked agent ${link.name} -> ${link.target}`);
|
|
77664
|
-
const agentName =
|
|
78041
|
+
const agentName = agentNameFromToml3(link.name);
|
|
77665
78042
|
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
77666
78043
|
}
|
|
77667
78044
|
}
|
|
@@ -77684,13 +78061,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
77684
78061
|
});
|
|
77685
78062
|
}
|
|
77686
78063
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
77687
|
-
const marketplaceRoot =
|
|
78064
|
+
const marketplaceRoot = join55(codexHome, "plugins", "cache", marketplace.name);
|
|
77688
78065
|
await writeCachedMarketplaceManifest({
|
|
77689
78066
|
marketplaceName: marketplace.name,
|
|
77690
78067
|
marketplaceRoot,
|
|
77691
78068
|
plugins: installed
|
|
77692
78069
|
});
|
|
77693
|
-
const configPath =
|
|
78070
|
+
const configPath = join55(codexHome, "config.toml");
|
|
77694
78071
|
await updateCodexConfig({
|
|
77695
78072
|
configPath,
|
|
77696
78073
|
repoRoot: codexPackageRoot,
|
|
@@ -77728,7 +78105,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77728
78105
|
projectCleanup
|
|
77729
78106
|
};
|
|
77730
78107
|
}
|
|
77731
|
-
function
|
|
78108
|
+
function agentNameFromToml3(fileName) {
|
|
77732
78109
|
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
77733
78110
|
}
|
|
77734
78111
|
async function agentSourceRootsForInstall(input) {
|
|
@@ -77750,7 +78127,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
77750
78127
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
77751
78128
|
if (isRepoRootWithCodexPlugin(current))
|
|
77752
78129
|
return current;
|
|
77753
|
-
for (const wrapperPackageRoot of [
|
|
78130
|
+
for (const wrapperPackageRoot of [join55(current, "node_modules", "oh-my-openagent"), join55(current, "oh-my-openagent")]) {
|
|
77754
78131
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
77755
78132
|
return wrapperPackageRoot;
|
|
77756
78133
|
}
|
|
@@ -77768,7 +78145,7 @@ function findRepoRoot(input) {
|
|
|
77768
78145
|
return findRepoRootFromImporter(input.importerDir);
|
|
77769
78146
|
}
|
|
77770
78147
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
77771
|
-
return existsSync30(
|
|
78148
|
+
return existsSync30(join55(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
77772
78149
|
}
|
|
77773
78150
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
77774
78151
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -77789,19 +78166,19 @@ async function detectCodexInstallation(input = {}) {
|
|
|
77789
78166
|
const platform = input.platform ?? process.platform;
|
|
77790
78167
|
const env3 = input.env ?? process.env;
|
|
77791
78168
|
const homeDir = input.homeDir ?? homedir7();
|
|
77792
|
-
const
|
|
78169
|
+
const exists6 = input.exists ?? existsSync31;
|
|
77793
78170
|
const which2 = input.which ?? bunWhich;
|
|
77794
78171
|
const checkedPaths = [CODEX_PATH_CHECK_LABEL];
|
|
77795
78172
|
const cliPath = nonEmptyValue2(which2("codex"));
|
|
77796
78173
|
if (cliPath !== undefined)
|
|
77797
78174
|
return { found: true, source: "cli", path: cliPath };
|
|
77798
78175
|
if (platform === "darwin") {
|
|
77799
|
-
return detectMacCodexInstallation({ homeDir, exists:
|
|
78176
|
+
return detectMacCodexInstallation({ homeDir, exists: exists6, checkedPaths });
|
|
77800
78177
|
}
|
|
77801
78178
|
if (platform === "win32") {
|
|
77802
78179
|
return detectWindowsCodexInstallation({
|
|
77803
78180
|
env: env3,
|
|
77804
|
-
exists:
|
|
78181
|
+
exists: exists6,
|
|
77805
78182
|
checkedPaths,
|
|
77806
78183
|
runCommand: input.runCommand ?? defaultRunCommand2
|
|
77807
78184
|
});
|
|
@@ -77903,17 +78280,20 @@ function defaultRunCommand2(command, args) {
|
|
|
77903
78280
|
});
|
|
77904
78281
|
}
|
|
77905
78282
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
77906
|
-
import { lstat as
|
|
78283
|
+
import { lstat as lstat12, readFile as readFile21, readdir as readdir10, rm as rm11, rmdir } from "fs/promises";
|
|
77907
78284
|
import { homedir as homedir8 } from "os";
|
|
77908
|
-
import { isAbsolute as
|
|
78285
|
+
import { isAbsolute as isAbsolute11, join as join57, relative as relative7, resolve as resolve17 } from "path";
|
|
77909
78286
|
|
|
77910
78287
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
77911
|
-
import { lstat as
|
|
77912
|
-
import { dirname as
|
|
78288
|
+
import { lstat as lstat11, mkdir as mkdir8, readFile as readFile20, writeFile as writeFile12 } from "fs/promises";
|
|
78289
|
+
import { dirname as dirname19 } from "path";
|
|
77913
78290
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
77914
78291
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
77915
78292
|
var CURRENT_MANAGED_CODEX_AGENT_NAMES2 = [
|
|
77916
78293
|
"explorer",
|
|
78294
|
+
"lazycodex-worker-high",
|
|
78295
|
+
"lazycodex-worker-low",
|
|
78296
|
+
"lazycodex-worker-medium",
|
|
77917
78297
|
"librarian",
|
|
77918
78298
|
"metis",
|
|
77919
78299
|
"momus",
|
|
@@ -77943,9 +78323,9 @@ async function cleanupCodexConfig(configPath, now) {
|
|
|
77943
78323
|
if (next === original)
|
|
77944
78324
|
return { changed: false };
|
|
77945
78325
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
77946
|
-
await mkdir8(
|
|
77947
|
-
await
|
|
77948
|
-
await
|
|
78326
|
+
await mkdir8(dirname19(configPath), { recursive: true });
|
|
78327
|
+
await writeFile12(backupPath, original);
|
|
78328
|
+
await writeFile12(configPath, `${next.trimEnd()}
|
|
77949
78329
|
`);
|
|
77950
78330
|
return { changed: true, backupPath };
|
|
77951
78331
|
}
|
|
@@ -78007,27 +78387,27 @@ function formatBackupTimestamp2(date) {
|
|
|
78007
78387
|
}
|
|
78008
78388
|
async function configExists(path7) {
|
|
78009
78389
|
try {
|
|
78010
|
-
await
|
|
78390
|
+
await lstat11(path7);
|
|
78011
78391
|
return true;
|
|
78012
78392
|
} catch (error) {
|
|
78013
|
-
if (
|
|
78393
|
+
if (nodeErrorCode5(error) === "ENOENT")
|
|
78014
78394
|
return false;
|
|
78015
78395
|
throw error;
|
|
78016
78396
|
}
|
|
78017
78397
|
}
|
|
78018
|
-
function
|
|
78398
|
+
function nodeErrorCode5(error) {
|
|
78019
78399
|
if (!(error instanceof Error) || !("code" in error))
|
|
78020
78400
|
return null;
|
|
78021
78401
|
return typeof error.code === "string" ? error.code : null;
|
|
78022
78402
|
}
|
|
78023
78403
|
|
|
78024
78404
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
78025
|
-
import { dirname as
|
|
78405
|
+
import { dirname as dirname20, isAbsolute as isAbsolute10, join as join56, relative as relative6, resolve as resolve16 } from "path";
|
|
78026
78406
|
function validateManagedCleanupTarget(input) {
|
|
78027
|
-
if (!
|
|
78407
|
+
if (!isAbsolute10(input.path))
|
|
78028
78408
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78029
78409
|
const codexHome = resolve16(input.codexHome);
|
|
78030
|
-
if (
|
|
78410
|
+
if (dirname20(codexHome) === codexHome)
|
|
78031
78411
|
return skipped(input.path, "Codex home resolves to a filesystem root");
|
|
78032
78412
|
const target = resolve16(input.path);
|
|
78033
78413
|
if (!isWithinDirectory(codexHome, target))
|
|
@@ -78035,11 +78415,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
78035
78415
|
if (target === codexHome)
|
|
78036
78416
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78037
78417
|
const exactManagedRoots = new Set([
|
|
78038
|
-
resolve16(
|
|
78039
|
-
resolve16(
|
|
78040
|
-
resolve16(
|
|
78041
|
-
resolve16(
|
|
78042
|
-
resolve16(
|
|
78418
|
+
resolve16(join56(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
78419
|
+
resolve16(join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
78420
|
+
resolve16(join56(codexHome, "runtime", "ast-grep")),
|
|
78421
|
+
resolve16(join56(codexHome, "runtime", "node")),
|
|
78422
|
+
resolve16(join56(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
78043
78423
|
]);
|
|
78044
78424
|
if (exactManagedRoots.has(target))
|
|
78045
78425
|
return null;
|
|
@@ -78049,7 +78429,7 @@ function validateManagedCleanupTarget(input) {
|
|
|
78049
78429
|
}
|
|
78050
78430
|
function isWithinDirectory(parent, child) {
|
|
78051
78431
|
const relativePath = relative6(parent, child);
|
|
78052
|
-
return relativePath === "" || !relativePath.startsWith("..") && !
|
|
78432
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute10(relativePath);
|
|
78053
78433
|
}
|
|
78054
78434
|
function isManagedBootstrapDriftPath(codexHome, target) {
|
|
78055
78435
|
const relativePath = relative6(codexHome, target);
|
|
@@ -78069,8 +78449,8 @@ function skipped(path7, reason) {
|
|
|
78069
78449
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
78070
78450
|
async function cleanupCodexLight(input = {}) {
|
|
78071
78451
|
const env3 = input.env ?? process.env;
|
|
78072
|
-
const codexHome = resolve17(input.codexHome ?? env3.CODEX_HOME ??
|
|
78073
|
-
const configPath =
|
|
78452
|
+
const codexHome = resolve17(input.codexHome ?? env3.CODEX_HOME ?? join57(homedir8(), ".codex"));
|
|
78453
|
+
const configPath = join57(codexHome, "config.toml");
|
|
78074
78454
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
78075
78455
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
78076
78456
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
@@ -78109,32 +78489,32 @@ async function cleanupCodexLight(input = {}) {
|
|
|
78109
78489
|
}
|
|
78110
78490
|
function managedGlobalStatePaths(codexHome) {
|
|
78111
78491
|
return [
|
|
78112
|
-
|
|
78113
|
-
|
|
78114
|
-
|
|
78115
|
-
|
|
78116
|
-
|
|
78492
|
+
join57(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
78493
|
+
join57(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
78494
|
+
join57(codexHome, "runtime", "ast-grep"),
|
|
78495
|
+
join57(codexHome, "runtime", "node"),
|
|
78496
|
+
join57(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
78117
78497
|
];
|
|
78118
78498
|
}
|
|
78119
78499
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
78120
78500
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
78121
78501
|
const results = [];
|
|
78122
|
-
await walkForManagedBootstrapDirs(
|
|
78502
|
+
await walkForManagedBootstrapDirs(join57(codexHome, "plugins"), 0, results);
|
|
78123
78503
|
return results;
|
|
78124
78504
|
}
|
|
78125
78505
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
78126
78506
|
if (depth > BOOTSTRAP_DATA_GLOB_MAX_DEPTH)
|
|
78127
78507
|
return;
|
|
78128
|
-
const entries = await
|
|
78508
|
+
const entries = await readdir10(directory, { withFileTypes: true }).catch(() => null);
|
|
78129
78509
|
if (entries === null)
|
|
78130
78510
|
return;
|
|
78131
78511
|
for (const entry of entries) {
|
|
78132
78512
|
if (!entry.isDirectory())
|
|
78133
78513
|
continue;
|
|
78134
|
-
const childPath =
|
|
78514
|
+
const childPath = join57(directory, entry.name);
|
|
78135
78515
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
78136
|
-
const bootstrapDir =
|
|
78137
|
-
if (await
|
|
78516
|
+
const bootstrapDir = join57(childPath, "bootstrap");
|
|
78517
|
+
if (await exists6(bootstrapDir))
|
|
78138
78518
|
results.push(bootstrapDir);
|
|
78139
78519
|
continue;
|
|
78140
78520
|
}
|
|
@@ -78157,7 +78537,7 @@ async function removeManagedPathBestEffort(path7, seams) {
|
|
|
78157
78537
|
}
|
|
78158
78538
|
async function attemptRemove(path7) {
|
|
78159
78539
|
try {
|
|
78160
|
-
if (await
|
|
78540
|
+
if (await lstat12(path7).catch(() => null) === null)
|
|
78161
78541
|
return false;
|
|
78162
78542
|
await rm11(path7, { recursive: true, force: true });
|
|
78163
78543
|
return true;
|
|
@@ -78167,7 +78547,7 @@ async function attemptRemove(path7) {
|
|
|
78167
78547
|
}
|
|
78168
78548
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
78169
78549
|
try {
|
|
78170
|
-
await rmdir(
|
|
78550
|
+
await rmdir(join57(codexHome, "runtime"));
|
|
78171
78551
|
} catch (error) {
|
|
78172
78552
|
if (isExpectedRuntimePruneFailure(error))
|
|
78173
78553
|
return;
|
|
@@ -78175,18 +78555,18 @@ async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
|
78175
78555
|
}
|
|
78176
78556
|
}
|
|
78177
78557
|
function isExpectedRuntimePruneFailure(error) {
|
|
78178
|
-
return ["ENOENT", "ENOTEMPTY", "EEXIST", "EPERM", "EBUSY", "ENOTDIR"].includes(
|
|
78558
|
+
return ["ENOENT", "ENOTEMPTY", "EEXIST", "EPERM", "EBUSY", "ENOTDIR"].includes(nodeErrorCode6(error) ?? "");
|
|
78179
78559
|
}
|
|
78180
78560
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
78181
78561
|
const manifestPaths = [
|
|
78182
|
-
|
|
78562
|
+
join57(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
78183
78563
|
];
|
|
78184
|
-
const versionRoot =
|
|
78185
|
-
if (await
|
|
78186
|
-
const entries = await
|
|
78564
|
+
const versionRoot = join57(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
78565
|
+
if (await exists6(versionRoot)) {
|
|
78566
|
+
const entries = await readdir10(versionRoot, { withFileTypes: true });
|
|
78187
78567
|
for (const entry of entries) {
|
|
78188
78568
|
if (entry.isDirectory())
|
|
78189
|
-
manifestPaths.push(
|
|
78569
|
+
manifestPaths.push(join57(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
78190
78570
|
}
|
|
78191
78571
|
}
|
|
78192
78572
|
const paths = new Set;
|
|
@@ -78201,13 +78581,13 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
78201
78581
|
return [...paths].sort();
|
|
78202
78582
|
}
|
|
78203
78583
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
78204
|
-
if (!await
|
|
78584
|
+
if (!await exists6(configPath))
|
|
78205
78585
|
return [];
|
|
78206
78586
|
const config = await readFile21(configPath, "utf8");
|
|
78207
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
78587
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join57(codexHome, "agents", `${agentName}.toml`));
|
|
78208
78588
|
}
|
|
78209
78589
|
async function readInstalledAgentManifest(manifestPath) {
|
|
78210
|
-
if (!await
|
|
78590
|
+
if (!await exists6(manifestPath))
|
|
78211
78591
|
return [];
|
|
78212
78592
|
const parsed = JSON.parse(await readFile21(manifestPath, "utf8"));
|
|
78213
78593
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.agents))
|
|
@@ -78215,7 +78595,7 @@ async function readInstalledAgentManifest(manifestPath) {
|
|
|
78215
78595
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
78216
78596
|
}
|
|
78217
78597
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
78218
|
-
const agentsDir =
|
|
78598
|
+
const agentsDir = join57(codexHome, "agents");
|
|
78219
78599
|
const removed = [];
|
|
78220
78600
|
const skipped2 = [];
|
|
78221
78601
|
for (const path7 of paths) {
|
|
@@ -78236,29 +78616,29 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
78236
78616
|
return { removed, skipped: skipped2 };
|
|
78237
78617
|
}
|
|
78238
78618
|
function isSafeManagedAgentPath(agentsDir, path7) {
|
|
78239
|
-
if (!
|
|
78619
|
+
if (!isAbsolute11(path7))
|
|
78240
78620
|
return false;
|
|
78241
78621
|
const relativePath = relative7(agentsDir, path7);
|
|
78242
|
-
if (relativePath === "" || relativePath.startsWith("..") ||
|
|
78622
|
+
if (relativePath === "" || relativePath.startsWith("..") || isAbsolute11(relativePath))
|
|
78243
78623
|
return false;
|
|
78244
78624
|
const fileName = relativePath.split(/[\\/]/).pop();
|
|
78245
78625
|
if (fileName === undefined)
|
|
78246
78626
|
return false;
|
|
78247
78627
|
return MANAGED_CODEX_AGENT_NAMES2.some((agentName) => fileName === `${agentName}.toml`);
|
|
78248
78628
|
}
|
|
78249
|
-
async function
|
|
78629
|
+
async function exists6(path7) {
|
|
78250
78630
|
return await maybeLstat2(path7) !== null;
|
|
78251
78631
|
}
|
|
78252
78632
|
async function maybeLstat2(path7) {
|
|
78253
78633
|
try {
|
|
78254
|
-
return await
|
|
78634
|
+
return await lstat12(path7);
|
|
78255
78635
|
} catch (error) {
|
|
78256
|
-
if (
|
|
78636
|
+
if (nodeErrorCode6(error) === "ENOENT")
|
|
78257
78637
|
return null;
|
|
78258
78638
|
throw error;
|
|
78259
78639
|
}
|
|
78260
78640
|
}
|
|
78261
|
-
function
|
|
78641
|
+
function nodeErrorCode6(error) {
|
|
78262
78642
|
if (!(error instanceof Error) || !("code" in error))
|
|
78263
78643
|
return null;
|
|
78264
78644
|
return typeof error.code === "string" ? error.code : null;
|
|
@@ -78268,16 +78648,16 @@ var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", ".
|
|
|
78268
78648
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
78269
78649
|
import { execFile as execFile3 } from "child_process";
|
|
78270
78650
|
import { constants as constants7, existsSync as existsSync32 } from "fs";
|
|
78271
|
-
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile22, rename as rename5, writeFile as
|
|
78651
|
+
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile22, rename as rename5, writeFile as writeFile13 } from "fs/promises";
|
|
78272
78652
|
import { homedir as homedir9 } from "os";
|
|
78273
|
-
import { dirname as
|
|
78653
|
+
import { dirname as dirname21, join as join58, resolve as resolve18 } from "path";
|
|
78274
78654
|
import { fileURLToPath } from "url";
|
|
78275
78655
|
import { promisify as promisify2 } from "util";
|
|
78276
78656
|
var execFileAsync2 = promisify2(execFile3);
|
|
78277
78657
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
78278
|
-
|
|
78279
|
-
|
|
78280
|
-
|
|
78658
|
+
join58("extensions", "omo.js"),
|
|
78659
|
+
join58("skills", "ultrawork", "SKILL.md"),
|
|
78660
|
+
join58("skills", "ulw-loop", "SKILL.md")
|
|
78281
78661
|
];
|
|
78282
78662
|
async function runSenpiInstaller(options = {}) {
|
|
78283
78663
|
const context = resolveInstallContext(options);
|
|
@@ -78301,14 +78681,14 @@ async function runSenpiInstaller(options = {}) {
|
|
|
78301
78681
|
}
|
|
78302
78682
|
function resolveInstallContext(options) {
|
|
78303
78683
|
const env3 = options.env ?? process.env;
|
|
78304
|
-
const repoRoot = resolve18(options.repoRoot ?? findRepoRoot2(
|
|
78305
|
-
const agentDir = resolve18(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ??
|
|
78306
|
-
const pluginPath = resolve18(options.pluginPath ??
|
|
78684
|
+
const repoRoot = resolve18(options.repoRoot ?? findRepoRoot2(dirname21(fileURLToPath(import.meta.url))));
|
|
78685
|
+
const agentDir = resolve18(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ?? join58(homedir9(), ".senpi", "agent"));
|
|
78686
|
+
const pluginPath = resolve18(options.pluginPath ?? join58(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
78307
78687
|
return {
|
|
78308
78688
|
env: env3,
|
|
78309
78689
|
repoRoot,
|
|
78310
78690
|
agentDir,
|
|
78311
|
-
settingsPath:
|
|
78691
|
+
settingsPath: join58(agentDir, "settings.json"),
|
|
78312
78692
|
pluginPath,
|
|
78313
78693
|
runCommand: options.runCommand ?? defaultRunCommand3
|
|
78314
78694
|
};
|
|
@@ -78317,12 +78697,12 @@ async function ensurePluginArtifacts(context) {
|
|
|
78317
78697
|
const missing = await hasMissingPluginArtifact(context.pluginPath);
|
|
78318
78698
|
if (!missing)
|
|
78319
78699
|
return;
|
|
78320
|
-
await context.runCommand("node", [
|
|
78321
|
-
await context.runCommand("node", [
|
|
78700
|
+
await context.runCommand("node", [join58(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
78701
|
+
await context.runCommand("node", [join58(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
78322
78702
|
}
|
|
78323
78703
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
78324
78704
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
78325
|
-
if (!await fileExists(
|
|
78705
|
+
if (!await fileExists(join58(pluginPath, artifact)))
|
|
78326
78706
|
return true;
|
|
78327
78707
|
}
|
|
78328
78708
|
return false;
|
|
@@ -78361,16 +78741,16 @@ function dedupePackages(packages) {
|
|
|
78361
78741
|
return [...new Set(packages)];
|
|
78362
78742
|
}
|
|
78363
78743
|
async function writeSettingsAtomically(settingsPath, settings) {
|
|
78364
|
-
await mkdir9(
|
|
78744
|
+
await mkdir9(dirname21(settingsPath), { recursive: true });
|
|
78365
78745
|
const backupPath = await nextBackupPath(settingsPath);
|
|
78366
78746
|
if (await fileExists(settingsPath)) {
|
|
78367
78747
|
await copyFile3(settingsPath, backupPath);
|
|
78368
78748
|
} else {
|
|
78369
|
-
await
|
|
78749
|
+
await writeFile13(backupPath, `{}
|
|
78370
78750
|
`, "utf8");
|
|
78371
78751
|
}
|
|
78372
78752
|
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
|
|
78373
|
-
await
|
|
78753
|
+
await writeFile13(tempPath, `${JSON.stringify(settings, null, 2)}
|
|
78374
78754
|
`, "utf8");
|
|
78375
78755
|
await rename5(tempPath, settingsPath);
|
|
78376
78756
|
return backupPath;
|
|
@@ -78390,7 +78770,7 @@ function timestampForBackup() {
|
|
|
78390
78770
|
function findRepoRoot2(importerDir) {
|
|
78391
78771
|
let current = importerDir;
|
|
78392
78772
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
78393
|
-
if (fileExistsSync(
|
|
78773
|
+
if (fileExistsSync(join58(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
78394
78774
|
return current;
|
|
78395
78775
|
current = resolve18(current, "..");
|
|
78396
78776
|
}
|
|
@@ -78449,26 +78829,26 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
78449
78829
|
init_provider_availability();
|
|
78450
78830
|
|
|
78451
78831
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
78452
|
-
import { existsSync as existsSync34, mkdirSync as mkdirSync10, readFileSync as
|
|
78453
|
-
import { join as
|
|
78832
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync10, readFileSync as readFileSync17 } from "fs";
|
|
78833
|
+
import { join as join60 } from "path";
|
|
78454
78834
|
|
|
78455
78835
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
78456
78836
|
init_shared();
|
|
78457
|
-
import { existsSync as existsSync33, readFileSync as
|
|
78458
|
-
import { join as
|
|
78837
|
+
import { existsSync as existsSync33, readFileSync as readFileSync16 } from "fs";
|
|
78838
|
+
import { join as join59 } from "path";
|
|
78459
78839
|
var TUI_SUBPATH = "tui";
|
|
78460
78840
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
78461
78841
|
function fileEntryPackageJsonPath(entry) {
|
|
78462
78842
|
let path7 = entry.slice("file:".length);
|
|
78463
78843
|
if (path7.startsWith("//"))
|
|
78464
78844
|
path7 = path7.slice(2);
|
|
78465
|
-
return
|
|
78845
|
+
return join59(path7, "package.json");
|
|
78466
78846
|
}
|
|
78467
78847
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
78468
78848
|
if (!existsSync33(pkgJsonPath))
|
|
78469
78849
|
return null;
|
|
78470
78850
|
try {
|
|
78471
|
-
const parsed = JSON.parse(
|
|
78851
|
+
const parsed = JSON.parse(readFileSync16(pkgJsonPath, "utf-8"));
|
|
78472
78852
|
if (parsed.exports === undefined)
|
|
78473
78853
|
return null;
|
|
78474
78854
|
if (typeof parsed.exports === "string")
|
|
@@ -78500,7 +78880,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
78500
78880
|
const packageName = packageNameFromServerEntry(entry);
|
|
78501
78881
|
if (packageName === null)
|
|
78502
78882
|
return null;
|
|
78503
|
-
return packageJsonExportsTui(
|
|
78883
|
+
return packageJsonExportsTui(join59(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
78504
78884
|
}
|
|
78505
78885
|
function isOurFilePluginEntry(entry) {
|
|
78506
78886
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -78509,7 +78889,7 @@ function isOurFilePluginEntry(entry) {
|
|
|
78509
78889
|
const pkgJsonPath = fileEntryPackageJsonPath(entry);
|
|
78510
78890
|
if (!existsSync33(pkgJsonPath))
|
|
78511
78891
|
return false;
|
|
78512
|
-
const parsed = JSON.parse(
|
|
78892
|
+
const parsed = JSON.parse(readFileSync16(pkgJsonPath, "utf-8"));
|
|
78513
78893
|
return typeof parsed.name === "string" && ACCEPTED_PACKAGE_NAMES.includes(parsed.name);
|
|
78514
78894
|
} catch (error) {
|
|
78515
78895
|
log2("[tui-plugin-config] Failed to inspect file plugin package", {
|
|
@@ -78547,7 +78927,7 @@ function detectServerPluginRegistration() {
|
|
|
78547
78927
|
return { registered: false, configPath: null, entry: null, packageExportsTui: null };
|
|
78548
78928
|
}
|
|
78549
78929
|
try {
|
|
78550
|
-
const parsed = parseJsonc(
|
|
78930
|
+
const parsed = parseJsonc(readFileSync16(configPath, "utf-8"));
|
|
78551
78931
|
const plugins = parsed.plugin ?? [];
|
|
78552
78932
|
const serverEntry = plugins.find(isServerPluginEntry);
|
|
78553
78933
|
return {
|
|
@@ -78565,7 +78945,7 @@ function detectServerPluginRegistration() {
|
|
|
78565
78945
|
}
|
|
78566
78946
|
}
|
|
78567
78947
|
function detectTuiPluginRegistration() {
|
|
78568
|
-
const tuiJsonPath =
|
|
78948
|
+
const tuiJsonPath = join59(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
78569
78949
|
if (!existsSync33(tuiJsonPath)) {
|
|
78570
78950
|
return {
|
|
78571
78951
|
registered: false,
|
|
@@ -78577,7 +78957,7 @@ function detectTuiPluginRegistration() {
|
|
|
78577
78957
|
};
|
|
78578
78958
|
}
|
|
78579
78959
|
try {
|
|
78580
|
-
const parsed = parseJsonc(
|
|
78960
|
+
const parsed = parseJsonc(readFileSync16(tuiJsonPath, "utf-8"));
|
|
78581
78961
|
const plugins = parsed.plugin ?? [];
|
|
78582
78962
|
return {
|
|
78583
78963
|
registered: plugins.some(isTuiPluginEntry),
|
|
@@ -78710,7 +79090,7 @@ init_shared();
|
|
|
78710
79090
|
init_write_file_atomically2();
|
|
78711
79091
|
function readConfig(path7) {
|
|
78712
79092
|
try {
|
|
78713
|
-
const parsed = parseJsonc(
|
|
79093
|
+
const parsed = parseJsonc(readFileSync17(path7, "utf-8"));
|
|
78714
79094
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
78715
79095
|
return parsed;
|
|
78716
79096
|
}
|
|
@@ -78721,10 +79101,10 @@ function readConfig(path7) {
|
|
|
78721
79101
|
return null;
|
|
78722
79102
|
}
|
|
78723
79103
|
function readServerConfig(configDir) {
|
|
78724
|
-
const jsoncPath =
|
|
79104
|
+
const jsoncPath = join60(configDir, "opencode.jsonc");
|
|
78725
79105
|
if (existsSync34(jsoncPath))
|
|
78726
79106
|
return readConfig(jsoncPath);
|
|
78727
|
-
const jsonPath =
|
|
79107
|
+
const jsonPath = join60(configDir, "opencode.json");
|
|
78728
79108
|
if (existsSync34(jsonPath))
|
|
78729
79109
|
return readConfig(jsonPath);
|
|
78730
79110
|
return null;
|
|
@@ -78766,7 +79146,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
78766
79146
|
if (!desiredEntry) {
|
|
78767
79147
|
return { changed: false, reason: "no-server-entry" };
|
|
78768
79148
|
}
|
|
78769
|
-
const tuiJsonPath =
|
|
79149
|
+
const tuiJsonPath = join60(configDir, "tui.json");
|
|
78770
79150
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
78771
79151
|
if (malformed) {
|
|
78772
79152
|
return { changed: false, reason: "malformed" };
|
|
@@ -78782,7 +79162,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
78782
79162
|
|
|
78783
79163
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
78784
79164
|
import { homedir as homedir10 } from "os";
|
|
78785
|
-
import { join as
|
|
79165
|
+
import { join as join61 } from "path";
|
|
78786
79166
|
|
|
78787
79167
|
// packages/shared-skills/index.mjs
|
|
78788
79168
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -78801,9 +79181,9 @@ function describeResult2(result) {
|
|
|
78801
79181
|
}
|
|
78802
79182
|
async function installAstGrepForOpenCode(options = {}) {
|
|
78803
79183
|
const platform = options.platform ?? process.platform;
|
|
78804
|
-
const baseDir =
|
|
79184
|
+
const baseDir = join61(options.homeDir ?? homedir10(), ".omo");
|
|
78805
79185
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
78806
|
-
const skillDir =
|
|
79186
|
+
const skillDir = join61(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
78807
79187
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
78808
79188
|
try {
|
|
78809
79189
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -96798,7 +97178,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
96798
97178
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
96799
97179
|
init_bun_which_shim();
|
|
96800
97180
|
init_spawn_with_windows_hide();
|
|
96801
|
-
import { delimiter as delimiter2, dirname as
|
|
97181
|
+
import { delimiter as delimiter2, dirname as dirname23, posix as posix4, win32 as win324 } from "path";
|
|
96802
97182
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
96803
97183
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
96804
97184
|
function getCommandCandidates(platform) {
|
|
@@ -96856,7 +97236,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
96856
97236
|
return null;
|
|
96857
97237
|
}
|
|
96858
97238
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
96859
|
-
const preferredDir =
|
|
97239
|
+
const preferredDir = dirname23(binaryPath);
|
|
96860
97240
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
96861
97241
|
return [preferredDir, ...existing].join(delimiter2);
|
|
96862
97242
|
}
|
|
@@ -97249,7 +97629,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
97249
97629
|
var NOTEPAD_DIR = "notepads";
|
|
97250
97630
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
97251
97631
|
// packages/boulder-state/src/top-level-task.ts
|
|
97252
|
-
import { existsSync as existsSync37, readFileSync as
|
|
97632
|
+
import { existsSync as existsSync37, readFileSync as readFileSync19 } from "fs";
|
|
97253
97633
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
97254
97634
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
97255
97635
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -97276,7 +97656,7 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
97276
97656
|
return null;
|
|
97277
97657
|
}
|
|
97278
97658
|
try {
|
|
97279
|
-
const content =
|
|
97659
|
+
const content = readFileSync19(planPath, "utf-8");
|
|
97280
97660
|
const lines = content.split(/\r?\n/);
|
|
97281
97661
|
let section = "other";
|
|
97282
97662
|
for (const line of lines) {
|
|
@@ -97302,12 +97682,12 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
97302
97682
|
}
|
|
97303
97683
|
// packages/boulder-state/src/storage/path.ts
|
|
97304
97684
|
import { existsSync as existsSync38 } from "fs";
|
|
97305
|
-
import { isAbsolute as
|
|
97685
|
+
import { isAbsolute as isAbsolute12, join as join63, relative as relative8, resolve as resolve19 } from "path";
|
|
97306
97686
|
function getBoulderFilePath(directory) {
|
|
97307
|
-
return
|
|
97687
|
+
return join63(directory, BOULDER_DIR, BOULDER_FILE);
|
|
97308
97688
|
}
|
|
97309
97689
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
97310
|
-
return
|
|
97690
|
+
return isAbsolute12(trackedPath) ? resolve19(trackedPath) : resolve19(baseDirectory, trackedPath);
|
|
97311
97691
|
}
|
|
97312
97692
|
function resolveBoulderPlanPath(directory, state) {
|
|
97313
97693
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -97317,7 +97697,7 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
97317
97697
|
}
|
|
97318
97698
|
const absoluteDirectory = resolve19(directory);
|
|
97319
97699
|
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
97320
|
-
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") ||
|
|
97700
|
+
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute12(relativePlanPath)) {
|
|
97321
97701
|
return absolutePlanPath;
|
|
97322
97702
|
}
|
|
97323
97703
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
@@ -97328,7 +97708,7 @@ function resolveBoulderPlanPathForWork(directory, work) {
|
|
|
97328
97708
|
return resolveBoulderPlanPath(directory, work);
|
|
97329
97709
|
}
|
|
97330
97710
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
97331
|
-
import { existsSync as existsSync39, readFileSync as
|
|
97711
|
+
import { existsSync as existsSync39, readFileSync as readFileSync20, readdirSync as readdirSync5, statSync as statSync5 } from "fs";
|
|
97332
97712
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
97333
97713
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
97334
97714
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -97341,7 +97721,7 @@ function getPlanProgress(planPath) {
|
|
|
97341
97721
|
return { total: 0, completed: 0, isComplete: false };
|
|
97342
97722
|
}
|
|
97343
97723
|
try {
|
|
97344
|
-
const content =
|
|
97724
|
+
const content = readFileSync20(planPath, "utf-8");
|
|
97345
97725
|
const lines = content.split(/\r?\n/);
|
|
97346
97726
|
const hasStructuredSections = lines.some((line) => TODO_HEADING_PATTERN2.test(line) || FINAL_VERIFICATION_HEADING_PATTERN2.test(line));
|
|
97347
97727
|
if (hasStructuredSections) {
|
|
@@ -97457,14 +97837,14 @@ function selectMirrorWork(state) {
|
|
|
97457
97837
|
return sorted[0] ?? null;
|
|
97458
97838
|
}
|
|
97459
97839
|
// packages/boulder-state/src/storage/read-state.ts
|
|
97460
|
-
import { existsSync as existsSync40, readFileSync as
|
|
97840
|
+
import { existsSync as existsSync40, readFileSync as readFileSync21 } from "fs";
|
|
97461
97841
|
function readBoulderState(directory) {
|
|
97462
97842
|
const filePath = getBoulderFilePath(directory);
|
|
97463
97843
|
if (!existsSync40(filePath)) {
|
|
97464
97844
|
return null;
|
|
97465
97845
|
}
|
|
97466
97846
|
try {
|
|
97467
|
-
const content =
|
|
97847
|
+
const content = readFileSync21(filePath, "utf-8");
|
|
97468
97848
|
const parsed = JSON.parse(content);
|
|
97469
97849
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
97470
97850
|
return null;
|
|
@@ -97530,17 +97910,17 @@ init_state();
|
|
|
97530
97910
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
97531
97911
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
97532
97912
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
97533
|
-
import { existsSync as existsSync41, mkdirSync as mkdirSync11, readFileSync as
|
|
97534
|
-
import { join as
|
|
97913
|
+
import { existsSync as existsSync41, mkdirSync as mkdirSync11, readFileSync as readFileSync22, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
97914
|
+
import { join as join64 } from "path";
|
|
97535
97915
|
function getMarkerPath(directory, sessionID) {
|
|
97536
|
-
return
|
|
97916
|
+
return join64(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
97537
97917
|
}
|
|
97538
97918
|
function readContinuationMarker(directory, sessionID) {
|
|
97539
97919
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
97540
97920
|
if (!existsSync41(markerPath))
|
|
97541
97921
|
return null;
|
|
97542
97922
|
try {
|
|
97543
|
-
const raw =
|
|
97923
|
+
const raw = readFileSync22(markerPath, "utf-8");
|
|
97544
97924
|
const parsed = JSON.parse(raw);
|
|
97545
97925
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
97546
97926
|
return null;
|
|
@@ -97605,8 +97985,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
97605
97985
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
97606
97986
|
init_shared();
|
|
97607
97987
|
init_compaction_marker();
|
|
97608
|
-
import { readFileSync as
|
|
97609
|
-
import { join as
|
|
97988
|
+
import { readFileSync as readFileSync23, readdirSync as readdirSync6 } from "fs";
|
|
97989
|
+
import { join as join65 } from "path";
|
|
97610
97990
|
var defaultSessionLastAgentDeps = {
|
|
97611
97991
|
getMessageDir,
|
|
97612
97992
|
isSqliteBackend,
|
|
@@ -97666,7 +98046,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
97666
98046
|
try {
|
|
97667
98047
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
97668
98048
|
try {
|
|
97669
|
-
const content =
|
|
98049
|
+
const content = readFileSync23(join65(messageDir, fileName), "utf-8");
|
|
97670
98050
|
const parsed = JSON.parse(content);
|
|
97671
98051
|
return {
|
|
97672
98052
|
fileName,
|
|
@@ -97709,8 +98089,8 @@ init_agent_display_names();
|
|
|
97709
98089
|
|
|
97710
98090
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
97711
98091
|
init_frontmatter2();
|
|
97712
|
-
import { existsSync as existsSync42, readFileSync as
|
|
97713
|
-
import { dirname as
|
|
98092
|
+
import { existsSync as existsSync42, readFileSync as readFileSync24, writeFileSync as writeFileSync7, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "fs";
|
|
98093
|
+
import { dirname as dirname24, join as join66 } from "path";
|
|
97714
98094
|
|
|
97715
98095
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
97716
98096
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -97719,7 +98099,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
97719
98099
|
|
|
97720
98100
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
97721
98101
|
function getStateFilePath(directory, customPath) {
|
|
97722
|
-
return customPath ?
|
|
98102
|
+
return customPath ? join66(directory, customPath) : join66(directory, DEFAULT_STATE_FILE);
|
|
97723
98103
|
}
|
|
97724
98104
|
function readState(directory, customPath) {
|
|
97725
98105
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -97727,7 +98107,7 @@ function readState(directory, customPath) {
|
|
|
97727
98107
|
return null;
|
|
97728
98108
|
}
|
|
97729
98109
|
try {
|
|
97730
|
-
const content =
|
|
98110
|
+
const content = readFileSync24(filePath, "utf-8");
|
|
97731
98111
|
const { data, body } = parseFrontmatter(content);
|
|
97732
98112
|
const active = data.active;
|
|
97733
98113
|
const iteration = data.iteration;
|
|
@@ -98802,14 +99182,14 @@ async function getLocalVersion(options = {}) {
|
|
|
98802
99182
|
}
|
|
98803
99183
|
}
|
|
98804
99184
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
98805
|
-
import { existsSync as existsSync53, readFileSync as
|
|
99185
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34 } from "fs";
|
|
98806
99186
|
|
|
98807
99187
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
98808
99188
|
init_extract_semver();
|
|
98809
99189
|
init_bun_which_shim();
|
|
98810
99190
|
import { existsSync as existsSync50, accessSync as accessSync4, constants as constants10 } from "fs";
|
|
98811
99191
|
import { homedir as homedir14 } from "os";
|
|
98812
|
-
import { join as
|
|
99192
|
+
import { join as join73 } from "path";
|
|
98813
99193
|
|
|
98814
99194
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
98815
99195
|
init_spawn_with_windows_hide();
|
|
@@ -98901,17 +99281,17 @@ function getDesktopAppPaths(platform) {
|
|
|
98901
99281
|
case "darwin":
|
|
98902
99282
|
return [
|
|
98903
99283
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
98904
|
-
|
|
99284
|
+
join73(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
98905
99285
|
];
|
|
98906
99286
|
case "win32": {
|
|
98907
99287
|
const programFiles = process.env.ProgramFiles;
|
|
98908
99288
|
const localAppData = process.env.LOCALAPPDATA;
|
|
98909
99289
|
const paths = [];
|
|
98910
99290
|
if (programFiles) {
|
|
98911
|
-
paths.push(
|
|
99291
|
+
paths.push(join73(programFiles, "OpenCode", "OpenCode.exe"));
|
|
98912
99292
|
}
|
|
98913
99293
|
if (localAppData) {
|
|
98914
|
-
paths.push(
|
|
99294
|
+
paths.push(join73(localAppData, "OpenCode", "OpenCode.exe"));
|
|
98915
99295
|
}
|
|
98916
99296
|
return paths;
|
|
98917
99297
|
}
|
|
@@ -98919,8 +99299,8 @@ function getDesktopAppPaths(platform) {
|
|
|
98919
99299
|
return [
|
|
98920
99300
|
"/usr/bin/opencode",
|
|
98921
99301
|
"/usr/lib/opencode/opencode",
|
|
98922
|
-
|
|
98923
|
-
|
|
99302
|
+
join73(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
99303
|
+
join73(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
98924
99304
|
];
|
|
98925
99305
|
default:
|
|
98926
99306
|
return [];
|
|
@@ -98952,7 +99332,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
98952
99332
|
const candidates = getCommandCandidates2(platform);
|
|
98953
99333
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
98954
99334
|
for (const command of candidates) {
|
|
98955
|
-
const fullPath =
|
|
99335
|
+
const fullPath = join73(entry, command);
|
|
98956
99336
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
98957
99337
|
return { binary: command, path: fullPath };
|
|
98958
99338
|
}
|
|
@@ -98998,7 +99378,7 @@ function compareVersions3(current, minimum) {
|
|
|
98998
99378
|
|
|
98999
99379
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
99000
99380
|
init_shared();
|
|
99001
|
-
import { existsSync as existsSync51, readFileSync as
|
|
99381
|
+
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "fs";
|
|
99002
99382
|
function detectConfigPath() {
|
|
99003
99383
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
99004
99384
|
if (existsSync51(paths.configJsonc))
|
|
@@ -99049,7 +99429,7 @@ function getPluginInfo() {
|
|
|
99049
99429
|
};
|
|
99050
99430
|
}
|
|
99051
99431
|
try {
|
|
99052
|
-
const content =
|
|
99432
|
+
const content = readFileSync32(configPath, "utf-8");
|
|
99053
99433
|
const parsedConfig = parseJsonc(content);
|
|
99054
99434
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
99055
99435
|
if (!pluginEntry) {
|
|
@@ -99091,25 +99471,25 @@ init_file_utils2();
|
|
|
99091
99471
|
init_checker();
|
|
99092
99472
|
init_auto_update_checker();
|
|
99093
99473
|
init_package_json_locator();
|
|
99094
|
-
import { existsSync as existsSync52, readFileSync as
|
|
99474
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33, readdirSync as readdirSync8 } from "fs";
|
|
99095
99475
|
import { createRequire as createRequire2 } from "module";
|
|
99096
99476
|
import { homedir as homedir15 } from "os";
|
|
99097
|
-
import { join as
|
|
99477
|
+
import { join as join74 } from "path";
|
|
99098
99478
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
99099
99479
|
init_shared();
|
|
99100
99480
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
99101
99481
|
if (platform === "darwin")
|
|
99102
|
-
return
|
|
99482
|
+
return join74(homedir15(), "Library", "Caches");
|
|
99103
99483
|
if (platform === "win32")
|
|
99104
|
-
return process.env.LOCALAPPDATA ??
|
|
99105
|
-
return
|
|
99484
|
+
return process.env.LOCALAPPDATA ?? join74(homedir15(), "AppData", "Local");
|
|
99485
|
+
return join74(homedir15(), ".cache");
|
|
99106
99486
|
}
|
|
99107
99487
|
function resolveOpenCodeCacheDir() {
|
|
99108
99488
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
99109
99489
|
if (xdgCacheHome)
|
|
99110
|
-
return
|
|
99490
|
+
return join74(xdgCacheHome, "opencode");
|
|
99111
99491
|
const fromShared = getOpenCodeCacheDir();
|
|
99112
|
-
const platformDefault =
|
|
99492
|
+
const platformDefault = join74(getPlatformDefaultCacheDir(), "opencode");
|
|
99113
99493
|
if (existsSync52(fromShared) || !existsSync52(platformDefault))
|
|
99114
99494
|
return fromShared;
|
|
99115
99495
|
return platformDefault;
|
|
@@ -99123,7 +99503,7 @@ function readPackageJson(filePath) {
|
|
|
99123
99503
|
if (!existsSync52(filePath))
|
|
99124
99504
|
return null;
|
|
99125
99505
|
try {
|
|
99126
|
-
const content =
|
|
99506
|
+
const content = readFileSync33(filePath, "utf-8");
|
|
99127
99507
|
return parseJsonc(content);
|
|
99128
99508
|
} catch (error51) {
|
|
99129
99509
|
if (!(error51 instanceof Error)) {
|
|
@@ -99141,11 +99521,11 @@ function normalizeVersion(value) {
|
|
|
99141
99521
|
function createPackageCandidates(rootDir) {
|
|
99142
99522
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
99143
99523
|
packageName,
|
|
99144
|
-
installedPackagePath:
|
|
99524
|
+
installedPackagePath: join74(rootDir, "node_modules", packageName, "package.json")
|
|
99145
99525
|
}));
|
|
99146
99526
|
}
|
|
99147
99527
|
function createTaggedInstallCandidates(rootDir) {
|
|
99148
|
-
const packagesDir =
|
|
99528
|
+
const packagesDir = join74(rootDir, "packages");
|
|
99149
99529
|
if (!existsSync52(packagesDir))
|
|
99150
99530
|
return [];
|
|
99151
99531
|
const candidates = [];
|
|
@@ -99153,14 +99533,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
99153
99533
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
99154
99534
|
if (packageName === undefined)
|
|
99155
99535
|
continue;
|
|
99156
|
-
const installDir =
|
|
99536
|
+
const installDir = join74(packagesDir, entryName);
|
|
99157
99537
|
candidates.push({
|
|
99158
99538
|
cacheDir: installDir,
|
|
99159
|
-
cachePackagePath:
|
|
99539
|
+
cachePackagePath: join74(installDir, "package.json"),
|
|
99160
99540
|
packageCandidates: [
|
|
99161
99541
|
{
|
|
99162
99542
|
packageName,
|
|
99163
|
-
installedPackagePath:
|
|
99543
|
+
installedPackagePath: join74(installDir, "node_modules", packageName, "package.json")
|
|
99164
99544
|
}
|
|
99165
99545
|
]
|
|
99166
99546
|
});
|
|
@@ -99205,13 +99585,13 @@ function getLoadedPluginVersion() {
|
|
|
99205
99585
|
const candidates = [
|
|
99206
99586
|
{
|
|
99207
99587
|
cacheDir: configDir,
|
|
99208
|
-
cachePackagePath:
|
|
99588
|
+
cachePackagePath: join74(configDir, "package.json"),
|
|
99209
99589
|
packageCandidates: createPackageCandidates(configDir)
|
|
99210
99590
|
},
|
|
99211
99591
|
...createTaggedInstallCandidates(configDir),
|
|
99212
99592
|
{
|
|
99213
99593
|
cacheDir,
|
|
99214
|
-
cachePackagePath:
|
|
99594
|
+
cachePackagePath: join74(cacheDir, "package.json"),
|
|
99215
99595
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
99216
99596
|
},
|
|
99217
99597
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -99257,7 +99637,7 @@ var defaultDeps6 = {
|
|
|
99257
99637
|
getLatestPluginVersion,
|
|
99258
99638
|
getSuggestedInstallTag,
|
|
99259
99639
|
configExists: existsSync53,
|
|
99260
|
-
readConfigFile: (path14) =>
|
|
99640
|
+
readConfigFile: (path14) => readFileSync34(path14, "utf-8"),
|
|
99261
99641
|
parseConfigContent: (content) => parseJsonc(content)
|
|
99262
99642
|
};
|
|
99263
99643
|
var BUN_POSTINSTALL_HELPER_PACKAGE_NAME = "@code-yeongyu/comment-checker";
|
|
@@ -99402,9 +99782,9 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
99402
99782
|
|
|
99403
99783
|
// packages/omo-opencode/src/config/validate.ts
|
|
99404
99784
|
init_src();
|
|
99405
|
-
import { readFileSync as
|
|
99785
|
+
import { readFileSync as readFileSync35 } from "fs";
|
|
99406
99786
|
import { homedir as homedir16 } from "os";
|
|
99407
|
-
import { dirname as
|
|
99787
|
+
import { dirname as dirname29, relative as relative9 } from "path";
|
|
99408
99788
|
init_shared();
|
|
99409
99789
|
init_plugin_identity();
|
|
99410
99790
|
function resolveHomeDirectory2() {
|
|
@@ -99428,7 +99808,7 @@ function discoverProjectLayersNearestFirst(directory) {
|
|
|
99428
99808
|
const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
|
|
99429
99809
|
return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
|
|
99430
99810
|
path: configPath,
|
|
99431
|
-
configDir:
|
|
99811
|
+
configDir: dirname29(configPath)
|
|
99432
99812
|
}));
|
|
99433
99813
|
}
|
|
99434
99814
|
function shortPath(configPath) {
|
|
@@ -99447,12 +99827,12 @@ function schemaMessages(configPath, rawConfig) {
|
|
|
99447
99827
|
}
|
|
99448
99828
|
function parseLayerConfig(configPath) {
|
|
99449
99829
|
try {
|
|
99450
|
-
const content =
|
|
99830
|
+
const content = readFileSync35(configPath, "utf-8");
|
|
99451
99831
|
const rawConfig = parseJsonc(content);
|
|
99452
99832
|
if (!isPlainRecord(rawConfig)) {
|
|
99453
99833
|
return {
|
|
99454
99834
|
path: configPath,
|
|
99455
|
-
configDir:
|
|
99835
|
+
configDir: dirname29(configPath),
|
|
99456
99836
|
config: null,
|
|
99457
99837
|
messages: [`${shortPath(configPath)}: <root>: Expected object`]
|
|
99458
99838
|
};
|
|
@@ -99460,7 +99840,7 @@ function parseLayerConfig(configPath) {
|
|
|
99460
99840
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
99461
99841
|
return {
|
|
99462
99842
|
path: configPath,
|
|
99463
|
-
configDir:
|
|
99843
|
+
configDir: dirname29(configPath),
|
|
99464
99844
|
config: result.success ? result.data : parseConfigPartially(rawConfig),
|
|
99465
99845
|
messages: schemaMessages(configPath, rawConfig)
|
|
99466
99846
|
};
|
|
@@ -99470,7 +99850,7 @@ function parseLayerConfig(configPath) {
|
|
|
99470
99850
|
}
|
|
99471
99851
|
return {
|
|
99472
99852
|
path: configPath,
|
|
99473
|
-
configDir:
|
|
99853
|
+
configDir: dirname29(configPath),
|
|
99474
99854
|
config: null,
|
|
99475
99855
|
messages: [`${shortPath(configPath)}: ${error51.message}`]
|
|
99476
99856
|
};
|
|
@@ -99516,26 +99896,26 @@ function validatePluginConfig(directory) {
|
|
|
99516
99896
|
|
|
99517
99897
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
99518
99898
|
init_shared();
|
|
99519
|
-
import { existsSync as existsSync54, readFileSync as
|
|
99899
|
+
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "fs";
|
|
99520
99900
|
import { homedir as homedir17 } from "os";
|
|
99521
|
-
import { join as
|
|
99901
|
+
import { join as join75 } from "path";
|
|
99522
99902
|
function getUserConfigDir2() {
|
|
99523
99903
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
99524
99904
|
if (xdgConfig)
|
|
99525
|
-
return
|
|
99526
|
-
return
|
|
99905
|
+
return join75(xdgConfig, "opencode");
|
|
99906
|
+
return join75(homedir17(), ".config", "opencode");
|
|
99527
99907
|
}
|
|
99528
99908
|
function loadCustomProviderNames() {
|
|
99529
99909
|
const configDir = getUserConfigDir2();
|
|
99530
99910
|
const candidatePaths = [
|
|
99531
|
-
|
|
99532
|
-
|
|
99911
|
+
join75(configDir, "opencode.json"),
|
|
99912
|
+
join75(configDir, "opencode.jsonc")
|
|
99533
99913
|
];
|
|
99534
99914
|
for (const configPath of candidatePaths) {
|
|
99535
99915
|
if (!existsSync54(configPath))
|
|
99536
99916
|
continue;
|
|
99537
99917
|
try {
|
|
99538
|
-
const content =
|
|
99918
|
+
const content = readFileSync36(configPath, "utf-8");
|
|
99539
99919
|
const data = parseJsonc(content);
|
|
99540
99920
|
if (data?.provider && typeof data.provider === "object") {
|
|
99541
99921
|
return Object.keys(data.provider);
|
|
@@ -99550,7 +99930,7 @@ function loadCustomProviderNames() {
|
|
|
99550
99930
|
return [];
|
|
99551
99931
|
}
|
|
99552
99932
|
function loadAvailableModelsFromCache() {
|
|
99553
|
-
const cacheFile =
|
|
99933
|
+
const cacheFile = join75(getOpenCodeCacheDir(), "models.json");
|
|
99554
99934
|
const customProviders = loadCustomProviderNames();
|
|
99555
99935
|
if (!existsSync54(cacheFile)) {
|
|
99556
99936
|
if (customProviders.length > 0) {
|
|
@@ -99559,7 +99939,7 @@ function loadAvailableModelsFromCache() {
|
|
|
99559
99939
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
99560
99940
|
}
|
|
99561
99941
|
try {
|
|
99562
|
-
const content =
|
|
99942
|
+
const content = readFileSync36(cacheFile, "utf-8");
|
|
99563
99943
|
const data = parseJsonc(content);
|
|
99564
99944
|
const cacheProviders = Object.keys(data);
|
|
99565
99945
|
let modelCount = 0;
|
|
@@ -99586,9 +99966,9 @@ init_model_capabilities2();
|
|
|
99586
99966
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-config.ts
|
|
99587
99967
|
init_shared();
|
|
99588
99968
|
init_plugin_identity();
|
|
99589
|
-
import { readFileSync as
|
|
99590
|
-
import { join as
|
|
99591
|
-
var PROJECT_CONFIG_DIR =
|
|
99969
|
+
import { readFileSync as readFileSync37 } from "fs";
|
|
99970
|
+
import { join as join76 } from "path";
|
|
99971
|
+
var PROJECT_CONFIG_DIR = join76(process.cwd(), ".opencode");
|
|
99592
99972
|
function loadOmoConfig() {
|
|
99593
99973
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
99594
99974
|
basenames: [CONFIG_BASENAME],
|
|
@@ -99596,7 +99976,7 @@ function loadOmoConfig() {
|
|
|
99596
99976
|
});
|
|
99597
99977
|
if (projectDetected.format !== "none") {
|
|
99598
99978
|
try {
|
|
99599
|
-
const content =
|
|
99979
|
+
const content = readFileSync37(projectDetected.path, "utf-8");
|
|
99600
99980
|
return parseJsonc(content);
|
|
99601
99981
|
} catch (error51) {
|
|
99602
99982
|
if (error51 instanceof Error) {
|
|
@@ -99612,7 +99992,7 @@ function loadOmoConfig() {
|
|
|
99612
99992
|
});
|
|
99613
99993
|
if (userDetected.format !== "none") {
|
|
99614
99994
|
try {
|
|
99615
|
-
const content =
|
|
99995
|
+
const content = readFileSync37(userDetected.path, "utf-8");
|
|
99616
99996
|
return parseJsonc(content);
|
|
99617
99997
|
} catch (error51) {
|
|
99618
99998
|
if (error51 instanceof Error) {
|
|
@@ -99626,7 +100006,7 @@ function loadOmoConfig() {
|
|
|
99626
100006
|
|
|
99627
100007
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
99628
100008
|
init_shared();
|
|
99629
|
-
import { join as
|
|
100009
|
+
import { join as join77 } from "path";
|
|
99630
100010
|
|
|
99631
100011
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
99632
100012
|
function formatModelWithVariant(model, variant) {
|
|
@@ -99668,7 +100048,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
99668
100048
|
}
|
|
99669
100049
|
function buildModelResolutionDetails(options) {
|
|
99670
100050
|
const details = [];
|
|
99671
|
-
const cacheFile =
|
|
100051
|
+
const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
|
|
99672
100052
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
99673
100053
|
details.push("");
|
|
99674
100054
|
if (options.available.cacheExists) {
|
|
@@ -99947,25 +100327,25 @@ init_src();
|
|
|
99947
100327
|
import { existsSync as existsSync55 } from "fs";
|
|
99948
100328
|
import { createRequire as createRequire3 } from "module";
|
|
99949
100329
|
import { homedir as homedir19 } from "os";
|
|
99950
|
-
import { dirname as
|
|
100330
|
+
import { dirname as dirname30, join as join79 } from "path";
|
|
99951
100331
|
|
|
99952
100332
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
99953
|
-
import { join as
|
|
100333
|
+
import { join as join78 } from "path";
|
|
99954
100334
|
import { homedir as homedir18, tmpdir as tmpdir3 } from "os";
|
|
99955
100335
|
init_binary_downloader();
|
|
99956
100336
|
init_logger2();
|
|
99957
100337
|
init_plugin_identity();
|
|
99958
100338
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
99959
|
-
var DEBUG_FILE =
|
|
100339
|
+
var DEBUG_FILE = join78(tmpdir3(), "comment-checker-debug.log");
|
|
99960
100340
|
function getCacheDir2() {
|
|
99961
100341
|
if (process.platform === "win32") {
|
|
99962
100342
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
99963
|
-
const base2 = localAppData ||
|
|
99964
|
-
return
|
|
100343
|
+
const base2 = localAppData || join78(homedir18(), "AppData", "Local");
|
|
100344
|
+
return join78(base2, CACHE_DIR_NAME, "bin");
|
|
99965
100345
|
}
|
|
99966
100346
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
99967
|
-
const base = xdgCache ||
|
|
99968
|
-
return
|
|
100347
|
+
const base = xdgCache || join78(homedir18(), ".cache");
|
|
100348
|
+
return join78(base, CACHE_DIR_NAME, "bin");
|
|
99969
100349
|
}
|
|
99970
100350
|
function getBinaryName() {
|
|
99971
100351
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -100015,7 +100395,7 @@ async function getBinaryVersion(binary) {
|
|
|
100015
100395
|
}
|
|
100016
100396
|
}
|
|
100017
100397
|
async function checkAstGrepCli() {
|
|
100018
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
100398
|
+
const runtimeDir = astGrepRuntimeDir(join79(homedir19(), ".omo"));
|
|
100019
100399
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
100020
100400
|
if (sgPath === null) {
|
|
100021
100401
|
return {
|
|
@@ -100044,11 +100424,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
100044
100424
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
100045
100425
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
100046
100426
|
try {
|
|
100047
|
-
const packageDir = baseDirOverride ??
|
|
100048
|
-
const vendorPath =
|
|
100427
|
+
const packageDir = baseDirOverride ?? dirname30(resolvePackageJsonPath());
|
|
100428
|
+
const vendorPath = join79(packageDir, "vendor", platformKey, binaryName);
|
|
100049
100429
|
if (existsSync55(vendorPath))
|
|
100050
100430
|
return vendorPath;
|
|
100051
|
-
const binPath =
|
|
100431
|
+
const binPath = join79(packageDir, "bin", binaryName);
|
|
100052
100432
|
if (existsSync55(binPath))
|
|
100053
100433
|
return binPath;
|
|
100054
100434
|
} catch (error51) {
|
|
@@ -100193,12 +100573,12 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
100193
100573
|
}
|
|
100194
100574
|
|
|
100195
100575
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
100196
|
-
import { readFileSync as
|
|
100197
|
-
import { join as
|
|
100576
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
100577
|
+
import { join as join80 } from "path";
|
|
100198
100578
|
|
|
100199
100579
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
100200
100580
|
import { existsSync as existsSync56 } from "fs";
|
|
100201
|
-
import { delimiter as delimiter3, dirname as
|
|
100581
|
+
import { delimiter as delimiter3, dirname as dirname31, resolve as resolve21 } from "path";
|
|
100202
100582
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
100203
100583
|
|
|
100204
100584
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -100320,7 +100700,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
100320
100700
|
].join(";");
|
|
100321
100701
|
function getModuleDirectory(moduleUrl) {
|
|
100322
100702
|
try {
|
|
100323
|
-
return
|
|
100703
|
+
return dirname31(fileURLToPath7(moduleUrl));
|
|
100324
100704
|
} catch (error51) {
|
|
100325
100705
|
if (!(error51 instanceof Error))
|
|
100326
100706
|
throw error51;
|
|
@@ -100390,7 +100770,7 @@ function readOmoConfig(configDirectory) {
|
|
|
100390
100770
|
return null;
|
|
100391
100771
|
}
|
|
100392
100772
|
try {
|
|
100393
|
-
const content =
|
|
100773
|
+
const content = readFileSync38(detected.path, "utf-8");
|
|
100394
100774
|
return parseJsonc(content);
|
|
100395
100775
|
} catch (error51) {
|
|
100396
100776
|
if (!(error51 instanceof Error)) {
|
|
@@ -100401,7 +100781,7 @@ function readOmoConfig(configDirectory) {
|
|
|
100401
100781
|
}
|
|
100402
100782
|
function isLspMcpDisabled(options) {
|
|
100403
100783
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
100404
|
-
const projectConfigDirectory =
|
|
100784
|
+
const projectConfigDirectory = join80(options.cwd ?? process.cwd(), ".opencode");
|
|
100405
100785
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
100406
100786
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
100407
100787
|
const disabledMcps = new Set([
|
|
@@ -100420,15 +100800,15 @@ function getInstalledLspServers(options = {}) {
|
|
|
100420
100800
|
|
|
100421
100801
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
100422
100802
|
init_shared();
|
|
100423
|
-
import { existsSync as existsSync57, readFileSync as
|
|
100803
|
+
import { existsSync as existsSync57, readFileSync as readFileSync39 } from "fs";
|
|
100424
100804
|
import { homedir as homedir20 } from "os";
|
|
100425
|
-
import { join as
|
|
100805
|
+
import { join as join81 } from "path";
|
|
100426
100806
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
100427
100807
|
function getMcpConfigPaths() {
|
|
100428
100808
|
return [
|
|
100429
|
-
|
|
100430
|
-
|
|
100431
|
-
|
|
100809
|
+
join81(homedir20(), ".claude", ".mcp.json"),
|
|
100810
|
+
join81(process.cwd(), ".mcp.json"),
|
|
100811
|
+
join81(process.cwd(), ".claude", ".mcp.json")
|
|
100432
100812
|
];
|
|
100433
100813
|
}
|
|
100434
100814
|
function loadUserMcpConfig() {
|
|
@@ -100437,7 +100817,7 @@ function loadUserMcpConfig() {
|
|
|
100437
100817
|
if (!existsSync57(configPath))
|
|
100438
100818
|
continue;
|
|
100439
100819
|
try {
|
|
100440
|
-
const content =
|
|
100820
|
+
const content = readFileSync39(configPath, "utf-8");
|
|
100441
100821
|
const config3 = parseJsonc(content);
|
|
100442
100822
|
if (config3.mcpServers) {
|
|
100443
100823
|
Object.assign(servers, config3.mcpServers);
|
|
@@ -100572,7 +100952,7 @@ async function checkTools() {
|
|
|
100572
100952
|
|
|
100573
100953
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
100574
100954
|
init_src4();
|
|
100575
|
-
import { existsSync as existsSync58, readFileSync as
|
|
100955
|
+
import { existsSync as existsSync58, readFileSync as readFileSync40 } from "fs";
|
|
100576
100956
|
function isTelemetryState(value) {
|
|
100577
100957
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
100578
100958
|
}
|
|
@@ -100582,7 +100962,7 @@ function readLastActiveDay(stateFilePath) {
|
|
|
100582
100962
|
}
|
|
100583
100963
|
let parsed;
|
|
100584
100964
|
try {
|
|
100585
|
-
parsed = JSON.parse(
|
|
100965
|
+
parsed = JSON.parse(readFileSync40(stateFilePath, "utf-8"));
|
|
100586
100966
|
} catch (error51) {
|
|
100587
100967
|
if (error51 instanceof Error) {
|
|
100588
100968
|
return "unreadable";
|
|
@@ -100657,7 +101037,7 @@ function expandHomeDirectory(directoryPath) {
|
|
|
100657
101037
|
// packages/omo-opencode/src/cli/doctor/checks/team-mode.ts
|
|
100658
101038
|
init_shared();
|
|
100659
101039
|
init_plugin_identity();
|
|
100660
|
-
import { readFileSync as
|
|
101040
|
+
import { readFileSync as readFileSync41, promises as fs13 } from "fs";
|
|
100661
101041
|
import path15 from "path";
|
|
100662
101042
|
async function checkTeamMode() {
|
|
100663
101043
|
const config3 = loadTeamModeConfig();
|
|
@@ -100694,7 +101074,7 @@ function loadTeamModeConfig() {
|
|
|
100694
101074
|
if (!configPath)
|
|
100695
101075
|
return { team_mode: undefined };
|
|
100696
101076
|
try {
|
|
100697
|
-
return parseJsonc(
|
|
101077
|
+
return parseJsonc(readFileSync41(configPath, "utf-8"));
|
|
100698
101078
|
} catch (error51) {
|
|
100699
101079
|
if (error51 instanceof Error) {
|
|
100700
101080
|
return { team_mode: undefined };
|
|
@@ -100728,9 +101108,9 @@ async function pathExists(dir) {
|
|
|
100728
101108
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
100729
101109
|
init_src();
|
|
100730
101110
|
import { existsSync as existsSync59 } from "fs";
|
|
100731
|
-
import { lstat as
|
|
101111
|
+
import { lstat as lstat13, readdir as readdir11, readFile as readFile23 } from "fs/promises";
|
|
100732
101112
|
import { homedir as homedir22 } from "os";
|
|
100733
|
-
import { basename as basename13, join as
|
|
101113
|
+
import { basename as basename13, join as join82, resolve as resolve22 } from "path";
|
|
100734
101114
|
// packages/omo-opencode/package.json
|
|
100735
101115
|
var package_default3 = {
|
|
100736
101116
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -100788,13 +101168,13 @@ var CODEX_BIN_NAMES = [
|
|
|
100788
101168
|
"omo-git-bash-hook"
|
|
100789
101169
|
];
|
|
100790
101170
|
async function gatherCodexSummary(deps = {}) {
|
|
100791
|
-
const codexHome = resolve22(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
101171
|
+
const codexHome = resolve22(deps.codexHome ?? process.env.CODEX_HOME ?? join82(homedir22(), ".codex"));
|
|
100792
101172
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
100793
101173
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
100794
101174
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
100795
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
100796
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
100797
|
-
const configPath =
|
|
101175
|
+
const manifest = pluginRoot === null ? null : await readJson(join82(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
101176
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join82(pluginRoot, "lazycodex-install.json"));
|
|
101177
|
+
const configPath = join82(codexHome, "config.toml");
|
|
100798
101178
|
const pluginVersion = stringField(manifest, "version");
|
|
100799
101179
|
return {
|
|
100800
101180
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -100851,7 +101231,7 @@ function buildCodexIssues(summary) {
|
|
|
100851
101231
|
if (summary.pluginRoot === null) {
|
|
100852
101232
|
issues.push({
|
|
100853
101233
|
title: "OMO Codex plugin is not installed",
|
|
100854
|
-
description: `Expected cached plugin at ${
|
|
101234
|
+
description: `Expected cached plugin at ${join82("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
100855
101235
|
fix: "Run: npx lazycodex-ai install",
|
|
100856
101236
|
severity: "error",
|
|
100857
101237
|
affects: ["plugin loading"]
|
|
@@ -100916,12 +101296,12 @@ function buildCodexIssues(summary) {
|
|
|
100916
101296
|
return issues;
|
|
100917
101297
|
}
|
|
100918
101298
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
100919
|
-
const pluginRoot =
|
|
101299
|
+
const pluginRoot = join82(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
100920
101300
|
if (!existsSync59(pluginRoot))
|
|
100921
101301
|
return null;
|
|
100922
|
-
const versions2 = await
|
|
101302
|
+
const versions2 = await readdir11(pluginRoot, { withFileTypes: true });
|
|
100923
101303
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
100924
|
-
return candidates.length === 0 ? null :
|
|
101304
|
+
return candidates.length === 0 ? null : join82(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
100925
101305
|
}
|
|
100926
101306
|
async function readCodexConfigSummary(configPath) {
|
|
100927
101307
|
if (!existsSync59(configPath)) {
|
|
@@ -100949,16 +101329,16 @@ async function readCodexConfigSummary(configPath) {
|
|
|
100949
101329
|
async function readLinkedBins(binDir) {
|
|
100950
101330
|
const linked = [];
|
|
100951
101331
|
for (const name of CODEX_BIN_NAMES) {
|
|
100952
|
-
if (await pathExists2(
|
|
101332
|
+
if (await pathExists2(join82(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
100953
101333
|
linked.push(name);
|
|
100954
101334
|
}
|
|
100955
101335
|
return linked;
|
|
100956
101336
|
}
|
|
100957
101337
|
async function readLinkedAgents(codexHome) {
|
|
100958
|
-
const agentsDir =
|
|
101338
|
+
const agentsDir = join82(codexHome, "agents");
|
|
100959
101339
|
if (!existsSync59(agentsDir))
|
|
100960
101340
|
return [];
|
|
100961
|
-
const entries = await
|
|
101341
|
+
const entries = await readdir11(agentsDir, { withFileTypes: true });
|
|
100962
101342
|
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename13(entry.name, ".toml")).sort();
|
|
100963
101343
|
}
|
|
100964
101344
|
async function readJson(path16) {
|
|
@@ -101058,7 +101438,7 @@ function compareVersionsDescending(left, right) {
|
|
|
101058
101438
|
}
|
|
101059
101439
|
async function pathExists2(path16) {
|
|
101060
101440
|
try {
|
|
101061
|
-
await
|
|
101441
|
+
await lstat13(path16);
|
|
101062
101442
|
return true;
|
|
101063
101443
|
} catch (error51) {
|
|
101064
101444
|
if (error51 instanceof Error)
|
|
@@ -101069,9 +101449,9 @@ async function pathExists2(path16) {
|
|
|
101069
101449
|
|
|
101070
101450
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
101071
101451
|
init_src();
|
|
101072
|
-
import { readdir as
|
|
101452
|
+
import { readdir as readdir12, readFile as readFile24, stat as stat6 } from "fs/promises";
|
|
101073
101453
|
import { homedir as homedir23 } from "os";
|
|
101074
|
-
import { dirname as
|
|
101454
|
+
import { dirname as dirname32, isAbsolute as isAbsolute13, join as join83, relative as relative10, resolve as resolve23, sep as sep9 } from "path";
|
|
101075
101455
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
101076
101456
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
101077
101457
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -101081,7 +101461,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
101081
101461
|
const env3 = deps.env ?? process.env;
|
|
101082
101462
|
const platform = deps.platform ?? process.platform;
|
|
101083
101463
|
const arch = deps.arch ?? process.arch;
|
|
101084
|
-
const codexHome = resolve23(deps.codexHome ?? env3["CODEX_HOME"] ??
|
|
101464
|
+
const codexHome = resolve23(deps.codexHome ?? env3["CODEX_HOME"] ?? join83(homedir23(), ".codex"));
|
|
101085
101465
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
101086
101466
|
if (summary.pluginRoot === null) {
|
|
101087
101467
|
return {
|
|
@@ -101106,7 +101486,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
101106
101486
|
});
|
|
101107
101487
|
}
|
|
101108
101488
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
101109
|
-
const runtimeSgPath =
|
|
101489
|
+
const runtimeSgPath = join83(runtimeSgDir, sgBinaryName(platform));
|
|
101110
101490
|
const sg = findSgBinarySync({
|
|
101111
101491
|
arch,
|
|
101112
101492
|
env: env3,
|
|
@@ -101143,12 +101523,12 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
101143
101523
|
let referencedCount = 0;
|
|
101144
101524
|
for (const manifestPath of await findManifestPaths(pluginRoot, ".mcp.json")) {
|
|
101145
101525
|
const manifest = await readJson2(manifestPath);
|
|
101146
|
-
if (manifest === null || !
|
|
101526
|
+
if (manifest === null || !isRecord6(manifest["mcpServers"]))
|
|
101147
101527
|
continue;
|
|
101148
|
-
const manifestRoot =
|
|
101528
|
+
const manifestRoot = dirname32(manifestPath);
|
|
101149
101529
|
const isRootManifest = resolve23(manifestRoot) === resolve23(pluginRoot);
|
|
101150
101530
|
for (const server2 of Object.values(manifest["mcpServers"])) {
|
|
101151
|
-
if (!
|
|
101531
|
+
if (!isRecord6(server2) || !Array.isArray(server2["args"]))
|
|
101152
101532
|
continue;
|
|
101153
101533
|
for (const arg of server2["args"]) {
|
|
101154
101534
|
if (typeof arg !== "string" || !isPluginRuntimePathArg(arg))
|
|
@@ -101166,7 +101546,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
101166
101546
|
continue;
|
|
101167
101547
|
const commands2 = [];
|
|
101168
101548
|
collectHookCommands(manifest, commands2);
|
|
101169
|
-
const hookPluginRoot =
|
|
101549
|
+
const hookPluginRoot = dirname32(dirname32(hookManifestPath));
|
|
101170
101550
|
for (const command of commands2) {
|
|
101171
101551
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
101172
101552
|
referencedCount += 1;
|
|
@@ -101205,12 +101585,12 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
101205
101585
|
}
|
|
101206
101586
|
async function findHookManifestPaths(root) {
|
|
101207
101587
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
101208
|
-
return paths2.filter((path16) =>
|
|
101588
|
+
return paths2.filter((path16) => dirname32(path16).endsWith(`${sep9}hooks`));
|
|
101209
101589
|
}
|
|
101210
101590
|
async function findManifestPaths(root, manifestName) {
|
|
101211
101591
|
let entries;
|
|
101212
101592
|
try {
|
|
101213
|
-
entries = await
|
|
101593
|
+
entries = await readdir12(root, { withFileTypes: true });
|
|
101214
101594
|
} catch {
|
|
101215
101595
|
return [];
|
|
101216
101596
|
}
|
|
@@ -101218,7 +101598,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
101218
101598
|
for (const entry of entries) {
|
|
101219
101599
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
101220
101600
|
continue;
|
|
101221
|
-
const entryPath =
|
|
101601
|
+
const entryPath = join83(root, entry.name);
|
|
101222
101602
|
if (entry.isDirectory()) {
|
|
101223
101603
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
101224
101604
|
continue;
|
|
@@ -101234,7 +101614,7 @@ function collectHookCommands(value, commands2) {
|
|
|
101234
101614
|
collectHookCommands(item, commands2);
|
|
101235
101615
|
return;
|
|
101236
101616
|
}
|
|
101237
|
-
if (!
|
|
101617
|
+
if (!isRecord6(value))
|
|
101238
101618
|
return;
|
|
101239
101619
|
if (value["type"] === "command") {
|
|
101240
101620
|
if (typeof value["command"] === "string")
|
|
@@ -101259,21 +101639,21 @@ function extractPluginRootPaths(command) {
|
|
|
101259
101639
|
}
|
|
101260
101640
|
function isPluginRuntimePathArg(arg) {
|
|
101261
101641
|
const normalized = normalizePathSeparators(arg);
|
|
101262
|
-
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") ||
|
|
101642
|
+
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute13(arg));
|
|
101263
101643
|
}
|
|
101264
101644
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
101265
|
-
return
|
|
101645
|
+
return join83(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
101266
101646
|
}
|
|
101267
101647
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
101268
101648
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
101269
101649
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
101270
101650
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
101271
|
-
if (sgPath ===
|
|
101651
|
+
if (sgPath === join83(runtimeSgDir, sgBinaryName(platform)))
|
|
101272
101652
|
return "runtime dir";
|
|
101273
101653
|
return "PATH";
|
|
101274
101654
|
}
|
|
101275
101655
|
async function readBootstrapStateSummary(codexHome) {
|
|
101276
|
-
const statePath =
|
|
101656
|
+
const statePath = join83(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
101277
101657
|
const raw = await readJson2(statePath);
|
|
101278
101658
|
if (raw === null)
|
|
101279
101659
|
return null;
|
|
@@ -101289,7 +101669,7 @@ function parseDegradedEntries(value) {
|
|
|
101289
101669
|
return [];
|
|
101290
101670
|
const entries = [];
|
|
101291
101671
|
for (const item of value) {
|
|
101292
|
-
if (!
|
|
101672
|
+
if (!isRecord6(item))
|
|
101293
101673
|
continue;
|
|
101294
101674
|
if (typeof item["component"] !== "string" || typeof item["reason"] !== "string")
|
|
101295
101675
|
continue;
|
|
@@ -101323,7 +101703,7 @@ function degradedDetailLines(entries) {
|
|
|
101323
101703
|
async function readJson2(path16) {
|
|
101324
101704
|
try {
|
|
101325
101705
|
const parsed = JSON.parse(await readFile24(path16, "utf8"));
|
|
101326
|
-
return
|
|
101706
|
+
return isRecord6(parsed) ? parsed : null;
|
|
101327
101707
|
} catch (error51) {
|
|
101328
101708
|
if (error51 instanceof Error)
|
|
101329
101709
|
return null;
|
|
@@ -101344,7 +101724,7 @@ function normalizeRelative(root, target) {
|
|
|
101344
101724
|
function normalizePathSeparators(path16) {
|
|
101345
101725
|
return path16.split("\\").join("/");
|
|
101346
101726
|
}
|
|
101347
|
-
function
|
|
101727
|
+
function isRecord6(value) {
|
|
101348
101728
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
101349
101729
|
}
|
|
101350
101730
|
|
|
@@ -101352,15 +101732,15 @@ function isRecord5(value) {
|
|
|
101352
101732
|
import { existsSync as existsSync60 } from "fs";
|
|
101353
101733
|
import { readFile as readFile25 } from "fs/promises";
|
|
101354
101734
|
import { homedir as homedir24 } from "os";
|
|
101355
|
-
import { join as
|
|
101735
|
+
import { join as join84, resolve as resolve24 } from "path";
|
|
101356
101736
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
101357
101737
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
101358
101738
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
101359
101739
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
101360
|
-
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
101740
|
+
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ?? join84(homedir24(), ".codex"));
|
|
101361
101741
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
101362
101742
|
const platform = deps.platform ?? process.platform;
|
|
101363
|
-
const wrapperPath =
|
|
101743
|
+
const wrapperPath = join84(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
101364
101744
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
101365
101745
|
const issues = [];
|
|
101366
101746
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -101867,17 +102247,17 @@ import {
|
|
|
101867
102247
|
existsSync as existsSync63,
|
|
101868
102248
|
mkdirSync as mkdirSync14,
|
|
101869
102249
|
readdirSync as readdirSync9,
|
|
101870
|
-
readFileSync as
|
|
102250
|
+
readFileSync as readFileSync43,
|
|
101871
102251
|
renameSync as renameSync7,
|
|
101872
102252
|
unlinkSync as unlinkSync8,
|
|
101873
102253
|
writeFileSync as writeFileSync11
|
|
101874
102254
|
} from "fs";
|
|
101875
|
-
import { basename as basename14, dirname as
|
|
102255
|
+
import { basename as basename14, dirname as dirname33, join as join87 } from "path";
|
|
101876
102256
|
|
|
101877
102257
|
// packages/mcp-client-core/src/config-dir.ts
|
|
101878
102258
|
import { existsSync as existsSync61, realpathSync as realpathSync8 } from "fs";
|
|
101879
102259
|
import { homedir as homedir25 } from "os";
|
|
101880
|
-
import { join as
|
|
102260
|
+
import { join as join85, resolve as resolve25 } from "path";
|
|
101881
102261
|
function resolveConfigPath2(pathValue) {
|
|
101882
102262
|
const resolvedPath = resolve25(pathValue);
|
|
101883
102263
|
if (!existsSync61(resolvedPath))
|
|
@@ -101895,13 +102275,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
101895
102275
|
if (customConfigDir) {
|
|
101896
102276
|
return resolveConfigPath2(customConfigDir);
|
|
101897
102277
|
}
|
|
101898
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
101899
|
-
return resolveConfigPath2(
|
|
102278
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join85(homedir25(), ".config");
|
|
102279
|
+
return resolveConfigPath2(join85(xdgConfigDir, "opencode"));
|
|
101900
102280
|
}
|
|
101901
102281
|
|
|
101902
102282
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
101903
|
-
import { chmodSync as chmodSync3, existsSync as existsSync62, readFileSync as
|
|
101904
|
-
import { join as
|
|
102283
|
+
import { chmodSync as chmodSync3, existsSync as existsSync62, readFileSync as readFileSync42, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "fs";
|
|
102284
|
+
import { join as join86 } from "path";
|
|
101905
102285
|
var INDEX_FILE_NAME = "index.json";
|
|
101906
102286
|
function isTokenIndex(value) {
|
|
101907
102287
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -101909,14 +102289,14 @@ function isTokenIndex(value) {
|
|
|
101909
102289
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
101910
102290
|
}
|
|
101911
102291
|
function getIndexPath(storageDir) {
|
|
101912
|
-
return
|
|
102292
|
+
return join86(storageDir, INDEX_FILE_NAME);
|
|
101913
102293
|
}
|
|
101914
102294
|
function readTokenIndex(storageDir) {
|
|
101915
102295
|
const indexPath = getIndexPath(storageDir);
|
|
101916
102296
|
if (!existsSync62(indexPath))
|
|
101917
102297
|
return {};
|
|
101918
102298
|
try {
|
|
101919
|
-
const parsed = JSON.parse(
|
|
102299
|
+
const parsed = JSON.parse(readFileSync42(indexPath, "utf-8"));
|
|
101920
102300
|
return isTokenIndex(parsed) ? parsed : {};
|
|
101921
102301
|
} catch (readError) {
|
|
101922
102302
|
if (!(readError instanceof Error))
|
|
@@ -101953,16 +102333,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
101953
102333
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
101954
102334
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
101955
102335
|
function getMcpOauthStorageDir() {
|
|
101956
|
-
return
|
|
102336
|
+
return join87(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
101957
102337
|
}
|
|
101958
102338
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
101959
102339
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
101960
102340
|
}
|
|
101961
102341
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
101962
|
-
return
|
|
102342
|
+
return join87(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
101963
102343
|
}
|
|
101964
102344
|
function getLegacyStoragePath() {
|
|
101965
|
-
return
|
|
102345
|
+
return join87(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
101966
102346
|
}
|
|
101967
102347
|
function normalizeHost2(serverHost) {
|
|
101968
102348
|
let host = serverHost.trim();
|
|
@@ -102026,7 +102406,7 @@ function readTokenFile(filePath) {
|
|
|
102026
102406
|
if (!existsSync63(filePath))
|
|
102027
102407
|
return null;
|
|
102028
102408
|
try {
|
|
102029
|
-
const parsed = JSON.parse(
|
|
102409
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
102030
102410
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
102031
102411
|
} catch (readError) {
|
|
102032
102412
|
if (!(readError instanceof Error))
|
|
@@ -102039,7 +102419,7 @@ function readLegacyStore() {
|
|
|
102039
102419
|
if (!existsSync63(filePath))
|
|
102040
102420
|
return null;
|
|
102041
102421
|
try {
|
|
102042
|
-
const parsed = JSON.parse(
|
|
102422
|
+
const parsed = JSON.parse(readFileSync43(filePath, "utf-8"));
|
|
102043
102423
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
102044
102424
|
return null;
|
|
102045
102425
|
const result = {};
|
|
@@ -102056,7 +102436,7 @@ function readLegacyStore() {
|
|
|
102056
102436
|
}
|
|
102057
102437
|
function writeTokenFile(filePath, token) {
|
|
102058
102438
|
try {
|
|
102059
|
-
const dir =
|
|
102439
|
+
const dir = dirname33(filePath);
|
|
102060
102440
|
if (!existsSync63(dir)) {
|
|
102061
102441
|
mkdirSync14(dir, { recursive: true });
|
|
102062
102442
|
}
|
|
@@ -102141,7 +102521,7 @@ function listTokensByHost(serverHost) {
|
|
|
102141
102521
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
102142
102522
|
if (!indexedKey.startsWith(prefix))
|
|
102143
102523
|
continue;
|
|
102144
|
-
const indexedToken = readTokenFile(
|
|
102524
|
+
const indexedToken = readTokenFile(join87(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
102145
102525
|
if (indexedToken)
|
|
102146
102526
|
result[indexedKey] = indexedToken;
|
|
102147
102527
|
}
|
|
@@ -102156,7 +102536,7 @@ function listAllTokens() {
|
|
|
102156
102536
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
102157
102537
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
102158
102538
|
continue;
|
|
102159
|
-
const token = readTokenFile(
|
|
102539
|
+
const token = readTokenFile(join87(dir, entry.name));
|
|
102160
102540
|
const hash2 = basename14(entry.name, ".json");
|
|
102161
102541
|
if (token)
|
|
102162
102542
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -102880,7 +103260,7 @@ async function boulder(options) {
|
|
|
102880
103260
|
}
|
|
102881
103261
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
102882
103262
|
import { spawn as spawn5 } from "child_process";
|
|
102883
|
-
import { existsSync as existsSync65, readFileSync as
|
|
103263
|
+
import { existsSync as existsSync65, readFileSync as readFileSync44, realpathSync as realpathSync9 } from "fs";
|
|
102884
103264
|
import { homedir as homedir26 } from "os";
|
|
102885
103265
|
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
|
|
102886
103266
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
@@ -102930,7 +103310,7 @@ function resolveLegacyLocalOmoBin(env3, homeDir, currentExecutablePaths) {
|
|
|
102930
103310
|
}
|
|
102931
103311
|
function isGeneratedRuntimeWrapper(candidate) {
|
|
102932
103312
|
try {
|
|
102933
|
-
return
|
|
103313
|
+
return readFileSync44(candidate, "utf8").includes(RUNTIME_WRAPPER_MARKER);
|
|
102934
103314
|
} catch (error51) {
|
|
102935
103315
|
if (error51 instanceof Error)
|
|
102936
103316
|
return false;
|