oh-my-opencode 4.12.1 → 4.13.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/README.md +1 -1
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/agents/sisyphus-agent-factory.d.ts +9 -0
- package/dist/agents/sisyphus-runtime-prompt-reconciler.d.ts +31 -0
- package/dist/cli/index.js +896 -669
- package/dist/cli-node/index.js +896 -669
- package/dist/config/schema/codegraph.d.ts +1 -0
- package/dist/config/schema/oh-my-opencode-config.d.ts +2 -0
- package/dist/config/schema/runtime-fallback.d.ts +1 -0
- package/dist/features/background-agent/background-task-marker.d.ts +8 -0
- package/dist/features/background-agent/fallback-retry-handler.d.ts +1 -0
- package/dist/features/background-agent/manager.d.ts +1 -0
- package/dist/features/background-agent/parent-wake-dedupe.d.ts +1 -0
- package/dist/features/background-agent/parent-wake-notifier-types.d.ts +2 -0
- package/dist/features/background-agent/parent-wake-notifier.d.ts +1 -0
- package/dist/features/background-agent/parent-wake-window-recovery.d.ts +2 -0
- package/dist/hooks/runtime-fallback/auto-retry-dispatch.d.ts +2 -2
- package/dist/hooks/runtime-fallback/auto-retry-timeout.d.ts +2 -2
- package/dist/hooks/runtime-fallback/auto-retry.d.ts +1 -1
- package/dist/hooks/runtime-fallback/fallback-state-snapshot.d.ts +13 -0
- package/dist/hooks/runtime-fallback/types.d.ts +8 -0
- package/dist/index.js +708 -413
- package/dist/oh-my-opencode.schema.json +8 -0
- package/dist/plugin/runtime-skill-resolver.d.ts +35 -0
- package/dist/plugin/skill-context.d.ts +9 -0
- package/dist/skills/frontend/ATTRIBUTION.md +32 -8
- package/dist/skills/frontend/references/design/airbnb.md +3 -0
- package/dist/skills/frontend/references/design/airtable.md +3 -0
- package/dist/skills/frontend/references/design/apple.md +3 -0
- package/dist/skills/frontend/references/design/binance.md +3 -0
- package/dist/skills/frontend/references/design/bmw.md +3 -0
- package/dist/skills/frontend/references/design/bugatti.md +3 -0
- package/dist/skills/frontend/references/design/cal.md +3 -0
- package/dist/skills/frontend/references/design/claude.md +3 -0
- package/dist/skills/frontend/references/design/clay.md +3 -0
- package/dist/skills/frontend/references/design/clickhouse.md +3 -0
- package/dist/skills/frontend/references/design/cohere.md +3 -0
- package/dist/skills/frontend/references/design/coinbase.md +3 -0
- package/dist/skills/frontend/references/design/composio.md +3 -0
- package/dist/skills/frontend/references/design/cursor.md +3 -0
- package/dist/skills/frontend/references/design/elevenlabs.md +3 -0
- package/dist/skills/frontend/references/design/expo.md +3 -0
- package/dist/skills/frontend/references/design/ferrari.md +3 -0
- package/dist/skills/frontend/references/design/figma.md +3 -0
- package/dist/skills/frontend/references/design/framer.md +3 -0
- package/dist/skills/frontend/references/design/hashicorp.md +3 -0
- package/dist/skills/frontend/references/design/ibm.md +3 -0
- package/dist/skills/frontend/references/design/imagegen-frontend-web.md +380 -79
- package/dist/skills/frontend/references/design/intercom.md +3 -0
- package/dist/skills/frontend/references/design/kraken.md +3 -0
- package/dist/skills/frontend/references/design/lamborghini.md +3 -0
- package/dist/skills/frontend/references/design/linear.app.md +3 -0
- package/dist/skills/frontend/references/design/lovable.md +3 -0
- package/dist/skills/frontend/references/design/mastercard.md +3 -0
- package/dist/skills/frontend/references/design/meta.md +3 -0
- package/dist/skills/frontend/references/design/minimax.md +3 -0
- package/dist/skills/frontend/references/design/mintlify.md +3 -0
- package/dist/skills/frontend/references/design/miro.md +3 -0
- package/dist/skills/frontend/references/design/mistral.ai.md +3 -0
- package/dist/skills/frontend/references/design/mongodb.md +3 -0
- package/dist/skills/frontend/references/design/nike.md +3 -0
- package/dist/skills/frontend/references/design/notion.md +3 -0
- package/dist/skills/frontend/references/design/nvidia.md +3 -0
- package/dist/skills/frontend/references/design/ollama.md +3 -0
- package/dist/skills/frontend/references/design/opencode.ai.md +3 -0
- package/dist/skills/frontend/references/design/pinterest.md +3 -0
- package/dist/skills/frontend/references/design/playstation.md +3 -0
- package/dist/skills/frontend/references/design/posthog.md +3 -0
- package/dist/skills/frontend/references/design/raycast.md +3 -0
- package/dist/skills/frontend/references/design/renault.md +3 -0
- package/dist/skills/frontend/references/design/replicate.md +3 -0
- package/dist/skills/frontend/references/design/resend.md +3 -0
- package/dist/skills/frontend/references/design/revolut.md +3 -0
- package/dist/skills/frontend/references/design/runwayml.md +3 -0
- package/dist/skills/frontend/references/design/sanity.md +3 -0
- package/dist/skills/frontend/references/design/sentry.md +3 -0
- package/dist/skills/frontend/references/design/shopify.md +3 -0
- package/dist/skills/frontend/references/design/spacex.md +3 -0
- package/dist/skills/frontend/references/design/spotify.md +3 -0
- package/dist/skills/frontend/references/design/starbucks.md +3 -0
- package/dist/skills/frontend/references/design/stitch-skill.md +1 -1
- package/dist/skills/frontend/references/design/stripe.md +3 -0
- package/dist/skills/frontend/references/design/supabase.md +3 -0
- package/dist/skills/frontend/references/design/superhuman.md +3 -0
- package/dist/skills/frontend/references/design/taste-skill.md +1188 -208
- package/dist/skills/frontend/references/design/tesla.md +3 -0
- package/dist/skills/frontend/references/design/theverge.md +3 -0
- package/dist/skills/frontend/references/design/together.ai.md +3 -0
- package/dist/skills/frontend/references/design/uber.md +3 -0
- package/dist/skills/frontend/references/design/vercel.md +3 -0
- package/dist/skills/frontend/references/design/vodafone.md +3 -0
- package/dist/skills/frontend/references/design/voltagent.md +3 -0
- package/dist/skills/frontend/references/design/warp.md +3 -0
- package/dist/skills/frontend/references/design/webflow.md +3 -0
- package/dist/skills/frontend/references/design/wired.md +3 -0
- package/dist/skills/frontend/references/design/wise.md +3 -0
- package/dist/skills/frontend/references/design/x.ai.md +3 -0
- package/dist/skills/frontend/references/design/zapier.md +3 -0
- package/dist/skills/frontend/references/ui-ux-db/README.md +501 -115
- package/dist/skills/frontend/references/ui-ux-db/data/charts.csv +26 -26
- package/dist/skills/frontend/references/ui-ux-db/data/colors.csv +162 -97
- package/dist/skills/frontend/references/ui-ux-db/data/icons.csv +105 -100
- package/dist/skills/frontend/references/ui-ux-db/data/landing.csv +22 -18
- package/dist/skills/frontend/references/ui-ux-db/data/products.csv +162 -97
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -53
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -56
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -53
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -54
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -54
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -51
- package/dist/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -50
- package/dist/skills/frontend/references/ui-ux-db/data/styles.csv +17 -0
- package/dist/skills/frontend/references/ui-ux-db/data/typography.csv +17 -1
- package/dist/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +162 -101
- package/dist/skills/frontend/references/ui-ux-db/data/web-interface.csv +30 -30
- package/dist/skills/frontend/references/ui-ux-db/scripts/core.py +31 -22
- package/dist/skills/frontend/references/ui-ux-db/scripts/design_system.py +150 -69
- package/dist/skills/frontend/references/ui-ux-db/scripts/search.py +3 -3
- package/dist/skills/lcx-doctor/SKILL.md +1 -1
- package/dist/skills/ultimate-browsing/ATTRIBUTION.md +105 -0
- package/dist/skills/ultimate-browsing/SKILL.md +140 -0
- package/dist/skills/ultimate-browsing/engine/__init__.py +24 -0
- package/dist/skills/ultimate-browsing/engine/__main__.py +106 -0
- package/dist/skills/ultimate-browsing/engine/bias_check.py +174 -0
- package/dist/skills/ultimate-browsing/engine/curl_probe.py +91 -0
- package/dist/skills/ultimate-browsing/engine/executor.py +192 -0
- package/dist/skills/ultimate-browsing/engine/fetch_chain.py +268 -0
- package/dist/skills/ultimate-browsing/engine/referers.py +15 -0
- package/dist/skills/ultimate-browsing/engine/result_schema.py +45 -0
- package/dist/skills/ultimate-browsing/engine/summary.py +37 -0
- package/dist/skills/ultimate-browsing/engine/templates/package.json +11 -0
- package/dist/skills/ultimate-browsing/engine/templates/playwright_mobile_chrome.js +129 -0
- package/dist/skills/ultimate-browsing/engine/templates/playwright_real_chrome.js +167 -0
- package/dist/skills/ultimate-browsing/engine/tests/test_fetch_chain.py +77 -0
- package/dist/skills/ultimate-browsing/engine/tests/test_playwright_templates.py +282 -0
- package/dist/skills/ultimate-browsing/engine/url_transforms.py +98 -0
- package/dist/skills/ultimate-browsing/engine/validators.py +216 -0
- package/dist/skills/ultimate-browsing/engine/waf_detector.py +214 -0
- package/dist/skills/ultimate-browsing/engine/waf_profiles.yaml +162 -0
- package/dist/skills/ultimate-browsing/references/agent-reach/README.md +79 -0
- package/dist/skills/ultimate-browsing/references/agent-reach/career.md +29 -0
- package/dist/skills/ultimate-browsing/references/agent-reach/dev.md +62 -0
- package/dist/skills/ultimate-browsing/references/agent-reach/search.md +33 -0
- package/dist/skills/ultimate-browsing/references/agent-reach/social.md +207 -0
- package/dist/skills/ultimate-browsing/references/agent-reach/video.md +115 -0
- package/dist/skills/ultimate-browsing/references/agent-reach/web.md +76 -0
- package/dist/skills/ultimate-browsing/references/chrome-stealth.md +120 -0
- package/dist/skills/ultimate-browsing/references/insane-search/README.md +319 -0
- package/dist/skills/ultimate-browsing/references/insane-search/cache-archive.md +83 -0
- package/dist/skills/ultimate-browsing/references/insane-search/fallback.md +159 -0
- package/dist/skills/ultimate-browsing/references/insane-search/jina.md +130 -0
- package/dist/skills/ultimate-browsing/references/insane-search/json-api.md +133 -0
- package/dist/skills/ultimate-browsing/references/insane-search/media.md +123 -0
- package/dist/skills/ultimate-browsing/references/insane-search/metadata.md +116 -0
- package/dist/skills/ultimate-browsing/references/insane-search/naver.md +107 -0
- package/dist/skills/ultimate-browsing/references/insane-search/playwright.md +142 -0
- package/dist/skills/ultimate-browsing/references/insane-search/public-api.md +119 -0
- package/dist/skills/ultimate-browsing/references/insane-search/rss.md +123 -0
- package/dist/skills/ultimate-browsing/references/insane-search/tls-impersonate.md +186 -0
- package/dist/skills/ultimate-browsing/references/insane-search/twitter.md +104 -0
- package/dist/skills/ultimate-browsing/scripts/cookie_crypto.py +75 -0
- package/dist/skills/ultimate-browsing/scripts/cookie_domains.py +38 -0
- package/dist/skills/ultimate-browsing/scripts/cookie_paths.py +112 -0
- package/dist/skills/ultimate-browsing/scripts/extract_cookies.py +280 -0
- package/dist/skills/ultimate-browsing/scripts/tests/test_cookie_domain_filter.py +110 -0
- package/dist/skills/ultimate-browsing/scripts/tests/test_extract_cookies.py +245 -0
- package/dist/skills/ultraresearch/ATTRIBUTION.md +49 -0
- package/dist/skills/ultraresearch/SKILL.md +23 -4
- package/dist/skills/ulw-plan/SKILL.md +4 -1
- package/dist/tools/delegate-task/sync-task-deps.d.ts +8 -6
- package/dist/tools/skill-mcp/tools.d.ts +1 -1
- package/dist/tui.js +9 -1
- package/package.json +16 -14
- package/packages/omo-codex/THIRD-PARTY-NOTICES.md +27 -4
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/README.md +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +134 -42
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/LICENSE +21 -0
- package/packages/omo-codex/plugin/components/codegraph/NODE-RUNTIME-LICENSES.md +2951 -0
- package/packages/omo-codex/plugin/components/codegraph/NOTICE +16 -0
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +323 -39
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +292 -19
- package/packages/omo-codex/plugin/components/codegraph/package.json +9 -3
- package/packages/omo-codex/plugin/components/codegraph/src/mcp-unavailable.ts +75 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +29 -13
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +20 -7
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +1 -243
- package/packages/omo-codex/plugin/components/codegraph/test/package-runtime.test.ts +91 -0
- package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +1 -1
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-facade.test.ts +68 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve-node-support.test.ts +11 -1
- package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable.test.ts +133 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +1 -113
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +8 -1
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-trust-boundary.test.ts +63 -0
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-availability.test.ts +106 -0
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +150 -0
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +3 -3
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +3 -3
- package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +33 -9
- package/packages/omo-codex/plugin/components/start-work-continuation/package.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 +59 -32
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-guide.mjs +17 -16
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-state.mjs +70 -3
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-worktree.mjs +113 -0
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team.mjs +63 -4
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +5 -4
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +24 -3
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +8 -7
- package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +1 -1
- package/packages/omo-codex/plugin/package-lock.json +112 -13
- package/packages/omo-codex/plugin/package.json +2 -2
- package/packages/omo-codex/plugin/scripts/auto-update-plan.mjs +133 -0
- package/packages/omo-codex/plugin/scripts/auto-update-release-notes.mjs +135 -0
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +33 -133
- package/packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs +41 -0
- package/packages/omo-codex/plugin/shared/src/config-loader.ts +20 -2
- package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +16 -0
- package/packages/omo-codex/plugin/skills/frontend/ATTRIBUTION.md +32 -8
- package/packages/omo-codex/plugin/skills/frontend/references/design/airbnb.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/airtable.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/apple.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/binance.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/bmw.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/bugatti.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/cal.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/claude.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/clay.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/clickhouse.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/cohere.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/coinbase.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/composio.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/cursor.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/elevenlabs.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/expo.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/ferrari.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/figma.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/framer.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/hashicorp.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/ibm.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/imagegen-frontend-web.md +380 -79
- package/packages/omo-codex/plugin/skills/frontend/references/design/intercom.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/kraken.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/lamborghini.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/linear.app.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/lovable.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mastercard.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/meta.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/minimax.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mintlify.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/miro.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mistral.ai.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/mongodb.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/nike.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/notion.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/nvidia.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/ollama.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/opencode.ai.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/pinterest.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/playstation.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/posthog.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/raycast.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/renault.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/replicate.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/resend.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/revolut.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/runwayml.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/sanity.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/sentry.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/shopify.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/spacex.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/spotify.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/starbucks.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/stitch-skill.md +1 -1
- package/packages/omo-codex/plugin/skills/frontend/references/design/stripe.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/supabase.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/superhuman.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/taste-skill.md +1188 -208
- package/packages/omo-codex/plugin/skills/frontend/references/design/tesla.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/theverge.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/together.ai.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/uber.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/vercel.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/vodafone.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/voltagent.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/warp.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/webflow.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/wired.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/wise.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/x.ai.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/design/zapier.md +3 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/README.md +501 -115
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/charts.csv +26 -26
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/colors.csv +162 -97
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/icons.csv +105 -100
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/landing.csv +22 -18
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/products.csv +162 -97
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -53
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -56
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -53
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -54
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -54
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -51
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -50
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/styles.csv +17 -0
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/typography.csv +17 -1
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +162 -101
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/web-interface.csv +30 -30
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/core.py +31 -22
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/design_system.py +150 -69
- package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/search.py +3 -3
- package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/teammode/SKILL.md +59 -32
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-guide.mjs +17 -16
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-state.mjs +70 -3
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-worktree.mjs +113 -0
- package/packages/omo-codex/plugin/skills/teammode/scripts/team.mjs +63 -4
- package/packages/omo-codex/plugin/skills/ultimate-browsing/ATTRIBUTION.md +105 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +140 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/__init__.py +24 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/__main__.py +106 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/bias_check.py +174 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/curl_probe.py +91 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/executor.py +192 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/fetch_chain.py +268 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/referers.py +15 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/result_schema.py +45 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/summary.py +37 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/package.json +11 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/playwright_mobile_chrome.js +129 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/playwright_real_chrome.js +167 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/tests/test_fetch_chain.py +77 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/tests/test_playwright_templates.py +282 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/url_transforms.py +98 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/validators.py +216 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/waf_detector.py +214 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/waf_profiles.yaml +162 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/README.md +79 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/career.md +29 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/dev.md +62 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/search.md +33 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/social.md +207 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/video.md +115 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/agent-reach/web.md +76 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/chrome-stealth.md +120 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/README.md +319 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/cache-archive.md +83 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/fallback.md +159 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/jina.md +130 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/json-api.md +133 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/media.md +123 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/metadata.md +116 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/naver.md +107 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/playwright.md +142 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/public-api.md +119 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/rss.md +123 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/tls-impersonate.md +186 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/twitter.md +104 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/cookie_crypto.py +75 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/cookie_domains.py +38 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/cookie_paths.py +112 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/extract_cookies.py +280 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/tests/test_cookie_domain_filter.py +110 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/tests/test_extract_cookies.py +245 -0
- package/packages/omo-codex/plugin/skills/ultraresearch/ATTRIBUTION.md +49 -0
- package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +23 -4
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +8 -7
- package/packages/omo-codex/plugin/test/aggregate-build.test.mjs +2 -1
- package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +95 -0
- package/packages/omo-codex/plugin/test/auto-update-restart-notice.test.mjs +12 -3
- package/packages/omo-codex/plugin/test/component-codegraph-mcp-smoke.test.mjs +76 -0
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +1 -0
- package/packages/omo-codex/plugin/test/teammode-communication.test.mjs +87 -0
- package/packages/omo-codex/plugin/test/teammode-thread-title.test.mjs +169 -0
- package/packages/omo-codex/plugin/test/teammode-worktree.test.mjs +246 -0
- package/packages/omo-codex/plugin/test/ultraresearch-skill-contract.test.mjs +30 -0
- package/packages/omo-codex/scripts/install-cli-args.test.mjs +1 -1
- package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +23 -0
- package/packages/omo-codex/scripts/install-delegated-command.test.mjs +76 -4
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +520 -216
- package/packages/omo-codex/scripts/install-local-entrypoint.test.mjs +40 -3
- package/packages/shared-skills/skills/frontend/ATTRIBUTION.md +32 -8
- package/packages/shared-skills/skills/frontend/references/design/airbnb.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/airtable.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/apple.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/binance.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/bmw.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/bugatti.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/cal.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/claude.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/clay.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/clickhouse.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/cohere.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/coinbase.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/composio.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/cursor.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/elevenlabs.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/expo.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/ferrari.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/figma.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/framer.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/hashicorp.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/ibm.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/imagegen-frontend-web.md +380 -79
- package/packages/shared-skills/skills/frontend/references/design/intercom.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/kraken.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/lamborghini.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/linear.app.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/lovable.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/mastercard.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/meta.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/minimax.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/mintlify.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/miro.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/mistral.ai.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/mongodb.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/nike.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/notion.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/nvidia.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/ollama.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/opencode.ai.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/pinterest.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/playstation.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/posthog.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/raycast.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/renault.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/replicate.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/resend.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/revolut.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/runwayml.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/sanity.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/sentry.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/shopify.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/spacex.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/spotify.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/starbucks.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/stitch-skill.md +1 -1
- package/packages/shared-skills/skills/frontend/references/design/stripe.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/supabase.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/superhuman.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/taste-skill.md +1188 -208
- package/packages/shared-skills/skills/frontend/references/design/tesla.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/theverge.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/together.ai.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/uber.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/vercel.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/vodafone.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/voltagent.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/warp.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/webflow.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/wired.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/wise.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/x.ai.md +3 -0
- package/packages/shared-skills/skills/frontend/references/design/zapier.md +3 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/README.md +501 -115
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/charts.csv +26 -26
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/colors.csv +162 -97
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/icons.csv +105 -100
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/landing.csv +22 -18
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/products.csv +162 -97
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -53
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -56
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -53
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -54
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -54
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -51
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -50
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/styles.csv +17 -0
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/typography.csv +17 -1
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +162 -101
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/web-interface.csv +30 -30
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/core.py +31 -22
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/design_system.py +150 -69
- package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/search.py +3 -3
- package/packages/shared-skills/skills/lcx-doctor/SKILL.md +1 -1
- package/packages/shared-skills/skills/ultimate-browsing/ATTRIBUTION.md +105 -0
- package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +140 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/__init__.py +24 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/__main__.py +106 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/bias_check.py +174 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/curl_probe.py +91 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/executor.py +192 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/fetch_chain.py +268 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/referers.py +15 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/result_schema.py +45 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/summary.py +37 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/templates/package.json +11 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/templates/playwright_mobile_chrome.js +129 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/templates/playwright_real_chrome.js +167 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/tests/test_fetch_chain.py +77 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/tests/test_playwright_templates.py +282 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/url_transforms.py +98 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/validators.py +216 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/waf_detector.py +214 -0
- package/packages/shared-skills/skills/ultimate-browsing/engine/waf_profiles.yaml +162 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/README.md +79 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/career.md +29 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/dev.md +62 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/search.md +33 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/social.md +207 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/video.md +115 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/agent-reach/web.md +76 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/chrome-stealth.md +120 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/README.md +319 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/cache-archive.md +83 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/fallback.md +159 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/jina.md +130 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/json-api.md +133 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/media.md +123 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/metadata.md +116 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/naver.md +107 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/playwright.md +142 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/public-api.md +119 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/rss.md +123 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/tls-impersonate.md +186 -0
- package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/twitter.md +104 -0
- package/packages/shared-skills/skills/ultimate-browsing/scripts/cookie_crypto.py +75 -0
- package/packages/shared-skills/skills/ultimate-browsing/scripts/cookie_domains.py +38 -0
- package/packages/shared-skills/skills/ultimate-browsing/scripts/cookie_paths.py +112 -0
- package/packages/shared-skills/skills/ultimate-browsing/scripts/extract_cookies.py +280 -0
- package/packages/shared-skills/skills/ultimate-browsing/scripts/tests/test_cookie_domain_filter.py +110 -0
- package/packages/shared-skills/skills/ultimate-browsing/scripts/tests/test_extract_cookies.py +245 -0
- package/packages/shared-skills/skills/ultraresearch/ATTRIBUTION.md +49 -0
- package/packages/shared-skills/skills/ultraresearch/SKILL.md +23 -4
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +4 -1
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.d.ts +0 -2
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.d.ts +0 -32
package/dist/cli-node/index.js
CHANGED
|
@@ -2146,7 +2146,7 @@ var package_default;
|
|
|
2146
2146
|
var init_package = __esm(() => {
|
|
2147
2147
|
package_default = {
|
|
2148
2148
|
name: "oh-my-opencode",
|
|
2149
|
-
version: "4.
|
|
2149
|
+
version: "4.13.0",
|
|
2150
2150
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2151
2151
|
main: "./dist/index.js",
|
|
2152
2152
|
types: "dist/index.d.ts",
|
|
@@ -2227,7 +2227,8 @@ var init_package = __esm(() => {
|
|
|
2227
2227
|
"build:cli-node": "bun run script/build-cli-node.ts",
|
|
2228
2228
|
"build:codex-install": "bun run script/build-codex-install.ts",
|
|
2229
2229
|
"build:codex-plugin": "npm --prefix packages/omo-codex/plugin ci && bun run --cwd packages/omo-codex/plugin build",
|
|
2230
|
-
"build:
|
|
2230
|
+
"build:materialize-frontend": "node packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs --strict",
|
|
2231
|
+
"build:shared-skills-assets": "bun run build:materialize-frontend && rm -rf dist/skills && cp -R packages/shared-skills/skills dist/skills",
|
|
2231
2232
|
"build:lsp-tools-mcp": "npm --prefix packages/lsp-tools-mcp ci && npm --prefix packages/lsp-tools-mcp run build",
|
|
2232
2233
|
"build:lsp-daemon": "npm --prefix packages/lsp-daemon ci && npm --prefix packages/lsp-daemon run build",
|
|
2233
2234
|
"build:node-require-shim": "bun run script/patch-node-require-shim.ts",
|
|
@@ -2236,6 +2237,7 @@ var init_package = __esm(() => {
|
|
|
2236
2237
|
"build:schema": "bun run script/build-schema.ts",
|
|
2237
2238
|
"build:model-capabilities": "bun run script/build-model-capabilities.ts",
|
|
2238
2239
|
clean: "rm -rf dist",
|
|
2240
|
+
prepack: "bun run build:materialize-frontend",
|
|
2239
2241
|
prepare: "bun run build",
|
|
2240
2242
|
postinstall: "node postinstall.mjs",
|
|
2241
2243
|
prepublishOnly: "bun run clean && bun run build:lsp-tools-mcp && bun run build:lsp-daemon && bun run build",
|
|
@@ -2316,18 +2318,18 @@ var init_package = __esm(() => {
|
|
|
2316
2318
|
typescript: "^6.0.3"
|
|
2317
2319
|
},
|
|
2318
2320
|
optionalDependencies: {
|
|
2319
|
-
"oh-my-opencode-darwin-arm64": "4.
|
|
2320
|
-
"oh-my-opencode-darwin-x64": "4.
|
|
2321
|
-
"oh-my-opencode-darwin-x64-baseline": "4.
|
|
2322
|
-
"oh-my-opencode-linux-arm64": "4.
|
|
2323
|
-
"oh-my-opencode-linux-arm64-musl": "4.
|
|
2324
|
-
"oh-my-opencode-linux-x64": "4.
|
|
2325
|
-
"oh-my-opencode-linux-x64-baseline": "4.
|
|
2326
|
-
"oh-my-opencode-linux-x64-musl": "4.
|
|
2327
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.
|
|
2328
|
-
"oh-my-opencode-windows-arm64": "4.
|
|
2329
|
-
"oh-my-opencode-windows-x64": "4.
|
|
2330
|
-
"oh-my-opencode-windows-x64-baseline": "4.
|
|
2321
|
+
"oh-my-opencode-darwin-arm64": "4.13.0",
|
|
2322
|
+
"oh-my-opencode-darwin-x64": "4.13.0",
|
|
2323
|
+
"oh-my-opencode-darwin-x64-baseline": "4.13.0",
|
|
2324
|
+
"oh-my-opencode-linux-arm64": "4.13.0",
|
|
2325
|
+
"oh-my-opencode-linux-arm64-musl": "4.13.0",
|
|
2326
|
+
"oh-my-opencode-linux-x64": "4.13.0",
|
|
2327
|
+
"oh-my-opencode-linux-x64-baseline": "4.13.0",
|
|
2328
|
+
"oh-my-opencode-linux-x64-musl": "4.13.0",
|
|
2329
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.13.0",
|
|
2330
|
+
"oh-my-opencode-windows-arm64": "4.13.0",
|
|
2331
|
+
"oh-my-opencode-windows-x64": "4.13.0",
|
|
2332
|
+
"oh-my-opencode-windows-x64-baseline": "4.13.0"
|
|
2331
2333
|
},
|
|
2332
2334
|
overrides: {
|
|
2333
2335
|
hono: "^4.12.18",
|
|
@@ -7379,6 +7381,28 @@ var init_workspace = () => {};
|
|
|
7379
7381
|
var init_guidance = __esm(() => {
|
|
7380
7382
|
init_workspace();
|
|
7381
7383
|
});
|
|
7384
|
+
|
|
7385
|
+
// packages/utils/src/codegraph/node-support.ts
|
|
7386
|
+
function evaluateCodegraphNodeSupport(options = {}) {
|
|
7387
|
+
const nodeVersion = options.nodeVersion ?? process.versions.node;
|
|
7388
|
+
const env = options.env ?? process.env;
|
|
7389
|
+
const override = (env[CODEGRAPH_UNSAFE_NODE_ENV]?.trim().length ?? 0) > 0;
|
|
7390
|
+
const major = parseNodeMajor(nodeVersion);
|
|
7391
|
+
if (major >= CODEGRAPH_BLOCKED_NODE_MAJOR) {
|
|
7392
|
+
return { major, override, reason: "too-new", supported: override };
|
|
7393
|
+
}
|
|
7394
|
+
if (major < CODEGRAPH_MIN_NODE_MAJOR) {
|
|
7395
|
+
return { major, override, reason: "too-old", supported: override };
|
|
7396
|
+
}
|
|
7397
|
+
return { major, override, supported: true };
|
|
7398
|
+
}
|
|
7399
|
+
function parseNodeMajor(version) {
|
|
7400
|
+
const normalized = version.startsWith("v") ? version.slice(1) : version;
|
|
7401
|
+
const major = Number.parseInt(normalized.split(".")[0] ?? "", 10);
|
|
7402
|
+
return Number.isNaN(major) ? 0 : major;
|
|
7403
|
+
}
|
|
7404
|
+
var CODEGRAPH_MIN_NODE_MAJOR = 20, CODEGRAPH_BLOCKED_NODE_MAJOR = 25, CODEGRAPH_UNSAFE_NODE_ENV = "CODEGRAPH_ALLOW_UNSAFE_NODE", CODEGRAPH_NODE_BIN_ENV = "CODEGRAPH_NODE_BIN";
|
|
7405
|
+
|
|
7382
7406
|
// packages/utils/src/codegraph/manifest.ts
|
|
7383
7407
|
var init_manifest = () => {};
|
|
7384
7408
|
|
|
@@ -7392,10 +7416,85 @@ var init_provision = __esm(() => {
|
|
|
7392
7416
|
});
|
|
7393
7417
|
|
|
7394
7418
|
// packages/utils/src/codegraph/resolve.ts
|
|
7419
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
7420
|
+
import { spawnSync } from "node:child_process";
|
|
7421
|
+
import { basename as basename2, dirname as dirname2, join as join7 } from "node:path";
|
|
7395
7422
|
import { createRequire as createRequire2 } from "node:module";
|
|
7396
|
-
|
|
7423
|
+
function defaultNodeVersion(nodePath) {
|
|
7424
|
+
if (nodePath === process.execPath && isNodeExecutableName(nodePath))
|
|
7425
|
+
return process.versions.node;
|
|
7426
|
+
try {
|
|
7427
|
+
const result = spawnSync(nodePath, ["--version"], {
|
|
7428
|
+
encoding: "utf8",
|
|
7429
|
+
timeout: 2000,
|
|
7430
|
+
windowsHide: true
|
|
7431
|
+
});
|
|
7432
|
+
if (result.error !== undefined || result.status !== 0)
|
|
7433
|
+
return null;
|
|
7434
|
+
const version = `${result.stdout}
|
|
7435
|
+
${result.stderr}`.trim().split(/\s+/)[0];
|
|
7436
|
+
return version === undefined || version.length === 0 ? null : version;
|
|
7437
|
+
} catch (error) {
|
|
7438
|
+
if (error instanceof Error)
|
|
7439
|
+
return null;
|
|
7440
|
+
throw error;
|
|
7441
|
+
}
|
|
7442
|
+
}
|
|
7443
|
+
function isNodeExecutableName(filePath) {
|
|
7444
|
+
const executable = basename2(filePath).toLowerCase();
|
|
7445
|
+
return executable === "node" || executable === "node.exe" || /^node\d+(\.exe)?$/.test(executable);
|
|
7446
|
+
}
|
|
7447
|
+
function looksLikePath(command) {
|
|
7448
|
+
return command.includes("/") || command.includes("\\") || /^[a-zA-Z]:/.test(command);
|
|
7449
|
+
}
|
|
7450
|
+
function resolveConfiguredNodeRuntime(configured, fileExists, which2) {
|
|
7451
|
+
if (looksLikePath(configured))
|
|
7452
|
+
return fileExists(configured) ? configured : null;
|
|
7453
|
+
return which2(configured);
|
|
7454
|
+
}
|
|
7455
|
+
function supportsCodegraphNodeRuntime(nodePath, env, nodeVersion) {
|
|
7456
|
+
const version = nodeVersion(nodePath);
|
|
7457
|
+
if (version === null)
|
|
7458
|
+
return false;
|
|
7459
|
+
return evaluateCodegraphNodeSupport({ env, nodeVersion: version }).supported;
|
|
7460
|
+
}
|
|
7461
|
+
function defaultNodeRuntime(env, fileExists, which2, nodeVersion) {
|
|
7462
|
+
const configured = env[CODEGRAPH_NODE_BIN_ENV]?.trim();
|
|
7463
|
+
if (configured !== undefined && configured.length > 0) {
|
|
7464
|
+
const resolved = resolveConfiguredNodeRuntime(configured, fileExists, which2);
|
|
7465
|
+
return resolved !== null && supportsCodegraphNodeRuntime(resolved, env, nodeVersion) ? resolved : null;
|
|
7466
|
+
}
|
|
7467
|
+
const candidates = [
|
|
7468
|
+
...isNodeExecutableName(process.execPath) ? [process.execPath] : [],
|
|
7469
|
+
...CODEGRAPH_NODE_CANDIDATES.map((commandName) => which2(commandName)).filter((candidate) => candidate !== null)
|
|
7470
|
+
];
|
|
7471
|
+
const seen = new Set;
|
|
7472
|
+
for (const candidate of candidates) {
|
|
7473
|
+
if (seen.has(candidate))
|
|
7474
|
+
continue;
|
|
7475
|
+
seen.add(candidate);
|
|
7476
|
+
if (supportsCodegraphNodeRuntime(candidate, env, nodeVersion))
|
|
7477
|
+
return candidate;
|
|
7478
|
+
}
|
|
7479
|
+
return null;
|
|
7480
|
+
}
|
|
7481
|
+
function resolveCodegraphNodeRuntime(options = {}) {
|
|
7482
|
+
const env = options.env ?? process.env;
|
|
7483
|
+
return defaultNodeRuntime(env, options.fileExists ?? existsSync7, options.which ?? bunWhich, options.nodeVersion ?? defaultNodeVersion);
|
|
7484
|
+
}
|
|
7485
|
+
function resolveCodegraphNodeSupport(options = {}) {
|
|
7486
|
+
const env = options.env ?? process.env;
|
|
7487
|
+
const nodeVersion = options.nodeVersion ?? defaultNodeVersion;
|
|
7488
|
+
const runtime3 = resolveCodegraphNodeRuntime({ ...options, env, nodeVersion });
|
|
7489
|
+
if (runtime3 === null) {
|
|
7490
|
+
return evaluateCodegraphNodeSupport({ env, nodeVersion: "0.0.0" });
|
|
7491
|
+
}
|
|
7492
|
+
return evaluateCodegraphNodeSupport({ env, nodeVersion: nodeVersion(runtime3) ?? "0.0.0" });
|
|
7493
|
+
}
|
|
7494
|
+
var CODEGRAPH_NODE_CANDIDATES, requireFromHere;
|
|
7397
7495
|
var init_resolve2 = __esm(() => {
|
|
7398
7496
|
init_which();
|
|
7497
|
+
CODEGRAPH_NODE_CANDIDATES = ["node24", "node22", "node20", "node"];
|
|
7399
7498
|
requireFromHere = createRequire2(import.meta.url);
|
|
7400
7499
|
});
|
|
7401
7500
|
|
|
@@ -9941,6 +10040,11 @@ var init_runtime_fallback_error_classifier = __esm(() => {
|
|
|
9941
10040
|
init_runtime_fallback_error_shape();
|
|
9942
10041
|
});
|
|
9943
10042
|
|
|
10043
|
+
// packages/model-core/src/provider-exhaustion-fallback-policy.ts
|
|
10044
|
+
var init_provider_exhaustion_fallback_policy = __esm(() => {
|
|
10045
|
+
init_runtime_fallback_error_classifier();
|
|
10046
|
+
});
|
|
10047
|
+
|
|
9944
10048
|
// packages/model-core/src/runtime-fallback-model.ts
|
|
9945
10049
|
var init_runtime_fallback_model = __esm(() => {
|
|
9946
10050
|
init_model_string_parser();
|
|
@@ -10369,6 +10473,7 @@ var init_src2 = __esm(() => {
|
|
|
10369
10473
|
init_runtime_fallback_auto_retry_signal();
|
|
10370
10474
|
init_runtime_fallback_error_classifier();
|
|
10371
10475
|
init_runtime_fallback_error_shape();
|
|
10476
|
+
init_provider_exhaustion_fallback_policy();
|
|
10372
10477
|
init_runtime_fallback_model();
|
|
10373
10478
|
init_model_capabilities();
|
|
10374
10479
|
init_context_limit_resolver();
|
|
@@ -10980,9 +11085,9 @@ var init_migration2 = __esm(() => {
|
|
|
10980
11085
|
});
|
|
10981
11086
|
|
|
10982
11087
|
// packages/omo-opencode/src/shared/opencode-config-dir.ts
|
|
10983
|
-
import { existsSync as
|
|
11088
|
+
import { existsSync as existsSync9, realpathSync as realpathSync3 } from "node:fs";
|
|
10984
11089
|
import { homedir as homedir3 } from "node:os";
|
|
10985
|
-
import { join as
|
|
11090
|
+
import { join as join9, posix, resolve as resolve4, win32 } from "node:path";
|
|
10986
11091
|
function isDevBuild(version) {
|
|
10987
11092
|
if (!version)
|
|
10988
11093
|
return false;
|
|
@@ -10992,15 +11097,15 @@ function getTauriConfigDir(identifier) {
|
|
|
10992
11097
|
const platform = process.platform;
|
|
10993
11098
|
switch (platform) {
|
|
10994
11099
|
case "darwin":
|
|
10995
|
-
return
|
|
11100
|
+
return join9(homedir3(), "Library", "Application Support", identifier);
|
|
10996
11101
|
case "win32": {
|
|
10997
|
-
const appData = process.env.APPDATA ||
|
|
11102
|
+
const appData = process.env.APPDATA || join9(homedir3(), "AppData", "Roaming");
|
|
10998
11103
|
return win32.join(appData, identifier);
|
|
10999
11104
|
}
|
|
11000
11105
|
case "linux":
|
|
11001
11106
|
default: {
|
|
11002
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
11003
|
-
return
|
|
11107
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join9(homedir3(), ".config");
|
|
11108
|
+
return join9(xdgConfig, identifier);
|
|
11004
11109
|
}
|
|
11005
11110
|
}
|
|
11006
11111
|
}
|
|
@@ -11009,7 +11114,7 @@ function resolveConfigPath(pathValue) {
|
|
|
11009
11114
|
return posix.normalize(pathValue);
|
|
11010
11115
|
}
|
|
11011
11116
|
const resolvedPath = resolve4(pathValue);
|
|
11012
|
-
if (!
|
|
11117
|
+
if (!existsSync9(resolvedPath))
|
|
11013
11118
|
return resolvedPath;
|
|
11014
11119
|
try {
|
|
11015
11120
|
return realpathSync3(resolvedPath);
|
|
@@ -11043,8 +11148,8 @@ function getWslLinuxHomeDir(windowsConfigRoot) {
|
|
|
11043
11148
|
function getCliDefaultConfigDir() {
|
|
11044
11149
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
11045
11150
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment() && isWindowsUserConfigRoot(envXdgConfig);
|
|
11046
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix.join(getWslLinuxHomeDir(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
11047
|
-
const configDir = isWslEnvironment() ? posix.join(xdgConfig, "opencode") :
|
|
11151
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix.join(getWslLinuxHomeDir(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join9(homedir3(), ".config");
|
|
11152
|
+
const configDir = isWslEnvironment() ? posix.join(xdgConfig, "opencode") : join9(xdgConfig, "opencode");
|
|
11048
11153
|
return resolveConfigPath(configDir);
|
|
11049
11154
|
}
|
|
11050
11155
|
function getCliCustomConfigDir() {
|
|
@@ -11077,9 +11182,9 @@ function getOpenCodeConfigDir(options) {
|
|
|
11077
11182
|
const tauriDir = process.platform === "win32" ? win32.isAbsolute(tauriDirBase) ? win32.normalize(tauriDirBase) : win32.resolve(tauriDirBase) : resolveConfigPath(tauriDirBase);
|
|
11078
11183
|
if (checkExisting) {
|
|
11079
11184
|
const legacyDir = getCliConfigDir();
|
|
11080
|
-
const legacyConfig =
|
|
11081
|
-
const legacyConfigC =
|
|
11082
|
-
if (
|
|
11185
|
+
const legacyConfig = join9(legacyDir, "opencode.json");
|
|
11186
|
+
const legacyConfigC = join9(legacyDir, "opencode.jsonc");
|
|
11187
|
+
if (existsSync9(legacyConfig) || existsSync9(legacyConfigC)) {
|
|
11083
11188
|
return legacyDir;
|
|
11084
11189
|
}
|
|
11085
11190
|
}
|
|
@@ -11089,10 +11194,10 @@ function getOpenCodeConfigPaths(options) {
|
|
|
11089
11194
|
const configDir = getOpenCodeConfigDir(options);
|
|
11090
11195
|
return {
|
|
11091
11196
|
configDir,
|
|
11092
|
-
configJson:
|
|
11093
|
-
configJsonc:
|
|
11094
|
-
packageJson:
|
|
11095
|
-
omoConfig:
|
|
11197
|
+
configJson: join9(configDir, "opencode.json"),
|
|
11198
|
+
configJsonc: join9(configDir, "opencode.jsonc"),
|
|
11199
|
+
packageJson: join9(configDir, "package.json"),
|
|
11200
|
+
omoConfig: join9(configDir, `${CONFIG_BASENAME}.json`)
|
|
11096
11201
|
};
|
|
11097
11202
|
}
|
|
11098
11203
|
var TAURI_APP_IDENTIFIER = "ai.opencode.desktop", TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
|
|
@@ -11102,10 +11207,10 @@ var init_opencode_config_dir = __esm(() => {
|
|
|
11102
11207
|
|
|
11103
11208
|
// packages/omo-opencode/src/shared/resolve-agent-definition-paths.ts
|
|
11104
11209
|
import { homedir as homedir4 } from "os";
|
|
11105
|
-
import { isAbsolute as isAbsolute2, join as
|
|
11210
|
+
import { isAbsolute as isAbsolute2, join as join10, resolve as resolve5 } from "path";
|
|
11106
11211
|
function resolveAgentDefinitionPaths(paths, baseDir, containmentDir) {
|
|
11107
11212
|
return paths.flatMap((p) => {
|
|
11108
|
-
const expanded = p.startsWith("~/") ?
|
|
11213
|
+
const expanded = p.startsWith("~/") ? join10(homedir4(), p.slice(2)) : p;
|
|
11109
11214
|
const resolved = isAbsolute2(expanded) ? expanded : resolve5(baseDir, expanded);
|
|
11110
11215
|
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
11111
11216
|
log2(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
@@ -11121,8 +11226,8 @@ var init_resolve_agent_definition_paths = __esm(() => {
|
|
|
11121
11226
|
|
|
11122
11227
|
// packages/omo-opencode/src/shared/opencode-version.ts
|
|
11123
11228
|
import { execSync } from "child_process";
|
|
11124
|
-
import { existsSync as
|
|
11125
|
-
import { dirname as
|
|
11229
|
+
import { existsSync as existsSync10, readFileSync as readFileSync4, realpathSync as realpathSync4 } from "fs";
|
|
11230
|
+
import { dirname as dirname4, join as join11 } from "path";
|
|
11126
11231
|
function parseVersion(version) {
|
|
11127
11232
|
const cleaned = version.replace(/^v/, "").split("-")[0];
|
|
11128
11233
|
return cleaned.split(".").map((n) => parseInt(n, 10) || 0);
|
|
@@ -11163,7 +11268,7 @@ function parsePackageVersion(content) {
|
|
|
11163
11268
|
function getPackageVersionFromBinary(binaryPath, deps) {
|
|
11164
11269
|
try {
|
|
11165
11270
|
const realBinaryPath = deps.realpath(binaryPath);
|
|
11166
|
-
const packagePath =
|
|
11271
|
+
const packagePath = join11(dirname4(dirname4(realBinaryPath)), "package.json");
|
|
11167
11272
|
if (!deps.exists(packagePath))
|
|
11168
11273
|
return null;
|
|
11169
11274
|
return parsePackageVersion(deps.readText(packagePath));
|
|
@@ -11223,15 +11328,15 @@ var init_opencode_version = __esm(() => {
|
|
|
11223
11328
|
return envPath;
|
|
11224
11329
|
return globalThis.Bun?.which("opencode") ?? null;
|
|
11225
11330
|
},
|
|
11226
|
-
exists:
|
|
11331
|
+
exists: existsSync10,
|
|
11227
11332
|
realpath: realpathSync4,
|
|
11228
11333
|
readText: (filePath) => readFileSync4(filePath, "utf-8")
|
|
11229
11334
|
};
|
|
11230
11335
|
});
|
|
11231
11336
|
|
|
11232
11337
|
// packages/omo-opencode/src/shared/opencode-storage-detection.ts
|
|
11233
|
-
import { existsSync as
|
|
11234
|
-
import { join as
|
|
11338
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
11339
|
+
import { join as join12 } from "node:path";
|
|
11235
11340
|
function isSqliteBackend() {
|
|
11236
11341
|
if (cachedResult === true)
|
|
11237
11342
|
return true;
|
|
@@ -11239,8 +11344,8 @@ function isSqliteBackend() {
|
|
|
11239
11344
|
return false;
|
|
11240
11345
|
const check = () => {
|
|
11241
11346
|
const versionOk = isOpenCodeVersionAtLeast(OPENCODE_SQLITE_VERSION);
|
|
11242
|
-
const dbPath =
|
|
11243
|
-
return versionOk &&
|
|
11347
|
+
const dbPath = join12(getDataDir(), "opencode", "opencode.db");
|
|
11348
|
+
return versionOk && existsSync11(dbPath);
|
|
11244
11349
|
};
|
|
11245
11350
|
if (cachedResult === FALSE_PENDING_RETRY) {
|
|
11246
11351
|
const result2 = check();
|
|
@@ -11309,11 +11414,11 @@ var init_bun_file_shim = __esm(() => {
|
|
|
11309
11414
|
});
|
|
11310
11415
|
|
|
11311
11416
|
// packages/omo-opencode/src/shared/binary-downloader.ts
|
|
11312
|
-
import { chmodSync, existsSync as
|
|
11417
|
+
import { chmodSync, existsSync as existsSync12, mkdirSync as mkdirSync4, unlinkSync as unlinkSync3 } from "node:fs";
|
|
11313
11418
|
import * as path6 from "node:path";
|
|
11314
11419
|
function getCachedBinaryPath(cacheDir, binaryName) {
|
|
11315
11420
|
const binaryPath = path6.join(cacheDir, binaryName);
|
|
11316
|
-
return
|
|
11421
|
+
return existsSync12(binaryPath) ? binaryPath : null;
|
|
11317
11422
|
}
|
|
11318
11423
|
var init_binary_downloader = __esm(() => {
|
|
11319
11424
|
init_bun_spawn_shim();
|
|
@@ -11481,8 +11586,8 @@ var init_agent_tool_restrictions = __esm(() => {
|
|
|
11481
11586
|
});
|
|
11482
11587
|
|
|
11483
11588
|
// packages/omo-opencode/src/shared/json-file-cache-store.ts
|
|
11484
|
-
import { existsSync as
|
|
11485
|
-
import { join as
|
|
11589
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
|
|
11590
|
+
import { join as join14 } from "node:path";
|
|
11486
11591
|
function toLogLabel(cacheLabel) {
|
|
11487
11592
|
return cacheLabel.toLowerCase();
|
|
11488
11593
|
}
|
|
@@ -11490,11 +11595,11 @@ function createJsonFileCacheStore(options) {
|
|
|
11490
11595
|
let memoryValue;
|
|
11491
11596
|
let writtenInCurrentProcess = false;
|
|
11492
11597
|
function getCacheFilePath() {
|
|
11493
|
-
return
|
|
11598
|
+
return join14(options.getCacheDir(), options.filename);
|
|
11494
11599
|
}
|
|
11495
11600
|
function ensureCacheDir() {
|
|
11496
11601
|
const cacheDir = options.getCacheDir();
|
|
11497
|
-
if (!
|
|
11602
|
+
if (!existsSync13(cacheDir)) {
|
|
11498
11603
|
mkdirSync5(cacheDir, { recursive: true });
|
|
11499
11604
|
}
|
|
11500
11605
|
}
|
|
@@ -11503,7 +11608,7 @@ function createJsonFileCacheStore(options) {
|
|
|
11503
11608
|
return memoryValue;
|
|
11504
11609
|
}
|
|
11505
11610
|
const cacheFile = getCacheFilePath();
|
|
11506
|
-
if (!
|
|
11611
|
+
if (!existsSync13(cacheFile)) {
|
|
11507
11612
|
memoryValue = null;
|
|
11508
11613
|
log2(`[${options.logPrefix}] ${options.cacheLabel} file not found`, { cacheFile });
|
|
11509
11614
|
return null;
|
|
@@ -11529,7 +11634,7 @@ function createJsonFileCacheStore(options) {
|
|
|
11529
11634
|
if (writtenInCurrentProcess) {
|
|
11530
11635
|
return true;
|
|
11531
11636
|
}
|
|
11532
|
-
return
|
|
11637
|
+
return existsSync13(getCacheFilePath());
|
|
11533
11638
|
}
|
|
11534
11639
|
function write(value) {
|
|
11535
11640
|
ensureCacheDir();
|
|
@@ -11772,14 +11877,14 @@ var init_model_resolution_pipeline2 = __esm(() => {
|
|
|
11772
11877
|
});
|
|
11773
11878
|
|
|
11774
11879
|
// packages/omo-opencode/src/shared/model-availability.ts
|
|
11775
|
-
import { existsSync as
|
|
11776
|
-
import { join as
|
|
11880
|
+
import { existsSync as existsSync14, readFileSync as readFileSync6 } from "fs";
|
|
11881
|
+
import { join as join15 } from "path";
|
|
11777
11882
|
function isModelCacheAvailable() {
|
|
11778
11883
|
if (hasProviderModelsCache()) {
|
|
11779
11884
|
return true;
|
|
11780
11885
|
}
|
|
11781
|
-
const cacheFile =
|
|
11782
|
-
return
|
|
11886
|
+
const cacheFile = join15(getOpenCodeCacheDir(), "models.json");
|
|
11887
|
+
return existsSync14(cacheFile);
|
|
11783
11888
|
}
|
|
11784
11889
|
var init_model_availability = __esm(() => {
|
|
11785
11890
|
init_logger2();
|
|
@@ -54203,19 +54308,19 @@ var init_fallback_model_availability = __esm(() => {
|
|
|
54203
54308
|
});
|
|
54204
54309
|
|
|
54205
54310
|
// packages/omo-opencode/src/shared/opencode-storage-paths.ts
|
|
54206
|
-
import { join as
|
|
54311
|
+
import { join as join16 } from "node:path";
|
|
54207
54312
|
var OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE, SESSION_STORAGE;
|
|
54208
54313
|
var init_opencode_storage_paths = __esm(() => {
|
|
54209
54314
|
init_data_path();
|
|
54210
54315
|
OPENCODE_STORAGE = getOpenCodeStorageDir();
|
|
54211
|
-
MESSAGE_STORAGE =
|
|
54212
|
-
PART_STORAGE =
|
|
54213
|
-
SESSION_STORAGE =
|
|
54316
|
+
MESSAGE_STORAGE = join16(OPENCODE_STORAGE, "message");
|
|
54317
|
+
PART_STORAGE = join16(OPENCODE_STORAGE, "part");
|
|
54318
|
+
SESSION_STORAGE = join16(OPENCODE_STORAGE, "session");
|
|
54214
54319
|
});
|
|
54215
54320
|
|
|
54216
54321
|
// packages/omo-opencode/src/shared/compaction-marker.ts
|
|
54217
|
-
import { existsSync as
|
|
54218
|
-
import { join as
|
|
54322
|
+
import { existsSync as existsSync15, readdirSync, readFileSync as readFileSync7 } from "node:fs";
|
|
54323
|
+
import { join as join17 } from "node:path";
|
|
54219
54324
|
function isCompactionPart(part) {
|
|
54220
54325
|
return typeof part === "object" && part !== null && part.type === "compaction";
|
|
54221
54326
|
}
|
|
@@ -54229,20 +54334,20 @@ function isCompactionMessage(message) {
|
|
|
54229
54334
|
return isCompactionAgent(message.info?.agent ?? message.agent) || hasCompactionPart(message.parts);
|
|
54230
54335
|
}
|
|
54231
54336
|
function getCompactionPartStorageDir(messageID) {
|
|
54232
|
-
return
|
|
54337
|
+
return join17(PART_STORAGE, messageID);
|
|
54233
54338
|
}
|
|
54234
54339
|
function hasCompactionPartInStorage(messageID) {
|
|
54235
54340
|
if (!messageID) {
|
|
54236
54341
|
return false;
|
|
54237
54342
|
}
|
|
54238
54343
|
const partDir = getCompactionPartStorageDir(messageID);
|
|
54239
|
-
if (!
|
|
54344
|
+
if (!existsSync15(partDir)) {
|
|
54240
54345
|
return false;
|
|
54241
54346
|
}
|
|
54242
54347
|
try {
|
|
54243
54348
|
return readdirSync(partDir).filter((fileName) => fileName.endsWith(".json")).some((fileName) => {
|
|
54244
54349
|
try {
|
|
54245
|
-
const content = readFileSync7(
|
|
54350
|
+
const content = readFileSync7(join17(partDir, fileName), "utf-8");
|
|
54246
54351
|
return isCompactionPart(JSON.parse(content));
|
|
54247
54352
|
} catch (error) {
|
|
54248
54353
|
if (error instanceof Error) {
|
|
@@ -54342,23 +54447,23 @@ var init_hook_message_injector = __esm(() => {
|
|
|
54342
54447
|
});
|
|
54343
54448
|
|
|
54344
54449
|
// packages/omo-opencode/src/shared/opencode-message-dir.ts
|
|
54345
|
-
import { existsSync as
|
|
54346
|
-
import { join as
|
|
54450
|
+
import { existsSync as existsSync16, readdirSync as readdirSync2 } from "node:fs";
|
|
54451
|
+
import { join as join18 } from "node:path";
|
|
54347
54452
|
function getMessageDir(sessionID) {
|
|
54348
54453
|
if (!sessionID.startsWith("ses_"))
|
|
54349
54454
|
return null;
|
|
54350
54455
|
if (/[/\\]|\.\./.test(sessionID))
|
|
54351
54456
|
return null;
|
|
54352
|
-
if (!
|
|
54457
|
+
if (!existsSync16(MESSAGE_STORAGE))
|
|
54353
54458
|
return null;
|
|
54354
|
-
const directPath =
|
|
54355
|
-
if (
|
|
54459
|
+
const directPath = join18(MESSAGE_STORAGE, sessionID);
|
|
54460
|
+
if (existsSync16(directPath)) {
|
|
54356
54461
|
return directPath;
|
|
54357
54462
|
}
|
|
54358
54463
|
try {
|
|
54359
54464
|
for (const dir of readdirSync2(MESSAGE_STORAGE)) {
|
|
54360
|
-
const sessionPath =
|
|
54361
|
-
if (
|
|
54465
|
+
const sessionPath = join18(MESSAGE_STORAGE, dir, sessionID);
|
|
54466
|
+
if (existsSync16(sessionPath)) {
|
|
54362
54467
|
return sessionPath;
|
|
54363
54468
|
}
|
|
54364
54469
|
}
|
|
@@ -56492,7 +56597,7 @@ var require_cross_spawn = __commonJS((exports, module) => {
|
|
|
56492
56597
|
enoent.hookChildProcess(spawned, parsed);
|
|
56493
56598
|
return spawned;
|
|
56494
56599
|
}
|
|
56495
|
-
function
|
|
56600
|
+
function spawnSync3(command, args, options) {
|
|
56496
56601
|
const parsed = parse3(command, args, options);
|
|
56497
56602
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
56498
56603
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
@@ -56500,18 +56605,18 @@ var require_cross_spawn = __commonJS((exports, module) => {
|
|
|
56500
56605
|
}
|
|
56501
56606
|
module.exports = spawn4;
|
|
56502
56607
|
module.exports.spawn = spawn4;
|
|
56503
|
-
module.exports.sync =
|
|
56608
|
+
module.exports.sync = spawnSync3;
|
|
56504
56609
|
module.exports._parse = parse3;
|
|
56505
56610
|
module.exports._enoent = enoent;
|
|
56506
56611
|
});
|
|
56507
56612
|
|
|
56508
56613
|
// node_modules/.bun/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/process.js
|
|
56509
|
-
import { spawnSync as
|
|
56614
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
56510
56615
|
function stop(proc) {
|
|
56511
56616
|
if (proc.exitCode !== null || proc.signalCode !== null)
|
|
56512
56617
|
return;
|
|
56513
56618
|
if (process.platform === "win32" && proc.pid) {
|
|
56514
|
-
const out =
|
|
56619
|
+
const out = spawnSync3("taskkill", ["/pid", String(proc.pid), "/T", "/F"], { windowsHide: true });
|
|
56515
56620
|
if (!out.error && out.status === 0)
|
|
56516
56621
|
return;
|
|
56517
56622
|
}
|
|
@@ -57018,11 +57123,11 @@ var init_opencode_command_dirs = __esm(() => {
|
|
|
57018
57123
|
});
|
|
57019
57124
|
|
|
57020
57125
|
// packages/omo-opencode/src/shared/project-discovery-dirs.ts
|
|
57021
|
-
import { existsSync as
|
|
57022
|
-
import { dirname as
|
|
57126
|
+
import { existsSync as existsSync17, realpathSync as realpathSync5 } from "node:fs";
|
|
57127
|
+
import { dirname as dirname5, join as join19, resolve as resolve6, win32 as win322 } from "node:path";
|
|
57023
57128
|
function normalizePath(path7) {
|
|
57024
57129
|
const resolvedPath = process.platform !== "win32" && win322.isAbsolute(path7) ? path7 : resolve6(path7);
|
|
57025
|
-
if (!
|
|
57130
|
+
if (!existsSync17(resolvedPath)) {
|
|
57026
57131
|
return resolvedPath;
|
|
57027
57132
|
}
|
|
57028
57133
|
try {
|
|
@@ -57052,8 +57157,8 @@ function findProjectOpencodePluginConfigFiles(startDirectory, stopDirectory) {
|
|
|
57052
57157
|
const resolvedStopDirectory = stopDirectory ? normalizePath(stopDirectory) : undefined;
|
|
57053
57158
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey(resolvedStopDirectory) : undefined;
|
|
57054
57159
|
while (true) {
|
|
57055
|
-
const opencodeDirectory =
|
|
57056
|
-
if (
|
|
57160
|
+
const opencodeDirectory = join19(currentDirectory, ".opencode");
|
|
57161
|
+
if (existsSync17(opencodeDirectory)) {
|
|
57057
57162
|
const detected = detectPluginConfigFile(opencodeDirectory, {
|
|
57058
57163
|
basenames: [CONFIG_BASENAME],
|
|
57059
57164
|
legacyBasenames: [LEGACY_CONFIG_BASENAME]
|
|
@@ -57069,7 +57174,7 @@ function findProjectOpencodePluginConfigFiles(startDirectory, stopDirectory) {
|
|
|
57069
57174
|
if (stopDirectoryKey === pathKey(currentDirectory)) {
|
|
57070
57175
|
return paths;
|
|
57071
57176
|
}
|
|
57072
|
-
const parentDirectory =
|
|
57177
|
+
const parentDirectory = dirname5(currentDirectory);
|
|
57073
57178
|
if (parentDirectory === currentDirectory) {
|
|
57074
57179
|
return paths;
|
|
57075
57180
|
}
|
|
@@ -57610,17 +57715,17 @@ var init_plugin_name_with_version = __esm(() => {
|
|
|
57610
57715
|
});
|
|
57611
57716
|
|
|
57612
57717
|
// packages/omo-opencode/src/cli/config-manager/backup-config.ts
|
|
57613
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
57614
|
-
import { dirname as
|
|
57718
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync18, mkdirSync as mkdirSync6 } from "node:fs";
|
|
57719
|
+
import { dirname as dirname6 } from "node:path";
|
|
57615
57720
|
function backupConfigFile(configPath) {
|
|
57616
|
-
if (!
|
|
57721
|
+
if (!existsSync18(configPath)) {
|
|
57617
57722
|
return { success: true };
|
|
57618
57723
|
}
|
|
57619
57724
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
57620
57725
|
const backupPath = `${configPath}.backup-${timestamp}`;
|
|
57621
57726
|
try {
|
|
57622
|
-
const dir =
|
|
57623
|
-
if (!
|
|
57727
|
+
const dir = dirname6(backupPath);
|
|
57728
|
+
if (!existsSync18(dir)) {
|
|
57624
57729
|
mkdirSync6(dir, { recursive: true });
|
|
57625
57730
|
}
|
|
57626
57731
|
copyFileSync2(configPath, backupPath);
|
|
@@ -57635,10 +57740,10 @@ function backupConfigFile(configPath) {
|
|
|
57635
57740
|
var init_backup_config = () => {};
|
|
57636
57741
|
|
|
57637
57742
|
// packages/omo-opencode/src/cli/config-manager/ensure-config-directory-exists.ts
|
|
57638
|
-
import { existsSync as
|
|
57743
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync7 } from "node:fs";
|
|
57639
57744
|
function ensureConfigDirectoryExists() {
|
|
57640
57745
|
const configDir = getConfigDir();
|
|
57641
|
-
if (!
|
|
57746
|
+
if (!existsSync19(configDir)) {
|
|
57642
57747
|
mkdirSync7(configDir, { recursive: true });
|
|
57643
57748
|
}
|
|
57644
57749
|
}
|
|
@@ -57676,14 +57781,14 @@ function formatErrorWithSuggestion(err, context) {
|
|
|
57676
57781
|
}
|
|
57677
57782
|
|
|
57678
57783
|
// packages/omo-opencode/src/cli/config-manager/opencode-config-format.ts
|
|
57679
|
-
import { existsSync as
|
|
57784
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
57680
57785
|
function detectConfigFormat() {
|
|
57681
57786
|
const configJsonc = getConfigJsonc();
|
|
57682
57787
|
const configJson = getConfigJson();
|
|
57683
|
-
if (
|
|
57788
|
+
if (existsSync20(configJsonc)) {
|
|
57684
57789
|
return { format: "jsonc", path: configJsonc };
|
|
57685
57790
|
}
|
|
57686
|
-
if (
|
|
57791
|
+
if (existsSync20(configJson)) {
|
|
57687
57792
|
return { format: "json", path: configJson };
|
|
57688
57793
|
}
|
|
57689
57794
|
return { format: "none", path: configJson };
|
|
@@ -57816,30 +57921,30 @@ function extractVersionFromPluginEntry(entry) {
|
|
|
57816
57921
|
}
|
|
57817
57922
|
|
|
57818
57923
|
// packages/omo-opencode/src/cli/config-manager/add-plugin-to-opencode-config.ts
|
|
57819
|
-
import { existsSync as
|
|
57820
|
-
import { basename as
|
|
57924
|
+
import { existsSync as existsSync21, readdirSync as readdirSync3, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "node:fs";
|
|
57925
|
+
import { basename as basename3, dirname as dirname7, join as join20 } from "node:path";
|
|
57821
57926
|
function detectConfigFormatInDir(configDir) {
|
|
57822
|
-
const configJsonc =
|
|
57823
|
-
const configJson =
|
|
57824
|
-
if (
|
|
57927
|
+
const configJsonc = join20(configDir, "opencode.jsonc");
|
|
57928
|
+
const configJson = join20(configDir, "opencode.json");
|
|
57929
|
+
if (existsSync21(configJsonc)) {
|
|
57825
57930
|
return { format: "jsonc", path: configJsonc };
|
|
57826
57931
|
}
|
|
57827
|
-
if (
|
|
57932
|
+
if (existsSync21(configJson)) {
|
|
57828
57933
|
return { format: "json", path: configJson };
|
|
57829
57934
|
}
|
|
57830
57935
|
return { format: "none", path: configJson };
|
|
57831
57936
|
}
|
|
57832
57937
|
function getParentConfigDirForProfile(configDir) {
|
|
57833
|
-
const parentDir =
|
|
57834
|
-
if (
|
|
57938
|
+
const parentDir = dirname7(configDir);
|
|
57939
|
+
if (basename3(parentDir) !== "profiles")
|
|
57835
57940
|
return null;
|
|
57836
|
-
return
|
|
57941
|
+
return dirname7(parentDir);
|
|
57837
57942
|
}
|
|
57838
57943
|
function listProfileConfigDirs(rootConfigDir) {
|
|
57839
|
-
const profilesDir =
|
|
57840
|
-
if (!
|
|
57944
|
+
const profilesDir = join20(rootConfigDir, "profiles");
|
|
57945
|
+
if (!existsSync21(profilesDir))
|
|
57841
57946
|
return [];
|
|
57842
|
-
return readdirSync3(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
57947
|
+
return readdirSync3(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join20(profilesDir, entry.name)).filter((profileDir) => detectConfigFormatInDir(profileDir).format !== "none");
|
|
57843
57948
|
}
|
|
57844
57949
|
function getConfigTargets() {
|
|
57845
57950
|
const primaryConfigDir = getConfigDir();
|
|
@@ -58339,12 +58444,12 @@ var init_migrations_sidecar2 = __esm(() => {
|
|
|
58339
58444
|
});
|
|
58340
58445
|
|
|
58341
58446
|
// packages/omo-opencode/src/shared/migrate-legacy-config-file.ts
|
|
58342
|
-
import { existsSync as
|
|
58343
|
-
import { join as
|
|
58447
|
+
import { existsSync as existsSync22, readFileSync as readFileSync10, renameSync as renameSync4, rmSync } from "node:fs";
|
|
58448
|
+
import { join as join21, dirname as dirname8, basename as basename4 } from "node:path";
|
|
58344
58449
|
function buildCanonicalPath(legacyPath) {
|
|
58345
|
-
const dir =
|
|
58346
|
-
const ext =
|
|
58347
|
-
return
|
|
58450
|
+
const dir = dirname8(legacyPath);
|
|
58451
|
+
const ext = basename4(legacyPath).includes(".jsonc") ? ".jsonc" : ".json";
|
|
58452
|
+
return join21(dir, `${CONFIG_BASENAME}${ext}`);
|
|
58348
58453
|
}
|
|
58349
58454
|
function archiveLegacyConfigFile(legacyPath) {
|
|
58350
58455
|
const backupPath = `${legacyPath}.bak`;
|
|
@@ -58377,10 +58482,10 @@ function archiveLegacyConfigFile(legacyPath) {
|
|
|
58377
58482
|
}
|
|
58378
58483
|
function migrateLegacySidecarFile(legacyPath, canonicalPath) {
|
|
58379
58484
|
const legacySidecarPath = getSidecarPath(legacyPath);
|
|
58380
|
-
if (!
|
|
58485
|
+
if (!existsSync22(legacySidecarPath))
|
|
58381
58486
|
return true;
|
|
58382
58487
|
const canonicalSidecarPath = getSidecarPath(canonicalPath);
|
|
58383
|
-
if (
|
|
58488
|
+
if (existsSync22(canonicalSidecarPath))
|
|
58384
58489
|
return true;
|
|
58385
58490
|
try {
|
|
58386
58491
|
const content = readFileSync10(legacySidecarPath, "utf-8");
|
|
@@ -58400,12 +58505,12 @@ function migrateLegacySidecarFile(legacyPath, canonicalPath) {
|
|
|
58400
58505
|
}
|
|
58401
58506
|
}
|
|
58402
58507
|
function migrateLegacyConfigFile(legacyPath) {
|
|
58403
|
-
if (!
|
|
58508
|
+
if (!existsSync22(legacyPath))
|
|
58404
58509
|
return false;
|
|
58405
|
-
if (!
|
|
58510
|
+
if (!basename4(legacyPath).startsWith(LEGACY_CONFIG_BASENAME))
|
|
58406
58511
|
return false;
|
|
58407
58512
|
const canonicalPath = buildCanonicalPath(legacyPath);
|
|
58408
|
-
if (
|
|
58513
|
+
if (existsSync22(canonicalPath))
|
|
58409
58514
|
return false;
|
|
58410
58515
|
try {
|
|
58411
58516
|
const content = readFileSync10(legacyPath, "utf-8");
|
|
@@ -58449,8 +58554,8 @@ function deepMergeRecord(target, source) {
|
|
|
58449
58554
|
}
|
|
58450
58555
|
|
|
58451
58556
|
// packages/omo-opencode/src/cli/config-manager/write-omo-config.ts
|
|
58452
|
-
import { existsSync as
|
|
58453
|
-
import { basename as
|
|
58557
|
+
import { existsSync as existsSync23, readFileSync as readFileSync11, statSync as statSync4, writeFileSync as writeFileSync5 } from "node:fs";
|
|
58558
|
+
import { basename as basename5, dirname as dirname9, extname, join as join22 } from "node:path";
|
|
58454
58559
|
function isEmptyOrWhitespace2(content) {
|
|
58455
58560
|
return content.trim().length === 0;
|
|
58456
58561
|
}
|
|
@@ -58465,12 +58570,12 @@ function writeOmoConfig(installConfig) {
|
|
|
58465
58570
|
};
|
|
58466
58571
|
}
|
|
58467
58572
|
const detectedConfigPath = getOmoConfigPath();
|
|
58468
|
-
const canonicalConfigPath =
|
|
58469
|
-
const shouldMigrateLegacyPath =
|
|
58470
|
-
const omoConfigPath = shouldMigrateLegacyPath ? migrateLegacyConfigFile(detectedConfigPath) ||
|
|
58573
|
+
const canonicalConfigPath = join22(dirname9(detectedConfigPath), `${CONFIG_BASENAME}${extname(detectedConfigPath) || ".json"}`);
|
|
58574
|
+
const shouldMigrateLegacyPath = basename5(detectedConfigPath).startsWith(LEGACY_CONFIG_BASENAME);
|
|
58575
|
+
const omoConfigPath = shouldMigrateLegacyPath ? migrateLegacyConfigFile(detectedConfigPath) || existsSync23(canonicalConfigPath) ? canonicalConfigPath : detectedConfigPath : detectedConfigPath;
|
|
58471
58576
|
try {
|
|
58472
58577
|
const newConfig = generateOmoConfig(installConfig);
|
|
58473
|
-
if (
|
|
58578
|
+
if (existsSync23(omoConfigPath)) {
|
|
58474
58579
|
const backupResult = backupConfigFile(omoConfigPath);
|
|
58475
58580
|
if (!backupResult.success) {
|
|
58476
58581
|
return {
|
|
@@ -58687,10 +58792,10 @@ var init_opencode_binary = __esm(() => {
|
|
|
58687
58792
|
});
|
|
58688
58793
|
|
|
58689
58794
|
// packages/omo-opencode/src/cli/config-manager/detect-current-config.ts
|
|
58690
|
-
import { existsSync as
|
|
58795
|
+
import { existsSync as existsSync24, readFileSync as readFileSync12 } from "node:fs";
|
|
58691
58796
|
function detectProvidersFromOmoConfig() {
|
|
58692
58797
|
const omoConfigPath = getOmoConfigPath();
|
|
58693
|
-
if (!
|
|
58798
|
+
if (!existsSync24(omoConfigPath)) {
|
|
58694
58799
|
return {
|
|
58695
58800
|
hasOpenAI: true,
|
|
58696
58801
|
hasOpencodeZen: true,
|
|
@@ -58842,10 +58947,10 @@ var init_detect_current_config = __esm(() => {
|
|
|
58842
58947
|
});
|
|
58843
58948
|
|
|
58844
58949
|
// packages/omo-opencode/src/cli/config-manager/bun-install.ts
|
|
58845
|
-
import { existsSync as
|
|
58846
|
-
import { join as
|
|
58950
|
+
import { existsSync as existsSync25 } from "node:fs";
|
|
58951
|
+
import { join as join23 } from "node:path";
|
|
58847
58952
|
function getDefaultWorkspaceDir() {
|
|
58848
|
-
return
|
|
58953
|
+
return join23(getOpenCodeCacheDir(), "packages");
|
|
58849
58954
|
}
|
|
58850
58955
|
function readProcessOutput(stream) {
|
|
58851
58956
|
if (!stream) {
|
|
@@ -58871,7 +58976,7 @@ async function runBunInstallWithDetails(options) {
|
|
|
58871
58976
|
const outputMode = options?.outputMode ?? "pipe";
|
|
58872
58977
|
const cacheDir = options?.workspaceDir ?? getDefaultWorkspaceDir();
|
|
58873
58978
|
const packageJsonPath = `${cacheDir}/package.json`;
|
|
58874
|
-
if (!
|
|
58979
|
+
if (!existsSync25(packageJsonPath)) {
|
|
58875
58980
|
return {
|
|
58876
58981
|
success: false,
|
|
58877
58982
|
error: `Workspace not initialized: ${packageJsonPath} not found. OpenCode should create this on first run.`
|
|
@@ -58952,21 +59057,21 @@ var init_config_manager = __esm(() => {
|
|
|
58952
59057
|
});
|
|
58953
59058
|
|
|
58954
59059
|
// packages/telemetry-core/src/activity-state.ts
|
|
58955
|
-
import { existsSync as
|
|
58956
|
-
import { basename as
|
|
59060
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as readFileSync13 } from "node:fs";
|
|
59061
|
+
import { basename as basename10, join as join49 } from "node:path";
|
|
58957
59062
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
58958
59063
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
58959
59064
|
env: options.env,
|
|
58960
59065
|
osProvider: options.osProvider
|
|
58961
59066
|
});
|
|
58962
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
58963
|
-
if (dataDir === xdgStateDir || xdgStateDir === undefined &&
|
|
59067
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join49(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
59068
|
+
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename10(dataDir) === product.cacheDirName) {
|
|
58964
59069
|
return dataDir;
|
|
58965
59070
|
}
|
|
58966
|
-
return
|
|
59071
|
+
return join49(dataDir, product.cacheDirName);
|
|
58967
59072
|
}
|
|
58968
59073
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
58969
|
-
return
|
|
59074
|
+
return join49(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
58970
59075
|
}
|
|
58971
59076
|
function getDailyActiveCaptureState(input) {
|
|
58972
59077
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -58991,7 +59096,7 @@ function isPostHogActivityState(value) {
|
|
|
58991
59096
|
}
|
|
58992
59097
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
58993
59098
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
58994
|
-
if (!
|
|
59099
|
+
if (!existsSync28(stateFilePath)) {
|
|
58995
59100
|
return {};
|
|
58996
59101
|
}
|
|
58997
59102
|
try {
|
|
@@ -59036,10 +59141,10 @@ var init_activity_state = __esm(() => {
|
|
|
59036
59141
|
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74";
|
|
59037
59142
|
|
|
59038
59143
|
// packages/telemetry-core/src/diagnostics.ts
|
|
59039
|
-
import { appendFileSync as appendFileSync2, existsSync as
|
|
59040
|
-
import { join as
|
|
59144
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync9, readFileSync as readFileSync14 } from "node:fs";
|
|
59145
|
+
import { join as join50 } from "node:path";
|
|
59041
59146
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
59042
|
-
return
|
|
59147
|
+
return join50(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
59043
59148
|
}
|
|
59044
59149
|
function writeTelemetryDiagnostic(input, options) {
|
|
59045
59150
|
const now = options.now ?? new Date;
|
|
@@ -59057,7 +59162,7 @@ function writeTelemetryDiagnostic(input, options) {
|
|
|
59057
59162
|
}
|
|
59058
59163
|
function cleanupTelemetryDiagnostics(options) {
|
|
59059
59164
|
const diagnosticsFilePath = getTelemetryDiagnosticsFilePath(options.diagnosticsDir);
|
|
59060
|
-
if (!
|
|
59165
|
+
if (!existsSync29(diagnosticsFilePath)) {
|
|
59061
59166
|
return;
|
|
59062
59167
|
}
|
|
59063
59168
|
try {
|
|
@@ -59205,7 +59310,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
59205
59310
|
var init_machine_id = () => {};
|
|
59206
59311
|
|
|
59207
59312
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
59208
|
-
import { dirname as
|
|
59313
|
+
import { dirname as dirname16, posix as posix2, sep as sep7 } from "path";
|
|
59209
59314
|
function createModulerModifier() {
|
|
59210
59315
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
59211
59316
|
return async (frames) => {
|
|
@@ -59214,7 +59319,7 @@ function createModulerModifier() {
|
|
|
59214
59319
|
return frames;
|
|
59215
59320
|
};
|
|
59216
59321
|
}
|
|
59217
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
59322
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
59218
59323
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
59219
59324
|
return (filename) => {
|
|
59220
59325
|
if (!filename)
|
|
@@ -64764,7 +64869,7 @@ var package_default2;
|
|
|
64764
64869
|
var init_package2 = __esm(() => {
|
|
64765
64870
|
package_default2 = {
|
|
64766
64871
|
name: "@oh-my-opencode/omo-codex",
|
|
64767
|
-
version: "4.
|
|
64872
|
+
version: "4.13.0",
|
|
64768
64873
|
type: "module",
|
|
64769
64874
|
private: true,
|
|
64770
64875
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -64899,7 +65004,7 @@ function createPostHogClient(source, options = {}) {
|
|
|
64899
65004
|
osProvider: options.osProvider ?? resolveOsProvider(),
|
|
64900
65005
|
product: createCodexTelemetryProductConfig(),
|
|
64901
65006
|
source,
|
|
64902
|
-
transportFactory: options.transportFactory
|
|
65007
|
+
transportFactory: options.transportFactory ?? transportFactoryOverride ?? undefined
|
|
64903
65008
|
});
|
|
64904
65009
|
if (!client3.enabled) {
|
|
64905
65010
|
return NO_OP_POSTHOG;
|
|
@@ -64950,7 +65055,7 @@ function __setActivityStateProviderForTesting(provider) {
|
|
|
64950
65055
|
function __resetActivityStateProviderForTesting() {
|
|
64951
65056
|
activityStateProviderOverride = null;
|
|
64952
65057
|
}
|
|
64953
|
-
var osProviderOverride2 = null, activityStateProviderOverride = null, NO_OP_POSTHOG;
|
|
65058
|
+
var osProviderOverride2 = null, activityStateProviderOverride = null, transportFactoryOverride = null, NO_OP_POSTHOG;
|
|
64954
65059
|
var init_posthog = __esm(() => {
|
|
64955
65060
|
init_src4();
|
|
64956
65061
|
init_diagnostics2();
|
|
@@ -65733,20 +65838,20 @@ var init_update_toasts = __esm(() => {
|
|
|
65733
65838
|
});
|
|
65734
65839
|
|
|
65735
65840
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
65736
|
-
import { existsSync as
|
|
65737
|
-
import { dirname as
|
|
65841
|
+
import { existsSync as existsSync48 } from "node:fs";
|
|
65842
|
+
import { dirname as dirname25, join as join67 } from "node:path";
|
|
65738
65843
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
65739
65844
|
function defaultGetModuleHostingWorkspace() {
|
|
65740
65845
|
try {
|
|
65741
|
-
const currentDir =
|
|
65846
|
+
const currentDir = dirname25(fileURLToPath4(import.meta.url));
|
|
65742
65847
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
65743
65848
|
if (!pkgJsonPath)
|
|
65744
65849
|
return null;
|
|
65745
|
-
const pkgDir =
|
|
65746
|
-
const nodeModulesDir =
|
|
65850
|
+
const pkgDir = dirname25(pkgJsonPath);
|
|
65851
|
+
const nodeModulesDir = dirname25(pkgDir);
|
|
65747
65852
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
65748
65853
|
return null;
|
|
65749
|
-
return
|
|
65854
|
+
return dirname25(nodeModulesDir);
|
|
65750
65855
|
} catch (error51) {
|
|
65751
65856
|
if (error51 instanceof Error) {
|
|
65752
65857
|
return null;
|
|
@@ -65887,8 +65992,8 @@ var init_background_update_check = __esm(() => {
|
|
|
65887
65992
|
init_package_json_locator();
|
|
65888
65993
|
init_update_toasts();
|
|
65889
65994
|
defaultDeps4 = {
|
|
65890
|
-
existsSync:
|
|
65891
|
-
join:
|
|
65995
|
+
existsSync: existsSync48,
|
|
65996
|
+
join: join67,
|
|
65892
65997
|
runBunInstallWithDetails,
|
|
65893
65998
|
log: log2,
|
|
65894
65999
|
getOpenCodeCacheDir,
|
|
@@ -66051,7 +66156,7 @@ async function showSpinnerToast(ctx, version3, message) {
|
|
|
66051
66156
|
duration: frameInterval + 50
|
|
66052
66157
|
}
|
|
66053
66158
|
}).catch(ignoreToastError);
|
|
66054
|
-
await new Promise((
|
|
66159
|
+
await new Promise((resolve18) => setTimeout(resolve18, frameInterval));
|
|
66055
66160
|
}
|
|
66056
66161
|
}
|
|
66057
66162
|
var SISYPHUS_SPINNER;
|
|
@@ -66490,13 +66595,13 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
66490
66595
|
}
|
|
66491
66596
|
|
|
66492
66597
|
// packages/omo-codex/src/install/install-codex.ts
|
|
66493
|
-
import { join as
|
|
66494
|
-
import { existsSync as
|
|
66598
|
+
import { join as join51, resolve as resolve14 } from "node:path";
|
|
66599
|
+
import { existsSync as existsSync30 } from "node:fs";
|
|
66495
66600
|
import { homedir as homedir6 } from "node:os";
|
|
66496
66601
|
|
|
66497
66602
|
// packages/omo-codex/src/install/codex-cache-bins.ts
|
|
66498
66603
|
import { chmod, lstat as lstat3, mkdir, readFile as readFile2, readdir, readlink as readlink2, rm as rm2, stat, symlink, writeFile } from "node:fs/promises";
|
|
66499
|
-
import { basename as
|
|
66604
|
+
import { basename as basename6, isAbsolute as isAbsolute3, join as join26, relative as relative2, resolve as resolve7, sep } from "node:path";
|
|
66500
66605
|
|
|
66501
66606
|
// packages/omo-codex/src/install/codex-cache-command-shim.ts
|
|
66502
66607
|
var COMMAND_SHIM_MARKER = ":: generated by oh-my-openagent Codex installer";
|
|
@@ -66522,7 +66627,7 @@ function isNodeErrorWithCode(error) {
|
|
|
66522
66627
|
|
|
66523
66628
|
// packages/omo-codex/src/install/codex-cache-legacy-bins.ts
|
|
66524
66629
|
import { lstat as lstat2, readFile, readlink, rm } from "node:fs/promises";
|
|
66525
|
-
import { join as
|
|
66630
|
+
import { join as join24 } from "node:path";
|
|
66526
66631
|
var LEGACY_CODEX_COMPONENT_BINS = [
|
|
66527
66632
|
{ name: "omo", component: "ulw-loop" },
|
|
66528
66633
|
{ name: "codex-comment-checker", component: "comment-checker" },
|
|
@@ -66534,7 +66639,7 @@ var LEGACY_CODEX_COMPONENT_BINS = [
|
|
|
66534
66639
|
];
|
|
66535
66640
|
async function removeLegacyCodexComponentBins(binDir, platform) {
|
|
66536
66641
|
for (const entry of LEGACY_CODEX_COMPONENT_BINS) {
|
|
66537
|
-
const linkPath =
|
|
66642
|
+
const linkPath = join24(binDir, platform === "win32" ? `${entry.name}.cmd` : entry.name);
|
|
66538
66643
|
await removeLegacyCodexComponentBin(linkPath, entry.component, platform);
|
|
66539
66644
|
}
|
|
66540
66645
|
}
|
|
@@ -66585,10 +66690,10 @@ function isNodeErrorWithCode2(error) {
|
|
|
66585
66690
|
}
|
|
66586
66691
|
|
|
66587
66692
|
// packages/omo-codex/src/install/codex-cache-runtime-wrapper.ts
|
|
66588
|
-
import { join as
|
|
66693
|
+
import { join as join25 } from "node:path";
|
|
66589
66694
|
var RUNTIME_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
66590
66695
|
function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
66591
|
-
const ulwLoopBin = toPosixPath(
|
|
66696
|
+
const ulwLoopBin = toPosixPath(join25(binDir, "omo-ulw-loop"));
|
|
66592
66697
|
const nodeCli = escapePosixDoubleQuoted(toPosixPath(nodeCliPath));
|
|
66593
66698
|
const escapedCliPath = escapePosixDoubleQuoted(toPosixPath(cliPath));
|
|
66594
66699
|
const escapedCodexHome = escapePosixDoubleQuoted(toPosixPath(codexHome));
|
|
@@ -66634,7 +66739,7 @@ function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
|
66634
66739
|
`);
|
|
66635
66740
|
}
|
|
66636
66741
|
function windowsRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
66637
|
-
const ulwLoopBin =
|
|
66742
|
+
const ulwLoopBin = join25(binDir, "omo-ulw-loop.cmd");
|
|
66638
66743
|
return [
|
|
66639
66744
|
"@echo off",
|
|
66640
66745
|
`rem ${RUNTIME_WRAPPER_MARKER}`,
|
|
@@ -66690,29 +66795,29 @@ async function linkCachedPluginBins(input) {
|
|
|
66690
66795
|
return linked;
|
|
66691
66796
|
}
|
|
66692
66797
|
async function linkRootRuntimeBin(input) {
|
|
66693
|
-
const cliPath =
|
|
66798
|
+
const cliPath = join26(input.repoRoot, "dist", "cli", "index.js");
|
|
66694
66799
|
if (!await isFile(cliPath))
|
|
66695
66800
|
return null;
|
|
66696
|
-
const nodeCliPath =
|
|
66801
|
+
const nodeCliPath = join26(input.repoRoot, "dist", "cli-node", "index.js");
|
|
66697
66802
|
const platform = input.platform ?? process.platform;
|
|
66698
66803
|
await mkdir(input.binDir, { recursive: true });
|
|
66699
66804
|
if (platform === "win32") {
|
|
66700
|
-
const linkPath2 =
|
|
66805
|
+
const linkPath2 = join26(input.binDir, "omo.cmd");
|
|
66701
66806
|
await replaceRuntimeWrapper(linkPath2, windowsRuntimeWrapper(cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
66702
66807
|
return { name: "omo", path: linkPath2, target: cliPath };
|
|
66703
66808
|
}
|
|
66704
|
-
const linkPath =
|
|
66809
|
+
const linkPath = join26(input.binDir, "omo");
|
|
66705
66810
|
await replaceRuntimeWrapper(linkPath, posixRuntimeWrapper(cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
66706
66811
|
await chmod(linkPath, 493);
|
|
66707
66812
|
return { name: "omo", path: linkPath, target: cliPath };
|
|
66708
66813
|
}
|
|
66709
66814
|
async function linkCachedPluginBin(binDir, link, platform) {
|
|
66710
66815
|
if (platform === "win32") {
|
|
66711
|
-
const linkPath2 =
|
|
66816
|
+
const linkPath2 = join26(binDir, `${link.name}.cmd`);
|
|
66712
66817
|
await replaceCommandShim(linkPath2, link.target);
|
|
66713
66818
|
return linkPath2;
|
|
66714
66819
|
}
|
|
66715
|
-
const linkPath =
|
|
66820
|
+
const linkPath = join26(binDir, link.name);
|
|
66716
66821
|
await replaceSymlink(linkPath, link.target);
|
|
66717
66822
|
return linkPath;
|
|
66718
66823
|
}
|
|
@@ -66733,14 +66838,14 @@ async function discoverPackageBins(root) {
|
|
|
66733
66838
|
async function collectPackageBins(directory, root, links) {
|
|
66734
66839
|
const entries = await readdir(directory, { withFileTypes: true });
|
|
66735
66840
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
66736
|
-
await appendPackageBinLinks(
|
|
66841
|
+
await appendPackageBinLinks(join26(directory, "package.json"), directory, root, links);
|
|
66737
66842
|
}
|
|
66738
66843
|
for (const entry of entries) {
|
|
66739
66844
|
if (!entry.isDirectory())
|
|
66740
66845
|
continue;
|
|
66741
66846
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
66742
66847
|
continue;
|
|
66743
|
-
const childPath =
|
|
66848
|
+
const childPath = join26(directory, entry.name);
|
|
66744
66849
|
if (!childPath.startsWith(root))
|
|
66745
66850
|
continue;
|
|
66746
66851
|
await collectPackageBins(childPath, root, links);
|
|
@@ -66753,7 +66858,7 @@ async function appendPackageBinLinks(packageJsonPath, packageRoot, root, links)
|
|
|
66753
66858
|
const packageName = packageJson.name;
|
|
66754
66859
|
const packageBin = packageJson.bin;
|
|
66755
66860
|
if (typeof packageBin === "string" && typeof packageName === "string") {
|
|
66756
|
-
const name = assertSafeCommandName(
|
|
66861
|
+
const name = assertSafeCommandName(basename6(packageName));
|
|
66757
66862
|
if (!isReservedNestedBinName(name, packageRoot, root)) {
|
|
66758
66863
|
links.push({ name, target: resolvePackageBinTarget(packageRoot, packageBin) });
|
|
66759
66864
|
}
|
|
@@ -66855,11 +66960,11 @@ async function existingNonSymlink(path7) {
|
|
|
66855
66960
|
}
|
|
66856
66961
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
66857
66962
|
import { cp as cp2, mkdir as mkdir3, readFile as readFile7, rename, rm as rm3 } from "node:fs/promises";
|
|
66858
|
-
import { basename as
|
|
66963
|
+
import { basename as basename7, dirname as dirname12, join as join32, sep as sep5 } from "node:path";
|
|
66859
66964
|
|
|
66860
66965
|
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
|
|
66861
66966
|
import { cp, mkdir as mkdir2, readFile as readFile3, stat as stat2 } from "node:fs/promises";
|
|
66862
|
-
import { dirname as
|
|
66967
|
+
import { dirname as dirname10, join as join27, resolve as resolve8 } from "node:path";
|
|
66863
66968
|
var BUNDLED_MCP_RUNTIMES = [
|
|
66864
66969
|
{
|
|
66865
66970
|
label: "Git Bash MCP",
|
|
@@ -66877,7 +66982,7 @@ var BUNDLED_MCP_RUNTIMES = [
|
|
|
66877
66982
|
}
|
|
66878
66983
|
];
|
|
66879
66984
|
async function copyBundledMcpRuntimeDists(input) {
|
|
66880
|
-
const sourceArgs = await readSourceMcpArgs(
|
|
66985
|
+
const sourceArgs = await readSourceMcpArgs(join27(input.sourceRoot, ".mcp.json"));
|
|
66881
66986
|
for (const runtime4 of BUNDLED_MCP_RUNTIMES) {
|
|
66882
66987
|
if (!sourceArgs.has(runtime4.sourceArg))
|
|
66883
66988
|
continue;
|
|
@@ -66886,15 +66991,15 @@ async function copyBundledMcpRuntimeDists(input) {
|
|
|
66886
66991
|
}
|
|
66887
66992
|
function resolveBundledMcpRuntimeArg(pluginRoot, arg) {
|
|
66888
66993
|
const runtime4 = BUNDLED_MCP_RUNTIMES.find((candidate) => candidate.sourceArg === arg);
|
|
66889
|
-
return runtime4 ?
|
|
66994
|
+
return runtime4 ? join27(pluginRoot, runtime4.destinationArg) : null;
|
|
66890
66995
|
}
|
|
66891
66996
|
async function copyBundledMcpRuntimeDist(pluginRoot, sourceRoot, runtime4) {
|
|
66892
66997
|
const sourcePath = resolve8(sourceRoot, runtime4.sourceDistFromPlugin);
|
|
66893
66998
|
if (!await isDirectory(sourcePath)) {
|
|
66894
66999
|
throw new Error(`missing built ${runtime4.label} dist at ${sourcePath}`);
|
|
66895
67000
|
}
|
|
66896
|
-
const destinationPath =
|
|
66897
|
-
await mkdir2(
|
|
67001
|
+
const destinationPath = join27(pluginRoot, runtime4.destinationDistFromPlugin);
|
|
67002
|
+
await mkdir2(dirname10(destinationPath), { recursive: true });
|
|
66898
67003
|
await cp(sourcePath, destinationPath, { recursive: true });
|
|
66899
67004
|
}
|
|
66900
67005
|
async function readSourceMcpArgs(path7) {
|
|
@@ -66932,37 +67037,37 @@ async function isDirectory(path7) {
|
|
|
66932
67037
|
// packages/omo-codex/src/install/codex-cache-local-dependencies.ts
|
|
66933
67038
|
import { realpathSync as realpathSync6 } from "node:fs";
|
|
66934
67039
|
import { readFile as readFile4, readdir as readdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
66935
|
-
import { dirname as
|
|
67040
|
+
import { dirname as dirname11, isAbsolute as isAbsolute5, join as join29, relative as relative4, resolve as resolve10, sep as sep2 } from "node:path";
|
|
66936
67041
|
|
|
66937
67042
|
// packages/omo-codex/src/install/codex-cache-paths.ts
|
|
66938
|
-
import { existsSync as
|
|
66939
|
-
import { isAbsolute as isAbsolute4, join as
|
|
67043
|
+
import { existsSync as existsSync26, readdirSync as readdirSync4 } from "node:fs";
|
|
67044
|
+
import { isAbsolute as isAbsolute4, join as join28, relative as relative3, resolve as resolve9 } from "node:path";
|
|
66940
67045
|
var DEFAULT_CODEX_MARKETPLACE_NAME = "sisyphuslabs";
|
|
66941
67046
|
var DEFAULT_CODEX_PLUGIN_NAME = "omo";
|
|
66942
67047
|
function resolveDefaultCodexHome(homeDir) {
|
|
66943
|
-
return
|
|
67048
|
+
return join28(homeDir, ".codex");
|
|
66944
67049
|
}
|
|
66945
67050
|
function resolveCodexPluginCacheRoot(codexHome, input = {}) {
|
|
66946
|
-
return
|
|
67051
|
+
return join28(codexHome, "plugins", "cache", input.marketplaceName ?? DEFAULT_CODEX_MARKETPLACE_NAME, input.pluginName ?? DEFAULT_CODEX_PLUGIN_NAME);
|
|
66947
67052
|
}
|
|
66948
67053
|
function resolveCachedCodexComponentCliPath(pluginRoot, componentName) {
|
|
66949
|
-
return
|
|
67054
|
+
return join28(pluginRoot, "components", componentName, "dist", "cli.js");
|
|
66950
67055
|
}
|
|
66951
67056
|
function resolveCodexComponentBinCandidates(input) {
|
|
66952
67057
|
return [
|
|
66953
|
-
input.env.CODEX_LOCAL_BIN_DIR ?
|
|
66954
|
-
|
|
66955
|
-
|
|
67058
|
+
input.env.CODEX_LOCAL_BIN_DIR ? join28(input.env.CODEX_LOCAL_BIN_DIR, input.executableName) : undefined,
|
|
67059
|
+
join28(input.homeDir, ".local", "bin", input.executableName),
|
|
67060
|
+
join28(resolveDefaultCodexHome(input.homeDir), "bin", input.executableName)
|
|
66956
67061
|
].filter((value) => typeof value === "string");
|
|
66957
67062
|
}
|
|
66958
67063
|
function findNewestCachedCodexComponentCli(input) {
|
|
66959
67064
|
const versionsRoot = resolveCodexPluginCacheRoot(input.codexHome, input);
|
|
66960
|
-
if (!
|
|
67065
|
+
if (!existsSync26(versionsRoot))
|
|
66961
67066
|
return null;
|
|
66962
67067
|
const versions = readdirSync4(versionsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionNames).reverse();
|
|
66963
67068
|
for (const version of versions) {
|
|
66964
|
-
const candidate = resolveCachedCodexComponentCliPath(
|
|
66965
|
-
if (
|
|
67069
|
+
const candidate = resolveCachedCodexComponentCliPath(join28(versionsRoot, version), input.componentName);
|
|
67070
|
+
if (existsSync26(candidate))
|
|
66966
67071
|
return candidate;
|
|
66967
67072
|
}
|
|
66968
67073
|
return null;
|
|
@@ -67000,8 +67105,8 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
67000
67105
|
const parsed = JSON.parse(raw);
|
|
67001
67106
|
if (!isPlainRecord3(parsed))
|
|
67002
67107
|
continue;
|
|
67003
|
-
const packageDir =
|
|
67004
|
-
const sourcePackageDir =
|
|
67108
|
+
const packageDir = dirname11(packageJsonPath);
|
|
67109
|
+
const sourcePackageDir = join29(sourceRoot, relative4(pluginRoot, packageDir));
|
|
67005
67110
|
let changed = false;
|
|
67006
67111
|
for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
|
|
67007
67112
|
const dependencies = parsed[field];
|
|
@@ -67039,7 +67144,7 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
67039
67144
|
`);
|
|
67040
67145
|
}
|
|
67041
67146
|
async function readPackageLock(pluginRoot) {
|
|
67042
|
-
const path7 =
|
|
67147
|
+
const path7 = join29(pluginRoot, "package-lock.json");
|
|
67043
67148
|
try {
|
|
67044
67149
|
const parsed = JSON.parse(await readFile4(path7, "utf8"));
|
|
67045
67150
|
return { path: path7, value: isPlainRecord3(parsed) ? parsed : null, changed: false };
|
|
@@ -67100,14 +67205,14 @@ function canonicalizeExistingPath(path7) {
|
|
|
67100
67205
|
async function collectPackageJsonPaths(directory, root, paths) {
|
|
67101
67206
|
const entries = await readdir2(directory, { withFileTypes: true });
|
|
67102
67207
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
67103
|
-
paths.push(
|
|
67208
|
+
paths.push(join29(directory, "package.json"));
|
|
67104
67209
|
}
|
|
67105
67210
|
for (const entry of entries) {
|
|
67106
67211
|
if (!entry.isDirectory())
|
|
67107
67212
|
continue;
|
|
67108
67213
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
67109
67214
|
continue;
|
|
67110
|
-
const childPath =
|
|
67215
|
+
const childPath = join29(directory, entry.name);
|
|
67111
67216
|
if (!isPathInside(childPath, root))
|
|
67112
67217
|
continue;
|
|
67113
67218
|
await collectPackageJsonPaths(childPath, root, paths);
|
|
@@ -67116,10 +67221,10 @@ async function collectPackageJsonPaths(directory, root, paths) {
|
|
|
67116
67221
|
|
|
67117
67222
|
// packages/omo-codex/src/install/codex-cache-mcp-manifest.ts
|
|
67118
67223
|
import { readFile as readFile5, writeFile as writeFile3 } from "node:fs/promises";
|
|
67119
|
-
import { join as
|
|
67224
|
+
import { join as join30, sep as sep3 } from "node:path";
|
|
67120
67225
|
var CODEGRAPH_RELATIVE_ARGS = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
|
|
67121
67226
|
async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
|
|
67122
|
-
const manifestPath =
|
|
67227
|
+
const manifestPath = join30(pluginRoot, ".mcp.json");
|
|
67123
67228
|
if (!await fileExistsStrict(manifestPath))
|
|
67124
67229
|
return;
|
|
67125
67230
|
const raw = await readFile5(manifestPath, "utf8");
|
|
@@ -67144,7 +67249,7 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
|
|
|
67144
67249
|
if (bundledMcpRuntimeArg !== null)
|
|
67145
67250
|
return bundledMcpRuntimeArg;
|
|
67146
67251
|
if (CODEGRAPH_RELATIVE_ARGS.has(arg))
|
|
67147
|
-
return
|
|
67252
|
+
return join30(pluginRoot, "components", "codegraph", "dist", "serve.js");
|
|
67148
67253
|
if (arg.startsWith("./") || arg.startsWith("../"))
|
|
67149
67254
|
return resolveCachedRuntimePath(pluginRoot, sourceRoot, arg);
|
|
67150
67255
|
return arg;
|
|
@@ -67159,7 +67264,7 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
|
|
|
67159
67264
|
`);
|
|
67160
67265
|
}
|
|
67161
67266
|
async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
67162
|
-
const manifestPath =
|
|
67267
|
+
const manifestPath = join30(pluginRoot, ".mcp.json");
|
|
67163
67268
|
if (!await fileExistsStrict(manifestPath))
|
|
67164
67269
|
return;
|
|
67165
67270
|
const raw = await readFile5(manifestPath, "utf8");
|
|
@@ -67195,7 +67300,7 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
|
67195
67300
|
|
|
67196
67301
|
// packages/omo-codex/src/install/codex-hook-targets.ts
|
|
67197
67302
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
67198
|
-
import { join as
|
|
67303
|
+
import { join as join31, sep as sep4 } from "node:path";
|
|
67199
67304
|
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
|
|
67200
67305
|
async function findMissingHookCommandTargets(pluginRoot) {
|
|
67201
67306
|
const commands = [];
|
|
@@ -67212,7 +67317,7 @@ async function findMissingHookCommandTargets(pluginRoot) {
|
|
|
67212
67317
|
const targetSuffix = match[1];
|
|
67213
67318
|
if (targetSuffix === undefined)
|
|
67214
67319
|
continue;
|
|
67215
|
-
const target =
|
|
67320
|
+
const target = join31(pluginRoot, ...targetSuffix.split(/[\\/]+/));
|
|
67216
67321
|
if (seen.has(target))
|
|
67217
67322
|
continue;
|
|
67218
67323
|
seen.add(target);
|
|
@@ -67223,17 +67328,17 @@ async function findMissingHookCommandTargets(pluginRoot) {
|
|
|
67223
67328
|
return missing;
|
|
67224
67329
|
}
|
|
67225
67330
|
async function hookManifestPaths(pluginRoot) {
|
|
67226
|
-
const pluginManifestPath =
|
|
67331
|
+
const pluginManifestPath = join31(pluginRoot, ".codex-plugin", "plugin.json");
|
|
67227
67332
|
if (!await fileExistsStrict(pluginManifestPath))
|
|
67228
|
-
return [
|
|
67333
|
+
return [join31(pluginRoot, "hooks", "hooks.json")];
|
|
67229
67334
|
const parsed = JSON.parse(await readFile6(pluginManifestPath, "utf8"));
|
|
67230
67335
|
if (!isPlainRecord3(parsed))
|
|
67231
67336
|
return [];
|
|
67232
67337
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
|
|
67233
|
-
return [
|
|
67338
|
+
return [join31(pluginRoot, stripDotSlash(parsed.hooks))];
|
|
67234
67339
|
}
|
|
67235
67340
|
if (Array.isArray(parsed.hooks)) {
|
|
67236
|
-
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) =>
|
|
67341
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) => join31(pluginRoot, stripDotSlash(hookPath)));
|
|
67237
67342
|
}
|
|
67238
67343
|
return [];
|
|
67239
67344
|
}
|
|
@@ -67269,7 +67374,7 @@ async function installCachedPlugin(input) {
|
|
|
67269
67374
|
await maybeRunNpmInstall(input.sourcePath, input.runCommand);
|
|
67270
67375
|
await maybeRunNpmBuild(input.sourcePath, input.runCommand);
|
|
67271
67376
|
}
|
|
67272
|
-
const targetPath =
|
|
67377
|
+
const targetPath = join32(input.codexHome, "plugins", "cache", input.marketplaceName, input.name, input.version);
|
|
67273
67378
|
const tempPath = createTempSiblingPath(targetPath);
|
|
67274
67379
|
await rm3(tempPath, { recursive: true, force: true });
|
|
67275
67380
|
try {
|
|
@@ -67290,14 +67395,14 @@ async function installCachedPlugin(input) {
|
|
|
67290
67395
|
return { name: input.name, version: input.version, path: targetPath };
|
|
67291
67396
|
}
|
|
67292
67397
|
async function maybeRunNpmInstall(cwd, runCommand, args = ["install"]) {
|
|
67293
|
-
if (!await fileExistsStrict(
|
|
67398
|
+
if (!await fileExistsStrict(join32(cwd, "package.json")))
|
|
67294
67399
|
return;
|
|
67295
67400
|
await runCommand("npm", args, { cwd });
|
|
67296
67401
|
}
|
|
67297
67402
|
async function maybeRunNpmBuild(cwd, runCommand) {
|
|
67298
|
-
if (!await fileExistsStrict(
|
|
67403
|
+
if (!await fileExistsStrict(join32(cwd, "package.json")))
|
|
67299
67404
|
return;
|
|
67300
|
-
const packageJson = JSON.parse(await readFile7(
|
|
67405
|
+
const packageJson = JSON.parse(await readFile7(join32(cwd, "package.json"), "utf8"));
|
|
67301
67406
|
if (!isPlainRecord3(packageJson))
|
|
67302
67407
|
return;
|
|
67303
67408
|
const scripts = packageJson.scripts;
|
|
@@ -67306,9 +67411,9 @@ async function maybeRunNpmBuild(cwd, runCommand) {
|
|
|
67306
67411
|
await runCommand("npm", ["run", "build"], { cwd });
|
|
67307
67412
|
}
|
|
67308
67413
|
async function maybeRunNpmSyncSkills(cwd, runCommand) {
|
|
67309
|
-
if (!await fileExistsStrict(
|
|
67414
|
+
if (!await fileExistsStrict(join32(cwd, "package.json")))
|
|
67310
67415
|
return;
|
|
67311
|
-
const packageJson = JSON.parse(await readFile7(
|
|
67416
|
+
const packageJson = JSON.parse(await readFile7(join32(cwd, "package.json"), "utf8"));
|
|
67312
67417
|
if (!isPlainRecord3(packageJson))
|
|
67313
67418
|
return;
|
|
67314
67419
|
const scripts = packageJson.scripts;
|
|
@@ -67317,13 +67422,13 @@ async function maybeRunNpmSyncSkills(cwd, runCommand) {
|
|
|
67317
67422
|
await runCommand("npm", ["run", "sync:skills"], { cwd });
|
|
67318
67423
|
}
|
|
67319
67424
|
function createTempSiblingPath(targetPath) {
|
|
67320
|
-
return
|
|
67425
|
+
return join32(dirname12(targetPath), `.tmp-${basename7(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67321
67426
|
}
|
|
67322
67427
|
function createBackupSiblingPath(targetPath) {
|
|
67323
|
-
return
|
|
67428
|
+
return join32(dirname12(targetPath), `.backup-${basename7(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67324
67429
|
}
|
|
67325
67430
|
async function copyDirectory(sourcePath, targetPath) {
|
|
67326
|
-
await mkdir3(
|
|
67431
|
+
await mkdir3(dirname12(targetPath), { recursive: true });
|
|
67327
67432
|
await cp2(sourcePath, targetPath, { recursive: true, filter: (source) => shouldCopyPluginPath(source, sourcePath) });
|
|
67328
67433
|
}
|
|
67329
67434
|
async function promoteDirectory(tempPath, targetPath, renameDirectory) {
|
|
@@ -67359,9 +67464,9 @@ function shouldCopyPluginPath(path7, root) {
|
|
|
67359
67464
|
}
|
|
67360
67465
|
// packages/omo-codex/src/install/codex-cache-prune.ts
|
|
67361
67466
|
import { lstat as lstat4, readdir as readdir3, rm as rm4, stat as stat3 } from "node:fs/promises";
|
|
67362
|
-
import { join as
|
|
67467
|
+
import { join as join33 } from "node:path";
|
|
67363
67468
|
async function pruneMarketplaceCache(input) {
|
|
67364
|
-
const cacheRoot =
|
|
67469
|
+
const cacheRoot = join33(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67365
67470
|
if (!await fileExistsStrict(cacheRoot))
|
|
67366
67471
|
return;
|
|
67367
67472
|
const keep = new Set(input.keepPluginNames);
|
|
@@ -67369,15 +67474,15 @@ async function pruneMarketplaceCache(input) {
|
|
|
67369
67474
|
for (const entry of entries) {
|
|
67370
67475
|
if (!entry.isDirectory() || keep.has(entry.name))
|
|
67371
67476
|
continue;
|
|
67372
|
-
await rm4(
|
|
67477
|
+
await rm4(join33(cacheRoot, entry.name), { recursive: true, force: true });
|
|
67373
67478
|
}
|
|
67374
67479
|
}
|
|
67375
67480
|
async function pruneMarketplacePluginCaches(input) {
|
|
67376
|
-
const cacheRoot =
|
|
67481
|
+
const cacheRoot = join33(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67377
67482
|
if (!await fileExistsStrict(cacheRoot))
|
|
67378
67483
|
return;
|
|
67379
67484
|
for (const pluginName of input.pluginNames) {
|
|
67380
|
-
await rm4(
|
|
67485
|
+
await rm4(join33(cacheRoot, pluginName), { recursive: true, force: true });
|
|
67381
67486
|
}
|
|
67382
67487
|
const remainingEntries = await readCacheEntryNames(cacheRoot);
|
|
67383
67488
|
if (remainingEntries.length === 0) {
|
|
@@ -67424,11 +67529,11 @@ async function isBrokenCacheSymlink(path7) {
|
|
|
67424
67529
|
}
|
|
67425
67530
|
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
|
|
67426
67531
|
import { mkdir as mkdir4, writeFile as writeFile4 } from "node:fs/promises";
|
|
67427
|
-
import { join as
|
|
67532
|
+
import { join as join34 } from "node:path";
|
|
67428
67533
|
async function writeCachedMarketplaceManifest(input) {
|
|
67429
|
-
const marketplaceDir =
|
|
67534
|
+
const marketplaceDir = join34(input.marketplaceRoot, ".agents", "plugins");
|
|
67430
67535
|
await mkdir4(marketplaceDir, { recursive: true });
|
|
67431
|
-
await writeFile4(
|
|
67536
|
+
await writeFile4(join34(marketplaceDir, "marketplace.json"), `${JSON.stringify({
|
|
67432
67537
|
name: input.marketplaceName,
|
|
67433
67538
|
plugins: input.plugins.map((plugin) => ({
|
|
67434
67539
|
name: plugin.name,
|
|
@@ -67439,9 +67544,9 @@ async function writeCachedMarketplaceManifest(input) {
|
|
|
67439
67544
|
}
|
|
67440
67545
|
|
|
67441
67546
|
// packages/omo-codex/src/install/codex-package-layout.ts
|
|
67442
|
-
import { existsSync as
|
|
67547
|
+
import { existsSync as existsSync27 } from "node:fs";
|
|
67443
67548
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
67444
|
-
import { join as
|
|
67549
|
+
import { join as join35 } from "node:path";
|
|
67445
67550
|
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
67446
67551
|
"@code-yeongyu/lazycodex",
|
|
67447
67552
|
"@code-yeongyu/lazycodex-ai",
|
|
@@ -67451,10 +67556,10 @@ var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
|
67451
67556
|
"oh-my-openagent"
|
|
67452
67557
|
]);
|
|
67453
67558
|
async function shouldBuildSourcePackages(repoRoot) {
|
|
67454
|
-
if (
|
|
67559
|
+
if (existsSync27(join35(repoRoot, "packages", "omo-opencode", "src", "index.ts")))
|
|
67455
67560
|
return true;
|
|
67456
|
-
const packageJsonPath =
|
|
67457
|
-
if (!
|
|
67561
|
+
const packageJsonPath = join35(repoRoot, "package.json");
|
|
67562
|
+
if (!existsSync27(packageJsonPath))
|
|
67458
67563
|
return true;
|
|
67459
67564
|
const packageJson = JSON.parse(await readFile8(packageJsonPath, "utf8"));
|
|
67460
67565
|
if (!isPlainRecord3(packageJson) || typeof packageJson.name !== "string")
|
|
@@ -67464,11 +67569,12 @@ async function shouldBuildSourcePackages(repoRoot) {
|
|
|
67464
67569
|
|
|
67465
67570
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
67466
67571
|
import { mkdir as mkdir5, readFile as readFile10 } from "node:fs/promises";
|
|
67467
|
-
import { dirname as
|
|
67572
|
+
import { dirname as dirname14 } from "node:path";
|
|
67468
67573
|
|
|
67469
67574
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
67470
67575
|
function findTomlSection(config, header) {
|
|
67471
67576
|
const headerLine = `[${header}]`;
|
|
67577
|
+
const targetHeaderPath = parseTomlDottedKey(header);
|
|
67472
67578
|
const lines = config.match(/[^\n]*\n?|$/g) ?? [];
|
|
67473
67579
|
let offset = 0;
|
|
67474
67580
|
let start = -1;
|
|
@@ -67477,7 +67583,7 @@ function findTomlSection(config, header) {
|
|
|
67477
67583
|
break;
|
|
67478
67584
|
const trimmed = line.trim();
|
|
67479
67585
|
if (start === -1) {
|
|
67480
|
-
if (trimmed
|
|
67586
|
+
if (tomlTableHeaderMatches(trimmed, headerLine, targetHeaderPath))
|
|
67481
67587
|
start = offset;
|
|
67482
67588
|
} else if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
|
|
67483
67589
|
return { start, end: offset, text: config.slice(start, offset) };
|
|
@@ -67533,6 +67639,127 @@ function insertSetting(sectionText, key, value) {
|
|
|
67533
67639
|
function escapeRegExp(value) {
|
|
67534
67640
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
67535
67641
|
}
|
|
67642
|
+
function tomlTableHeaderMatches(line, headerLine, targetHeaderPath) {
|
|
67643
|
+
if (line === headerLine)
|
|
67644
|
+
return true;
|
|
67645
|
+
if (!targetHeaderPath)
|
|
67646
|
+
return false;
|
|
67647
|
+
const candidateHeaderPath = parseTomlTableHeader(line);
|
|
67648
|
+
if (!candidateHeaderPath || candidateHeaderPath.length !== targetHeaderPath.length)
|
|
67649
|
+
return false;
|
|
67650
|
+
return candidateHeaderPath.every((part, index) => part === targetHeaderPath[index]);
|
|
67651
|
+
}
|
|
67652
|
+
function parseTomlTableHeader(line) {
|
|
67653
|
+
if (!line.startsWith("[") || !line.endsWith("]") || line.startsWith("[["))
|
|
67654
|
+
return null;
|
|
67655
|
+
return parseTomlDottedKey(line.slice(1, -1).trim());
|
|
67656
|
+
}
|
|
67657
|
+
function parseTomlDottedKey(input) {
|
|
67658
|
+
const parts = [];
|
|
67659
|
+
let index = 0;
|
|
67660
|
+
while (index < input.length) {
|
|
67661
|
+
index = skipWhitespace(input, index);
|
|
67662
|
+
const parsedKey = parseTomlKeyPart(input, index);
|
|
67663
|
+
if (!parsedKey)
|
|
67664
|
+
return null;
|
|
67665
|
+
parts.push(parsedKey.value);
|
|
67666
|
+
index = skipWhitespace(input, parsedKey.nextIndex);
|
|
67667
|
+
if (index === input.length)
|
|
67668
|
+
return parts;
|
|
67669
|
+
if (input[index] !== ".")
|
|
67670
|
+
return null;
|
|
67671
|
+
index += 1;
|
|
67672
|
+
}
|
|
67673
|
+
return parts.length > 0 ? parts : null;
|
|
67674
|
+
}
|
|
67675
|
+
function parseTomlKeyPart(input, startIndex) {
|
|
67676
|
+
const quote = input[startIndex];
|
|
67677
|
+
if (quote === "'")
|
|
67678
|
+
return parseLiteralTomlString(input, startIndex);
|
|
67679
|
+
if (quote === '"')
|
|
67680
|
+
return parseBasicTomlString(input, startIndex);
|
|
67681
|
+
return parseBareTomlKey(input, startIndex);
|
|
67682
|
+
}
|
|
67683
|
+
function parseLiteralTomlString(input, startIndex) {
|
|
67684
|
+
let index = startIndex + 1;
|
|
67685
|
+
let value = "";
|
|
67686
|
+
while (index < input.length) {
|
|
67687
|
+
const char = input[index];
|
|
67688
|
+
if (char === "'")
|
|
67689
|
+
return { value, nextIndex: index + 1 };
|
|
67690
|
+
value += char;
|
|
67691
|
+
index += 1;
|
|
67692
|
+
}
|
|
67693
|
+
return null;
|
|
67694
|
+
}
|
|
67695
|
+
function parseBasicTomlString(input, startIndex) {
|
|
67696
|
+
let index = startIndex + 1;
|
|
67697
|
+
let value = "";
|
|
67698
|
+
while (index < input.length) {
|
|
67699
|
+
const char = input[index];
|
|
67700
|
+
if (char === '"')
|
|
67701
|
+
return { value, nextIndex: index + 1 };
|
|
67702
|
+
if (char !== "\\") {
|
|
67703
|
+
value += char;
|
|
67704
|
+
index += 1;
|
|
67705
|
+
continue;
|
|
67706
|
+
}
|
|
67707
|
+
const escaped = parseBasicTomlEscape(input, index);
|
|
67708
|
+
if (!escaped)
|
|
67709
|
+
return null;
|
|
67710
|
+
value += escaped.value;
|
|
67711
|
+
index = escaped.nextIndex;
|
|
67712
|
+
}
|
|
67713
|
+
return null;
|
|
67714
|
+
}
|
|
67715
|
+
function parseBasicTomlEscape(input, backslashIndex) {
|
|
67716
|
+
const escape = input[backslashIndex + 1];
|
|
67717
|
+
if (escape === undefined)
|
|
67718
|
+
return null;
|
|
67719
|
+
if (escape === "b")
|
|
67720
|
+
return { value: "\b", nextIndex: backslashIndex + 2 };
|
|
67721
|
+
if (escape === "t")
|
|
67722
|
+
return { value: "\t", nextIndex: backslashIndex + 2 };
|
|
67723
|
+
if (escape === "n")
|
|
67724
|
+
return { value: `
|
|
67725
|
+
`, nextIndex: backslashIndex + 2 };
|
|
67726
|
+
if (escape === "f")
|
|
67727
|
+
return { value: "\f", nextIndex: backslashIndex + 2 };
|
|
67728
|
+
if (escape === "r")
|
|
67729
|
+
return { value: "\r", nextIndex: backslashIndex + 2 };
|
|
67730
|
+
if (escape === '"')
|
|
67731
|
+
return { value: '"', nextIndex: backslashIndex + 2 };
|
|
67732
|
+
if (escape === "\\")
|
|
67733
|
+
return { value: "\\", nextIndex: backslashIndex + 2 };
|
|
67734
|
+
if (escape === "u")
|
|
67735
|
+
return parseUnicodeEscape(input, backslashIndex + 2, 4);
|
|
67736
|
+
if (escape === "U")
|
|
67737
|
+
return parseUnicodeEscape(input, backslashIndex + 2, 8);
|
|
67738
|
+
return null;
|
|
67739
|
+
}
|
|
67740
|
+
function parseUnicodeEscape(input, digitsStart, digitCount) {
|
|
67741
|
+
const digits = input.slice(digitsStart, digitsStart + digitCount);
|
|
67742
|
+
if (digits.length !== digitCount || !/^[0-9A-Fa-f]+$/.test(digits))
|
|
67743
|
+
return null;
|
|
67744
|
+
const codePoint = Number.parseInt(digits, 16);
|
|
67745
|
+
if (codePoint > 1114111)
|
|
67746
|
+
return null;
|
|
67747
|
+
return { value: String.fromCodePoint(codePoint), nextIndex: digitsStart + digitCount };
|
|
67748
|
+
}
|
|
67749
|
+
function parseBareTomlKey(input, startIndex) {
|
|
67750
|
+
let index = startIndex;
|
|
67751
|
+
while (index < input.length && /[A-Za-z0-9_-]/.test(input[index]))
|
|
67752
|
+
index += 1;
|
|
67753
|
+
if (index === startIndex)
|
|
67754
|
+
return null;
|
|
67755
|
+
return { value: input.slice(startIndex, index), nextIndex: index };
|
|
67756
|
+
}
|
|
67757
|
+
function skipWhitespace(input, startIndex) {
|
|
67758
|
+
let index = startIndex;
|
|
67759
|
+
while (index < input.length && /\s/.test(input[index]))
|
|
67760
|
+
index += 1;
|
|
67761
|
+
return index;
|
|
67762
|
+
}
|
|
67536
67763
|
|
|
67537
67764
|
// packages/omo-codex/src/install/codex-config-toml-sections.ts
|
|
67538
67765
|
function removeTomlSections(config, shouldRemove) {
|
|
@@ -67561,27 +67788,18 @@ function splitTomlSections(config) {
|
|
|
67561
67788
|
return sections;
|
|
67562
67789
|
}
|
|
67563
67790
|
function parsePluginHeaderKey(header) {
|
|
67564
|
-
const
|
|
67565
|
-
|
|
67566
|
-
return null;
|
|
67567
|
-
return parseLeadingJsonString(header.slice(prefix.length));
|
|
67791
|
+
const path7 = parseTomlDottedKey(header);
|
|
67792
|
+
return path7?.[0] === "plugins" ? path7[1] ?? null : null;
|
|
67568
67793
|
}
|
|
67569
67794
|
function parseAgentHeaderName(header) {
|
|
67570
|
-
const
|
|
67571
|
-
|
|
67572
|
-
return null;
|
|
67573
|
-
const key = header.slice(prefix.length);
|
|
67574
|
-
return key.startsWith('"') ? parseLeadingJsonString(key) : key;
|
|
67795
|
+
const path7 = parseTomlDottedKey(header);
|
|
67796
|
+
return path7?.[0] === "agents" ? path7[1] ?? null : null;
|
|
67575
67797
|
}
|
|
67576
|
-
function
|
|
67577
|
-
|
|
67578
|
-
|
|
67579
|
-
return typeof parsed === "string" ? parsed : null;
|
|
67580
|
-
} catch (error) {
|
|
67581
|
-
if (error instanceof Error)
|
|
67582
|
-
return null;
|
|
67798
|
+
function parseHookStateHeaderKey(header) {
|
|
67799
|
+
const path7 = parseTomlDottedKey(header);
|
|
67800
|
+
if (path7?.[0] !== "hooks" || path7[1] !== "state")
|
|
67583
67801
|
return null;
|
|
67584
|
-
|
|
67802
|
+
return path7[2] ?? null;
|
|
67585
67803
|
}
|
|
67586
67804
|
function parseTomlHeader(line) {
|
|
67587
67805
|
const trimmed = line.trim();
|
|
@@ -67589,25 +67807,6 @@ function parseTomlHeader(line) {
|
|
|
67589
67807
|
return null;
|
|
67590
67808
|
return trimmed.slice(1, -1);
|
|
67591
67809
|
}
|
|
67592
|
-
function parseLeadingJsonString(value) {
|
|
67593
|
-
if (!value.startsWith('"'))
|
|
67594
|
-
return parseJsonString(value);
|
|
67595
|
-
let escaped = false;
|
|
67596
|
-
for (let index = 1;index < value.length; index += 1) {
|
|
67597
|
-
const char = value[index];
|
|
67598
|
-
if (escaped) {
|
|
67599
|
-
escaped = false;
|
|
67600
|
-
continue;
|
|
67601
|
-
}
|
|
67602
|
-
if (char === "\\") {
|
|
67603
|
-
escaped = true;
|
|
67604
|
-
continue;
|
|
67605
|
-
}
|
|
67606
|
-
if (char === '"')
|
|
67607
|
-
return parseJsonString(value.slice(0, index + 1));
|
|
67608
|
-
}
|
|
67609
|
-
return null;
|
|
67610
|
-
}
|
|
67611
67810
|
|
|
67612
67811
|
// packages/omo-codex/src/install/codex-config-agents.ts
|
|
67613
67812
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE = ["codex-ultrawork-reviewer"];
|
|
@@ -67651,12 +67850,12 @@ function tomlKeySegment(value) {
|
|
|
67651
67850
|
|
|
67652
67851
|
// packages/omo-codex/src/install/codex-config-atomic-write.ts
|
|
67653
67852
|
import { lstat as lstat5, readlink as readlink3, realpath, rename as rename2, unlink, writeFile as writeFile5 } from "node:fs/promises";
|
|
67654
|
-
import { basename as
|
|
67853
|
+
import { basename as basename8, dirname as dirname13, isAbsolute as isAbsolute6, join as join36, resolve as resolve11 } from "node:path";
|
|
67655
67854
|
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
67656
67855
|
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
67657
67856
|
async function writeFileAtomic(targetPath, data) {
|
|
67658
67857
|
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
67659
|
-
const temporaryPath =
|
|
67858
|
+
const temporaryPath = join36(dirname13(writeTarget), `.tmp-${basename8(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
67660
67859
|
await writeFile5(temporaryPath, data);
|
|
67661
67860
|
try {
|
|
67662
67861
|
await renameWithRetry(temporaryPath, writeTarget);
|
|
@@ -67685,7 +67884,7 @@ async function resolveSymlinkTarget(targetPath) {
|
|
|
67685
67884
|
if (!(error instanceof Error))
|
|
67686
67885
|
throw error;
|
|
67687
67886
|
const linkValue = await readlink3(targetPath);
|
|
67688
|
-
return isAbsolute6(linkValue) ? linkValue : resolve11(
|
|
67887
|
+
return isAbsolute6(linkValue) ? linkValue : resolve11(dirname13(targetPath), linkValue);
|
|
67689
67888
|
}
|
|
67690
67889
|
}
|
|
67691
67890
|
async function renameWithRetry(fromPath, toPath) {
|
|
@@ -67744,10 +67943,7 @@ function removeStaleMarketplacePluginBlocks(config, marketplaceName, keepPluginN
|
|
|
67744
67943
|
}
|
|
67745
67944
|
function removeStaleMarketplaceHookStateBlocks(config, marketplaceName, keepPluginNames) {
|
|
67746
67945
|
return removeTomlSections(config, (header) => {
|
|
67747
|
-
const
|
|
67748
|
-
if (!header.startsWith(prefix))
|
|
67749
|
-
return false;
|
|
67750
|
-
const hookKey = parseJsonString(header.slice(prefix.length));
|
|
67946
|
+
const hookKey = parseHookStateHeaderKey(header);
|
|
67751
67947
|
if (hookKey === null)
|
|
67752
67948
|
return false;
|
|
67753
67949
|
const separator = hookKey.indexOf(":");
|
|
@@ -67832,9 +68028,10 @@ enabled = true
|
|
|
67832
68028
|
function ensureOmoBuiltinMcpPolicies(config, input) {
|
|
67833
68029
|
if (input.marketplaceName !== "sisyphuslabs" || !input.pluginNames.includes("omo"))
|
|
67834
68030
|
return config;
|
|
68031
|
+
const codegraphEnabled = input.codegraphMcpEnabled ?? true;
|
|
67835
68032
|
const gitBashEnabled = (input.platform ?? process.platform) === "win32" && input.gitBashEnabled === true;
|
|
67836
68033
|
let nextConfig = ensurePluginMcpEnabled(config, "omo@sisyphuslabs", "context7", true);
|
|
67837
|
-
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "codegraph",
|
|
68034
|
+
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "codegraph", codegraphEnabled);
|
|
67838
68035
|
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "git_bash", gitBashEnabled);
|
|
67839
68036
|
return nextConfig;
|
|
67840
68037
|
}
|
|
@@ -67927,7 +68124,7 @@ function isRootSetting(line, key) {
|
|
|
67927
68124
|
|
|
67928
68125
|
// packages/omo-codex/src/install/codex-model-catalog.ts
|
|
67929
68126
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
67930
|
-
import { join as
|
|
68127
|
+
import { join as join37 } from "node:path";
|
|
67931
68128
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
67932
68129
|
current: {
|
|
67933
68130
|
model: "gpt-5.5",
|
|
@@ -67946,7 +68143,7 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
|
67946
68143
|
]
|
|
67947
68144
|
};
|
|
67948
68145
|
async function readCodexModelCatalog(codexPackageRoot) {
|
|
67949
|
-
const catalogPath =
|
|
68146
|
+
const catalogPath = join37(codexPackageRoot, "plugin", "model-catalog.json");
|
|
67950
68147
|
try {
|
|
67951
68148
|
const parsed = JSON.parse(await readFile9(catalogPath, "utf8"));
|
|
67952
68149
|
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
@@ -68026,7 +68223,7 @@ function removeLegacyAgentsMaxThreadsSetting(config) {
|
|
|
68026
68223
|
|
|
68027
68224
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
68028
68225
|
async function updateCodexConfig(input) {
|
|
68029
|
-
await mkdir5(
|
|
68226
|
+
await mkdir5(dirname14(input.configPath), { recursive: true });
|
|
68030
68227
|
let config = "";
|
|
68031
68228
|
if (await exists(input.configPath))
|
|
68032
68229
|
config = await readFile10(input.configPath, "utf8");
|
|
@@ -68077,7 +68274,7 @@ async function exists(path7) {
|
|
|
68077
68274
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
68078
68275
|
import { createHash as createHash2 } from "node:crypto";
|
|
68079
68276
|
import { readFile as readFile11 } from "node:fs/promises";
|
|
68080
|
-
import { join as
|
|
68277
|
+
import { join as join38 } from "node:path";
|
|
68081
68278
|
var EVENT_LABELS = new Map([
|
|
68082
68279
|
["PreToolUse", "pre_tool_use"],
|
|
68083
68280
|
["PermissionRequest", "permission_request"],
|
|
@@ -68091,7 +68288,7 @@ var EVENT_LABELS = new Map([
|
|
|
68091
68288
|
["Stop", "stop"]
|
|
68092
68289
|
]);
|
|
68093
68290
|
async function trustedHookStatesForPlugin(input) {
|
|
68094
|
-
const manifestPath =
|
|
68291
|
+
const manifestPath = join38(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
68095
68292
|
if (!await exists2(manifestPath))
|
|
68096
68293
|
return [];
|
|
68097
68294
|
const manifest = JSON.parse(await readFile11(manifestPath, "utf8"));
|
|
@@ -68099,7 +68296,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
68099
68296
|
return [];
|
|
68100
68297
|
const states = [];
|
|
68101
68298
|
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
68102
|
-
const hooksPath =
|
|
68299
|
+
const hooksPath = join38(input.pluginRoot, hookPath);
|
|
68103
68300
|
if (!await exists2(hooksPath))
|
|
68104
68301
|
continue;
|
|
68105
68302
|
const parsed = JSON.parse(await readFile11(hooksPath, "utf8"));
|
|
@@ -68229,11 +68426,11 @@ function toCodexResolution(resolution) {
|
|
|
68229
68426
|
|
|
68230
68427
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68231
68428
|
import { copyFile, lstat as lstat7, mkdir as mkdir6, readFile as readFile13, readdir as readdir4, rm as rm6, writeFile as writeFile6 } from "node:fs/promises";
|
|
68232
|
-
import { basename as
|
|
68429
|
+
import { basename as basename9, join as join40 } from "node:path";
|
|
68233
68430
|
|
|
68234
68431
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
68235
68432
|
import { lstat as lstat6, readFile as readFile12, rm as rm5 } from "node:fs/promises";
|
|
68236
|
-
import { join as
|
|
68433
|
+
import { join as join39 } from "node:path";
|
|
68237
68434
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
68238
68435
|
{
|
|
68239
68436
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -68245,11 +68442,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
68245
68442
|
}
|
|
68246
68443
|
];
|
|
68247
68444
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
68248
|
-
const agentsDir =
|
|
68445
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68249
68446
|
if (!await exists3(agentsDir))
|
|
68250
68447
|
return;
|
|
68251
68448
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
68252
|
-
const agentPath =
|
|
68449
|
+
const agentPath = join39(agentsDir, retiredAgent.fileName);
|
|
68253
68450
|
if (!await exists3(agentPath))
|
|
68254
68451
|
continue;
|
|
68255
68452
|
const agentStat = await lstat6(agentPath);
|
|
@@ -68292,7 +68489,7 @@ function nodeErrorCode(error) {
|
|
|
68292
68489
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68293
68490
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
68294
68491
|
async function capturePreservedAgentReasoning(input) {
|
|
68295
|
-
const agentsDir =
|
|
68492
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
68296
68493
|
if (!await exists4(agentsDir))
|
|
68297
68494
|
return new Map;
|
|
68298
68495
|
const preserved = new Map;
|
|
@@ -68300,7 +68497,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68300
68497
|
for (const entry of agentEntries) {
|
|
68301
68498
|
if (!entry.name.endsWith(".toml"))
|
|
68302
68499
|
continue;
|
|
68303
|
-
const content = await readTextIfExists2(
|
|
68500
|
+
const content = await readTextIfExists2(join40(agentsDir, entry.name));
|
|
68304
68501
|
if (content === null)
|
|
68305
68502
|
continue;
|
|
68306
68503
|
const effort = extractReasoningEffort(content);
|
|
@@ -68310,7 +68507,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68310
68507
|
return preserved;
|
|
68311
68508
|
}
|
|
68312
68509
|
async function capturePreservedAgentServiceTier(input) {
|
|
68313
|
-
const agentsDir =
|
|
68510
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
68314
68511
|
if (!await exists4(agentsDir))
|
|
68315
68512
|
return new Map;
|
|
68316
68513
|
const preserved = new Map;
|
|
@@ -68318,7 +68515,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
68318
68515
|
for (const entry of agentEntries) {
|
|
68319
68516
|
if (!entry.name.endsWith(".toml"))
|
|
68320
68517
|
continue;
|
|
68321
|
-
const content = await readTextIfExists2(
|
|
68518
|
+
const content = await readTextIfExists2(join40(agentsDir, entry.name));
|
|
68322
68519
|
if (content === null)
|
|
68323
68520
|
continue;
|
|
68324
68521
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -68332,13 +68529,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
68332
68529
|
await writeManifest(input.pluginRoot, []);
|
|
68333
68530
|
return [];
|
|
68334
68531
|
}
|
|
68335
|
-
const agentsDir =
|
|
68532
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
68336
68533
|
await mkdir6(agentsDir, { recursive: true });
|
|
68337
68534
|
const linked = [];
|
|
68338
68535
|
for (const agentPath of bundledAgents) {
|
|
68339
|
-
const agentFileName =
|
|
68536
|
+
const agentFileName = basename9(agentPath);
|
|
68340
68537
|
const agentName = agentNameFromToml(agentFileName);
|
|
68341
|
-
const linkPath =
|
|
68538
|
+
const linkPath = join40(agentsDir, agentFileName);
|
|
68342
68539
|
await replaceWithCopy(linkPath, agentPath);
|
|
68343
68540
|
await restorePreservedReasoning({
|
|
68344
68541
|
agentName,
|
|
@@ -68368,7 +68565,7 @@ async function restorePreservedServiceTier(input) {
|
|
|
68368
68565
|
await writeFile6(input.linkPath, replacement.content);
|
|
68369
68566
|
}
|
|
68370
68567
|
async function discoverBundledAgents(pluginRoot) {
|
|
68371
|
-
const componentsRoot =
|
|
68568
|
+
const componentsRoot = join40(pluginRoot, "components");
|
|
68372
68569
|
if (!await exists4(componentsRoot))
|
|
68373
68570
|
return [];
|
|
68374
68571
|
const componentEntries = await readdir4(componentsRoot, { withFileTypes: true });
|
|
@@ -68376,14 +68573,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
68376
68573
|
for (const entry of componentEntries) {
|
|
68377
68574
|
if (!entry.isDirectory())
|
|
68378
68575
|
continue;
|
|
68379
|
-
const agentsRoot =
|
|
68576
|
+
const agentsRoot = join40(componentsRoot, entry.name, "agents");
|
|
68380
68577
|
if (!await exists4(agentsRoot))
|
|
68381
68578
|
continue;
|
|
68382
68579
|
const agentEntries = await readdir4(agentsRoot, { withFileTypes: true });
|
|
68383
68580
|
for (const file2 of agentEntries) {
|
|
68384
68581
|
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
68385
68582
|
continue;
|
|
68386
|
-
agents.push(
|
|
68583
|
+
agents.push(join40(agentsRoot, file2.name));
|
|
68387
68584
|
}
|
|
68388
68585
|
}
|
|
68389
68586
|
agents.sort();
|
|
@@ -68403,7 +68600,7 @@ async function prepareReplacement(linkPath) {
|
|
|
68403
68600
|
await rm6(linkPath, { force: true });
|
|
68404
68601
|
}
|
|
68405
68602
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
68406
|
-
const manifestPath =
|
|
68603
|
+
const manifestPath = join40(pluginRoot, MANIFEST_FILE);
|
|
68407
68604
|
const payload = { agents: [...agentPaths].sort() };
|
|
68408
68605
|
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
68409
68606
|
`);
|
|
@@ -68442,7 +68639,7 @@ function extractTopLevelStringSetting(content, key) {
|
|
|
68442
68639
|
const rawValue = topLevelStringSettingRawValue(line, key);
|
|
68443
68640
|
if (rawValue === undefined)
|
|
68444
68641
|
continue;
|
|
68445
|
-
const parsed =
|
|
68642
|
+
const parsed = parseJsonString(rawValue);
|
|
68446
68643
|
if (parsed !== null)
|
|
68447
68644
|
return parsed;
|
|
68448
68645
|
}
|
|
@@ -68503,7 +68700,7 @@ function isSectionHeader2(line) {
|
|
|
68503
68700
|
function agentNameFromToml(fileName) {
|
|
68504
68701
|
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
68505
68702
|
}
|
|
68506
|
-
function
|
|
68703
|
+
function parseJsonString(value) {
|
|
68507
68704
|
try {
|
|
68508
68705
|
const parsed = JSON.parse(value);
|
|
68509
68706
|
return typeof parsed === "string" ? parsed : null;
|
|
@@ -68531,10 +68728,10 @@ function nodeErrorCode2(error) {
|
|
|
68531
68728
|
|
|
68532
68729
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
68533
68730
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
68534
|
-
import { join as
|
|
68731
|
+
import { join as join41 } from "node:path";
|
|
68535
68732
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
68536
68733
|
async function readMarketplace(repoRoot, options) {
|
|
68537
|
-
const marketplacePath = options?.marketplacePath ??
|
|
68734
|
+
const marketplacePath = options?.marketplacePath ?? join41(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
68538
68735
|
const raw = await readFile14(marketplacePath, "utf8");
|
|
68539
68736
|
const parsed = JSON.parse(raw);
|
|
68540
68737
|
if (!isPlainRecord3(parsed))
|
|
@@ -68553,10 +68750,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
68553
68750
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
68554
68751
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
68555
68752
|
const relativePath = sourcePath.slice(2);
|
|
68556
|
-
return
|
|
68753
|
+
return join41(repoRoot, ...relativePath.split(/[\\/]/));
|
|
68557
68754
|
}
|
|
68558
68755
|
async function readPluginManifest(pluginRoot) {
|
|
68559
|
-
const raw = await readFile14(
|
|
68756
|
+
const raw = await readFile14(join41(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
68560
68757
|
const parsed = JSON.parse(raw);
|
|
68561
68758
|
if (!isPlainRecord3(parsed))
|
|
68562
68759
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -68638,7 +68835,7 @@ function validateLocalSourcePath(path7) {
|
|
|
68638
68835
|
|
|
68639
68836
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
68640
68837
|
import { cp as cp3, mkdir as mkdir7, rename as rename3, rm as rm7, writeFile as writeFile7 } from "node:fs/promises";
|
|
68641
|
-
import { join as
|
|
68838
|
+
import { join as join42, sep as sep6 } from "node:path";
|
|
68642
68839
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
68643
68840
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
68644
68841
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -68651,21 +68848,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
68651
68848
|
return snapshotPlugins;
|
|
68652
68849
|
}
|
|
68653
68850
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
68654
|
-
return
|
|
68851
|
+
return join42(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
68655
68852
|
}
|
|
68656
68853
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
68657
|
-
const manifestDir =
|
|
68854
|
+
const manifestDir = join42(marketplaceRoot, ".agents", "plugins");
|
|
68658
68855
|
await mkdir7(manifestDir, { recursive: true });
|
|
68659
|
-
const tempPath =
|
|
68856
|
+
const tempPath = join42(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
68660
68857
|
await writeFile7(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
68661
68858
|
`);
|
|
68662
|
-
await rename3(tempPath,
|
|
68859
|
+
await rename3(tempPath, join42(manifestDir, "marketplace.json"));
|
|
68663
68860
|
}
|
|
68664
68861
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
68665
|
-
const pluginsDir =
|
|
68862
|
+
const pluginsDir = join42(marketplaceRoot, "plugins");
|
|
68666
68863
|
await mkdir7(pluginsDir, { recursive: true });
|
|
68667
|
-
const targetPath =
|
|
68668
|
-
const tempPath =
|
|
68864
|
+
const targetPath = join42(pluginsDir, plugin.name);
|
|
68865
|
+
const tempPath = join42(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
68669
68866
|
await rm7(tempPath, { recursive: true, force: true });
|
|
68670
68867
|
await cp3(plugin.sourcePath, tempPath, {
|
|
68671
68868
|
recursive: true,
|
|
@@ -68687,10 +68884,10 @@ function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
|
68687
68884
|
|
|
68688
68885
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
68689
68886
|
import { readdir as readdir5, readFile as readFile15, writeFile as writeFile8 } from "node:fs/promises";
|
|
68690
|
-
import { join as
|
|
68887
|
+
import { join as join43 } from "node:path";
|
|
68691
68888
|
async function readDistributionManifest(repoRoot) {
|
|
68692
68889
|
try {
|
|
68693
|
-
const parsed = JSON.parse(await readFile15(
|
|
68890
|
+
const parsed = JSON.parse(await readFile15(join43(repoRoot, "package.json"), "utf8"));
|
|
68694
68891
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
68695
68892
|
return;
|
|
68696
68893
|
return {
|
|
@@ -68710,19 +68907,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
68710
68907
|
return input.manifestVersion ?? "local";
|
|
68711
68908
|
}
|
|
68712
68909
|
async function stampLazyCodexPluginVersion(input) {
|
|
68713
|
-
const manifestPath =
|
|
68910
|
+
const manifestPath = join43(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
68714
68911
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
68715
68912
|
await stampJsonVersion(manifestPath, input.version);
|
|
68716
|
-
await stampJsonVersion(
|
|
68913
|
+
await stampJsonVersion(join43(input.pluginRoot, "package.json"), input.version);
|
|
68717
68914
|
for (const hookPath of hookPaths) {
|
|
68718
|
-
await stampHookStatusMessages(
|
|
68915
|
+
await stampHookStatusMessages(join43(input.pluginRoot, hookPath), input.version);
|
|
68719
68916
|
}
|
|
68720
68917
|
await stampComponentVersions(input);
|
|
68721
68918
|
}
|
|
68722
68919
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
68723
68920
|
if (input.distributionManifest === undefined)
|
|
68724
68921
|
return;
|
|
68725
|
-
await writeFile8(
|
|
68922
|
+
await writeFile8(join43(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
68726
68923
|
packageName: input.distributionManifest.name,
|
|
68727
68924
|
version: input.distributionManifest.version
|
|
68728
68925
|
}, null, "\t")}
|
|
@@ -68779,16 +68976,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
68779
68976
|
async function stampComponentVersions(input) {
|
|
68780
68977
|
let entries;
|
|
68781
68978
|
try {
|
|
68782
|
-
entries = await readdir5(
|
|
68979
|
+
entries = await readdir5(join43(input.pluginRoot, "components"));
|
|
68783
68980
|
} catch (error) {
|
|
68784
68981
|
if (error instanceof Error)
|
|
68785
68982
|
return;
|
|
68786
68983
|
throw error;
|
|
68787
68984
|
}
|
|
68788
68985
|
for (const entry of entries) {
|
|
68789
|
-
const componentRoot =
|
|
68790
|
-
await stampJsonVersion(
|
|
68791
|
-
await stampHookStatusMessages(
|
|
68986
|
+
const componentRoot = join43(input.pluginRoot, "components", entry);
|
|
68987
|
+
await stampJsonVersion(join43(componentRoot, "package.json"), input.version);
|
|
68988
|
+
await stampHookStatusMessages(join43(componentRoot, "hooks", "hooks.json"), input.version);
|
|
68792
68989
|
}
|
|
68793
68990
|
}
|
|
68794
68991
|
function stampHookGroups(hooks, version) {
|
|
@@ -68842,7 +69039,7 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
68842
69039
|
|
|
68843
69040
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
68844
69041
|
import { copyFile as copyFile2, lstat as lstat8, readFile as readFile16, writeFile as writeFile9 } from "node:fs/promises";
|
|
68845
|
-
import { dirname as
|
|
69042
|
+
import { dirname as dirname15, join as join44, resolve as resolve12 } from "node:path";
|
|
68846
69043
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
68847
69044
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
68848
69045
|
".codex/hooks.json",
|
|
@@ -68945,37 +69142,37 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
68945
69142
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
68946
69143
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
68947
69144
|
}
|
|
68948
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
69145
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join44(resolve12(codexHome), "config.toml");
|
|
68949
69146
|
let current = resolve12(startDirectory);
|
|
68950
69147
|
const configPathsFromCwd = [];
|
|
68951
69148
|
while (true) {
|
|
68952
|
-
const configPath =
|
|
69149
|
+
const configPath = join44(current, ".codex", "config.toml");
|
|
68953
69150
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
68954
69151
|
if (codexHomeConfigPath === null || resolve12(configPath) !== codexHomeConfigPath) {
|
|
68955
69152
|
configPathsFromCwd.push(configPath);
|
|
68956
69153
|
}
|
|
68957
69154
|
}
|
|
68958
|
-
if (await exists5(
|
|
69155
|
+
if (await exists5(join44(current, ".git"))) {
|
|
68959
69156
|
return configPathsFromCwd.length === 0 ? null : {
|
|
68960
69157
|
projectRoot: current,
|
|
68961
69158
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
68962
69159
|
artifactRoots: artifactRootsForConfigPaths(configPathsFromCwd)
|
|
68963
69160
|
};
|
|
68964
69161
|
}
|
|
68965
|
-
const parent =
|
|
69162
|
+
const parent = dirname15(current);
|
|
68966
69163
|
if (parent === current) {
|
|
68967
69164
|
const nearestConfigPath = configPathsFromCwd[0];
|
|
68968
69165
|
return nearestConfigPath === undefined ? null : {
|
|
68969
|
-
projectRoot:
|
|
69166
|
+
projectRoot: dirname15(dirname15(nearestConfigPath)),
|
|
68970
69167
|
configPaths: [nearestConfigPath],
|
|
68971
|
-
artifactRoots: [
|
|
69168
|
+
artifactRoots: [dirname15(dirname15(nearestConfigPath))]
|
|
68972
69169
|
};
|
|
68973
69170
|
}
|
|
68974
69171
|
current = parent;
|
|
68975
69172
|
}
|
|
68976
69173
|
}
|
|
68977
69174
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
68978
|
-
const codexDirStat = await maybeLstat(
|
|
69175
|
+
const codexDirStat = await maybeLstat(join44(directory, ".codex"));
|
|
68979
69176
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
68980
69177
|
return false;
|
|
68981
69178
|
const configStat = await maybeLstat(configPath);
|
|
@@ -68984,7 +69181,7 @@ async function isRegularProjectLocalConfig(directory, configPath) {
|
|
|
68984
69181
|
function artifactRootsForConfigPaths(configPaths) {
|
|
68985
69182
|
const roots = [];
|
|
68986
69183
|
for (const configPath of configPaths) {
|
|
68987
|
-
const root =
|
|
69184
|
+
const root = dirname15(dirname15(configPath));
|
|
68988
69185
|
if (!roots.includes(root))
|
|
68989
69186
|
roots.push(root);
|
|
68990
69187
|
}
|
|
@@ -68995,7 +69192,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
68995
69192
|
const seenPaths = new Set;
|
|
68996
69193
|
for (const projectRoot of projectRoots) {
|
|
68997
69194
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
68998
|
-
const artifactPath =
|
|
69195
|
+
const artifactPath = join44(projectRoot, relativePath);
|
|
68999
69196
|
if (seenPaths.has(artifactPath))
|
|
69000
69197
|
continue;
|
|
69001
69198
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -69072,11 +69269,11 @@ function formatUnknownError(error) {
|
|
|
69072
69269
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
69073
69270
|
import { readFile as readFile17, readdir as readdir6, rm as rm8 } from "node:fs/promises";
|
|
69074
69271
|
import { connect } from "node:net";
|
|
69075
|
-
import { join as
|
|
69272
|
+
import { join as join45 } from "node:path";
|
|
69076
69273
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
69077
69274
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
69078
69275
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
69079
|
-
const daemonRoot =
|
|
69276
|
+
const daemonRoot = join45(codexHome, "codex-lsp", "daemon");
|
|
69080
69277
|
const reaped = [];
|
|
69081
69278
|
let entries;
|
|
69082
69279
|
try {
|
|
@@ -69085,9 +69282,9 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
69085
69282
|
return reaped;
|
|
69086
69283
|
}
|
|
69087
69284
|
for (const entry of entries) {
|
|
69088
|
-
const versionDir =
|
|
69089
|
-
const pid = await readPidFile(
|
|
69090
|
-
const socketPath = await readEndpointFile(
|
|
69285
|
+
const versionDir = join45(daemonRoot, entry);
|
|
69286
|
+
const pid = await readPidFile(join45(versionDir, "daemon.pid"));
|
|
69287
|
+
const socketPath = await readEndpointFile(join45(versionDir, "daemon.endpoint"));
|
|
69091
69288
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
69092
69289
|
reaped.push(pid);
|
|
69093
69290
|
}
|
|
@@ -69141,7 +69338,7 @@ function sendSigterm(pid) {
|
|
|
69141
69338
|
|
|
69142
69339
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
69143
69340
|
import { homedir as homedir5 } from "node:os";
|
|
69144
|
-
import { join as
|
|
69341
|
+
import { join as join46, resolve as resolve13 } from "node:path";
|
|
69145
69342
|
function resolveCodexInstallerBinDir(input) {
|
|
69146
69343
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
69147
69344
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -69150,15 +69347,15 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
69150
69347
|
const defaultCodexHome = resolve13(homeDir, ".codex");
|
|
69151
69348
|
const resolvedCodexHome = resolve13(input.codexHome);
|
|
69152
69349
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
69153
|
-
return
|
|
69350
|
+
return join46(resolvedCodexHome, "bin");
|
|
69154
69351
|
return resolve13(homeDir, ".local", "bin");
|
|
69155
69352
|
}
|
|
69156
69353
|
|
|
69157
69354
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
69158
|
-
import { join as
|
|
69355
|
+
import { join as join47 } from "node:path";
|
|
69159
69356
|
async function seedAndMigrateOmoSot(input) {
|
|
69160
69357
|
const commandEnv = { ...input.env };
|
|
69161
|
-
const scriptPath =
|
|
69358
|
+
const scriptPath = join47(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
69162
69359
|
try {
|
|
69163
69360
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
69164
69361
|
cwd: input.repoRoot,
|
|
@@ -69173,7 +69370,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
69173
69370
|
|
|
69174
69371
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
69175
69372
|
init_src();
|
|
69176
|
-
import { join as
|
|
69373
|
+
import { join as join48 } from "node:path";
|
|
69177
69374
|
function describeResult(result) {
|
|
69178
69375
|
if (result.kind === "succeeded")
|
|
69179
69376
|
return null;
|
|
@@ -69187,7 +69384,7 @@ async function installAstGrepForCodex(options) {
|
|
|
69187
69384
|
return;
|
|
69188
69385
|
const platform = options.platform ?? process.platform;
|
|
69189
69386
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
69190
|
-
const skillDir =
|
|
69387
|
+
const skillDir = join48(plugin.path, "skills", "ast-grep");
|
|
69191
69388
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
69192
69389
|
try {
|
|
69193
69390
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -69215,12 +69412,13 @@ async function trackCodexInstallTelemetry() {
|
|
|
69215
69412
|
}
|
|
69216
69413
|
|
|
69217
69414
|
// packages/omo-codex/src/install/install-codex.ts
|
|
69415
|
+
init_src();
|
|
69218
69416
|
var SISYPHUS_LEGACY_CACHE_MARKETPLACES = ["lazycodex", "code-yeongyu-codex-plugins"];
|
|
69219
69417
|
async function runCodexInstaller(options = {}) {
|
|
69220
69418
|
const env3 = options.env ?? process.env;
|
|
69221
69419
|
const platform = options.platform ?? process.platform;
|
|
69222
69420
|
const repoRoot = resolve14(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
69223
|
-
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ??
|
|
69421
|
+
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ?? join51(homedir6(), ".codex"));
|
|
69224
69422
|
const projectDirectory = resolve14(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
69225
69423
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
69226
69424
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -69238,9 +69436,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
69238
69436
|
if (!gitBashResolution.found) {
|
|
69239
69437
|
throw new Error(gitBashResolution.installHint);
|
|
69240
69438
|
}
|
|
69241
|
-
const codexPackageRoot =
|
|
69439
|
+
const codexPackageRoot = join51(repoRoot, "packages", "omo-codex");
|
|
69242
69440
|
const marketplace = await readMarketplace(repoRoot, {
|
|
69243
|
-
marketplacePath:
|
|
69441
|
+
marketplacePath: join51(codexPackageRoot, "marketplace.json")
|
|
69244
69442
|
});
|
|
69245
69443
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
69246
69444
|
const installed = [];
|
|
@@ -69282,7 +69480,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69282
69480
|
if (runtimeLink !== null)
|
|
69283
69481
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
69284
69482
|
else
|
|
69285
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
69483
|
+
log4(`Warning: skipped the omo runtime wrapper because ${join51(repoRoot, "dist", "cli", "index.js")} is missing; omo sparkshell/ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
69286
69484
|
}
|
|
69287
69485
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
69288
69486
|
installed.push(plugin);
|
|
@@ -69335,13 +69533,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
69335
69533
|
});
|
|
69336
69534
|
}
|
|
69337
69535
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
69338
|
-
const marketplaceRoot =
|
|
69536
|
+
const marketplaceRoot = join51(codexHome, "plugins", "cache", marketplace.name);
|
|
69339
69537
|
await writeCachedMarketplaceManifest({
|
|
69340
69538
|
marketplaceName: marketplace.name,
|
|
69341
69539
|
marketplaceRoot,
|
|
69342
69540
|
plugins: installed
|
|
69343
69541
|
});
|
|
69344
|
-
const configPath =
|
|
69542
|
+
const configPath = join51(codexHome, "config.toml");
|
|
69345
69543
|
await updateCodexConfig({
|
|
69346
69544
|
configPath,
|
|
69347
69545
|
repoRoot: codexPackageRoot,
|
|
@@ -69349,6 +69547,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69349
69547
|
marketplaceSource: codexMarketplaceSource(marketplaceRoot),
|
|
69350
69548
|
pluginNames: marketplace.plugins.map((plugin) => plugin.name),
|
|
69351
69549
|
platform,
|
|
69550
|
+
codegraphMcpEnabled: options.codegraphMcpEnabled ?? resolveCodegraphNodeSupport({ env: env3 }).supported,
|
|
69352
69551
|
gitBashEnabled: platform === "win32" && gitBashResolution.found,
|
|
69353
69552
|
trustedHookStates,
|
|
69354
69553
|
agentConfigs: [...agentConfigs.values()].sort((left, right) => left.name.localeCompare(right.name)),
|
|
@@ -69400,7 +69599,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
69400
69599
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
69401
69600
|
if (isRepoRootWithCodexPlugin(current))
|
|
69402
69601
|
return current;
|
|
69403
|
-
for (const wrapperPackageRoot of [
|
|
69602
|
+
for (const wrapperPackageRoot of [join51(current, "node_modules", "oh-my-openagent"), join51(current, "oh-my-openagent")]) {
|
|
69404
69603
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
69405
69604
|
return wrapperPackageRoot;
|
|
69406
69605
|
}
|
|
@@ -69418,7 +69617,7 @@ function findRepoRoot(input) {
|
|
|
69418
69617
|
return findRepoRootFromImporter(input.importerDir);
|
|
69419
69618
|
}
|
|
69420
69619
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
69421
|
-
return
|
|
69620
|
+
return existsSync30(join51(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
69422
69621
|
}
|
|
69423
69622
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
69424
69623
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -69426,7 +69625,7 @@ function codexMarketplaceSource(marketplaceRoot) {
|
|
|
69426
69625
|
// packages/omo-codex/src/install/codex-installation-detection.ts
|
|
69427
69626
|
init_bun_which_shim();
|
|
69428
69627
|
import { execFile as execFile2 } from "node:child_process";
|
|
69429
|
-
import { existsSync as
|
|
69628
|
+
import { existsSync as existsSync31 } from "node:fs";
|
|
69430
69629
|
import { homedir as homedir7 } from "node:os";
|
|
69431
69630
|
import { posix as posix3, win32 as win323 } from "node:path";
|
|
69432
69631
|
var CODEX_PATH_CHECK_LABEL = "codex (PATH)";
|
|
@@ -69439,7 +69638,7 @@ async function detectCodexInstallation(input = {}) {
|
|
|
69439
69638
|
const platform = input.platform ?? process.platform;
|
|
69440
69639
|
const env3 = input.env ?? process.env;
|
|
69441
69640
|
const homeDir = input.homeDir ?? homedir7();
|
|
69442
|
-
const exists6 = input.exists ??
|
|
69641
|
+
const exists6 = input.exists ?? existsSync31;
|
|
69443
69642
|
const which2 = input.which ?? bunWhich;
|
|
69444
69643
|
const checkedPaths = [CODEX_PATH_CHECK_LABEL];
|
|
69445
69644
|
const cliPath = nonEmptyValue2(which2("codex"));
|
|
@@ -69555,11 +69754,11 @@ function defaultRunCommand2(command, args) {
|
|
|
69555
69754
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
69556
69755
|
import { lstat as lstat10, readFile as readFile19, readdir as readdir7, rm as rm9, rmdir } from "node:fs/promises";
|
|
69557
69756
|
import { homedir as homedir8 } from "node:os";
|
|
69558
|
-
import { isAbsolute as
|
|
69757
|
+
import { isAbsolute as isAbsolute9, join as join53, relative as relative7, resolve as resolve16 } from "node:path";
|
|
69559
69758
|
|
|
69560
69759
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
69561
69760
|
import { lstat as lstat9, mkdir as mkdir8, readFile as readFile18, writeFile as writeFile10 } from "node:fs/promises";
|
|
69562
|
-
import { dirname as
|
|
69761
|
+
import { dirname as dirname17 } from "node:path";
|
|
69563
69762
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
69564
69763
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
69565
69764
|
var CURRENT_MANAGED_CODEX_AGENT_NAMES2 = [
|
|
@@ -69593,7 +69792,7 @@ async function cleanupCodexConfig(configPath, now) {
|
|
|
69593
69792
|
if (next === original)
|
|
69594
69793
|
return { changed: false };
|
|
69595
69794
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
69596
|
-
await mkdir8(
|
|
69795
|
+
await mkdir8(dirname17(configPath), { recursive: true });
|
|
69597
69796
|
await writeFile10(backupPath, original);
|
|
69598
69797
|
await writeFile10(configPath, `${next.trimEnd()}
|
|
69599
69798
|
`);
|
|
@@ -69604,21 +69803,18 @@ function removeManagedAgentBlocks(config) {
|
|
|
69604
69803
|
return splitTomlSections2(config).filter((section) => {
|
|
69605
69804
|
if (section.header === null)
|
|
69606
69805
|
return true;
|
|
69607
|
-
const agentName =
|
|
69806
|
+
const agentName = parseAgentHeaderName(section.header);
|
|
69608
69807
|
if (agentName === null || !managedAgentNames.has(agentName))
|
|
69609
69808
|
return true;
|
|
69610
69809
|
return !section.text.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`);
|
|
69611
69810
|
}).map((section) => section.text).join("");
|
|
69612
69811
|
}
|
|
69613
69812
|
function isManagedPluginHeader(header, marketplace) {
|
|
69614
|
-
const pluginKey =
|
|
69813
|
+
const pluginKey = parsePluginHeaderKey(header);
|
|
69615
69814
|
return pluginKey !== null && pluginKey.endsWith(`@${marketplace}`);
|
|
69616
69815
|
}
|
|
69617
69816
|
function isManagedHookStateHeader(header, marketplace) {
|
|
69618
|
-
const
|
|
69619
|
-
if (!header.startsWith(prefix))
|
|
69620
|
-
return false;
|
|
69621
|
-
const hookKey = parseJsonString3(header.slice(prefix.length));
|
|
69817
|
+
const hookKey = parseHookStateHeaderKey(header);
|
|
69622
69818
|
if (hookKey === null)
|
|
69623
69819
|
return false;
|
|
69624
69820
|
const separator = hookKey.indexOf(":");
|
|
@@ -69655,48 +69851,6 @@ function parseTomlHeader2(line) {
|
|
|
69655
69851
|
return null;
|
|
69656
69852
|
return trimmed.slice(1, -1);
|
|
69657
69853
|
}
|
|
69658
|
-
function parsePluginHeaderKey2(header) {
|
|
69659
|
-
const prefix = "plugins.";
|
|
69660
|
-
if (!header.startsWith(prefix))
|
|
69661
|
-
return null;
|
|
69662
|
-
return parseLeadingJsonString2(header.slice(prefix.length));
|
|
69663
|
-
}
|
|
69664
|
-
function parseAgentHeaderName2(header) {
|
|
69665
|
-
const prefix = "agents.";
|
|
69666
|
-
if (!header.startsWith(prefix))
|
|
69667
|
-
return null;
|
|
69668
|
-
const key = header.slice(prefix.length);
|
|
69669
|
-
return key.startsWith('"') ? parseLeadingJsonString2(key) : key;
|
|
69670
|
-
}
|
|
69671
|
-
function parseLeadingJsonString2(value) {
|
|
69672
|
-
if (!value.startsWith('"'))
|
|
69673
|
-
return parseJsonString3(value);
|
|
69674
|
-
let escaped = false;
|
|
69675
|
-
for (let index = 1;index < value.length; index += 1) {
|
|
69676
|
-
const char = value[index];
|
|
69677
|
-
if (escaped) {
|
|
69678
|
-
escaped = false;
|
|
69679
|
-
continue;
|
|
69680
|
-
}
|
|
69681
|
-
if (char === "\\") {
|
|
69682
|
-
escaped = true;
|
|
69683
|
-
continue;
|
|
69684
|
-
}
|
|
69685
|
-
if (char === '"')
|
|
69686
|
-
return parseJsonString3(value.slice(0, index + 1));
|
|
69687
|
-
}
|
|
69688
|
-
return null;
|
|
69689
|
-
}
|
|
69690
|
-
function parseJsonString3(value) {
|
|
69691
|
-
try {
|
|
69692
|
-
const parsed = JSON.parse(value);
|
|
69693
|
-
return typeof parsed === "string" ? parsed : null;
|
|
69694
|
-
} catch (error) {
|
|
69695
|
-
if (error instanceof Error)
|
|
69696
|
-
return null;
|
|
69697
|
-
return null;
|
|
69698
|
-
}
|
|
69699
|
-
}
|
|
69700
69854
|
function formatBackupTimestamp2(date) {
|
|
69701
69855
|
return date.toISOString().replace(/[:.]/g, "-");
|
|
69702
69856
|
}
|
|
@@ -69716,23 +69870,69 @@ function nodeErrorCode4(error) {
|
|
|
69716
69870
|
return typeof error.code === "string" ? error.code : null;
|
|
69717
69871
|
}
|
|
69718
69872
|
|
|
69873
|
+
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
69874
|
+
import { dirname as dirname18, isAbsolute as isAbsolute8, join as join52, relative as relative6, resolve as resolve15 } from "node:path";
|
|
69875
|
+
function validateManagedCleanupTarget(input) {
|
|
69876
|
+
if (!isAbsolute8(input.path))
|
|
69877
|
+
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
69878
|
+
const codexHome = resolve15(input.codexHome);
|
|
69879
|
+
if (dirname18(codexHome) === codexHome)
|
|
69880
|
+
return skipped(input.path, "Codex home resolves to a filesystem root");
|
|
69881
|
+
const target = resolve15(input.path);
|
|
69882
|
+
if (!isWithinDirectory(codexHome, target))
|
|
69883
|
+
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
69884
|
+
if (target === codexHome)
|
|
69885
|
+
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
69886
|
+
const exactManagedRoots = new Set([
|
|
69887
|
+
resolve15(join52(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
69888
|
+
resolve15(join52(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
69889
|
+
resolve15(join52(codexHome, "runtime", "ast-grep")),
|
|
69890
|
+
resolve15(join52(codexHome, "runtime", "node")),
|
|
69891
|
+
resolve15(join52(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
69892
|
+
]);
|
|
69893
|
+
if (exactManagedRoots.has(target))
|
|
69894
|
+
return null;
|
|
69895
|
+
if (isManagedBootstrapDriftPath(codexHome, target))
|
|
69896
|
+
return null;
|
|
69897
|
+
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
69898
|
+
}
|
|
69899
|
+
function isWithinDirectory(parent, child) {
|
|
69900
|
+
const relativePath = relative6(parent, child);
|
|
69901
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute8(relativePath);
|
|
69902
|
+
}
|
|
69903
|
+
function isManagedBootstrapDriftPath(codexHome, target) {
|
|
69904
|
+
const relativePath = relative6(codexHome, target);
|
|
69905
|
+
const segments = relativePath.split(/[\\/]/);
|
|
69906
|
+
if (segments[0] !== "plugins")
|
|
69907
|
+
return false;
|
|
69908
|
+
if (segments[segments.length - 1] !== "bootstrap")
|
|
69909
|
+
return false;
|
|
69910
|
+
const ownerName = segments[segments.length - 2];
|
|
69911
|
+
return ownerName !== undefined && ownerName.startsWith("omo") && ownerName.slice("omo".length).includes("sisyphuslabs");
|
|
69912
|
+
}
|
|
69913
|
+
function skipped(path7, reason) {
|
|
69914
|
+
return { path: path7, reason };
|
|
69915
|
+
}
|
|
69916
|
+
|
|
69719
69917
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
69720
69918
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
69721
69919
|
async function cleanupCodexLight(input = {}) {
|
|
69722
69920
|
const env3 = input.env ?? process.env;
|
|
69723
|
-
const codexHome =
|
|
69724
|
-
const configPath =
|
|
69921
|
+
const codexHome = resolve16(input.codexHome ?? env3.CODEX_HOME ?? join53(homedir8(), ".codex"));
|
|
69922
|
+
const configPath = join53(codexHome, "config.toml");
|
|
69725
69923
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
69726
69924
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
69727
69925
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
69728
69926
|
const removedPaths = [];
|
|
69927
|
+
const skippedPaths = [];
|
|
69729
69928
|
const managedStatePaths = new Set([
|
|
69730
69929
|
...managedGlobalStatePaths(codexHome),
|
|
69731
69930
|
...await collectBootstrapDataDirsByGlob(codexHome)
|
|
69732
69931
|
]);
|
|
69733
69932
|
for (const path7 of managedStatePaths) {
|
|
69734
|
-
if (await removeManagedPathBestEffort(path7))
|
|
69933
|
+
if (await removeManagedPathBestEffort(path7, { codexHome, onSkip: (skip) => skippedPaths.push(skip) })) {
|
|
69735
69934
|
removedPaths.push(path7);
|
|
69935
|
+
}
|
|
69736
69936
|
}
|
|
69737
69937
|
await pruneEmptyRuntimeDirBestEffort(codexHome);
|
|
69738
69938
|
const projectDirectory = input.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd();
|
|
@@ -69750,6 +69950,7 @@ async function cleanupCodexLight(input = {}) {
|
|
|
69750
69950
|
configChanged: configCleanup.changed,
|
|
69751
69951
|
configBackupPath: configCleanup.backupPath,
|
|
69752
69952
|
removedPaths,
|
|
69953
|
+
skippedPaths,
|
|
69753
69954
|
removedAgentLinks: agentCleanup.removed,
|
|
69754
69955
|
skippedAgentLinks: agentCleanup.skipped,
|
|
69755
69956
|
projectCleanup
|
|
@@ -69757,17 +69958,17 @@ async function cleanupCodexLight(input = {}) {
|
|
|
69757
69958
|
}
|
|
69758
69959
|
function managedGlobalStatePaths(codexHome) {
|
|
69759
69960
|
return [
|
|
69760
|
-
|
|
69761
|
-
|
|
69762
|
-
|
|
69763
|
-
|
|
69764
|
-
|
|
69961
|
+
join53(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
69962
|
+
join53(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
69963
|
+
join53(codexHome, "runtime", "ast-grep"),
|
|
69964
|
+
join53(codexHome, "runtime", "node"),
|
|
69965
|
+
join53(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
69765
69966
|
];
|
|
69766
69967
|
}
|
|
69767
69968
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
69768
69969
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
69769
69970
|
const results = [];
|
|
69770
|
-
await walkForManagedBootstrapDirs(
|
|
69971
|
+
await walkForManagedBootstrapDirs(join53(codexHome, "plugins"), 0, results);
|
|
69771
69972
|
return results;
|
|
69772
69973
|
}
|
|
69773
69974
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -69779,9 +69980,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
69779
69980
|
for (const entry of entries) {
|
|
69780
69981
|
if (!entry.isDirectory())
|
|
69781
69982
|
continue;
|
|
69782
|
-
const childPath =
|
|
69983
|
+
const childPath = join53(directory, entry.name);
|
|
69783
69984
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
69784
|
-
const bootstrapDir =
|
|
69985
|
+
const bootstrapDir = join53(childPath, "bootstrap");
|
|
69785
69986
|
if (await exists6(bootstrapDir))
|
|
69786
69987
|
results.push(bootstrapDir);
|
|
69787
69988
|
continue;
|
|
@@ -69792,7 +69993,12 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
69792
69993
|
function isManagedBootstrapOwnerName(name) {
|
|
69793
69994
|
return name.startsWith("omo") && name.slice("omo".length).includes("sisyphuslabs");
|
|
69794
69995
|
}
|
|
69795
|
-
async function removeManagedPathBestEffort(path7, seams
|
|
69996
|
+
async function removeManagedPathBestEffort(path7, seams) {
|
|
69997
|
+
const skip = validateManagedCleanupTarget({ codexHome: seams.codexHome, path: path7 });
|
|
69998
|
+
if (skip !== null) {
|
|
69999
|
+
seams.onSkip?.(skip);
|
|
70000
|
+
return false;
|
|
70001
|
+
}
|
|
69796
70002
|
const removedOnFirstAttempt = await attemptRemove(path7);
|
|
69797
70003
|
await seams.afterFirstAttempt?.();
|
|
69798
70004
|
const removedOnRetry = await attemptRemove(path7);
|
|
@@ -69810,19 +70016,26 @@ async function attemptRemove(path7) {
|
|
|
69810
70016
|
}
|
|
69811
70017
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
69812
70018
|
try {
|
|
69813
|
-
await rmdir(
|
|
69814
|
-
} catch {
|
|
70019
|
+
await rmdir(join53(codexHome, "runtime"));
|
|
70020
|
+
} catch (error) {
|
|
70021
|
+
if (isExpectedRuntimePruneFailure(error))
|
|
70022
|
+
return;
|
|
70023
|
+
throw error;
|
|
70024
|
+
}
|
|
70025
|
+
}
|
|
70026
|
+
function isExpectedRuntimePruneFailure(error) {
|
|
70027
|
+
return ["ENOENT", "ENOTEMPTY", "EEXIST", "EPERM", "EBUSY", "ENOTDIR"].includes(nodeErrorCode5(error) ?? "");
|
|
69815
70028
|
}
|
|
69816
70029
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
69817
70030
|
const manifestPaths = [
|
|
69818
|
-
|
|
70031
|
+
join53(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
69819
70032
|
];
|
|
69820
|
-
const versionRoot =
|
|
70033
|
+
const versionRoot = join53(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
69821
70034
|
if (await exists6(versionRoot)) {
|
|
69822
70035
|
const entries = await readdir7(versionRoot, { withFileTypes: true });
|
|
69823
70036
|
for (const entry of entries) {
|
|
69824
70037
|
if (entry.isDirectory())
|
|
69825
|
-
manifestPaths.push(
|
|
70038
|
+
manifestPaths.push(join53(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
69826
70039
|
}
|
|
69827
70040
|
}
|
|
69828
70041
|
const paths = new Set;
|
|
@@ -69840,7 +70053,7 @@ async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
|
69840
70053
|
if (!await exists6(configPath))
|
|
69841
70054
|
return [];
|
|
69842
70055
|
const config = await readFile19(configPath, "utf8");
|
|
69843
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
70056
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join53(codexHome, "agents", `${agentName}.toml`));
|
|
69844
70057
|
}
|
|
69845
70058
|
async function readInstalledAgentManifest(manifestPath) {
|
|
69846
70059
|
if (!await exists6(manifestPath))
|
|
@@ -69851,31 +70064,31 @@ async function readInstalledAgentManifest(manifestPath) {
|
|
|
69851
70064
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
69852
70065
|
}
|
|
69853
70066
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
69854
|
-
const agentsDir =
|
|
70067
|
+
const agentsDir = join53(codexHome, "agents");
|
|
69855
70068
|
const removed = [];
|
|
69856
|
-
const
|
|
70069
|
+
const skipped2 = [];
|
|
69857
70070
|
for (const path7 of paths) {
|
|
69858
70071
|
if (!isSafeManagedAgentPath(agentsDir, path7)) {
|
|
69859
|
-
|
|
70072
|
+
skipped2.push(path7);
|
|
69860
70073
|
continue;
|
|
69861
70074
|
}
|
|
69862
70075
|
const entryStat = await maybeLstat2(path7);
|
|
69863
70076
|
if (entryStat === null)
|
|
69864
70077
|
continue;
|
|
69865
70078
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
69866
|
-
|
|
70079
|
+
skipped2.push(path7);
|
|
69867
70080
|
continue;
|
|
69868
70081
|
}
|
|
69869
70082
|
await rm9(path7, { force: true });
|
|
69870
70083
|
removed.push(path7);
|
|
69871
70084
|
}
|
|
69872
|
-
return { removed, skipped };
|
|
70085
|
+
return { removed, skipped: skipped2 };
|
|
69873
70086
|
}
|
|
69874
70087
|
function isSafeManagedAgentPath(agentsDir, path7) {
|
|
69875
|
-
if (!
|
|
70088
|
+
if (!isAbsolute9(path7))
|
|
69876
70089
|
return false;
|
|
69877
|
-
const relativePath =
|
|
69878
|
-
if (relativePath === "" || relativePath.startsWith("..") ||
|
|
70090
|
+
const relativePath = relative7(agentsDir, path7);
|
|
70091
|
+
if (relativePath === "" || relativePath.startsWith("..") || isAbsolute9(relativePath))
|
|
69879
70092
|
return false;
|
|
69880
70093
|
const fileName = relativePath.split(/[\\/]/).pop();
|
|
69881
70094
|
if (fileName === undefined)
|
|
@@ -69934,23 +70147,23 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
69934
70147
|
init_provider_availability();
|
|
69935
70148
|
|
|
69936
70149
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
69937
|
-
import { existsSync as
|
|
69938
|
-
import { join as
|
|
70150
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync10, readFileSync as readFileSync16 } from "node:fs";
|
|
70151
|
+
import { join as join55 } from "node:path";
|
|
69939
70152
|
|
|
69940
70153
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
69941
70154
|
init_shared();
|
|
69942
|
-
import { existsSync as
|
|
69943
|
-
import { join as
|
|
70155
|
+
import { existsSync as existsSync32, readFileSync as readFileSync15 } from "node:fs";
|
|
70156
|
+
import { join as join54 } from "node:path";
|
|
69944
70157
|
var TUI_SUBPATH = "tui";
|
|
69945
70158
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
69946
70159
|
function fileEntryPackageJsonPath(entry) {
|
|
69947
70160
|
let path7 = entry.slice("file:".length);
|
|
69948
70161
|
if (path7.startsWith("//"))
|
|
69949
70162
|
path7 = path7.slice(2);
|
|
69950
|
-
return
|
|
70163
|
+
return join54(path7, "package.json");
|
|
69951
70164
|
}
|
|
69952
70165
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
69953
|
-
if (!
|
|
70166
|
+
if (!existsSync32(pkgJsonPath))
|
|
69954
70167
|
return null;
|
|
69955
70168
|
try {
|
|
69956
70169
|
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
@@ -69985,14 +70198,14 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
69985
70198
|
const packageName = packageNameFromServerEntry(entry);
|
|
69986
70199
|
if (packageName === null)
|
|
69987
70200
|
return null;
|
|
69988
|
-
return packageJsonExportsTui(
|
|
70201
|
+
return packageJsonExportsTui(join54(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
69989
70202
|
}
|
|
69990
70203
|
function isOurFilePluginEntry(entry) {
|
|
69991
70204
|
if (!entry.startsWith("file:"))
|
|
69992
70205
|
return false;
|
|
69993
70206
|
try {
|
|
69994
70207
|
const pkgJsonPath = fileEntryPackageJsonPath(entry);
|
|
69995
|
-
if (!
|
|
70208
|
+
if (!existsSync32(pkgJsonPath))
|
|
69996
70209
|
return false;
|
|
69997
70210
|
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
69998
70211
|
return typeof parsed.name === "string" && ACCEPTED_PACKAGE_NAMES.includes(parsed.name);
|
|
@@ -70035,7 +70248,7 @@ function isCanonicalNamedTuiPluginEntry(entry) {
|
|
|
70035
70248
|
}
|
|
70036
70249
|
function detectServerPluginRegistration() {
|
|
70037
70250
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
70038
|
-
const configPath =
|
|
70251
|
+
const configPath = existsSync32(paths.configJsonc) ? paths.configJsonc : existsSync32(paths.configJson) ? paths.configJson : null;
|
|
70039
70252
|
if (!configPath) {
|
|
70040
70253
|
return { registered: false, configPath: null, entry: null, packageExportsTui: null };
|
|
70041
70254
|
}
|
|
@@ -70058,8 +70271,8 @@ function detectServerPluginRegistration() {
|
|
|
70058
70271
|
}
|
|
70059
70272
|
}
|
|
70060
70273
|
function detectTuiPluginRegistration() {
|
|
70061
|
-
const tuiJsonPath =
|
|
70062
|
-
if (!
|
|
70274
|
+
const tuiJsonPath = join54(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
70275
|
+
if (!existsSync32(tuiJsonPath)) {
|
|
70063
70276
|
return {
|
|
70064
70277
|
registered: false,
|
|
70065
70278
|
configPath: tuiJsonPath,
|
|
@@ -70214,11 +70427,11 @@ function readConfig(path7) {
|
|
|
70214
70427
|
return null;
|
|
70215
70428
|
}
|
|
70216
70429
|
function readServerConfig(configDir) {
|
|
70217
|
-
const jsoncPath =
|
|
70218
|
-
if (
|
|
70430
|
+
const jsoncPath = join55(configDir, "opencode.jsonc");
|
|
70431
|
+
if (existsSync33(jsoncPath))
|
|
70219
70432
|
return readConfig(jsoncPath);
|
|
70220
|
-
const jsonPath =
|
|
70221
|
-
if (
|
|
70433
|
+
const jsonPath = join55(configDir, "opencode.json");
|
|
70434
|
+
if (existsSync33(jsonPath))
|
|
70222
70435
|
return readConfig(jsonPath);
|
|
70223
70436
|
return null;
|
|
70224
70437
|
}
|
|
@@ -70238,7 +70451,7 @@ function desiredTuiEntry(serverEntry) {
|
|
|
70238
70451
|
return null;
|
|
70239
70452
|
}
|
|
70240
70453
|
function readTuiConfig(tuiJsonPath) {
|
|
70241
|
-
if (!
|
|
70454
|
+
if (!existsSync33(tuiJsonPath)) {
|
|
70242
70455
|
return { config: {}, malformed: false };
|
|
70243
70456
|
}
|
|
70244
70457
|
const config = readConfig(tuiJsonPath);
|
|
@@ -70259,7 +70472,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70259
70472
|
if (!desiredEntry) {
|
|
70260
70473
|
return { changed: false, reason: "no-server-entry" };
|
|
70261
70474
|
}
|
|
70262
|
-
const tuiJsonPath =
|
|
70475
|
+
const tuiJsonPath = join55(configDir, "tui.json");
|
|
70263
70476
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
70264
70477
|
if (malformed) {
|
|
70265
70478
|
return { changed: false, reason: "malformed" };
|
|
@@ -70275,7 +70488,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70275
70488
|
|
|
70276
70489
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
70277
70490
|
import { homedir as homedir9 } from "node:os";
|
|
70278
|
-
import { join as
|
|
70491
|
+
import { join as join56 } from "node:path";
|
|
70279
70492
|
|
|
70280
70493
|
// packages/shared-skills/index.mjs
|
|
70281
70494
|
import { fileURLToPath } from "node:url";
|
|
@@ -70294,9 +70507,9 @@ function describeResult2(result) {
|
|
|
70294
70507
|
}
|
|
70295
70508
|
async function installAstGrepForOpenCode(options = {}) {
|
|
70296
70509
|
const platform = options.platform ?? process.platform;
|
|
70297
|
-
const baseDir =
|
|
70510
|
+
const baseDir = join56(options.homeDir ?? homedir9(), ".omo");
|
|
70298
70511
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
70299
|
-
const skillDir =
|
|
70512
|
+
const skillDir = join56(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
70300
70513
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
70301
70514
|
try {
|
|
70302
70515
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -72175,6 +72388,9 @@ async function cleanup(options) {
|
|
|
72175
72388
|
for (const path7 of result.removedPaths) {
|
|
72176
72389
|
console.log(`- Removed ${path7}`);
|
|
72177
72390
|
}
|
|
72391
|
+
for (const skippedPath of result.skippedPaths) {
|
|
72392
|
+
console.log(`- Skipped cleanup target ${skippedPath.path}: ${skippedPath.reason}`);
|
|
72393
|
+
}
|
|
72178
72394
|
for (const path7 of result.removedAgentLinks) {
|
|
72179
72395
|
console.log(`- Removed managed agent link ${path7}`);
|
|
72180
72396
|
}
|
|
@@ -87438,6 +87654,7 @@ var ClaudeCodeConfigSchema = exports_external.object({
|
|
|
87438
87654
|
});
|
|
87439
87655
|
// packages/omo-opencode/src/config/schema/codegraph.ts
|
|
87440
87656
|
var CodegraphConfigSchema = exports_external.object({
|
|
87657
|
+
auto_init: exports_external.boolean().default(true),
|
|
87441
87658
|
auto_provision: exports_external.boolean().default(true),
|
|
87442
87659
|
enabled: exports_external.boolean().default(true),
|
|
87443
87660
|
install_dir: exports_external.string().optional(),
|
|
@@ -87677,7 +87894,8 @@ var RuntimeFallbackConfigSchema = exports_external.object({
|
|
|
87677
87894
|
max_fallback_attempts: exports_external.number().min(1).max(20).optional(),
|
|
87678
87895
|
cooldown_seconds: exports_external.number().min(0).optional(),
|
|
87679
87896
|
timeout_seconds: exports_external.number().min(0).optional(),
|
|
87680
|
-
notify_on_fallback: exports_external.boolean().optional()
|
|
87897
|
+
notify_on_fallback: exports_external.boolean().optional(),
|
|
87898
|
+
restore_primary_after_cooldown: exports_external.boolean().optional()
|
|
87681
87899
|
});
|
|
87682
87900
|
|
|
87683
87901
|
// packages/team-core/src/config.ts
|
|
@@ -88239,7 +88457,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
88239
88457
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
88240
88458
|
init_bun_which_shim();
|
|
88241
88459
|
init_spawn_with_windows_hide();
|
|
88242
|
-
import { delimiter as delimiter2, dirname as
|
|
88460
|
+
import { delimiter as delimiter2, dirname as dirname20, posix as posix4, win32 as win324 } from "node:path";
|
|
88243
88461
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
88244
88462
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
88245
88463
|
function getCommandCandidates(platform) {
|
|
@@ -88297,7 +88515,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
88297
88515
|
return null;
|
|
88298
88516
|
}
|
|
88299
88517
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
88300
|
-
const preferredDir =
|
|
88518
|
+
const preferredDir = dirname20(binaryPath);
|
|
88301
88519
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
88302
88520
|
return [preferredDir, ...existing].join(delimiter2);
|
|
88303
88521
|
}
|
|
@@ -88465,7 +88683,7 @@ async function resolveSession(options) {
|
|
|
88465
88683
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
88466
88684
|
const delay2 = SESSION_CREATE_RETRY_DELAY_MS * attempt;
|
|
88467
88685
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
88468
|
-
await new Promise((
|
|
88686
|
+
await new Promise((resolve17) => setTimeout(resolve17, delay2));
|
|
88469
88687
|
}
|
|
88470
88688
|
continue;
|
|
88471
88689
|
}
|
|
@@ -88476,7 +88694,7 @@ async function resolveSession(options) {
|
|
|
88476
88694
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
88477
88695
|
const delay2 = SESSION_CREATE_RETRY_DELAY_MS * attempt;
|
|
88478
88696
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
88479
|
-
await new Promise((
|
|
88697
|
+
await new Promise((resolve17) => setTimeout(resolve17, delay2));
|
|
88480
88698
|
}
|
|
88481
88699
|
}
|
|
88482
88700
|
throw new Error("Failed to create session after all retries");
|
|
@@ -88689,7 +88907,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
88689
88907
|
var NOTEPAD_DIR = "notepads";
|
|
88690
88908
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
88691
88909
|
// packages/boulder-state/src/top-level-task.ts
|
|
88692
|
-
import { existsSync as
|
|
88910
|
+
import { existsSync as existsSync36, readFileSync as readFileSync18 } from "node:fs";
|
|
88693
88911
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
88694
88912
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
88695
88913
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -88712,7 +88930,7 @@ function buildTaskRef(section, taskLabel) {
|
|
|
88712
88930
|
};
|
|
88713
88931
|
}
|
|
88714
88932
|
function readCurrentTopLevelTask(planPath) {
|
|
88715
|
-
if (!
|
|
88933
|
+
if (!existsSync36(planPath)) {
|
|
88716
88934
|
return null;
|
|
88717
88935
|
}
|
|
88718
88936
|
try {
|
|
@@ -88741,13 +88959,13 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
88741
88959
|
}
|
|
88742
88960
|
}
|
|
88743
88961
|
// packages/boulder-state/src/storage/path.ts
|
|
88744
|
-
import { existsSync as
|
|
88745
|
-
import { isAbsolute as
|
|
88962
|
+
import { existsSync as existsSync37 } from "node:fs";
|
|
88963
|
+
import { isAbsolute as isAbsolute10, join as join58, relative as relative8, resolve as resolve17 } from "node:path";
|
|
88746
88964
|
function getBoulderFilePath(directory) {
|
|
88747
|
-
return
|
|
88965
|
+
return join58(directory, BOULDER_DIR, BOULDER_FILE);
|
|
88748
88966
|
}
|
|
88749
88967
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
88750
|
-
return
|
|
88968
|
+
return isAbsolute10(trackedPath) ? resolve17(trackedPath) : resolve17(baseDirectory, trackedPath);
|
|
88751
88969
|
}
|
|
88752
88970
|
function resolveBoulderPlanPath(directory, state) {
|
|
88753
88971
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -88755,20 +88973,20 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
88755
88973
|
if (!worktreePath) {
|
|
88756
88974
|
return absolutePlanPath;
|
|
88757
88975
|
}
|
|
88758
|
-
const absoluteDirectory =
|
|
88759
|
-
const relativePlanPath =
|
|
88760
|
-
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") ||
|
|
88976
|
+
const absoluteDirectory = resolve17(directory);
|
|
88977
|
+
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
88978
|
+
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute10(relativePlanPath)) {
|
|
88761
88979
|
return absolutePlanPath;
|
|
88762
88980
|
}
|
|
88763
88981
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
88764
|
-
const worktreePlanPath =
|
|
88765
|
-
return
|
|
88982
|
+
const worktreePlanPath = resolve17(absoluteWorktreePath, relativePlanPath);
|
|
88983
|
+
return existsSync37(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
88766
88984
|
}
|
|
88767
88985
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
88768
88986
|
return resolveBoulderPlanPath(directory, work);
|
|
88769
88987
|
}
|
|
88770
88988
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
88771
|
-
import { existsSync as
|
|
88989
|
+
import { existsSync as existsSync38, readFileSync as readFileSync19, readdirSync as readdirSync5, statSync as statSync5 } from "node:fs";
|
|
88772
88990
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
88773
88991
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
88774
88992
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -88777,7 +88995,7 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
|
|
|
88777
88995
|
var TODO_TASK_PATTERN2 = /^\d+\.\s+/;
|
|
88778
88996
|
var FINAL_WAVE_TASK_PATTERN2 = /^F\d+\.\s+/i;
|
|
88779
88997
|
function getPlanProgress(planPath) {
|
|
88780
|
-
if (!
|
|
88998
|
+
if (!existsSync38(planPath)) {
|
|
88781
88999
|
return { total: 0, completed: 0, isComplete: false };
|
|
88782
89000
|
}
|
|
88783
89001
|
try {
|
|
@@ -88897,10 +89115,10 @@ function selectMirrorWork(state) {
|
|
|
88897
89115
|
return sorted[0] ?? null;
|
|
88898
89116
|
}
|
|
88899
89117
|
// packages/boulder-state/src/storage/read-state.ts
|
|
88900
|
-
import { existsSync as
|
|
89118
|
+
import { existsSync as existsSync39, readFileSync as readFileSync20 } from "node:fs";
|
|
88901
89119
|
function readBoulderState(directory) {
|
|
88902
89120
|
const filePath = getBoulderFilePath(directory);
|
|
88903
|
-
if (!
|
|
89121
|
+
if (!existsSync39(filePath)) {
|
|
88904
89122
|
return null;
|
|
88905
89123
|
}
|
|
88906
89124
|
try {
|
|
@@ -88972,14 +89190,14 @@ init_state();
|
|
|
88972
89190
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
88973
89191
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
88974
89192
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
88975
|
-
import { existsSync as
|
|
88976
|
-
import { join as
|
|
89193
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync11, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
89194
|
+
import { join as join59 } from "node:path";
|
|
88977
89195
|
function getMarkerPath(directory, sessionID) {
|
|
88978
|
-
return
|
|
89196
|
+
return join59(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
88979
89197
|
}
|
|
88980
89198
|
function readContinuationMarker(directory, sessionID) {
|
|
88981
89199
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
88982
|
-
if (!
|
|
89200
|
+
if (!existsSync40(markerPath))
|
|
88983
89201
|
return null;
|
|
88984
89202
|
try {
|
|
88985
89203
|
const raw = readFileSync21(markerPath, "utf-8");
|
|
@@ -89048,7 +89266,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
89048
89266
|
init_shared();
|
|
89049
89267
|
init_compaction_marker();
|
|
89050
89268
|
import { readFileSync as readFileSync22, readdirSync as readdirSync6 } from "node:fs";
|
|
89051
|
-
import { join as
|
|
89269
|
+
import { join as join60 } from "node:path";
|
|
89052
89270
|
var defaultSessionLastAgentDeps = {
|
|
89053
89271
|
getMessageDir,
|
|
89054
89272
|
isSqliteBackend,
|
|
@@ -89108,7 +89326,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
89108
89326
|
try {
|
|
89109
89327
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
89110
89328
|
try {
|
|
89111
|
-
const content = readFileSync22(
|
|
89329
|
+
const content = readFileSync22(join60(messageDir, fileName), "utf-8");
|
|
89112
89330
|
const parsed = JSON.parse(content);
|
|
89113
89331
|
return {
|
|
89114
89332
|
fileName,
|
|
@@ -89151,8 +89369,8 @@ init_agent_display_names();
|
|
|
89151
89369
|
|
|
89152
89370
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
89153
89371
|
init_frontmatter2();
|
|
89154
|
-
import { existsSync as
|
|
89155
|
-
import { dirname as
|
|
89372
|
+
import { existsSync as existsSync41, readFileSync as readFileSync23, writeFileSync as writeFileSync7, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "node:fs";
|
|
89373
|
+
import { dirname as dirname21, join as join61 } from "node:path";
|
|
89156
89374
|
|
|
89157
89375
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
89158
89376
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -89161,11 +89379,11 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
89161
89379
|
|
|
89162
89380
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
89163
89381
|
function getStateFilePath(directory, customPath) {
|
|
89164
|
-
return customPath ?
|
|
89382
|
+
return customPath ? join61(directory, customPath) : join61(directory, DEFAULT_STATE_FILE);
|
|
89165
89383
|
}
|
|
89166
89384
|
function readState(directory, customPath) {
|
|
89167
89385
|
const filePath = getStateFilePath(directory, customPath);
|
|
89168
|
-
if (!
|
|
89386
|
+
if (!existsSync41(filePath)) {
|
|
89169
89387
|
return null;
|
|
89170
89388
|
}
|
|
89171
89389
|
try {
|
|
@@ -89400,7 +89618,7 @@ async function pollForCompletion(ctx, eventState, abortController, options = {})
|
|
|
89400
89618
|
let secondaryTimeoutChecked = false;
|
|
89401
89619
|
const pollStartTimestamp = Date.now();
|
|
89402
89620
|
while (!abortController.signal.aborted) {
|
|
89403
|
-
await new Promise((
|
|
89621
|
+
await new Promise((resolve18) => setTimeout(resolve18, pollIntervalMs));
|
|
89404
89622
|
if (abortController.signal.aborted) {
|
|
89405
89623
|
return 130;
|
|
89406
89624
|
}
|
|
@@ -89558,7 +89776,7 @@ function createAbortError() {
|
|
|
89558
89776
|
return error51;
|
|
89559
89777
|
}
|
|
89560
89778
|
function sleep(delayMs) {
|
|
89561
|
-
return new Promise((
|
|
89779
|
+
return new Promise((resolve18) => setTimeout(resolve18, delayMs));
|
|
89562
89780
|
}
|
|
89563
89781
|
function hasPromptStartEvidence(eventState) {
|
|
89564
89782
|
return eventState.mainSessionStarted || eventState.hasReceivedMeaningfulWork || eventState.messageCount > 0 || eventState.currentTool !== null;
|
|
@@ -89779,7 +89997,7 @@ function getPostHogActivityCaptureState2(now = new Date) {
|
|
|
89779
89997
|
// packages/omo-opencode/src/shared/posthog.ts
|
|
89780
89998
|
var activityStateProviderOverride2 = null;
|
|
89781
89999
|
var osProviderOverride3 = null;
|
|
89782
|
-
var
|
|
90000
|
+
var transportFactoryOverride2 = null;
|
|
89783
90001
|
function resolveActivityState() {
|
|
89784
90002
|
return (activityStateProviderOverride2 ?? getPostHogActivityCaptureState2)();
|
|
89785
90003
|
}
|
|
@@ -89787,7 +90005,7 @@ function resolveOsProvider2() {
|
|
|
89787
90005
|
return osProviderOverride3 ?? os5;
|
|
89788
90006
|
}
|
|
89789
90007
|
function resolveTransportFactory() {
|
|
89790
|
-
return
|
|
90008
|
+
return transportFactoryOverride2 ?? createDefaultPostHogTransport;
|
|
89791
90009
|
}
|
|
89792
90010
|
var NO_OP_POSTHOG2 = {
|
|
89793
90011
|
trackActive: () => {
|
|
@@ -89964,7 +90182,7 @@ var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
|
|
|
89964
90182
|
async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
|
|
89965
90183
|
const completed = await Promise.race([
|
|
89966
90184
|
eventProcessor.then(() => true),
|
|
89967
|
-
new Promise((
|
|
90185
|
+
new Promise((resolve18) => setTimeout(() => resolve18(false), timeoutMs))
|
|
89968
90186
|
]);
|
|
89969
90187
|
}
|
|
89970
90188
|
async function run(options) {
|
|
@@ -90267,14 +90485,14 @@ async function getLocalVersion(options = {}) {
|
|
|
90267
90485
|
}
|
|
90268
90486
|
}
|
|
90269
90487
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
90270
|
-
import { existsSync as
|
|
90488
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "node:fs";
|
|
90271
90489
|
|
|
90272
90490
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
90273
90491
|
init_extract_semver();
|
|
90274
90492
|
init_bun_which_shim();
|
|
90275
|
-
import { existsSync as
|
|
90493
|
+
import { existsSync as existsSync49, accessSync as accessSync4, constants as constants9 } from "node:fs";
|
|
90276
90494
|
import { homedir as homedir13 } from "node:os";
|
|
90277
|
-
import { join as
|
|
90495
|
+
import { join as join68 } from "node:path";
|
|
90278
90496
|
|
|
90279
90497
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
90280
90498
|
init_spawn_with_windows_hide();
|
|
@@ -90313,8 +90531,8 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
|
|
|
90313
90531
|
const stdoutPromise = readSpawnStream(proc.stdout);
|
|
90314
90532
|
const stderrPromise = readSpawnStream(proc.stderr);
|
|
90315
90533
|
let timer;
|
|
90316
|
-
const timeoutPromise = new Promise((
|
|
90317
|
-
timer = setTimeout(() =>
|
|
90534
|
+
const timeoutPromise = new Promise((resolve18) => {
|
|
90535
|
+
timer = setTimeout(() => resolve18("timeout"), timeoutMs);
|
|
90318
90536
|
});
|
|
90319
90537
|
const processPromise = (async () => {
|
|
90320
90538
|
await proc.exited;
|
|
@@ -90366,17 +90584,17 @@ function getDesktopAppPaths(platform) {
|
|
|
90366
90584
|
case "darwin":
|
|
90367
90585
|
return [
|
|
90368
90586
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
90369
|
-
|
|
90587
|
+
join68(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
90370
90588
|
];
|
|
90371
90589
|
case "win32": {
|
|
90372
90590
|
const programFiles = process.env.ProgramFiles;
|
|
90373
90591
|
const localAppData = process.env.LOCALAPPDATA;
|
|
90374
90592
|
const paths = [];
|
|
90375
90593
|
if (programFiles) {
|
|
90376
|
-
paths.push(
|
|
90594
|
+
paths.push(join68(programFiles, "OpenCode", "OpenCode.exe"));
|
|
90377
90595
|
}
|
|
90378
90596
|
if (localAppData) {
|
|
90379
|
-
paths.push(
|
|
90597
|
+
paths.push(join68(localAppData, "OpenCode", "OpenCode.exe"));
|
|
90380
90598
|
}
|
|
90381
90599
|
return paths;
|
|
90382
90600
|
}
|
|
@@ -90384,8 +90602,8 @@ function getDesktopAppPaths(platform) {
|
|
|
90384
90602
|
return [
|
|
90385
90603
|
"/usr/bin/opencode",
|
|
90386
90604
|
"/usr/lib/opencode/opencode",
|
|
90387
|
-
|
|
90388
|
-
|
|
90605
|
+
join68(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
90606
|
+
join68(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
90389
90607
|
];
|
|
90390
90608
|
default:
|
|
90391
90609
|
return [];
|
|
@@ -90397,7 +90615,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
90397
90615
|
}
|
|
90398
90616
|
return [binaryPath, "--version"];
|
|
90399
90617
|
}
|
|
90400
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
90618
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync49) {
|
|
90401
90619
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
90402
90620
|
if (checkExists(desktopPath)) {
|
|
90403
90621
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -90405,7 +90623,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
90405
90623
|
}
|
|
90406
90624
|
return null;
|
|
90407
90625
|
}
|
|
90408
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
90626
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync49) {
|
|
90409
90627
|
for (const binary of OPENCODE_BINARIES2) {
|
|
90410
90628
|
const path14 = bunWhich(binary);
|
|
90411
90629
|
if (path14 && checkExists(path14)) {
|
|
@@ -90417,7 +90635,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
90417
90635
|
const candidates = getCommandCandidates2(platform);
|
|
90418
90636
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
90419
90637
|
for (const command of candidates) {
|
|
90420
|
-
const fullPath =
|
|
90638
|
+
const fullPath = join68(entry, command);
|
|
90421
90639
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
90422
90640
|
return { binary: command, path: fullPath };
|
|
90423
90641
|
}
|
|
@@ -90463,12 +90681,12 @@ function compareVersions3(current, minimum) {
|
|
|
90463
90681
|
|
|
90464
90682
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
90465
90683
|
init_shared();
|
|
90466
|
-
import { existsSync as
|
|
90684
|
+
import { existsSync as existsSync50, readFileSync as readFileSync31 } from "node:fs";
|
|
90467
90685
|
function detectConfigPath() {
|
|
90468
90686
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
90469
|
-
if (
|
|
90687
|
+
if (existsSync50(paths.configJsonc))
|
|
90470
90688
|
return paths.configJsonc;
|
|
90471
|
-
if (
|
|
90689
|
+
if (existsSync50(paths.configJson))
|
|
90472
90690
|
return paths.configJson;
|
|
90473
90691
|
return null;
|
|
90474
90692
|
}
|
|
@@ -90556,36 +90774,36 @@ init_file_utils2();
|
|
|
90556
90774
|
init_checker();
|
|
90557
90775
|
init_auto_update_checker();
|
|
90558
90776
|
init_package_json_locator();
|
|
90559
|
-
import { existsSync as
|
|
90777
|
+
import { existsSync as existsSync51, readFileSync as readFileSync32, readdirSync as readdirSync8 } from "node:fs";
|
|
90560
90778
|
import { createRequire as createRequire3 } from "node:module";
|
|
90561
90779
|
import { homedir as homedir14 } from "node:os";
|
|
90562
|
-
import { join as
|
|
90780
|
+
import { join as join69 } from "node:path";
|
|
90563
90781
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
90564
90782
|
init_shared();
|
|
90565
90783
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
90566
90784
|
if (platform === "darwin")
|
|
90567
|
-
return
|
|
90785
|
+
return join69(homedir14(), "Library", "Caches");
|
|
90568
90786
|
if (platform === "win32")
|
|
90569
|
-
return process.env.LOCALAPPDATA ??
|
|
90570
|
-
return
|
|
90787
|
+
return process.env.LOCALAPPDATA ?? join69(homedir14(), "AppData", "Local");
|
|
90788
|
+
return join69(homedir14(), ".cache");
|
|
90571
90789
|
}
|
|
90572
90790
|
function resolveOpenCodeCacheDir() {
|
|
90573
90791
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
90574
90792
|
if (xdgCacheHome)
|
|
90575
|
-
return
|
|
90793
|
+
return join69(xdgCacheHome, "opencode");
|
|
90576
90794
|
const fromShared = getOpenCodeCacheDir();
|
|
90577
|
-
const platformDefault =
|
|
90578
|
-
if (
|
|
90795
|
+
const platformDefault = join69(getPlatformDefaultCacheDir(), "opencode");
|
|
90796
|
+
if (existsSync51(fromShared) || !existsSync51(platformDefault))
|
|
90579
90797
|
return fromShared;
|
|
90580
90798
|
return platformDefault;
|
|
90581
90799
|
}
|
|
90582
90800
|
function resolveExistingDir(dirPath) {
|
|
90583
|
-
if (!
|
|
90801
|
+
if (!existsSync51(dirPath))
|
|
90584
90802
|
return dirPath;
|
|
90585
90803
|
return resolveSymlink(dirPath);
|
|
90586
90804
|
}
|
|
90587
90805
|
function readPackageJson(filePath) {
|
|
90588
|
-
if (!
|
|
90806
|
+
if (!existsSync51(filePath))
|
|
90589
90807
|
return null;
|
|
90590
90808
|
try {
|
|
90591
90809
|
const content = readFileSync32(filePath, "utf-8");
|
|
@@ -90606,26 +90824,26 @@ function normalizeVersion(value) {
|
|
|
90606
90824
|
function createPackageCandidates(rootDir) {
|
|
90607
90825
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
90608
90826
|
packageName,
|
|
90609
|
-
installedPackagePath:
|
|
90827
|
+
installedPackagePath: join69(rootDir, "node_modules", packageName, "package.json")
|
|
90610
90828
|
}));
|
|
90611
90829
|
}
|
|
90612
90830
|
function createTaggedInstallCandidates(rootDir) {
|
|
90613
|
-
const packagesDir =
|
|
90614
|
-
if (!
|
|
90831
|
+
const packagesDir = join69(rootDir, "packages");
|
|
90832
|
+
if (!existsSync51(packagesDir))
|
|
90615
90833
|
return [];
|
|
90616
90834
|
const candidates = [];
|
|
90617
90835
|
for (const entryName of readdirSync8(packagesDir).sort()) {
|
|
90618
90836
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
90619
90837
|
if (packageName === undefined)
|
|
90620
90838
|
continue;
|
|
90621
|
-
const installDir =
|
|
90839
|
+
const installDir = join69(packagesDir, entryName);
|
|
90622
90840
|
candidates.push({
|
|
90623
90841
|
cacheDir: installDir,
|
|
90624
|
-
cachePackagePath:
|
|
90842
|
+
cachePackagePath: join69(installDir, "package.json"),
|
|
90625
90843
|
packageCandidates: [
|
|
90626
90844
|
{
|
|
90627
90845
|
packageName,
|
|
90628
|
-
installedPackagePath:
|
|
90846
|
+
installedPackagePath: join69(installDir, "node_modules", packageName, "package.json")
|
|
90629
90847
|
}
|
|
90630
90848
|
]
|
|
90631
90849
|
});
|
|
@@ -90633,7 +90851,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
90633
90851
|
return candidates;
|
|
90634
90852
|
}
|
|
90635
90853
|
function selectInstalledPackage(candidate) {
|
|
90636
|
-
return candidate.packageCandidates.find((packageCandidate) =>
|
|
90854
|
+
return candidate.packageCandidates.find((packageCandidate) => existsSync51(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
|
|
90637
90855
|
}
|
|
90638
90856
|
function getExpectedVersion(cachePackage, packageName) {
|
|
90639
90857
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -90644,7 +90862,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
90644
90862
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
90645
90863
|
try {
|
|
90646
90864
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
90647
|
-
if (
|
|
90865
|
+
if (existsSync51(packageJsonPath)) {
|
|
90648
90866
|
return { packageName, packageJsonPath };
|
|
90649
90867
|
}
|
|
90650
90868
|
} catch {
|
|
@@ -90670,22 +90888,22 @@ function getLoadedPluginVersion() {
|
|
|
90670
90888
|
const candidates = [
|
|
90671
90889
|
{
|
|
90672
90890
|
cacheDir: configDir,
|
|
90673
|
-
cachePackagePath:
|
|
90891
|
+
cachePackagePath: join69(configDir, "package.json"),
|
|
90674
90892
|
packageCandidates: createPackageCandidates(configDir)
|
|
90675
90893
|
},
|
|
90676
90894
|
...createTaggedInstallCandidates(configDir),
|
|
90677
90895
|
{
|
|
90678
90896
|
cacheDir,
|
|
90679
|
-
cachePackagePath:
|
|
90897
|
+
cachePackagePath: join69(cacheDir, "package.json"),
|
|
90680
90898
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
90681
90899
|
},
|
|
90682
90900
|
...createTaggedInstallCandidates(cacheDir)
|
|
90683
90901
|
];
|
|
90684
|
-
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) =>
|
|
90902
|
+
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync51(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
90685
90903
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
90686
90904
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
90687
90905
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
90688
|
-
const candidateExists =
|
|
90906
|
+
const candidateExists = existsSync51(candidateInstalledPath);
|
|
90689
90907
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
90690
90908
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
90691
90909
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -90721,7 +90939,7 @@ var defaultDeps6 = {
|
|
|
90721
90939
|
getLoadedPluginVersion,
|
|
90722
90940
|
getLatestPluginVersion,
|
|
90723
90941
|
getSuggestedInstallTag,
|
|
90724
|
-
configExists:
|
|
90942
|
+
configExists: existsSync52,
|
|
90725
90943
|
readConfigFile: (path14) => readFileSync33(path14, "utf-8"),
|
|
90726
90944
|
parseConfigContent: (content) => parseJsonc(content)
|
|
90727
90945
|
};
|
|
@@ -90865,7 +91083,7 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
90865
91083
|
init_src();
|
|
90866
91084
|
import { readFileSync as readFileSync34 } from "node:fs";
|
|
90867
91085
|
import { homedir as homedir15 } from "node:os";
|
|
90868
|
-
import { dirname as
|
|
91086
|
+
import { dirname as dirname26, relative as relative9 } from "node:path";
|
|
90869
91087
|
init_shared();
|
|
90870
91088
|
init_plugin_identity();
|
|
90871
91089
|
function resolveHomeDirectory2() {
|
|
@@ -90889,11 +91107,11 @@ function discoverProjectLayersNearestFirst(directory) {
|
|
|
90889
91107
|
const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
|
|
90890
91108
|
return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
|
|
90891
91109
|
path: configPath,
|
|
90892
|
-
configDir:
|
|
91110
|
+
configDir: dirname26(configPath)
|
|
90893
91111
|
}));
|
|
90894
91112
|
}
|
|
90895
91113
|
function shortPath(configPath) {
|
|
90896
|
-
const candidate =
|
|
91114
|
+
const candidate = relative9(process.cwd(), configPath);
|
|
90897
91115
|
return candidate.length > 0 ? candidate : configPath;
|
|
90898
91116
|
}
|
|
90899
91117
|
function formatIssuePath(path14) {
|
|
@@ -90913,7 +91131,7 @@ function parseLayerConfig(configPath) {
|
|
|
90913
91131
|
if (!isPlainRecord(rawConfig)) {
|
|
90914
91132
|
return {
|
|
90915
91133
|
path: configPath,
|
|
90916
|
-
configDir:
|
|
91134
|
+
configDir: dirname26(configPath),
|
|
90917
91135
|
config: null,
|
|
90918
91136
|
messages: [`${shortPath(configPath)}: <root>: Expected object`]
|
|
90919
91137
|
};
|
|
@@ -90921,7 +91139,7 @@ function parseLayerConfig(configPath) {
|
|
|
90921
91139
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
90922
91140
|
return {
|
|
90923
91141
|
path: configPath,
|
|
90924
|
-
configDir:
|
|
91142
|
+
configDir: dirname26(configPath),
|
|
90925
91143
|
config: result.success ? result.data : parseConfigPartially(rawConfig),
|
|
90926
91144
|
messages: schemaMessages(configPath, rawConfig)
|
|
90927
91145
|
};
|
|
@@ -90931,7 +91149,7 @@ function parseLayerConfig(configPath) {
|
|
|
90931
91149
|
}
|
|
90932
91150
|
return {
|
|
90933
91151
|
path: configPath,
|
|
90934
|
-
configDir:
|
|
91152
|
+
configDir: dirname26(configPath),
|
|
90935
91153
|
config: null,
|
|
90936
91154
|
messages: [`${shortPath(configPath)}: ${error51.message}`]
|
|
90937
91155
|
};
|
|
@@ -90977,23 +91195,23 @@ function validatePluginConfig(directory) {
|
|
|
90977
91195
|
|
|
90978
91196
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
90979
91197
|
init_shared();
|
|
90980
|
-
import { existsSync as
|
|
91198
|
+
import { existsSync as existsSync53, readFileSync as readFileSync35 } from "node:fs";
|
|
90981
91199
|
import { homedir as homedir16 } from "node:os";
|
|
90982
|
-
import { join as
|
|
91200
|
+
import { join as join70 } from "node:path";
|
|
90983
91201
|
function getUserConfigDir2() {
|
|
90984
91202
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
90985
91203
|
if (xdgConfig)
|
|
90986
|
-
return
|
|
90987
|
-
return
|
|
91204
|
+
return join70(xdgConfig, "opencode");
|
|
91205
|
+
return join70(homedir16(), ".config", "opencode");
|
|
90988
91206
|
}
|
|
90989
91207
|
function loadCustomProviderNames() {
|
|
90990
91208
|
const configDir = getUserConfigDir2();
|
|
90991
91209
|
const candidatePaths = [
|
|
90992
|
-
|
|
90993
|
-
|
|
91210
|
+
join70(configDir, "opencode.json"),
|
|
91211
|
+
join70(configDir, "opencode.jsonc")
|
|
90994
91212
|
];
|
|
90995
91213
|
for (const configPath of candidatePaths) {
|
|
90996
|
-
if (!
|
|
91214
|
+
if (!existsSync53(configPath))
|
|
90997
91215
|
continue;
|
|
90998
91216
|
try {
|
|
90999
91217
|
const content = readFileSync35(configPath, "utf-8");
|
|
@@ -91011,9 +91229,9 @@ function loadCustomProviderNames() {
|
|
|
91011
91229
|
return [];
|
|
91012
91230
|
}
|
|
91013
91231
|
function loadAvailableModelsFromCache() {
|
|
91014
|
-
const cacheFile =
|
|
91232
|
+
const cacheFile = join70(getOpenCodeCacheDir(), "models.json");
|
|
91015
91233
|
const customProviders = loadCustomProviderNames();
|
|
91016
|
-
if (!
|
|
91234
|
+
if (!existsSync53(cacheFile)) {
|
|
91017
91235
|
if (customProviders.length > 0) {
|
|
91018
91236
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
91019
91237
|
}
|
|
@@ -91048,8 +91266,8 @@ init_model_capabilities2();
|
|
|
91048
91266
|
init_shared();
|
|
91049
91267
|
init_plugin_identity();
|
|
91050
91268
|
import { readFileSync as readFileSync36 } from "node:fs";
|
|
91051
|
-
import { join as
|
|
91052
|
-
var PROJECT_CONFIG_DIR =
|
|
91269
|
+
import { join as join71 } from "node:path";
|
|
91270
|
+
var PROJECT_CONFIG_DIR = join71(process.cwd(), ".opencode");
|
|
91053
91271
|
function loadOmoConfig() {
|
|
91054
91272
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
91055
91273
|
basenames: [CONFIG_BASENAME],
|
|
@@ -91087,7 +91305,7 @@ function loadOmoConfig() {
|
|
|
91087
91305
|
|
|
91088
91306
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
91089
91307
|
init_shared();
|
|
91090
|
-
import { join as
|
|
91308
|
+
import { join as join72 } from "node:path";
|
|
91091
91309
|
|
|
91092
91310
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
91093
91311
|
function formatModelWithVariant(model, variant) {
|
|
@@ -91129,7 +91347,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
91129
91347
|
}
|
|
91130
91348
|
function buildModelResolutionDetails(options) {
|
|
91131
91349
|
const details = [];
|
|
91132
|
-
const cacheFile =
|
|
91350
|
+
const cacheFile = join72(getOpenCodeCacheDir(), "models.json");
|
|
91133
91351
|
details.push("═══ Available Models (from cache) ═══");
|
|
91134
91352
|
details.push("");
|
|
91135
91353
|
if (options.available.cacheExists) {
|
|
@@ -91405,28 +91623,28 @@ async function checkConfig() {
|
|
|
91405
91623
|
|
|
91406
91624
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
91407
91625
|
init_src();
|
|
91408
|
-
import { existsSync as
|
|
91626
|
+
import { existsSync as existsSync54 } from "node:fs";
|
|
91409
91627
|
import { createRequire as createRequire4 } from "node:module";
|
|
91410
91628
|
import { homedir as homedir18 } from "node:os";
|
|
91411
|
-
import { dirname as
|
|
91629
|
+
import { dirname as dirname27, join as join74 } from "node:path";
|
|
91412
91630
|
|
|
91413
91631
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
91414
|
-
import { join as
|
|
91632
|
+
import { join as join73 } from "path";
|
|
91415
91633
|
import { homedir as homedir17, tmpdir as tmpdir3 } from "os";
|
|
91416
91634
|
init_binary_downloader();
|
|
91417
91635
|
init_logger2();
|
|
91418
91636
|
init_plugin_identity();
|
|
91419
91637
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
91420
|
-
var DEBUG_FILE =
|
|
91638
|
+
var DEBUG_FILE = join73(tmpdir3(), "comment-checker-debug.log");
|
|
91421
91639
|
function getCacheDir2() {
|
|
91422
91640
|
if (process.platform === "win32") {
|
|
91423
91641
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
91424
|
-
const base2 = localAppData ||
|
|
91425
|
-
return
|
|
91642
|
+
const base2 = localAppData || join73(homedir17(), "AppData", "Local");
|
|
91643
|
+
return join73(base2, CACHE_DIR_NAME, "bin");
|
|
91426
91644
|
}
|
|
91427
91645
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
91428
|
-
const base = xdgCache ||
|
|
91429
|
-
return
|
|
91646
|
+
const base = xdgCache || join73(homedir17(), ".cache");
|
|
91647
|
+
return join73(base, CACHE_DIR_NAME, "bin");
|
|
91430
91648
|
}
|
|
91431
91649
|
function getBinaryName() {
|
|
91432
91650
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -91476,7 +91694,7 @@ async function getBinaryVersion(binary) {
|
|
|
91476
91694
|
}
|
|
91477
91695
|
}
|
|
91478
91696
|
async function checkAstGrepCli() {
|
|
91479
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
91697
|
+
const runtimeDir = astGrepRuntimeDir(join74(homedir18(), ".omo"));
|
|
91480
91698
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
91481
91699
|
if (sgPath === null) {
|
|
91482
91700
|
return {
|
|
@@ -91505,12 +91723,12 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
91505
91723
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
91506
91724
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
91507
91725
|
try {
|
|
91508
|
-
const packageDir = baseDirOverride ??
|
|
91509
|
-
const vendorPath =
|
|
91510
|
-
if (
|
|
91726
|
+
const packageDir = baseDirOverride ?? dirname27(resolvePackageJsonPath());
|
|
91727
|
+
const vendorPath = join74(packageDir, "vendor", platformKey, binaryName);
|
|
91728
|
+
if (existsSync54(vendorPath))
|
|
91511
91729
|
return vendorPath;
|
|
91512
|
-
const binPath =
|
|
91513
|
-
if (
|
|
91730
|
+
const binPath = join74(packageDir, "bin", binaryName);
|
|
91731
|
+
if (existsSync54(binPath))
|
|
91514
91732
|
return binPath;
|
|
91515
91733
|
} catch (error51) {
|
|
91516
91734
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -91655,11 +91873,11 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
91655
91873
|
|
|
91656
91874
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
91657
91875
|
import { readFileSync as readFileSync37 } from "node:fs";
|
|
91658
|
-
import { join as
|
|
91876
|
+
import { join as join75 } from "node:path";
|
|
91659
91877
|
|
|
91660
91878
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
91661
|
-
import { existsSync as
|
|
91662
|
-
import { delimiter as delimiter3, dirname as
|
|
91879
|
+
import { existsSync as existsSync55 } from "node:fs";
|
|
91880
|
+
import { delimiter as delimiter3, dirname as dirname28, resolve as resolve19 } from "node:path";
|
|
91663
91881
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
91664
91882
|
|
|
91665
91883
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -91672,7 +91890,7 @@ function hasCliSuffix(candidatePath, suffix) {
|
|
|
91672
91890
|
|
|
91673
91891
|
// packages/omo-opencode/src/mcp/runtime-executable.ts
|
|
91674
91892
|
init_bun_which_shim();
|
|
91675
|
-
import { basename as
|
|
91893
|
+
import { basename as basename12 } from "node:path";
|
|
91676
91894
|
var NODE_EXECUTABLE_NAMES = new Set(["node", "node.exe"]);
|
|
91677
91895
|
function isUnsafeCommandName2(commandName) {
|
|
91678
91896
|
if (commandName.length === 0)
|
|
@@ -91688,7 +91906,7 @@ function isUnsafeCommandName2(commandName) {
|
|
|
91688
91906
|
return false;
|
|
91689
91907
|
}
|
|
91690
91908
|
function isNodeExecPath(execPath) {
|
|
91691
|
-
return NODE_EXECUTABLE_NAMES.has(
|
|
91909
|
+
return NODE_EXECUTABLE_NAMES.has(basename12(execPath).toLowerCase());
|
|
91692
91910
|
}
|
|
91693
91911
|
function resolveRuntimeExecutable(commandName, options = {}) {
|
|
91694
91912
|
if (isUnsafeCommandName2(commandName)) {
|
|
@@ -91706,7 +91924,7 @@ function resolveRuntimeExecutable(commandName, options = {}) {
|
|
|
91706
91924
|
}
|
|
91707
91925
|
|
|
91708
91926
|
// packages/omo-opencode/src/mcp/shared/ancestor-cli-resolver.ts
|
|
91709
|
-
import { resolve as
|
|
91927
|
+
import { resolve as resolve18 } from "node:path";
|
|
91710
91928
|
function resolveJavaScriptRuntime(resolveExecutable) {
|
|
91711
91929
|
const node = resolveExecutable("node");
|
|
91712
91930
|
return node.available ? node : resolveExecutable("bun");
|
|
@@ -91714,9 +91932,9 @@ function resolveJavaScriptRuntime(resolveExecutable) {
|
|
|
91714
91932
|
function createAncestorCliCandidates(options) {
|
|
91715
91933
|
const candidates = [];
|
|
91716
91934
|
const seenPaths = new Set;
|
|
91717
|
-
let currentDirectory =
|
|
91935
|
+
let currentDirectory = resolve18(options.startDirectory);
|
|
91718
91936
|
while (true) {
|
|
91719
|
-
const distCliPath =
|
|
91937
|
+
const distCliPath = resolve18(currentDirectory, options.packageRel, options.distCliRel);
|
|
91720
91938
|
if (!seenPaths.has(distCliPath)) {
|
|
91721
91939
|
const runtime5 = resolveJavaScriptRuntime(options.resolveExecutable);
|
|
91722
91940
|
seenPaths.add(distCliPath);
|
|
@@ -91728,7 +91946,7 @@ function createAncestorCliCandidates(options) {
|
|
|
91728
91946
|
runtimeAvailable: runtime5.available
|
|
91729
91947
|
});
|
|
91730
91948
|
}
|
|
91731
|
-
const sourceCliPath =
|
|
91949
|
+
const sourceCliPath = resolve18(currentDirectory, options.packageRel, options.sourceCliRel);
|
|
91732
91950
|
if (!seenPaths.has(sourceCliPath)) {
|
|
91733
91951
|
const runtime5 = options.resolveExecutable("bun");
|
|
91734
91952
|
const sourceCandidateAvailable = options.isSourceCandidateAvailable?.({
|
|
@@ -91745,7 +91963,7 @@ function createAncestorCliCandidates(options) {
|
|
|
91745
91963
|
runtimeAvailable: runtime5.available
|
|
91746
91964
|
});
|
|
91747
91965
|
}
|
|
91748
|
-
const parentDirectory =
|
|
91966
|
+
const parentDirectory = resolve18(currentDirectory, "..");
|
|
91749
91967
|
if (parentDirectory === currentDirectory)
|
|
91750
91968
|
return candidates;
|
|
91751
91969
|
currentDirectory = parentDirectory;
|
|
@@ -91781,7 +91999,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
91781
91999
|
].join(";");
|
|
91782
92000
|
function getModuleDirectory(moduleUrl) {
|
|
91783
92001
|
try {
|
|
91784
|
-
return
|
|
92002
|
+
return dirname28(fileURLToPath6(moduleUrl));
|
|
91785
92003
|
} catch (error51) {
|
|
91786
92004
|
if (!(error51 instanceof Error))
|
|
91787
92005
|
throw error51;
|
|
@@ -91789,23 +92007,23 @@ function getModuleDirectory(moduleUrl) {
|
|
|
91789
92007
|
}
|
|
91790
92008
|
}
|
|
91791
92009
|
function findBootstrapRoot(candidates, pathExists) {
|
|
91792
|
-
return candidates.find((candidate) => pathExists(
|
|
92010
|
+
return candidates.find((candidate) => pathExists(resolve19(candidate.root, "package.json")))?.root ?? process.cwd();
|
|
91793
92011
|
}
|
|
91794
92012
|
function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
91795
92013
|
const runtime5 = resolveJavaScriptRuntime(resolveExecutable);
|
|
91796
92014
|
const bun = resolveExecutable("bun");
|
|
91797
92015
|
const npm = resolveExecutable("npm");
|
|
91798
|
-
const packageManifestPath =
|
|
92016
|
+
const packageManifestPath = resolve19(root, PACKAGE_REL, "package.json");
|
|
91799
92017
|
return {
|
|
91800
92018
|
command: [runtime5.command, "-e", LSP_BOOTSTRAP_SCRIPT, root, npm.command, bun.command],
|
|
91801
92019
|
root,
|
|
91802
|
-
path:
|
|
92020
|
+
path: resolve19(root, PACKAGE_REL, DIST_CLI_REL),
|
|
91803
92021
|
exists: runtime5.available && npm.available && pathExists(packageManifestPath),
|
|
91804
92022
|
runtimeAvailable: runtime5.available
|
|
91805
92023
|
};
|
|
91806
92024
|
}
|
|
91807
92025
|
function resolveLspCommand(options = {}) {
|
|
91808
|
-
const pathExists = options.exists ??
|
|
92026
|
+
const pathExists = options.exists ?? existsSync55;
|
|
91809
92027
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
91810
92028
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
91811
92029
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -91815,7 +92033,7 @@ function resolveLspCommand(options = {}) {
|
|
|
91815
92033
|
sourceCliRel: SOURCE_CLI_REL,
|
|
91816
92034
|
pathExists,
|
|
91817
92035
|
resolveExecutable,
|
|
91818
|
-
isSourceCandidateAvailable: ({ root }) => pathExists(
|
|
92036
|
+
isSourceCandidateAvailable: ({ root }) => pathExists(resolve19(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL))
|
|
91819
92037
|
}) : [];
|
|
91820
92038
|
const distCandidate = candidates.find((candidate) => hasCliSuffix(candidate.path, DIST_CLI_REL) && candidate.exists);
|
|
91821
92039
|
if (distCandidate) {
|
|
@@ -91862,7 +92080,7 @@ function readOmoConfig(configDirectory) {
|
|
|
91862
92080
|
}
|
|
91863
92081
|
function isLspMcpDisabled(options) {
|
|
91864
92082
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
91865
|
-
const projectConfigDirectory =
|
|
92083
|
+
const projectConfigDirectory = join75(options.cwd ?? process.cwd(), ".opencode");
|
|
91866
92084
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
91867
92085
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
91868
92086
|
const disabledMcps = new Set([
|
|
@@ -91881,21 +92099,21 @@ function getInstalledLspServers(options = {}) {
|
|
|
91881
92099
|
|
|
91882
92100
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
91883
92101
|
init_shared();
|
|
91884
|
-
import { existsSync as
|
|
92102
|
+
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "node:fs";
|
|
91885
92103
|
import { homedir as homedir19 } from "node:os";
|
|
91886
|
-
import { join as
|
|
92104
|
+
import { join as join76 } from "node:path";
|
|
91887
92105
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
91888
92106
|
function getMcpConfigPaths() {
|
|
91889
92107
|
return [
|
|
91890
|
-
|
|
91891
|
-
|
|
91892
|
-
|
|
92108
|
+
join76(homedir19(), ".claude", ".mcp.json"),
|
|
92109
|
+
join76(process.cwd(), ".mcp.json"),
|
|
92110
|
+
join76(process.cwd(), ".claude", ".mcp.json")
|
|
91893
92111
|
];
|
|
91894
92112
|
}
|
|
91895
92113
|
function loadUserMcpConfig() {
|
|
91896
92114
|
const servers = {};
|
|
91897
92115
|
for (const configPath of getMcpConfigPaths()) {
|
|
91898
|
-
if (!
|
|
92116
|
+
if (!existsSync56(configPath))
|
|
91899
92117
|
continue;
|
|
91900
92118
|
try {
|
|
91901
92119
|
const content = readFileSync38(configPath, "utf-8");
|
|
@@ -92058,7 +92276,16 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
92058
92276
|
import { homedir as homedir20 } from "node:os";
|
|
92059
92277
|
import path14 from "node:path";
|
|
92060
92278
|
function resolveBaseDir(config3) {
|
|
92061
|
-
return config3.base_dir ?? path14.join(homedir20(), ".omo");
|
|
92279
|
+
return expandHomeDirectory(config3.base_dir ?? path14.join(homedir20(), ".omo"));
|
|
92280
|
+
}
|
|
92281
|
+
function expandHomeDirectory(directoryPath) {
|
|
92282
|
+
if (directoryPath === "~") {
|
|
92283
|
+
return homedir20();
|
|
92284
|
+
}
|
|
92285
|
+
if (directoryPath.startsWith("~/") || directoryPath.startsWith("~\\")) {
|
|
92286
|
+
return path14.join(homedir20(), directoryPath.slice(2));
|
|
92287
|
+
}
|
|
92288
|
+
return directoryPath;
|
|
92062
92289
|
}
|
|
92063
92290
|
// packages/omo-opencode/src/cli/doctor/checks/team-mode.ts
|
|
92064
92291
|
init_shared();
|
|
@@ -92133,10 +92360,10 @@ async function pathExists(dir) {
|
|
|
92133
92360
|
|
|
92134
92361
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
92135
92362
|
init_src();
|
|
92136
|
-
import { existsSync as
|
|
92363
|
+
import { existsSync as existsSync57 } from "node:fs";
|
|
92137
92364
|
import { lstat as lstat11, readdir as readdir8, readFile as readFile20 } from "node:fs/promises";
|
|
92138
92365
|
import { homedir as homedir21 } from "node:os";
|
|
92139
|
-
import { basename as
|
|
92366
|
+
import { basename as basename13, join as join77, resolve as resolve20 } from "node:path";
|
|
92140
92367
|
// packages/omo-opencode/package.json
|
|
92141
92368
|
var package_default3 = {
|
|
92142
92369
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -92192,13 +92419,13 @@ var CODEX_BIN_NAMES = [
|
|
|
92192
92419
|
"omo-git-bash-hook"
|
|
92193
92420
|
];
|
|
92194
92421
|
async function gatherCodexSummary(deps = {}) {
|
|
92195
|
-
const codexHome =
|
|
92422
|
+
const codexHome = resolve20(deps.codexHome ?? process.env.CODEX_HOME ?? join77(homedir21(), ".codex"));
|
|
92196
92423
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
92197
92424
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
92198
92425
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
92199
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
92200
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
92201
|
-
const configPath =
|
|
92426
|
+
const manifest = pluginRoot === null ? null : await readJson(join77(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
92427
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join77(pluginRoot, "lazycodex-install.json"));
|
|
92428
|
+
const configPath = join77(codexHome, "config.toml");
|
|
92202
92429
|
const pluginVersion = stringField(manifest, "version");
|
|
92203
92430
|
return {
|
|
92204
92431
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -92254,7 +92481,7 @@ function buildCodexIssues(summary) {
|
|
|
92254
92481
|
if (summary.pluginRoot === null) {
|
|
92255
92482
|
issues.push({
|
|
92256
92483
|
title: "OMO Codex plugin is not installed",
|
|
92257
|
-
description: `Expected cached plugin at ${
|
|
92484
|
+
description: `Expected cached plugin at ${join77("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
92258
92485
|
fix: "Run: npx lazycodex-ai install",
|
|
92259
92486
|
severity: "error",
|
|
92260
92487
|
affects: ["plugin loading"]
|
|
@@ -92307,15 +92534,15 @@ function buildCodexIssues(summary) {
|
|
|
92307
92534
|
return issues;
|
|
92308
92535
|
}
|
|
92309
92536
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
92310
|
-
const pluginRoot =
|
|
92311
|
-
if (!
|
|
92537
|
+
const pluginRoot = join77(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
92538
|
+
if (!existsSync57(pluginRoot))
|
|
92312
92539
|
return null;
|
|
92313
92540
|
const versions2 = await readdir8(pluginRoot, { withFileTypes: true });
|
|
92314
92541
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
92315
|
-
return candidates.length === 0 ? null :
|
|
92542
|
+
return candidates.length === 0 ? null : join77(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
92316
92543
|
}
|
|
92317
92544
|
async function readCodexConfigSummary(configPath) {
|
|
92318
|
-
if (!
|
|
92545
|
+
if (!existsSync57(configPath)) {
|
|
92319
92546
|
return { exists: false, marketplaceConfigured: false, pluginEnabled: false, pluginsFeatureEnabled: false, pluginHooksFeatureEnabled: false };
|
|
92320
92547
|
}
|
|
92321
92548
|
const content = await readFile20(configPath, "utf8");
|
|
@@ -92330,17 +92557,17 @@ async function readCodexConfigSummary(configPath) {
|
|
|
92330
92557
|
async function readLinkedBins(binDir) {
|
|
92331
92558
|
const linked = [];
|
|
92332
92559
|
for (const name of CODEX_BIN_NAMES) {
|
|
92333
|
-
if (await pathExists2(
|
|
92560
|
+
if (await pathExists2(join77(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
92334
92561
|
linked.push(name);
|
|
92335
92562
|
}
|
|
92336
92563
|
return linked;
|
|
92337
92564
|
}
|
|
92338
92565
|
async function readLinkedAgents(codexHome) {
|
|
92339
|
-
const agentsDir =
|
|
92340
|
-
if (!
|
|
92566
|
+
const agentsDir = join77(codexHome, "agents");
|
|
92567
|
+
if (!existsSync57(agentsDir))
|
|
92341
92568
|
return [];
|
|
92342
92569
|
const entries = await readdir8(agentsDir, { withFileTypes: true });
|
|
92343
|
-
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) =>
|
|
92570
|
+
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename13(entry.name, ".toml")).sort();
|
|
92344
92571
|
}
|
|
92345
92572
|
async function readJson(path16) {
|
|
92346
92573
|
try {
|
|
@@ -92396,7 +92623,7 @@ async function pathExists2(path16) {
|
|
|
92396
92623
|
init_src();
|
|
92397
92624
|
import { readdir as readdir9, readFile as readFile21, stat as stat4 } from "node:fs/promises";
|
|
92398
92625
|
import { homedir as homedir22 } from "node:os";
|
|
92399
|
-
import { dirname as
|
|
92626
|
+
import { dirname as dirname29, join as join78, relative as relative10, resolve as resolve21, sep as sep9 } from "node:path";
|
|
92400
92627
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
92401
92628
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
92402
92629
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -92406,7 +92633,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92406
92633
|
const env3 = deps.env ?? process.env;
|
|
92407
92634
|
const platform = deps.platform ?? process.platform;
|
|
92408
92635
|
const arch = deps.arch ?? process.arch;
|
|
92409
|
-
const codexHome =
|
|
92636
|
+
const codexHome = resolve21(deps.codexHome ?? env3["CODEX_HOME"] ?? join78(homedir22(), ".codex"));
|
|
92410
92637
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
92411
92638
|
if (summary.pluginRoot === null) {
|
|
92412
92639
|
return {
|
|
@@ -92431,7 +92658,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92431
92658
|
});
|
|
92432
92659
|
}
|
|
92433
92660
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
92434
|
-
const runtimeSgPath =
|
|
92661
|
+
const runtimeSgPath = join78(runtimeSgDir, sgBinaryName(platform));
|
|
92435
92662
|
const sg = findSgBinarySync({
|
|
92436
92663
|
arch,
|
|
92437
92664
|
env: env3,
|
|
@@ -92470,8 +92697,8 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
92470
92697
|
const manifest = await readJson2(manifestPath);
|
|
92471
92698
|
if (manifest === null || !isRecord5(manifest["mcpServers"]))
|
|
92472
92699
|
continue;
|
|
92473
|
-
const manifestRoot =
|
|
92474
|
-
const isRootManifest =
|
|
92700
|
+
const manifestRoot = dirname29(manifestPath);
|
|
92701
|
+
const isRootManifest = resolve21(manifestRoot) === resolve21(pluginRoot);
|
|
92475
92702
|
for (const server2 of Object.values(manifest["mcpServers"])) {
|
|
92476
92703
|
if (!isRecord5(server2) || !Array.isArray(server2["args"]))
|
|
92477
92704
|
continue;
|
|
@@ -92491,7 +92718,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
92491
92718
|
continue;
|
|
92492
92719
|
const commands2 = [];
|
|
92493
92720
|
collectHookCommands(manifest, commands2);
|
|
92494
|
-
const hookPluginRoot =
|
|
92721
|
+
const hookPluginRoot = dirname29(dirname29(hookManifestPath));
|
|
92495
92722
|
for (const command of commands2) {
|
|
92496
92723
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
92497
92724
|
referencedCount += 1;
|
|
@@ -92513,8 +92740,8 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
92513
92740
|
broken.push(entry);
|
|
92514
92741
|
}
|
|
92515
92742
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
92516
|
-
const targetPath =
|
|
92517
|
-
const bundleRootPath =
|
|
92743
|
+
const targetPath = resolve21(baseRoot, relativePath);
|
|
92744
|
+
const bundleRootPath = resolve21(bundleRoot);
|
|
92518
92745
|
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
92519
92746
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
92520
92747
|
if (allowEscape)
|
|
@@ -92530,7 +92757,7 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
92530
92757
|
}
|
|
92531
92758
|
async function findHookManifestPaths(root) {
|
|
92532
92759
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
92533
|
-
return paths2.filter((path16) =>
|
|
92760
|
+
return paths2.filter((path16) => dirname29(path16).endsWith(`${sep9}hooks`));
|
|
92534
92761
|
}
|
|
92535
92762
|
async function findManifestPaths(root, manifestName) {
|
|
92536
92763
|
let entries;
|
|
@@ -92543,7 +92770,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
92543
92770
|
for (const entry of entries) {
|
|
92544
92771
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
92545
92772
|
continue;
|
|
92546
|
-
const entryPath =
|
|
92773
|
+
const entryPath = join78(root, entry.name);
|
|
92547
92774
|
if (entry.isDirectory()) {
|
|
92548
92775
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
92549
92776
|
continue;
|
|
@@ -92586,18 +92813,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
92586
92813
|
return (arg.startsWith("./") || arg.startsWith("../")) && arg.endsWith("/dist/cli.js");
|
|
92587
92814
|
}
|
|
92588
92815
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
92589
|
-
return
|
|
92816
|
+
return join78(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
92590
92817
|
}
|
|
92591
92818
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
92592
92819
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
92593
92820
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
92594
92821
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
92595
|
-
if (sgPath ===
|
|
92822
|
+
if (sgPath === join78(runtimeSgDir, sgBinaryName(platform)))
|
|
92596
92823
|
return "runtime dir";
|
|
92597
92824
|
return "PATH";
|
|
92598
92825
|
}
|
|
92599
92826
|
async function readBootstrapStateSummary(codexHome) {
|
|
92600
|
-
const statePath =
|
|
92827
|
+
const statePath = join78(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
92601
92828
|
const raw = await readJson2(statePath);
|
|
92602
92829
|
if (raw === null)
|
|
92603
92830
|
return null;
|
|
@@ -92663,7 +92890,7 @@ async function fileSize(path16) {
|
|
|
92663
92890
|
}
|
|
92664
92891
|
}
|
|
92665
92892
|
function normalizeRelative(root, target) {
|
|
92666
|
-
return normalizePathSeparators(
|
|
92893
|
+
return normalizePathSeparators(relative10(root, target));
|
|
92667
92894
|
}
|
|
92668
92895
|
function normalizePathSeparators(path16) {
|
|
92669
92896
|
return path16.split("\\").join("/");
|
|
@@ -92673,23 +92900,23 @@ function isRecord5(value) {
|
|
|
92673
92900
|
}
|
|
92674
92901
|
|
|
92675
92902
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
92676
|
-
import { existsSync as
|
|
92903
|
+
import { existsSync as existsSync58 } from "node:fs";
|
|
92677
92904
|
import { readFile as readFile22 } from "node:fs/promises";
|
|
92678
92905
|
import { homedir as homedir23 } from "node:os";
|
|
92679
|
-
import { join as
|
|
92906
|
+
import { join as join79, resolve as resolve22 } from "node:path";
|
|
92680
92907
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
92681
92908
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
92682
92909
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
92683
92910
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
92684
|
-
const codexHome =
|
|
92911
|
+
const codexHome = resolve22(deps.codexHome ?? process.env.CODEX_HOME ?? join79(homedir23(), ".codex"));
|
|
92685
92912
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
92686
92913
|
const platform = deps.platform ?? process.platform;
|
|
92687
|
-
const wrapperPath =
|
|
92914
|
+
const wrapperPath = join79(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
92688
92915
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
92689
92916
|
const issues = [];
|
|
92690
92917
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
92691
92918
|
const targetPath = parseRuntimeTargetPath(wrapper);
|
|
92692
|
-
if (targetPath !== null && !
|
|
92919
|
+
if (targetPath !== null && !existsSync58(targetPath)) {
|
|
92693
92920
|
issues.push({
|
|
92694
92921
|
title: "omo runtime wrapper target is missing",
|
|
92695
92922
|
description: `Generated omo runtime wrapper at ${wrapperPath} points to missing target ${targetPath}.`,
|
|
@@ -93181,7 +93408,7 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
93181
93408
|
import { createHash as createHash4 } from "node:crypto";
|
|
93182
93409
|
import {
|
|
93183
93410
|
chmodSync as chmodSync4,
|
|
93184
|
-
existsSync as
|
|
93411
|
+
existsSync as existsSync61,
|
|
93185
93412
|
mkdirSync as mkdirSync14,
|
|
93186
93413
|
readdirSync as readdirSync9,
|
|
93187
93414
|
readFileSync as readFileSync41,
|
|
@@ -93189,15 +93416,15 @@ import {
|
|
|
93189
93416
|
unlinkSync as unlinkSync8,
|
|
93190
93417
|
writeFileSync as writeFileSync11
|
|
93191
93418
|
} from "node:fs";
|
|
93192
|
-
import { basename as
|
|
93419
|
+
import { basename as basename14, dirname as dirname30, join as join82 } from "node:path";
|
|
93193
93420
|
|
|
93194
93421
|
// packages/mcp-client-core/src/config-dir.ts
|
|
93195
|
-
import { existsSync as
|
|
93422
|
+
import { existsSync as existsSync59, realpathSync as realpathSync8 } from "node:fs";
|
|
93196
93423
|
import { homedir as homedir24 } from "node:os";
|
|
93197
|
-
import { join as
|
|
93424
|
+
import { join as join80, resolve as resolve23 } from "node:path";
|
|
93198
93425
|
function resolveConfigPath2(pathValue) {
|
|
93199
|
-
const resolvedPath =
|
|
93200
|
-
if (!
|
|
93426
|
+
const resolvedPath = resolve23(pathValue);
|
|
93427
|
+
if (!existsSync59(resolvedPath))
|
|
93201
93428
|
return resolvedPath;
|
|
93202
93429
|
try {
|
|
93203
93430
|
return realpathSync8(resolvedPath);
|
|
@@ -93212,13 +93439,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
93212
93439
|
if (customConfigDir) {
|
|
93213
93440
|
return resolveConfigPath2(customConfigDir);
|
|
93214
93441
|
}
|
|
93215
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
93216
|
-
return resolveConfigPath2(
|
|
93442
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join80(homedir24(), ".config");
|
|
93443
|
+
return resolveConfigPath2(join80(xdgConfigDir, "opencode"));
|
|
93217
93444
|
}
|
|
93218
93445
|
|
|
93219
93446
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
93220
|
-
import { chmodSync as chmodSync3, existsSync as
|
|
93221
|
-
import { join as
|
|
93447
|
+
import { chmodSync as chmodSync3, existsSync as existsSync60, readFileSync as readFileSync40, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "node:fs";
|
|
93448
|
+
import { join as join81 } from "node:path";
|
|
93222
93449
|
var INDEX_FILE_NAME = "index.json";
|
|
93223
93450
|
function isTokenIndex(value) {
|
|
93224
93451
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -93226,11 +93453,11 @@ function isTokenIndex(value) {
|
|
|
93226
93453
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
93227
93454
|
}
|
|
93228
93455
|
function getIndexPath(storageDir) {
|
|
93229
|
-
return
|
|
93456
|
+
return join81(storageDir, INDEX_FILE_NAME);
|
|
93230
93457
|
}
|
|
93231
93458
|
function readTokenIndex(storageDir) {
|
|
93232
93459
|
const indexPath = getIndexPath(storageDir);
|
|
93233
|
-
if (!
|
|
93460
|
+
if (!existsSync60(indexPath))
|
|
93234
93461
|
return {};
|
|
93235
93462
|
try {
|
|
93236
93463
|
const parsed = JSON.parse(readFileSync40(indexPath, "utf-8"));
|
|
@@ -93270,16 +93497,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
93270
93497
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
93271
93498
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
93272
93499
|
function getMcpOauthStorageDir() {
|
|
93273
|
-
return
|
|
93500
|
+
return join82(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
93274
93501
|
}
|
|
93275
93502
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
93276
93503
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
93277
93504
|
}
|
|
93278
93505
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
93279
|
-
return
|
|
93506
|
+
return join82(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
93280
93507
|
}
|
|
93281
93508
|
function getLegacyStoragePath() {
|
|
93282
|
-
return
|
|
93509
|
+
return join82(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
93283
93510
|
}
|
|
93284
93511
|
function normalizeHost2(serverHost) {
|
|
93285
93512
|
let host = serverHost.trim();
|
|
@@ -93340,7 +93567,7 @@ function isOAuthTokenData(value) {
|
|
|
93340
93567
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
93341
93568
|
}
|
|
93342
93569
|
function readTokenFile(filePath) {
|
|
93343
|
-
if (!
|
|
93570
|
+
if (!existsSync61(filePath))
|
|
93344
93571
|
return null;
|
|
93345
93572
|
try {
|
|
93346
93573
|
const parsed = JSON.parse(readFileSync41(filePath, "utf-8"));
|
|
@@ -93353,7 +93580,7 @@ function readTokenFile(filePath) {
|
|
|
93353
93580
|
}
|
|
93354
93581
|
function readLegacyStore() {
|
|
93355
93582
|
const filePath = getLegacyStoragePath();
|
|
93356
|
-
if (!
|
|
93583
|
+
if (!existsSync61(filePath))
|
|
93357
93584
|
return null;
|
|
93358
93585
|
try {
|
|
93359
93586
|
const parsed = JSON.parse(readFileSync41(filePath, "utf-8"));
|
|
@@ -93373,8 +93600,8 @@ function readLegacyStore() {
|
|
|
93373
93600
|
}
|
|
93374
93601
|
function writeTokenFile(filePath, token) {
|
|
93375
93602
|
try {
|
|
93376
|
-
const dir =
|
|
93377
|
-
if (!
|
|
93603
|
+
const dir = dirname30(filePath);
|
|
93604
|
+
if (!existsSync61(dir)) {
|
|
93378
93605
|
mkdirSync14(dir, { recursive: true });
|
|
93379
93606
|
}
|
|
93380
93607
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
@@ -93398,7 +93625,7 @@ function saveToken(serverHost, resource, token) {
|
|
|
93398
93625
|
}
|
|
93399
93626
|
function deleteToken(serverHost, resource) {
|
|
93400
93627
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
93401
|
-
if (!
|
|
93628
|
+
if (!existsSync61(filePath))
|
|
93402
93629
|
return deleteLegacyToken(serverHost, resource);
|
|
93403
93630
|
try {
|
|
93404
93631
|
unlinkSync8(filePath);
|
|
@@ -93420,7 +93647,7 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
93420
93647
|
if (Object.keys(store2).length === 0) {
|
|
93421
93648
|
try {
|
|
93422
93649
|
const filePath = getLegacyStoragePath();
|
|
93423
|
-
if (
|
|
93650
|
+
if (existsSync61(filePath))
|
|
93424
93651
|
unlinkSync8(filePath);
|
|
93425
93652
|
return true;
|
|
93426
93653
|
} catch (deleteError) {
|
|
@@ -93458,7 +93685,7 @@ function listTokensByHost(serverHost) {
|
|
|
93458
93685
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
93459
93686
|
if (!indexedKey.startsWith(prefix))
|
|
93460
93687
|
continue;
|
|
93461
|
-
const indexedToken = readTokenFile(
|
|
93688
|
+
const indexedToken = readTokenFile(join82(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
93462
93689
|
if (indexedToken)
|
|
93463
93690
|
result[indexedKey] = indexedToken;
|
|
93464
93691
|
}
|
|
@@ -93467,14 +93694,14 @@ function listTokensByHost(serverHost) {
|
|
|
93467
93694
|
function listAllTokens() {
|
|
93468
93695
|
const result = { ...readLegacyStore() ?? {} };
|
|
93469
93696
|
const dir = getMcpOauthStorageDir();
|
|
93470
|
-
if (!
|
|
93697
|
+
if (!existsSync61(dir))
|
|
93471
93698
|
return result;
|
|
93472
93699
|
const index = readTokenIndex(dir);
|
|
93473
93700
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
93474
93701
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
93475
93702
|
continue;
|
|
93476
|
-
const token = readTokenFile(
|
|
93477
|
-
const hash2 =
|
|
93703
|
+
const token = readTokenFile(join82(dir, entry.name));
|
|
93704
|
+
const hash2 = basename14(entry.name, ".json");
|
|
93478
93705
|
if (token)
|
|
93479
93706
|
result[index[hash2] ?? hash2] = token;
|
|
93480
93707
|
}
|
|
@@ -93673,7 +93900,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
|
93673
93900
|
}
|
|
93674
93901
|
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
93675
93902
|
function startCallbackServer(port) {
|
|
93676
|
-
return new Promise((
|
|
93903
|
+
return new Promise((resolve24, reject) => {
|
|
93677
93904
|
let timeoutId;
|
|
93678
93905
|
const server2 = createServer2((request, response) => {
|
|
93679
93906
|
clearTimeout(timeoutId);
|
|
@@ -93699,7 +93926,7 @@ function startCallbackServer(port) {
|
|
|
93699
93926
|
response.writeHead(200, { "content-type": "text/html" });
|
|
93700
93927
|
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
|
|
93701
93928
|
server2.close();
|
|
93702
|
-
|
|
93929
|
+
resolve24({ code, state: state2 });
|
|
93703
93930
|
});
|
|
93704
93931
|
timeoutId = setTimeout(() => {
|
|
93705
93932
|
server2.close();
|
|
@@ -94039,7 +94266,7 @@ function createMcpOAuthCommand() {
|
|
|
94039
94266
|
}
|
|
94040
94267
|
|
|
94041
94268
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
94042
|
-
import { existsSync as
|
|
94269
|
+
import { existsSync as existsSync62 } from "node:fs";
|
|
94043
94270
|
|
|
94044
94271
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
94045
94272
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -94176,10 +94403,10 @@ async function boulder(options) {
|
|
|
94176
94403
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
94177
94404
|
const state2 = readBoulderState(directory);
|
|
94178
94405
|
if (!state2) {
|
|
94179
|
-
const message =
|
|
94406
|
+
const message = existsSync62(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
94180
94407
|
process.stderr.write(`${message}
|
|
94181
94408
|
`);
|
|
94182
|
-
return
|
|
94409
|
+
return existsSync62(boulderFilePath) ? 2 : 1;
|
|
94183
94410
|
}
|
|
94184
94411
|
const works = getBoulderWorks(state2);
|
|
94185
94412
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -94197,7 +94424,7 @@ async function boulder(options) {
|
|
|
94197
94424
|
}
|
|
94198
94425
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
94199
94426
|
import { spawn as spawn5 } from "node:child_process";
|
|
94200
|
-
import { existsSync as
|
|
94427
|
+
import { existsSync as existsSync63, realpathSync as realpathSync9 } from "node:fs";
|
|
94201
94428
|
import { homedir as homedir25 } from "node:os";
|
|
94202
94429
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
94203
94430
|
const env3 = input.env ?? process.env;
|
|
@@ -94222,22 +94449,22 @@ async function codexUlwLoop(args) {
|
|
|
94222
94449
|
console.error("Codex ulw-loop is not installed. Run: npx lazycodex-ai@latest install --no-tui");
|
|
94223
94450
|
return 1;
|
|
94224
94451
|
}
|
|
94225
|
-
return new Promise((
|
|
94452
|
+
return new Promise((resolve24) => {
|
|
94226
94453
|
const child = spawn5(command.executable, [...command.argsPrefix, ...args], { stdio: "inherit" });
|
|
94227
94454
|
child.on("error", (error51) => {
|
|
94228
94455
|
console.error(error51.message);
|
|
94229
|
-
|
|
94456
|
+
resolve24(1);
|
|
94230
94457
|
});
|
|
94231
|
-
child.on("close", (code) =>
|
|
94458
|
+
child.on("close", (code) => resolve24(code ?? 1));
|
|
94232
94459
|
});
|
|
94233
94460
|
}
|
|
94234
94461
|
function resolveLocalUlwLoopBin(env3, homeDir) {
|
|
94235
94462
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo-ulw-loop", env: env3, homeDir });
|
|
94236
|
-
return candidates.find((candidate) =>
|
|
94463
|
+
return candidates.find((candidate) => existsSync63(candidate)) ?? null;
|
|
94237
94464
|
}
|
|
94238
94465
|
function resolveLegacyLocalOmoBin(env3, homeDir, currentExecutablePaths) {
|
|
94239
94466
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo", env: env3, homeDir });
|
|
94240
|
-
return candidates.find((candidate) =>
|
|
94467
|
+
return candidates.find((candidate) => existsSync63(candidate) && !isCurrentExecutable(candidate, currentExecutablePaths)) ?? null;
|
|
94241
94468
|
}
|
|
94242
94469
|
function isCurrentExecutable(candidate, currentExecutablePaths) {
|
|
94243
94470
|
const candidateRealPath = realpathOrSelf(candidate);
|
|
@@ -94286,15 +94513,15 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
94286
94513
|
}
|
|
94287
94514
|
|
|
94288
94515
|
// packages/omo-opencode/src/cli/sparkshell.ts
|
|
94289
|
-
import { spawnSync as
|
|
94516
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
94290
94517
|
import { constants as osConstants } from "node:os";
|
|
94291
|
-
import { isAbsolute as
|
|
94518
|
+
import { isAbsolute as isAbsolute11, resolve as resolve24 } from "node:path";
|
|
94292
94519
|
|
|
94293
94520
|
// packages/omo-opencode/src/cli/sparkshell-appserver.ts
|
|
94294
94521
|
init_src();
|
|
94295
|
-
import { existsSync as
|
|
94522
|
+
import { existsSync as existsSync64 } from "node:fs";
|
|
94296
94523
|
import { homedir as homedir26 } from "node:os";
|
|
94297
|
-
import { join as
|
|
94524
|
+
import { join as join83 } from "node:path";
|
|
94298
94525
|
|
|
94299
94526
|
// packages/omo-opencode/src/cli/sparkshell-appserver-websocket.ts
|
|
94300
94527
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
@@ -94445,7 +94672,7 @@ function bufferUnreadSocketBytes(socket, unread) {
|
|
|
94445
94672
|
// packages/omo-opencode/src/cli/sparkshell-appserver.ts
|
|
94446
94673
|
function createDefaultSparkShellAppServerClient(env3) {
|
|
94447
94674
|
const socketPath = resolveAppServerSocketPath(env3);
|
|
94448
|
-
if (!socketPath || !
|
|
94675
|
+
if (!socketPath || !existsSync64(socketPath)) {
|
|
94449
94676
|
return null;
|
|
94450
94677
|
}
|
|
94451
94678
|
return new JsonRpcSparkShellAppServerClient(socketPath, resolveAppServerTimeoutMs(env3));
|
|
@@ -94455,8 +94682,8 @@ function resolveAppServerSocketPath(env3) {
|
|
|
94455
94682
|
if (explicit) {
|
|
94456
94683
|
return explicit;
|
|
94457
94684
|
}
|
|
94458
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94459
|
-
return
|
|
94685
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join83(homedir26(), ".codex");
|
|
94686
|
+
return join83(codexHome, "app-server-control", "app-server-control.sock");
|
|
94460
94687
|
}
|
|
94461
94688
|
function resolveAppServerTimeoutMs(env3) {
|
|
94462
94689
|
const parsed = Number.parseInt(env3["OMO_SPARKSHELL_APP_SERVER_TIMEOUT_MS"]?.trim() ?? "", 10);
|
|
@@ -94885,9 +95112,9 @@ function extractContextHints(requests) {
|
|
|
94885
95112
|
seen.add(key);
|
|
94886
95113
|
hints.push(hint);
|
|
94887
95114
|
}
|
|
94888
|
-
const
|
|
94889
|
-
if (
|
|
94890
|
-
add(
|
|
95115
|
+
const basename15 = hint.slice(hint.lastIndexOf("/") + 1);
|
|
95116
|
+
if (basename15.length > 0 && basename15 !== hint) {
|
|
95117
|
+
add(basename15);
|
|
94891
95118
|
}
|
|
94892
95119
|
};
|
|
94893
95120
|
for (const request of requests) {
|
|
@@ -95026,9 +95253,9 @@ function isLowSurrogate(codeUnit) {
|
|
|
95026
95253
|
|
|
95027
95254
|
// packages/omo-opencode/src/cli/sparkshell-session-context.ts
|
|
95028
95255
|
init_src();
|
|
95029
|
-
import { existsSync as
|
|
95256
|
+
import { existsSync as existsSync65, readdirSync as readdirSync10, readFileSync as readFileSync42 } from "node:fs";
|
|
95030
95257
|
import { homedir as homedir27 } from "node:os";
|
|
95031
|
-
import { join as
|
|
95258
|
+
import { join as join84 } from "node:path";
|
|
95032
95259
|
var SPARKSHELL_SESSION_CONTEXT_ENV = "OMO_SPARKSHELL_SESSION_CONTEXT";
|
|
95033
95260
|
var SPARKSHELL_SESSION_ID_ENV = "OMO_SPARKSHELL_SESSION_ID";
|
|
95034
95261
|
var CODEX_THREAD_ID_ENV = "CODEX_THREAD_ID";
|
|
@@ -95041,11 +95268,11 @@ function resolveCodexSessionId(env3) {
|
|
|
95041
95268
|
return /^[0-9a-f][0-9a-f-]{7,}$/i.test(candidate) ? candidate : null;
|
|
95042
95269
|
}
|
|
95043
95270
|
function findRolloutPath(sessionId, env3, deps = {}) {
|
|
95044
|
-
const fileExists = deps.fileExists ??
|
|
95271
|
+
const fileExists = deps.fileExists ?? existsSync65;
|
|
95045
95272
|
const listDirectory = deps.listDirectory ?? ((path16) => readdirSync10(path16));
|
|
95046
95273
|
const homeDirectory = deps.homeDirectory ?? homedir27;
|
|
95047
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
95048
|
-
const roots = [
|
|
95274
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join84(homeDirectory(), ".codex");
|
|
95275
|
+
const roots = [join84(codexHome, "sessions"), join84(codexHome, "archived_sessions")];
|
|
95049
95276
|
const fileSuffix = `-${sessionId}.jsonl`;
|
|
95050
95277
|
const scanDay = (dayDir) => {
|
|
95051
95278
|
if (!fileExists(dayDir)) {
|
|
@@ -95053,14 +95280,14 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
95053
95280
|
}
|
|
95054
95281
|
for (const name of listSafely(listDirectory, dayDir)) {
|
|
95055
95282
|
if (name.startsWith("rollout-") && name.endsWith(fileSuffix)) {
|
|
95056
|
-
return
|
|
95283
|
+
return join84(dayDir, name);
|
|
95057
95284
|
}
|
|
95058
95285
|
}
|
|
95059
95286
|
return null;
|
|
95060
95287
|
};
|
|
95061
95288
|
for (const dayDir of uuidV7DayDirCandidates(sessionId)) {
|
|
95062
95289
|
for (const root of roots) {
|
|
95063
|
-
const found = scanDay(
|
|
95290
|
+
const found = scanDay(join84(root, dayDir));
|
|
95064
95291
|
if (found) {
|
|
95065
95292
|
return found;
|
|
95066
95293
|
}
|
|
@@ -95071,9 +95298,9 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
95071
95298
|
continue;
|
|
95072
95299
|
}
|
|
95073
95300
|
for (const year of numericNamesDescending(listSafely(listDirectory, root))) {
|
|
95074
|
-
for (const month of numericNamesDescending(listSafely(listDirectory,
|
|
95075
|
-
for (const day of numericNamesDescending(listSafely(listDirectory,
|
|
95076
|
-
const found = scanDay(
|
|
95301
|
+
for (const month of numericNamesDescending(listSafely(listDirectory, join84(root, year)))) {
|
|
95302
|
+
for (const day of numericNamesDescending(listSafely(listDirectory, join84(root, year, month)))) {
|
|
95303
|
+
const found = scanDay(join84(root, year, month, day));
|
|
95077
95304
|
if (found) {
|
|
95078
95305
|
return found;
|
|
95079
95306
|
}
|
|
@@ -95233,7 +95460,7 @@ function uuidV7DayDirCandidates(sessionId) {
|
|
|
95233
95460
|
const candidates = [];
|
|
95234
95461
|
for (const offsetDays of [0, 1, -1]) {
|
|
95235
95462
|
const date5 = new Date(ms + offsetDays * DAY_MS);
|
|
95236
|
-
candidates.push(
|
|
95463
|
+
candidates.push(join84(String(date5.getFullYear()), pad2(date5.getMonth() + 1), pad2(date5.getDate())));
|
|
95237
95464
|
}
|
|
95238
95465
|
return candidates;
|
|
95239
95466
|
}
|
|
@@ -95271,10 +95498,10 @@ function isFalsy2(value) {
|
|
|
95271
95498
|
}
|
|
95272
95499
|
|
|
95273
95500
|
// packages/omo-opencode/src/cli/sparkshell-spark.ts
|
|
95274
|
-
import { spawnSync as
|
|
95501
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
95275
95502
|
import { mkdtempSync, readFileSync as readFileSync43, rmSync as rmSync4 } from "node:fs";
|
|
95276
95503
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
95277
|
-
import { join as
|
|
95504
|
+
import { join as join85 } from "node:path";
|
|
95278
95505
|
var SPARKSHELL_SPARK_ENV = "OMO_SPARKSHELL_SPARK";
|
|
95279
95506
|
var SPARKSHELL_SPARK_MODEL_ENV = "OMO_SPARKSHELL_SPARK_MODEL";
|
|
95280
95507
|
var SPARKSHELL_SPARK_TIMEOUT_ENV = "OMO_SPARKSHELL_SPARK_TIMEOUT_MS";
|
|
@@ -95348,10 +95575,10 @@ function buildSparkExecArgs(env3, lastMessagePath) {
|
|
|
95348
95575
|
function createDefaultSparkSummarizer(env3, cwd) {
|
|
95349
95576
|
return (request) => {
|
|
95350
95577
|
const binary = env3[SPARKSHELL_SPARK_BIN_ENV]?.trim() || "codex";
|
|
95351
|
-
const tempDir = mkdtempSync(
|
|
95352
|
-
const lastMessagePath =
|
|
95578
|
+
const tempDir = mkdtempSync(join85(tmpdir4(), "omo-sparkshell-spark-"));
|
|
95579
|
+
const lastMessagePath = join85(tempDir, "last-message.txt");
|
|
95353
95580
|
try {
|
|
95354
|
-
const result =
|
|
95581
|
+
const result = spawnSync4(binary, [...buildSparkExecArgs(env3, lastMessagePath)], {
|
|
95355
95582
|
cwd,
|
|
95356
95583
|
env: { ...process.env, ...env3, [SPARKSHELL_SPARK_ENV]: "0" },
|
|
95357
95584
|
input: buildSparkSummaryPrompt(request),
|
|
@@ -95544,7 +95771,7 @@ function resolveNativeBinaryOverride(env3, cwd) {
|
|
|
95544
95771
|
if (override.length === 0) {
|
|
95545
95772
|
return "";
|
|
95546
95773
|
}
|
|
95547
|
-
return
|
|
95774
|
+
return isAbsolute11(override) || /^[A-Za-z]:[\\/]/.test(override) ? override : resolve24(cwd, override);
|
|
95548
95775
|
}
|
|
95549
95776
|
async function runAppServerCommand(args, appServerClient, options) {
|
|
95550
95777
|
let invocation;
|
|
@@ -95656,13 +95883,13 @@ function signalExitCode(signal) {
|
|
|
95656
95883
|
return typeof signalNumber === "number" && Number.isFinite(signalNumber) ? 128 + signalNumber : 1;
|
|
95657
95884
|
}
|
|
95658
95885
|
function defaultCommandExists(command) {
|
|
95659
|
-
const result =
|
|
95886
|
+
const result = spawnSync5(command, ["--version"], {
|
|
95660
95887
|
stdio: "ignore"
|
|
95661
95888
|
});
|
|
95662
95889
|
return result.error === undefined;
|
|
95663
95890
|
}
|
|
95664
95891
|
function defaultSpawn(command, args, options) {
|
|
95665
|
-
const result =
|
|
95892
|
+
const result = spawnSync5(command, [...args], {
|
|
95666
95893
|
cwd: options.cwd,
|
|
95667
95894
|
env: { ...process.env, ...options.env },
|
|
95668
95895
|
stdio: ["inherit", "pipe", "pipe"],
|