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/index.js
CHANGED
|
@@ -2145,7 +2145,7 @@ var package_default;
|
|
|
2145
2145
|
var init_package = __esm(() => {
|
|
2146
2146
|
package_default = {
|
|
2147
2147
|
name: "oh-my-opencode",
|
|
2148
|
-
version: "4.
|
|
2148
|
+
version: "4.13.0",
|
|
2149
2149
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2150
2150
|
main: "./dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -2226,7 +2226,8 @@ var init_package = __esm(() => {
|
|
|
2226
2226
|
"build:cli-node": "bun run script/build-cli-node.ts",
|
|
2227
2227
|
"build:codex-install": "bun run script/build-codex-install.ts",
|
|
2228
2228
|
"build:codex-plugin": "npm --prefix packages/omo-codex/plugin ci && bun run --cwd packages/omo-codex/plugin build",
|
|
2229
|
-
"build:
|
|
2229
|
+
"build:materialize-frontend": "node packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs --strict",
|
|
2230
|
+
"build:shared-skills-assets": "bun run build:materialize-frontend && rm -rf dist/skills && cp -R packages/shared-skills/skills dist/skills",
|
|
2230
2231
|
"build:lsp-tools-mcp": "npm --prefix packages/lsp-tools-mcp ci && npm --prefix packages/lsp-tools-mcp run build",
|
|
2231
2232
|
"build:lsp-daemon": "npm --prefix packages/lsp-daemon ci && npm --prefix packages/lsp-daemon run build",
|
|
2232
2233
|
"build:node-require-shim": "bun run script/patch-node-require-shim.ts",
|
|
@@ -2235,6 +2236,7 @@ var init_package = __esm(() => {
|
|
|
2235
2236
|
"build:schema": "bun run script/build-schema.ts",
|
|
2236
2237
|
"build:model-capabilities": "bun run script/build-model-capabilities.ts",
|
|
2237
2238
|
clean: "rm -rf dist",
|
|
2239
|
+
prepack: "bun run build:materialize-frontend",
|
|
2238
2240
|
prepare: "bun run build",
|
|
2239
2241
|
postinstall: "node postinstall.mjs",
|
|
2240
2242
|
prepublishOnly: "bun run clean && bun run build:lsp-tools-mcp && bun run build:lsp-daemon && bun run build",
|
|
@@ -2315,18 +2317,18 @@ var init_package = __esm(() => {
|
|
|
2315
2317
|
typescript: "^6.0.3"
|
|
2316
2318
|
},
|
|
2317
2319
|
optionalDependencies: {
|
|
2318
|
-
"oh-my-opencode-darwin-arm64": "4.
|
|
2319
|
-
"oh-my-opencode-darwin-x64": "4.
|
|
2320
|
-
"oh-my-opencode-darwin-x64-baseline": "4.
|
|
2321
|
-
"oh-my-opencode-linux-arm64": "4.
|
|
2322
|
-
"oh-my-opencode-linux-arm64-musl": "4.
|
|
2323
|
-
"oh-my-opencode-linux-x64": "4.
|
|
2324
|
-
"oh-my-opencode-linux-x64-baseline": "4.
|
|
2325
|
-
"oh-my-opencode-linux-x64-musl": "4.
|
|
2326
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.
|
|
2327
|
-
"oh-my-opencode-windows-arm64": "4.
|
|
2328
|
-
"oh-my-opencode-windows-x64": "4.
|
|
2329
|
-
"oh-my-opencode-windows-x64-baseline": "4.
|
|
2320
|
+
"oh-my-opencode-darwin-arm64": "4.13.0",
|
|
2321
|
+
"oh-my-opencode-darwin-x64": "4.13.0",
|
|
2322
|
+
"oh-my-opencode-darwin-x64-baseline": "4.13.0",
|
|
2323
|
+
"oh-my-opencode-linux-arm64": "4.13.0",
|
|
2324
|
+
"oh-my-opencode-linux-arm64-musl": "4.13.0",
|
|
2325
|
+
"oh-my-opencode-linux-x64": "4.13.0",
|
|
2326
|
+
"oh-my-opencode-linux-x64-baseline": "4.13.0",
|
|
2327
|
+
"oh-my-opencode-linux-x64-musl": "4.13.0",
|
|
2328
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.13.0",
|
|
2329
|
+
"oh-my-opencode-windows-arm64": "4.13.0",
|
|
2330
|
+
"oh-my-opencode-windows-x64": "4.13.0",
|
|
2331
|
+
"oh-my-opencode-windows-x64-baseline": "4.13.0"
|
|
2330
2332
|
},
|
|
2331
2333
|
overrides: {
|
|
2332
2334
|
hono: "^4.12.18",
|
|
@@ -7378,6 +7380,28 @@ var init_workspace = () => {};
|
|
|
7378
7380
|
var init_guidance = __esm(() => {
|
|
7379
7381
|
init_workspace();
|
|
7380
7382
|
});
|
|
7383
|
+
|
|
7384
|
+
// packages/utils/src/codegraph/node-support.ts
|
|
7385
|
+
function evaluateCodegraphNodeSupport(options = {}) {
|
|
7386
|
+
const nodeVersion = options.nodeVersion ?? process.versions.node;
|
|
7387
|
+
const env = options.env ?? process.env;
|
|
7388
|
+
const override = (env[CODEGRAPH_UNSAFE_NODE_ENV]?.trim().length ?? 0) > 0;
|
|
7389
|
+
const major = parseNodeMajor(nodeVersion);
|
|
7390
|
+
if (major >= CODEGRAPH_BLOCKED_NODE_MAJOR) {
|
|
7391
|
+
return { major, override, reason: "too-new", supported: override };
|
|
7392
|
+
}
|
|
7393
|
+
if (major < CODEGRAPH_MIN_NODE_MAJOR) {
|
|
7394
|
+
return { major, override, reason: "too-old", supported: override };
|
|
7395
|
+
}
|
|
7396
|
+
return { major, override, supported: true };
|
|
7397
|
+
}
|
|
7398
|
+
function parseNodeMajor(version) {
|
|
7399
|
+
const normalized = version.startsWith("v") ? version.slice(1) : version;
|
|
7400
|
+
const major = Number.parseInt(normalized.split(".")[0] ?? "", 10);
|
|
7401
|
+
return Number.isNaN(major) ? 0 : major;
|
|
7402
|
+
}
|
|
7403
|
+
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";
|
|
7404
|
+
|
|
7381
7405
|
// packages/utils/src/codegraph/manifest.ts
|
|
7382
7406
|
var init_manifest = () => {};
|
|
7383
7407
|
|
|
@@ -7391,10 +7415,85 @@ var init_provision = __esm(() => {
|
|
|
7391
7415
|
});
|
|
7392
7416
|
|
|
7393
7417
|
// packages/utils/src/codegraph/resolve.ts
|
|
7418
|
+
import { existsSync as existsSync7 } from "fs";
|
|
7419
|
+
import { spawnSync } from "child_process";
|
|
7420
|
+
import { basename as basename2, dirname as dirname2, join as join7 } from "path";
|
|
7394
7421
|
import { createRequire } from "module";
|
|
7395
|
-
|
|
7422
|
+
function defaultNodeVersion(nodePath) {
|
|
7423
|
+
if (nodePath === process.execPath && isNodeExecutableName(nodePath))
|
|
7424
|
+
return process.versions.node;
|
|
7425
|
+
try {
|
|
7426
|
+
const result = spawnSync(nodePath, ["--version"], {
|
|
7427
|
+
encoding: "utf8",
|
|
7428
|
+
timeout: 2000,
|
|
7429
|
+
windowsHide: true
|
|
7430
|
+
});
|
|
7431
|
+
if (result.error !== undefined || result.status !== 0)
|
|
7432
|
+
return null;
|
|
7433
|
+
const version = `${result.stdout}
|
|
7434
|
+
${result.stderr}`.trim().split(/\s+/)[0];
|
|
7435
|
+
return version === undefined || version.length === 0 ? null : version;
|
|
7436
|
+
} catch (error) {
|
|
7437
|
+
if (error instanceof Error)
|
|
7438
|
+
return null;
|
|
7439
|
+
throw error;
|
|
7440
|
+
}
|
|
7441
|
+
}
|
|
7442
|
+
function isNodeExecutableName(filePath) {
|
|
7443
|
+
const executable = basename2(filePath).toLowerCase();
|
|
7444
|
+
return executable === "node" || executable === "node.exe" || /^node\d+(\.exe)?$/.test(executable);
|
|
7445
|
+
}
|
|
7446
|
+
function looksLikePath(command) {
|
|
7447
|
+
return command.includes("/") || command.includes("\\") || /^[a-zA-Z]:/.test(command);
|
|
7448
|
+
}
|
|
7449
|
+
function resolveConfiguredNodeRuntime(configured, fileExists, which2) {
|
|
7450
|
+
if (looksLikePath(configured))
|
|
7451
|
+
return fileExists(configured) ? configured : null;
|
|
7452
|
+
return which2(configured);
|
|
7453
|
+
}
|
|
7454
|
+
function supportsCodegraphNodeRuntime(nodePath, env, nodeVersion) {
|
|
7455
|
+
const version = nodeVersion(nodePath);
|
|
7456
|
+
if (version === null)
|
|
7457
|
+
return false;
|
|
7458
|
+
return evaluateCodegraphNodeSupport({ env, nodeVersion: version }).supported;
|
|
7459
|
+
}
|
|
7460
|
+
function defaultNodeRuntime(env, fileExists, which2, nodeVersion) {
|
|
7461
|
+
const configured = env[CODEGRAPH_NODE_BIN_ENV]?.trim();
|
|
7462
|
+
if (configured !== undefined && configured.length > 0) {
|
|
7463
|
+
const resolved = resolveConfiguredNodeRuntime(configured, fileExists, which2);
|
|
7464
|
+
return resolved !== null && supportsCodegraphNodeRuntime(resolved, env, nodeVersion) ? resolved : null;
|
|
7465
|
+
}
|
|
7466
|
+
const candidates = [
|
|
7467
|
+
...isNodeExecutableName(process.execPath) ? [process.execPath] : [],
|
|
7468
|
+
...CODEGRAPH_NODE_CANDIDATES.map((commandName) => which2(commandName)).filter((candidate) => candidate !== null)
|
|
7469
|
+
];
|
|
7470
|
+
const seen = new Set;
|
|
7471
|
+
for (const candidate of candidates) {
|
|
7472
|
+
if (seen.has(candidate))
|
|
7473
|
+
continue;
|
|
7474
|
+
seen.add(candidate);
|
|
7475
|
+
if (supportsCodegraphNodeRuntime(candidate, env, nodeVersion))
|
|
7476
|
+
return candidate;
|
|
7477
|
+
}
|
|
7478
|
+
return null;
|
|
7479
|
+
}
|
|
7480
|
+
function resolveCodegraphNodeRuntime(options = {}) {
|
|
7481
|
+
const env = options.env ?? process.env;
|
|
7482
|
+
return defaultNodeRuntime(env, options.fileExists ?? existsSync7, options.which ?? bunWhich, options.nodeVersion ?? defaultNodeVersion);
|
|
7483
|
+
}
|
|
7484
|
+
function resolveCodegraphNodeSupport(options = {}) {
|
|
7485
|
+
const env = options.env ?? process.env;
|
|
7486
|
+
const nodeVersion = options.nodeVersion ?? defaultNodeVersion;
|
|
7487
|
+
const runtime3 = resolveCodegraphNodeRuntime({ ...options, env, nodeVersion });
|
|
7488
|
+
if (runtime3 === null) {
|
|
7489
|
+
return evaluateCodegraphNodeSupport({ env, nodeVersion: "0.0.0" });
|
|
7490
|
+
}
|
|
7491
|
+
return evaluateCodegraphNodeSupport({ env, nodeVersion: nodeVersion(runtime3) ?? "0.0.0" });
|
|
7492
|
+
}
|
|
7493
|
+
var CODEGRAPH_NODE_CANDIDATES, requireFromHere;
|
|
7396
7494
|
var init_resolve2 = __esm(() => {
|
|
7397
7495
|
init_which();
|
|
7496
|
+
CODEGRAPH_NODE_CANDIDATES = ["node24", "node22", "node20", "node"];
|
|
7398
7497
|
requireFromHere = createRequire(import.meta.url);
|
|
7399
7498
|
});
|
|
7400
7499
|
|
|
@@ -9940,6 +10039,11 @@ var init_runtime_fallback_error_classifier = __esm(() => {
|
|
|
9940
10039
|
init_runtime_fallback_error_shape();
|
|
9941
10040
|
});
|
|
9942
10041
|
|
|
10042
|
+
// packages/model-core/src/provider-exhaustion-fallback-policy.ts
|
|
10043
|
+
var init_provider_exhaustion_fallback_policy = __esm(() => {
|
|
10044
|
+
init_runtime_fallback_error_classifier();
|
|
10045
|
+
});
|
|
10046
|
+
|
|
9943
10047
|
// packages/model-core/src/runtime-fallback-model.ts
|
|
9944
10048
|
var init_runtime_fallback_model = __esm(() => {
|
|
9945
10049
|
init_model_string_parser();
|
|
@@ -10368,6 +10472,7 @@ var init_src2 = __esm(() => {
|
|
|
10368
10472
|
init_runtime_fallback_auto_retry_signal();
|
|
10369
10473
|
init_runtime_fallback_error_classifier();
|
|
10370
10474
|
init_runtime_fallback_error_shape();
|
|
10475
|
+
init_provider_exhaustion_fallback_policy();
|
|
10371
10476
|
init_runtime_fallback_model();
|
|
10372
10477
|
init_model_capabilities();
|
|
10373
10478
|
init_context_limit_resolver();
|
|
@@ -10979,9 +11084,9 @@ var init_migration2 = __esm(() => {
|
|
|
10979
11084
|
});
|
|
10980
11085
|
|
|
10981
11086
|
// packages/omo-opencode/src/shared/opencode-config-dir.ts
|
|
10982
|
-
import { existsSync as
|
|
11087
|
+
import { existsSync as existsSync9, realpathSync as realpathSync3 } from "fs";
|
|
10983
11088
|
import { homedir as homedir3 } from "os";
|
|
10984
|
-
import { join as
|
|
11089
|
+
import { join as join9, posix, resolve as resolve4, win32 } from "path";
|
|
10985
11090
|
function isDevBuild(version) {
|
|
10986
11091
|
if (!version)
|
|
10987
11092
|
return false;
|
|
@@ -10991,15 +11096,15 @@ function getTauriConfigDir(identifier) {
|
|
|
10991
11096
|
const platform = process.platform;
|
|
10992
11097
|
switch (platform) {
|
|
10993
11098
|
case "darwin":
|
|
10994
|
-
return
|
|
11099
|
+
return join9(homedir3(), "Library", "Application Support", identifier);
|
|
10995
11100
|
case "win32": {
|
|
10996
|
-
const appData = process.env.APPDATA ||
|
|
11101
|
+
const appData = process.env.APPDATA || join9(homedir3(), "AppData", "Roaming");
|
|
10997
11102
|
return win32.join(appData, identifier);
|
|
10998
11103
|
}
|
|
10999
11104
|
case "linux":
|
|
11000
11105
|
default: {
|
|
11001
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
11002
|
-
return
|
|
11106
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join9(homedir3(), ".config");
|
|
11107
|
+
return join9(xdgConfig, identifier);
|
|
11003
11108
|
}
|
|
11004
11109
|
}
|
|
11005
11110
|
}
|
|
@@ -11008,7 +11113,7 @@ function resolveConfigPath(pathValue) {
|
|
|
11008
11113
|
return posix.normalize(pathValue);
|
|
11009
11114
|
}
|
|
11010
11115
|
const resolvedPath = resolve4(pathValue);
|
|
11011
|
-
if (!
|
|
11116
|
+
if (!existsSync9(resolvedPath))
|
|
11012
11117
|
return resolvedPath;
|
|
11013
11118
|
try {
|
|
11014
11119
|
return realpathSync3(resolvedPath);
|
|
@@ -11042,8 +11147,8 @@ function getWslLinuxHomeDir(windowsConfigRoot) {
|
|
|
11042
11147
|
function getCliDefaultConfigDir() {
|
|
11043
11148
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
11044
11149
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment() && isWindowsUserConfigRoot(envXdgConfig);
|
|
11045
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix.join(getWslLinuxHomeDir(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
11046
|
-
const configDir = isWslEnvironment() ? posix.join(xdgConfig, "opencode") :
|
|
11150
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix.join(getWslLinuxHomeDir(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join9(homedir3(), ".config");
|
|
11151
|
+
const configDir = isWslEnvironment() ? posix.join(xdgConfig, "opencode") : join9(xdgConfig, "opencode");
|
|
11047
11152
|
return resolveConfigPath(configDir);
|
|
11048
11153
|
}
|
|
11049
11154
|
function getCliCustomConfigDir() {
|
|
@@ -11076,9 +11181,9 @@ function getOpenCodeConfigDir(options) {
|
|
|
11076
11181
|
const tauriDir = process.platform === "win32" ? win32.isAbsolute(tauriDirBase) ? win32.normalize(tauriDirBase) : win32.resolve(tauriDirBase) : resolveConfigPath(tauriDirBase);
|
|
11077
11182
|
if (checkExisting) {
|
|
11078
11183
|
const legacyDir = getCliConfigDir();
|
|
11079
|
-
const legacyConfig =
|
|
11080
|
-
const legacyConfigC =
|
|
11081
|
-
if (
|
|
11184
|
+
const legacyConfig = join9(legacyDir, "opencode.json");
|
|
11185
|
+
const legacyConfigC = join9(legacyDir, "opencode.jsonc");
|
|
11186
|
+
if (existsSync9(legacyConfig) || existsSync9(legacyConfigC)) {
|
|
11082
11187
|
return legacyDir;
|
|
11083
11188
|
}
|
|
11084
11189
|
}
|
|
@@ -11088,10 +11193,10 @@ function getOpenCodeConfigPaths(options) {
|
|
|
11088
11193
|
const configDir = getOpenCodeConfigDir(options);
|
|
11089
11194
|
return {
|
|
11090
11195
|
configDir,
|
|
11091
|
-
configJson:
|
|
11092
|
-
configJsonc:
|
|
11093
|
-
packageJson:
|
|
11094
|
-
omoConfig:
|
|
11196
|
+
configJson: join9(configDir, "opencode.json"),
|
|
11197
|
+
configJsonc: join9(configDir, "opencode.jsonc"),
|
|
11198
|
+
packageJson: join9(configDir, "package.json"),
|
|
11199
|
+
omoConfig: join9(configDir, `${CONFIG_BASENAME}.json`)
|
|
11095
11200
|
};
|
|
11096
11201
|
}
|
|
11097
11202
|
var TAURI_APP_IDENTIFIER = "ai.opencode.desktop", TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
|
|
@@ -11101,10 +11206,10 @@ var init_opencode_config_dir = __esm(() => {
|
|
|
11101
11206
|
|
|
11102
11207
|
// packages/omo-opencode/src/shared/resolve-agent-definition-paths.ts
|
|
11103
11208
|
import { homedir as homedir4 } from "os";
|
|
11104
|
-
import { isAbsolute as isAbsolute2, join as
|
|
11209
|
+
import { isAbsolute as isAbsolute2, join as join10, resolve as resolve5 } from "path";
|
|
11105
11210
|
function resolveAgentDefinitionPaths(paths, baseDir, containmentDir) {
|
|
11106
11211
|
return paths.flatMap((p) => {
|
|
11107
|
-
const expanded = p.startsWith("~/") ?
|
|
11212
|
+
const expanded = p.startsWith("~/") ? join10(homedir4(), p.slice(2)) : p;
|
|
11108
11213
|
const resolved = isAbsolute2(expanded) ? expanded : resolve5(baseDir, expanded);
|
|
11109
11214
|
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
11110
11215
|
log2(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
@@ -11120,8 +11225,8 @@ var init_resolve_agent_definition_paths = __esm(() => {
|
|
|
11120
11225
|
|
|
11121
11226
|
// packages/omo-opencode/src/shared/opencode-version.ts
|
|
11122
11227
|
import { execSync } from "child_process";
|
|
11123
|
-
import { existsSync as
|
|
11124
|
-
import { dirname as
|
|
11228
|
+
import { existsSync as existsSync10, readFileSync as readFileSync4, realpathSync as realpathSync4 } from "fs";
|
|
11229
|
+
import { dirname as dirname4, join as join11 } from "path";
|
|
11125
11230
|
function parseVersion(version) {
|
|
11126
11231
|
const cleaned = version.replace(/^v/, "").split("-")[0];
|
|
11127
11232
|
return cleaned.split(".").map((n) => parseInt(n, 10) || 0);
|
|
@@ -11162,7 +11267,7 @@ function parsePackageVersion(content) {
|
|
|
11162
11267
|
function getPackageVersionFromBinary(binaryPath, deps) {
|
|
11163
11268
|
try {
|
|
11164
11269
|
const realBinaryPath = deps.realpath(binaryPath);
|
|
11165
|
-
const packagePath =
|
|
11270
|
+
const packagePath = join11(dirname4(dirname4(realBinaryPath)), "package.json");
|
|
11166
11271
|
if (!deps.exists(packagePath))
|
|
11167
11272
|
return null;
|
|
11168
11273
|
return parsePackageVersion(deps.readText(packagePath));
|
|
@@ -11222,15 +11327,15 @@ var init_opencode_version = __esm(() => {
|
|
|
11222
11327
|
return envPath;
|
|
11223
11328
|
return globalThis.Bun?.which("opencode") ?? null;
|
|
11224
11329
|
},
|
|
11225
|
-
exists:
|
|
11330
|
+
exists: existsSync10,
|
|
11226
11331
|
realpath: realpathSync4,
|
|
11227
11332
|
readText: (filePath) => readFileSync4(filePath, "utf-8")
|
|
11228
11333
|
};
|
|
11229
11334
|
});
|
|
11230
11335
|
|
|
11231
11336
|
// packages/omo-opencode/src/shared/opencode-storage-detection.ts
|
|
11232
|
-
import { existsSync as
|
|
11233
|
-
import { join as
|
|
11337
|
+
import { existsSync as existsSync11 } from "fs";
|
|
11338
|
+
import { join as join12 } from "path";
|
|
11234
11339
|
function isSqliteBackend() {
|
|
11235
11340
|
if (cachedResult === true)
|
|
11236
11341
|
return true;
|
|
@@ -11238,8 +11343,8 @@ function isSqliteBackend() {
|
|
|
11238
11343
|
return false;
|
|
11239
11344
|
const check = () => {
|
|
11240
11345
|
const versionOk = isOpenCodeVersionAtLeast(OPENCODE_SQLITE_VERSION);
|
|
11241
|
-
const dbPath =
|
|
11242
|
-
return versionOk &&
|
|
11346
|
+
const dbPath = join12(getDataDir(), "opencode", "opencode.db");
|
|
11347
|
+
return versionOk && existsSync11(dbPath);
|
|
11243
11348
|
};
|
|
11244
11349
|
if (cachedResult === FALSE_PENDING_RETRY) {
|
|
11245
11350
|
const result2 = check();
|
|
@@ -11308,11 +11413,11 @@ var init_bun_file_shim = __esm(() => {
|
|
|
11308
11413
|
});
|
|
11309
11414
|
|
|
11310
11415
|
// packages/omo-opencode/src/shared/binary-downloader.ts
|
|
11311
|
-
import { chmodSync, existsSync as
|
|
11416
|
+
import { chmodSync, existsSync as existsSync12, mkdirSync as mkdirSync4, unlinkSync as unlinkSync3 } from "fs";
|
|
11312
11417
|
import * as path6 from "path";
|
|
11313
11418
|
function getCachedBinaryPath(cacheDir, binaryName) {
|
|
11314
11419
|
const binaryPath = path6.join(cacheDir, binaryName);
|
|
11315
|
-
return
|
|
11420
|
+
return existsSync12(binaryPath) ? binaryPath : null;
|
|
11316
11421
|
}
|
|
11317
11422
|
var init_binary_downloader = __esm(() => {
|
|
11318
11423
|
init_bun_spawn_shim();
|
|
@@ -11480,8 +11585,8 @@ var init_agent_tool_restrictions = __esm(() => {
|
|
|
11480
11585
|
});
|
|
11481
11586
|
|
|
11482
11587
|
// packages/omo-opencode/src/shared/json-file-cache-store.ts
|
|
11483
|
-
import { existsSync as
|
|
11484
|
-
import { join as
|
|
11588
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
11589
|
+
import { join as join14 } from "path";
|
|
11485
11590
|
function toLogLabel(cacheLabel) {
|
|
11486
11591
|
return cacheLabel.toLowerCase();
|
|
11487
11592
|
}
|
|
@@ -11489,11 +11594,11 @@ function createJsonFileCacheStore(options) {
|
|
|
11489
11594
|
let memoryValue;
|
|
11490
11595
|
let writtenInCurrentProcess = false;
|
|
11491
11596
|
function getCacheFilePath() {
|
|
11492
|
-
return
|
|
11597
|
+
return join14(options.getCacheDir(), options.filename);
|
|
11493
11598
|
}
|
|
11494
11599
|
function ensureCacheDir() {
|
|
11495
11600
|
const cacheDir = options.getCacheDir();
|
|
11496
|
-
if (!
|
|
11601
|
+
if (!existsSync13(cacheDir)) {
|
|
11497
11602
|
mkdirSync5(cacheDir, { recursive: true });
|
|
11498
11603
|
}
|
|
11499
11604
|
}
|
|
@@ -11502,7 +11607,7 @@ function createJsonFileCacheStore(options) {
|
|
|
11502
11607
|
return memoryValue;
|
|
11503
11608
|
}
|
|
11504
11609
|
const cacheFile = getCacheFilePath();
|
|
11505
|
-
if (!
|
|
11610
|
+
if (!existsSync13(cacheFile)) {
|
|
11506
11611
|
memoryValue = null;
|
|
11507
11612
|
log2(`[${options.logPrefix}] ${options.cacheLabel} file not found`, { cacheFile });
|
|
11508
11613
|
return null;
|
|
@@ -11528,7 +11633,7 @@ function createJsonFileCacheStore(options) {
|
|
|
11528
11633
|
if (writtenInCurrentProcess) {
|
|
11529
11634
|
return true;
|
|
11530
11635
|
}
|
|
11531
|
-
return
|
|
11636
|
+
return existsSync13(getCacheFilePath());
|
|
11532
11637
|
}
|
|
11533
11638
|
function write(value) {
|
|
11534
11639
|
ensureCacheDir();
|
|
@@ -11771,14 +11876,14 @@ var init_model_resolution_pipeline2 = __esm(() => {
|
|
|
11771
11876
|
});
|
|
11772
11877
|
|
|
11773
11878
|
// packages/omo-opencode/src/shared/model-availability.ts
|
|
11774
|
-
import { existsSync as
|
|
11775
|
-
import { join as
|
|
11879
|
+
import { existsSync as existsSync14, readFileSync as readFileSync6 } from "fs";
|
|
11880
|
+
import { join as join15 } from "path";
|
|
11776
11881
|
function isModelCacheAvailable() {
|
|
11777
11882
|
if (hasProviderModelsCache()) {
|
|
11778
11883
|
return true;
|
|
11779
11884
|
}
|
|
11780
|
-
const cacheFile =
|
|
11781
|
-
return
|
|
11885
|
+
const cacheFile = join15(getOpenCodeCacheDir(), "models.json");
|
|
11886
|
+
return existsSync14(cacheFile);
|
|
11782
11887
|
}
|
|
11783
11888
|
var init_model_availability = __esm(() => {
|
|
11784
11889
|
init_logger2();
|
|
@@ -54202,19 +54307,19 @@ var init_fallback_model_availability = __esm(() => {
|
|
|
54202
54307
|
});
|
|
54203
54308
|
|
|
54204
54309
|
// packages/omo-opencode/src/shared/opencode-storage-paths.ts
|
|
54205
|
-
import { join as
|
|
54310
|
+
import { join as join16 } from "path";
|
|
54206
54311
|
var OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE, SESSION_STORAGE;
|
|
54207
54312
|
var init_opencode_storage_paths = __esm(() => {
|
|
54208
54313
|
init_data_path();
|
|
54209
54314
|
OPENCODE_STORAGE = getOpenCodeStorageDir();
|
|
54210
|
-
MESSAGE_STORAGE =
|
|
54211
|
-
PART_STORAGE =
|
|
54212
|
-
SESSION_STORAGE =
|
|
54315
|
+
MESSAGE_STORAGE = join16(OPENCODE_STORAGE, "message");
|
|
54316
|
+
PART_STORAGE = join16(OPENCODE_STORAGE, "part");
|
|
54317
|
+
SESSION_STORAGE = join16(OPENCODE_STORAGE, "session");
|
|
54213
54318
|
});
|
|
54214
54319
|
|
|
54215
54320
|
// packages/omo-opencode/src/shared/compaction-marker.ts
|
|
54216
|
-
import { existsSync as
|
|
54217
|
-
import { join as
|
|
54321
|
+
import { existsSync as existsSync15, readdirSync, readFileSync as readFileSync7 } from "fs";
|
|
54322
|
+
import { join as join17 } from "path";
|
|
54218
54323
|
function isCompactionPart(part) {
|
|
54219
54324
|
return typeof part === "object" && part !== null && part.type === "compaction";
|
|
54220
54325
|
}
|
|
@@ -54228,20 +54333,20 @@ function isCompactionMessage(message) {
|
|
|
54228
54333
|
return isCompactionAgent(message.info?.agent ?? message.agent) || hasCompactionPart(message.parts);
|
|
54229
54334
|
}
|
|
54230
54335
|
function getCompactionPartStorageDir(messageID) {
|
|
54231
|
-
return
|
|
54336
|
+
return join17(PART_STORAGE, messageID);
|
|
54232
54337
|
}
|
|
54233
54338
|
function hasCompactionPartInStorage(messageID) {
|
|
54234
54339
|
if (!messageID) {
|
|
54235
54340
|
return false;
|
|
54236
54341
|
}
|
|
54237
54342
|
const partDir = getCompactionPartStorageDir(messageID);
|
|
54238
|
-
if (!
|
|
54343
|
+
if (!existsSync15(partDir)) {
|
|
54239
54344
|
return false;
|
|
54240
54345
|
}
|
|
54241
54346
|
try {
|
|
54242
54347
|
return readdirSync(partDir).filter((fileName) => fileName.endsWith(".json")).some((fileName) => {
|
|
54243
54348
|
try {
|
|
54244
|
-
const content = readFileSync7(
|
|
54349
|
+
const content = readFileSync7(join17(partDir, fileName), "utf-8");
|
|
54245
54350
|
return isCompactionPart(JSON.parse(content));
|
|
54246
54351
|
} catch (error) {
|
|
54247
54352
|
if (error instanceof Error) {
|
|
@@ -54341,23 +54446,23 @@ var init_hook_message_injector = __esm(() => {
|
|
|
54341
54446
|
});
|
|
54342
54447
|
|
|
54343
54448
|
// packages/omo-opencode/src/shared/opencode-message-dir.ts
|
|
54344
|
-
import { existsSync as
|
|
54345
|
-
import { join as
|
|
54449
|
+
import { existsSync as existsSync16, readdirSync as readdirSync2 } from "fs";
|
|
54450
|
+
import { join as join18 } from "path";
|
|
54346
54451
|
function getMessageDir(sessionID) {
|
|
54347
54452
|
if (!sessionID.startsWith("ses_"))
|
|
54348
54453
|
return null;
|
|
54349
54454
|
if (/[/\\]|\.\./.test(sessionID))
|
|
54350
54455
|
return null;
|
|
54351
|
-
if (!
|
|
54456
|
+
if (!existsSync16(MESSAGE_STORAGE))
|
|
54352
54457
|
return null;
|
|
54353
|
-
const directPath =
|
|
54354
|
-
if (
|
|
54458
|
+
const directPath = join18(MESSAGE_STORAGE, sessionID);
|
|
54459
|
+
if (existsSync16(directPath)) {
|
|
54355
54460
|
return directPath;
|
|
54356
54461
|
}
|
|
54357
54462
|
try {
|
|
54358
54463
|
for (const dir of readdirSync2(MESSAGE_STORAGE)) {
|
|
54359
|
-
const sessionPath =
|
|
54360
|
-
if (
|
|
54464
|
+
const sessionPath = join18(MESSAGE_STORAGE, dir, sessionID);
|
|
54465
|
+
if (existsSync16(sessionPath)) {
|
|
54361
54466
|
return sessionPath;
|
|
54362
54467
|
}
|
|
54363
54468
|
}
|
|
@@ -56491,7 +56596,7 @@ var require_cross_spawn = __commonJS((exports, module) => {
|
|
|
56491
56596
|
enoent.hookChildProcess(spawned, parsed);
|
|
56492
56597
|
return spawned;
|
|
56493
56598
|
}
|
|
56494
|
-
function
|
|
56599
|
+
function spawnSync3(command, args, options) {
|
|
56495
56600
|
const parsed = parse3(command, args, options);
|
|
56496
56601
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
56497
56602
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
@@ -56499,18 +56604,18 @@ var require_cross_spawn = __commonJS((exports, module) => {
|
|
|
56499
56604
|
}
|
|
56500
56605
|
module.exports = spawn4;
|
|
56501
56606
|
module.exports.spawn = spawn4;
|
|
56502
|
-
module.exports.sync =
|
|
56607
|
+
module.exports.sync = spawnSync3;
|
|
56503
56608
|
module.exports._parse = parse3;
|
|
56504
56609
|
module.exports._enoent = enoent;
|
|
56505
56610
|
});
|
|
56506
56611
|
|
|
56507
56612
|
// node_modules/.bun/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/process.js
|
|
56508
|
-
import { spawnSync as
|
|
56613
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
56509
56614
|
function stop(proc) {
|
|
56510
56615
|
if (proc.exitCode !== null || proc.signalCode !== null)
|
|
56511
56616
|
return;
|
|
56512
56617
|
if (process.platform === "win32" && proc.pid) {
|
|
56513
|
-
const out =
|
|
56618
|
+
const out = spawnSync3("taskkill", ["/pid", String(proc.pid), "/T", "/F"], { windowsHide: true });
|
|
56514
56619
|
if (!out.error && out.status === 0)
|
|
56515
56620
|
return;
|
|
56516
56621
|
}
|
|
@@ -57017,11 +57122,11 @@ var init_opencode_command_dirs = __esm(() => {
|
|
|
57017
57122
|
});
|
|
57018
57123
|
|
|
57019
57124
|
// packages/omo-opencode/src/shared/project-discovery-dirs.ts
|
|
57020
|
-
import { existsSync as
|
|
57021
|
-
import { dirname as
|
|
57125
|
+
import { existsSync as existsSync17, realpathSync as realpathSync5 } from "fs";
|
|
57126
|
+
import { dirname as dirname5, join as join19, resolve as resolve6, win32 as win322 } from "path";
|
|
57022
57127
|
function normalizePath(path7) {
|
|
57023
57128
|
const resolvedPath = process.platform !== "win32" && win322.isAbsolute(path7) ? path7 : resolve6(path7);
|
|
57024
|
-
if (!
|
|
57129
|
+
if (!existsSync17(resolvedPath)) {
|
|
57025
57130
|
return resolvedPath;
|
|
57026
57131
|
}
|
|
57027
57132
|
try {
|
|
@@ -57051,8 +57156,8 @@ function findProjectOpencodePluginConfigFiles(startDirectory, stopDirectory) {
|
|
|
57051
57156
|
const resolvedStopDirectory = stopDirectory ? normalizePath(stopDirectory) : undefined;
|
|
57052
57157
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey(resolvedStopDirectory) : undefined;
|
|
57053
57158
|
while (true) {
|
|
57054
|
-
const opencodeDirectory =
|
|
57055
|
-
if (
|
|
57159
|
+
const opencodeDirectory = join19(currentDirectory, ".opencode");
|
|
57160
|
+
if (existsSync17(opencodeDirectory)) {
|
|
57056
57161
|
const detected = detectPluginConfigFile(opencodeDirectory, {
|
|
57057
57162
|
basenames: [CONFIG_BASENAME],
|
|
57058
57163
|
legacyBasenames: [LEGACY_CONFIG_BASENAME]
|
|
@@ -57068,7 +57173,7 @@ function findProjectOpencodePluginConfigFiles(startDirectory, stopDirectory) {
|
|
|
57068
57173
|
if (stopDirectoryKey === pathKey(currentDirectory)) {
|
|
57069
57174
|
return paths;
|
|
57070
57175
|
}
|
|
57071
|
-
const parentDirectory =
|
|
57176
|
+
const parentDirectory = dirname5(currentDirectory);
|
|
57072
57177
|
if (parentDirectory === currentDirectory) {
|
|
57073
57178
|
return paths;
|
|
57074
57179
|
}
|
|
@@ -57554,17 +57659,17 @@ var init_plugin_name_with_version = __esm(() => {
|
|
|
57554
57659
|
});
|
|
57555
57660
|
|
|
57556
57661
|
// packages/omo-opencode/src/cli/config-manager/backup-config.ts
|
|
57557
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
57558
|
-
import { dirname as
|
|
57662
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync18, mkdirSync as mkdirSync6 } from "fs";
|
|
57663
|
+
import { dirname as dirname6 } from "path";
|
|
57559
57664
|
function backupConfigFile(configPath) {
|
|
57560
|
-
if (!
|
|
57665
|
+
if (!existsSync18(configPath)) {
|
|
57561
57666
|
return { success: true };
|
|
57562
57667
|
}
|
|
57563
57668
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
57564
57669
|
const backupPath = `${configPath}.backup-${timestamp}`;
|
|
57565
57670
|
try {
|
|
57566
|
-
const dir =
|
|
57567
|
-
if (!
|
|
57671
|
+
const dir = dirname6(backupPath);
|
|
57672
|
+
if (!existsSync18(dir)) {
|
|
57568
57673
|
mkdirSync6(dir, { recursive: true });
|
|
57569
57674
|
}
|
|
57570
57675
|
copyFileSync2(configPath, backupPath);
|
|
@@ -57579,10 +57684,10 @@ function backupConfigFile(configPath) {
|
|
|
57579
57684
|
var init_backup_config = () => {};
|
|
57580
57685
|
|
|
57581
57686
|
// packages/omo-opencode/src/cli/config-manager/ensure-config-directory-exists.ts
|
|
57582
|
-
import { existsSync as
|
|
57687
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync7 } from "fs";
|
|
57583
57688
|
function ensureConfigDirectoryExists() {
|
|
57584
57689
|
const configDir = getConfigDir();
|
|
57585
|
-
if (!
|
|
57690
|
+
if (!existsSync19(configDir)) {
|
|
57586
57691
|
mkdirSync7(configDir, { recursive: true });
|
|
57587
57692
|
}
|
|
57588
57693
|
}
|
|
@@ -57620,14 +57725,14 @@ function formatErrorWithSuggestion(err, context) {
|
|
|
57620
57725
|
}
|
|
57621
57726
|
|
|
57622
57727
|
// packages/omo-opencode/src/cli/config-manager/opencode-config-format.ts
|
|
57623
|
-
import { existsSync as
|
|
57728
|
+
import { existsSync as existsSync20 } from "fs";
|
|
57624
57729
|
function detectConfigFormat() {
|
|
57625
57730
|
const configJsonc = getConfigJsonc();
|
|
57626
57731
|
const configJson = getConfigJson();
|
|
57627
|
-
if (
|
|
57732
|
+
if (existsSync20(configJsonc)) {
|
|
57628
57733
|
return { format: "jsonc", path: configJsonc };
|
|
57629
57734
|
}
|
|
57630
|
-
if (
|
|
57735
|
+
if (existsSync20(configJson)) {
|
|
57631
57736
|
return { format: "json", path: configJson };
|
|
57632
57737
|
}
|
|
57633
57738
|
return { format: "none", path: configJson };
|
|
@@ -57760,30 +57865,30 @@ function extractVersionFromPluginEntry(entry) {
|
|
|
57760
57865
|
}
|
|
57761
57866
|
|
|
57762
57867
|
// packages/omo-opencode/src/cli/config-manager/add-plugin-to-opencode-config.ts
|
|
57763
|
-
import { existsSync as
|
|
57764
|
-
import { basename as
|
|
57868
|
+
import { existsSync as existsSync21, readdirSync as readdirSync3, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "fs";
|
|
57869
|
+
import { basename as basename3, dirname as dirname7, join as join20 } from "path";
|
|
57765
57870
|
function detectConfigFormatInDir(configDir) {
|
|
57766
|
-
const configJsonc =
|
|
57767
|
-
const configJson =
|
|
57768
|
-
if (
|
|
57871
|
+
const configJsonc = join20(configDir, "opencode.jsonc");
|
|
57872
|
+
const configJson = join20(configDir, "opencode.json");
|
|
57873
|
+
if (existsSync21(configJsonc)) {
|
|
57769
57874
|
return { format: "jsonc", path: configJsonc };
|
|
57770
57875
|
}
|
|
57771
|
-
if (
|
|
57876
|
+
if (existsSync21(configJson)) {
|
|
57772
57877
|
return { format: "json", path: configJson };
|
|
57773
57878
|
}
|
|
57774
57879
|
return { format: "none", path: configJson };
|
|
57775
57880
|
}
|
|
57776
57881
|
function getParentConfigDirForProfile(configDir) {
|
|
57777
|
-
const parentDir =
|
|
57778
|
-
if (
|
|
57882
|
+
const parentDir = dirname7(configDir);
|
|
57883
|
+
if (basename3(parentDir) !== "profiles")
|
|
57779
57884
|
return null;
|
|
57780
|
-
return
|
|
57885
|
+
return dirname7(parentDir);
|
|
57781
57886
|
}
|
|
57782
57887
|
function listProfileConfigDirs(rootConfigDir) {
|
|
57783
|
-
const profilesDir =
|
|
57784
|
-
if (!
|
|
57888
|
+
const profilesDir = join20(rootConfigDir, "profiles");
|
|
57889
|
+
if (!existsSync21(profilesDir))
|
|
57785
57890
|
return [];
|
|
57786
|
-
return readdirSync3(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
57891
|
+
return readdirSync3(profilesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join20(profilesDir, entry.name)).filter((profileDir) => detectConfigFormatInDir(profileDir).format !== "none");
|
|
57787
57892
|
}
|
|
57788
57893
|
function getConfigTargets() {
|
|
57789
57894
|
const primaryConfigDir = getConfigDir();
|
|
@@ -58283,12 +58388,12 @@ var init_migrations_sidecar2 = __esm(() => {
|
|
|
58283
58388
|
});
|
|
58284
58389
|
|
|
58285
58390
|
// packages/omo-opencode/src/shared/migrate-legacy-config-file.ts
|
|
58286
|
-
import { existsSync as
|
|
58287
|
-
import { join as
|
|
58391
|
+
import { existsSync as existsSync22, readFileSync as readFileSync10, renameSync as renameSync4, rmSync } from "fs";
|
|
58392
|
+
import { join as join21, dirname as dirname8, basename as basename4 } from "path";
|
|
58288
58393
|
function buildCanonicalPath(legacyPath) {
|
|
58289
|
-
const dir =
|
|
58290
|
-
const ext =
|
|
58291
|
-
return
|
|
58394
|
+
const dir = dirname8(legacyPath);
|
|
58395
|
+
const ext = basename4(legacyPath).includes(".jsonc") ? ".jsonc" : ".json";
|
|
58396
|
+
return join21(dir, `${CONFIG_BASENAME}${ext}`);
|
|
58292
58397
|
}
|
|
58293
58398
|
function archiveLegacyConfigFile(legacyPath) {
|
|
58294
58399
|
const backupPath = `${legacyPath}.bak`;
|
|
@@ -58321,10 +58426,10 @@ function archiveLegacyConfigFile(legacyPath) {
|
|
|
58321
58426
|
}
|
|
58322
58427
|
function migrateLegacySidecarFile(legacyPath, canonicalPath) {
|
|
58323
58428
|
const legacySidecarPath = getSidecarPath(legacyPath);
|
|
58324
|
-
if (!
|
|
58429
|
+
if (!existsSync22(legacySidecarPath))
|
|
58325
58430
|
return true;
|
|
58326
58431
|
const canonicalSidecarPath = getSidecarPath(canonicalPath);
|
|
58327
|
-
if (
|
|
58432
|
+
if (existsSync22(canonicalSidecarPath))
|
|
58328
58433
|
return true;
|
|
58329
58434
|
try {
|
|
58330
58435
|
const content = readFileSync10(legacySidecarPath, "utf-8");
|
|
@@ -58344,12 +58449,12 @@ function migrateLegacySidecarFile(legacyPath, canonicalPath) {
|
|
|
58344
58449
|
}
|
|
58345
58450
|
}
|
|
58346
58451
|
function migrateLegacyConfigFile(legacyPath) {
|
|
58347
|
-
if (!
|
|
58452
|
+
if (!existsSync22(legacyPath))
|
|
58348
58453
|
return false;
|
|
58349
|
-
if (!
|
|
58454
|
+
if (!basename4(legacyPath).startsWith(LEGACY_CONFIG_BASENAME))
|
|
58350
58455
|
return false;
|
|
58351
58456
|
const canonicalPath = buildCanonicalPath(legacyPath);
|
|
58352
|
-
if (
|
|
58457
|
+
if (existsSync22(canonicalPath))
|
|
58353
58458
|
return false;
|
|
58354
58459
|
try {
|
|
58355
58460
|
const content = readFileSync10(legacyPath, "utf-8");
|
|
@@ -58393,8 +58498,8 @@ function deepMergeRecord(target, source) {
|
|
|
58393
58498
|
}
|
|
58394
58499
|
|
|
58395
58500
|
// packages/omo-opencode/src/cli/config-manager/write-omo-config.ts
|
|
58396
|
-
import { existsSync as
|
|
58397
|
-
import { basename as
|
|
58501
|
+
import { existsSync as existsSync23, readFileSync as readFileSync11, statSync as statSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
58502
|
+
import { basename as basename5, dirname as dirname9, extname, join as join22 } from "path";
|
|
58398
58503
|
function isEmptyOrWhitespace2(content) {
|
|
58399
58504
|
return content.trim().length === 0;
|
|
58400
58505
|
}
|
|
@@ -58409,12 +58514,12 @@ function writeOmoConfig(installConfig) {
|
|
|
58409
58514
|
};
|
|
58410
58515
|
}
|
|
58411
58516
|
const detectedConfigPath = getOmoConfigPath();
|
|
58412
|
-
const canonicalConfigPath =
|
|
58413
|
-
const shouldMigrateLegacyPath =
|
|
58414
|
-
const omoConfigPath = shouldMigrateLegacyPath ? migrateLegacyConfigFile(detectedConfigPath) ||
|
|
58517
|
+
const canonicalConfigPath = join22(dirname9(detectedConfigPath), `${CONFIG_BASENAME}${extname(detectedConfigPath) || ".json"}`);
|
|
58518
|
+
const shouldMigrateLegacyPath = basename5(detectedConfigPath).startsWith(LEGACY_CONFIG_BASENAME);
|
|
58519
|
+
const omoConfigPath = shouldMigrateLegacyPath ? migrateLegacyConfigFile(detectedConfigPath) || existsSync23(canonicalConfigPath) ? canonicalConfigPath : detectedConfigPath : detectedConfigPath;
|
|
58415
58520
|
try {
|
|
58416
58521
|
const newConfig = generateOmoConfig(installConfig);
|
|
58417
|
-
if (
|
|
58522
|
+
if (existsSync23(omoConfigPath)) {
|
|
58418
58523
|
const backupResult = backupConfigFile(omoConfigPath);
|
|
58419
58524
|
if (!backupResult.success) {
|
|
58420
58525
|
return {
|
|
@@ -58631,10 +58736,10 @@ var init_opencode_binary = __esm(() => {
|
|
|
58631
58736
|
});
|
|
58632
58737
|
|
|
58633
58738
|
// packages/omo-opencode/src/cli/config-manager/detect-current-config.ts
|
|
58634
|
-
import { existsSync as
|
|
58739
|
+
import { existsSync as existsSync24, readFileSync as readFileSync12 } from "fs";
|
|
58635
58740
|
function detectProvidersFromOmoConfig() {
|
|
58636
58741
|
const omoConfigPath = getOmoConfigPath();
|
|
58637
|
-
if (!
|
|
58742
|
+
if (!existsSync24(omoConfigPath)) {
|
|
58638
58743
|
return {
|
|
58639
58744
|
hasOpenAI: true,
|
|
58640
58745
|
hasOpencodeZen: true,
|
|
@@ -58786,10 +58891,10 @@ var init_detect_current_config = __esm(() => {
|
|
|
58786
58891
|
});
|
|
58787
58892
|
|
|
58788
58893
|
// packages/omo-opencode/src/cli/config-manager/bun-install.ts
|
|
58789
|
-
import { existsSync as
|
|
58790
|
-
import { join as
|
|
58894
|
+
import { existsSync as existsSync25 } from "fs";
|
|
58895
|
+
import { join as join23 } from "path";
|
|
58791
58896
|
function getDefaultWorkspaceDir() {
|
|
58792
|
-
return
|
|
58897
|
+
return join23(getOpenCodeCacheDir(), "packages");
|
|
58793
58898
|
}
|
|
58794
58899
|
function readProcessOutput(stream) {
|
|
58795
58900
|
if (!stream) {
|
|
@@ -58815,7 +58920,7 @@ async function runBunInstallWithDetails(options) {
|
|
|
58815
58920
|
const outputMode = options?.outputMode ?? "pipe";
|
|
58816
58921
|
const cacheDir = options?.workspaceDir ?? getDefaultWorkspaceDir();
|
|
58817
58922
|
const packageJsonPath = `${cacheDir}/package.json`;
|
|
58818
|
-
if (!
|
|
58923
|
+
if (!existsSync25(packageJsonPath)) {
|
|
58819
58924
|
return {
|
|
58820
58925
|
success: false,
|
|
58821
58926
|
error: `Workspace not initialized: ${packageJsonPath} not found. OpenCode should create this on first run.`
|
|
@@ -58896,21 +59001,21 @@ var init_config_manager = __esm(() => {
|
|
|
58896
59001
|
});
|
|
58897
59002
|
|
|
58898
59003
|
// packages/telemetry-core/src/activity-state.ts
|
|
58899
|
-
import { existsSync as
|
|
58900
|
-
import { basename as
|
|
59004
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as readFileSync13 } from "fs";
|
|
59005
|
+
import { basename as basename10, join as join49 } from "path";
|
|
58901
59006
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
58902
59007
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
58903
59008
|
env: options.env,
|
|
58904
59009
|
osProvider: options.osProvider
|
|
58905
59010
|
});
|
|
58906
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
58907
|
-
if (dataDir === xdgStateDir || xdgStateDir === undefined &&
|
|
59011
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join49(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
59012
|
+
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename10(dataDir) === product.cacheDirName) {
|
|
58908
59013
|
return dataDir;
|
|
58909
59014
|
}
|
|
58910
|
-
return
|
|
59015
|
+
return join49(dataDir, product.cacheDirName);
|
|
58911
59016
|
}
|
|
58912
59017
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
58913
|
-
return
|
|
59018
|
+
return join49(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
58914
59019
|
}
|
|
58915
59020
|
function getDailyActiveCaptureState(input) {
|
|
58916
59021
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -58935,7 +59040,7 @@ function isPostHogActivityState(value) {
|
|
|
58935
59040
|
}
|
|
58936
59041
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
58937
59042
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
58938
|
-
if (!
|
|
59043
|
+
if (!existsSync28(stateFilePath)) {
|
|
58939
59044
|
return {};
|
|
58940
59045
|
}
|
|
58941
59046
|
try {
|
|
@@ -58980,10 +59085,10 @@ var init_activity_state = __esm(() => {
|
|
|
58980
59085
|
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74";
|
|
58981
59086
|
|
|
58982
59087
|
// packages/telemetry-core/src/diagnostics.ts
|
|
58983
|
-
import { appendFileSync as appendFileSync2, existsSync as
|
|
58984
|
-
import { join as
|
|
59088
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync9, readFileSync as readFileSync14 } from "fs";
|
|
59089
|
+
import { join as join50 } from "path";
|
|
58985
59090
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
58986
|
-
return
|
|
59091
|
+
return join50(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
58987
59092
|
}
|
|
58988
59093
|
function writeTelemetryDiagnostic(input, options) {
|
|
58989
59094
|
const now = options.now ?? new Date;
|
|
@@ -59001,7 +59106,7 @@ function writeTelemetryDiagnostic(input, options) {
|
|
|
59001
59106
|
}
|
|
59002
59107
|
function cleanupTelemetryDiagnostics(options) {
|
|
59003
59108
|
const diagnosticsFilePath = getTelemetryDiagnosticsFilePath(options.diagnosticsDir);
|
|
59004
|
-
if (!
|
|
59109
|
+
if (!existsSync29(diagnosticsFilePath)) {
|
|
59005
59110
|
return;
|
|
59006
59111
|
}
|
|
59007
59112
|
try {
|
|
@@ -59149,7 +59254,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
59149
59254
|
var init_machine_id = () => {};
|
|
59150
59255
|
|
|
59151
59256
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
59152
|
-
import { dirname as
|
|
59257
|
+
import { dirname as dirname16, posix as posix2, sep as sep7 } from "path";
|
|
59153
59258
|
function createModulerModifier() {
|
|
59154
59259
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
59155
59260
|
return async (frames) => {
|
|
@@ -59158,7 +59263,7 @@ function createModulerModifier() {
|
|
|
59158
59263
|
return frames;
|
|
59159
59264
|
};
|
|
59160
59265
|
}
|
|
59161
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
59266
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
59162
59267
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
59163
59268
|
return (filename) => {
|
|
59164
59269
|
if (!filename)
|
|
@@ -64708,7 +64813,7 @@ var package_default2;
|
|
|
64708
64813
|
var init_package2 = __esm(() => {
|
|
64709
64814
|
package_default2 = {
|
|
64710
64815
|
name: "@oh-my-opencode/omo-codex",
|
|
64711
|
-
version: "4.
|
|
64816
|
+
version: "4.13.0",
|
|
64712
64817
|
type: "module",
|
|
64713
64818
|
private: true,
|
|
64714
64819
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -64843,7 +64948,7 @@ function createPostHogClient(source, options = {}) {
|
|
|
64843
64948
|
osProvider: options.osProvider ?? resolveOsProvider(),
|
|
64844
64949
|
product: createCodexTelemetryProductConfig(),
|
|
64845
64950
|
source,
|
|
64846
|
-
transportFactory: options.transportFactory
|
|
64951
|
+
transportFactory: options.transportFactory ?? transportFactoryOverride ?? undefined
|
|
64847
64952
|
});
|
|
64848
64953
|
if (!client3.enabled) {
|
|
64849
64954
|
return NO_OP_POSTHOG;
|
|
@@ -64894,7 +64999,7 @@ function __setActivityStateProviderForTesting(provider) {
|
|
|
64894
64999
|
function __resetActivityStateProviderForTesting() {
|
|
64895
65000
|
activityStateProviderOverride = null;
|
|
64896
65001
|
}
|
|
64897
|
-
var osProviderOverride2 = null, activityStateProviderOverride = null, NO_OP_POSTHOG;
|
|
65002
|
+
var osProviderOverride2 = null, activityStateProviderOverride = null, transportFactoryOverride = null, NO_OP_POSTHOG;
|
|
64898
65003
|
var init_posthog = __esm(() => {
|
|
64899
65004
|
init_src4();
|
|
64900
65005
|
init_diagnostics2();
|
|
@@ -65677,20 +65782,20 @@ var init_update_toasts = __esm(() => {
|
|
|
65677
65782
|
});
|
|
65678
65783
|
|
|
65679
65784
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
65680
|
-
import { existsSync as
|
|
65681
|
-
import { dirname as
|
|
65785
|
+
import { existsSync as existsSync48 } from "fs";
|
|
65786
|
+
import { dirname as dirname25, join as join67 } from "path";
|
|
65682
65787
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
65683
65788
|
function defaultGetModuleHostingWorkspace() {
|
|
65684
65789
|
try {
|
|
65685
|
-
const currentDir =
|
|
65790
|
+
const currentDir = dirname25(fileURLToPath4(import.meta.url));
|
|
65686
65791
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
65687
65792
|
if (!pkgJsonPath)
|
|
65688
65793
|
return null;
|
|
65689
|
-
const pkgDir =
|
|
65690
|
-
const nodeModulesDir =
|
|
65794
|
+
const pkgDir = dirname25(pkgJsonPath);
|
|
65795
|
+
const nodeModulesDir = dirname25(pkgDir);
|
|
65691
65796
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
65692
65797
|
return null;
|
|
65693
|
-
return
|
|
65798
|
+
return dirname25(nodeModulesDir);
|
|
65694
65799
|
} catch (error51) {
|
|
65695
65800
|
if (error51 instanceof Error) {
|
|
65696
65801
|
return null;
|
|
@@ -65831,8 +65936,8 @@ var init_background_update_check = __esm(() => {
|
|
|
65831
65936
|
init_package_json_locator();
|
|
65832
65937
|
init_update_toasts();
|
|
65833
65938
|
defaultDeps4 = {
|
|
65834
|
-
existsSync:
|
|
65835
|
-
join:
|
|
65939
|
+
existsSync: existsSync48,
|
|
65940
|
+
join: join67,
|
|
65836
65941
|
runBunInstallWithDetails,
|
|
65837
65942
|
log: log2,
|
|
65838
65943
|
getOpenCodeCacheDir,
|
|
@@ -65995,7 +66100,7 @@ async function showSpinnerToast(ctx, version3, message) {
|
|
|
65995
66100
|
duration: frameInterval + 50
|
|
65996
66101
|
}
|
|
65997
66102
|
}).catch(ignoreToastError);
|
|
65998
|
-
await new Promise((
|
|
66103
|
+
await new Promise((resolve18) => setTimeout(resolve18, frameInterval));
|
|
65999
66104
|
}
|
|
66000
66105
|
}
|
|
66001
66106
|
var SISYPHUS_SPINNER;
|
|
@@ -66434,13 +66539,13 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
66434
66539
|
}
|
|
66435
66540
|
|
|
66436
66541
|
// packages/omo-codex/src/install/install-codex.ts
|
|
66437
|
-
import { join as
|
|
66438
|
-
import { existsSync as
|
|
66542
|
+
import { join as join51, resolve as resolve14 } from "path";
|
|
66543
|
+
import { existsSync as existsSync30 } from "fs";
|
|
66439
66544
|
import { homedir as homedir6 } from "os";
|
|
66440
66545
|
|
|
66441
66546
|
// packages/omo-codex/src/install/codex-cache-bins.ts
|
|
66442
66547
|
import { chmod, lstat as lstat3, mkdir, readFile as readFile2, readdir, readlink as readlink2, rm as rm2, stat, symlink, writeFile } from "fs/promises";
|
|
66443
|
-
import { basename as
|
|
66548
|
+
import { basename as basename6, isAbsolute as isAbsolute3, join as join26, relative as relative2, resolve as resolve7, sep } from "path";
|
|
66444
66549
|
|
|
66445
66550
|
// packages/omo-codex/src/install/codex-cache-command-shim.ts
|
|
66446
66551
|
var COMMAND_SHIM_MARKER = ":: generated by oh-my-openagent Codex installer";
|
|
@@ -66466,7 +66571,7 @@ function isNodeErrorWithCode(error) {
|
|
|
66466
66571
|
|
|
66467
66572
|
// packages/omo-codex/src/install/codex-cache-legacy-bins.ts
|
|
66468
66573
|
import { lstat as lstat2, readFile, readlink, rm } from "fs/promises";
|
|
66469
|
-
import { join as
|
|
66574
|
+
import { join as join24 } from "path";
|
|
66470
66575
|
var LEGACY_CODEX_COMPONENT_BINS = [
|
|
66471
66576
|
{ name: "omo", component: "ulw-loop" },
|
|
66472
66577
|
{ name: "codex-comment-checker", component: "comment-checker" },
|
|
@@ -66478,7 +66583,7 @@ var LEGACY_CODEX_COMPONENT_BINS = [
|
|
|
66478
66583
|
];
|
|
66479
66584
|
async function removeLegacyCodexComponentBins(binDir, platform) {
|
|
66480
66585
|
for (const entry of LEGACY_CODEX_COMPONENT_BINS) {
|
|
66481
|
-
const linkPath =
|
|
66586
|
+
const linkPath = join24(binDir, platform === "win32" ? `${entry.name}.cmd` : entry.name);
|
|
66482
66587
|
await removeLegacyCodexComponentBin(linkPath, entry.component, platform);
|
|
66483
66588
|
}
|
|
66484
66589
|
}
|
|
@@ -66529,10 +66634,10 @@ function isNodeErrorWithCode2(error) {
|
|
|
66529
66634
|
}
|
|
66530
66635
|
|
|
66531
66636
|
// packages/omo-codex/src/install/codex-cache-runtime-wrapper.ts
|
|
66532
|
-
import { join as
|
|
66637
|
+
import { join as join25 } from "path";
|
|
66533
66638
|
var RUNTIME_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
66534
66639
|
function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
66535
|
-
const ulwLoopBin = toPosixPath(
|
|
66640
|
+
const ulwLoopBin = toPosixPath(join25(binDir, "omo-ulw-loop"));
|
|
66536
66641
|
const nodeCli = escapePosixDoubleQuoted(toPosixPath(nodeCliPath));
|
|
66537
66642
|
const escapedCliPath = escapePosixDoubleQuoted(toPosixPath(cliPath));
|
|
66538
66643
|
const escapedCodexHome = escapePosixDoubleQuoted(toPosixPath(codexHome));
|
|
@@ -66578,7 +66683,7 @@ function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
|
66578
66683
|
`);
|
|
66579
66684
|
}
|
|
66580
66685
|
function windowsRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
66581
|
-
const ulwLoopBin =
|
|
66686
|
+
const ulwLoopBin = join25(binDir, "omo-ulw-loop.cmd");
|
|
66582
66687
|
return [
|
|
66583
66688
|
"@echo off",
|
|
66584
66689
|
`rem ${RUNTIME_WRAPPER_MARKER}`,
|
|
@@ -66634,29 +66739,29 @@ async function linkCachedPluginBins(input) {
|
|
|
66634
66739
|
return linked;
|
|
66635
66740
|
}
|
|
66636
66741
|
async function linkRootRuntimeBin(input) {
|
|
66637
|
-
const cliPath =
|
|
66742
|
+
const cliPath = join26(input.repoRoot, "dist", "cli", "index.js");
|
|
66638
66743
|
if (!await isFile(cliPath))
|
|
66639
66744
|
return null;
|
|
66640
|
-
const nodeCliPath =
|
|
66745
|
+
const nodeCliPath = join26(input.repoRoot, "dist", "cli-node", "index.js");
|
|
66641
66746
|
const platform = input.platform ?? process.platform;
|
|
66642
66747
|
await mkdir(input.binDir, { recursive: true });
|
|
66643
66748
|
if (platform === "win32") {
|
|
66644
|
-
const linkPath2 =
|
|
66749
|
+
const linkPath2 = join26(input.binDir, "omo.cmd");
|
|
66645
66750
|
await replaceRuntimeWrapper(linkPath2, windowsRuntimeWrapper(cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
66646
66751
|
return { name: "omo", path: linkPath2, target: cliPath };
|
|
66647
66752
|
}
|
|
66648
|
-
const linkPath =
|
|
66753
|
+
const linkPath = join26(input.binDir, "omo");
|
|
66649
66754
|
await replaceRuntimeWrapper(linkPath, posixRuntimeWrapper(cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
66650
66755
|
await chmod(linkPath, 493);
|
|
66651
66756
|
return { name: "omo", path: linkPath, target: cliPath };
|
|
66652
66757
|
}
|
|
66653
66758
|
async function linkCachedPluginBin(binDir, link, platform) {
|
|
66654
66759
|
if (platform === "win32") {
|
|
66655
|
-
const linkPath2 =
|
|
66760
|
+
const linkPath2 = join26(binDir, `${link.name}.cmd`);
|
|
66656
66761
|
await replaceCommandShim(linkPath2, link.target);
|
|
66657
66762
|
return linkPath2;
|
|
66658
66763
|
}
|
|
66659
|
-
const linkPath =
|
|
66764
|
+
const linkPath = join26(binDir, link.name);
|
|
66660
66765
|
await replaceSymlink(linkPath, link.target);
|
|
66661
66766
|
return linkPath;
|
|
66662
66767
|
}
|
|
@@ -66677,14 +66782,14 @@ async function discoverPackageBins(root) {
|
|
|
66677
66782
|
async function collectPackageBins(directory, root, links) {
|
|
66678
66783
|
const entries = await readdir(directory, { withFileTypes: true });
|
|
66679
66784
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
66680
|
-
await appendPackageBinLinks(
|
|
66785
|
+
await appendPackageBinLinks(join26(directory, "package.json"), directory, root, links);
|
|
66681
66786
|
}
|
|
66682
66787
|
for (const entry of entries) {
|
|
66683
66788
|
if (!entry.isDirectory())
|
|
66684
66789
|
continue;
|
|
66685
66790
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
66686
66791
|
continue;
|
|
66687
|
-
const childPath =
|
|
66792
|
+
const childPath = join26(directory, entry.name);
|
|
66688
66793
|
if (!childPath.startsWith(root))
|
|
66689
66794
|
continue;
|
|
66690
66795
|
await collectPackageBins(childPath, root, links);
|
|
@@ -66697,7 +66802,7 @@ async function appendPackageBinLinks(packageJsonPath, packageRoot, root, links)
|
|
|
66697
66802
|
const packageName = packageJson.name;
|
|
66698
66803
|
const packageBin = packageJson.bin;
|
|
66699
66804
|
if (typeof packageBin === "string" && typeof packageName === "string") {
|
|
66700
|
-
const name = assertSafeCommandName(
|
|
66805
|
+
const name = assertSafeCommandName(basename6(packageName));
|
|
66701
66806
|
if (!isReservedNestedBinName(name, packageRoot, root)) {
|
|
66702
66807
|
links.push({ name, target: resolvePackageBinTarget(packageRoot, packageBin) });
|
|
66703
66808
|
}
|
|
@@ -66799,11 +66904,11 @@ async function existingNonSymlink(path7) {
|
|
|
66799
66904
|
}
|
|
66800
66905
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
66801
66906
|
import { cp as cp2, mkdir as mkdir3, readFile as readFile7, rename, rm as rm3 } from "fs/promises";
|
|
66802
|
-
import { basename as
|
|
66907
|
+
import { basename as basename7, dirname as dirname12, join as join32, sep as sep5 } from "path";
|
|
66803
66908
|
|
|
66804
66909
|
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
|
|
66805
66910
|
import { cp, mkdir as mkdir2, readFile as readFile3, stat as stat2 } from "fs/promises";
|
|
66806
|
-
import { dirname as
|
|
66911
|
+
import { dirname as dirname10, join as join27, resolve as resolve8 } from "path";
|
|
66807
66912
|
var BUNDLED_MCP_RUNTIMES = [
|
|
66808
66913
|
{
|
|
66809
66914
|
label: "Git Bash MCP",
|
|
@@ -66821,7 +66926,7 @@ var BUNDLED_MCP_RUNTIMES = [
|
|
|
66821
66926
|
}
|
|
66822
66927
|
];
|
|
66823
66928
|
async function copyBundledMcpRuntimeDists(input) {
|
|
66824
|
-
const sourceArgs = await readSourceMcpArgs(
|
|
66929
|
+
const sourceArgs = await readSourceMcpArgs(join27(input.sourceRoot, ".mcp.json"));
|
|
66825
66930
|
for (const runtime4 of BUNDLED_MCP_RUNTIMES) {
|
|
66826
66931
|
if (!sourceArgs.has(runtime4.sourceArg))
|
|
66827
66932
|
continue;
|
|
@@ -66830,15 +66935,15 @@ async function copyBundledMcpRuntimeDists(input) {
|
|
|
66830
66935
|
}
|
|
66831
66936
|
function resolveBundledMcpRuntimeArg(pluginRoot, arg) {
|
|
66832
66937
|
const runtime4 = BUNDLED_MCP_RUNTIMES.find((candidate) => candidate.sourceArg === arg);
|
|
66833
|
-
return runtime4 ?
|
|
66938
|
+
return runtime4 ? join27(pluginRoot, runtime4.destinationArg) : null;
|
|
66834
66939
|
}
|
|
66835
66940
|
async function copyBundledMcpRuntimeDist(pluginRoot, sourceRoot, runtime4) {
|
|
66836
66941
|
const sourcePath = resolve8(sourceRoot, runtime4.sourceDistFromPlugin);
|
|
66837
66942
|
if (!await isDirectory(sourcePath)) {
|
|
66838
66943
|
throw new Error(`missing built ${runtime4.label} dist at ${sourcePath}`);
|
|
66839
66944
|
}
|
|
66840
|
-
const destinationPath =
|
|
66841
|
-
await mkdir2(
|
|
66945
|
+
const destinationPath = join27(pluginRoot, runtime4.destinationDistFromPlugin);
|
|
66946
|
+
await mkdir2(dirname10(destinationPath), { recursive: true });
|
|
66842
66947
|
await cp(sourcePath, destinationPath, { recursive: true });
|
|
66843
66948
|
}
|
|
66844
66949
|
async function readSourceMcpArgs(path7) {
|
|
@@ -66876,37 +66981,37 @@ async function isDirectory(path7) {
|
|
|
66876
66981
|
// packages/omo-codex/src/install/codex-cache-local-dependencies.ts
|
|
66877
66982
|
import { realpathSync as realpathSync6 } from "fs";
|
|
66878
66983
|
import { readFile as readFile4, readdir as readdir2, writeFile as writeFile2 } from "fs/promises";
|
|
66879
|
-
import { dirname as
|
|
66984
|
+
import { dirname as dirname11, isAbsolute as isAbsolute5, join as join29, relative as relative4, resolve as resolve10, sep as sep2 } from "path";
|
|
66880
66985
|
|
|
66881
66986
|
// packages/omo-codex/src/install/codex-cache-paths.ts
|
|
66882
|
-
import { existsSync as
|
|
66883
|
-
import { isAbsolute as isAbsolute4, join as
|
|
66987
|
+
import { existsSync as existsSync26, readdirSync as readdirSync4 } from "fs";
|
|
66988
|
+
import { isAbsolute as isAbsolute4, join as join28, relative as relative3, resolve as resolve9 } from "path";
|
|
66884
66989
|
var DEFAULT_CODEX_MARKETPLACE_NAME = "sisyphuslabs";
|
|
66885
66990
|
var DEFAULT_CODEX_PLUGIN_NAME = "omo";
|
|
66886
66991
|
function resolveDefaultCodexHome(homeDir) {
|
|
66887
|
-
return
|
|
66992
|
+
return join28(homeDir, ".codex");
|
|
66888
66993
|
}
|
|
66889
66994
|
function resolveCodexPluginCacheRoot(codexHome, input = {}) {
|
|
66890
|
-
return
|
|
66995
|
+
return join28(codexHome, "plugins", "cache", input.marketplaceName ?? DEFAULT_CODEX_MARKETPLACE_NAME, input.pluginName ?? DEFAULT_CODEX_PLUGIN_NAME);
|
|
66891
66996
|
}
|
|
66892
66997
|
function resolveCachedCodexComponentCliPath(pluginRoot, componentName) {
|
|
66893
|
-
return
|
|
66998
|
+
return join28(pluginRoot, "components", componentName, "dist", "cli.js");
|
|
66894
66999
|
}
|
|
66895
67000
|
function resolveCodexComponentBinCandidates(input) {
|
|
66896
67001
|
return [
|
|
66897
|
-
input.env.CODEX_LOCAL_BIN_DIR ?
|
|
66898
|
-
|
|
66899
|
-
|
|
67002
|
+
input.env.CODEX_LOCAL_BIN_DIR ? join28(input.env.CODEX_LOCAL_BIN_DIR, input.executableName) : undefined,
|
|
67003
|
+
join28(input.homeDir, ".local", "bin", input.executableName),
|
|
67004
|
+
join28(resolveDefaultCodexHome(input.homeDir), "bin", input.executableName)
|
|
66900
67005
|
].filter((value) => typeof value === "string");
|
|
66901
67006
|
}
|
|
66902
67007
|
function findNewestCachedCodexComponentCli(input) {
|
|
66903
67008
|
const versionsRoot = resolveCodexPluginCacheRoot(input.codexHome, input);
|
|
66904
|
-
if (!
|
|
67009
|
+
if (!existsSync26(versionsRoot))
|
|
66905
67010
|
return null;
|
|
66906
67011
|
const versions = readdirSync4(versionsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionNames).reverse();
|
|
66907
67012
|
for (const version of versions) {
|
|
66908
|
-
const candidate = resolveCachedCodexComponentCliPath(
|
|
66909
|
-
if (
|
|
67013
|
+
const candidate = resolveCachedCodexComponentCliPath(join28(versionsRoot, version), input.componentName);
|
|
67014
|
+
if (existsSync26(candidate))
|
|
66910
67015
|
return candidate;
|
|
66911
67016
|
}
|
|
66912
67017
|
return null;
|
|
@@ -66944,8 +67049,8 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
66944
67049
|
const parsed = JSON.parse(raw);
|
|
66945
67050
|
if (!isPlainRecord3(parsed))
|
|
66946
67051
|
continue;
|
|
66947
|
-
const packageDir =
|
|
66948
|
-
const sourcePackageDir =
|
|
67052
|
+
const packageDir = dirname11(packageJsonPath);
|
|
67053
|
+
const sourcePackageDir = join29(sourceRoot, relative4(pluginRoot, packageDir));
|
|
66949
67054
|
let changed = false;
|
|
66950
67055
|
for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
|
|
66951
67056
|
const dependencies = parsed[field];
|
|
@@ -66983,7 +67088,7 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
66983
67088
|
`);
|
|
66984
67089
|
}
|
|
66985
67090
|
async function readPackageLock(pluginRoot) {
|
|
66986
|
-
const path7 =
|
|
67091
|
+
const path7 = join29(pluginRoot, "package-lock.json");
|
|
66987
67092
|
try {
|
|
66988
67093
|
const parsed = JSON.parse(await readFile4(path7, "utf8"));
|
|
66989
67094
|
return { path: path7, value: isPlainRecord3(parsed) ? parsed : null, changed: false };
|
|
@@ -67044,14 +67149,14 @@ function canonicalizeExistingPath(path7) {
|
|
|
67044
67149
|
async function collectPackageJsonPaths(directory, root, paths) {
|
|
67045
67150
|
const entries = await readdir2(directory, { withFileTypes: true });
|
|
67046
67151
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
67047
|
-
paths.push(
|
|
67152
|
+
paths.push(join29(directory, "package.json"));
|
|
67048
67153
|
}
|
|
67049
67154
|
for (const entry of entries) {
|
|
67050
67155
|
if (!entry.isDirectory())
|
|
67051
67156
|
continue;
|
|
67052
67157
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
67053
67158
|
continue;
|
|
67054
|
-
const childPath =
|
|
67159
|
+
const childPath = join29(directory, entry.name);
|
|
67055
67160
|
if (!isPathInside(childPath, root))
|
|
67056
67161
|
continue;
|
|
67057
67162
|
await collectPackageJsonPaths(childPath, root, paths);
|
|
@@ -67060,10 +67165,10 @@ async function collectPackageJsonPaths(directory, root, paths) {
|
|
|
67060
67165
|
|
|
67061
67166
|
// packages/omo-codex/src/install/codex-cache-mcp-manifest.ts
|
|
67062
67167
|
import { readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
|
|
67063
|
-
import { join as
|
|
67168
|
+
import { join as join30, sep as sep3 } from "path";
|
|
67064
67169
|
var CODEGRAPH_RELATIVE_ARGS = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
|
|
67065
67170
|
async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
|
|
67066
|
-
const manifestPath =
|
|
67171
|
+
const manifestPath = join30(pluginRoot, ".mcp.json");
|
|
67067
67172
|
if (!await fileExistsStrict(manifestPath))
|
|
67068
67173
|
return;
|
|
67069
67174
|
const raw = await readFile5(manifestPath, "utf8");
|
|
@@ -67088,7 +67193,7 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
|
|
|
67088
67193
|
if (bundledMcpRuntimeArg !== null)
|
|
67089
67194
|
return bundledMcpRuntimeArg;
|
|
67090
67195
|
if (CODEGRAPH_RELATIVE_ARGS.has(arg))
|
|
67091
|
-
return
|
|
67196
|
+
return join30(pluginRoot, "components", "codegraph", "dist", "serve.js");
|
|
67092
67197
|
if (arg.startsWith("./") || arg.startsWith("../"))
|
|
67093
67198
|
return resolveCachedRuntimePath(pluginRoot, sourceRoot, arg);
|
|
67094
67199
|
return arg;
|
|
@@ -67103,7 +67208,7 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
|
|
|
67103
67208
|
`);
|
|
67104
67209
|
}
|
|
67105
67210
|
async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
67106
|
-
const manifestPath =
|
|
67211
|
+
const manifestPath = join30(pluginRoot, ".mcp.json");
|
|
67107
67212
|
if (!await fileExistsStrict(manifestPath))
|
|
67108
67213
|
return;
|
|
67109
67214
|
const raw = await readFile5(manifestPath, "utf8");
|
|
@@ -67139,7 +67244,7 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
|
67139
67244
|
|
|
67140
67245
|
// packages/omo-codex/src/install/codex-hook-targets.ts
|
|
67141
67246
|
import { readFile as readFile6 } from "fs/promises";
|
|
67142
|
-
import { join as
|
|
67247
|
+
import { join as join31, sep as sep4 } from "path";
|
|
67143
67248
|
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
|
|
67144
67249
|
async function findMissingHookCommandTargets(pluginRoot) {
|
|
67145
67250
|
const commands = [];
|
|
@@ -67156,7 +67261,7 @@ async function findMissingHookCommandTargets(pluginRoot) {
|
|
|
67156
67261
|
const targetSuffix = match[1];
|
|
67157
67262
|
if (targetSuffix === undefined)
|
|
67158
67263
|
continue;
|
|
67159
|
-
const target =
|
|
67264
|
+
const target = join31(pluginRoot, ...targetSuffix.split(/[\\/]+/));
|
|
67160
67265
|
if (seen.has(target))
|
|
67161
67266
|
continue;
|
|
67162
67267
|
seen.add(target);
|
|
@@ -67167,17 +67272,17 @@ async function findMissingHookCommandTargets(pluginRoot) {
|
|
|
67167
67272
|
return missing;
|
|
67168
67273
|
}
|
|
67169
67274
|
async function hookManifestPaths(pluginRoot) {
|
|
67170
|
-
const pluginManifestPath =
|
|
67275
|
+
const pluginManifestPath = join31(pluginRoot, ".codex-plugin", "plugin.json");
|
|
67171
67276
|
if (!await fileExistsStrict(pluginManifestPath))
|
|
67172
|
-
return [
|
|
67277
|
+
return [join31(pluginRoot, "hooks", "hooks.json")];
|
|
67173
67278
|
const parsed = JSON.parse(await readFile6(pluginManifestPath, "utf8"));
|
|
67174
67279
|
if (!isPlainRecord3(parsed))
|
|
67175
67280
|
return [];
|
|
67176
67281
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
|
|
67177
|
-
return [
|
|
67282
|
+
return [join31(pluginRoot, stripDotSlash(parsed.hooks))];
|
|
67178
67283
|
}
|
|
67179
67284
|
if (Array.isArray(parsed.hooks)) {
|
|
67180
|
-
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) =>
|
|
67285
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) => join31(pluginRoot, stripDotSlash(hookPath)));
|
|
67181
67286
|
}
|
|
67182
67287
|
return [];
|
|
67183
67288
|
}
|
|
@@ -67213,7 +67318,7 @@ async function installCachedPlugin(input) {
|
|
|
67213
67318
|
await maybeRunNpmInstall(input.sourcePath, input.runCommand);
|
|
67214
67319
|
await maybeRunNpmBuild(input.sourcePath, input.runCommand);
|
|
67215
67320
|
}
|
|
67216
|
-
const targetPath =
|
|
67321
|
+
const targetPath = join32(input.codexHome, "plugins", "cache", input.marketplaceName, input.name, input.version);
|
|
67217
67322
|
const tempPath = createTempSiblingPath(targetPath);
|
|
67218
67323
|
await rm3(tempPath, { recursive: true, force: true });
|
|
67219
67324
|
try {
|
|
@@ -67234,14 +67339,14 @@ async function installCachedPlugin(input) {
|
|
|
67234
67339
|
return { name: input.name, version: input.version, path: targetPath };
|
|
67235
67340
|
}
|
|
67236
67341
|
async function maybeRunNpmInstall(cwd, runCommand, args = ["install"]) {
|
|
67237
|
-
if (!await fileExistsStrict(
|
|
67342
|
+
if (!await fileExistsStrict(join32(cwd, "package.json")))
|
|
67238
67343
|
return;
|
|
67239
67344
|
await runCommand("npm", args, { cwd });
|
|
67240
67345
|
}
|
|
67241
67346
|
async function maybeRunNpmBuild(cwd, runCommand) {
|
|
67242
|
-
if (!await fileExistsStrict(
|
|
67347
|
+
if (!await fileExistsStrict(join32(cwd, "package.json")))
|
|
67243
67348
|
return;
|
|
67244
|
-
const packageJson = JSON.parse(await readFile7(
|
|
67349
|
+
const packageJson = JSON.parse(await readFile7(join32(cwd, "package.json"), "utf8"));
|
|
67245
67350
|
if (!isPlainRecord3(packageJson))
|
|
67246
67351
|
return;
|
|
67247
67352
|
const scripts = packageJson.scripts;
|
|
@@ -67250,9 +67355,9 @@ async function maybeRunNpmBuild(cwd, runCommand) {
|
|
|
67250
67355
|
await runCommand("npm", ["run", "build"], { cwd });
|
|
67251
67356
|
}
|
|
67252
67357
|
async function maybeRunNpmSyncSkills(cwd, runCommand) {
|
|
67253
|
-
if (!await fileExistsStrict(
|
|
67358
|
+
if (!await fileExistsStrict(join32(cwd, "package.json")))
|
|
67254
67359
|
return;
|
|
67255
|
-
const packageJson = JSON.parse(await readFile7(
|
|
67360
|
+
const packageJson = JSON.parse(await readFile7(join32(cwd, "package.json"), "utf8"));
|
|
67256
67361
|
if (!isPlainRecord3(packageJson))
|
|
67257
67362
|
return;
|
|
67258
67363
|
const scripts = packageJson.scripts;
|
|
@@ -67261,13 +67366,13 @@ async function maybeRunNpmSyncSkills(cwd, runCommand) {
|
|
|
67261
67366
|
await runCommand("npm", ["run", "sync:skills"], { cwd });
|
|
67262
67367
|
}
|
|
67263
67368
|
function createTempSiblingPath(targetPath) {
|
|
67264
|
-
return
|
|
67369
|
+
return join32(dirname12(targetPath), `.tmp-${basename7(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67265
67370
|
}
|
|
67266
67371
|
function createBackupSiblingPath(targetPath) {
|
|
67267
|
-
return
|
|
67372
|
+
return join32(dirname12(targetPath), `.backup-${basename7(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67268
67373
|
}
|
|
67269
67374
|
async function copyDirectory(sourcePath, targetPath) {
|
|
67270
|
-
await mkdir3(
|
|
67375
|
+
await mkdir3(dirname12(targetPath), { recursive: true });
|
|
67271
67376
|
await cp2(sourcePath, targetPath, { recursive: true, filter: (source) => shouldCopyPluginPath(source, sourcePath) });
|
|
67272
67377
|
}
|
|
67273
67378
|
async function promoteDirectory(tempPath, targetPath, renameDirectory) {
|
|
@@ -67303,9 +67408,9 @@ function shouldCopyPluginPath(path7, root) {
|
|
|
67303
67408
|
}
|
|
67304
67409
|
// packages/omo-codex/src/install/codex-cache-prune.ts
|
|
67305
67410
|
import { lstat as lstat4, readdir as readdir3, rm as rm4, stat as stat3 } from "fs/promises";
|
|
67306
|
-
import { join as
|
|
67411
|
+
import { join as join33 } from "path";
|
|
67307
67412
|
async function pruneMarketplaceCache(input) {
|
|
67308
|
-
const cacheRoot =
|
|
67413
|
+
const cacheRoot = join33(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67309
67414
|
if (!await fileExistsStrict(cacheRoot))
|
|
67310
67415
|
return;
|
|
67311
67416
|
const keep = new Set(input.keepPluginNames);
|
|
@@ -67313,15 +67418,15 @@ async function pruneMarketplaceCache(input) {
|
|
|
67313
67418
|
for (const entry of entries) {
|
|
67314
67419
|
if (!entry.isDirectory() || keep.has(entry.name))
|
|
67315
67420
|
continue;
|
|
67316
|
-
await rm4(
|
|
67421
|
+
await rm4(join33(cacheRoot, entry.name), { recursive: true, force: true });
|
|
67317
67422
|
}
|
|
67318
67423
|
}
|
|
67319
67424
|
async function pruneMarketplacePluginCaches(input) {
|
|
67320
|
-
const cacheRoot =
|
|
67425
|
+
const cacheRoot = join33(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67321
67426
|
if (!await fileExistsStrict(cacheRoot))
|
|
67322
67427
|
return;
|
|
67323
67428
|
for (const pluginName of input.pluginNames) {
|
|
67324
|
-
await rm4(
|
|
67429
|
+
await rm4(join33(cacheRoot, pluginName), { recursive: true, force: true });
|
|
67325
67430
|
}
|
|
67326
67431
|
const remainingEntries = await readCacheEntryNames(cacheRoot);
|
|
67327
67432
|
if (remainingEntries.length === 0) {
|
|
@@ -67368,11 +67473,11 @@ async function isBrokenCacheSymlink(path7) {
|
|
|
67368
67473
|
}
|
|
67369
67474
|
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
|
|
67370
67475
|
import { mkdir as mkdir4, writeFile as writeFile4 } from "fs/promises";
|
|
67371
|
-
import { join as
|
|
67476
|
+
import { join as join34 } from "path";
|
|
67372
67477
|
async function writeCachedMarketplaceManifest(input) {
|
|
67373
|
-
const marketplaceDir =
|
|
67478
|
+
const marketplaceDir = join34(input.marketplaceRoot, ".agents", "plugins");
|
|
67374
67479
|
await mkdir4(marketplaceDir, { recursive: true });
|
|
67375
|
-
await writeFile4(
|
|
67480
|
+
await writeFile4(join34(marketplaceDir, "marketplace.json"), `${JSON.stringify({
|
|
67376
67481
|
name: input.marketplaceName,
|
|
67377
67482
|
plugins: input.plugins.map((plugin) => ({
|
|
67378
67483
|
name: plugin.name,
|
|
@@ -67383,9 +67488,9 @@ async function writeCachedMarketplaceManifest(input) {
|
|
|
67383
67488
|
}
|
|
67384
67489
|
|
|
67385
67490
|
// packages/omo-codex/src/install/codex-package-layout.ts
|
|
67386
|
-
import { existsSync as
|
|
67491
|
+
import { existsSync as existsSync27 } from "fs";
|
|
67387
67492
|
import { readFile as readFile8 } from "fs/promises";
|
|
67388
|
-
import { join as
|
|
67493
|
+
import { join as join35 } from "path";
|
|
67389
67494
|
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
67390
67495
|
"@code-yeongyu/lazycodex",
|
|
67391
67496
|
"@code-yeongyu/lazycodex-ai",
|
|
@@ -67395,10 +67500,10 @@ var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
|
67395
67500
|
"oh-my-openagent"
|
|
67396
67501
|
]);
|
|
67397
67502
|
async function shouldBuildSourcePackages(repoRoot) {
|
|
67398
|
-
if (
|
|
67503
|
+
if (existsSync27(join35(repoRoot, "packages", "omo-opencode", "src", "index.ts")))
|
|
67399
67504
|
return true;
|
|
67400
|
-
const packageJsonPath =
|
|
67401
|
-
if (!
|
|
67505
|
+
const packageJsonPath = join35(repoRoot, "package.json");
|
|
67506
|
+
if (!existsSync27(packageJsonPath))
|
|
67402
67507
|
return true;
|
|
67403
67508
|
const packageJson = JSON.parse(await readFile8(packageJsonPath, "utf8"));
|
|
67404
67509
|
if (!isPlainRecord3(packageJson) || typeof packageJson.name !== "string")
|
|
@@ -67408,11 +67513,12 @@ async function shouldBuildSourcePackages(repoRoot) {
|
|
|
67408
67513
|
|
|
67409
67514
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
67410
67515
|
import { mkdir as mkdir5, readFile as readFile10 } from "fs/promises";
|
|
67411
|
-
import { dirname as
|
|
67516
|
+
import { dirname as dirname14 } from "path";
|
|
67412
67517
|
|
|
67413
67518
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
67414
67519
|
function findTomlSection(config, header) {
|
|
67415
67520
|
const headerLine = `[${header}]`;
|
|
67521
|
+
const targetHeaderPath = parseTomlDottedKey(header);
|
|
67416
67522
|
const lines = config.match(/[^\n]*\n?|$/g) ?? [];
|
|
67417
67523
|
let offset = 0;
|
|
67418
67524
|
let start = -1;
|
|
@@ -67421,7 +67527,7 @@ function findTomlSection(config, header) {
|
|
|
67421
67527
|
break;
|
|
67422
67528
|
const trimmed = line.trim();
|
|
67423
67529
|
if (start === -1) {
|
|
67424
|
-
if (trimmed
|
|
67530
|
+
if (tomlTableHeaderMatches(trimmed, headerLine, targetHeaderPath))
|
|
67425
67531
|
start = offset;
|
|
67426
67532
|
} else if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
|
|
67427
67533
|
return { start, end: offset, text: config.slice(start, offset) };
|
|
@@ -67477,6 +67583,127 @@ function insertSetting(sectionText, key, value) {
|
|
|
67477
67583
|
function escapeRegExp(value) {
|
|
67478
67584
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
67479
67585
|
}
|
|
67586
|
+
function tomlTableHeaderMatches(line, headerLine, targetHeaderPath) {
|
|
67587
|
+
if (line === headerLine)
|
|
67588
|
+
return true;
|
|
67589
|
+
if (!targetHeaderPath)
|
|
67590
|
+
return false;
|
|
67591
|
+
const candidateHeaderPath = parseTomlTableHeader(line);
|
|
67592
|
+
if (!candidateHeaderPath || candidateHeaderPath.length !== targetHeaderPath.length)
|
|
67593
|
+
return false;
|
|
67594
|
+
return candidateHeaderPath.every((part, index) => part === targetHeaderPath[index]);
|
|
67595
|
+
}
|
|
67596
|
+
function parseTomlTableHeader(line) {
|
|
67597
|
+
if (!line.startsWith("[") || !line.endsWith("]") || line.startsWith("[["))
|
|
67598
|
+
return null;
|
|
67599
|
+
return parseTomlDottedKey(line.slice(1, -1).trim());
|
|
67600
|
+
}
|
|
67601
|
+
function parseTomlDottedKey(input) {
|
|
67602
|
+
const parts = [];
|
|
67603
|
+
let index = 0;
|
|
67604
|
+
while (index < input.length) {
|
|
67605
|
+
index = skipWhitespace(input, index);
|
|
67606
|
+
const parsedKey = parseTomlKeyPart(input, index);
|
|
67607
|
+
if (!parsedKey)
|
|
67608
|
+
return null;
|
|
67609
|
+
parts.push(parsedKey.value);
|
|
67610
|
+
index = skipWhitespace(input, parsedKey.nextIndex);
|
|
67611
|
+
if (index === input.length)
|
|
67612
|
+
return parts;
|
|
67613
|
+
if (input[index] !== ".")
|
|
67614
|
+
return null;
|
|
67615
|
+
index += 1;
|
|
67616
|
+
}
|
|
67617
|
+
return parts.length > 0 ? parts : null;
|
|
67618
|
+
}
|
|
67619
|
+
function parseTomlKeyPart(input, startIndex) {
|
|
67620
|
+
const quote = input[startIndex];
|
|
67621
|
+
if (quote === "'")
|
|
67622
|
+
return parseLiteralTomlString(input, startIndex);
|
|
67623
|
+
if (quote === '"')
|
|
67624
|
+
return parseBasicTomlString(input, startIndex);
|
|
67625
|
+
return parseBareTomlKey(input, startIndex);
|
|
67626
|
+
}
|
|
67627
|
+
function parseLiteralTomlString(input, startIndex) {
|
|
67628
|
+
let index = startIndex + 1;
|
|
67629
|
+
let value = "";
|
|
67630
|
+
while (index < input.length) {
|
|
67631
|
+
const char = input[index];
|
|
67632
|
+
if (char === "'")
|
|
67633
|
+
return { value, nextIndex: index + 1 };
|
|
67634
|
+
value += char;
|
|
67635
|
+
index += 1;
|
|
67636
|
+
}
|
|
67637
|
+
return null;
|
|
67638
|
+
}
|
|
67639
|
+
function parseBasicTomlString(input, startIndex) {
|
|
67640
|
+
let index = startIndex + 1;
|
|
67641
|
+
let value = "";
|
|
67642
|
+
while (index < input.length) {
|
|
67643
|
+
const char = input[index];
|
|
67644
|
+
if (char === '"')
|
|
67645
|
+
return { value, nextIndex: index + 1 };
|
|
67646
|
+
if (char !== "\\") {
|
|
67647
|
+
value += char;
|
|
67648
|
+
index += 1;
|
|
67649
|
+
continue;
|
|
67650
|
+
}
|
|
67651
|
+
const escaped = parseBasicTomlEscape(input, index);
|
|
67652
|
+
if (!escaped)
|
|
67653
|
+
return null;
|
|
67654
|
+
value += escaped.value;
|
|
67655
|
+
index = escaped.nextIndex;
|
|
67656
|
+
}
|
|
67657
|
+
return null;
|
|
67658
|
+
}
|
|
67659
|
+
function parseBasicTomlEscape(input, backslashIndex) {
|
|
67660
|
+
const escape = input[backslashIndex + 1];
|
|
67661
|
+
if (escape === undefined)
|
|
67662
|
+
return null;
|
|
67663
|
+
if (escape === "b")
|
|
67664
|
+
return { value: "\b", nextIndex: backslashIndex + 2 };
|
|
67665
|
+
if (escape === "t")
|
|
67666
|
+
return { value: "\t", nextIndex: backslashIndex + 2 };
|
|
67667
|
+
if (escape === "n")
|
|
67668
|
+
return { value: `
|
|
67669
|
+
`, nextIndex: backslashIndex + 2 };
|
|
67670
|
+
if (escape === "f")
|
|
67671
|
+
return { value: "\f", nextIndex: backslashIndex + 2 };
|
|
67672
|
+
if (escape === "r")
|
|
67673
|
+
return { value: "\r", nextIndex: backslashIndex + 2 };
|
|
67674
|
+
if (escape === '"')
|
|
67675
|
+
return { value: '"', nextIndex: backslashIndex + 2 };
|
|
67676
|
+
if (escape === "\\")
|
|
67677
|
+
return { value: "\\", nextIndex: backslashIndex + 2 };
|
|
67678
|
+
if (escape === "u")
|
|
67679
|
+
return parseUnicodeEscape(input, backslashIndex + 2, 4);
|
|
67680
|
+
if (escape === "U")
|
|
67681
|
+
return parseUnicodeEscape(input, backslashIndex + 2, 8);
|
|
67682
|
+
return null;
|
|
67683
|
+
}
|
|
67684
|
+
function parseUnicodeEscape(input, digitsStart, digitCount) {
|
|
67685
|
+
const digits = input.slice(digitsStart, digitsStart + digitCount);
|
|
67686
|
+
if (digits.length !== digitCount || !/^[0-9A-Fa-f]+$/.test(digits))
|
|
67687
|
+
return null;
|
|
67688
|
+
const codePoint = Number.parseInt(digits, 16);
|
|
67689
|
+
if (codePoint > 1114111)
|
|
67690
|
+
return null;
|
|
67691
|
+
return { value: String.fromCodePoint(codePoint), nextIndex: digitsStart + digitCount };
|
|
67692
|
+
}
|
|
67693
|
+
function parseBareTomlKey(input, startIndex) {
|
|
67694
|
+
let index = startIndex;
|
|
67695
|
+
while (index < input.length && /[A-Za-z0-9_-]/.test(input[index]))
|
|
67696
|
+
index += 1;
|
|
67697
|
+
if (index === startIndex)
|
|
67698
|
+
return null;
|
|
67699
|
+
return { value: input.slice(startIndex, index), nextIndex: index };
|
|
67700
|
+
}
|
|
67701
|
+
function skipWhitespace(input, startIndex) {
|
|
67702
|
+
let index = startIndex;
|
|
67703
|
+
while (index < input.length && /\s/.test(input[index]))
|
|
67704
|
+
index += 1;
|
|
67705
|
+
return index;
|
|
67706
|
+
}
|
|
67480
67707
|
|
|
67481
67708
|
// packages/omo-codex/src/install/codex-config-toml-sections.ts
|
|
67482
67709
|
function removeTomlSections(config, shouldRemove) {
|
|
@@ -67505,27 +67732,18 @@ function splitTomlSections(config) {
|
|
|
67505
67732
|
return sections;
|
|
67506
67733
|
}
|
|
67507
67734
|
function parsePluginHeaderKey(header) {
|
|
67508
|
-
const
|
|
67509
|
-
|
|
67510
|
-
return null;
|
|
67511
|
-
return parseLeadingJsonString(header.slice(prefix.length));
|
|
67735
|
+
const path7 = parseTomlDottedKey(header);
|
|
67736
|
+
return path7?.[0] === "plugins" ? path7[1] ?? null : null;
|
|
67512
67737
|
}
|
|
67513
67738
|
function parseAgentHeaderName(header) {
|
|
67514
|
-
const
|
|
67515
|
-
|
|
67516
|
-
return null;
|
|
67517
|
-
const key = header.slice(prefix.length);
|
|
67518
|
-
return key.startsWith('"') ? parseLeadingJsonString(key) : key;
|
|
67739
|
+
const path7 = parseTomlDottedKey(header);
|
|
67740
|
+
return path7?.[0] === "agents" ? path7[1] ?? null : null;
|
|
67519
67741
|
}
|
|
67520
|
-
function
|
|
67521
|
-
|
|
67522
|
-
|
|
67523
|
-
return typeof parsed === "string" ? parsed : null;
|
|
67524
|
-
} catch (error) {
|
|
67525
|
-
if (error instanceof Error)
|
|
67526
|
-
return null;
|
|
67742
|
+
function parseHookStateHeaderKey(header) {
|
|
67743
|
+
const path7 = parseTomlDottedKey(header);
|
|
67744
|
+
if (path7?.[0] !== "hooks" || path7[1] !== "state")
|
|
67527
67745
|
return null;
|
|
67528
|
-
|
|
67746
|
+
return path7[2] ?? null;
|
|
67529
67747
|
}
|
|
67530
67748
|
function parseTomlHeader(line) {
|
|
67531
67749
|
const trimmed = line.trim();
|
|
@@ -67533,25 +67751,6 @@ function parseTomlHeader(line) {
|
|
|
67533
67751
|
return null;
|
|
67534
67752
|
return trimmed.slice(1, -1);
|
|
67535
67753
|
}
|
|
67536
|
-
function parseLeadingJsonString(value) {
|
|
67537
|
-
if (!value.startsWith('"'))
|
|
67538
|
-
return parseJsonString(value);
|
|
67539
|
-
let escaped = false;
|
|
67540
|
-
for (let index = 1;index < value.length; index += 1) {
|
|
67541
|
-
const char = value[index];
|
|
67542
|
-
if (escaped) {
|
|
67543
|
-
escaped = false;
|
|
67544
|
-
continue;
|
|
67545
|
-
}
|
|
67546
|
-
if (char === "\\") {
|
|
67547
|
-
escaped = true;
|
|
67548
|
-
continue;
|
|
67549
|
-
}
|
|
67550
|
-
if (char === '"')
|
|
67551
|
-
return parseJsonString(value.slice(0, index + 1));
|
|
67552
|
-
}
|
|
67553
|
-
return null;
|
|
67554
|
-
}
|
|
67555
67754
|
|
|
67556
67755
|
// packages/omo-codex/src/install/codex-config-agents.ts
|
|
67557
67756
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE = ["codex-ultrawork-reviewer"];
|
|
@@ -67595,12 +67794,12 @@ function tomlKeySegment(value) {
|
|
|
67595
67794
|
|
|
67596
67795
|
// packages/omo-codex/src/install/codex-config-atomic-write.ts
|
|
67597
67796
|
import { lstat as lstat5, readlink as readlink3, realpath, rename as rename2, unlink, writeFile as writeFile5 } from "fs/promises";
|
|
67598
|
-
import { basename as
|
|
67797
|
+
import { basename as basename8, dirname as dirname13, isAbsolute as isAbsolute6, join as join36, resolve as resolve11 } from "path";
|
|
67599
67798
|
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
67600
67799
|
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
67601
67800
|
async function writeFileAtomic(targetPath, data) {
|
|
67602
67801
|
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
67603
|
-
const temporaryPath =
|
|
67802
|
+
const temporaryPath = join36(dirname13(writeTarget), `.tmp-${basename8(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
67604
67803
|
await writeFile5(temporaryPath, data);
|
|
67605
67804
|
try {
|
|
67606
67805
|
await renameWithRetry(temporaryPath, writeTarget);
|
|
@@ -67629,7 +67828,7 @@ async function resolveSymlinkTarget(targetPath) {
|
|
|
67629
67828
|
if (!(error instanceof Error))
|
|
67630
67829
|
throw error;
|
|
67631
67830
|
const linkValue = await readlink3(targetPath);
|
|
67632
|
-
return isAbsolute6(linkValue) ? linkValue : resolve11(
|
|
67831
|
+
return isAbsolute6(linkValue) ? linkValue : resolve11(dirname13(targetPath), linkValue);
|
|
67633
67832
|
}
|
|
67634
67833
|
}
|
|
67635
67834
|
async function renameWithRetry(fromPath, toPath) {
|
|
@@ -67688,10 +67887,7 @@ function removeStaleMarketplacePluginBlocks(config, marketplaceName, keepPluginN
|
|
|
67688
67887
|
}
|
|
67689
67888
|
function removeStaleMarketplaceHookStateBlocks(config, marketplaceName, keepPluginNames) {
|
|
67690
67889
|
return removeTomlSections(config, (header) => {
|
|
67691
|
-
const
|
|
67692
|
-
if (!header.startsWith(prefix))
|
|
67693
|
-
return false;
|
|
67694
|
-
const hookKey = parseJsonString(header.slice(prefix.length));
|
|
67890
|
+
const hookKey = parseHookStateHeaderKey(header);
|
|
67695
67891
|
if (hookKey === null)
|
|
67696
67892
|
return false;
|
|
67697
67893
|
const separator = hookKey.indexOf(":");
|
|
@@ -67776,9 +67972,10 @@ enabled = true
|
|
|
67776
67972
|
function ensureOmoBuiltinMcpPolicies(config, input) {
|
|
67777
67973
|
if (input.marketplaceName !== "sisyphuslabs" || !input.pluginNames.includes("omo"))
|
|
67778
67974
|
return config;
|
|
67975
|
+
const codegraphEnabled = input.codegraphMcpEnabled ?? true;
|
|
67779
67976
|
const gitBashEnabled = (input.platform ?? process.platform) === "win32" && input.gitBashEnabled === true;
|
|
67780
67977
|
let nextConfig = ensurePluginMcpEnabled(config, "omo@sisyphuslabs", "context7", true);
|
|
67781
|
-
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "codegraph",
|
|
67978
|
+
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "codegraph", codegraphEnabled);
|
|
67782
67979
|
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "git_bash", gitBashEnabled);
|
|
67783
67980
|
return nextConfig;
|
|
67784
67981
|
}
|
|
@@ -67871,7 +68068,7 @@ function isRootSetting(line, key) {
|
|
|
67871
68068
|
|
|
67872
68069
|
// packages/omo-codex/src/install/codex-model-catalog.ts
|
|
67873
68070
|
import { readFile as readFile9 } from "fs/promises";
|
|
67874
|
-
import { join as
|
|
68071
|
+
import { join as join37 } from "path";
|
|
67875
68072
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
67876
68073
|
current: {
|
|
67877
68074
|
model: "gpt-5.5",
|
|
@@ -67890,7 +68087,7 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
|
67890
68087
|
]
|
|
67891
68088
|
};
|
|
67892
68089
|
async function readCodexModelCatalog(codexPackageRoot) {
|
|
67893
|
-
const catalogPath =
|
|
68090
|
+
const catalogPath = join37(codexPackageRoot, "plugin", "model-catalog.json");
|
|
67894
68091
|
try {
|
|
67895
68092
|
const parsed = JSON.parse(await readFile9(catalogPath, "utf8"));
|
|
67896
68093
|
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
@@ -67970,7 +68167,7 @@ function removeLegacyAgentsMaxThreadsSetting(config) {
|
|
|
67970
68167
|
|
|
67971
68168
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
67972
68169
|
async function updateCodexConfig(input) {
|
|
67973
|
-
await mkdir5(
|
|
68170
|
+
await mkdir5(dirname14(input.configPath), { recursive: true });
|
|
67974
68171
|
let config = "";
|
|
67975
68172
|
if (await exists(input.configPath))
|
|
67976
68173
|
config = await readFile10(input.configPath, "utf8");
|
|
@@ -68021,7 +68218,7 @@ async function exists(path7) {
|
|
|
68021
68218
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
68022
68219
|
import { createHash as createHash2 } from "crypto";
|
|
68023
68220
|
import { readFile as readFile11 } from "fs/promises";
|
|
68024
|
-
import { join as
|
|
68221
|
+
import { join as join38 } from "path";
|
|
68025
68222
|
var EVENT_LABELS = new Map([
|
|
68026
68223
|
["PreToolUse", "pre_tool_use"],
|
|
68027
68224
|
["PermissionRequest", "permission_request"],
|
|
@@ -68035,7 +68232,7 @@ var EVENT_LABELS = new Map([
|
|
|
68035
68232
|
["Stop", "stop"]
|
|
68036
68233
|
]);
|
|
68037
68234
|
async function trustedHookStatesForPlugin(input) {
|
|
68038
|
-
const manifestPath =
|
|
68235
|
+
const manifestPath = join38(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
68039
68236
|
if (!await exists2(manifestPath))
|
|
68040
68237
|
return [];
|
|
68041
68238
|
const manifest = JSON.parse(await readFile11(manifestPath, "utf8"));
|
|
@@ -68043,7 +68240,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
68043
68240
|
return [];
|
|
68044
68241
|
const states = [];
|
|
68045
68242
|
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
68046
|
-
const hooksPath =
|
|
68243
|
+
const hooksPath = join38(input.pluginRoot, hookPath);
|
|
68047
68244
|
if (!await exists2(hooksPath))
|
|
68048
68245
|
continue;
|
|
68049
68246
|
const parsed = JSON.parse(await readFile11(hooksPath, "utf8"));
|
|
@@ -68173,11 +68370,11 @@ function toCodexResolution(resolution) {
|
|
|
68173
68370
|
|
|
68174
68371
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68175
68372
|
import { copyFile, lstat as lstat7, mkdir as mkdir6, readFile as readFile13, readdir as readdir4, rm as rm6, writeFile as writeFile6 } from "fs/promises";
|
|
68176
|
-
import { basename as
|
|
68373
|
+
import { basename as basename9, join as join40 } from "path";
|
|
68177
68374
|
|
|
68178
68375
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
68179
68376
|
import { lstat as lstat6, readFile as readFile12, rm as rm5 } from "fs/promises";
|
|
68180
|
-
import { join as
|
|
68377
|
+
import { join as join39 } from "path";
|
|
68181
68378
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
68182
68379
|
{
|
|
68183
68380
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -68189,11 +68386,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
68189
68386
|
}
|
|
68190
68387
|
];
|
|
68191
68388
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
68192
|
-
const agentsDir =
|
|
68389
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68193
68390
|
if (!await exists3(agentsDir))
|
|
68194
68391
|
return;
|
|
68195
68392
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
68196
|
-
const agentPath =
|
|
68393
|
+
const agentPath = join39(agentsDir, retiredAgent.fileName);
|
|
68197
68394
|
if (!await exists3(agentPath))
|
|
68198
68395
|
continue;
|
|
68199
68396
|
const agentStat = await lstat6(agentPath);
|
|
@@ -68236,7 +68433,7 @@ function nodeErrorCode(error) {
|
|
|
68236
68433
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68237
68434
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
68238
68435
|
async function capturePreservedAgentReasoning(input) {
|
|
68239
|
-
const agentsDir =
|
|
68436
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
68240
68437
|
if (!await exists4(agentsDir))
|
|
68241
68438
|
return new Map;
|
|
68242
68439
|
const preserved = new Map;
|
|
@@ -68244,7 +68441,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68244
68441
|
for (const entry of agentEntries) {
|
|
68245
68442
|
if (!entry.name.endsWith(".toml"))
|
|
68246
68443
|
continue;
|
|
68247
|
-
const content = await readTextIfExists2(
|
|
68444
|
+
const content = await readTextIfExists2(join40(agentsDir, entry.name));
|
|
68248
68445
|
if (content === null)
|
|
68249
68446
|
continue;
|
|
68250
68447
|
const effort = extractReasoningEffort(content);
|
|
@@ -68254,7 +68451,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68254
68451
|
return preserved;
|
|
68255
68452
|
}
|
|
68256
68453
|
async function capturePreservedAgentServiceTier(input) {
|
|
68257
|
-
const agentsDir =
|
|
68454
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
68258
68455
|
if (!await exists4(agentsDir))
|
|
68259
68456
|
return new Map;
|
|
68260
68457
|
const preserved = new Map;
|
|
@@ -68262,7 +68459,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
68262
68459
|
for (const entry of agentEntries) {
|
|
68263
68460
|
if (!entry.name.endsWith(".toml"))
|
|
68264
68461
|
continue;
|
|
68265
|
-
const content = await readTextIfExists2(
|
|
68462
|
+
const content = await readTextIfExists2(join40(agentsDir, entry.name));
|
|
68266
68463
|
if (content === null)
|
|
68267
68464
|
continue;
|
|
68268
68465
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -68276,13 +68473,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
68276
68473
|
await writeManifest(input.pluginRoot, []);
|
|
68277
68474
|
return [];
|
|
68278
68475
|
}
|
|
68279
|
-
const agentsDir =
|
|
68476
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
68280
68477
|
await mkdir6(agentsDir, { recursive: true });
|
|
68281
68478
|
const linked = [];
|
|
68282
68479
|
for (const agentPath of bundledAgents) {
|
|
68283
|
-
const agentFileName =
|
|
68480
|
+
const agentFileName = basename9(agentPath);
|
|
68284
68481
|
const agentName = agentNameFromToml(agentFileName);
|
|
68285
|
-
const linkPath =
|
|
68482
|
+
const linkPath = join40(agentsDir, agentFileName);
|
|
68286
68483
|
await replaceWithCopy(linkPath, agentPath);
|
|
68287
68484
|
await restorePreservedReasoning({
|
|
68288
68485
|
agentName,
|
|
@@ -68312,7 +68509,7 @@ async function restorePreservedServiceTier(input) {
|
|
|
68312
68509
|
await writeFile6(input.linkPath, replacement.content);
|
|
68313
68510
|
}
|
|
68314
68511
|
async function discoverBundledAgents(pluginRoot) {
|
|
68315
|
-
const componentsRoot =
|
|
68512
|
+
const componentsRoot = join40(pluginRoot, "components");
|
|
68316
68513
|
if (!await exists4(componentsRoot))
|
|
68317
68514
|
return [];
|
|
68318
68515
|
const componentEntries = await readdir4(componentsRoot, { withFileTypes: true });
|
|
@@ -68320,14 +68517,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
68320
68517
|
for (const entry of componentEntries) {
|
|
68321
68518
|
if (!entry.isDirectory())
|
|
68322
68519
|
continue;
|
|
68323
|
-
const agentsRoot =
|
|
68520
|
+
const agentsRoot = join40(componentsRoot, entry.name, "agents");
|
|
68324
68521
|
if (!await exists4(agentsRoot))
|
|
68325
68522
|
continue;
|
|
68326
68523
|
const agentEntries = await readdir4(agentsRoot, { withFileTypes: true });
|
|
68327
68524
|
for (const file2 of agentEntries) {
|
|
68328
68525
|
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
68329
68526
|
continue;
|
|
68330
|
-
agents.push(
|
|
68527
|
+
agents.push(join40(agentsRoot, file2.name));
|
|
68331
68528
|
}
|
|
68332
68529
|
}
|
|
68333
68530
|
agents.sort();
|
|
@@ -68347,7 +68544,7 @@ async function prepareReplacement(linkPath) {
|
|
|
68347
68544
|
await rm6(linkPath, { force: true });
|
|
68348
68545
|
}
|
|
68349
68546
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
68350
|
-
const manifestPath =
|
|
68547
|
+
const manifestPath = join40(pluginRoot, MANIFEST_FILE);
|
|
68351
68548
|
const payload = { agents: [...agentPaths].sort() };
|
|
68352
68549
|
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
68353
68550
|
`);
|
|
@@ -68386,7 +68583,7 @@ function extractTopLevelStringSetting(content, key) {
|
|
|
68386
68583
|
const rawValue = topLevelStringSettingRawValue(line, key);
|
|
68387
68584
|
if (rawValue === undefined)
|
|
68388
68585
|
continue;
|
|
68389
|
-
const parsed =
|
|
68586
|
+
const parsed = parseJsonString(rawValue);
|
|
68390
68587
|
if (parsed !== null)
|
|
68391
68588
|
return parsed;
|
|
68392
68589
|
}
|
|
@@ -68447,7 +68644,7 @@ function isSectionHeader2(line) {
|
|
|
68447
68644
|
function agentNameFromToml(fileName) {
|
|
68448
68645
|
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
68449
68646
|
}
|
|
68450
|
-
function
|
|
68647
|
+
function parseJsonString(value) {
|
|
68451
68648
|
try {
|
|
68452
68649
|
const parsed = JSON.parse(value);
|
|
68453
68650
|
return typeof parsed === "string" ? parsed : null;
|
|
@@ -68475,10 +68672,10 @@ function nodeErrorCode2(error) {
|
|
|
68475
68672
|
|
|
68476
68673
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
68477
68674
|
import { readFile as readFile14 } from "fs/promises";
|
|
68478
|
-
import { join as
|
|
68675
|
+
import { join as join41 } from "path";
|
|
68479
68676
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
68480
68677
|
async function readMarketplace(repoRoot, options) {
|
|
68481
|
-
const marketplacePath = options?.marketplacePath ??
|
|
68678
|
+
const marketplacePath = options?.marketplacePath ?? join41(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
68482
68679
|
const raw = await readFile14(marketplacePath, "utf8");
|
|
68483
68680
|
const parsed = JSON.parse(raw);
|
|
68484
68681
|
if (!isPlainRecord3(parsed))
|
|
@@ -68497,10 +68694,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
68497
68694
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
68498
68695
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
68499
68696
|
const relativePath = sourcePath.slice(2);
|
|
68500
|
-
return
|
|
68697
|
+
return join41(repoRoot, ...relativePath.split(/[\\/]/));
|
|
68501
68698
|
}
|
|
68502
68699
|
async function readPluginManifest(pluginRoot) {
|
|
68503
|
-
const raw = await readFile14(
|
|
68700
|
+
const raw = await readFile14(join41(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
68504
68701
|
const parsed = JSON.parse(raw);
|
|
68505
68702
|
if (!isPlainRecord3(parsed))
|
|
68506
68703
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -68582,7 +68779,7 @@ function validateLocalSourcePath(path7) {
|
|
|
68582
68779
|
|
|
68583
68780
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
68584
68781
|
import { cp as cp3, mkdir as mkdir7, rename as rename3, rm as rm7, writeFile as writeFile7 } from "fs/promises";
|
|
68585
|
-
import { join as
|
|
68782
|
+
import { join as join42, sep as sep6 } from "path";
|
|
68586
68783
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
68587
68784
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
68588
68785
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -68595,21 +68792,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
68595
68792
|
return snapshotPlugins;
|
|
68596
68793
|
}
|
|
68597
68794
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
68598
|
-
return
|
|
68795
|
+
return join42(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
68599
68796
|
}
|
|
68600
68797
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
68601
|
-
const manifestDir =
|
|
68798
|
+
const manifestDir = join42(marketplaceRoot, ".agents", "plugins");
|
|
68602
68799
|
await mkdir7(manifestDir, { recursive: true });
|
|
68603
|
-
const tempPath =
|
|
68800
|
+
const tempPath = join42(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
68604
68801
|
await writeFile7(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
68605
68802
|
`);
|
|
68606
|
-
await rename3(tempPath,
|
|
68803
|
+
await rename3(tempPath, join42(manifestDir, "marketplace.json"));
|
|
68607
68804
|
}
|
|
68608
68805
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
68609
|
-
const pluginsDir =
|
|
68806
|
+
const pluginsDir = join42(marketplaceRoot, "plugins");
|
|
68610
68807
|
await mkdir7(pluginsDir, { recursive: true });
|
|
68611
|
-
const targetPath =
|
|
68612
|
-
const tempPath =
|
|
68808
|
+
const targetPath = join42(pluginsDir, plugin.name);
|
|
68809
|
+
const tempPath = join42(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
68613
68810
|
await rm7(tempPath, { recursive: true, force: true });
|
|
68614
68811
|
await cp3(plugin.sourcePath, tempPath, {
|
|
68615
68812
|
recursive: true,
|
|
@@ -68631,10 +68828,10 @@ function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
|
68631
68828
|
|
|
68632
68829
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
68633
68830
|
import { readdir as readdir5, readFile as readFile15, writeFile as writeFile8 } from "fs/promises";
|
|
68634
|
-
import { join as
|
|
68831
|
+
import { join as join43 } from "path";
|
|
68635
68832
|
async function readDistributionManifest(repoRoot) {
|
|
68636
68833
|
try {
|
|
68637
|
-
const parsed = JSON.parse(await readFile15(
|
|
68834
|
+
const parsed = JSON.parse(await readFile15(join43(repoRoot, "package.json"), "utf8"));
|
|
68638
68835
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
68639
68836
|
return;
|
|
68640
68837
|
return {
|
|
@@ -68654,19 +68851,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
68654
68851
|
return input.manifestVersion ?? "local";
|
|
68655
68852
|
}
|
|
68656
68853
|
async function stampLazyCodexPluginVersion(input) {
|
|
68657
|
-
const manifestPath =
|
|
68854
|
+
const manifestPath = join43(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
68658
68855
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
68659
68856
|
await stampJsonVersion(manifestPath, input.version);
|
|
68660
|
-
await stampJsonVersion(
|
|
68857
|
+
await stampJsonVersion(join43(input.pluginRoot, "package.json"), input.version);
|
|
68661
68858
|
for (const hookPath of hookPaths) {
|
|
68662
|
-
await stampHookStatusMessages(
|
|
68859
|
+
await stampHookStatusMessages(join43(input.pluginRoot, hookPath), input.version);
|
|
68663
68860
|
}
|
|
68664
68861
|
await stampComponentVersions(input);
|
|
68665
68862
|
}
|
|
68666
68863
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
68667
68864
|
if (input.distributionManifest === undefined)
|
|
68668
68865
|
return;
|
|
68669
|
-
await writeFile8(
|
|
68866
|
+
await writeFile8(join43(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
68670
68867
|
packageName: input.distributionManifest.name,
|
|
68671
68868
|
version: input.distributionManifest.version
|
|
68672
68869
|
}, null, "\t")}
|
|
@@ -68723,16 +68920,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
68723
68920
|
async function stampComponentVersions(input) {
|
|
68724
68921
|
let entries;
|
|
68725
68922
|
try {
|
|
68726
|
-
entries = await readdir5(
|
|
68923
|
+
entries = await readdir5(join43(input.pluginRoot, "components"));
|
|
68727
68924
|
} catch (error) {
|
|
68728
68925
|
if (error instanceof Error)
|
|
68729
68926
|
return;
|
|
68730
68927
|
throw error;
|
|
68731
68928
|
}
|
|
68732
68929
|
for (const entry of entries) {
|
|
68733
|
-
const componentRoot =
|
|
68734
|
-
await stampJsonVersion(
|
|
68735
|
-
await stampHookStatusMessages(
|
|
68930
|
+
const componentRoot = join43(input.pluginRoot, "components", entry);
|
|
68931
|
+
await stampJsonVersion(join43(componentRoot, "package.json"), input.version);
|
|
68932
|
+
await stampHookStatusMessages(join43(componentRoot, "hooks", "hooks.json"), input.version);
|
|
68736
68933
|
}
|
|
68737
68934
|
}
|
|
68738
68935
|
function stampHookGroups(hooks, version) {
|
|
@@ -68786,7 +68983,7 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
68786
68983
|
|
|
68787
68984
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
68788
68985
|
import { copyFile as copyFile2, lstat as lstat8, readFile as readFile16, writeFile as writeFile9 } from "fs/promises";
|
|
68789
|
-
import { dirname as
|
|
68986
|
+
import { dirname as dirname15, join as join44, resolve as resolve12 } from "path";
|
|
68790
68987
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
68791
68988
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
68792
68989
|
".codex/hooks.json",
|
|
@@ -68889,37 +69086,37 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
68889
69086
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
68890
69087
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
68891
69088
|
}
|
|
68892
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
69089
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join44(resolve12(codexHome), "config.toml");
|
|
68893
69090
|
let current = resolve12(startDirectory);
|
|
68894
69091
|
const configPathsFromCwd = [];
|
|
68895
69092
|
while (true) {
|
|
68896
|
-
const configPath =
|
|
69093
|
+
const configPath = join44(current, ".codex", "config.toml");
|
|
68897
69094
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
68898
69095
|
if (codexHomeConfigPath === null || resolve12(configPath) !== codexHomeConfigPath) {
|
|
68899
69096
|
configPathsFromCwd.push(configPath);
|
|
68900
69097
|
}
|
|
68901
69098
|
}
|
|
68902
|
-
if (await exists5(
|
|
69099
|
+
if (await exists5(join44(current, ".git"))) {
|
|
68903
69100
|
return configPathsFromCwd.length === 0 ? null : {
|
|
68904
69101
|
projectRoot: current,
|
|
68905
69102
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
68906
69103
|
artifactRoots: artifactRootsForConfigPaths(configPathsFromCwd)
|
|
68907
69104
|
};
|
|
68908
69105
|
}
|
|
68909
|
-
const parent =
|
|
69106
|
+
const parent = dirname15(current);
|
|
68910
69107
|
if (parent === current) {
|
|
68911
69108
|
const nearestConfigPath = configPathsFromCwd[0];
|
|
68912
69109
|
return nearestConfigPath === undefined ? null : {
|
|
68913
|
-
projectRoot:
|
|
69110
|
+
projectRoot: dirname15(dirname15(nearestConfigPath)),
|
|
68914
69111
|
configPaths: [nearestConfigPath],
|
|
68915
|
-
artifactRoots: [
|
|
69112
|
+
artifactRoots: [dirname15(dirname15(nearestConfigPath))]
|
|
68916
69113
|
};
|
|
68917
69114
|
}
|
|
68918
69115
|
current = parent;
|
|
68919
69116
|
}
|
|
68920
69117
|
}
|
|
68921
69118
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
68922
|
-
const codexDirStat = await maybeLstat(
|
|
69119
|
+
const codexDirStat = await maybeLstat(join44(directory, ".codex"));
|
|
68923
69120
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
68924
69121
|
return false;
|
|
68925
69122
|
const configStat = await maybeLstat(configPath);
|
|
@@ -68928,7 +69125,7 @@ async function isRegularProjectLocalConfig(directory, configPath) {
|
|
|
68928
69125
|
function artifactRootsForConfigPaths(configPaths) {
|
|
68929
69126
|
const roots = [];
|
|
68930
69127
|
for (const configPath of configPaths) {
|
|
68931
|
-
const root =
|
|
69128
|
+
const root = dirname15(dirname15(configPath));
|
|
68932
69129
|
if (!roots.includes(root))
|
|
68933
69130
|
roots.push(root);
|
|
68934
69131
|
}
|
|
@@ -68939,7 +69136,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
68939
69136
|
const seenPaths = new Set;
|
|
68940
69137
|
for (const projectRoot of projectRoots) {
|
|
68941
69138
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
68942
|
-
const artifactPath =
|
|
69139
|
+
const artifactPath = join44(projectRoot, relativePath);
|
|
68943
69140
|
if (seenPaths.has(artifactPath))
|
|
68944
69141
|
continue;
|
|
68945
69142
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -69016,11 +69213,11 @@ function formatUnknownError(error) {
|
|
|
69016
69213
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
69017
69214
|
import { readFile as readFile17, readdir as readdir6, rm as rm8 } from "fs/promises";
|
|
69018
69215
|
import { connect } from "net";
|
|
69019
|
-
import { join as
|
|
69216
|
+
import { join as join45 } from "path";
|
|
69020
69217
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
69021
69218
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
69022
69219
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
69023
|
-
const daemonRoot =
|
|
69220
|
+
const daemonRoot = join45(codexHome, "codex-lsp", "daemon");
|
|
69024
69221
|
const reaped = [];
|
|
69025
69222
|
let entries;
|
|
69026
69223
|
try {
|
|
@@ -69029,9 +69226,9 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
69029
69226
|
return reaped;
|
|
69030
69227
|
}
|
|
69031
69228
|
for (const entry of entries) {
|
|
69032
|
-
const versionDir =
|
|
69033
|
-
const pid = await readPidFile(
|
|
69034
|
-
const socketPath = await readEndpointFile(
|
|
69229
|
+
const versionDir = join45(daemonRoot, entry);
|
|
69230
|
+
const pid = await readPidFile(join45(versionDir, "daemon.pid"));
|
|
69231
|
+
const socketPath = await readEndpointFile(join45(versionDir, "daemon.endpoint"));
|
|
69035
69232
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
69036
69233
|
reaped.push(pid);
|
|
69037
69234
|
}
|
|
@@ -69085,7 +69282,7 @@ function sendSigterm(pid) {
|
|
|
69085
69282
|
|
|
69086
69283
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
69087
69284
|
import { homedir as homedir5 } from "os";
|
|
69088
|
-
import { join as
|
|
69285
|
+
import { join as join46, resolve as resolve13 } from "path";
|
|
69089
69286
|
function resolveCodexInstallerBinDir(input) {
|
|
69090
69287
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
69091
69288
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -69094,15 +69291,15 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
69094
69291
|
const defaultCodexHome = resolve13(homeDir, ".codex");
|
|
69095
69292
|
const resolvedCodexHome = resolve13(input.codexHome);
|
|
69096
69293
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
69097
|
-
return
|
|
69294
|
+
return join46(resolvedCodexHome, "bin");
|
|
69098
69295
|
return resolve13(homeDir, ".local", "bin");
|
|
69099
69296
|
}
|
|
69100
69297
|
|
|
69101
69298
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
69102
|
-
import { join as
|
|
69299
|
+
import { join as join47 } from "path";
|
|
69103
69300
|
async function seedAndMigrateOmoSot(input) {
|
|
69104
69301
|
const commandEnv = { ...input.env };
|
|
69105
|
-
const scriptPath =
|
|
69302
|
+
const scriptPath = join47(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
69106
69303
|
try {
|
|
69107
69304
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
69108
69305
|
cwd: input.repoRoot,
|
|
@@ -69117,7 +69314,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
69117
69314
|
|
|
69118
69315
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
69119
69316
|
init_src();
|
|
69120
|
-
import { join as
|
|
69317
|
+
import { join as join48 } from "path";
|
|
69121
69318
|
function describeResult(result) {
|
|
69122
69319
|
if (result.kind === "succeeded")
|
|
69123
69320
|
return null;
|
|
@@ -69131,7 +69328,7 @@ async function installAstGrepForCodex(options) {
|
|
|
69131
69328
|
return;
|
|
69132
69329
|
const platform = options.platform ?? process.platform;
|
|
69133
69330
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
69134
|
-
const skillDir =
|
|
69331
|
+
const skillDir = join48(plugin.path, "skills", "ast-grep");
|
|
69135
69332
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
69136
69333
|
try {
|
|
69137
69334
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -69159,12 +69356,13 @@ async function trackCodexInstallTelemetry() {
|
|
|
69159
69356
|
}
|
|
69160
69357
|
|
|
69161
69358
|
// packages/omo-codex/src/install/install-codex.ts
|
|
69359
|
+
init_src();
|
|
69162
69360
|
var SISYPHUS_LEGACY_CACHE_MARKETPLACES = ["lazycodex", "code-yeongyu-codex-plugins"];
|
|
69163
69361
|
async function runCodexInstaller(options = {}) {
|
|
69164
69362
|
const env3 = options.env ?? process.env;
|
|
69165
69363
|
const platform = options.platform ?? process.platform;
|
|
69166
69364
|
const repoRoot = resolve14(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
69167
|
-
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ??
|
|
69365
|
+
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ?? join51(homedir6(), ".codex"));
|
|
69168
69366
|
const projectDirectory = resolve14(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
69169
69367
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
69170
69368
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -69182,9 +69380,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
69182
69380
|
if (!gitBashResolution.found) {
|
|
69183
69381
|
throw new Error(gitBashResolution.installHint);
|
|
69184
69382
|
}
|
|
69185
|
-
const codexPackageRoot =
|
|
69383
|
+
const codexPackageRoot = join51(repoRoot, "packages", "omo-codex");
|
|
69186
69384
|
const marketplace = await readMarketplace(repoRoot, {
|
|
69187
|
-
marketplacePath:
|
|
69385
|
+
marketplacePath: join51(codexPackageRoot, "marketplace.json")
|
|
69188
69386
|
});
|
|
69189
69387
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
69190
69388
|
const installed = [];
|
|
@@ -69226,7 +69424,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69226
69424
|
if (runtimeLink !== null)
|
|
69227
69425
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
69228
69426
|
else
|
|
69229
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
69427
|
+
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`);
|
|
69230
69428
|
}
|
|
69231
69429
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
69232
69430
|
installed.push(plugin);
|
|
@@ -69279,13 +69477,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
69279
69477
|
});
|
|
69280
69478
|
}
|
|
69281
69479
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
69282
|
-
const marketplaceRoot =
|
|
69480
|
+
const marketplaceRoot = join51(codexHome, "plugins", "cache", marketplace.name);
|
|
69283
69481
|
await writeCachedMarketplaceManifest({
|
|
69284
69482
|
marketplaceName: marketplace.name,
|
|
69285
69483
|
marketplaceRoot,
|
|
69286
69484
|
plugins: installed
|
|
69287
69485
|
});
|
|
69288
|
-
const configPath =
|
|
69486
|
+
const configPath = join51(codexHome, "config.toml");
|
|
69289
69487
|
await updateCodexConfig({
|
|
69290
69488
|
configPath,
|
|
69291
69489
|
repoRoot: codexPackageRoot,
|
|
@@ -69293,6 +69491,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69293
69491
|
marketplaceSource: codexMarketplaceSource(marketplaceRoot),
|
|
69294
69492
|
pluginNames: marketplace.plugins.map((plugin) => plugin.name),
|
|
69295
69493
|
platform,
|
|
69494
|
+
codegraphMcpEnabled: options.codegraphMcpEnabled ?? resolveCodegraphNodeSupport({ env: env3 }).supported,
|
|
69296
69495
|
gitBashEnabled: platform === "win32" && gitBashResolution.found,
|
|
69297
69496
|
trustedHookStates,
|
|
69298
69497
|
agentConfigs: [...agentConfigs.values()].sort((left, right) => left.name.localeCompare(right.name)),
|
|
@@ -69344,7 +69543,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
69344
69543
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
69345
69544
|
if (isRepoRootWithCodexPlugin(current))
|
|
69346
69545
|
return current;
|
|
69347
|
-
for (const wrapperPackageRoot of [
|
|
69546
|
+
for (const wrapperPackageRoot of [join51(current, "node_modules", "oh-my-openagent"), join51(current, "oh-my-openagent")]) {
|
|
69348
69547
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
69349
69548
|
return wrapperPackageRoot;
|
|
69350
69549
|
}
|
|
@@ -69362,7 +69561,7 @@ function findRepoRoot(input) {
|
|
|
69362
69561
|
return findRepoRootFromImporter(input.importerDir);
|
|
69363
69562
|
}
|
|
69364
69563
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
69365
|
-
return
|
|
69564
|
+
return existsSync30(join51(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
69366
69565
|
}
|
|
69367
69566
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
69368
69567
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -69370,7 +69569,7 @@ function codexMarketplaceSource(marketplaceRoot) {
|
|
|
69370
69569
|
// packages/omo-codex/src/install/codex-installation-detection.ts
|
|
69371
69570
|
init_bun_which_shim();
|
|
69372
69571
|
import { execFile as execFile2 } from "child_process";
|
|
69373
|
-
import { existsSync as
|
|
69572
|
+
import { existsSync as existsSync31 } from "fs";
|
|
69374
69573
|
import { homedir as homedir7 } from "os";
|
|
69375
69574
|
import { posix as posix3, win32 as win323 } from "path";
|
|
69376
69575
|
var CODEX_PATH_CHECK_LABEL = "codex (PATH)";
|
|
@@ -69383,7 +69582,7 @@ async function detectCodexInstallation(input = {}) {
|
|
|
69383
69582
|
const platform = input.platform ?? process.platform;
|
|
69384
69583
|
const env3 = input.env ?? process.env;
|
|
69385
69584
|
const homeDir = input.homeDir ?? homedir7();
|
|
69386
|
-
const exists6 = input.exists ??
|
|
69585
|
+
const exists6 = input.exists ?? existsSync31;
|
|
69387
69586
|
const which2 = input.which ?? bunWhich;
|
|
69388
69587
|
const checkedPaths = [CODEX_PATH_CHECK_LABEL];
|
|
69389
69588
|
const cliPath = nonEmptyValue2(which2("codex"));
|
|
@@ -69499,11 +69698,11 @@ function defaultRunCommand2(command, args) {
|
|
|
69499
69698
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
69500
69699
|
import { lstat as lstat10, readFile as readFile19, readdir as readdir7, rm as rm9, rmdir } from "fs/promises";
|
|
69501
69700
|
import { homedir as homedir8 } from "os";
|
|
69502
|
-
import { isAbsolute as
|
|
69701
|
+
import { isAbsolute as isAbsolute9, join as join53, relative as relative7, resolve as resolve16 } from "path";
|
|
69503
69702
|
|
|
69504
69703
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
69505
69704
|
import { lstat as lstat9, mkdir as mkdir8, readFile as readFile18, writeFile as writeFile10 } from "fs/promises";
|
|
69506
|
-
import { dirname as
|
|
69705
|
+
import { dirname as dirname17 } from "path";
|
|
69507
69706
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
69508
69707
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
69509
69708
|
var CURRENT_MANAGED_CODEX_AGENT_NAMES2 = [
|
|
@@ -69537,7 +69736,7 @@ async function cleanupCodexConfig(configPath, now) {
|
|
|
69537
69736
|
if (next === original)
|
|
69538
69737
|
return { changed: false };
|
|
69539
69738
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
69540
|
-
await mkdir8(
|
|
69739
|
+
await mkdir8(dirname17(configPath), { recursive: true });
|
|
69541
69740
|
await writeFile10(backupPath, original);
|
|
69542
69741
|
await writeFile10(configPath, `${next.trimEnd()}
|
|
69543
69742
|
`);
|
|
@@ -69548,21 +69747,18 @@ function removeManagedAgentBlocks(config) {
|
|
|
69548
69747
|
return splitTomlSections2(config).filter((section) => {
|
|
69549
69748
|
if (section.header === null)
|
|
69550
69749
|
return true;
|
|
69551
|
-
const agentName =
|
|
69750
|
+
const agentName = parseAgentHeaderName(section.header);
|
|
69552
69751
|
if (agentName === null || !managedAgentNames.has(agentName))
|
|
69553
69752
|
return true;
|
|
69554
69753
|
return !section.text.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`);
|
|
69555
69754
|
}).map((section) => section.text).join("");
|
|
69556
69755
|
}
|
|
69557
69756
|
function isManagedPluginHeader(header, marketplace) {
|
|
69558
|
-
const pluginKey =
|
|
69757
|
+
const pluginKey = parsePluginHeaderKey(header);
|
|
69559
69758
|
return pluginKey !== null && pluginKey.endsWith(`@${marketplace}`);
|
|
69560
69759
|
}
|
|
69561
69760
|
function isManagedHookStateHeader(header, marketplace) {
|
|
69562
|
-
const
|
|
69563
|
-
if (!header.startsWith(prefix))
|
|
69564
|
-
return false;
|
|
69565
|
-
const hookKey = parseJsonString3(header.slice(prefix.length));
|
|
69761
|
+
const hookKey = parseHookStateHeaderKey(header);
|
|
69566
69762
|
if (hookKey === null)
|
|
69567
69763
|
return false;
|
|
69568
69764
|
const separator = hookKey.indexOf(":");
|
|
@@ -69599,48 +69795,6 @@ function parseTomlHeader2(line) {
|
|
|
69599
69795
|
return null;
|
|
69600
69796
|
return trimmed.slice(1, -1);
|
|
69601
69797
|
}
|
|
69602
|
-
function parsePluginHeaderKey2(header) {
|
|
69603
|
-
const prefix = "plugins.";
|
|
69604
|
-
if (!header.startsWith(prefix))
|
|
69605
|
-
return null;
|
|
69606
|
-
return parseLeadingJsonString2(header.slice(prefix.length));
|
|
69607
|
-
}
|
|
69608
|
-
function parseAgentHeaderName2(header) {
|
|
69609
|
-
const prefix = "agents.";
|
|
69610
|
-
if (!header.startsWith(prefix))
|
|
69611
|
-
return null;
|
|
69612
|
-
const key = header.slice(prefix.length);
|
|
69613
|
-
return key.startsWith('"') ? parseLeadingJsonString2(key) : key;
|
|
69614
|
-
}
|
|
69615
|
-
function parseLeadingJsonString2(value) {
|
|
69616
|
-
if (!value.startsWith('"'))
|
|
69617
|
-
return parseJsonString3(value);
|
|
69618
|
-
let escaped = false;
|
|
69619
|
-
for (let index = 1;index < value.length; index += 1) {
|
|
69620
|
-
const char = value[index];
|
|
69621
|
-
if (escaped) {
|
|
69622
|
-
escaped = false;
|
|
69623
|
-
continue;
|
|
69624
|
-
}
|
|
69625
|
-
if (char === "\\") {
|
|
69626
|
-
escaped = true;
|
|
69627
|
-
continue;
|
|
69628
|
-
}
|
|
69629
|
-
if (char === '"')
|
|
69630
|
-
return parseJsonString3(value.slice(0, index + 1));
|
|
69631
|
-
}
|
|
69632
|
-
return null;
|
|
69633
|
-
}
|
|
69634
|
-
function parseJsonString3(value) {
|
|
69635
|
-
try {
|
|
69636
|
-
const parsed = JSON.parse(value);
|
|
69637
|
-
return typeof parsed === "string" ? parsed : null;
|
|
69638
|
-
} catch (error) {
|
|
69639
|
-
if (error instanceof Error)
|
|
69640
|
-
return null;
|
|
69641
|
-
return null;
|
|
69642
|
-
}
|
|
69643
|
-
}
|
|
69644
69798
|
function formatBackupTimestamp2(date) {
|
|
69645
69799
|
return date.toISOString().replace(/[:.]/g, "-");
|
|
69646
69800
|
}
|
|
@@ -69660,23 +69814,69 @@ function nodeErrorCode4(error) {
|
|
|
69660
69814
|
return typeof error.code === "string" ? error.code : null;
|
|
69661
69815
|
}
|
|
69662
69816
|
|
|
69817
|
+
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
69818
|
+
import { dirname as dirname18, isAbsolute as isAbsolute8, join as join52, relative as relative6, resolve as resolve15 } from "path";
|
|
69819
|
+
function validateManagedCleanupTarget(input) {
|
|
69820
|
+
if (!isAbsolute8(input.path))
|
|
69821
|
+
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
69822
|
+
const codexHome = resolve15(input.codexHome);
|
|
69823
|
+
if (dirname18(codexHome) === codexHome)
|
|
69824
|
+
return skipped(input.path, "Codex home resolves to a filesystem root");
|
|
69825
|
+
const target = resolve15(input.path);
|
|
69826
|
+
if (!isWithinDirectory(codexHome, target))
|
|
69827
|
+
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
69828
|
+
if (target === codexHome)
|
|
69829
|
+
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
69830
|
+
const exactManagedRoots = new Set([
|
|
69831
|
+
resolve15(join52(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
69832
|
+
resolve15(join52(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
69833
|
+
resolve15(join52(codexHome, "runtime", "ast-grep")),
|
|
69834
|
+
resolve15(join52(codexHome, "runtime", "node")),
|
|
69835
|
+
resolve15(join52(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
69836
|
+
]);
|
|
69837
|
+
if (exactManagedRoots.has(target))
|
|
69838
|
+
return null;
|
|
69839
|
+
if (isManagedBootstrapDriftPath(codexHome, target))
|
|
69840
|
+
return null;
|
|
69841
|
+
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
69842
|
+
}
|
|
69843
|
+
function isWithinDirectory(parent, child) {
|
|
69844
|
+
const relativePath = relative6(parent, child);
|
|
69845
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute8(relativePath);
|
|
69846
|
+
}
|
|
69847
|
+
function isManagedBootstrapDriftPath(codexHome, target) {
|
|
69848
|
+
const relativePath = relative6(codexHome, target);
|
|
69849
|
+
const segments = relativePath.split(/[\\/]/);
|
|
69850
|
+
if (segments[0] !== "plugins")
|
|
69851
|
+
return false;
|
|
69852
|
+
if (segments[segments.length - 1] !== "bootstrap")
|
|
69853
|
+
return false;
|
|
69854
|
+
const ownerName = segments[segments.length - 2];
|
|
69855
|
+
return ownerName !== undefined && ownerName.startsWith("omo") && ownerName.slice("omo".length).includes("sisyphuslabs");
|
|
69856
|
+
}
|
|
69857
|
+
function skipped(path7, reason) {
|
|
69858
|
+
return { path: path7, reason };
|
|
69859
|
+
}
|
|
69860
|
+
|
|
69663
69861
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
69664
69862
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
69665
69863
|
async function cleanupCodexLight(input = {}) {
|
|
69666
69864
|
const env3 = input.env ?? process.env;
|
|
69667
|
-
const codexHome =
|
|
69668
|
-
const configPath =
|
|
69865
|
+
const codexHome = resolve16(input.codexHome ?? env3.CODEX_HOME ?? join53(homedir8(), ".codex"));
|
|
69866
|
+
const configPath = join53(codexHome, "config.toml");
|
|
69669
69867
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
69670
69868
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
69671
69869
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
69672
69870
|
const removedPaths = [];
|
|
69871
|
+
const skippedPaths = [];
|
|
69673
69872
|
const managedStatePaths = new Set([
|
|
69674
69873
|
...managedGlobalStatePaths(codexHome),
|
|
69675
69874
|
...await collectBootstrapDataDirsByGlob(codexHome)
|
|
69676
69875
|
]);
|
|
69677
69876
|
for (const path7 of managedStatePaths) {
|
|
69678
|
-
if (await removeManagedPathBestEffort(path7))
|
|
69877
|
+
if (await removeManagedPathBestEffort(path7, { codexHome, onSkip: (skip) => skippedPaths.push(skip) })) {
|
|
69679
69878
|
removedPaths.push(path7);
|
|
69879
|
+
}
|
|
69680
69880
|
}
|
|
69681
69881
|
await pruneEmptyRuntimeDirBestEffort(codexHome);
|
|
69682
69882
|
const projectDirectory = input.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd();
|
|
@@ -69694,6 +69894,7 @@ async function cleanupCodexLight(input = {}) {
|
|
|
69694
69894
|
configChanged: configCleanup.changed,
|
|
69695
69895
|
configBackupPath: configCleanup.backupPath,
|
|
69696
69896
|
removedPaths,
|
|
69897
|
+
skippedPaths,
|
|
69697
69898
|
removedAgentLinks: agentCleanup.removed,
|
|
69698
69899
|
skippedAgentLinks: agentCleanup.skipped,
|
|
69699
69900
|
projectCleanup
|
|
@@ -69701,17 +69902,17 @@ async function cleanupCodexLight(input = {}) {
|
|
|
69701
69902
|
}
|
|
69702
69903
|
function managedGlobalStatePaths(codexHome) {
|
|
69703
69904
|
return [
|
|
69704
|
-
|
|
69705
|
-
|
|
69706
|
-
|
|
69707
|
-
|
|
69708
|
-
|
|
69905
|
+
join53(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
69906
|
+
join53(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
69907
|
+
join53(codexHome, "runtime", "ast-grep"),
|
|
69908
|
+
join53(codexHome, "runtime", "node"),
|
|
69909
|
+
join53(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
69709
69910
|
];
|
|
69710
69911
|
}
|
|
69711
69912
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
69712
69913
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
69713
69914
|
const results = [];
|
|
69714
|
-
await walkForManagedBootstrapDirs(
|
|
69915
|
+
await walkForManagedBootstrapDirs(join53(codexHome, "plugins"), 0, results);
|
|
69715
69916
|
return results;
|
|
69716
69917
|
}
|
|
69717
69918
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -69723,9 +69924,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
69723
69924
|
for (const entry of entries) {
|
|
69724
69925
|
if (!entry.isDirectory())
|
|
69725
69926
|
continue;
|
|
69726
|
-
const childPath =
|
|
69927
|
+
const childPath = join53(directory, entry.name);
|
|
69727
69928
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
69728
|
-
const bootstrapDir =
|
|
69929
|
+
const bootstrapDir = join53(childPath, "bootstrap");
|
|
69729
69930
|
if (await exists6(bootstrapDir))
|
|
69730
69931
|
results.push(bootstrapDir);
|
|
69731
69932
|
continue;
|
|
@@ -69736,7 +69937,12 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
69736
69937
|
function isManagedBootstrapOwnerName(name) {
|
|
69737
69938
|
return name.startsWith("omo") && name.slice("omo".length).includes("sisyphuslabs");
|
|
69738
69939
|
}
|
|
69739
|
-
async function removeManagedPathBestEffort(path7, seams
|
|
69940
|
+
async function removeManagedPathBestEffort(path7, seams) {
|
|
69941
|
+
const skip = validateManagedCleanupTarget({ codexHome: seams.codexHome, path: path7 });
|
|
69942
|
+
if (skip !== null) {
|
|
69943
|
+
seams.onSkip?.(skip);
|
|
69944
|
+
return false;
|
|
69945
|
+
}
|
|
69740
69946
|
const removedOnFirstAttempt = await attemptRemove(path7);
|
|
69741
69947
|
await seams.afterFirstAttempt?.();
|
|
69742
69948
|
const removedOnRetry = await attemptRemove(path7);
|
|
@@ -69754,19 +69960,26 @@ async function attemptRemove(path7) {
|
|
|
69754
69960
|
}
|
|
69755
69961
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
69756
69962
|
try {
|
|
69757
|
-
await rmdir(
|
|
69758
|
-
} catch {
|
|
69963
|
+
await rmdir(join53(codexHome, "runtime"));
|
|
69964
|
+
} catch (error) {
|
|
69965
|
+
if (isExpectedRuntimePruneFailure(error))
|
|
69966
|
+
return;
|
|
69967
|
+
throw error;
|
|
69968
|
+
}
|
|
69969
|
+
}
|
|
69970
|
+
function isExpectedRuntimePruneFailure(error) {
|
|
69971
|
+
return ["ENOENT", "ENOTEMPTY", "EEXIST", "EPERM", "EBUSY", "ENOTDIR"].includes(nodeErrorCode5(error) ?? "");
|
|
69759
69972
|
}
|
|
69760
69973
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
69761
69974
|
const manifestPaths = [
|
|
69762
|
-
|
|
69975
|
+
join53(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
69763
69976
|
];
|
|
69764
|
-
const versionRoot =
|
|
69977
|
+
const versionRoot = join53(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
69765
69978
|
if (await exists6(versionRoot)) {
|
|
69766
69979
|
const entries = await readdir7(versionRoot, { withFileTypes: true });
|
|
69767
69980
|
for (const entry of entries) {
|
|
69768
69981
|
if (entry.isDirectory())
|
|
69769
|
-
manifestPaths.push(
|
|
69982
|
+
manifestPaths.push(join53(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
69770
69983
|
}
|
|
69771
69984
|
}
|
|
69772
69985
|
const paths = new Set;
|
|
@@ -69784,7 +69997,7 @@ async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
|
69784
69997
|
if (!await exists6(configPath))
|
|
69785
69998
|
return [];
|
|
69786
69999
|
const config = await readFile19(configPath, "utf8");
|
|
69787
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
70000
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join53(codexHome, "agents", `${agentName}.toml`));
|
|
69788
70001
|
}
|
|
69789
70002
|
async function readInstalledAgentManifest(manifestPath) {
|
|
69790
70003
|
if (!await exists6(manifestPath))
|
|
@@ -69795,31 +70008,31 @@ async function readInstalledAgentManifest(manifestPath) {
|
|
|
69795
70008
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
69796
70009
|
}
|
|
69797
70010
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
69798
|
-
const agentsDir =
|
|
70011
|
+
const agentsDir = join53(codexHome, "agents");
|
|
69799
70012
|
const removed = [];
|
|
69800
|
-
const
|
|
70013
|
+
const skipped2 = [];
|
|
69801
70014
|
for (const path7 of paths) {
|
|
69802
70015
|
if (!isSafeManagedAgentPath(agentsDir, path7)) {
|
|
69803
|
-
|
|
70016
|
+
skipped2.push(path7);
|
|
69804
70017
|
continue;
|
|
69805
70018
|
}
|
|
69806
70019
|
const entryStat = await maybeLstat2(path7);
|
|
69807
70020
|
if (entryStat === null)
|
|
69808
70021
|
continue;
|
|
69809
70022
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
69810
|
-
|
|
70023
|
+
skipped2.push(path7);
|
|
69811
70024
|
continue;
|
|
69812
70025
|
}
|
|
69813
70026
|
await rm9(path7, { force: true });
|
|
69814
70027
|
removed.push(path7);
|
|
69815
70028
|
}
|
|
69816
|
-
return { removed, skipped };
|
|
70029
|
+
return { removed, skipped: skipped2 };
|
|
69817
70030
|
}
|
|
69818
70031
|
function isSafeManagedAgentPath(agentsDir, path7) {
|
|
69819
|
-
if (!
|
|
70032
|
+
if (!isAbsolute9(path7))
|
|
69820
70033
|
return false;
|
|
69821
|
-
const relativePath =
|
|
69822
|
-
if (relativePath === "" || relativePath.startsWith("..") ||
|
|
70034
|
+
const relativePath = relative7(agentsDir, path7);
|
|
70035
|
+
if (relativePath === "" || relativePath.startsWith("..") || isAbsolute9(relativePath))
|
|
69823
70036
|
return false;
|
|
69824
70037
|
const fileName = relativePath.split(/[\\/]/).pop();
|
|
69825
70038
|
if (fileName === undefined)
|
|
@@ -69878,23 +70091,23 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
69878
70091
|
init_provider_availability();
|
|
69879
70092
|
|
|
69880
70093
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
69881
|
-
import { existsSync as
|
|
69882
|
-
import { join as
|
|
70094
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync10, readFileSync as readFileSync16 } from "fs";
|
|
70095
|
+
import { join as join55 } from "path";
|
|
69883
70096
|
|
|
69884
70097
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
69885
70098
|
init_shared();
|
|
69886
|
-
import { existsSync as
|
|
69887
|
-
import { join as
|
|
70099
|
+
import { existsSync as existsSync32, readFileSync as readFileSync15 } from "fs";
|
|
70100
|
+
import { join as join54 } from "path";
|
|
69888
70101
|
var TUI_SUBPATH = "tui";
|
|
69889
70102
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
69890
70103
|
function fileEntryPackageJsonPath(entry) {
|
|
69891
70104
|
let path7 = entry.slice("file:".length);
|
|
69892
70105
|
if (path7.startsWith("//"))
|
|
69893
70106
|
path7 = path7.slice(2);
|
|
69894
|
-
return
|
|
70107
|
+
return join54(path7, "package.json");
|
|
69895
70108
|
}
|
|
69896
70109
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
69897
|
-
if (!
|
|
70110
|
+
if (!existsSync32(pkgJsonPath))
|
|
69898
70111
|
return null;
|
|
69899
70112
|
try {
|
|
69900
70113
|
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
@@ -69929,14 +70142,14 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
69929
70142
|
const packageName = packageNameFromServerEntry(entry);
|
|
69930
70143
|
if (packageName === null)
|
|
69931
70144
|
return null;
|
|
69932
|
-
return packageJsonExportsTui(
|
|
70145
|
+
return packageJsonExportsTui(join54(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
69933
70146
|
}
|
|
69934
70147
|
function isOurFilePluginEntry(entry) {
|
|
69935
70148
|
if (!entry.startsWith("file:"))
|
|
69936
70149
|
return false;
|
|
69937
70150
|
try {
|
|
69938
70151
|
const pkgJsonPath = fileEntryPackageJsonPath(entry);
|
|
69939
|
-
if (!
|
|
70152
|
+
if (!existsSync32(pkgJsonPath))
|
|
69940
70153
|
return false;
|
|
69941
70154
|
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
69942
70155
|
return typeof parsed.name === "string" && ACCEPTED_PACKAGE_NAMES.includes(parsed.name);
|
|
@@ -69979,7 +70192,7 @@ function isCanonicalNamedTuiPluginEntry(entry) {
|
|
|
69979
70192
|
}
|
|
69980
70193
|
function detectServerPluginRegistration() {
|
|
69981
70194
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
69982
|
-
const configPath =
|
|
70195
|
+
const configPath = existsSync32(paths.configJsonc) ? paths.configJsonc : existsSync32(paths.configJson) ? paths.configJson : null;
|
|
69983
70196
|
if (!configPath) {
|
|
69984
70197
|
return { registered: false, configPath: null, entry: null, packageExportsTui: null };
|
|
69985
70198
|
}
|
|
@@ -70002,8 +70215,8 @@ function detectServerPluginRegistration() {
|
|
|
70002
70215
|
}
|
|
70003
70216
|
}
|
|
70004
70217
|
function detectTuiPluginRegistration() {
|
|
70005
|
-
const tuiJsonPath =
|
|
70006
|
-
if (!
|
|
70218
|
+
const tuiJsonPath = join54(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
70219
|
+
if (!existsSync32(tuiJsonPath)) {
|
|
70007
70220
|
return {
|
|
70008
70221
|
registered: false,
|
|
70009
70222
|
configPath: tuiJsonPath,
|
|
@@ -70158,11 +70371,11 @@ function readConfig(path7) {
|
|
|
70158
70371
|
return null;
|
|
70159
70372
|
}
|
|
70160
70373
|
function readServerConfig(configDir) {
|
|
70161
|
-
const jsoncPath =
|
|
70162
|
-
if (
|
|
70374
|
+
const jsoncPath = join55(configDir, "opencode.jsonc");
|
|
70375
|
+
if (existsSync33(jsoncPath))
|
|
70163
70376
|
return readConfig(jsoncPath);
|
|
70164
|
-
const jsonPath =
|
|
70165
|
-
if (
|
|
70377
|
+
const jsonPath = join55(configDir, "opencode.json");
|
|
70378
|
+
if (existsSync33(jsonPath))
|
|
70166
70379
|
return readConfig(jsonPath);
|
|
70167
70380
|
return null;
|
|
70168
70381
|
}
|
|
@@ -70182,7 +70395,7 @@ function desiredTuiEntry(serverEntry) {
|
|
|
70182
70395
|
return null;
|
|
70183
70396
|
}
|
|
70184
70397
|
function readTuiConfig(tuiJsonPath) {
|
|
70185
|
-
if (!
|
|
70398
|
+
if (!existsSync33(tuiJsonPath)) {
|
|
70186
70399
|
return { config: {}, malformed: false };
|
|
70187
70400
|
}
|
|
70188
70401
|
const config = readConfig(tuiJsonPath);
|
|
@@ -70203,7 +70416,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70203
70416
|
if (!desiredEntry) {
|
|
70204
70417
|
return { changed: false, reason: "no-server-entry" };
|
|
70205
70418
|
}
|
|
70206
|
-
const tuiJsonPath =
|
|
70419
|
+
const tuiJsonPath = join55(configDir, "tui.json");
|
|
70207
70420
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
70208
70421
|
if (malformed) {
|
|
70209
70422
|
return { changed: false, reason: "malformed" };
|
|
@@ -70219,7 +70432,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70219
70432
|
|
|
70220
70433
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
70221
70434
|
import { homedir as homedir9 } from "os";
|
|
70222
|
-
import { join as
|
|
70435
|
+
import { join as join56 } from "path";
|
|
70223
70436
|
|
|
70224
70437
|
// packages/shared-skills/index.mjs
|
|
70225
70438
|
import { fileURLToPath } from "url";
|
|
@@ -70238,9 +70451,9 @@ function describeResult2(result) {
|
|
|
70238
70451
|
}
|
|
70239
70452
|
async function installAstGrepForOpenCode(options = {}) {
|
|
70240
70453
|
const platform = options.platform ?? process.platform;
|
|
70241
|
-
const baseDir =
|
|
70454
|
+
const baseDir = join56(options.homeDir ?? homedir9(), ".omo");
|
|
70242
70455
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
70243
|
-
const skillDir =
|
|
70456
|
+
const skillDir = join56(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
70244
70457
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
70245
70458
|
try {
|
|
70246
70459
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -72119,6 +72332,9 @@ async function cleanup(options) {
|
|
|
72119
72332
|
for (const path7 of result.removedPaths) {
|
|
72120
72333
|
console.log(`- Removed ${path7}`);
|
|
72121
72334
|
}
|
|
72335
|
+
for (const skippedPath of result.skippedPaths) {
|
|
72336
|
+
console.log(`- Skipped cleanup target ${skippedPath.path}: ${skippedPath.reason}`);
|
|
72337
|
+
}
|
|
72122
72338
|
for (const path7 of result.removedAgentLinks) {
|
|
72123
72339
|
console.log(`- Removed managed agent link ${path7}`);
|
|
72124
72340
|
}
|
|
@@ -87382,6 +87598,7 @@ var ClaudeCodeConfigSchema = exports_external.object({
|
|
|
87382
87598
|
});
|
|
87383
87599
|
// packages/omo-opencode/src/config/schema/codegraph.ts
|
|
87384
87600
|
var CodegraphConfigSchema = exports_external.object({
|
|
87601
|
+
auto_init: exports_external.boolean().default(true),
|
|
87385
87602
|
auto_provision: exports_external.boolean().default(true),
|
|
87386
87603
|
enabled: exports_external.boolean().default(true),
|
|
87387
87604
|
install_dir: exports_external.string().optional(),
|
|
@@ -87621,7 +87838,8 @@ var RuntimeFallbackConfigSchema = exports_external.object({
|
|
|
87621
87838
|
max_fallback_attempts: exports_external.number().min(1).max(20).optional(),
|
|
87622
87839
|
cooldown_seconds: exports_external.number().min(0).optional(),
|
|
87623
87840
|
timeout_seconds: exports_external.number().min(0).optional(),
|
|
87624
|
-
notify_on_fallback: exports_external.boolean().optional()
|
|
87841
|
+
notify_on_fallback: exports_external.boolean().optional(),
|
|
87842
|
+
restore_primary_after_cooldown: exports_external.boolean().optional()
|
|
87625
87843
|
});
|
|
87626
87844
|
|
|
87627
87845
|
// packages/team-core/src/config.ts
|
|
@@ -88183,7 +88401,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
88183
88401
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
88184
88402
|
init_bun_which_shim();
|
|
88185
88403
|
init_spawn_with_windows_hide();
|
|
88186
|
-
import { delimiter as delimiter2, dirname as
|
|
88404
|
+
import { delimiter as delimiter2, dirname as dirname20, posix as posix4, win32 as win324 } from "path";
|
|
88187
88405
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
88188
88406
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
88189
88407
|
function getCommandCandidates(platform) {
|
|
@@ -88241,7 +88459,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
88241
88459
|
return null;
|
|
88242
88460
|
}
|
|
88243
88461
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
88244
|
-
const preferredDir =
|
|
88462
|
+
const preferredDir = dirname20(binaryPath);
|
|
88245
88463
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
88246
88464
|
return [preferredDir, ...existing].join(delimiter2);
|
|
88247
88465
|
}
|
|
@@ -88409,7 +88627,7 @@ async function resolveSession(options) {
|
|
|
88409
88627
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
88410
88628
|
const delay2 = SESSION_CREATE_RETRY_DELAY_MS * attempt;
|
|
88411
88629
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
88412
|
-
await new Promise((
|
|
88630
|
+
await new Promise((resolve17) => setTimeout(resolve17, delay2));
|
|
88413
88631
|
}
|
|
88414
88632
|
continue;
|
|
88415
88633
|
}
|
|
@@ -88420,7 +88638,7 @@ async function resolveSession(options) {
|
|
|
88420
88638
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
88421
88639
|
const delay2 = SESSION_CREATE_RETRY_DELAY_MS * attempt;
|
|
88422
88640
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
88423
|
-
await new Promise((
|
|
88641
|
+
await new Promise((resolve17) => setTimeout(resolve17, delay2));
|
|
88424
88642
|
}
|
|
88425
88643
|
}
|
|
88426
88644
|
throw new Error("Failed to create session after all retries");
|
|
@@ -88633,7 +88851,7 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
88633
88851
|
var NOTEPAD_DIR = "notepads";
|
|
88634
88852
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
88635
88853
|
// packages/boulder-state/src/top-level-task.ts
|
|
88636
|
-
import { existsSync as
|
|
88854
|
+
import { existsSync as existsSync36, readFileSync as readFileSync18 } from "fs";
|
|
88637
88855
|
var TODO_HEADING_PATTERN = /^##\s+TODOs\b/i;
|
|
88638
88856
|
var FINAL_VERIFICATION_HEADING_PATTERN = /^##\s+Final Verification Wave\b/i;
|
|
88639
88857
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -88656,7 +88874,7 @@ function buildTaskRef(section, taskLabel) {
|
|
|
88656
88874
|
};
|
|
88657
88875
|
}
|
|
88658
88876
|
function readCurrentTopLevelTask(planPath) {
|
|
88659
|
-
if (!
|
|
88877
|
+
if (!existsSync36(planPath)) {
|
|
88660
88878
|
return null;
|
|
88661
88879
|
}
|
|
88662
88880
|
try {
|
|
@@ -88685,13 +88903,13 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
88685
88903
|
}
|
|
88686
88904
|
}
|
|
88687
88905
|
// packages/boulder-state/src/storage/path.ts
|
|
88688
|
-
import { existsSync as
|
|
88689
|
-
import { isAbsolute as
|
|
88906
|
+
import { existsSync as existsSync37 } from "fs";
|
|
88907
|
+
import { isAbsolute as isAbsolute10, join as join58, relative as relative8, resolve as resolve17 } from "path";
|
|
88690
88908
|
function getBoulderFilePath(directory) {
|
|
88691
|
-
return
|
|
88909
|
+
return join58(directory, BOULDER_DIR, BOULDER_FILE);
|
|
88692
88910
|
}
|
|
88693
88911
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
88694
|
-
return
|
|
88912
|
+
return isAbsolute10(trackedPath) ? resolve17(trackedPath) : resolve17(baseDirectory, trackedPath);
|
|
88695
88913
|
}
|
|
88696
88914
|
function resolveBoulderPlanPath(directory, state) {
|
|
88697
88915
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -88699,20 +88917,20 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
88699
88917
|
if (!worktreePath) {
|
|
88700
88918
|
return absolutePlanPath;
|
|
88701
88919
|
}
|
|
88702
|
-
const absoluteDirectory =
|
|
88703
|
-
const relativePlanPath =
|
|
88704
|
-
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") ||
|
|
88920
|
+
const absoluteDirectory = resolve17(directory);
|
|
88921
|
+
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
88922
|
+
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute10(relativePlanPath)) {
|
|
88705
88923
|
return absolutePlanPath;
|
|
88706
88924
|
}
|
|
88707
88925
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
88708
|
-
const worktreePlanPath =
|
|
88709
|
-
return
|
|
88926
|
+
const worktreePlanPath = resolve17(absoluteWorktreePath, relativePlanPath);
|
|
88927
|
+
return existsSync37(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
88710
88928
|
}
|
|
88711
88929
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
88712
88930
|
return resolveBoulderPlanPath(directory, work);
|
|
88713
88931
|
}
|
|
88714
88932
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
88715
|
-
import { existsSync as
|
|
88933
|
+
import { existsSync as existsSync38, readFileSync as readFileSync19, readdirSync as readdirSync5, statSync as statSync5 } from "fs";
|
|
88716
88934
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
88717
88935
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
88718
88936
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -88721,7 +88939,7 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
|
|
|
88721
88939
|
var TODO_TASK_PATTERN2 = /^\d+\.\s+/;
|
|
88722
88940
|
var FINAL_WAVE_TASK_PATTERN2 = /^F\d+\.\s+/i;
|
|
88723
88941
|
function getPlanProgress(planPath) {
|
|
88724
|
-
if (!
|
|
88942
|
+
if (!existsSync38(planPath)) {
|
|
88725
88943
|
return { total: 0, completed: 0, isComplete: false };
|
|
88726
88944
|
}
|
|
88727
88945
|
try {
|
|
@@ -88841,10 +89059,10 @@ function selectMirrorWork(state) {
|
|
|
88841
89059
|
return sorted[0] ?? null;
|
|
88842
89060
|
}
|
|
88843
89061
|
// packages/boulder-state/src/storage/read-state.ts
|
|
88844
|
-
import { existsSync as
|
|
89062
|
+
import { existsSync as existsSync39, readFileSync as readFileSync20 } from "fs";
|
|
88845
89063
|
function readBoulderState(directory) {
|
|
88846
89064
|
const filePath = getBoulderFilePath(directory);
|
|
88847
|
-
if (!
|
|
89065
|
+
if (!existsSync39(filePath)) {
|
|
88848
89066
|
return null;
|
|
88849
89067
|
}
|
|
88850
89068
|
try {
|
|
@@ -88916,14 +89134,14 @@ init_state();
|
|
|
88916
89134
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
88917
89135
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
88918
89136
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
88919
|
-
import { existsSync as
|
|
88920
|
-
import { join as
|
|
89137
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync11, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
89138
|
+
import { join as join59 } from "path";
|
|
88921
89139
|
function getMarkerPath(directory, sessionID) {
|
|
88922
|
-
return
|
|
89140
|
+
return join59(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
88923
89141
|
}
|
|
88924
89142
|
function readContinuationMarker(directory, sessionID) {
|
|
88925
89143
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
88926
|
-
if (!
|
|
89144
|
+
if (!existsSync40(markerPath))
|
|
88927
89145
|
return null;
|
|
88928
89146
|
try {
|
|
88929
89147
|
const raw = readFileSync21(markerPath, "utf-8");
|
|
@@ -88992,7 +89210,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
88992
89210
|
init_shared();
|
|
88993
89211
|
init_compaction_marker();
|
|
88994
89212
|
import { readFileSync as readFileSync22, readdirSync as readdirSync6 } from "fs";
|
|
88995
|
-
import { join as
|
|
89213
|
+
import { join as join60 } from "path";
|
|
88996
89214
|
var defaultSessionLastAgentDeps = {
|
|
88997
89215
|
getMessageDir,
|
|
88998
89216
|
isSqliteBackend,
|
|
@@ -89052,7 +89270,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
89052
89270
|
try {
|
|
89053
89271
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
89054
89272
|
try {
|
|
89055
|
-
const content = readFileSync22(
|
|
89273
|
+
const content = readFileSync22(join60(messageDir, fileName), "utf-8");
|
|
89056
89274
|
const parsed = JSON.parse(content);
|
|
89057
89275
|
return {
|
|
89058
89276
|
fileName,
|
|
@@ -89095,8 +89313,8 @@ init_agent_display_names();
|
|
|
89095
89313
|
|
|
89096
89314
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
89097
89315
|
init_frontmatter2();
|
|
89098
|
-
import { existsSync as
|
|
89099
|
-
import { dirname as
|
|
89316
|
+
import { existsSync as existsSync41, readFileSync as readFileSync23, writeFileSync as writeFileSync7, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "fs";
|
|
89317
|
+
import { dirname as dirname21, join as join61 } from "path";
|
|
89100
89318
|
|
|
89101
89319
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
89102
89320
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -89105,11 +89323,11 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
89105
89323
|
|
|
89106
89324
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
89107
89325
|
function getStateFilePath(directory, customPath) {
|
|
89108
|
-
return customPath ?
|
|
89326
|
+
return customPath ? join61(directory, customPath) : join61(directory, DEFAULT_STATE_FILE);
|
|
89109
89327
|
}
|
|
89110
89328
|
function readState(directory, customPath) {
|
|
89111
89329
|
const filePath = getStateFilePath(directory, customPath);
|
|
89112
|
-
if (!
|
|
89330
|
+
if (!existsSync41(filePath)) {
|
|
89113
89331
|
return null;
|
|
89114
89332
|
}
|
|
89115
89333
|
try {
|
|
@@ -89344,7 +89562,7 @@ async function pollForCompletion(ctx, eventState, abortController, options = {})
|
|
|
89344
89562
|
let secondaryTimeoutChecked = false;
|
|
89345
89563
|
const pollStartTimestamp = Date.now();
|
|
89346
89564
|
while (!abortController.signal.aborted) {
|
|
89347
|
-
await new Promise((
|
|
89565
|
+
await new Promise((resolve18) => setTimeout(resolve18, pollIntervalMs));
|
|
89348
89566
|
if (abortController.signal.aborted) {
|
|
89349
89567
|
return 130;
|
|
89350
89568
|
}
|
|
@@ -89502,7 +89720,7 @@ function createAbortError() {
|
|
|
89502
89720
|
return error51;
|
|
89503
89721
|
}
|
|
89504
89722
|
function sleep(delayMs) {
|
|
89505
|
-
return new Promise((
|
|
89723
|
+
return new Promise((resolve18) => setTimeout(resolve18, delayMs));
|
|
89506
89724
|
}
|
|
89507
89725
|
function hasPromptStartEvidence(eventState) {
|
|
89508
89726
|
return eventState.mainSessionStarted || eventState.hasReceivedMeaningfulWork || eventState.messageCount > 0 || eventState.currentTool !== null;
|
|
@@ -89723,7 +89941,7 @@ function getPostHogActivityCaptureState2(now = new Date) {
|
|
|
89723
89941
|
// packages/omo-opencode/src/shared/posthog.ts
|
|
89724
89942
|
var activityStateProviderOverride2 = null;
|
|
89725
89943
|
var osProviderOverride3 = null;
|
|
89726
|
-
var
|
|
89944
|
+
var transportFactoryOverride2 = null;
|
|
89727
89945
|
function resolveActivityState() {
|
|
89728
89946
|
return (activityStateProviderOverride2 ?? getPostHogActivityCaptureState2)();
|
|
89729
89947
|
}
|
|
@@ -89731,7 +89949,7 @@ function resolveOsProvider2() {
|
|
|
89731
89949
|
return osProviderOverride3 ?? os5;
|
|
89732
89950
|
}
|
|
89733
89951
|
function resolveTransportFactory() {
|
|
89734
|
-
return
|
|
89952
|
+
return transportFactoryOverride2 ?? createDefaultPostHogTransport;
|
|
89735
89953
|
}
|
|
89736
89954
|
var NO_OP_POSTHOG2 = {
|
|
89737
89955
|
trackActive: () => {
|
|
@@ -89908,7 +90126,7 @@ var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
|
|
|
89908
90126
|
async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
|
|
89909
90127
|
const completed = await Promise.race([
|
|
89910
90128
|
eventProcessor.then(() => true),
|
|
89911
|
-
new Promise((
|
|
90129
|
+
new Promise((resolve18) => setTimeout(() => resolve18(false), timeoutMs))
|
|
89912
90130
|
]);
|
|
89913
90131
|
}
|
|
89914
90132
|
async function run(options) {
|
|
@@ -90211,14 +90429,14 @@ async function getLocalVersion(options = {}) {
|
|
|
90211
90429
|
}
|
|
90212
90430
|
}
|
|
90213
90431
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
90214
|
-
import { existsSync as
|
|
90432
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
|
|
90215
90433
|
|
|
90216
90434
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
90217
90435
|
init_extract_semver();
|
|
90218
90436
|
init_bun_which_shim();
|
|
90219
|
-
import { existsSync as
|
|
90437
|
+
import { existsSync as existsSync49, accessSync as accessSync4, constants as constants9 } from "fs";
|
|
90220
90438
|
import { homedir as homedir13 } from "os";
|
|
90221
|
-
import { join as
|
|
90439
|
+
import { join as join68 } from "path";
|
|
90222
90440
|
|
|
90223
90441
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
90224
90442
|
init_spawn_with_windows_hide();
|
|
@@ -90257,8 +90475,8 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
|
|
|
90257
90475
|
const stdoutPromise = readSpawnStream(proc.stdout);
|
|
90258
90476
|
const stderrPromise = readSpawnStream(proc.stderr);
|
|
90259
90477
|
let timer;
|
|
90260
|
-
const timeoutPromise = new Promise((
|
|
90261
|
-
timer = setTimeout(() =>
|
|
90478
|
+
const timeoutPromise = new Promise((resolve18) => {
|
|
90479
|
+
timer = setTimeout(() => resolve18("timeout"), timeoutMs);
|
|
90262
90480
|
});
|
|
90263
90481
|
const processPromise = (async () => {
|
|
90264
90482
|
await proc.exited;
|
|
@@ -90310,17 +90528,17 @@ function getDesktopAppPaths(platform) {
|
|
|
90310
90528
|
case "darwin":
|
|
90311
90529
|
return [
|
|
90312
90530
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
90313
|
-
|
|
90531
|
+
join68(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
90314
90532
|
];
|
|
90315
90533
|
case "win32": {
|
|
90316
90534
|
const programFiles = process.env.ProgramFiles;
|
|
90317
90535
|
const localAppData = process.env.LOCALAPPDATA;
|
|
90318
90536
|
const paths = [];
|
|
90319
90537
|
if (programFiles) {
|
|
90320
|
-
paths.push(
|
|
90538
|
+
paths.push(join68(programFiles, "OpenCode", "OpenCode.exe"));
|
|
90321
90539
|
}
|
|
90322
90540
|
if (localAppData) {
|
|
90323
|
-
paths.push(
|
|
90541
|
+
paths.push(join68(localAppData, "OpenCode", "OpenCode.exe"));
|
|
90324
90542
|
}
|
|
90325
90543
|
return paths;
|
|
90326
90544
|
}
|
|
@@ -90328,8 +90546,8 @@ function getDesktopAppPaths(platform) {
|
|
|
90328
90546
|
return [
|
|
90329
90547
|
"/usr/bin/opencode",
|
|
90330
90548
|
"/usr/lib/opencode/opencode",
|
|
90331
|
-
|
|
90332
|
-
|
|
90549
|
+
join68(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
90550
|
+
join68(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
90333
90551
|
];
|
|
90334
90552
|
default:
|
|
90335
90553
|
return [];
|
|
@@ -90341,7 +90559,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
90341
90559
|
}
|
|
90342
90560
|
return [binaryPath, "--version"];
|
|
90343
90561
|
}
|
|
90344
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
90562
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync49) {
|
|
90345
90563
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
90346
90564
|
if (checkExists(desktopPath)) {
|
|
90347
90565
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -90349,7 +90567,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
90349
90567
|
}
|
|
90350
90568
|
return null;
|
|
90351
90569
|
}
|
|
90352
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
90570
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync49) {
|
|
90353
90571
|
for (const binary of OPENCODE_BINARIES2) {
|
|
90354
90572
|
const path14 = bunWhich(binary);
|
|
90355
90573
|
if (path14 && checkExists(path14)) {
|
|
@@ -90361,7 +90579,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
90361
90579
|
const candidates = getCommandCandidates2(platform);
|
|
90362
90580
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
90363
90581
|
for (const command of candidates) {
|
|
90364
|
-
const fullPath =
|
|
90582
|
+
const fullPath = join68(entry, command);
|
|
90365
90583
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
90366
90584
|
return { binary: command, path: fullPath };
|
|
90367
90585
|
}
|
|
@@ -90407,12 +90625,12 @@ function compareVersions3(current, minimum) {
|
|
|
90407
90625
|
|
|
90408
90626
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
90409
90627
|
init_shared();
|
|
90410
|
-
import { existsSync as
|
|
90628
|
+
import { existsSync as existsSync50, readFileSync as readFileSync31 } from "fs";
|
|
90411
90629
|
function detectConfigPath() {
|
|
90412
90630
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
90413
|
-
if (
|
|
90631
|
+
if (existsSync50(paths.configJsonc))
|
|
90414
90632
|
return paths.configJsonc;
|
|
90415
|
-
if (
|
|
90633
|
+
if (existsSync50(paths.configJson))
|
|
90416
90634
|
return paths.configJson;
|
|
90417
90635
|
return null;
|
|
90418
90636
|
}
|
|
@@ -90500,36 +90718,36 @@ init_file_utils2();
|
|
|
90500
90718
|
init_checker();
|
|
90501
90719
|
init_auto_update_checker();
|
|
90502
90720
|
init_package_json_locator();
|
|
90503
|
-
import { existsSync as
|
|
90721
|
+
import { existsSync as existsSync51, readFileSync as readFileSync32, readdirSync as readdirSync8 } from "fs";
|
|
90504
90722
|
import { createRequire as createRequire2 } from "module";
|
|
90505
90723
|
import { homedir as homedir14 } from "os";
|
|
90506
|
-
import { join as
|
|
90724
|
+
import { join as join69 } from "path";
|
|
90507
90725
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
90508
90726
|
init_shared();
|
|
90509
90727
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
90510
90728
|
if (platform === "darwin")
|
|
90511
|
-
return
|
|
90729
|
+
return join69(homedir14(), "Library", "Caches");
|
|
90512
90730
|
if (platform === "win32")
|
|
90513
|
-
return process.env.LOCALAPPDATA ??
|
|
90514
|
-
return
|
|
90731
|
+
return process.env.LOCALAPPDATA ?? join69(homedir14(), "AppData", "Local");
|
|
90732
|
+
return join69(homedir14(), ".cache");
|
|
90515
90733
|
}
|
|
90516
90734
|
function resolveOpenCodeCacheDir() {
|
|
90517
90735
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
90518
90736
|
if (xdgCacheHome)
|
|
90519
|
-
return
|
|
90737
|
+
return join69(xdgCacheHome, "opencode");
|
|
90520
90738
|
const fromShared = getOpenCodeCacheDir();
|
|
90521
|
-
const platformDefault =
|
|
90522
|
-
if (
|
|
90739
|
+
const platformDefault = join69(getPlatformDefaultCacheDir(), "opencode");
|
|
90740
|
+
if (existsSync51(fromShared) || !existsSync51(platformDefault))
|
|
90523
90741
|
return fromShared;
|
|
90524
90742
|
return platformDefault;
|
|
90525
90743
|
}
|
|
90526
90744
|
function resolveExistingDir(dirPath) {
|
|
90527
|
-
if (!
|
|
90745
|
+
if (!existsSync51(dirPath))
|
|
90528
90746
|
return dirPath;
|
|
90529
90747
|
return resolveSymlink(dirPath);
|
|
90530
90748
|
}
|
|
90531
90749
|
function readPackageJson(filePath) {
|
|
90532
|
-
if (!
|
|
90750
|
+
if (!existsSync51(filePath))
|
|
90533
90751
|
return null;
|
|
90534
90752
|
try {
|
|
90535
90753
|
const content = readFileSync32(filePath, "utf-8");
|
|
@@ -90550,26 +90768,26 @@ function normalizeVersion(value) {
|
|
|
90550
90768
|
function createPackageCandidates(rootDir) {
|
|
90551
90769
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
90552
90770
|
packageName,
|
|
90553
|
-
installedPackagePath:
|
|
90771
|
+
installedPackagePath: join69(rootDir, "node_modules", packageName, "package.json")
|
|
90554
90772
|
}));
|
|
90555
90773
|
}
|
|
90556
90774
|
function createTaggedInstallCandidates(rootDir) {
|
|
90557
|
-
const packagesDir =
|
|
90558
|
-
if (!
|
|
90775
|
+
const packagesDir = join69(rootDir, "packages");
|
|
90776
|
+
if (!existsSync51(packagesDir))
|
|
90559
90777
|
return [];
|
|
90560
90778
|
const candidates = [];
|
|
90561
90779
|
for (const entryName of readdirSync8(packagesDir).sort()) {
|
|
90562
90780
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
90563
90781
|
if (packageName === undefined)
|
|
90564
90782
|
continue;
|
|
90565
|
-
const installDir =
|
|
90783
|
+
const installDir = join69(packagesDir, entryName);
|
|
90566
90784
|
candidates.push({
|
|
90567
90785
|
cacheDir: installDir,
|
|
90568
|
-
cachePackagePath:
|
|
90786
|
+
cachePackagePath: join69(installDir, "package.json"),
|
|
90569
90787
|
packageCandidates: [
|
|
90570
90788
|
{
|
|
90571
90789
|
packageName,
|
|
90572
|
-
installedPackagePath:
|
|
90790
|
+
installedPackagePath: join69(installDir, "node_modules", packageName, "package.json")
|
|
90573
90791
|
}
|
|
90574
90792
|
]
|
|
90575
90793
|
});
|
|
@@ -90577,7 +90795,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
90577
90795
|
return candidates;
|
|
90578
90796
|
}
|
|
90579
90797
|
function selectInstalledPackage(candidate) {
|
|
90580
|
-
return candidate.packageCandidates.find((packageCandidate) =>
|
|
90798
|
+
return candidate.packageCandidates.find((packageCandidate) => existsSync51(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
|
|
90581
90799
|
}
|
|
90582
90800
|
function getExpectedVersion(cachePackage, packageName) {
|
|
90583
90801
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -90588,7 +90806,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
90588
90806
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
90589
90807
|
try {
|
|
90590
90808
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
90591
|
-
if (
|
|
90809
|
+
if (existsSync51(packageJsonPath)) {
|
|
90592
90810
|
return { packageName, packageJsonPath };
|
|
90593
90811
|
}
|
|
90594
90812
|
} catch {
|
|
@@ -90614,22 +90832,22 @@ function getLoadedPluginVersion() {
|
|
|
90614
90832
|
const candidates = [
|
|
90615
90833
|
{
|
|
90616
90834
|
cacheDir: configDir,
|
|
90617
|
-
cachePackagePath:
|
|
90835
|
+
cachePackagePath: join69(configDir, "package.json"),
|
|
90618
90836
|
packageCandidates: createPackageCandidates(configDir)
|
|
90619
90837
|
},
|
|
90620
90838
|
...createTaggedInstallCandidates(configDir),
|
|
90621
90839
|
{
|
|
90622
90840
|
cacheDir,
|
|
90623
|
-
cachePackagePath:
|
|
90841
|
+
cachePackagePath: join69(cacheDir, "package.json"),
|
|
90624
90842
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
90625
90843
|
},
|
|
90626
90844
|
...createTaggedInstallCandidates(cacheDir)
|
|
90627
90845
|
];
|
|
90628
|
-
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) =>
|
|
90846
|
+
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync51(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
90629
90847
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
90630
90848
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
90631
90849
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
90632
|
-
const candidateExists =
|
|
90850
|
+
const candidateExists = existsSync51(candidateInstalledPath);
|
|
90633
90851
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
90634
90852
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
90635
90853
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -90665,7 +90883,7 @@ var defaultDeps6 = {
|
|
|
90665
90883
|
getLoadedPluginVersion,
|
|
90666
90884
|
getLatestPluginVersion,
|
|
90667
90885
|
getSuggestedInstallTag,
|
|
90668
|
-
configExists:
|
|
90886
|
+
configExists: existsSync52,
|
|
90669
90887
|
readConfigFile: (path14) => readFileSync33(path14, "utf-8"),
|
|
90670
90888
|
parseConfigContent: (content) => parseJsonc(content)
|
|
90671
90889
|
};
|
|
@@ -90809,7 +91027,7 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
90809
91027
|
init_src();
|
|
90810
91028
|
import { readFileSync as readFileSync34 } from "fs";
|
|
90811
91029
|
import { homedir as homedir15 } from "os";
|
|
90812
|
-
import { dirname as
|
|
91030
|
+
import { dirname as dirname26, relative as relative9 } from "path";
|
|
90813
91031
|
init_shared();
|
|
90814
91032
|
init_plugin_identity();
|
|
90815
91033
|
function resolveHomeDirectory2() {
|
|
@@ -90833,11 +91051,11 @@ function discoverProjectLayersNearestFirst(directory) {
|
|
|
90833
91051
|
const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
|
|
90834
91052
|
return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
|
|
90835
91053
|
path: configPath,
|
|
90836
|
-
configDir:
|
|
91054
|
+
configDir: dirname26(configPath)
|
|
90837
91055
|
}));
|
|
90838
91056
|
}
|
|
90839
91057
|
function shortPath(configPath) {
|
|
90840
|
-
const candidate =
|
|
91058
|
+
const candidate = relative9(process.cwd(), configPath);
|
|
90841
91059
|
return candidate.length > 0 ? candidate : configPath;
|
|
90842
91060
|
}
|
|
90843
91061
|
function formatIssuePath(path14) {
|
|
@@ -90857,7 +91075,7 @@ function parseLayerConfig(configPath) {
|
|
|
90857
91075
|
if (!isPlainRecord(rawConfig)) {
|
|
90858
91076
|
return {
|
|
90859
91077
|
path: configPath,
|
|
90860
|
-
configDir:
|
|
91078
|
+
configDir: dirname26(configPath),
|
|
90861
91079
|
config: null,
|
|
90862
91080
|
messages: [`${shortPath(configPath)}: <root>: Expected object`]
|
|
90863
91081
|
};
|
|
@@ -90865,7 +91083,7 @@ function parseLayerConfig(configPath) {
|
|
|
90865
91083
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
90866
91084
|
return {
|
|
90867
91085
|
path: configPath,
|
|
90868
|
-
configDir:
|
|
91086
|
+
configDir: dirname26(configPath),
|
|
90869
91087
|
config: result.success ? result.data : parseConfigPartially(rawConfig),
|
|
90870
91088
|
messages: schemaMessages(configPath, rawConfig)
|
|
90871
91089
|
};
|
|
@@ -90875,7 +91093,7 @@ function parseLayerConfig(configPath) {
|
|
|
90875
91093
|
}
|
|
90876
91094
|
return {
|
|
90877
91095
|
path: configPath,
|
|
90878
|
-
configDir:
|
|
91096
|
+
configDir: dirname26(configPath),
|
|
90879
91097
|
config: null,
|
|
90880
91098
|
messages: [`${shortPath(configPath)}: ${error51.message}`]
|
|
90881
91099
|
};
|
|
@@ -90921,23 +91139,23 @@ function validatePluginConfig(directory) {
|
|
|
90921
91139
|
|
|
90922
91140
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
90923
91141
|
init_shared();
|
|
90924
|
-
import { existsSync as
|
|
91142
|
+
import { existsSync as existsSync53, readFileSync as readFileSync35 } from "fs";
|
|
90925
91143
|
import { homedir as homedir16 } from "os";
|
|
90926
|
-
import { join as
|
|
91144
|
+
import { join as join70 } from "path";
|
|
90927
91145
|
function getUserConfigDir2() {
|
|
90928
91146
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
90929
91147
|
if (xdgConfig)
|
|
90930
|
-
return
|
|
90931
|
-
return
|
|
91148
|
+
return join70(xdgConfig, "opencode");
|
|
91149
|
+
return join70(homedir16(), ".config", "opencode");
|
|
90932
91150
|
}
|
|
90933
91151
|
function loadCustomProviderNames() {
|
|
90934
91152
|
const configDir = getUserConfigDir2();
|
|
90935
91153
|
const candidatePaths = [
|
|
90936
|
-
|
|
90937
|
-
|
|
91154
|
+
join70(configDir, "opencode.json"),
|
|
91155
|
+
join70(configDir, "opencode.jsonc")
|
|
90938
91156
|
];
|
|
90939
91157
|
for (const configPath of candidatePaths) {
|
|
90940
|
-
if (!
|
|
91158
|
+
if (!existsSync53(configPath))
|
|
90941
91159
|
continue;
|
|
90942
91160
|
try {
|
|
90943
91161
|
const content = readFileSync35(configPath, "utf-8");
|
|
@@ -90955,9 +91173,9 @@ function loadCustomProviderNames() {
|
|
|
90955
91173
|
return [];
|
|
90956
91174
|
}
|
|
90957
91175
|
function loadAvailableModelsFromCache() {
|
|
90958
|
-
const cacheFile =
|
|
91176
|
+
const cacheFile = join70(getOpenCodeCacheDir(), "models.json");
|
|
90959
91177
|
const customProviders = loadCustomProviderNames();
|
|
90960
|
-
if (!
|
|
91178
|
+
if (!existsSync53(cacheFile)) {
|
|
90961
91179
|
if (customProviders.length > 0) {
|
|
90962
91180
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
90963
91181
|
}
|
|
@@ -90992,8 +91210,8 @@ init_model_capabilities2();
|
|
|
90992
91210
|
init_shared();
|
|
90993
91211
|
init_plugin_identity();
|
|
90994
91212
|
import { readFileSync as readFileSync36 } from "fs";
|
|
90995
|
-
import { join as
|
|
90996
|
-
var PROJECT_CONFIG_DIR =
|
|
91213
|
+
import { join as join71 } from "path";
|
|
91214
|
+
var PROJECT_CONFIG_DIR = join71(process.cwd(), ".opencode");
|
|
90997
91215
|
function loadOmoConfig() {
|
|
90998
91216
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
90999
91217
|
basenames: [CONFIG_BASENAME],
|
|
@@ -91031,7 +91249,7 @@ function loadOmoConfig() {
|
|
|
91031
91249
|
|
|
91032
91250
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
91033
91251
|
init_shared();
|
|
91034
|
-
import { join as
|
|
91252
|
+
import { join as join72 } from "path";
|
|
91035
91253
|
|
|
91036
91254
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
91037
91255
|
function formatModelWithVariant(model, variant) {
|
|
@@ -91073,7 +91291,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
91073
91291
|
}
|
|
91074
91292
|
function buildModelResolutionDetails(options) {
|
|
91075
91293
|
const details = [];
|
|
91076
|
-
const cacheFile =
|
|
91294
|
+
const cacheFile = join72(getOpenCodeCacheDir(), "models.json");
|
|
91077
91295
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
91078
91296
|
details.push("");
|
|
91079
91297
|
if (options.available.cacheExists) {
|
|
@@ -91349,28 +91567,28 @@ async function checkConfig() {
|
|
|
91349
91567
|
|
|
91350
91568
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
91351
91569
|
init_src();
|
|
91352
|
-
import { existsSync as
|
|
91570
|
+
import { existsSync as existsSync54 } from "fs";
|
|
91353
91571
|
import { createRequire as createRequire3 } from "module";
|
|
91354
91572
|
import { homedir as homedir18 } from "os";
|
|
91355
|
-
import { dirname as
|
|
91573
|
+
import { dirname as dirname27, join as join74 } from "path";
|
|
91356
91574
|
|
|
91357
91575
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
91358
|
-
import { join as
|
|
91576
|
+
import { join as join73 } from "path";
|
|
91359
91577
|
import { homedir as homedir17, tmpdir as tmpdir3 } from "os";
|
|
91360
91578
|
init_binary_downloader();
|
|
91361
91579
|
init_logger2();
|
|
91362
91580
|
init_plugin_identity();
|
|
91363
91581
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
91364
|
-
var DEBUG_FILE =
|
|
91582
|
+
var DEBUG_FILE = join73(tmpdir3(), "comment-checker-debug.log");
|
|
91365
91583
|
function getCacheDir2() {
|
|
91366
91584
|
if (process.platform === "win32") {
|
|
91367
91585
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
91368
|
-
const base2 = localAppData ||
|
|
91369
|
-
return
|
|
91586
|
+
const base2 = localAppData || join73(homedir17(), "AppData", "Local");
|
|
91587
|
+
return join73(base2, CACHE_DIR_NAME, "bin");
|
|
91370
91588
|
}
|
|
91371
91589
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
91372
|
-
const base = xdgCache ||
|
|
91373
|
-
return
|
|
91590
|
+
const base = xdgCache || join73(homedir17(), ".cache");
|
|
91591
|
+
return join73(base, CACHE_DIR_NAME, "bin");
|
|
91374
91592
|
}
|
|
91375
91593
|
function getBinaryName() {
|
|
91376
91594
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -91420,7 +91638,7 @@ async function getBinaryVersion(binary) {
|
|
|
91420
91638
|
}
|
|
91421
91639
|
}
|
|
91422
91640
|
async function checkAstGrepCli() {
|
|
91423
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
91641
|
+
const runtimeDir = astGrepRuntimeDir(join74(homedir18(), ".omo"));
|
|
91424
91642
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
91425
91643
|
if (sgPath === null) {
|
|
91426
91644
|
return {
|
|
@@ -91449,12 +91667,12 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
91449
91667
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
91450
91668
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
91451
91669
|
try {
|
|
91452
|
-
const packageDir = baseDirOverride ??
|
|
91453
|
-
const vendorPath =
|
|
91454
|
-
if (
|
|
91670
|
+
const packageDir = baseDirOverride ?? dirname27(resolvePackageJsonPath());
|
|
91671
|
+
const vendorPath = join74(packageDir, "vendor", platformKey, binaryName);
|
|
91672
|
+
if (existsSync54(vendorPath))
|
|
91455
91673
|
return vendorPath;
|
|
91456
|
-
const binPath =
|
|
91457
|
-
if (
|
|
91674
|
+
const binPath = join74(packageDir, "bin", binaryName);
|
|
91675
|
+
if (existsSync54(binPath))
|
|
91458
91676
|
return binPath;
|
|
91459
91677
|
} catch (error51) {
|
|
91460
91678
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -91599,11 +91817,11 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
91599
91817
|
|
|
91600
91818
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
91601
91819
|
import { readFileSync as readFileSync37 } from "fs";
|
|
91602
|
-
import { join as
|
|
91820
|
+
import { join as join75 } from "path";
|
|
91603
91821
|
|
|
91604
91822
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
91605
|
-
import { existsSync as
|
|
91606
|
-
import { delimiter as delimiter3, dirname as
|
|
91823
|
+
import { existsSync as existsSync55 } from "fs";
|
|
91824
|
+
import { delimiter as delimiter3, dirname as dirname28, resolve as resolve19 } from "path";
|
|
91607
91825
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
91608
91826
|
|
|
91609
91827
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -91616,7 +91834,7 @@ function hasCliSuffix(candidatePath, suffix) {
|
|
|
91616
91834
|
|
|
91617
91835
|
// packages/omo-opencode/src/mcp/runtime-executable.ts
|
|
91618
91836
|
init_bun_which_shim();
|
|
91619
|
-
import { basename as
|
|
91837
|
+
import { basename as basename12 } from "path";
|
|
91620
91838
|
var NODE_EXECUTABLE_NAMES = new Set(["node", "node.exe"]);
|
|
91621
91839
|
function isUnsafeCommandName2(commandName) {
|
|
91622
91840
|
if (commandName.length === 0)
|
|
@@ -91632,7 +91850,7 @@ function isUnsafeCommandName2(commandName) {
|
|
|
91632
91850
|
return false;
|
|
91633
91851
|
}
|
|
91634
91852
|
function isNodeExecPath(execPath) {
|
|
91635
|
-
return NODE_EXECUTABLE_NAMES.has(
|
|
91853
|
+
return NODE_EXECUTABLE_NAMES.has(basename12(execPath).toLowerCase());
|
|
91636
91854
|
}
|
|
91637
91855
|
function resolveRuntimeExecutable(commandName, options = {}) {
|
|
91638
91856
|
if (isUnsafeCommandName2(commandName)) {
|
|
@@ -91650,7 +91868,7 @@ function resolveRuntimeExecutable(commandName, options = {}) {
|
|
|
91650
91868
|
}
|
|
91651
91869
|
|
|
91652
91870
|
// packages/omo-opencode/src/mcp/shared/ancestor-cli-resolver.ts
|
|
91653
|
-
import { resolve as
|
|
91871
|
+
import { resolve as resolve18 } from "path";
|
|
91654
91872
|
function resolveJavaScriptRuntime(resolveExecutable) {
|
|
91655
91873
|
const node = resolveExecutable("node");
|
|
91656
91874
|
return node.available ? node : resolveExecutable("bun");
|
|
@@ -91658,9 +91876,9 @@ function resolveJavaScriptRuntime(resolveExecutable) {
|
|
|
91658
91876
|
function createAncestorCliCandidates(options) {
|
|
91659
91877
|
const candidates = [];
|
|
91660
91878
|
const seenPaths = new Set;
|
|
91661
|
-
let currentDirectory =
|
|
91879
|
+
let currentDirectory = resolve18(options.startDirectory);
|
|
91662
91880
|
while (true) {
|
|
91663
|
-
const distCliPath =
|
|
91881
|
+
const distCliPath = resolve18(currentDirectory, options.packageRel, options.distCliRel);
|
|
91664
91882
|
if (!seenPaths.has(distCliPath)) {
|
|
91665
91883
|
const runtime5 = resolveJavaScriptRuntime(options.resolveExecutable);
|
|
91666
91884
|
seenPaths.add(distCliPath);
|
|
@@ -91672,7 +91890,7 @@ function createAncestorCliCandidates(options) {
|
|
|
91672
91890
|
runtimeAvailable: runtime5.available
|
|
91673
91891
|
});
|
|
91674
91892
|
}
|
|
91675
|
-
const sourceCliPath =
|
|
91893
|
+
const sourceCliPath = resolve18(currentDirectory, options.packageRel, options.sourceCliRel);
|
|
91676
91894
|
if (!seenPaths.has(sourceCliPath)) {
|
|
91677
91895
|
const runtime5 = options.resolveExecutable("bun");
|
|
91678
91896
|
const sourceCandidateAvailable = options.isSourceCandidateAvailable?.({
|
|
@@ -91689,7 +91907,7 @@ function createAncestorCliCandidates(options) {
|
|
|
91689
91907
|
runtimeAvailable: runtime5.available
|
|
91690
91908
|
});
|
|
91691
91909
|
}
|
|
91692
|
-
const parentDirectory =
|
|
91910
|
+
const parentDirectory = resolve18(currentDirectory, "..");
|
|
91693
91911
|
if (parentDirectory === currentDirectory)
|
|
91694
91912
|
return candidates;
|
|
91695
91913
|
currentDirectory = parentDirectory;
|
|
@@ -91725,7 +91943,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
91725
91943
|
].join(";");
|
|
91726
91944
|
function getModuleDirectory(moduleUrl) {
|
|
91727
91945
|
try {
|
|
91728
|
-
return
|
|
91946
|
+
return dirname28(fileURLToPath6(moduleUrl));
|
|
91729
91947
|
} catch (error51) {
|
|
91730
91948
|
if (!(error51 instanceof Error))
|
|
91731
91949
|
throw error51;
|
|
@@ -91733,23 +91951,23 @@ function getModuleDirectory(moduleUrl) {
|
|
|
91733
91951
|
}
|
|
91734
91952
|
}
|
|
91735
91953
|
function findBootstrapRoot(candidates, pathExists) {
|
|
91736
|
-
return candidates.find((candidate) => pathExists(
|
|
91954
|
+
return candidates.find((candidate) => pathExists(resolve19(candidate.root, "package.json")))?.root ?? process.cwd();
|
|
91737
91955
|
}
|
|
91738
91956
|
function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
91739
91957
|
const runtime5 = resolveJavaScriptRuntime(resolveExecutable);
|
|
91740
91958
|
const bun = resolveExecutable("bun");
|
|
91741
91959
|
const npm = resolveExecutable("npm");
|
|
91742
|
-
const packageManifestPath =
|
|
91960
|
+
const packageManifestPath = resolve19(root, PACKAGE_REL, "package.json");
|
|
91743
91961
|
return {
|
|
91744
91962
|
command: [runtime5.command, "-e", LSP_BOOTSTRAP_SCRIPT, root, npm.command, bun.command],
|
|
91745
91963
|
root,
|
|
91746
|
-
path:
|
|
91964
|
+
path: resolve19(root, PACKAGE_REL, DIST_CLI_REL),
|
|
91747
91965
|
exists: runtime5.available && npm.available && pathExists(packageManifestPath),
|
|
91748
91966
|
runtimeAvailable: runtime5.available
|
|
91749
91967
|
};
|
|
91750
91968
|
}
|
|
91751
91969
|
function resolveLspCommand(options = {}) {
|
|
91752
|
-
const pathExists = options.exists ??
|
|
91970
|
+
const pathExists = options.exists ?? existsSync55;
|
|
91753
91971
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
91754
91972
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
91755
91973
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -91759,7 +91977,7 @@ function resolveLspCommand(options = {}) {
|
|
|
91759
91977
|
sourceCliRel: SOURCE_CLI_REL,
|
|
91760
91978
|
pathExists,
|
|
91761
91979
|
resolveExecutable,
|
|
91762
|
-
isSourceCandidateAvailable: ({ root }) => pathExists(
|
|
91980
|
+
isSourceCandidateAvailable: ({ root }) => pathExists(resolve19(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL))
|
|
91763
91981
|
}) : [];
|
|
91764
91982
|
const distCandidate = candidates.find((candidate) => hasCliSuffix(candidate.path, DIST_CLI_REL) && candidate.exists);
|
|
91765
91983
|
if (distCandidate) {
|
|
@@ -91806,7 +92024,7 @@ function readOmoConfig(configDirectory) {
|
|
|
91806
92024
|
}
|
|
91807
92025
|
function isLspMcpDisabled(options) {
|
|
91808
92026
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
91809
|
-
const projectConfigDirectory =
|
|
92027
|
+
const projectConfigDirectory = join75(options.cwd ?? process.cwd(), ".opencode");
|
|
91810
92028
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
91811
92029
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
91812
92030
|
const disabledMcps = new Set([
|
|
@@ -91825,21 +92043,21 @@ function getInstalledLspServers(options = {}) {
|
|
|
91825
92043
|
|
|
91826
92044
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
91827
92045
|
init_shared();
|
|
91828
|
-
import { existsSync as
|
|
92046
|
+
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "fs";
|
|
91829
92047
|
import { homedir as homedir19 } from "os";
|
|
91830
|
-
import { join as
|
|
92048
|
+
import { join as join76 } from "path";
|
|
91831
92049
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
91832
92050
|
function getMcpConfigPaths() {
|
|
91833
92051
|
return [
|
|
91834
|
-
|
|
91835
|
-
|
|
91836
|
-
|
|
92052
|
+
join76(homedir19(), ".claude", ".mcp.json"),
|
|
92053
|
+
join76(process.cwd(), ".mcp.json"),
|
|
92054
|
+
join76(process.cwd(), ".claude", ".mcp.json")
|
|
91837
92055
|
];
|
|
91838
92056
|
}
|
|
91839
92057
|
function loadUserMcpConfig() {
|
|
91840
92058
|
const servers = {};
|
|
91841
92059
|
for (const configPath of getMcpConfigPaths()) {
|
|
91842
|
-
if (!
|
|
92060
|
+
if (!existsSync56(configPath))
|
|
91843
92061
|
continue;
|
|
91844
92062
|
try {
|
|
91845
92063
|
const content = readFileSync38(configPath, "utf-8");
|
|
@@ -92002,7 +92220,16 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
92002
92220
|
import { homedir as homedir20 } from "os";
|
|
92003
92221
|
import path14 from "path";
|
|
92004
92222
|
function resolveBaseDir(config3) {
|
|
92005
|
-
return config3.base_dir ?? path14.join(homedir20(), ".omo");
|
|
92223
|
+
return expandHomeDirectory(config3.base_dir ?? path14.join(homedir20(), ".omo"));
|
|
92224
|
+
}
|
|
92225
|
+
function expandHomeDirectory(directoryPath) {
|
|
92226
|
+
if (directoryPath === "~") {
|
|
92227
|
+
return homedir20();
|
|
92228
|
+
}
|
|
92229
|
+
if (directoryPath.startsWith("~/") || directoryPath.startsWith("~\\")) {
|
|
92230
|
+
return path14.join(homedir20(), directoryPath.slice(2));
|
|
92231
|
+
}
|
|
92232
|
+
return directoryPath;
|
|
92006
92233
|
}
|
|
92007
92234
|
// packages/omo-opencode/src/cli/doctor/checks/team-mode.ts
|
|
92008
92235
|
init_shared();
|
|
@@ -92077,10 +92304,10 @@ async function pathExists(dir) {
|
|
|
92077
92304
|
|
|
92078
92305
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
92079
92306
|
init_src();
|
|
92080
|
-
import { existsSync as
|
|
92307
|
+
import { existsSync as existsSync57 } from "fs";
|
|
92081
92308
|
import { lstat as lstat11, readdir as readdir8, readFile as readFile20 } from "fs/promises";
|
|
92082
92309
|
import { homedir as homedir21 } from "os";
|
|
92083
|
-
import { basename as
|
|
92310
|
+
import { basename as basename13, join as join77, resolve as resolve20 } from "path";
|
|
92084
92311
|
// packages/omo-opencode/package.json
|
|
92085
92312
|
var package_default3 = {
|
|
92086
92313
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -92136,13 +92363,13 @@ var CODEX_BIN_NAMES = [
|
|
|
92136
92363
|
"omo-git-bash-hook"
|
|
92137
92364
|
];
|
|
92138
92365
|
async function gatherCodexSummary(deps = {}) {
|
|
92139
|
-
const codexHome =
|
|
92366
|
+
const codexHome = resolve20(deps.codexHome ?? process.env.CODEX_HOME ?? join77(homedir21(), ".codex"));
|
|
92140
92367
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
92141
92368
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
92142
92369
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
92143
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
92144
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
92145
|
-
const configPath =
|
|
92370
|
+
const manifest = pluginRoot === null ? null : await readJson(join77(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
92371
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join77(pluginRoot, "lazycodex-install.json"));
|
|
92372
|
+
const configPath = join77(codexHome, "config.toml");
|
|
92146
92373
|
const pluginVersion = stringField(manifest, "version");
|
|
92147
92374
|
return {
|
|
92148
92375
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -92198,7 +92425,7 @@ function buildCodexIssues(summary) {
|
|
|
92198
92425
|
if (summary.pluginRoot === null) {
|
|
92199
92426
|
issues.push({
|
|
92200
92427
|
title: "OMO Codex plugin is not installed",
|
|
92201
|
-
description: `Expected cached plugin at ${
|
|
92428
|
+
description: `Expected cached plugin at ${join77("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
92202
92429
|
fix: "Run: npx lazycodex-ai install",
|
|
92203
92430
|
severity: "error",
|
|
92204
92431
|
affects: ["plugin loading"]
|
|
@@ -92251,15 +92478,15 @@ function buildCodexIssues(summary) {
|
|
|
92251
92478
|
return issues;
|
|
92252
92479
|
}
|
|
92253
92480
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
92254
|
-
const pluginRoot =
|
|
92255
|
-
if (!
|
|
92481
|
+
const pluginRoot = join77(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
92482
|
+
if (!existsSync57(pluginRoot))
|
|
92256
92483
|
return null;
|
|
92257
92484
|
const versions2 = await readdir8(pluginRoot, { withFileTypes: true });
|
|
92258
92485
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
92259
|
-
return candidates.length === 0 ? null :
|
|
92486
|
+
return candidates.length === 0 ? null : join77(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
92260
92487
|
}
|
|
92261
92488
|
async function readCodexConfigSummary(configPath) {
|
|
92262
|
-
if (!
|
|
92489
|
+
if (!existsSync57(configPath)) {
|
|
92263
92490
|
return { exists: false, marketplaceConfigured: false, pluginEnabled: false, pluginsFeatureEnabled: false, pluginHooksFeatureEnabled: false };
|
|
92264
92491
|
}
|
|
92265
92492
|
const content = await readFile20(configPath, "utf8");
|
|
@@ -92274,17 +92501,17 @@ async function readCodexConfigSummary(configPath) {
|
|
|
92274
92501
|
async function readLinkedBins(binDir) {
|
|
92275
92502
|
const linked = [];
|
|
92276
92503
|
for (const name of CODEX_BIN_NAMES) {
|
|
92277
|
-
if (await pathExists2(
|
|
92504
|
+
if (await pathExists2(join77(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
92278
92505
|
linked.push(name);
|
|
92279
92506
|
}
|
|
92280
92507
|
return linked;
|
|
92281
92508
|
}
|
|
92282
92509
|
async function readLinkedAgents(codexHome) {
|
|
92283
|
-
const agentsDir =
|
|
92284
|
-
if (!
|
|
92510
|
+
const agentsDir = join77(codexHome, "agents");
|
|
92511
|
+
if (!existsSync57(agentsDir))
|
|
92285
92512
|
return [];
|
|
92286
92513
|
const entries = await readdir8(agentsDir, { withFileTypes: true });
|
|
92287
|
-
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) =>
|
|
92514
|
+
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename13(entry.name, ".toml")).sort();
|
|
92288
92515
|
}
|
|
92289
92516
|
async function readJson(path16) {
|
|
92290
92517
|
try {
|
|
@@ -92340,7 +92567,7 @@ async function pathExists2(path16) {
|
|
|
92340
92567
|
init_src();
|
|
92341
92568
|
import { readdir as readdir9, readFile as readFile21, stat as stat4 } from "fs/promises";
|
|
92342
92569
|
import { homedir as homedir22 } from "os";
|
|
92343
|
-
import { dirname as
|
|
92570
|
+
import { dirname as dirname29, join as join78, relative as relative10, resolve as resolve21, sep as sep9 } from "path";
|
|
92344
92571
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
92345
92572
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
92346
92573
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -92350,7 +92577,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92350
92577
|
const env3 = deps.env ?? process.env;
|
|
92351
92578
|
const platform = deps.platform ?? process.platform;
|
|
92352
92579
|
const arch = deps.arch ?? process.arch;
|
|
92353
|
-
const codexHome =
|
|
92580
|
+
const codexHome = resolve21(deps.codexHome ?? env3["CODEX_HOME"] ?? join78(homedir22(), ".codex"));
|
|
92354
92581
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
92355
92582
|
if (summary.pluginRoot === null) {
|
|
92356
92583
|
return {
|
|
@@ -92375,7 +92602,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92375
92602
|
});
|
|
92376
92603
|
}
|
|
92377
92604
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
92378
|
-
const runtimeSgPath =
|
|
92605
|
+
const runtimeSgPath = join78(runtimeSgDir, sgBinaryName(platform));
|
|
92379
92606
|
const sg = findSgBinarySync({
|
|
92380
92607
|
arch,
|
|
92381
92608
|
env: env3,
|
|
@@ -92414,8 +92641,8 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
92414
92641
|
const manifest = await readJson2(manifestPath);
|
|
92415
92642
|
if (manifest === null || !isRecord5(manifest["mcpServers"]))
|
|
92416
92643
|
continue;
|
|
92417
|
-
const manifestRoot =
|
|
92418
|
-
const isRootManifest =
|
|
92644
|
+
const manifestRoot = dirname29(manifestPath);
|
|
92645
|
+
const isRootManifest = resolve21(manifestRoot) === resolve21(pluginRoot);
|
|
92419
92646
|
for (const server2 of Object.values(manifest["mcpServers"])) {
|
|
92420
92647
|
if (!isRecord5(server2) || !Array.isArray(server2["args"]))
|
|
92421
92648
|
continue;
|
|
@@ -92435,7 +92662,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
92435
92662
|
continue;
|
|
92436
92663
|
const commands2 = [];
|
|
92437
92664
|
collectHookCommands(manifest, commands2);
|
|
92438
|
-
const hookPluginRoot =
|
|
92665
|
+
const hookPluginRoot = dirname29(dirname29(hookManifestPath));
|
|
92439
92666
|
for (const command of commands2) {
|
|
92440
92667
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
92441
92668
|
referencedCount += 1;
|
|
@@ -92457,8 +92684,8 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
92457
92684
|
broken.push(entry);
|
|
92458
92685
|
}
|
|
92459
92686
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
92460
|
-
const targetPath =
|
|
92461
|
-
const bundleRootPath =
|
|
92687
|
+
const targetPath = resolve21(baseRoot, relativePath);
|
|
92688
|
+
const bundleRootPath = resolve21(bundleRoot);
|
|
92462
92689
|
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
92463
92690
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
92464
92691
|
if (allowEscape)
|
|
@@ -92474,7 +92701,7 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
92474
92701
|
}
|
|
92475
92702
|
async function findHookManifestPaths(root) {
|
|
92476
92703
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
92477
|
-
return paths2.filter((path16) =>
|
|
92704
|
+
return paths2.filter((path16) => dirname29(path16).endsWith(`${sep9}hooks`));
|
|
92478
92705
|
}
|
|
92479
92706
|
async function findManifestPaths(root, manifestName) {
|
|
92480
92707
|
let entries;
|
|
@@ -92487,7 +92714,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
92487
92714
|
for (const entry of entries) {
|
|
92488
92715
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
92489
92716
|
continue;
|
|
92490
|
-
const entryPath =
|
|
92717
|
+
const entryPath = join78(root, entry.name);
|
|
92491
92718
|
if (entry.isDirectory()) {
|
|
92492
92719
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
92493
92720
|
continue;
|
|
@@ -92530,18 +92757,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
92530
92757
|
return (arg.startsWith("./") || arg.startsWith("../")) && arg.endsWith("/dist/cli.js");
|
|
92531
92758
|
}
|
|
92532
92759
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
92533
|
-
return
|
|
92760
|
+
return join78(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
92534
92761
|
}
|
|
92535
92762
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
92536
92763
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
92537
92764
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
92538
92765
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
92539
|
-
if (sgPath ===
|
|
92766
|
+
if (sgPath === join78(runtimeSgDir, sgBinaryName(platform)))
|
|
92540
92767
|
return "runtime dir";
|
|
92541
92768
|
return "PATH";
|
|
92542
92769
|
}
|
|
92543
92770
|
async function readBootstrapStateSummary(codexHome) {
|
|
92544
|
-
const statePath =
|
|
92771
|
+
const statePath = join78(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
92545
92772
|
const raw = await readJson2(statePath);
|
|
92546
92773
|
if (raw === null)
|
|
92547
92774
|
return null;
|
|
@@ -92607,7 +92834,7 @@ async function fileSize(path16) {
|
|
|
92607
92834
|
}
|
|
92608
92835
|
}
|
|
92609
92836
|
function normalizeRelative(root, target) {
|
|
92610
|
-
return normalizePathSeparators(
|
|
92837
|
+
return normalizePathSeparators(relative10(root, target));
|
|
92611
92838
|
}
|
|
92612
92839
|
function normalizePathSeparators(path16) {
|
|
92613
92840
|
return path16.split("\\").join("/");
|
|
@@ -92617,23 +92844,23 @@ function isRecord5(value) {
|
|
|
92617
92844
|
}
|
|
92618
92845
|
|
|
92619
92846
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
92620
|
-
import { existsSync as
|
|
92847
|
+
import { existsSync as existsSync58 } from "fs";
|
|
92621
92848
|
import { readFile as readFile22 } from "fs/promises";
|
|
92622
92849
|
import { homedir as homedir23 } from "os";
|
|
92623
|
-
import { join as
|
|
92850
|
+
import { join as join79, resolve as resolve22 } from "path";
|
|
92624
92851
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
92625
92852
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
92626
92853
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
92627
92854
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
92628
|
-
const codexHome =
|
|
92855
|
+
const codexHome = resolve22(deps.codexHome ?? process.env.CODEX_HOME ?? join79(homedir23(), ".codex"));
|
|
92629
92856
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
92630
92857
|
const platform = deps.platform ?? process.platform;
|
|
92631
|
-
const wrapperPath =
|
|
92858
|
+
const wrapperPath = join79(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
92632
92859
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
92633
92860
|
const issues = [];
|
|
92634
92861
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
92635
92862
|
const targetPath = parseRuntimeTargetPath(wrapper);
|
|
92636
|
-
if (targetPath !== null && !
|
|
92863
|
+
if (targetPath !== null && !existsSync58(targetPath)) {
|
|
92637
92864
|
issues.push({
|
|
92638
92865
|
title: "omo runtime wrapper target is missing",
|
|
92639
92866
|
description: `Generated omo runtime wrapper at ${wrapperPath} points to missing target ${targetPath}.`,
|
|
@@ -93125,7 +93352,7 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
93125
93352
|
import { createHash as createHash4 } from "crypto";
|
|
93126
93353
|
import {
|
|
93127
93354
|
chmodSync as chmodSync4,
|
|
93128
|
-
existsSync as
|
|
93355
|
+
existsSync as existsSync61,
|
|
93129
93356
|
mkdirSync as mkdirSync14,
|
|
93130
93357
|
readdirSync as readdirSync9,
|
|
93131
93358
|
readFileSync as readFileSync41,
|
|
@@ -93133,15 +93360,15 @@ import {
|
|
|
93133
93360
|
unlinkSync as unlinkSync8,
|
|
93134
93361
|
writeFileSync as writeFileSync11
|
|
93135
93362
|
} from "fs";
|
|
93136
|
-
import { basename as
|
|
93363
|
+
import { basename as basename14, dirname as dirname30, join as join82 } from "path";
|
|
93137
93364
|
|
|
93138
93365
|
// packages/mcp-client-core/src/config-dir.ts
|
|
93139
|
-
import { existsSync as
|
|
93366
|
+
import { existsSync as existsSync59, realpathSync as realpathSync8 } from "fs";
|
|
93140
93367
|
import { homedir as homedir24 } from "os";
|
|
93141
|
-
import { join as
|
|
93368
|
+
import { join as join80, resolve as resolve23 } from "path";
|
|
93142
93369
|
function resolveConfigPath2(pathValue) {
|
|
93143
|
-
const resolvedPath =
|
|
93144
|
-
if (!
|
|
93370
|
+
const resolvedPath = resolve23(pathValue);
|
|
93371
|
+
if (!existsSync59(resolvedPath))
|
|
93145
93372
|
return resolvedPath;
|
|
93146
93373
|
try {
|
|
93147
93374
|
return realpathSync8(resolvedPath);
|
|
@@ -93156,13 +93383,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
93156
93383
|
if (customConfigDir) {
|
|
93157
93384
|
return resolveConfigPath2(customConfigDir);
|
|
93158
93385
|
}
|
|
93159
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
93160
|
-
return resolveConfigPath2(
|
|
93386
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join80(homedir24(), ".config");
|
|
93387
|
+
return resolveConfigPath2(join80(xdgConfigDir, "opencode"));
|
|
93161
93388
|
}
|
|
93162
93389
|
|
|
93163
93390
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
93164
|
-
import { chmodSync as chmodSync3, existsSync as
|
|
93165
|
-
import { join as
|
|
93391
|
+
import { chmodSync as chmodSync3, existsSync as existsSync60, readFileSync as readFileSync40, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "fs";
|
|
93392
|
+
import { join as join81 } from "path";
|
|
93166
93393
|
var INDEX_FILE_NAME = "index.json";
|
|
93167
93394
|
function isTokenIndex(value) {
|
|
93168
93395
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -93170,11 +93397,11 @@ function isTokenIndex(value) {
|
|
|
93170
93397
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
93171
93398
|
}
|
|
93172
93399
|
function getIndexPath(storageDir) {
|
|
93173
|
-
return
|
|
93400
|
+
return join81(storageDir, INDEX_FILE_NAME);
|
|
93174
93401
|
}
|
|
93175
93402
|
function readTokenIndex(storageDir) {
|
|
93176
93403
|
const indexPath = getIndexPath(storageDir);
|
|
93177
|
-
if (!
|
|
93404
|
+
if (!existsSync60(indexPath))
|
|
93178
93405
|
return {};
|
|
93179
93406
|
try {
|
|
93180
93407
|
const parsed = JSON.parse(readFileSync40(indexPath, "utf-8"));
|
|
@@ -93214,16 +93441,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
93214
93441
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
93215
93442
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
93216
93443
|
function getMcpOauthStorageDir() {
|
|
93217
|
-
return
|
|
93444
|
+
return join82(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
93218
93445
|
}
|
|
93219
93446
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
93220
93447
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
93221
93448
|
}
|
|
93222
93449
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
93223
|
-
return
|
|
93450
|
+
return join82(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
93224
93451
|
}
|
|
93225
93452
|
function getLegacyStoragePath() {
|
|
93226
|
-
return
|
|
93453
|
+
return join82(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
93227
93454
|
}
|
|
93228
93455
|
function normalizeHost2(serverHost) {
|
|
93229
93456
|
let host = serverHost.trim();
|
|
@@ -93284,7 +93511,7 @@ function isOAuthTokenData(value) {
|
|
|
93284
93511
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
93285
93512
|
}
|
|
93286
93513
|
function readTokenFile(filePath) {
|
|
93287
|
-
if (!
|
|
93514
|
+
if (!existsSync61(filePath))
|
|
93288
93515
|
return null;
|
|
93289
93516
|
try {
|
|
93290
93517
|
const parsed = JSON.parse(readFileSync41(filePath, "utf-8"));
|
|
@@ -93297,7 +93524,7 @@ function readTokenFile(filePath) {
|
|
|
93297
93524
|
}
|
|
93298
93525
|
function readLegacyStore() {
|
|
93299
93526
|
const filePath = getLegacyStoragePath();
|
|
93300
|
-
if (!
|
|
93527
|
+
if (!existsSync61(filePath))
|
|
93301
93528
|
return null;
|
|
93302
93529
|
try {
|
|
93303
93530
|
const parsed = JSON.parse(readFileSync41(filePath, "utf-8"));
|
|
@@ -93317,8 +93544,8 @@ function readLegacyStore() {
|
|
|
93317
93544
|
}
|
|
93318
93545
|
function writeTokenFile(filePath, token) {
|
|
93319
93546
|
try {
|
|
93320
|
-
const dir =
|
|
93321
|
-
if (!
|
|
93547
|
+
const dir = dirname30(filePath);
|
|
93548
|
+
if (!existsSync61(dir)) {
|
|
93322
93549
|
mkdirSync14(dir, { recursive: true });
|
|
93323
93550
|
}
|
|
93324
93551
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
@@ -93342,7 +93569,7 @@ function saveToken(serverHost, resource, token) {
|
|
|
93342
93569
|
}
|
|
93343
93570
|
function deleteToken(serverHost, resource) {
|
|
93344
93571
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
93345
|
-
if (!
|
|
93572
|
+
if (!existsSync61(filePath))
|
|
93346
93573
|
return deleteLegacyToken(serverHost, resource);
|
|
93347
93574
|
try {
|
|
93348
93575
|
unlinkSync8(filePath);
|
|
@@ -93364,7 +93591,7 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
93364
93591
|
if (Object.keys(store2).length === 0) {
|
|
93365
93592
|
try {
|
|
93366
93593
|
const filePath = getLegacyStoragePath();
|
|
93367
|
-
if (
|
|
93594
|
+
if (existsSync61(filePath))
|
|
93368
93595
|
unlinkSync8(filePath);
|
|
93369
93596
|
return true;
|
|
93370
93597
|
} catch (deleteError) {
|
|
@@ -93402,7 +93629,7 @@ function listTokensByHost(serverHost) {
|
|
|
93402
93629
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
93403
93630
|
if (!indexedKey.startsWith(prefix))
|
|
93404
93631
|
continue;
|
|
93405
|
-
const indexedToken = readTokenFile(
|
|
93632
|
+
const indexedToken = readTokenFile(join82(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
93406
93633
|
if (indexedToken)
|
|
93407
93634
|
result[indexedKey] = indexedToken;
|
|
93408
93635
|
}
|
|
@@ -93411,14 +93638,14 @@ function listTokensByHost(serverHost) {
|
|
|
93411
93638
|
function listAllTokens() {
|
|
93412
93639
|
const result = { ...readLegacyStore() ?? {} };
|
|
93413
93640
|
const dir = getMcpOauthStorageDir();
|
|
93414
|
-
if (!
|
|
93641
|
+
if (!existsSync61(dir))
|
|
93415
93642
|
return result;
|
|
93416
93643
|
const index = readTokenIndex(dir);
|
|
93417
93644
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
93418
93645
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
93419
93646
|
continue;
|
|
93420
|
-
const token = readTokenFile(
|
|
93421
|
-
const hash2 =
|
|
93647
|
+
const token = readTokenFile(join82(dir, entry.name));
|
|
93648
|
+
const hash2 = basename14(entry.name, ".json");
|
|
93422
93649
|
if (token)
|
|
93423
93650
|
result[index[hash2] ?? hash2] = token;
|
|
93424
93651
|
}
|
|
@@ -93617,7 +93844,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
|
93617
93844
|
}
|
|
93618
93845
|
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
93619
93846
|
function startCallbackServer(port) {
|
|
93620
|
-
return new Promise((
|
|
93847
|
+
return new Promise((resolve24, reject) => {
|
|
93621
93848
|
let timeoutId;
|
|
93622
93849
|
const server2 = createServer2((request, response) => {
|
|
93623
93850
|
clearTimeout(timeoutId);
|
|
@@ -93643,7 +93870,7 @@ function startCallbackServer(port) {
|
|
|
93643
93870
|
response.writeHead(200, { "content-type": "text/html" });
|
|
93644
93871
|
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
|
|
93645
93872
|
server2.close();
|
|
93646
|
-
|
|
93873
|
+
resolve24({ code, state: state2 });
|
|
93647
93874
|
});
|
|
93648
93875
|
timeoutId = setTimeout(() => {
|
|
93649
93876
|
server2.close();
|
|
@@ -93983,7 +94210,7 @@ function createMcpOAuthCommand() {
|
|
|
93983
94210
|
}
|
|
93984
94211
|
|
|
93985
94212
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
93986
|
-
import { existsSync as
|
|
94213
|
+
import { existsSync as existsSync62 } from "fs";
|
|
93987
94214
|
|
|
93988
94215
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
93989
94216
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -94120,10 +94347,10 @@ async function boulder(options) {
|
|
|
94120
94347
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
94121
94348
|
const state2 = readBoulderState(directory);
|
|
94122
94349
|
if (!state2) {
|
|
94123
|
-
const message =
|
|
94350
|
+
const message = existsSync62(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
94124
94351
|
process.stderr.write(`${message}
|
|
94125
94352
|
`);
|
|
94126
|
-
return
|
|
94353
|
+
return existsSync62(boulderFilePath) ? 2 : 1;
|
|
94127
94354
|
}
|
|
94128
94355
|
const works = getBoulderWorks(state2);
|
|
94129
94356
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -94141,7 +94368,7 @@ async function boulder(options) {
|
|
|
94141
94368
|
}
|
|
94142
94369
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
94143
94370
|
import { spawn as spawn5 } from "child_process";
|
|
94144
|
-
import { existsSync as
|
|
94371
|
+
import { existsSync as existsSync63, realpathSync as realpathSync9 } from "fs";
|
|
94145
94372
|
import { homedir as homedir25 } from "os";
|
|
94146
94373
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
94147
94374
|
const env3 = input.env ?? process.env;
|
|
@@ -94166,22 +94393,22 @@ async function codexUlwLoop(args) {
|
|
|
94166
94393
|
console.error("Codex ulw-loop is not installed. Run: npx lazycodex-ai@latest install --no-tui");
|
|
94167
94394
|
return 1;
|
|
94168
94395
|
}
|
|
94169
|
-
return new Promise((
|
|
94396
|
+
return new Promise((resolve24) => {
|
|
94170
94397
|
const child = spawn5(command.executable, [...command.argsPrefix, ...args], { stdio: "inherit" });
|
|
94171
94398
|
child.on("error", (error51) => {
|
|
94172
94399
|
console.error(error51.message);
|
|
94173
|
-
|
|
94400
|
+
resolve24(1);
|
|
94174
94401
|
});
|
|
94175
|
-
child.on("close", (code) =>
|
|
94402
|
+
child.on("close", (code) => resolve24(code ?? 1));
|
|
94176
94403
|
});
|
|
94177
94404
|
}
|
|
94178
94405
|
function resolveLocalUlwLoopBin(env3, homeDir) {
|
|
94179
94406
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo-ulw-loop", env: env3, homeDir });
|
|
94180
|
-
return candidates.find((candidate) =>
|
|
94407
|
+
return candidates.find((candidate) => existsSync63(candidate)) ?? null;
|
|
94181
94408
|
}
|
|
94182
94409
|
function resolveLegacyLocalOmoBin(env3, homeDir, currentExecutablePaths) {
|
|
94183
94410
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo", env: env3, homeDir });
|
|
94184
|
-
return candidates.find((candidate) =>
|
|
94411
|
+
return candidates.find((candidate) => existsSync63(candidate) && !isCurrentExecutable(candidate, currentExecutablePaths)) ?? null;
|
|
94185
94412
|
}
|
|
94186
94413
|
function isCurrentExecutable(candidate, currentExecutablePaths) {
|
|
94187
94414
|
const candidateRealPath = realpathOrSelf(candidate);
|
|
@@ -94230,15 +94457,15 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
94230
94457
|
}
|
|
94231
94458
|
|
|
94232
94459
|
// packages/omo-opencode/src/cli/sparkshell.ts
|
|
94233
|
-
import { spawnSync as
|
|
94460
|
+
import { spawnSync as spawnSync5 } from "child_process";
|
|
94234
94461
|
import { constants as osConstants } from "os";
|
|
94235
|
-
import { isAbsolute as
|
|
94462
|
+
import { isAbsolute as isAbsolute11, resolve as resolve24 } from "path";
|
|
94236
94463
|
|
|
94237
94464
|
// packages/omo-opencode/src/cli/sparkshell-appserver.ts
|
|
94238
94465
|
init_src();
|
|
94239
|
-
import { existsSync as
|
|
94466
|
+
import { existsSync as existsSync64 } from "fs";
|
|
94240
94467
|
import { homedir as homedir26 } from "os";
|
|
94241
|
-
import { join as
|
|
94468
|
+
import { join as join83 } from "path";
|
|
94242
94469
|
|
|
94243
94470
|
// packages/omo-opencode/src/cli/sparkshell-appserver-websocket.ts
|
|
94244
94471
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
@@ -94389,7 +94616,7 @@ function bufferUnreadSocketBytes(socket, unread) {
|
|
|
94389
94616
|
// packages/omo-opencode/src/cli/sparkshell-appserver.ts
|
|
94390
94617
|
function createDefaultSparkShellAppServerClient(env3) {
|
|
94391
94618
|
const socketPath = resolveAppServerSocketPath(env3);
|
|
94392
|
-
if (!socketPath || !
|
|
94619
|
+
if (!socketPath || !existsSync64(socketPath)) {
|
|
94393
94620
|
return null;
|
|
94394
94621
|
}
|
|
94395
94622
|
return new JsonRpcSparkShellAppServerClient(socketPath, resolveAppServerTimeoutMs(env3));
|
|
@@ -94399,8 +94626,8 @@ function resolveAppServerSocketPath(env3) {
|
|
|
94399
94626
|
if (explicit) {
|
|
94400
94627
|
return explicit;
|
|
94401
94628
|
}
|
|
94402
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94403
|
-
return
|
|
94629
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join83(homedir26(), ".codex");
|
|
94630
|
+
return join83(codexHome, "app-server-control", "app-server-control.sock");
|
|
94404
94631
|
}
|
|
94405
94632
|
function resolveAppServerTimeoutMs(env3) {
|
|
94406
94633
|
const parsed = Number.parseInt(env3["OMO_SPARKSHELL_APP_SERVER_TIMEOUT_MS"]?.trim() ?? "", 10);
|
|
@@ -94829,9 +95056,9 @@ function extractContextHints(requests) {
|
|
|
94829
95056
|
seen.add(key);
|
|
94830
95057
|
hints.push(hint);
|
|
94831
95058
|
}
|
|
94832
|
-
const
|
|
94833
|
-
if (
|
|
94834
|
-
add(
|
|
95059
|
+
const basename15 = hint.slice(hint.lastIndexOf("/") + 1);
|
|
95060
|
+
if (basename15.length > 0 && basename15 !== hint) {
|
|
95061
|
+
add(basename15);
|
|
94835
95062
|
}
|
|
94836
95063
|
};
|
|
94837
95064
|
for (const request of requests) {
|
|
@@ -94970,9 +95197,9 @@ function isLowSurrogate(codeUnit) {
|
|
|
94970
95197
|
|
|
94971
95198
|
// packages/omo-opencode/src/cli/sparkshell-session-context.ts
|
|
94972
95199
|
init_src();
|
|
94973
|
-
import { existsSync as
|
|
95200
|
+
import { existsSync as existsSync65, readdirSync as readdirSync10, readFileSync as readFileSync42 } from "fs";
|
|
94974
95201
|
import { homedir as homedir27 } from "os";
|
|
94975
|
-
import { join as
|
|
95202
|
+
import { join as join84 } from "path";
|
|
94976
95203
|
var SPARKSHELL_SESSION_CONTEXT_ENV = "OMO_SPARKSHELL_SESSION_CONTEXT";
|
|
94977
95204
|
var SPARKSHELL_SESSION_ID_ENV = "OMO_SPARKSHELL_SESSION_ID";
|
|
94978
95205
|
var CODEX_THREAD_ID_ENV = "CODEX_THREAD_ID";
|
|
@@ -94985,11 +95212,11 @@ function resolveCodexSessionId(env3) {
|
|
|
94985
95212
|
return /^[0-9a-f][0-9a-f-]{7,}$/i.test(candidate) ? candidate : null;
|
|
94986
95213
|
}
|
|
94987
95214
|
function findRolloutPath(sessionId, env3, deps = {}) {
|
|
94988
|
-
const fileExists = deps.fileExists ??
|
|
95215
|
+
const fileExists = deps.fileExists ?? existsSync65;
|
|
94989
95216
|
const listDirectory = deps.listDirectory ?? ((path16) => readdirSync10(path16));
|
|
94990
95217
|
const homeDirectory = deps.homeDirectory ?? homedir27;
|
|
94991
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94992
|
-
const roots = [
|
|
95218
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join84(homeDirectory(), ".codex");
|
|
95219
|
+
const roots = [join84(codexHome, "sessions"), join84(codexHome, "archived_sessions")];
|
|
94993
95220
|
const fileSuffix = `-${sessionId}.jsonl`;
|
|
94994
95221
|
const scanDay = (dayDir) => {
|
|
94995
95222
|
if (!fileExists(dayDir)) {
|
|
@@ -94997,14 +95224,14 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94997
95224
|
}
|
|
94998
95225
|
for (const name of listSafely(listDirectory, dayDir)) {
|
|
94999
95226
|
if (name.startsWith("rollout-") && name.endsWith(fileSuffix)) {
|
|
95000
|
-
return
|
|
95227
|
+
return join84(dayDir, name);
|
|
95001
95228
|
}
|
|
95002
95229
|
}
|
|
95003
95230
|
return null;
|
|
95004
95231
|
};
|
|
95005
95232
|
for (const dayDir of uuidV7DayDirCandidates(sessionId)) {
|
|
95006
95233
|
for (const root of roots) {
|
|
95007
|
-
const found = scanDay(
|
|
95234
|
+
const found = scanDay(join84(root, dayDir));
|
|
95008
95235
|
if (found) {
|
|
95009
95236
|
return found;
|
|
95010
95237
|
}
|
|
@@ -95015,9 +95242,9 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
95015
95242
|
continue;
|
|
95016
95243
|
}
|
|
95017
95244
|
for (const year of numericNamesDescending(listSafely(listDirectory, root))) {
|
|
95018
|
-
for (const month of numericNamesDescending(listSafely(listDirectory,
|
|
95019
|
-
for (const day of numericNamesDescending(listSafely(listDirectory,
|
|
95020
|
-
const found = scanDay(
|
|
95245
|
+
for (const month of numericNamesDescending(listSafely(listDirectory, join84(root, year)))) {
|
|
95246
|
+
for (const day of numericNamesDescending(listSafely(listDirectory, join84(root, year, month)))) {
|
|
95247
|
+
const found = scanDay(join84(root, year, month, day));
|
|
95021
95248
|
if (found) {
|
|
95022
95249
|
return found;
|
|
95023
95250
|
}
|
|
@@ -95177,7 +95404,7 @@ function uuidV7DayDirCandidates(sessionId) {
|
|
|
95177
95404
|
const candidates = [];
|
|
95178
95405
|
for (const offsetDays of [0, 1, -1]) {
|
|
95179
95406
|
const date5 = new Date(ms + offsetDays * DAY_MS);
|
|
95180
|
-
candidates.push(
|
|
95407
|
+
candidates.push(join84(String(date5.getFullYear()), pad2(date5.getMonth() + 1), pad2(date5.getDate())));
|
|
95181
95408
|
}
|
|
95182
95409
|
return candidates;
|
|
95183
95410
|
}
|
|
@@ -95215,10 +95442,10 @@ function isFalsy2(value) {
|
|
|
95215
95442
|
}
|
|
95216
95443
|
|
|
95217
95444
|
// packages/omo-opencode/src/cli/sparkshell-spark.ts
|
|
95218
|
-
import { spawnSync as
|
|
95445
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
95219
95446
|
import { mkdtempSync, readFileSync as readFileSync43, rmSync as rmSync4 } from "fs";
|
|
95220
95447
|
import { tmpdir as tmpdir4 } from "os";
|
|
95221
|
-
import { join as
|
|
95448
|
+
import { join as join85 } from "path";
|
|
95222
95449
|
var SPARKSHELL_SPARK_ENV = "OMO_SPARKSHELL_SPARK";
|
|
95223
95450
|
var SPARKSHELL_SPARK_MODEL_ENV = "OMO_SPARKSHELL_SPARK_MODEL";
|
|
95224
95451
|
var SPARKSHELL_SPARK_TIMEOUT_ENV = "OMO_SPARKSHELL_SPARK_TIMEOUT_MS";
|
|
@@ -95292,10 +95519,10 @@ function buildSparkExecArgs(env3, lastMessagePath) {
|
|
|
95292
95519
|
function createDefaultSparkSummarizer(env3, cwd) {
|
|
95293
95520
|
return (request) => {
|
|
95294
95521
|
const binary = env3[SPARKSHELL_SPARK_BIN_ENV]?.trim() || "codex";
|
|
95295
|
-
const tempDir = mkdtempSync(
|
|
95296
|
-
const lastMessagePath =
|
|
95522
|
+
const tempDir = mkdtempSync(join85(tmpdir4(), "omo-sparkshell-spark-"));
|
|
95523
|
+
const lastMessagePath = join85(tempDir, "last-message.txt");
|
|
95297
95524
|
try {
|
|
95298
|
-
const result =
|
|
95525
|
+
const result = spawnSync4(binary, [...buildSparkExecArgs(env3, lastMessagePath)], {
|
|
95299
95526
|
cwd,
|
|
95300
95527
|
env: { ...process.env, ...env3, [SPARKSHELL_SPARK_ENV]: "0" },
|
|
95301
95528
|
input: buildSparkSummaryPrompt(request),
|
|
@@ -95488,7 +95715,7 @@ function resolveNativeBinaryOverride(env3, cwd) {
|
|
|
95488
95715
|
if (override.length === 0) {
|
|
95489
95716
|
return "";
|
|
95490
95717
|
}
|
|
95491
|
-
return
|
|
95718
|
+
return isAbsolute11(override) || /^[A-Za-z]:[\\/]/.test(override) ? override : resolve24(cwd, override);
|
|
95492
95719
|
}
|
|
95493
95720
|
async function runAppServerCommand(args, appServerClient, options) {
|
|
95494
95721
|
let invocation;
|
|
@@ -95600,13 +95827,13 @@ function signalExitCode(signal) {
|
|
|
95600
95827
|
return typeof signalNumber === "number" && Number.isFinite(signalNumber) ? 128 + signalNumber : 1;
|
|
95601
95828
|
}
|
|
95602
95829
|
function defaultCommandExists(command) {
|
|
95603
|
-
const result =
|
|
95830
|
+
const result = spawnSync5(command, ["--version"], {
|
|
95604
95831
|
stdio: "ignore"
|
|
95605
95832
|
});
|
|
95606
95833
|
return result.error === undefined;
|
|
95607
95834
|
}
|
|
95608
95835
|
function defaultSpawn(command, args, options) {
|
|
95609
|
-
const result =
|
|
95836
|
+
const result = spawnSync5(command, [...args], {
|
|
95610
95837
|
cwd: options.cwd,
|
|
95611
95838
|
env: { ...process.env, ...options.env },
|
|
95612
95839
|
stdio: ["inherit", "pipe", "pipe"],
|