oh-my-opencode 4.12.0 → 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 +916 -670
- package/dist/cli-node/index.js +916 -670
- 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 +1042 -640
- 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 +34 -6
- package/dist/skills/ulw-plan/SKILL.md +4 -1
- package/dist/tools/background-task/constants.d.ts +1 -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 +18 -4
- package/package.json +16 -14
- package/packages/omo-codex/THIRD-PARTY-NOTICES.md +27 -4
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +3 -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 +633 -193
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +561 -44
- package/packages/omo-codex/plugin/components/codegraph/package.json +9 -3
- package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +11 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +12 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +34 -0
- package/packages/omo-codex/plugin/components/codegraph/src/mcp-unavailable.ts +75 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +66 -13
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +26 -12
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +50 -330
- 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 +2 -2
- 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-provision.test.ts +48 -0
- 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 -112
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +149 -0
- 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/dist/cli.js +94 -0
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +17 -0
- package/packages/omo-codex/plugin/components/teammode/package.json +26 -0
- 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/teammode/src/cli.ts +12 -0
- package/packages/omo-codex/plugin/components/teammode/src/codex-hook.ts +125 -0
- package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +116 -0
- package/packages/omo-codex/plugin/components/teammode/tsconfig.json +25 -0
- 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/hooks/post-tool-use-checking-codegraph-init-guidance.json +17 -0
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +17 -0
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +129 -12
- package/packages/omo-codex/plugin/package.json +3 -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/hook-status-message.mjs +1 -0
- 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 +34 -6
- 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/aggregate-hooks.test.mjs +36 -0
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +2 -1
- package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +1 -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-bundled-cli.test.mjs +1 -0
- package/packages/omo-codex/plugin/test/component-codegraph-mcp-smoke.test.mjs +76 -0
- package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +24 -0
- package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +1 -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 +78 -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 +531 -214
- 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 +34 -6
- 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
|
@@ -8,13 +8,208 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
|
8
8
|
|
|
9
9
|
// components/codegraph/src/hook.ts
|
|
10
10
|
import { spawn } from "node:child_process";
|
|
11
|
-
import { homedir as
|
|
11
|
+
import { homedir as homedir9 } from "node:os";
|
|
12
12
|
import { cwd as processCwd2, env as processEnv2, stdin as processStdin, stdout as processStdout } from "node:process";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
|
|
15
|
-
// ../../utils/src/
|
|
16
|
-
import {
|
|
15
|
+
// ../../utils/src/codegraph/guidance.ts
|
|
16
|
+
import { homedir as homedir2 } from "node:os";
|
|
17
|
+
|
|
18
|
+
// ../../utils/src/codegraph/workspace.ts
|
|
19
|
+
import { createHash } from "node:crypto";
|
|
20
|
+
import {
|
|
21
|
+
appendFileSync,
|
|
22
|
+
existsSync,
|
|
23
|
+
lstatSync,
|
|
24
|
+
mkdirSync,
|
|
25
|
+
readFileSync,
|
|
26
|
+
readdirSync,
|
|
27
|
+
realpathSync,
|
|
28
|
+
rmSync,
|
|
29
|
+
statSync,
|
|
30
|
+
symlinkSync
|
|
31
|
+
} from "node:fs";
|
|
17
32
|
import { homedir } from "node:os";
|
|
33
|
+
import { basename, join, resolve } from "node:path";
|
|
34
|
+
function sanitizeBase(value) {
|
|
35
|
+
const sanitized = value.replace(/[^A-Za-z0-9._-]/g, "-").replace(/-+/g, "-");
|
|
36
|
+
return sanitized.length > 0 ? sanitized : "workspace";
|
|
37
|
+
}
|
|
38
|
+
function codegraphDataRoot(homeDir) {
|
|
39
|
+
return join(homeDir, ".omo", "codegraph");
|
|
40
|
+
}
|
|
41
|
+
function workspaceStorageName(workspace) {
|
|
42
|
+
const resolved = resolve(workspace);
|
|
43
|
+
const hash = createHash("sha256").update(resolved).digest("hex").slice(0, 16);
|
|
44
|
+
return `${sanitizeBase(basename(resolved))}-${hash}`;
|
|
45
|
+
}
|
|
46
|
+
function resolveCodegraphWorkspacePaths(workspace, options = {}) {
|
|
47
|
+
const resolvedWorkspace = resolve(workspace);
|
|
48
|
+
const dataRoot = codegraphDataRoot(options.homeDir ?? homedir());
|
|
49
|
+
return {
|
|
50
|
+
dataDir: join(dataRoot, "projects", workspaceStorageName(resolvedWorkspace)),
|
|
51
|
+
dataRoot,
|
|
52
|
+
projectLink: join(resolvedWorkspace, ".codegraph")
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function fallbackResult(dataRoot, projectLink, reason) {
|
|
56
|
+
return { dataDir: projectLink, dataRoot, linked: false, mode: "in-place-fallback", projectLink, reason };
|
|
57
|
+
}
|
|
58
|
+
function isSameFilesystem(workspace, dataRoot, override) {
|
|
59
|
+
if (override !== undefined)
|
|
60
|
+
return override;
|
|
61
|
+
return statSync(workspace).dev === statSync(dataRoot).dev;
|
|
62
|
+
}
|
|
63
|
+
function ensureInPlaceFallback(projectLink) {
|
|
64
|
+
if (!existsSync(projectLink))
|
|
65
|
+
mkdirSync(projectLink, { recursive: true });
|
|
66
|
+
}
|
|
67
|
+
function prepareCodegraphWorkspace(workspace, options = {}) {
|
|
68
|
+
const resolvedWorkspace = resolve(workspace);
|
|
69
|
+
const { dataDir, dataRoot, projectLink } = resolveCodegraphWorkspacePaths(resolvedWorkspace, options);
|
|
70
|
+
try {
|
|
71
|
+
mkdirSync(dataDir, { recursive: true });
|
|
72
|
+
if (existsSync(projectLink)) {
|
|
73
|
+
const linkStat = lstatSync(projectLink);
|
|
74
|
+
if (!linkStat.isSymbolicLink()) {
|
|
75
|
+
return { dataDir: projectLink, dataRoot, linked: false, mode: "in-project", projectLink };
|
|
76
|
+
}
|
|
77
|
+
if (realpathSync(projectLink) === realpathSync(dataDir)) {
|
|
78
|
+
return { dataDir, dataRoot, linked: true, mode: "global-linked", projectLink };
|
|
79
|
+
}
|
|
80
|
+
return fallbackResult(dataRoot, projectLink, "existing .codegraph symlink points outside OMO store");
|
|
81
|
+
}
|
|
82
|
+
if (!isSameFilesystem(resolvedWorkspace, dataRoot, options.sameFilesystem)) {
|
|
83
|
+
ensureInPlaceFallback(projectLink);
|
|
84
|
+
return fallbackResult(dataRoot, projectLink, "workspace and OMO store are on different filesystems");
|
|
85
|
+
}
|
|
86
|
+
const symlink = options.symlink ?? symlinkSync;
|
|
87
|
+
symlink(dataDir, projectLink, (options.platform ?? process.platform) === "win32" ? "junction" : "dir");
|
|
88
|
+
return { dataDir, dataRoot, linked: true, mode: "global-linked", projectLink };
|
|
89
|
+
} catch (error) {
|
|
90
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
91
|
+
try {
|
|
92
|
+
ensureInPlaceFallback(projectLink);
|
|
93
|
+
} catch (fallbackError) {
|
|
94
|
+
return fallbackResult(dataRoot, projectLink, `${reason}; fallback failed: ${String(fallbackError)}`);
|
|
95
|
+
}
|
|
96
|
+
return fallbackResult(dataRoot, projectLink, reason);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function ensureCodegraphGitignored(workspace) {
|
|
100
|
+
const gitDir = join(workspace, ".git");
|
|
101
|
+
if (!existsSync(gitDir))
|
|
102
|
+
return false;
|
|
103
|
+
const excludePath = join(gitDir, "info", "exclude");
|
|
104
|
+
try {
|
|
105
|
+
mkdirSync(join(gitDir, "info"), { recursive: true });
|
|
106
|
+
const existing = existsSync(excludePath) ? readFileSync(excludePath, "utf8") : "";
|
|
107
|
+
if (existing.split(/\r?\n/).includes(".codegraph"))
|
|
108
|
+
return true;
|
|
109
|
+
appendFileSync(excludePath, `${existing.endsWith(`
|
|
110
|
+
`) || existing.length === 0 ? "" : `
|
|
111
|
+
`}.codegraph
|
|
112
|
+
`);
|
|
113
|
+
return true;
|
|
114
|
+
} catch (error) {
|
|
115
|
+
if (error instanceof Error)
|
|
116
|
+
return false;
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ../../utils/src/codegraph/guidance.ts
|
|
122
|
+
var CODEGRAPH_UNINITIALIZED_PATTERN = /CodeGraph not initialized in ([\s\S]*?)\.\s*Run ['`]codegraph init['`] in that project first\./i;
|
|
123
|
+
var ANSI_ESCAPE_PATTERN = /\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g;
|
|
124
|
+
var CODEGRAPH_STATUS_PROJECT_PATTERN = /^.*?\bProject:\s*(.+?)\s*$/im;
|
|
125
|
+
var CODEGRAPH_STATUS_UNINITIALIZED_PATTERN = /^.*?\bNot initialized\s*$/im;
|
|
126
|
+
var CODEGRAPH_INIT_HINT_PATTERN = /Run\s+["'`]codegraph init["'`]\s+(?:in that project first|to initialize)\.?/i;
|
|
127
|
+
function getCodegraphUninitializedProject(input) {
|
|
128
|
+
const output = textFromUnknown(input.toolOutput);
|
|
129
|
+
if (!isCodegraphTool(input.toolName))
|
|
130
|
+
return null;
|
|
131
|
+
const projectPath = extractProjectPath(output);
|
|
132
|
+
if (projectPath !== null)
|
|
133
|
+
return projectPath;
|
|
134
|
+
if (!looksLikeCodegraphUninitializedOutput(output))
|
|
135
|
+
return null;
|
|
136
|
+
return typeof input.cwd === "string" && input.cwd.trim().length > 0 ? input.cwd.trim() : null;
|
|
137
|
+
}
|
|
138
|
+
function buildCodegraphInitGuidance(projectPath, options = {}) {
|
|
139
|
+
const { dataDir, dataRoot, projectLink } = resolveCodegraphWorkspacePaths(projectPath, {
|
|
140
|
+
homeDir: options.homeDir ?? homedir2()
|
|
141
|
+
});
|
|
142
|
+
const displayProjectPath = formatDisplayPath(projectPath);
|
|
143
|
+
const displayProjectLink = formatDisplayPath(projectLink);
|
|
144
|
+
const displayDataDir = formatDisplayPath(dataDir);
|
|
145
|
+
const displayDataRoot = formatDisplayPath(dataRoot);
|
|
146
|
+
return [
|
|
147
|
+
"OMO CodeGraph initialization guidance:",
|
|
148
|
+
"",
|
|
149
|
+
`CodeGraph is not initialized for ${displayProjectPath}. Initialize it through OMO's global local store instead of leaving a standalone project-local index.`,
|
|
150
|
+
"",
|
|
151
|
+
`- Link or create ${displayProjectLink} so it points at ${displayDataDir} under the OMO store ${displayDataRoot}.`,
|
|
152
|
+
`- Then run \`codegraph init\` from ${displayProjectPath} and retry the CodeGraph tool.`,
|
|
153
|
+
"- OMO's CodeGraph bootstrap does this automatically on session start; if bootstrap just ran, wait for it to finish and retry."
|
|
154
|
+
].join(`
|
|
155
|
+
`);
|
|
156
|
+
}
|
|
157
|
+
function buildCodegraphInitGuidanceForToolResult(input, options = {}) {
|
|
158
|
+
const projectPath = getCodegraphUninitializedProject(input);
|
|
159
|
+
return projectPath === null ? null : buildCodegraphInitGuidance(projectPath, options);
|
|
160
|
+
}
|
|
161
|
+
function extractProjectPath(output) {
|
|
162
|
+
const normalizedOutput = normalizeCodegraphOutput(output);
|
|
163
|
+
const uninitializedMatch = normalizedOutput.match(CODEGRAPH_UNINITIALIZED_PATTERN);
|
|
164
|
+
const uninitializedProject = uninitializedMatch?.[1]?.trim();
|
|
165
|
+
if (uninitializedProject && uninitializedProject.length > 0)
|
|
166
|
+
return uninitializedProject;
|
|
167
|
+
if (!looksLikeCodegraphUninitializedOutput(normalizedOutput))
|
|
168
|
+
return null;
|
|
169
|
+
const statusMatch = normalizedOutput.match(CODEGRAPH_STATUS_PROJECT_PATTERN);
|
|
170
|
+
const statusProject = statusMatch?.[1]?.trim();
|
|
171
|
+
return statusProject && statusProject.length > 0 ? statusProject : null;
|
|
172
|
+
}
|
|
173
|
+
function looksLikeCodegraphUninitializedOutput(output) {
|
|
174
|
+
const normalizedOutput = normalizeCodegraphOutput(output);
|
|
175
|
+
if (normalizedOutput.match(CODEGRAPH_UNINITIALIZED_PATTERN) !== null)
|
|
176
|
+
return true;
|
|
177
|
+
return CODEGRAPH_STATUS_UNINITIALIZED_PATTERN.test(normalizedOutput) && CODEGRAPH_INIT_HINT_PATTERN.test(normalizedOutput);
|
|
178
|
+
}
|
|
179
|
+
function normalizeCodegraphOutput(output) {
|
|
180
|
+
return output.replace(ANSI_ESCAPE_PATTERN, "");
|
|
181
|
+
}
|
|
182
|
+
function isCodegraphTool(toolName) {
|
|
183
|
+
if (typeof toolName !== "string")
|
|
184
|
+
return false;
|
|
185
|
+
return toolName.startsWith("codegraph.") || toolName.startsWith("codegraph_") || toolName.startsWith("mcp__codegraph__");
|
|
186
|
+
}
|
|
187
|
+
function formatDisplayPath(value) {
|
|
188
|
+
return JSON.stringify(value);
|
|
189
|
+
}
|
|
190
|
+
function textFromUnknown(value) {
|
|
191
|
+
if (typeof value === "string")
|
|
192
|
+
return value;
|
|
193
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint")
|
|
194
|
+
return String(value);
|
|
195
|
+
if (Array.isArray(value))
|
|
196
|
+
return value.map(textFromUnknown).filter(Boolean).join(`
|
|
197
|
+
`);
|
|
198
|
+
if (!isRecord(value))
|
|
199
|
+
return "";
|
|
200
|
+
return Object.entries(value).map(([key, nested]) => `${key}: ${textFromUnknown(nested)}`).filter((line) => line.trim().length > 0).join(`
|
|
201
|
+
`);
|
|
202
|
+
}
|
|
203
|
+
function isRecord(value) {
|
|
204
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// shared/src/config-loader.ts
|
|
208
|
+
import { homedir as homedir4 } from "node:os";
|
|
209
|
+
|
|
210
|
+
// ../../utils/src/omo-config/loader.ts
|
|
211
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
|
|
212
|
+
import { homedir as homedir3 } from "node:os";
|
|
18
213
|
|
|
19
214
|
// ../../utils/src/deep-merge.ts
|
|
20
215
|
var DANGEROUS_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
@@ -970,22 +1165,22 @@ function buildEnvOverrides(harness, env, warnings, merge) {
|
|
|
970
1165
|
}
|
|
971
1166
|
|
|
972
1167
|
// ../../utils/src/omo-config/resolve.ts
|
|
973
|
-
import { existsSync } from "node:fs";
|
|
974
|
-
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
1168
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
1169
|
+
import { dirname, isAbsolute, join as join2, relative, resolve as resolve2 } from "node:path";
|
|
975
1170
|
function containsPath(parent, child) {
|
|
976
1171
|
const pathToChild = relative(parent, child);
|
|
977
1172
|
return pathToChild === "" || !pathToChild.startsWith("..") && !isAbsolute(pathToChild);
|
|
978
1173
|
}
|
|
979
1174
|
function findProjectConfigPathsNearestFirst(cwd, homeDir) {
|
|
980
|
-
const startDir =
|
|
981
|
-
const stopBeforeDir = containsPath(
|
|
1175
|
+
const startDir = resolve2(cwd);
|
|
1176
|
+
const stopBeforeDir = containsPath(resolve2(homeDir), startDir) ? resolve2(homeDir) : null;
|
|
982
1177
|
const paths = [];
|
|
983
1178
|
let currentDir = startDir;
|
|
984
1179
|
while (true) {
|
|
985
1180
|
if (stopBeforeDir !== null && currentDir === stopBeforeDir)
|
|
986
1181
|
break;
|
|
987
|
-
const configPath =
|
|
988
|
-
if (
|
|
1182
|
+
const configPath = join2(currentDir, ".omo", "config.jsonc");
|
|
1183
|
+
if (existsSync2(configPath)) {
|
|
989
1184
|
paths.push(configPath);
|
|
990
1185
|
}
|
|
991
1186
|
const parentDir = dirname(currentDir);
|
|
@@ -996,7 +1191,7 @@ function findProjectConfigPathsNearestFirst(cwd, homeDir) {
|
|
|
996
1191
|
return paths;
|
|
997
1192
|
}
|
|
998
1193
|
function resolveOmoConfigPaths(options) {
|
|
999
|
-
const globalPath =
|
|
1194
|
+
const globalPath = join2(resolve2(options.homeDir), ".omo", "config.jsonc");
|
|
1000
1195
|
const projectPathsFarthestFirst = findProjectConfigPathsNearestFirst(options.cwd, options.homeDir).reverse();
|
|
1001
1196
|
return [
|
|
1002
1197
|
{ path: globalPath, scope: "global" },
|
|
@@ -1028,7 +1223,7 @@ var CODEGRAPH_SETTING_KEYS = [
|
|
|
1028
1223
|
"telemetry",
|
|
1029
1224
|
"watch_debounce_ms"
|
|
1030
1225
|
];
|
|
1031
|
-
function
|
|
1226
|
+
function isRecord2(value) {
|
|
1032
1227
|
return isPlainObject(value);
|
|
1033
1228
|
}
|
|
1034
1229
|
function hasOwn(record, key) {
|
|
@@ -1056,7 +1251,7 @@ function mergeValues(base, override) {
|
|
|
1056
1251
|
}
|
|
1057
1252
|
function mergeCodegraphConfig(base, override) {
|
|
1058
1253
|
const merged = mergeValues(base, override);
|
|
1059
|
-
if (!
|
|
1254
|
+
if (!isRecord2(merged))
|
|
1060
1255
|
return;
|
|
1061
1256
|
const codegraph = {};
|
|
1062
1257
|
for (const key of CODEGRAPH_SETTING_KEYS) {
|
|
@@ -1111,7 +1306,7 @@ function setCodegraphSetting2(config, key, value) {
|
|
|
1111
1306
|
}
|
|
1112
1307
|
}
|
|
1113
1308
|
function normalizeCodegraphSection(section, pathPrefix, warnings) {
|
|
1114
|
-
if (!
|
|
1309
|
+
if (!isRecord2(section)) {
|
|
1115
1310
|
warnings.push(`${pathPrefix} must be an object`);
|
|
1116
1311
|
return {};
|
|
1117
1312
|
}
|
|
@@ -1131,7 +1326,7 @@ function normalizeCodegraphSection(section, pathPrefix, warnings) {
|
|
|
1131
1326
|
return codegraph;
|
|
1132
1327
|
}
|
|
1133
1328
|
function normalizeConfigBody(value, pathPrefix, warnings) {
|
|
1134
|
-
if (!
|
|
1329
|
+
if (!isRecord2(value)) {
|
|
1135
1330
|
warnings.push(`${pathPrefix} must be an object`);
|
|
1136
1331
|
return {};
|
|
1137
1332
|
}
|
|
@@ -1152,7 +1347,7 @@ function normalizeConfigBody(value, pathPrefix, warnings) {
|
|
|
1152
1347
|
return config;
|
|
1153
1348
|
}
|
|
1154
1349
|
function normalizeActiveHarnessBlock(value, harness, pathPrefix, warnings) {
|
|
1155
|
-
if (!
|
|
1350
|
+
if (!isRecord2(value))
|
|
1156
1351
|
return {};
|
|
1157
1352
|
const blockKey = `[${harness}]`;
|
|
1158
1353
|
if (!hasOwn(value, blockKey))
|
|
@@ -1161,7 +1356,7 @@ function normalizeActiveHarnessBlock(value, harness, pathPrefix, warnings) {
|
|
|
1161
1356
|
}
|
|
1162
1357
|
function loadConfigFile(path, harness) {
|
|
1163
1358
|
try {
|
|
1164
|
-
const content =
|
|
1359
|
+
const content = readFileSync2(path, "utf-8");
|
|
1165
1360
|
const parsed = parseJsoncSafe(content);
|
|
1166
1361
|
if (parsed.errors.length > 0) {
|
|
1167
1362
|
return {
|
|
@@ -1207,13 +1402,13 @@ function validateHarnessApplicability(config, harness) {
|
|
|
1207
1402
|
}
|
|
1208
1403
|
function loadOmoConfig(options) {
|
|
1209
1404
|
const cwd = options.cwd ?? process.cwd();
|
|
1210
|
-
const homeDir = options.homeDir ?? process.env["HOME"] ?? process.env["USERPROFILE"] ??
|
|
1405
|
+
const homeDir = options.homeDir ?? process.env["HOME"] ?? process.env["USERPROFILE"] ?? homedir3();
|
|
1211
1406
|
const env = options.env ?? process.env;
|
|
1212
1407
|
let config = BUILT_IN_DEFAULTS;
|
|
1213
1408
|
const sources = [];
|
|
1214
1409
|
const warnings = [];
|
|
1215
1410
|
for (const candidate of resolveOmoConfigPaths({ cwd, homeDir })) {
|
|
1216
|
-
if (!
|
|
1411
|
+
if (!existsSync3(candidate.path)) {
|
|
1217
1412
|
if (candidate.scope === "global") {
|
|
1218
1413
|
sources.push(toMissingSource(candidate));
|
|
1219
1414
|
}
|
|
@@ -1237,37 +1432,51 @@ function loadOmoConfig(options) {
|
|
|
1237
1432
|
|
|
1238
1433
|
// shared/src/config-loader.ts
|
|
1239
1434
|
function getCodexOmoConfig(options = {}) {
|
|
1435
|
+
const env = options.env ?? process.env;
|
|
1436
|
+
const homeDir = resolveHomeDir(options);
|
|
1240
1437
|
const result = loadOmoConfig({
|
|
1241
1438
|
...options.cwd === undefined ? {} : { cwd: options.cwd },
|
|
1242
|
-
|
|
1243
|
-
|
|
1439
|
+
env,
|
|
1440
|
+
homeDir,
|
|
1441
|
+
harness: "codex"
|
|
1442
|
+
});
|
|
1443
|
+
const trustedConfig = loadOmoConfig({
|
|
1444
|
+
cwd: homeDir,
|
|
1445
|
+
env,
|
|
1446
|
+
homeDir,
|
|
1244
1447
|
harness: "codex"
|
|
1245
1448
|
});
|
|
1449
|
+
const trustedCodegraphInstallDir = trustedConfig.config.codegraph?.install_dir;
|
|
1246
1450
|
return {
|
|
1247
1451
|
...result.config,
|
|
1248
1452
|
sources: result.sources,
|
|
1453
|
+
...trustedCodegraphInstallDir === undefined ? {} : { trustedCodegraphInstallDir },
|
|
1249
1454
|
warnings: result.warnings
|
|
1250
1455
|
};
|
|
1251
1456
|
}
|
|
1457
|
+
function resolveHomeDir(options) {
|
|
1458
|
+
const env = options.env ?? process.env;
|
|
1459
|
+
return options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir4();
|
|
1460
|
+
}
|
|
1252
1461
|
|
|
1253
1462
|
// components/codegraph/src/session-start-worker.ts
|
|
1254
1463
|
import { execFile as execFile2 } from "node:child_process";
|
|
1255
1464
|
import { appendFileSync as appendFileSync2, existsSync as existsSync6, mkdirSync as mkdirSync2 } from "node:fs";
|
|
1256
|
-
import { homedir as
|
|
1465
|
+
import { homedir as homedir8 } from "node:os";
|
|
1257
1466
|
import { extname, join as join7 } from "node:path";
|
|
1258
1467
|
import { cwd as processCwd, env as processEnv, stderr as processStderr } from "node:process";
|
|
1259
1468
|
|
|
1260
1469
|
// ../../utils/src/codegraph/env.ts
|
|
1261
|
-
import { homedir as
|
|
1262
|
-
import { join as
|
|
1470
|
+
import { homedir as homedir5 } from "node:os";
|
|
1471
|
+
import { join as join3 } from "node:path";
|
|
1263
1472
|
var CODEGRAPH_INSTALL_DIR_ENV = "CODEGRAPH_INSTALL_DIR";
|
|
1264
1473
|
var CODEGRAPH_NO_DOWNLOAD_ENV = "CODEGRAPH_NO_DOWNLOAD";
|
|
1265
1474
|
var CODEGRAPH_TELEMETRY_ENV = "CODEGRAPH_TELEMETRY";
|
|
1266
1475
|
var DO_NOT_TRACK_ENV = "DO_NOT_TRACK";
|
|
1267
1476
|
function buildCodegraphEnv(options = {}) {
|
|
1268
|
-
const homeDir = options.homeDir ??
|
|
1477
|
+
const homeDir = options.homeDir ?? homedir5();
|
|
1269
1478
|
return {
|
|
1270
|
-
[CODEGRAPH_INSTALL_DIR_ENV]:
|
|
1479
|
+
[CODEGRAPH_INSTALL_DIR_ENV]: join3(homeDir, ".omo", "codegraph"),
|
|
1271
1480
|
[CODEGRAPH_NO_DOWNLOAD_ENV]: "1",
|
|
1272
1481
|
[CODEGRAPH_TELEMETRY_ENV]: "0",
|
|
1273
1482
|
[DO_NOT_TRACK_ENV]: "1"
|
|
@@ -1304,12 +1513,12 @@ function parseNodeMajor(version) {
|
|
|
1304
1513
|
}
|
|
1305
1514
|
|
|
1306
1515
|
// ../../utils/src/codegraph/provision.ts
|
|
1307
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
1516
|
+
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
1308
1517
|
import { execFile } from "node:child_process";
|
|
1309
1518
|
import { chmod, mkdir, readdir, readFile, rename, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
1310
|
-
import { existsSync as
|
|
1311
|
-
import { homedir as
|
|
1312
|
-
import { basename, join as
|
|
1519
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
1520
|
+
import { homedir as homedir6, hostname } from "node:os";
|
|
1521
|
+
import { basename as basename2, join as join4 } from "node:path";
|
|
1313
1522
|
import { promisify } from "node:util";
|
|
1314
1523
|
|
|
1315
1524
|
// ../../utils/src/codegraph/manifest.ts
|
|
@@ -1358,13 +1567,13 @@ function platformKey() {
|
|
|
1358
1567
|
return `${process.platform}-${process.arch}`;
|
|
1359
1568
|
}
|
|
1360
1569
|
function markerPath(installDir, version) {
|
|
1361
|
-
return
|
|
1570
|
+
return join4(installDir, ".provisioned", `codegraph-${version}.json`);
|
|
1362
1571
|
}
|
|
1363
1572
|
function defaultInstallDir() {
|
|
1364
|
-
return
|
|
1573
|
+
return join4(homedir6(), ".omo", "codegraph");
|
|
1365
1574
|
}
|
|
1366
1575
|
function sha256(bytes) {
|
|
1367
|
-
return
|
|
1576
|
+
return createHash2("sha256").update(bytes).digest("hex");
|
|
1368
1577
|
}
|
|
1369
1578
|
function isErrnoException(error) {
|
|
1370
1579
|
return error instanceof Error && "code" in error;
|
|
@@ -1381,7 +1590,7 @@ async function removeEmptyDirectory(path) {
|
|
|
1381
1590
|
}
|
|
1382
1591
|
}
|
|
1383
1592
|
function sleep(ms) {
|
|
1384
|
-
return new Promise((
|
|
1593
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
1385
1594
|
}
|
|
1386
1595
|
async function defaultDownloader(asset, timeoutMs = DEFAULT_DOWNLOAD_TIMEOUT_MS) {
|
|
1387
1596
|
const response = await fetch(asset.url, { signal: AbortSignal.timeout(timeoutMs) });
|
|
@@ -1395,7 +1604,7 @@ function forcedBadChecksumOptions(options) {
|
|
|
1395
1604
|
const key = options.platformKey ?? platformKey();
|
|
1396
1605
|
return {
|
|
1397
1606
|
downloader: async () => new TextEncoder().encode("checksum mismatch"),
|
|
1398
|
-
installDir: options.installDir ??
|
|
1607
|
+
installDir: options.installDir ?? join4(options.lockDir, "codegraph-force-bad-checksum"),
|
|
1399
1608
|
manifest: {
|
|
1400
1609
|
assets: {
|
|
1401
1610
|
[key]: { executableName: process.platform === "win32" ? "codegraph.cmd" : "codegraph", sha256: "0000", url: "memory://bad" }
|
|
@@ -1406,13 +1615,13 @@ function forcedBadChecksumOptions(options) {
|
|
|
1406
1615
|
};
|
|
1407
1616
|
}
|
|
1408
1617
|
async function readMarker(path) {
|
|
1409
|
-
if (!
|
|
1618
|
+
if (!existsSync4(path))
|
|
1410
1619
|
return null;
|
|
1411
1620
|
try {
|
|
1412
1621
|
const raw = JSON.parse(await readFile(path, "utf8"));
|
|
1413
1622
|
if (typeof raw === "object" && raw !== null && "binPath" in raw) {
|
|
1414
1623
|
const value = raw.binPath;
|
|
1415
|
-
return typeof value === "string" &&
|
|
1624
|
+
return typeof value === "string" && existsSync4(value) ? value : null;
|
|
1416
1625
|
}
|
|
1417
1626
|
return null;
|
|
1418
1627
|
} catch (error) {
|
|
@@ -1423,7 +1632,7 @@ async function readMarker(path) {
|
|
|
1423
1632
|
}
|
|
1424
1633
|
async function acquireLock(lockPath, waitMs, staleMs) {
|
|
1425
1634
|
const startedAt = Date.now();
|
|
1426
|
-
await mkdir(
|
|
1635
|
+
await mkdir(join4(lockPath, ".."), { recursive: true });
|
|
1427
1636
|
while (Date.now() - startedAt <= waitMs) {
|
|
1428
1637
|
try {
|
|
1429
1638
|
await mkdir(lockPath);
|
|
@@ -1448,44 +1657,44 @@ async function installExtractedBundle(extractDir, installDir, executableName) {
|
|
|
1448
1657
|
const roots = await readdir(extractDir);
|
|
1449
1658
|
if (roots.length !== 1)
|
|
1450
1659
|
throw new Error(`CodeGraph archive should contain one root directory, found ${roots.length}`);
|
|
1451
|
-
const bundleDir =
|
|
1660
|
+
const bundleDir = join4(extractDir, roots[0] ?? "");
|
|
1452
1661
|
const bundleEntries = await readdir(bundleDir);
|
|
1453
1662
|
await mkdir(installDir, { recursive: true });
|
|
1454
1663
|
for (const entry of bundleEntries) {
|
|
1455
|
-
await rm(
|
|
1456
|
-
await rename(
|
|
1664
|
+
await rm(join4(installDir, entry), { force: true, recursive: true });
|
|
1665
|
+
await rename(join4(bundleDir, entry), join4(installDir, entry));
|
|
1457
1666
|
}
|
|
1458
|
-
const destination =
|
|
1459
|
-
if (!
|
|
1667
|
+
const destination = join4(installDir, "bin", executableName);
|
|
1668
|
+
if (!existsSync4(destination))
|
|
1460
1669
|
throw new Error(`CodeGraph archive did not contain bin/${executableName}`);
|
|
1461
1670
|
await chmod(destination, 493);
|
|
1462
1671
|
return destination;
|
|
1463
1672
|
}
|
|
1464
1673
|
async function installAsset(layout) {
|
|
1465
1674
|
const { asset, downloader, installDir, version } = layout;
|
|
1466
|
-
const stagingDir =
|
|
1467
|
-
const archivePath =
|
|
1468
|
-
const extractDir =
|
|
1675
|
+
const stagingDir = join4(installDir, ".staging", randomUUID());
|
|
1676
|
+
const archivePath = join4(stagingDir, basename2(asset.url));
|
|
1677
|
+
const extractDir = join4(stagingDir, "extract");
|
|
1469
1678
|
try {
|
|
1470
1679
|
await mkdir(extractDir, { recursive: true });
|
|
1471
1680
|
const bytes = await downloader(asset);
|
|
1472
1681
|
const actualChecksum = sha256(bytes);
|
|
1473
1682
|
if (actualChecksum !== asset.sha256) {
|
|
1474
|
-
throw new Error(`checksum mismatch for ${
|
|
1683
|
+
throw new Error(`checksum mismatch for ${basename2(asset.url)}: expected ${asset.sha256}, got ${actualChecksum}`);
|
|
1475
1684
|
}
|
|
1476
1685
|
if (!asset.url.endsWith(".tar.gz") && !asset.url.endsWith(".tgz")) {
|
|
1477
|
-
throw new Error(`unsupported CodeGraph archive type for ${
|
|
1686
|
+
throw new Error(`unsupported CodeGraph archive type for ${basename2(asset.url)}`);
|
|
1478
1687
|
}
|
|
1479
1688
|
await writeFile(archivePath, bytes);
|
|
1480
1689
|
await extractTarGz(archivePath, extractDir);
|
|
1481
1690
|
const destination = await installExtractedBundle(extractDir, installDir, asset.executableName);
|
|
1482
|
-
await mkdir(
|
|
1691
|
+
await mkdir(join4(installDir, ".provisioned"), { recursive: true });
|
|
1483
1692
|
await writeFile(markerPath(installDir, version), `${JSON.stringify({ binPath: destination, version })}
|
|
1484
1693
|
`);
|
|
1485
1694
|
return destination;
|
|
1486
1695
|
} finally {
|
|
1487
1696
|
await rm(stagingDir, { force: true, recursive: true });
|
|
1488
|
-
await removeEmptyDirectory(
|
|
1697
|
+
await removeEmptyDirectory(join4(installDir, ".staging"));
|
|
1489
1698
|
}
|
|
1490
1699
|
}
|
|
1491
1700
|
async function ensureCodegraphProvisioned(options) {
|
|
@@ -1498,7 +1707,7 @@ async function ensureCodegraphProvisioned(options) {
|
|
|
1498
1707
|
const existing = await readMarker(marker);
|
|
1499
1708
|
if (existing !== null)
|
|
1500
1709
|
return { binPath: existing, provisioned: true };
|
|
1501
|
-
const lockPath =
|
|
1710
|
+
const lockPath = join4(options.lockDir, `codegraph-${hostname()}.lock`);
|
|
1502
1711
|
const release = await acquireLock(lockPath, options.lockWaitMs ?? DEFAULT_LOCK_WAIT_MS, options.lockStaleMs ?? DEFAULT_LOCK_STALE_MS);
|
|
1503
1712
|
if (release === null)
|
|
1504
1713
|
return { error: "timed out waiting for codegraph provisioning lock", provisioned: false };
|
|
@@ -1523,15 +1732,15 @@ async function ensureCodegraphProvisioned(options) {
|
|
|
1523
1732
|
}
|
|
1524
1733
|
|
|
1525
1734
|
// ../../utils/src/codegraph/resolve.ts
|
|
1526
|
-
import { existsSync as
|
|
1527
|
-
import { homedir as
|
|
1735
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
1736
|
+
import { homedir as homedir7 } from "node:os";
|
|
1528
1737
|
import { spawnSync } from "node:child_process";
|
|
1529
|
-
import { basename as
|
|
1738
|
+
import { basename as basename3, dirname as dirname2, join as join6 } from "node:path";
|
|
1530
1739
|
import { createRequire } from "node:module";
|
|
1531
1740
|
|
|
1532
1741
|
// ../../utils/src/runtime/which.ts
|
|
1533
1742
|
import { accessSync, constants } from "node:fs";
|
|
1534
|
-
import { delimiter, join as
|
|
1743
|
+
import { delimiter, join as join5 } from "node:path";
|
|
1535
1744
|
var runtime = globalThis;
|
|
1536
1745
|
function isUnsafeCommandName(commandName) {
|
|
1537
1746
|
if (commandName.includes("/") || commandName.includes("\\"))
|
|
@@ -1586,7 +1795,7 @@ function bunWhich(commandName) {
|
|
|
1586
1795
|
return null;
|
|
1587
1796
|
for (const pathEntry of pathEntries) {
|
|
1588
1797
|
for (const candidateName of candidateNames) {
|
|
1589
|
-
const candidatePath =
|
|
1798
|
+
const candidatePath = join5(pathEntry, candidateName);
|
|
1590
1799
|
if (isExecutable(candidatePath))
|
|
1591
1800
|
return candidatePath;
|
|
1592
1801
|
}
|
|
@@ -1627,7 +1836,7 @@ ${result.stderr}`.trim().split(/\s+/)[0];
|
|
|
1627
1836
|
}
|
|
1628
1837
|
}
|
|
1629
1838
|
function isNodeExecutableName(filePath) {
|
|
1630
|
-
const executable =
|
|
1839
|
+
const executable = basename3(filePath).toLowerCase();
|
|
1631
1840
|
return executable === "node" || executable === "node.exe" || /^node\d+(\.exe)?$/.test(executable);
|
|
1632
1841
|
}
|
|
1633
1842
|
function looksLikePath(command) {
|
|
@@ -1667,8 +1876,8 @@ function defaultNodeRuntime(env, fileExists, which, nodeVersion) {
|
|
|
1667
1876
|
function defaultProvisionedBin(homeDir, fileExists) {
|
|
1668
1877
|
const binaryName = process.platform === "win32" ? "codegraph.cmd" : "codegraph";
|
|
1669
1878
|
const candidates = [
|
|
1670
|
-
|
|
1671
|
-
|
|
1879
|
+
join6(homeDir, ".omo", "codegraph", "bin", binaryName),
|
|
1880
|
+
join6(homeDir, ".omo", "codegraph", "node-servers", "node_modules", ".bin", binaryName)
|
|
1672
1881
|
];
|
|
1673
1882
|
return candidates.find((candidate) => fileExists(candidate)) ?? null;
|
|
1674
1883
|
}
|
|
@@ -1676,7 +1885,7 @@ function resolveBundledShim(requireResolve, fileExists) {
|
|
|
1676
1885
|
try {
|
|
1677
1886
|
const packageJson = requireResolve(`${CODEGRAPH_PACKAGE}/package.json`);
|
|
1678
1887
|
const packageRoot = dirname2(packageJson);
|
|
1679
|
-
const candidates = [
|
|
1888
|
+
const candidates = [join6(packageRoot, "bin", "codegraph.js"), join6(packageRoot, "npm-shim.js")];
|
|
1680
1889
|
return candidates.find((candidate) => fileExists(candidate)) ?? null;
|
|
1681
1890
|
} catch (error) {
|
|
1682
1891
|
if (error instanceof Error)
|
|
@@ -1692,7 +1901,7 @@ function resolveBundledShim(requireResolve, fileExists) {
|
|
|
1692
1901
|
}
|
|
1693
1902
|
function resolveCodegraphCommand(options = {}) {
|
|
1694
1903
|
const env = options.env ?? process.env;
|
|
1695
|
-
const fileExists = options.fileExists ??
|
|
1904
|
+
const fileExists = options.fileExists ?? existsSync5;
|
|
1696
1905
|
const configuredBin = env[CODEGRAPH_ENV_BIN]?.trim() || env[CODEGRAPH_LEGACY_ENV_BIN]?.trim();
|
|
1697
1906
|
if (configuredBin !== undefined && configuredBin.length > 0) {
|
|
1698
1907
|
return { argsPrefix: [], command: configuredBin, exists: fileExists(configuredBin), source: "env" };
|
|
@@ -1704,7 +1913,7 @@ function resolveCodegraphCommand(options = {}) {
|
|
|
1704
1913
|
if (bundled !== null && runtime2 !== null) {
|
|
1705
1914
|
return { argsPrefix: [bundled], command: runtime2, exists: true, source: "bundled" };
|
|
1706
1915
|
}
|
|
1707
|
-
const provisioned = options.provisioned?.() ?? defaultProvisionedBin(options.homeDir ??
|
|
1916
|
+
const provisioned = options.provisioned?.() ?? defaultProvisionedBin(options.homeDir ?? homedir7(), fileExists);
|
|
1708
1917
|
if (provisioned !== null && fileExists(provisioned)) {
|
|
1709
1918
|
return { argsPrefix: [], command: provisioned, exists: true, source: "provisioned" };
|
|
1710
1919
|
}
|
|
@@ -1717,102 +1926,6 @@ function resolveCodegraphCommand(options = {}) {
|
|
|
1717
1926
|
};
|
|
1718
1927
|
}
|
|
1719
1928
|
|
|
1720
|
-
// ../../utils/src/codegraph/workspace.ts
|
|
1721
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
1722
|
-
import {
|
|
1723
|
-
appendFileSync,
|
|
1724
|
-
existsSync as existsSync5,
|
|
1725
|
-
lstatSync,
|
|
1726
|
-
mkdirSync,
|
|
1727
|
-
readFileSync as readFileSync2,
|
|
1728
|
-
readdirSync,
|
|
1729
|
-
realpathSync,
|
|
1730
|
-
rmSync,
|
|
1731
|
-
statSync,
|
|
1732
|
-
symlinkSync
|
|
1733
|
-
} from "node:fs";
|
|
1734
|
-
import { homedir as homedir5 } from "node:os";
|
|
1735
|
-
import { basename as basename3, join as join6, resolve as resolve2 } from "node:path";
|
|
1736
|
-
function sanitizeBase(value) {
|
|
1737
|
-
const sanitized = value.replace(/[^A-Za-z0-9._-]/g, "-").replace(/-+/g, "-");
|
|
1738
|
-
return sanitized.length > 0 ? sanitized : "workspace";
|
|
1739
|
-
}
|
|
1740
|
-
function codegraphDataRoot(homeDir) {
|
|
1741
|
-
return join6(homeDir, ".omo", "codegraph");
|
|
1742
|
-
}
|
|
1743
|
-
function workspaceStorageName(workspace) {
|
|
1744
|
-
const resolved = resolve2(workspace);
|
|
1745
|
-
const hash = createHash2("sha256").update(resolved).digest("hex").slice(0, 16);
|
|
1746
|
-
return `${sanitizeBase(basename3(resolved))}-${hash}`;
|
|
1747
|
-
}
|
|
1748
|
-
function fallbackResult(dataRoot, projectLink, reason) {
|
|
1749
|
-
return { dataDir: projectLink, dataRoot, linked: false, mode: "in-place-fallback", projectLink, reason };
|
|
1750
|
-
}
|
|
1751
|
-
function isSameFilesystem(workspace, dataRoot, override) {
|
|
1752
|
-
if (override !== undefined)
|
|
1753
|
-
return override;
|
|
1754
|
-
return statSync(workspace).dev === statSync(dataRoot).dev;
|
|
1755
|
-
}
|
|
1756
|
-
function ensureInPlaceFallback(projectLink) {
|
|
1757
|
-
if (!existsSync5(projectLink))
|
|
1758
|
-
mkdirSync(projectLink, { recursive: true });
|
|
1759
|
-
}
|
|
1760
|
-
function prepareCodegraphWorkspace(workspace, options = {}) {
|
|
1761
|
-
const resolvedWorkspace = resolve2(workspace);
|
|
1762
|
-
const dataRoot = codegraphDataRoot(options.homeDir ?? homedir5());
|
|
1763
|
-
const dataDir = join6(dataRoot, "projects", workspaceStorageName(resolvedWorkspace));
|
|
1764
|
-
const projectLink = join6(resolvedWorkspace, ".codegraph");
|
|
1765
|
-
try {
|
|
1766
|
-
mkdirSync(dataDir, { recursive: true });
|
|
1767
|
-
if (existsSync5(projectLink)) {
|
|
1768
|
-
const linkStat = lstatSync(projectLink);
|
|
1769
|
-
if (!linkStat.isSymbolicLink()) {
|
|
1770
|
-
return { dataDir: projectLink, dataRoot, linked: false, mode: "in-project", projectLink };
|
|
1771
|
-
}
|
|
1772
|
-
if (realpathSync(projectLink) === realpathSync(dataDir)) {
|
|
1773
|
-
return { dataDir, dataRoot, linked: true, mode: "global-linked", projectLink };
|
|
1774
|
-
}
|
|
1775
|
-
return fallbackResult(dataRoot, projectLink, "existing .codegraph symlink points outside OMO store");
|
|
1776
|
-
}
|
|
1777
|
-
if (!isSameFilesystem(resolvedWorkspace, dataRoot, options.sameFilesystem)) {
|
|
1778
|
-
ensureInPlaceFallback(projectLink);
|
|
1779
|
-
return fallbackResult(dataRoot, projectLink, "workspace and OMO store are on different filesystems");
|
|
1780
|
-
}
|
|
1781
|
-
const symlink = options.symlink ?? symlinkSync;
|
|
1782
|
-
symlink(dataDir, projectLink, (options.platform ?? process.platform) === "win32" ? "junction" : "dir");
|
|
1783
|
-
return { dataDir, dataRoot, linked: true, mode: "global-linked", projectLink };
|
|
1784
|
-
} catch (error) {
|
|
1785
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
1786
|
-
try {
|
|
1787
|
-
ensureInPlaceFallback(projectLink);
|
|
1788
|
-
} catch (fallbackError) {
|
|
1789
|
-
return fallbackResult(dataRoot, projectLink, `${reason}; fallback failed: ${String(fallbackError)}`);
|
|
1790
|
-
}
|
|
1791
|
-
return fallbackResult(dataRoot, projectLink, reason);
|
|
1792
|
-
}
|
|
1793
|
-
}
|
|
1794
|
-
function ensureCodegraphGitignored(workspace) {
|
|
1795
|
-
const gitDir = join6(workspace, ".git");
|
|
1796
|
-
if (!existsSync5(gitDir))
|
|
1797
|
-
return false;
|
|
1798
|
-
const excludePath = join6(gitDir, "info", "exclude");
|
|
1799
|
-
try {
|
|
1800
|
-
mkdirSync(join6(gitDir, "info"), { recursive: true });
|
|
1801
|
-
const existing = existsSync5(excludePath) ? readFileSync2(excludePath, "utf8") : "";
|
|
1802
|
-
if (existing.split(/\r?\n/).includes(".codegraph"))
|
|
1803
|
-
return true;
|
|
1804
|
-
appendFileSync(excludePath, `${existing.endsWith(`
|
|
1805
|
-
`) || existing.length === 0 ? "" : `
|
|
1806
|
-
`}.codegraph
|
|
1807
|
-
`);
|
|
1808
|
-
return true;
|
|
1809
|
-
} catch (error) {
|
|
1810
|
-
if (error instanceof Error)
|
|
1811
|
-
return false;
|
|
1812
|
-
throw error;
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
1929
|
// components/codegraph/src/session-start-worker.ts
|
|
1817
1930
|
var SESSION_START_CWD_ENV = "OMO_CODEGRAPH_SESSION_START_CWD";
|
|
1818
1931
|
var CODEGRAPH_VERSION = "1.0.1";
|
|
@@ -1827,7 +1940,7 @@ var defaultDeps = {
|
|
|
1827
1940
|
};
|
|
1828
1941
|
async function runCodegraphSessionStartWorker(options = {}) {
|
|
1829
1942
|
const env = options.env ?? processEnv;
|
|
1830
|
-
const homeDir =
|
|
1943
|
+
const homeDir = resolveHomeDir2(env);
|
|
1831
1944
|
const projectRoot = options.cwd ?? env[SESSION_START_CWD_ENV] ?? processCwd();
|
|
1832
1945
|
const config = options.config ?? getCodexOmoConfig({ cwd: projectRoot, env, homeDir });
|
|
1833
1946
|
const logOutcome = options.logOutcome ?? ((outcome) => appendOutcome(homeDir, outcome));
|
|
@@ -1835,7 +1948,11 @@ async function runCodegraphSessionStartWorker(options = {}) {
|
|
|
1835
1948
|
return finish("skipped-disabled", { projectRoot }, logOutcome);
|
|
1836
1949
|
}
|
|
1837
1950
|
const nodeSupport = evaluateCodegraphNodeSupport({ env, nodeVersion: options.nodeVersion });
|
|
1838
|
-
|
|
1951
|
+
const bootstrapConfig = {
|
|
1952
|
+
...config.codegraph ?? {},
|
|
1953
|
+
...config.trustedCodegraphInstallDir === undefined ? {} : { trustedCodegraphInstallDir: config.trustedCodegraphInstallDir }
|
|
1954
|
+
};
|
|
1955
|
+
return runBootstrap(projectRoot, bootstrapConfig, env, homeDir, nodeSupport, { ...defaultDeps, ...options.deps }, logOutcome);
|
|
1839
1956
|
}
|
|
1840
1957
|
async function runBootstrap(projectRoot, config, env, homeDir, nodeSupport, deps, logOutcome) {
|
|
1841
1958
|
try {
|
|
@@ -1848,7 +1965,7 @@ async function runBootstrap(projectRoot, config, env, homeDir, nodeSupport, deps
|
|
|
1848
1965
|
}
|
|
1849
1966
|
deps.prepareWorkspace(projectRoot, { homeDir });
|
|
1850
1967
|
deps.ensureGitignored(projectRoot);
|
|
1851
|
-
const codegraphEnv = config
|
|
1968
|
+
const codegraphEnv = codegraphEnvForConfig(config, homeDir);
|
|
1852
1969
|
const status = await deps.runCommand(projectRoot, command.resolution.command, [...command.resolution.argsPrefix, "status", "--json"], { env: codegraphEnv, timeoutMs: COMMAND_TIMEOUT_MS });
|
|
1853
1970
|
const decision = decideStartupAction(status);
|
|
1854
1971
|
if (decision.kind === "skip")
|
|
@@ -1865,24 +1982,29 @@ function finish(action, detail, logOutcome) {
|
|
|
1865
1982
|
return { action };
|
|
1866
1983
|
}
|
|
1867
1984
|
async function resolveOrProvisionCommand(deps, config, env, homeDir, nodeSupport) {
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
return { kind: "unsupported-node" };
|
|
1872
|
-
}
|
|
1985
|
+
const trustedInstallDir = config.trustedCodegraphInstallDir;
|
|
1986
|
+
const resolved = deps.resolveCommand({ env, homeDir, provisioned: () => provisionedBinFromInstallDir(trustedInstallDir) });
|
|
1987
|
+
if (resolved.exists && canUseResolvedCommand(resolved, nodeSupport)) {
|
|
1873
1988
|
return { kind: "resolved", resolution: resolved };
|
|
1874
1989
|
}
|
|
1875
|
-
if (
|
|
1990
|
+
if (resolved.exists && config.auto_provision === false)
|
|
1876
1991
|
return { kind: "unsupported-node" };
|
|
1877
1992
|
if (config.auto_provision === false)
|
|
1878
1993
|
return { error: "codegraph binary unavailable and auto_provision is disabled", kind: "unavailable", source: resolved.source };
|
|
1879
|
-
const installDir =
|
|
1880
|
-
const provisioned = await deps.ensureProvisioned({ installDir, lockDir: join7(installDir, "locks"), version: CODEGRAPH_VERSION });
|
|
1994
|
+
const installDir = trustedInstallDir ?? join7(homeDir, ".omo", "codegraph");
|
|
1995
|
+
const provisioned = await deps.ensureProvisioned({ installDir, lockDir: join7(installDir, ".locks"), version: CODEGRAPH_VERSION });
|
|
1881
1996
|
if (!provisioned.provisioned || provisioned.binPath === undefined) {
|
|
1882
1997
|
return { error: provisioned.error ?? "provisioning did not produce a binary", kind: "unavailable", source: resolved.source };
|
|
1883
1998
|
}
|
|
1884
1999
|
return { kind: "resolved", resolution: { argsPrefix: [], command: provisioned.binPath, exists: true, source: "provisioned" } };
|
|
1885
2000
|
}
|
|
2001
|
+
function codegraphEnvForConfig(config, homeDir) {
|
|
2002
|
+
const env = buildCodegraphEnv({ homeDir });
|
|
2003
|
+
return config.trustedCodegraphInstallDir === undefined ? env : { ...env, CODEGRAPH_INSTALL_DIR: config.trustedCodegraphInstallDir };
|
|
2004
|
+
}
|
|
2005
|
+
function canUseResolvedCommand(resolved, nodeSupport) {
|
|
2006
|
+
return !codegraphCommandRequiresSupportedLocalNode(resolved) || nodeSupport.supported;
|
|
2007
|
+
}
|
|
1886
2008
|
function decideStartupAction(status) {
|
|
1887
2009
|
if (status.timedOut)
|
|
1888
2010
|
return { kind: "skip", reason: "status timed out" };
|
|
@@ -1900,7 +2022,7 @@ ${status.stderr ?? ""}`.toLowerCase();
|
|
|
1900
2022
|
return { kind: "sync" };
|
|
1901
2023
|
}
|
|
1902
2024
|
function jsonSaysInitialized(value) {
|
|
1903
|
-
if (!
|
|
2025
|
+
if (!isRecord3(value))
|
|
1904
2026
|
return;
|
|
1905
2027
|
const initialized = value["initialized"] ?? value["isInitialized"] ?? value["ready"];
|
|
1906
2028
|
if (typeof initialized === "boolean")
|
|
@@ -1965,8 +2087,8 @@ function resolveExitCode(error) {
|
|
|
1965
2087
|
function toOutputText(value) {
|
|
1966
2088
|
return Buffer.isBuffer(value) ? value.toString("utf8") : value;
|
|
1967
2089
|
}
|
|
1968
|
-
function
|
|
1969
|
-
return env["HOME"] ?? env["USERPROFILE"] ??
|
|
2090
|
+
function resolveHomeDir2(env) {
|
|
2091
|
+
return env["HOME"] ?? env["USERPROFILE"] ?? homedir8();
|
|
1970
2092
|
}
|
|
1971
2093
|
function parseJson(text) {
|
|
1972
2094
|
try {
|
|
@@ -1977,7 +2099,7 @@ function parseJson(text) {
|
|
|
1977
2099
|
throw error;
|
|
1978
2100
|
}
|
|
1979
2101
|
}
|
|
1980
|
-
function
|
|
2102
|
+
function isRecord3(value) {
|
|
1981
2103
|
return typeof value === "object" && value !== null;
|
|
1982
2104
|
}
|
|
1983
2105
|
|
|
@@ -1986,11 +2108,14 @@ var CODEGRAPH_SESSION_START_NOTICE = "LazyCodex CodeGraph bootstrap scheduled in
|
|
|
1986
2108
|
async function runCodegraphSessionStartHook(options = {}) {
|
|
1987
2109
|
return (await executeCodegraphSessionStartHook(options)).exitCode;
|
|
1988
2110
|
}
|
|
2111
|
+
async function runCodegraphPostToolUseHookCli(options = {}) {
|
|
2112
|
+
return (await executeCodegraphPostToolUseHook(options)).exitCode;
|
|
2113
|
+
}
|
|
1989
2114
|
async function executeCodegraphSessionStartHook(options = {}) {
|
|
1990
2115
|
const env = options.env ?? processEnv2;
|
|
1991
2116
|
const input = await readHookInput(options.stdin ?? processStdin);
|
|
1992
2117
|
const projectRoot = resolveProjectRoot(input, options.cwd ?? processCwd2());
|
|
1993
|
-
const homeDir =
|
|
2118
|
+
const homeDir = resolveHomeDir3(env);
|
|
1994
2119
|
const config = options.config ?? getCodexOmoConfig({ cwd: projectRoot, env, homeDir });
|
|
1995
2120
|
if (config.codegraph?.enabled === false) {
|
|
1996
2121
|
return { action: "skipped-disabled", exitCode: 0 };
|
|
@@ -2003,6 +2128,30 @@ async function executeCodegraphSessionStartHook(options = {}) {
|
|
|
2003
2128
|
writeHookJson(options.stdout ?? processStdout);
|
|
2004
2129
|
return { action: "spawned", exitCode: 0 };
|
|
2005
2130
|
}
|
|
2131
|
+
async function executeCodegraphPostToolUseHook(options = {}) {
|
|
2132
|
+
const env = options.env ?? processEnv2;
|
|
2133
|
+
const input = await readHookInput(options.stdin ?? processStdin);
|
|
2134
|
+
const output = runCodegraphPostToolUseHook(input, { homeDir: resolveHomeDir3(env) });
|
|
2135
|
+
if (output.length === 0)
|
|
2136
|
+
return { action: "skipped", exitCode: 0 };
|
|
2137
|
+
(options.stdout ?? processStdout).write(output);
|
|
2138
|
+
return { action: "emitted-guidance", exitCode: 0 };
|
|
2139
|
+
}
|
|
2140
|
+
function runCodegraphPostToolUseHook(input, options = {}) {
|
|
2141
|
+
const toolName = isRecord4(input) ? input["tool_name"] : undefined;
|
|
2142
|
+
const cwd = isRecord4(input) ? input["cwd"] : undefined;
|
|
2143
|
+
const toolOutput = isRecord4(input) ? input["tool_response"] ?? input["tool_output"] ?? input["response"] : input;
|
|
2144
|
+
const guidance = buildCodegraphInitGuidanceForToolResult({ cwd, toolName, toolOutput }, options);
|
|
2145
|
+
if (guidance === null)
|
|
2146
|
+
return "";
|
|
2147
|
+
return `${JSON.stringify({
|
|
2148
|
+
hookSpecificOutput: {
|
|
2149
|
+
hookEventName: "PostToolUse",
|
|
2150
|
+
additionalContext: guidance
|
|
2151
|
+
}
|
|
2152
|
+
})}
|
|
2153
|
+
`;
|
|
2154
|
+
}
|
|
2006
2155
|
function writeHookJson(stdout) {
|
|
2007
2156
|
const output = {
|
|
2008
2157
|
hookSpecificOutput: {
|
|
@@ -2017,11 +2166,11 @@ function spawnDetachedWorker(invocation) {
|
|
|
2017
2166
|
const child = spawn(invocation.command, [...invocation.args], { detached: true, env: invocation.env, stdio: "ignore" });
|
|
2018
2167
|
child.unref();
|
|
2019
2168
|
}
|
|
2020
|
-
function
|
|
2021
|
-
return env["HOME"] ?? env["USERPROFILE"] ??
|
|
2169
|
+
function resolveHomeDir3(env) {
|
|
2170
|
+
return env["HOME"] ?? env["USERPROFILE"] ?? homedir9();
|
|
2022
2171
|
}
|
|
2023
2172
|
function resolveProjectRoot(input, fallback) {
|
|
2024
|
-
if (!
|
|
2173
|
+
if (!isRecord4(input))
|
|
2025
2174
|
return fallback;
|
|
2026
2175
|
const cwd = input["cwd"];
|
|
2027
2176
|
return typeof cwd === "string" && cwd.trim().length > 0 ? cwd : fallback;
|
|
@@ -2045,7 +2194,7 @@ function parseJson2(text) {
|
|
|
2045
2194
|
throw error;
|
|
2046
2195
|
}
|
|
2047
2196
|
}
|
|
2048
|
-
function
|
|
2197
|
+
function isRecord4(value) {
|
|
2049
2198
|
return typeof value === "object" && value !== null;
|
|
2050
2199
|
}
|
|
2051
2200
|
function defaultWorkerCliPath() {
|
|
@@ -2055,51 +2204,309 @@ function defaultWorkerCliPath() {
|
|
|
2055
2204
|
// components/codegraph/src/serve.ts
|
|
2056
2205
|
import { spawn as spawn2 } from "node:child_process";
|
|
2057
2206
|
import { existsSync as existsSync7, realpathSync as realpathSync2 } from "node:fs";
|
|
2058
|
-
import { homedir as
|
|
2207
|
+
import { homedir as homedir10 } from "node:os";
|
|
2059
2208
|
import { basename as basename4, extname as extname2, join as join8, resolve as resolve3 } from "node:path";
|
|
2060
2209
|
import {
|
|
2061
2210
|
cwd as processCwd3,
|
|
2062
2211
|
env as processEnv3,
|
|
2063
2212
|
execPath as processExecPath,
|
|
2064
|
-
|
|
2213
|
+
stdin as processStdin2,
|
|
2214
|
+
stderr as processStderr2,
|
|
2215
|
+
stdout as processStdout2
|
|
2065
2216
|
} from "node:process";
|
|
2066
2217
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2218
|
+
|
|
2219
|
+
// ../../mcp-stdio-core/src/record.ts
|
|
2220
|
+
function isPlainRecord(value) {
|
|
2221
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2222
|
+
}
|
|
2223
|
+
// ../../mcp-stdio-core/src/responses.ts
|
|
2224
|
+
function successResponse(id, result) {
|
|
2225
|
+
return { jsonrpc: "2.0", id, result };
|
|
2226
|
+
}
|
|
2227
|
+
function errorResponse(id, code, message, data) {
|
|
2228
|
+
return { jsonrpc: "2.0", id, error: data === undefined ? { code, message } : { code, message, data } };
|
|
2229
|
+
}
|
|
2230
|
+
function jsonRpcId(value) {
|
|
2231
|
+
return typeof value === "string" || typeof value === "number" || value === null ? value : null;
|
|
2232
|
+
}
|
|
2233
|
+
// ../../mcp-stdio-core/src/transport.ts
|
|
2234
|
+
var HEADER_SEPARATOR = Buffer.from(`\r
|
|
2235
|
+
\r
|
|
2236
|
+
`);
|
|
2237
|
+
async function* readStdioJsonRpcMessages(input) {
|
|
2238
|
+
let buffer = Buffer.alloc(0);
|
|
2239
|
+
for await (const chunk of input) {
|
|
2240
|
+
buffer = Buffer.concat([buffer, bufferFromChunk(chunk)]);
|
|
2241
|
+
while (true) {
|
|
2242
|
+
const result = readNextMessage(buffer);
|
|
2243
|
+
if (result.kind === "incomplete")
|
|
2244
|
+
break;
|
|
2245
|
+
buffer = result.remaining;
|
|
2246
|
+
if (result.message)
|
|
2247
|
+
yield result.message;
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
const trailing = buffer.toString("utf8").trim();
|
|
2251
|
+
if (trailing.length > 0) {
|
|
2252
|
+
yield parseJsonPayload(trailing, "line");
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
function writeStdioJsonRpcResponse(output, response, responseMode) {
|
|
2256
|
+
const body = JSON.stringify(response);
|
|
2257
|
+
if (responseMode === "framed") {
|
|
2258
|
+
output.write(`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
|
|
2259
|
+
\r
|
|
2260
|
+
${body}`);
|
|
2261
|
+
return;
|
|
2262
|
+
}
|
|
2263
|
+
output.write(`${body}
|
|
2264
|
+
`);
|
|
2265
|
+
}
|
|
2266
|
+
function readNextMessage(buffer) {
|
|
2267
|
+
if (buffer.length === 0)
|
|
2268
|
+
return { kind: "incomplete" };
|
|
2269
|
+
return startsWithContentLength(buffer) ? readFramedMessage(buffer) : readLineMessage(buffer);
|
|
2270
|
+
}
|
|
2271
|
+
function readLineMessage(buffer) {
|
|
2272
|
+
const newlineIndex = buffer.indexOf(10);
|
|
2273
|
+
if (newlineIndex === -1)
|
|
2274
|
+
return { kind: "incomplete" };
|
|
2275
|
+
const line = buffer.subarray(0, newlineIndex).toString("utf8").replace(/\r$/, "");
|
|
2276
|
+
if (line.trim().length === 0) {
|
|
2277
|
+
return { kind: "complete", remaining: buffer.subarray(newlineIndex + 1) };
|
|
2278
|
+
}
|
|
2279
|
+
return {
|
|
2280
|
+
kind: "complete",
|
|
2281
|
+
message: parseJsonPayload(line, "line"),
|
|
2282
|
+
remaining: buffer.subarray(newlineIndex + 1)
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
function readFramedMessage(buffer) {
|
|
2286
|
+
const separatorIndex = buffer.indexOf(HEADER_SEPARATOR);
|
|
2287
|
+
if (separatorIndex === -1)
|
|
2288
|
+
return { kind: "incomplete" };
|
|
2289
|
+
const headers = buffer.subarray(0, separatorIndex).toString("ascii");
|
|
2290
|
+
const contentLength = parseContentLength(headers);
|
|
2291
|
+
const bodyStart = separatorIndex + HEADER_SEPARATOR.length;
|
|
2292
|
+
if (contentLength === undefined) {
|
|
2293
|
+
return {
|
|
2294
|
+
kind: "complete",
|
|
2295
|
+
message: {
|
|
2296
|
+
kind: "parse_error",
|
|
2297
|
+
message: "Missing or invalid Content-Length header",
|
|
2298
|
+
responseMode: "framed"
|
|
2299
|
+
},
|
|
2300
|
+
remaining: buffer.subarray(bodyStart)
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2303
|
+
const bodyEnd = bodyStart + contentLength;
|
|
2304
|
+
if (buffer.length < bodyEnd)
|
|
2305
|
+
return { kind: "incomplete" };
|
|
2306
|
+
const body = buffer.subarray(bodyStart, bodyEnd).toString("utf8");
|
|
2307
|
+
return {
|
|
2308
|
+
kind: "complete",
|
|
2309
|
+
message: parseJsonPayload(body, "framed"),
|
|
2310
|
+
remaining: buffer.subarray(bodyEnd)
|
|
2311
|
+
};
|
|
2312
|
+
}
|
|
2313
|
+
function startsWithContentLength(buffer) {
|
|
2314
|
+
const prefix = buffer.subarray(0, "content-length:".length).toString("ascii").toLowerCase();
|
|
2315
|
+
return prefix === "content-length:";
|
|
2316
|
+
}
|
|
2317
|
+
function parseContentLength(headers) {
|
|
2318
|
+
for (const line of headers.split(`\r
|
|
2319
|
+
`)) {
|
|
2320
|
+
const match = /^content-length:\s*(\d+)$/i.exec(line);
|
|
2321
|
+
if (match === null)
|
|
2322
|
+
continue;
|
|
2323
|
+
const value = match[1];
|
|
2324
|
+
if (value === undefined)
|
|
2325
|
+
return;
|
|
2326
|
+
return Number(value);
|
|
2327
|
+
}
|
|
2328
|
+
return;
|
|
2329
|
+
}
|
|
2330
|
+
function parseJsonPayload(payload, responseMode) {
|
|
2331
|
+
try {
|
|
2332
|
+
return { kind: "request", payload: JSON.parse(payload), responseMode };
|
|
2333
|
+
} catch (error) {
|
|
2334
|
+
return { kind: "parse_error", message: error instanceof Error ? error.message : String(error), responseMode };
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
function bufferFromChunk(chunk) {
|
|
2338
|
+
if (Buffer.isBuffer(chunk))
|
|
2339
|
+
return chunk;
|
|
2340
|
+
if (typeof chunk === "string")
|
|
2341
|
+
return Buffer.from(chunk);
|
|
2342
|
+
throw new TypeError(`Unsupported stdio chunk type: ${typeof chunk}`);
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
// ../../mcp-stdio-core/src/server.ts
|
|
2346
|
+
var DEFAULT_IDLE_TIMEOUT_MS = 10 * 60000;
|
|
2347
|
+
var noopLog = () => {};
|
|
2348
|
+
async function runJsonRpcStdioServer(config) {
|
|
2349
|
+
const log = config.log ?? noopLog;
|
|
2350
|
+
const idleTimeoutMs = config.idleTimeoutMs ?? DEFAULT_IDLE_TIMEOUT_MS;
|
|
2351
|
+
const idleTimer = createIdleTimer(idleTimeoutMs, log, config.onIdleTimeout);
|
|
2352
|
+
log("stdio_started", { cwd: process.cwd(), idle_timeout_ms: idleTimeoutMs });
|
|
2353
|
+
idleTimer.arm();
|
|
2354
|
+
try {
|
|
2355
|
+
for await (const message of readStdioJsonRpcMessages(config.input)) {
|
|
2356
|
+
if (idleTimer.closed())
|
|
2357
|
+
break;
|
|
2358
|
+
idleTimer.arm();
|
|
2359
|
+
if (message.kind === "parse_error") {
|
|
2360
|
+
handleParseError(message, config, log);
|
|
2361
|
+
continue;
|
|
2362
|
+
}
|
|
2363
|
+
await handleRequest(message, config, log);
|
|
2364
|
+
}
|
|
2365
|
+
} finally {
|
|
2366
|
+
idleTimer.clear();
|
|
2367
|
+
log("stdio_stopped");
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
function handleParseError(message, config, log) {
|
|
2371
|
+
log("parse_error", { message: message.message });
|
|
2372
|
+
const response = config.parseErrorResponse?.(message.message) ?? errorResponse(null, -32700, "Parse error", message.message);
|
|
2373
|
+
if (response !== undefined) {
|
|
2374
|
+
writeStdioJsonRpcResponse(config.output, response, message.responseMode);
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
async function handleRequest(message, config, log) {
|
|
2378
|
+
const parsed = message.payload;
|
|
2379
|
+
const id = isPlainRecord(parsed) ? jsonRpcId(parsed["id"]) : null;
|
|
2380
|
+
const method = isPlainRecord(parsed) && typeof parsed["method"] === "string" ? parsed["method"] : null;
|
|
2381
|
+
log("request", { id: id === null ? null : String(id), method });
|
|
2382
|
+
try {
|
|
2383
|
+
const response = await config.handler(parsed, config.handlerOptions);
|
|
2384
|
+
if (response === undefined)
|
|
2385
|
+
return;
|
|
2386
|
+
writeStdioJsonRpcResponse(config.output, response, message.responseMode);
|
|
2387
|
+
log("response", { id: String(response.id), method, is_error: response.error !== undefined });
|
|
2388
|
+
} catch (error) {
|
|
2389
|
+
if (config.onHandlerError === undefined)
|
|
2390
|
+
throw error;
|
|
2391
|
+
config.onHandlerError(error);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
|
|
2395
|
+
let timer = null;
|
|
2396
|
+
let isClosed = false;
|
|
2397
|
+
return {
|
|
2398
|
+
arm: () => {
|
|
2399
|
+
if (timer !== null)
|
|
2400
|
+
clearTimeout(timer);
|
|
2401
|
+
if (idleTimeoutMs <= 0)
|
|
2402
|
+
return;
|
|
2403
|
+
timer = setTimeout(() => {
|
|
2404
|
+
isClosed = true;
|
|
2405
|
+
log("idle_timeout", { idle_timeout_ms: idleTimeoutMs });
|
|
2406
|
+
onIdleTimeout?.();
|
|
2407
|
+
}, idleTimeoutMs);
|
|
2408
|
+
timer.unref();
|
|
2409
|
+
},
|
|
2410
|
+
clear: () => {
|
|
2411
|
+
if (timer === null)
|
|
2412
|
+
return;
|
|
2413
|
+
clearTimeout(timer);
|
|
2414
|
+
timer = null;
|
|
2415
|
+
},
|
|
2416
|
+
closed: () => isClosed
|
|
2417
|
+
};
|
|
2418
|
+
}
|
|
2419
|
+
// components/codegraph/src/mcp-unavailable.ts
|
|
2420
|
+
async function runUnavailableCodegraphMcpServer(options) {
|
|
2421
|
+
await runJsonRpcStdioServer({
|
|
2422
|
+
handler: handleUnavailableCodegraphMcpRequest,
|
|
2423
|
+
handlerOptions: {
|
|
2424
|
+
reason: options.reason.trim(),
|
|
2425
|
+
serverVersion: options.serverVersion
|
|
2426
|
+
},
|
|
2427
|
+
input: options.input,
|
|
2428
|
+
output: options.output
|
|
2429
|
+
});
|
|
2430
|
+
}
|
|
2431
|
+
async function handleUnavailableCodegraphMcpRequest(input, options) {
|
|
2432
|
+
if (!isPlainRecord(input)) {
|
|
2433
|
+
return errorResponse(null, -32600, "Invalid Request");
|
|
2434
|
+
}
|
|
2435
|
+
const id = jsonRpcId(input["id"]);
|
|
2436
|
+
const method = input["method"];
|
|
2437
|
+
if (method === "notifications/initialized")
|
|
2438
|
+
return;
|
|
2439
|
+
if (method === "ping")
|
|
2440
|
+
return successResponse(id, {});
|
|
2441
|
+
if (method === "initialize") {
|
|
2442
|
+
return successResponse(id, {
|
|
2443
|
+
capabilities: { tools: { listChanged: false } },
|
|
2444
|
+
protocolVersion: requestedProtocolVersion(input["params"]),
|
|
2445
|
+
serverInfo: { name: "codegraph", version: options.serverVersion }
|
|
2446
|
+
});
|
|
2447
|
+
}
|
|
2448
|
+
if (method === "tools/list") {
|
|
2449
|
+
return successResponse(id, { tools: [] });
|
|
2450
|
+
}
|
|
2451
|
+
if (method === "tools/call") {
|
|
2452
|
+
return successResponse(id, {
|
|
2453
|
+
content: [{ text: options.reason, type: "text" }],
|
|
2454
|
+
isError: true
|
|
2455
|
+
});
|
|
2456
|
+
}
|
|
2457
|
+
return errorResponse(id, -32601, `Method not found: ${String(method)}`);
|
|
2458
|
+
}
|
|
2459
|
+
function requestedProtocolVersion(params) {
|
|
2460
|
+
if (!isPlainRecord(params) || typeof params["protocolVersion"] !== "string")
|
|
2461
|
+
return "2024-11-05";
|
|
2462
|
+
return params["protocolVersion"];
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
// components/codegraph/src/serve.ts
|
|
2067
2466
|
var CODEGRAPH_SKIP_HINT = `CodeGraph MCP skipped: codegraph binary not found. Install CodeGraph or set OMO_CODEGRAPH_BIN.
|
|
2068
2467
|
`;
|
|
2069
2468
|
var CODEGRAPH_DISABLED_HINT = `CodeGraph MCP skipped: disabled by OMO SOT config. Set [codex].codegraph.enabled=true to enable it.
|
|
2070
2469
|
`;
|
|
2470
|
+
var CODEGRAPH_VERSION2 = "1.0.1";
|
|
2071
2471
|
var WINDOWS_CMD_EXTENSIONS2 = new Set([".bat", ".cmd"]);
|
|
2072
2472
|
var WINDOWS_NODE_SCRIPT_EXTENSIONS = new Set([".cjs", ".js", ".mjs"]);
|
|
2073
2473
|
async function runCodegraphServe(options = {}) {
|
|
2074
2474
|
const env = options.env ?? processEnv3;
|
|
2075
|
-
const homeDir = options.homeDir ??
|
|
2475
|
+
const homeDir = options.homeDir ?? homedir10();
|
|
2076
2476
|
const config = options.config ?? getCodexOmoConfig({ cwd: options.cwd ?? processCwd3(), env, homeDir });
|
|
2077
2477
|
const codegraphConfig = config.codegraph ?? {};
|
|
2078
2478
|
if (codegraphConfig.enabled === false) {
|
|
2079
|
-
|
|
2080
|
-
return 1;
|
|
2479
|
+
return runUnavailableMcp(CODEGRAPH_DISABLED_HINT, options);
|
|
2081
2480
|
}
|
|
2481
|
+
const trustedInstallDir = config.trustedCodegraphInstallDir;
|
|
2082
2482
|
const resolutionOptions = {
|
|
2083
2483
|
env,
|
|
2084
2484
|
homeDir,
|
|
2085
|
-
provisioned: () => provisionedBinFromInstallDir2(
|
|
2485
|
+
provisioned: () => provisionedBinFromInstallDir2(trustedInstallDir)
|
|
2086
2486
|
};
|
|
2087
|
-
|
|
2487
|
+
let resolution = options.resolve?.(resolutionOptions) ?? resolveCodegraphCommand(resolutionOptions);
|
|
2088
2488
|
const nodeSupport = evaluateCodegraphNodeSupport({ env, nodeVersion: options.nodeVersion });
|
|
2089
2489
|
if (!resolution.exists || shouldSkipResolvedCommand(resolution, options.commandExists ?? existsSync7)) {
|
|
2090
2490
|
if (resolution.source === "path" && !nodeSupport.supported) {
|
|
2091
|
-
|
|
2092
|
-
|
|
2491
|
+
return runUnavailableMcp(buildCodegraphNodeSkipHint(nodeSupport), options);
|
|
2492
|
+
}
|
|
2493
|
+
const provisioned = await provisionMissingCodegraph({
|
|
2494
|
+
config: codegraphConfig,
|
|
2495
|
+
ensureProvisioned: options.ensureProvisioned ?? ensureCodegraphProvisioned,
|
|
2496
|
+
homeDir,
|
|
2497
|
+
resolution,
|
|
2498
|
+
...trustedInstallDir === undefined ? {} : { trustedInstallDir }
|
|
2499
|
+
});
|
|
2500
|
+
if (provisioned === null) {
|
|
2501
|
+
return runUnavailableMcp(CODEGRAPH_SKIP_HINT, options);
|
|
2093
2502
|
}
|
|
2094
|
-
|
|
2095
|
-
return 1;
|
|
2503
|
+
resolution = provisioned;
|
|
2096
2504
|
}
|
|
2097
2505
|
if (codegraphCommandRequiresSupportedLocalNode(resolution) && !nodeSupport.supported) {
|
|
2098
|
-
|
|
2099
|
-
return 1;
|
|
2506
|
+
return runUnavailableMcp(buildCodegraphNodeSkipHint(nodeSupport), options);
|
|
2100
2507
|
}
|
|
2101
2508
|
const runProcess = options.runProcess ?? runChildProcess;
|
|
2102
|
-
const codegraphEnv =
|
|
2509
|
+
const codegraphEnv = codegraphEnvForConfig2(trustedInstallDir, homeDir, options.buildEnv);
|
|
2103
2510
|
const mergedEnv = {
|
|
2104
2511
|
...env,
|
|
2105
2512
|
...codegraphEnv
|
|
@@ -2109,6 +2516,31 @@ async function runCodegraphServe(options = {}) {
|
|
|
2109
2516
|
stdio: "inherit"
|
|
2110
2517
|
});
|
|
2111
2518
|
}
|
|
2519
|
+
async function runUnavailableMcp(reason, options) {
|
|
2520
|
+
(options.stderr ?? processStderr2).write(reason);
|
|
2521
|
+
await runUnavailableCodegraphMcpServer({
|
|
2522
|
+
input: options.stdin ?? processStdin2,
|
|
2523
|
+
output: options.stdout ?? processStdout2,
|
|
2524
|
+
reason,
|
|
2525
|
+
serverVersion: CODEGRAPH_VERSION2
|
|
2526
|
+
});
|
|
2527
|
+
return 0;
|
|
2528
|
+
}
|
|
2529
|
+
async function provisionMissingCodegraph(options) {
|
|
2530
|
+
if (options.resolution.source === "env")
|
|
2531
|
+
return null;
|
|
2532
|
+
if (options.config.auto_provision === false)
|
|
2533
|
+
return null;
|
|
2534
|
+
const installDir = options.trustedInstallDir ?? join8(options.homeDir, ".omo", "codegraph");
|
|
2535
|
+
const result = await options.ensureProvisioned({
|
|
2536
|
+
installDir,
|
|
2537
|
+
lockDir: join8(installDir, ".locks"),
|
|
2538
|
+
version: CODEGRAPH_VERSION2
|
|
2539
|
+
});
|
|
2540
|
+
if (!result.provisioned || result.binPath === undefined)
|
|
2541
|
+
return null;
|
|
2542
|
+
return { argsPrefix: [], command: result.binPath, exists: true, source: "provisioned" };
|
|
2543
|
+
}
|
|
2112
2544
|
function shouldSkipResolvedCommand(resolution, commandExists) {
|
|
2113
2545
|
if (resolution.source !== "env")
|
|
2114
2546
|
return false;
|
|
@@ -2119,9 +2551,9 @@ function shouldSkipResolvedCommand(resolution, commandExists) {
|
|
|
2119
2551
|
function looksLikePath2(command) {
|
|
2120
2552
|
return command.includes("/") || command.includes("\\");
|
|
2121
2553
|
}
|
|
2122
|
-
function
|
|
2554
|
+
function codegraphEnvForConfig2(trustedInstallDir, homeDir, buildEnv) {
|
|
2123
2555
|
const env = buildEnv?.({ homeDir }) ?? buildCodegraphEnv({ homeDir });
|
|
2124
|
-
return
|
|
2556
|
+
return trustedInstallDir === undefined ? env : { ...env, CODEGRAPH_INSTALL_DIR: trustedInstallDir };
|
|
2125
2557
|
}
|
|
2126
2558
|
function provisionedBinFromInstallDir2(installDir) {
|
|
2127
2559
|
if (installDir === undefined)
|
|
@@ -2183,6 +2615,14 @@ async function runCodegraphCli(options = {}) {
|
|
|
2183
2615
|
if (command === "hook" && subcommand === "session-start") {
|
|
2184
2616
|
return runCodegraphSessionStartHook(options);
|
|
2185
2617
|
}
|
|
2618
|
+
if (command === "hook" && subcommand === "post-tool-use") {
|
|
2619
|
+
const hookOptions = {
|
|
2620
|
+
...options.env === undefined ? {} : { env: options.env },
|
|
2621
|
+
...options.stdin === undefined ? {} : { stdin: options.stdin },
|
|
2622
|
+
...options.stdout === undefined ? {} : { stdout: options.stdout }
|
|
2623
|
+
};
|
|
2624
|
+
return runCodegraphPostToolUseHookCli(hookOptions);
|
|
2625
|
+
}
|
|
2186
2626
|
if (command === "hook" && subcommand === "session-start-worker") {
|
|
2187
2627
|
const workerOptions = {
|
|
2188
2628
|
...options.workerOptions,
|