switchboard-router 0.6.11 → 0.6.13
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/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +3 -3
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/prerender-manifest.json +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-library/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/routing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/catalog/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/doctor/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/export/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/mcp/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/skills/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/sync/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agent-library/updates/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/aider-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +4 -4
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js +3 -3
- package/app/.next-cli-build/server/app/api/cli-tools/gemini-cli-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/grok-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/combos/[id]/strategy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/routing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/usage/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mgmt/v1/version/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/cache/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/prepare/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/remove-unavailable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/cancel/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/model-probes/verify/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/feedback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/insights/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/learn/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/versions/promote/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/routing/versions/rollback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/skills/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/token-saver/vault-stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +3 -3
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +3 -3
- package/app/.next-cli-build/server/chunks/194.js +1 -1
- package/app/.next-cli-build/server/chunks/{1062.js → 3787.js} +2 -2
- package/app/.next-cli-build/server/chunks/4126.js +1 -1
- package/app/.next-cli-build/server/chunks/4746.js +1 -1
- package/app/.next-cli-build/server/chunks/5821.js +1 -1
- package/app/.next-cli-build/server/chunks/7155.js +1 -1
- package/app/.next-cli-build/server/chunks/869.js +1 -1
- package/app/.next-cli-build/server/chunks/8998.js +1 -1
- package/app/.next-cli-build/server/chunks/9489.js +2 -2
- package/app/.next-cli-build/server/chunks/9696.js +5 -5
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/app/.next-cli-build/static/chunks/{1321-3452b6d48b71f4a2.js → 1321-f614c7c6e5ab4bcc.js} +1 -1
- package/app/.next-cli-build/static/chunks/{5497-d866b97bf9a716ba.js → 5497-3d546c1b7aa357b1.js} +5 -5
- package/app/.next-cli-build/static/chunks/594-e392353337efef19.js +64 -0
- package/app/.next-cli-build/static/chunks/6430-4c528cfc35666c11.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/agent-library/{page-d720efb4c9d427e6.js → page-62bea7b75b3f2692.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/{page-04509a38b9fd3dcf.js → page-1eb380280857cf20.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-fa35870caaeabe20.js → page-9aa986f145130c08.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-aa9c65a5e73a3f5d.js → page-a09d7692b3ea9179.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/{page-a8d77d24b4c71915.js → page-4bf0abe7c7119ac0.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/routing/{page-95f09ae849f539d6.js → page-1fc70bcd434deb73.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/{page-6678759c536b4008.js → page-fdc5377da12ec933.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-b48bd39cb03c4985.js +3 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-183cf5498e6d3e42.js → page-9e60537a4b8f5a0c.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/{page-b67e7e3b9acaf1cc.js → page-95bf830096d019fd.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-a4bad553cba810e7.js → page-45ebe6bb46c9f65e.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/{page-0568602ac2385103.js → page-7ac82c8930583633.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-f6e3507247a819e5.js → page-961013b570bbeac6.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-08fe6612a31239da.js → page-8619928e4b74f46b.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/{page-a1ab95a02951c91d.js → page-b5b9038ea28e63b6.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-e023b0417bbc3b44.js +10 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/{page-608cdc11e7047159.js → page-fe7ccc9c117d7d38.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/{page-ad84a479883e6cc3.js → page-d3e35265648406f2.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-f312c1076859630e.js → page-5ac3900baf3fe9ca.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/[id]/{page-90277b8688f387c1.js → page-bb4af1ac9b13a514.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/{page-33e127c15efc66a5.js → page-4382c14f28ddfc7f.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/{page-0f74a450b98fa125.js → page-1b2b6b736fe98698.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/{page-ad2eda4b48c9319b.js → page-92fe95bd4e6b3d0a.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/{page-025d20cc7b091120.js → page-4c47b9660f3066e2.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-d1fa5b81e1c386ab.js +1 -0
- package/app/package.json +1 -1
- package/cli.js +18 -2
- package/package.json +1 -1
- package/src/cli/interfaceMenu.js +11 -4
- package/app/.next-cli-build/static/chunks/1631-cb80453bf5d4173d.js +0 -1
- package/app/.next-cli-build/static/chunks/2176-8ad9ce4b3cb01006.js +0 -1
- package/app/.next-cli-build/static/chunks/2280-61262f8359f37a85.js +0 -64
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/page-59e92d48daea1aed.js +0 -3
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-c6f3cad64d4ef25a.js +0 -10
- package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-acc24d6e7d8eb782.js +0 -1
- /package/app/.next-cli-build/static/{cirxzk63Mj76HYSOHUdGc → y86nLCzoD011gXPeccvk9}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{cirxzk63Mj76HYSOHUdGc → y86nLCzoD011gXPeccvk9}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6430],{26430:(t,e,s)=>{s.d(e,{E:()=>f});var i=s(5858),a=s(85086),r=s(31967),n=s(98216),u=class extends n.Q{constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,s){let r=e.queryKey,n=e.queryHash??(0,i.F$)(r,e),u=this.get(n);return u||(u=new a.X({client:t,queryKey:r,queryHash:n,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(u)),u}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){r.jG.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>(0,i.MK)(e,t))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(e=>(0,i.MK)(t,e)):e}notify(t){r.jG.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){r.jG.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){r.jG.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},o=s(53390),h=class extends n.Q{constructor(t={}){super(),this.config=t,this.#e=new Set,this.#s=new Map,this.#i=0}#e;#s;#i;build(t,e,s){let i=new o.s({client:t,mutationCache:this,mutationId:++this.#i,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#e.add(t);let e=c(t);if("string"==typeof e){let s=this.#s.get(e);s?s.push(t):this.#s.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){let e=c(t);if("string"==typeof e){let s=this.#s.get(e);if(s)if(s.length>1){let e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#s.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=c(t);if("string"!=typeof e)return!0;{let s=this.#s.get(e),i=s?.find(t=>"pending"===t.state.status);return!i||i===t}}runNext(t){let e=c(t);if("string"!=typeof e)return Promise.resolve();{let s=this.#s.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){r.jG.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#s.clear()})}getAll(){return Array.from(this.#e)}find(t){let e={exact:!0,...t};return this.getAll().find(t=>(0,i.nJ)(e,t))}findAll(t={}){return this.getAll().filter(e=>(0,i.nJ)(t,e))}notify(t){r.jG.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return r.jG.batch(()=>Promise.all(t.map(t=>t.continue().catch(i.lQ))))}};function c(t){return t.options.scope?.id}var l=s(20562),d=s(1681),f=class{#a;#r;#n;#u;#o;#h;#c;#l;constructor(t={}){this.#a=t.queryCache||new u,this.#r=t.mutationCache||new h,this.#n=t.defaultOptions||{},this.#u=new Map,this.#o=new Map,this.#h=0}mount(){this.#h++,1===this.#h&&(this.#c=l.m.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#a.onFocus())}),this.#l=d.t.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#a.onOnline())}))}unmount(){this.#h--,0===this.#h&&(this.#c?.(),this.#c=void 0,this.#l?.(),this.#l=void 0)}isFetching(t){return this.#a.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#r.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#a.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#a.build(this,e),a=s.state.data;return void 0===a?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime((0,i.d2)(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(a))}getQueriesData(t){return this.#a.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){let a=this.defaultQueryOptions({queryKey:t}),r=this.#a.get(a.queryHash),n=r?.state.data,u=(0,i.Zw)(e,n);if(void 0!==u)return this.#a.build(this,a).setData(u,{...s,manual:!0})}setQueriesData(t,e,s){return r.jG.batch(()=>this.#a.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#a.get(e.queryHash)?.state}removeQueries(t){let e=this.#a;r.jG.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let s=this.#a;return r.jG.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e};return Promise.all(r.jG.batch(()=>this.#a.findAll(t).map(t=>t.cancel(s)))).then(i.lQ).catch(i.lQ)}invalidateQueries(t,e={}){return r.jG.batch(()=>(this.#a.findAll(t).forEach(t=>{t.invalidate()}),t?.refetchType==="none")?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0};return Promise.all(r.jG.batch(()=>this.#a.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(i.lQ)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(i.lQ)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#a.build(this,e);return s.isStaleByTime((0,i.d2)(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(i.lQ).catch(i.lQ)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(i.lQ).catch(i.lQ)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return d.t.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#a}getMutationCache(){return this.#r}getDefaultOptions(){return this.#n}setDefaultOptions(t){this.#n=t}setQueryDefaults(t,e){this.#u.set((0,i.EN)(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#u.values()],s={};return e.forEach(e=>{(0,i.Cp)(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#o.set((0,i.EN)(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#o.values()],s={};return e.forEach(e=>{(0,i.Cp)(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#n.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=(0,i.F$)(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===i.hT&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#n.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#a.clear(),this.#r.clear()}}},53390:(t,e,s)=>{s.d(e,{$:()=>u,s:()=>n});var i=s(31967),a=s(99190),r=s(9846),n=class extends a.k{#d;#f;#r;#y;constructor(t){super(),this.#d=t.client,this.mutationId=t.mutationId,this.#r=t.mutationCache,this.#f=[],this.state=t.state||u(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#f.includes(t)||(this.#f.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#f=this.#f.filter(e=>e!==t),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#f.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#y?.continue()??this.execute(this.state.variables)}async execute(t){let e=()=>{this.#p({type:"continue"})},s={client:this.#d,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#y=(0,r.II)({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#p({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#p({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let i="pending"===this.state.status,a=!this.#y.canStart();try{if(i)e();else{this.#p({type:"pending",variables:t,isPaused:a}),this.#r.config.onMutate&&await this.#r.config.onMutate(t,this,s);let e=await this.options.onMutate?.(t,s);e!==this.state.context&&this.#p({type:"pending",context:e,variables:t,isPaused:a})}let r=await this.#y.start();return await this.#r.config.onSuccess?.(r,t,this.state.context,this,s),await this.options.onSuccess?.(r,t,this.state.context,s),await this.#r.config.onSettled?.(r,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(r,null,t,this.state.context,s),this.#p({type:"success",data:r}),r}catch(e){try{await this.#r.config.onError?.(e,t,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onError?.(e,t,this.state.context,s)}catch(t){Promise.reject(t)}try{await this.#r.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onSettled?.(void 0,e,t,this.state.context,s)}catch(t){Promise.reject(t)}throw this.#p({type:"error",error:e}),e}finally{this.#r.runNext(this)}}#p(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),i.jG.batch(()=>{this.#f.forEach(e=>{e.onMutationUpdate(t)}),this.#r.notify({mutation:this,type:"updated",action:t})})}};function u(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6897],{5194:(e,t,s)=>{Promise.resolve().then(s.bind(s,94091))},94091:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>i});var a=s(95155),r=s(12115),l=s(35497),n=s(77251);function i(){let[e,t]=(0,r.useState)(null),[s,i]=(0,r.useState)(!0),[o,c]=(0,r.useState)(""),[x,m]=(0,r.useState)(null),[p,h]=(0,r.useState)(null),[u,b]=(0,r.useState)(null),[y,g]=(0,r.useState)("overview"),[f,j]=(0,r.useState)({id:"",name:"",transport:"stdio",command:"npx",args:"-y @modelcontextprotocol/server-filesystem .",url:"",notes:""}),[v,w]=(0,r.useState)([]),[k,N]=(0,r.useState)(""),[C,S]=(0,r.useState)(""),[P,$]=(0,r.useState)(""),[O,T]=(0,r.useState)(!1),[E,M]=(0,r.useState)(""),[I,z]=(0,r.useState)(""),[A,L]=(0,r.useState)({}),[Z,U]=(0,r.useState)(null),[D,R]=(0,r.useState)(!1),[J,_]=(0,r.useState)(""),H=(0,r.useCallback)(async()=>{i(!0);try{let e=await fetch("/api/agent-library",{cache:"no-store"}),s=await e.json();if(!e.ok)throw Error(s.error||"Load failed");t(s)}catch(e){m({type:"error",text:e.message})}finally{i(!1)}},[]),K=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/agent-library/updates",{cache:"no-store"}),t=await e.json();if(!e.ok)return;let s={};for(let e of t.results||[])s[e.id]=e;L(s)}catch{}},[]);(0,r.useEffect)(()=>{H(),K(),fetch("/api/agent-library/catalog").then(e=>e.json()).then(e=>w(e.presets||[])).catch(()=>{})},[H,K]);let F=e?.settings||{},G=e?.agents||{};async function W(e){c("settings"),m(null);try{let t=await fetch("/api/agent-library",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();if(!t.ok)throw Error(s.error||"Save failed");m({type:"success",text:"Settings saved"}),await H()}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function B(e){c(e),m(null),b(null);try{let t=await fetch("/api/agent-library/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,confirm:"clean"===e||void 0})}),s=await t.json();if(!t.ok)throw Error(s.error||s.message||"Sync failed");b(s),m({type:s.conflictCount?"warn":"success",text:"dry-run"===e?`Dry-run: ${s.summary?.skillsSynced??0} skill ops, ${s.summary?.mcpOk??0} MCP ok, ${s.conflictCount||0} conflicts`:"clean"===e?"Removed Switchboard-managed projections only":`Applied: ${s.summary?.skillsSynced??0} skills synced, ${s.conflictCount||0} conflicts protected`}),await H()}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function Y(){c("doctor");try{let e=await fetch("/api/agent-library/doctor",{cache:"no-store"}),t=await e.json();if(!e.ok)throw Error(t.error||"Doctor failed");h(t),m({type:t.ok?"success":"warn",text:t.ok?"Doctor: no blocking errors":`Doctor: ${t.issues?.filter(e=>"error"===e.severity).length||0} errors`})}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function q(e){e?.preventDefault?.(),c("mcp");try{let e=f.args?f.args.split(/\s+/).filter(Boolean):[],t=await fetch("/api/agent-library/mcp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:f.id,name:f.name||f.id,transport:f.transport,command:"stdio"===f.transport?f.command:void 0,args:"stdio"===f.transport?e:void 0,url:"stdio"!==f.transport?f.url:void 0,notes:f.notes})}),s=await t.json();if(!t.ok)throw Error(s.error||"MCP save failed");s.warnings?.length?m({type:"warn",text:s.warnings.join(" \xb7 ")}):m({type:"success",text:`MCP ${s.server?.id} saved (Apply to project)`}),j({id:"",name:"",transport:"stdio",command:"npx",args:"",url:"",notes:""}),await H()}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function Q(e){if(await (0,n.l)({message:`Remove MCP ${e} from library? (targets updated on next Apply)`,confirmText:"Continue"})){c("mcp-del");try{let t=await fetch(`/api/agent-library/mcp?id=${encodeURIComponent(e)}`,{method:"DELETE"}),s=await t.json();if(!t.ok)throw Error(s.error);m({type:"success",text:"MCP removed from library"}),await H()}catch(e){m({type:"error",text:e.message})}finally{c("")}}}async function V(e){if(await (0,n.l)({message:`Remove skill ${e} from library?`,confirmText:"Continue"})){c("skill-del");try{let t=await fetch(`/api/agent-library/skills?id=${encodeURIComponent(e)}`,{method:"DELETE"}),s=await t.json();if(!t.ok)throw Error(s.error);m({type:"success",text:"Skill removed from library"}),await H(),await K()}catch(e){m({type:"error",text:e.message})}finally{c("")}}}async function X(){c("skill-add");try{let e=await fetch("/api/agent-library/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:E,markdown:I,source:"manual"})}),t=await e.json();if(!e.ok)throw Error(t.error);m({type:"success",text:`Skill ${t.id} installed in library`}),M(""),z(""),await H()}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function ee(e){c("upd-preview"),R(!1);try{let t=await fetch("/api/agent-library/updates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview",skillId:e})}),s=await t.json();if(!t.ok||!s.ok)throw Error(s.message||s.error||"Preview failed");U({id:e,markdown:s.markdown,contentHash:s.contentHash})}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function et(){if(Z){c("upd-apply");try{let e=await fetch("/api/agent-library/updates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update",skillId:Z.id,confirmed:D,expectedHash:Z.contentHash})}),t=await e.json();if(!e.ok||!t.ok)throw Error(t.message||t.error||"Update failed");m({type:"success",text:t.warning||`Updated ${t.id}`}),U(null),R(!1),await H(),await K()}catch(e){m({type:"error",text:e.message})}finally{c("")}}}async function es(e){c("preview");try{let t=await fetch("/api/agent-library/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview",url:e})}),s=await t.json();if(!t.ok||!s.ok)throw Error(s.error||"Preview failed");$(s.preview||""),m({type:"success",text:`Preview loaded (${s.bytes} bytes)`})}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function ea(){c("catalog");try{let e=await fetch("/api/agent-library/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"install",skillId:C,url:k,confirmed:O})}),t=await e.json();if(!e.ok)throw Error(t.message||t.error||"Install failed");m({type:"success",text:t.warning||`Installed ${t.id}`}),T(!1),await H(),await K()}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function er(){c("export");try{let e=await fetch("/api/agent-library/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destPath:J||void 0})}),t=await e.json();if(!e.ok)throw Error(t.message||t.error||"Export failed");m({type:"success",text:`Exported AgentSync layout to ${t.path}`})}catch(e){m({type:"error",text:e.message})}finally{c("")}}return(0,a.jsxs)("div",{className:"max-w-5xl mx-auto space-y-5 pb-12",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Agent library"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted leading-relaxed max-w-2xl",children:["One Switchboard-owned library of ",(0,a.jsx)("strong",{className:"text-text-main",children:"skills"})," and"," ",(0,a.jsx)("strong",{className:"text-text-main",children:"MCP servers"}),", projected into Claude Code, Codex, OpenCode, Gemini CLI, and Cursor. Managed entries use the"," ",(0,a.jsx)("code",{className:"text-[11px] font-mono",children:"sb-"})," namespace so we never overwrite your existing skills or MCP keys."]})]}),x&&(0,a.jsx)("div",{className:`text-xs px-3 py-2 rounded-lg border ${"success"===x.type?"bg-green-500/10 border-green-500/30 text-green-600 dark:text-green-400":"warn"===x.type?"bg-amber-500/10 border-amber-500/30 text-amber-700 dark:text-amber-400":"bg-red-500/10 border-red-500/30 text-red-500"}`,children:x.text}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-main cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",className:"accent-[var(--color-primary)]",checked:!1!==F.enabled,disabled:!!o,onChange:e=>W({enabled:e.target.checked})}),"Sync enabled"]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:!!o||!1===F.enabled,loading:"dry-run"===o,onClick:()=>B("dry-run"),children:"Dry-run"}),(0,a.jsx)(l.$n,{size:"sm",disabled:!!o||!1===F.enabled,loading:"apply"===o,onClick:()=>B("apply"),children:"Apply sync"}),(0,a.jsx)(l.$n,{size:"sm",variant:"outline",disabled:!!o,loading:"doctor"===o,onClick:Y,children:"Doctor"})]})]}),(0,a.jsxs)("p",{className:"text-[11px] text-text-subtle mt-2 font-mono break-all",children:["Library: ",e?.libraryRoot||"…",F.linkMode?` \xb7 mode=${F.linkMode}`:"",F.scope?` \xb7 scope=${F.scope}`:""]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 border-b border-border pb-0",children:[{id:"overview",label:"Overview"},{id:"skills",label:"Skills"},{id:"mcp",label:"MCP"},{id:"catalog",label:"Catalog"},{id:"advanced",label:"Advanced"}].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>g(e.id),className:`px-3 py-2 text-xs font-medium rounded-t-md transition-colors ${y===e.id?"bg-surface border border-border border-b-surface text-primary -mb-px":"text-text-muted hover:text-text-main"}`,children:e.label},e.id))}),s&&(0,a.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),"Loading…"]}),!s&&"overview"===y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"How it works"}),(0,a.jsxs)("ol",{className:"text-xs text-text-muted space-y-1.5 list-decimal pl-4 leading-relaxed",children:[(0,a.jsxs)("li",{children:["Skills and MCP servers live only in Switchboard's library (",(0,a.jsx)("code",{className:"font-mono",children:"~/.switchboard/agent-library"}),")."]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("strong",{className:"text-text-main",children:"Apply sync"})," projects them into each enabled agent under namespaced paths/keys (",(0,a.jsx)("code",{className:"font-mono",children:"sb-*"}),")."]}),(0,a.jsxs)("li",{children:["If a path already exists and is ",(0,a.jsx)("em",{children:"not"})," marked managed, we"," ",(0,a.jsx)("strong",{className:"text-text-main",children:"skip"})," it (never overwrite)."]}),(0,a.jsx)("li",{children:"Turn individual agents or skills/MCP off with the toggles below."})]})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Targets"}),(0,a.jsx)("div",{className:"space-y-2",children:Object.values(G).map(e=>{let t=F.targets?.[e.id]||{skills:!0,mcp:!0};return(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 py-2 border-b border-border-subtle last:border-0",children:[(0,a.jsx)("span",{className:"text-sm text-text-main",children:e.label}),(0,a.jsxs)("div",{className:"flex gap-4 text-xs text-text-muted",children:[(0,a.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==t.skills,disabled:!e.supportsSkills||!!o,onChange:s=>W({targets:{...F.targets,[e.id]:{...t,skills:s.target.checked}}})}),"Skills"]}),(0,a.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==t.mcp,disabled:!e.supportsMcp||!!o,onChange:s=>W({targets:{...F.targets,[e.id]:{...t,mcp:s.target.checked}}})}),"MCP"]})]})]},e.id)})})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Safety & link mode"}),(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 text-xs",children:[(0,a.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Link mode"}),(0,a.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-text-main",value:F.linkMode||"copy",disabled:!!o,onChange:e=>W({linkMode:e.target.value}),children:[(0,a.jsx)("option",{value:"copy",children:"Copy (safe default on Windows)"}),(0,a.jsx)("option",{value:"symlink",children:"Symlink (instant updates; may need privileges on Windows)"})]})]}),(0,a.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Scope"}),(0,a.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-text-main",value:F.scope||"global",disabled:!!o,onChange:e=>W({scope:e.target.value,projectPath:"project"===e.target.value?F.projectPath||"":null}),children:[(0,a.jsx)("option",{value:"global",children:"Global (user home agents)"}),(0,a.jsx)("option",{value:"project",children:"Project (paths under project folder)"})]})]}),"project"===F.scope&&(0,a.jsxs)("label",{className:"flex flex-col gap-1 sm:col-span-2",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Project path (absolute)"}),(0,a.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 font-mono text-text-main",value:F.projectPath||"",placeholder:"/Users/you/my-app",disabled:!!o,onChange:e=>W({projectPath:e.target.value})})]}),(0,a.jsxs)("label",{className:"flex items-start gap-2 sm:col-span-2 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",className:"mt-0.5",checked:!1!==F.neverOverwriteUser,disabled:!!o,onChange:async e=>{e.target.checked?W({neverOverwriteUser:!0}):await (0,n.l)({message:"Allow overwriting paths that are NOT Switchboard-managed? This can replace your personal skills/MCP. Continue?",confirmText:"Continue"})&&W({neverOverwriteUser:!1,confirmAllowOverwrite:!0})}}),(0,a.jsxs)("span",{className:"text-text-muted leading-relaxed",children:[(0,a.jsx)("strong",{className:"text-text-main",children:"Never overwrite user-owned files"})," ","(recommended). Only touch ",(0,a.jsx)("code",{className:"font-mono",children:"sb-*"})," managed entries."]})]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==F.includeProductSkills,disabled:!!o,onChange:e=>W({includeProductSkills:e.target.checked})}),(0,a.jsx)("span",{className:"text-text-muted",children:"Auto-include Switchboard product skills (entry + chat)"})]})]})]}),(0,a.jsxs)("div",{className:"grid sm:grid-cols-3 gap-3",children:[(0,a.jsx)(d,{label:"Skills in library",value:String(e?.skills?.length??0)}),(0,a.jsx)(d,{label:"MCP servers",value:String(e?.mcpServers?.length??0)}),(0,a.jsx)(d,{label:"Last sync",value:e?.state?.lastSync?.at?new Date(e.state.lastSync.at).toLocaleString():"—"})]}),u&&(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Last sync detail"}),(0,a.jsx)("pre",{className:"text-[11px] font-mono text-text-muted overflow-x-auto max-h-48 bg-surface-2 p-2 rounded",children:JSON.stringify(u.summary||u,null,2)}),u.skills?.filter(e=>"conflict"===e.action).length>0&&(0,a.jsxs)("div",{className:"mt-2 text-xs text-amber-600 dark:text-amber-400",children:["Conflicts (protected):",(0,a.jsx)("ul",{className:"list-disc pl-4 mt-1",children:u.skills.filter(e=>"conflict"===e.action).map((e,t)=>(0,a.jsxs)("li",{children:[e.agent,"/",e.skillId,": ",e.message||e.reason]},t))})]})]}),p&&(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Doctor"}),p.issues?.length===0?(0,a.jsx)("p",{className:"text-xs text-green-600",children:"No issues"}):(0,a.jsx)("ul",{className:"text-xs space-y-1",children:p.issues?.map((e,t)=>(0,a.jsxs)("li",{className:"error"===e.severity?"text-red-500":"text-amber-600 dark:text-amber-400",children:["[",e.severity,"] ",e.message]},t))})]})]}),!s&&"skills"===y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"Library skills"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(l.$n,{size:"sm",variant:"ghost",disabled:!!o,onClick:async()=>{c("upd-check");try{await K(),m({type:"success",text:"Update check complete"})}finally{c("")}},children:"Check updates"}),(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:!!o,onClick:async()=>{c("ensure");try{await fetch("/api/agent-library/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"ensure_product"})}),await H(),m({type:"success",text:"Product skills ensured"})}finally{c("")}},children:"Refresh product skills"})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(e?.skills||[]).map(e=>(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 p-3 rounded-lg border border-border-subtle bg-surface-2/50",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-main",children:e.title||e.id}),(0,a.jsx)(l.Ex,{size:"sm",variant:"default",children:(0,a.jsxs)("code",{className:"text-[10px]",children:["sb-",e.id]})}),A[e.id]?.status==="update"&&(0,a.jsx)(l.Ex,{size:"sm",variant:"warning",children:"update available"}),A[e.id]?.status==="error"&&(0,a.jsx)("span",{className:"text-[10px] text-text-subtle",title:A[e.id]?.message||"check failed",children:"check failed"})]}),(0,a.jsx)("p",{className:"text-[11px] text-text-muted mt-0.5 line-clamp-2",children:e.description||"—"})]}),(0,a.jsxs)("div",{className:"flex gap-1 shrink-0",children:[A[e.id]?.status==="update"&&(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:!!o,loading:"upd-preview"===o&&Z?.id!==e.id,onClick:()=>ee(e.id),children:"Update"}),(0,a.jsx)(l.$n,{size:"sm",variant:"ghost",disabled:!!o,onClick:()=>V(e.id),children:"Remove"})]})]},e.id)),!e?.skills?.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No skills yet. Enable product skills or add manually."})]})]}),Z&&(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsxs)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:["Update preview — ",(0,a.jsx)("code",{className:"text-[12px]",children:Z.id})]}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle mb-2",children:"Full incoming SKILL.md shown below. Exactly these bytes are installed on confirm — if upstream changes in between, the update is refused and you preview again."}),(0,a.jsx)("pre",{className:"text-[10px] font-mono max-h-64 overflow-auto bg-surface-2 p-2 rounded border border-border-subtle whitespace-pre-wrap",children:Z.markdown}),(0,a.jsxs)("label",{className:"flex items-start gap-2 text-xs text-text-muted cursor-pointer mt-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:D,onChange:e=>R(e.target.checked)}),"I reviewed this skill and understand it may instruct agents to run tools/shell commands."]}),(0,a.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,a.jsx)(l.$n,{size:"sm",disabled:!D||!!o,loading:"upd-apply"===o,onClick:et,children:"Apply update"}),(0,a.jsx)(l.$n,{size:"sm",variant:"ghost",disabled:!!o,onClick:()=>{U(null),R(!1)},children:"Cancel"})]})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Add skill (paste SKILL.md)"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"skill-id (e.g. my-review)",value:E,onChange:e=>M(e.target.value)}),(0,a.jsx)("textarea",{className:"w-full h-40 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"---\nname: my-skill\ndescription: ...\n---\n\n# ...",value:I,onChange:e=>z(e.target.value)}),(0,a.jsx)(l.$n,{size:"sm",disabled:!E||!I||!!o,loading:"skill-add"===o,onClick:X,children:"Add to library"})]})]})]}),!s&&"mcp"===y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-1",children:"MCP servers in library"}),(0,a.jsxs)("p",{className:"text-[11px] text-text-subtle mb-3",children:["Prefer ",(0,a.jsxs)("code",{className:"font-mono",children:["$","{GITHUB_TOKEN}"]})," style env values — do not paste raw API keys if you can avoid it. Keys are projected as"," ",(0,a.jsx)("code",{className:"font-mono",children:"sb-*"})," only."]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(e?.mcpServers||[]).map(e=>(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 p-3 rounded-lg border border-border-subtle",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm text-text-main font-medium",children:e.name}),(0,a.jsx)("code",{className:"text-[10px] text-text-subtle",children:e.id}),(0,a.jsxs)("div",{className:"text-[11px] text-text-muted mt-1",children:[e.transport||"stdio"," \xb7"," ",e.command?`${e.command} ${(e.args||[]).join(" ")}`:e.url]})]}),(0,a.jsx)(l.$n,{size:"sm",variant:"ghost",onClick:()=>Q(e.id),children:"Remove"})]},e.id)),!e?.mcpServers?.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No MCP servers in library yet."})]})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Add MCP server"}),(0,a.jsxs)("form",{className:"grid gap-2 sm:grid-cols-2",onSubmit:q,children:[(0,a.jsx)("input",{required:!0,className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"id (e.g. filesystem)",value:f.id,onChange:e=>j({...f,id:e.target.value})}),(0,a.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs",placeholder:"Display name",value:f.name,onChange:e=>j({...f,name:e.target.value})}),(0,a.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs",value:f.transport,onChange:e=>j({...f,transport:e.target.value}),children:[(0,a.jsx)("option",{value:"stdio",children:"stdio (command)"}),(0,a.jsx)("option",{value:"http",children:"http (url)"}),(0,a.jsx)("option",{value:"sse",children:"sse (url)"})]}),"stdio"===f.transport?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"command",value:f.command,onChange:e=>j({...f,command:e.target.value})}),(0,a.jsx)("input",{className:"sm:col-span-2 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"args (space-separated)",value:f.args,onChange:e=>j({...f,args:e.target.value})})]}):(0,a.jsx)("input",{className:"sm:col-span-1 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"https://...",value:f.url,onChange:e=>j({...f,url:e.target.value})}),(0,a.jsx)("div",{className:"sm:col-span-2",children:(0,a.jsx)(l.$n,{size:"sm",type:"submit",loading:"mcp"===o,disabled:!!o,children:"Save to library"})})]})]})]}),!s&&"catalog"===y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-1",children:"Trusted presets"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle mb-3",children:"Fetches SKILL.md only — never runs install scripts. You must confirm and then Apply sync."}),(0,a.jsx)("div",{className:"space-y-2",children:v.map(e=>(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 p-2 rounded border border-border-subtle",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm text-text-main",children:e.name}),(0,a.jsx)("div",{className:"text-[11px] text-text-muted",children:e.description})]}),(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)(l.$n,{size:"sm",variant:"ghost",onClick:()=>{N(e.rawUrl),S(e.skillId),es(e.rawUrl)},children:"Preview"}),(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",onClick:()=>{N(e.rawUrl),S(e.skillId),T(!1)},children:"Select"})]})]},e.id))})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Install from URL"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"skill-id",value:C,onChange:e=>S(e.target.value)}),(0,a.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"https://.../SKILL.md",value:k,onChange:e=>N(e.target.value)}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:!k||!!o,onClick:()=>es(k),children:"Preview"})}),P&&(0,a.jsx)("pre",{className:"text-[10px] font-mono max-h-48 overflow-auto bg-surface-2 p-2 rounded border border-border-subtle whitespace-pre-wrap",children:P}),(0,a.jsxs)("label",{className:"flex items-start gap-2 text-xs text-text-muted cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:O,onChange:e=>T(e.target.checked)}),"I reviewed this skill and understand it may instruct agents to run tools/shell commands."]}),(0,a.jsx)(l.$n,{size:"sm",disabled:!k||!C||!O||!!o,loading:"catalog"===o,onClick:ea,children:"Install into library"})]})]})]}),!s&&"advanced"===y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Clean managed projections"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-3",children:["Removes only ",(0,a.jsx)("code",{className:"font-mono",children:"sb-*"})," skills and MCP keys written by Switchboard. Your other skills/MCP stay untouched."]}),(0,a.jsx)(l.$n,{size:"sm",variant:"outline",disabled:!!o,loading:"clean"===o,onClick:async()=>{await (0,n.l)({message:"Remove all Switchboard-managed skill/MCP projections from targets?",confirmText:"Continue"})&&B("clean")},children:"Clean managed only"})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Export AgentSync layout"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Writes a coexistence-friendly ",(0,a.jsx)("code",{className:"font-mono",children:".agents/"})," tree (skills + agentsync.toml). Does not run agentsync. Paths must be under your home or project directory."]}),(0,a.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono mb-2",placeholder:"Optional dest (default ~/switchboard-agents-export/.agents)",value:J,onChange:e=>_(e.target.value)}),(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:!!o,loading:"export"===o,onClick:er,children:"Export"})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Coexistence"}),(0,a.jsxs)("ul",{className:"text-xs text-text-muted space-y-1 list-disc pl-4",children:[(0,a.jsxs)("li",{children:["Switchboard only owns ",(0,a.jsx)("code",{className:"font-mono",children:"sb-*"})," skill directories and MCP keys."]}),(0,a.jsx)("li",{children:"AgentSync / skillbook may manage other paths — avoid pointing both at the same un-namespaced skill."}),(0,a.jsx)("li",{children:"Product skills for HTTP agents remain under Dashboard → Skills (separate)."})]})]})]})]})}function d({label:e,value:t}){return(0,a.jsxs)(l.Zp,{padding:"sm",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-text-subtle font-semibold",children:e}),(0,a.jsx)("div",{className:"text-sm text-text-main mt-1 font-medium truncate",title:t,children:t})]})}}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=5194)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6897],{5194:(e,t,s)=>{Promise.resolve().then(s.bind(s,94091))},94091:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>i});var a=s(95155),r=s(12115),l=s(35497),n=s(77251);function i(){let[e,t]=(0,r.useState)(null),[s,i]=(0,r.useState)(!0),[o,c]=(0,r.useState)(""),[x,m]=(0,r.useState)(null),[p,h]=(0,r.useState)(null),[u,b]=(0,r.useState)(null),[y,g]=(0,r.useState)("overview"),[f,j]=(0,r.useState)({id:"",name:"",transport:"stdio",command:"npx",args:"-y @modelcontextprotocol/server-filesystem .",url:"",notes:""}),[v,w]=(0,r.useState)([]),[k,N]=(0,r.useState)(""),[C,S]=(0,r.useState)(""),[P,$]=(0,r.useState)(""),[O,T]=(0,r.useState)(!1),[E,M]=(0,r.useState)(""),[I,z]=(0,r.useState)(""),[A,L]=(0,r.useState)({}),[Z,U]=(0,r.useState)(null),[D,R]=(0,r.useState)(!1),[J,_]=(0,r.useState)(""),H=(0,r.useCallback)(async()=>{i(!0);try{let e=await fetch("/api/agent-library",{cache:"no-store"}),s=await e.json();if(!e.ok)throw Error(s.error||"Load failed");t(s)}catch(e){m({type:"error",text:e.message})}finally{i(!1)}},[]),K=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/agent-library/updates",{cache:"no-store"}),t=await e.json();if(!e.ok)return;let s={};for(let e of t.results||[])s[e.id]=e;L(s)}catch{}},[]);(0,r.useEffect)(()=>{H(),K(),fetch("/api/agent-library/catalog").then(e=>e.json()).then(e=>w(e.presets||[])).catch(()=>{})},[H,K]);let F=e?.settings||{},G=e?.agents||{};async function W(e){c("settings"),m(null);try{let t=await fetch("/api/agent-library",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();if(!t.ok)throw Error(s.error||"Save failed");m({type:"success",text:"Settings saved"}),await H()}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function B(e){c(e),m(null),b(null);try{let t=await fetch("/api/agent-library/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,confirm:"clean"===e||void 0})}),s=await t.json();if(!t.ok)throw Error(s.error||s.message||"Sync failed");b(s),m({type:s.conflictCount?"warn":"success",text:"dry-run"===e?`Dry-run: ${s.summary?.skillsSynced??0} skill ops, ${s.summary?.mcpOk??0} MCP ok, ${s.conflictCount||0} conflicts`:"clean"===e?"Removed Switchboard-managed projections only":`Applied: ${s.summary?.skillsSynced??0} skills synced, ${s.conflictCount||0} conflicts protected`}),await H()}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function Y(){c("doctor");try{let e=await fetch("/api/agent-library/doctor",{cache:"no-store"}),t=await e.json();if(!e.ok)throw Error(t.error||"Doctor failed");h(t),m({type:t.ok?"success":"warn",text:t.ok?"Doctor: no blocking errors":`Doctor: ${t.issues?.filter(e=>"error"===e.severity).length||0} errors`})}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function q(e){e?.preventDefault?.(),c("mcp");try{let e=f.args?f.args.split(/\s+/).filter(Boolean):[],t=await fetch("/api/agent-library/mcp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:f.id,name:f.name||f.id,transport:f.transport,command:"stdio"===f.transport?f.command:void 0,args:"stdio"===f.transport?e:void 0,url:"stdio"!==f.transport?f.url:void 0,notes:f.notes})}),s=await t.json();if(!t.ok)throw Error(s.error||"MCP save failed");s.warnings?.length?m({type:"warn",text:s.warnings.join(" \xb7 ")}):m({type:"success",text:`MCP ${s.server?.id} saved (Apply to project)`}),j({id:"",name:"",transport:"stdio",command:"npx",args:"",url:"",notes:""}),await H()}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function Q(e){if(await (0,n.l)({message:`Remove MCP ${e} from library? (targets updated on next Apply)`,confirmText:"Continue"})){c("mcp-del");try{let t=await fetch(`/api/agent-library/mcp?id=${encodeURIComponent(e)}`,{method:"DELETE"}),s=await t.json();if(!t.ok)throw Error(s.error);m({type:"success",text:"MCP removed from library"}),await H()}catch(e){m({type:"error",text:e.message})}finally{c("")}}}async function V(e){if(await (0,n.l)({message:`Remove skill ${e} from library?`,confirmText:"Continue"})){c("skill-del");try{let t=await fetch(`/api/agent-library/skills?id=${encodeURIComponent(e)}`,{method:"DELETE"}),s=await t.json();if(!t.ok)throw Error(s.error);m({type:"success",text:"Skill removed from library"}),await H(),await K()}catch(e){m({type:"error",text:e.message})}finally{c("")}}}async function X(){c("skill-add");try{let e=await fetch("/api/agent-library/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:E,markdown:I,source:"manual"})}),t=await e.json();if(!e.ok)throw Error(t.error);m({type:"success",text:`Skill ${t.id} installed in library`}),M(""),z(""),await H()}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function ee(e){c("upd-preview"),R(!1);try{let t=await fetch("/api/agent-library/updates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview",skillId:e})}),s=await t.json();if(!t.ok||!s.ok)throw Error(s.message||s.error||"Preview failed");U({id:e,markdown:s.markdown,contentHash:s.contentHash})}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function et(){if(Z){c("upd-apply");try{let e=await fetch("/api/agent-library/updates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update",skillId:Z.id,confirmed:D,expectedHash:Z.contentHash})}),t=await e.json();if(!e.ok||!t.ok)throw Error(t.message||t.error||"Update failed");m({type:"success",text:t.warning||`Updated ${t.id}`}),U(null),R(!1),await H(),await K()}catch(e){m({type:"error",text:e.message})}finally{c("")}}}async function es(e){c("preview");try{let t=await fetch("/api/agent-library/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview",url:e})}),s=await t.json();if(!t.ok||!s.ok)throw Error(s.error||"Preview failed");$(s.preview||""),m({type:"success",text:`Preview loaded (${s.bytes} bytes)`})}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function ea(){c("catalog");try{let e=await fetch("/api/agent-library/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"install",skillId:C,url:k,confirmed:O})}),t=await e.json();if(!e.ok)throw Error(t.message||t.error||"Install failed");m({type:"success",text:t.warning||`Installed ${t.id}`}),T(!1),await H(),await K()}catch(e){m({type:"error",text:e.message})}finally{c("")}}async function er(){c("export");try{let e=await fetch("/api/agent-library/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({destPath:J||void 0})}),t=await e.json();if(!e.ok)throw Error(t.message||t.error||"Export failed");m({type:"success",text:`Exported AgentSync layout to ${t.path}`})}catch(e){m({type:"error",text:e.message})}finally{c("")}}return(0,a.jsxs)("div",{className:"max-w-5xl mx-auto space-y-5 pb-12",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,a.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Agent library"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted leading-relaxed max-w-2xl",children:["One Switchboard-owned library of ",(0,a.jsx)("strong",{className:"text-text-main",children:"skills"})," and"," ",(0,a.jsx)("strong",{className:"text-text-main",children:"MCP servers"}),", projected into Claude Code, Codex, OpenCode, Gemini CLI, and Cursor. Managed entries use the"," ",(0,a.jsx)("code",{className:"text-[11px] font-mono",children:"sb-"})," namespace so we never overwrite your existing skills or MCP keys."]})]}),x&&(0,a.jsx)("div",{className:`text-xs px-3 py-2 rounded-lg border ${"success"===x.type?"bg-green-500/10 border-green-500/30 text-green-600 dark:text-green-400":"warn"===x.type?"bg-amber-500/10 border-amber-500/30 text-amber-700 dark:text-amber-400":"bg-red-500/10 border-red-500/30 text-red-500"}`,children:x.text}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-main cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",className:"accent-[var(--color-primary)]",checked:!1!==F.enabled,disabled:!!o,onChange:e=>W({enabled:e.target.checked})}),"Sync enabled"]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:!!o||!1===F.enabled,loading:"dry-run"===o,onClick:()=>B("dry-run"),children:"Dry-run"}),(0,a.jsx)(l.$n,{size:"sm",disabled:!!o||!1===F.enabled,loading:"apply"===o,onClick:()=>B("apply"),children:"Apply sync"}),(0,a.jsx)(l.$n,{size:"sm",variant:"outline",disabled:!!o,loading:"doctor"===o,onClick:Y,children:"Doctor"})]})]}),(0,a.jsxs)("p",{className:"text-[11px] text-text-subtle mt-2 font-mono break-all",children:["Library: ",e?.libraryRoot||"…",F.linkMode?` \xb7 mode=${F.linkMode}`:"",F.scope?` \xb7 scope=${F.scope}`:""]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 border-b border-border pb-0",children:[{id:"overview",label:"Overview"},{id:"skills",label:"Skills"},{id:"mcp",label:"MCP"},{id:"catalog",label:"Catalog"},{id:"advanced",label:"Advanced"}].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>g(e.id),className:`px-3 py-2 text-xs font-medium rounded-t-md transition-colors ${y===e.id?"bg-surface border border-border border-b-surface text-primary -mb-px":"text-text-muted hover:text-text-main"}`,children:e.label},e.id))}),s&&(0,a.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),"Loading…"]}),!s&&"overview"===y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"How it works"}),(0,a.jsxs)("ol",{className:"text-xs text-text-muted space-y-1.5 list-decimal pl-4 leading-relaxed",children:[(0,a.jsxs)("li",{children:["Skills and MCP servers live only in Switchboard's library (",(0,a.jsx)("code",{className:"font-mono",children:"~/.switchboard/agent-library"}),")."]}),(0,a.jsxs)("li",{children:[(0,a.jsx)("strong",{className:"text-text-main",children:"Apply sync"})," projects them into each enabled agent under namespaced paths/keys (",(0,a.jsx)("code",{className:"font-mono",children:"sb-*"}),")."]}),(0,a.jsxs)("li",{children:["If a path already exists and is ",(0,a.jsx)("em",{children:"not"})," marked managed, we"," ",(0,a.jsx)("strong",{className:"text-text-main",children:"skip"})," it (never overwrite)."]}),(0,a.jsx)("li",{children:"Turn individual agents or skills/MCP off with the toggles below."})]})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Targets"}),(0,a.jsx)("div",{className:"space-y-2",children:Object.values(G).map(e=>{let t=F.targets?.[e.id]||{skills:!0,mcp:!0};return(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 py-2 border-b border-border-subtle last:border-0",children:[(0,a.jsx)("span",{className:"text-sm text-text-main",children:e.label}),(0,a.jsxs)("div",{className:"flex gap-4 text-xs text-text-muted",children:[(0,a.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==t.skills,disabled:!e.supportsSkills||!!o,onChange:s=>W({targets:{...F.targets,[e.id]:{...t,skills:s.target.checked}}})}),"Skills"]}),(0,a.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==t.mcp,disabled:!e.supportsMcp||!!o,onChange:s=>W({targets:{...F.targets,[e.id]:{...t,mcp:s.target.checked}}})}),"MCP"]})]})]},e.id)})})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Safety & link mode"}),(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 text-xs",children:[(0,a.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Link mode"}),(0,a.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-text-main",value:F.linkMode||"copy",disabled:!!o,onChange:e=>W({linkMode:e.target.value}),children:[(0,a.jsx)("option",{value:"copy",children:"Copy (safe default on Windows)"}),(0,a.jsx)("option",{value:"symlink",children:"Symlink (instant updates; may need privileges on Windows)"})]})]}),(0,a.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Scope"}),(0,a.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-text-main",value:F.scope||"global",disabled:!!o,onChange:e=>W({scope:e.target.value,projectPath:"project"===e.target.value?F.projectPath||"":null}),children:[(0,a.jsx)("option",{value:"global",children:"Global (user home agents)"}),(0,a.jsx)("option",{value:"project",children:"Project (paths under project folder)"})]})]}),"project"===F.scope&&(0,a.jsxs)("label",{className:"flex flex-col gap-1 sm:col-span-2",children:[(0,a.jsx)("span",{className:"text-text-muted",children:"Project path (absolute)"}),(0,a.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 font-mono text-text-main",value:F.projectPath||"",placeholder:"/Users/you/my-app",disabled:!!o,onChange:e=>W({projectPath:e.target.value})})]}),(0,a.jsxs)("label",{className:"flex items-start gap-2 sm:col-span-2 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",className:"mt-0.5",checked:!1!==F.neverOverwriteUser,disabled:!!o,onChange:async e=>{e.target.checked?W({neverOverwriteUser:!0}):await (0,n.l)({message:"Allow overwriting paths that are NOT Switchboard-managed? This can replace your personal skills/MCP. Continue?",confirmText:"Continue"})&&W({neverOverwriteUser:!1,confirmAllowOverwrite:!0})}}),(0,a.jsxs)("span",{className:"text-text-muted leading-relaxed",children:[(0,a.jsx)("strong",{className:"text-text-main",children:"Never overwrite user-owned files"})," ","(recommended). Only touch ",(0,a.jsx)("code",{className:"font-mono",children:"sb-*"})," managed entries."]})]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:!1!==F.includeProductSkills,disabled:!!o,onChange:e=>W({includeProductSkills:e.target.checked})}),(0,a.jsx)("span",{className:"text-text-muted",children:"Auto-include Switchboard product skills (entry + chat)"})]})]})]}),(0,a.jsxs)("div",{className:"grid sm:grid-cols-3 gap-3",children:[(0,a.jsx)(d,{label:"Skills in library",value:String(e?.skills?.length??0)}),(0,a.jsx)(d,{label:"MCP servers",value:String(e?.mcpServers?.length??0)}),(0,a.jsx)(d,{label:"Last sync",value:e?.state?.lastSync?.at?new Date(e.state.lastSync.at).toLocaleString():"—"})]}),u&&(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Last sync detail"}),(0,a.jsx)("pre",{className:"text-[11px] font-mono text-text-muted overflow-x-auto max-h-48 bg-surface-2 p-2 rounded",children:JSON.stringify(u.summary||u,null,2)}),u.skills?.filter(e=>"conflict"===e.action).length>0&&(0,a.jsxs)("div",{className:"mt-2 text-xs text-amber-600 dark:text-amber-400",children:["Conflicts (protected):",(0,a.jsx)("ul",{className:"list-disc pl-4 mt-1",children:u.skills.filter(e=>"conflict"===e.action).map((e,t)=>(0,a.jsxs)("li",{children:[e.agent,"/",e.skillId,": ",e.message||e.reason]},t))})]})]}),p&&(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Doctor"}),p.issues?.length===0?(0,a.jsx)("p",{className:"text-xs text-green-600",children:"No issues"}):(0,a.jsx)("ul",{className:"text-xs space-y-1",children:p.issues?.map((e,t)=>(0,a.jsxs)("li",{className:"error"===e.severity?"text-red-500":"text-amber-600 dark:text-amber-400",children:["[",e.severity,"] ",e.message]},t))})]})]}),!s&&"skills"===y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"Library skills"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(l.$n,{size:"sm",variant:"ghost",disabled:!!o,onClick:async()=>{c("upd-check");try{await K(),m({type:"success",text:"Update check complete"})}finally{c("")}},children:"Check updates"}),(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:!!o,onClick:async()=>{c("ensure");try{await fetch("/api/agent-library/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"ensure_product"})}),await H(),m({type:"success",text:"Product skills ensured"})}finally{c("")}},children:"Refresh product skills"})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(e?.skills||[]).map(e=>(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 p-3 rounded-lg border border-border-subtle bg-surface-2/50",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-text-main",children:e.title||e.id}),(0,a.jsx)(l.Ex,{size:"sm",variant:"default",children:(0,a.jsxs)("code",{className:"text-[10px]",children:["sb-",e.id]})}),A[e.id]?.status==="update"&&(0,a.jsx)(l.Ex,{size:"sm",variant:"warning",children:"update available"}),A[e.id]?.status==="error"&&(0,a.jsx)("span",{className:"text-[10px] text-text-subtle",title:A[e.id]?.message||"check failed",children:"check failed"})]}),(0,a.jsx)("p",{className:"text-[11px] text-text-muted mt-0.5 line-clamp-2",children:e.description||"—"})]}),(0,a.jsxs)("div",{className:"flex gap-1 shrink-0",children:[A[e.id]?.status==="update"&&(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:!!o,loading:"upd-preview"===o&&Z?.id!==e.id,onClick:()=>ee(e.id),children:"Update"}),(0,a.jsx)(l.$n,{size:"sm",variant:"ghost",disabled:!!o,onClick:()=>V(e.id),children:"Remove"})]})]},e.id)),!e?.skills?.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No skills yet. Enable product skills or add manually."})]})]}),Z&&(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsxs)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:["Update preview — ",(0,a.jsx)("code",{className:"text-[12px]",children:Z.id})]}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle mb-2",children:"Full incoming SKILL.md shown below. Exactly these bytes are installed on confirm — if upstream changes in between, the update is refused and you preview again."}),(0,a.jsx)("pre",{className:"text-[10px] font-mono max-h-64 overflow-auto bg-surface-2 p-2 rounded border border-border-subtle whitespace-pre-wrap",children:Z.markdown}),(0,a.jsxs)("label",{className:"flex items-start gap-2 text-xs text-text-muted cursor-pointer mt-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:D,onChange:e=>R(e.target.checked)}),"I reviewed this skill and understand it may instruct agents to run tools/shell commands."]}),(0,a.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,a.jsx)(l.$n,{size:"sm",disabled:!D||!!o,loading:"upd-apply"===o,onClick:et,children:"Apply update"}),(0,a.jsx)(l.$n,{size:"sm",variant:"ghost",disabled:!!o,onClick:()=>{U(null),R(!1)},children:"Cancel"})]})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Add skill (paste SKILL.md)"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"skill-id (e.g. my-review)",value:E,onChange:e=>M(e.target.value)}),(0,a.jsx)("textarea",{className:"w-full h-40 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"---\nname: my-skill\ndescription: ...\n---\n\n# ...",value:I,onChange:e=>z(e.target.value)}),(0,a.jsx)(l.$n,{size:"sm",disabled:!E||!I||!!o,loading:"skill-add"===o,onClick:X,children:"Add to library"})]})]})]}),!s&&"mcp"===y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-1",children:"MCP servers in library"}),(0,a.jsxs)("p",{className:"text-[11px] text-text-subtle mb-3",children:["Prefer ",(0,a.jsxs)("code",{className:"font-mono",children:["$","{GITHUB_TOKEN}"]})," style env values — do not paste raw API keys if you can avoid it. Keys are projected as"," ",(0,a.jsx)("code",{className:"font-mono",children:"sb-*"})," only."]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(e?.mcpServers||[]).map(e=>(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 p-3 rounded-lg border border-border-subtle",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm text-text-main font-medium",children:e.name}),(0,a.jsx)("code",{className:"text-[10px] text-text-subtle",children:e.id}),(0,a.jsxs)("div",{className:"text-[11px] text-text-muted mt-1",children:[e.transport||"stdio"," \xb7"," ",e.command?`${e.command} ${(e.args||[]).join(" ")}`:e.url]})]}),(0,a.jsx)(l.$n,{size:"sm",variant:"ghost",onClick:()=>Q(e.id),children:"Remove"})]},e.id)),!e?.mcpServers?.length&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"No MCP servers in library yet."})]})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-3",children:"Add MCP server"}),(0,a.jsxs)("form",{className:"grid gap-2 sm:grid-cols-2",onSubmit:q,children:[(0,a.jsx)("input",{required:!0,className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"id (e.g. filesystem)",value:f.id,onChange:e=>j({...f,id:e.target.value})}),(0,a.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs",placeholder:"Display name",value:f.name,onChange:e=>j({...f,name:e.target.value})}),(0,a.jsxs)("select",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs",value:f.transport,onChange:e=>j({...f,transport:e.target.value}),children:[(0,a.jsx)("option",{value:"stdio",children:"stdio (command)"}),(0,a.jsx)("option",{value:"http",children:"http (url)"}),(0,a.jsx)("option",{value:"sse",children:"sse (url)"})]}),"stdio"===f.transport?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{className:"bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"command",value:f.command,onChange:e=>j({...f,command:e.target.value})}),(0,a.jsx)("input",{className:"sm:col-span-2 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"args (space-separated)",value:f.args,onChange:e=>j({...f,args:e.target.value})})]}):(0,a.jsx)("input",{className:"sm:col-span-1 bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"https://...",value:f.url,onChange:e=>j({...f,url:e.target.value})}),(0,a.jsx)("div",{className:"sm:col-span-2",children:(0,a.jsx)(l.$n,{size:"sm",type:"submit",loading:"mcp"===o,disabled:!!o,children:"Save to library"})})]})]})]}),!s&&"catalog"===y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-1",children:"Trusted presets"}),(0,a.jsx)("p",{className:"text-[11px] text-text-subtle mb-3",children:"Fetches SKILL.md only — never runs install scripts. You must confirm and then Apply sync."}),(0,a.jsx)("div",{className:"space-y-2",children:v.map(e=>(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 p-2 rounded border border-border-subtle",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-sm text-text-main",children:e.name}),(0,a.jsx)("div",{className:"text-[11px] text-text-muted",children:e.description})]}),(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)(l.$n,{size:"sm",variant:"ghost",onClick:()=>{N(e.rawUrl),S(e.skillId),es(e.rawUrl)},children:"Preview"}),(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",onClick:()=>{N(e.rawUrl),S(e.skillId),T(!1)},children:"Select"})]})]},e.id))})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Install from URL"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"skill-id",value:C,onChange:e=>S(e.target.value)}),(0,a.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono",placeholder:"https://.../SKILL.md",value:k,onChange:e=>N(e.target.value)}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:!k||!!o,onClick:()=>es(k),children:"Preview"})}),P&&(0,a.jsx)("pre",{className:"text-[10px] font-mono max-h-48 overflow-auto bg-surface-2 p-2 rounded border border-border-subtle whitespace-pre-wrap",children:P}),(0,a.jsxs)("label",{className:"flex items-start gap-2 text-xs text-text-muted cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:O,onChange:e=>T(e.target.checked)}),"I reviewed this skill and understand it may instruct agents to run tools/shell commands."]}),(0,a.jsx)(l.$n,{size:"sm",disabled:!k||!C||!O||!!o,loading:"catalog"===o,onClick:ea,children:"Install into library"})]})]})]}),!s&&"advanced"===y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Clean managed projections"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-3",children:["Removes only ",(0,a.jsx)("code",{className:"font-mono",children:"sb-*"})," skills and MCP keys written by Switchboard. Your other skills/MCP stay untouched."]}),(0,a.jsx)(l.$n,{size:"sm",variant:"outline",disabled:!!o,loading:"clean"===o,onClick:async()=>{await (0,n.l)({message:"Remove all Switchboard-managed skill/MCP projections from targets?",confirmText:"Continue"})&&B("clean")},children:"Clean managed only"})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Export AgentSync layout"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Writes a coexistence-friendly ",(0,a.jsx)("code",{className:"font-mono",children:".agents/"})," tree (skills + agentsync.toml). Does not run agentsync. Paths must be under your home or project directory."]}),(0,a.jsx)("input",{className:"w-full bg-surface border border-border rounded-md px-2 py-1.5 text-xs font-mono mb-2",placeholder:"Optional dest (default ~/switchboard-agents-export/.agents)",value:J,onChange:e=>_(e.target.value)}),(0,a.jsx)(l.$n,{size:"sm",variant:"secondary",disabled:!!o,loading:"export"===o,onClick:er,children:"Export"})]}),(0,a.jsxs)(l.Zp,{padding:"md",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main mb-2",children:"Coexistence"}),(0,a.jsxs)("ul",{className:"text-xs text-text-muted space-y-1 list-disc pl-4",children:[(0,a.jsxs)("li",{children:["Switchboard only owns ",(0,a.jsx)("code",{className:"font-mono",children:"sb-*"})," skill directories and MCP keys."]}),(0,a.jsx)("li",{children:"AgentSync / skillbook may manage other paths — avoid pointing both at the same un-namespaced skill."}),(0,a.jsx)("li",{children:"Product skills for HTTP agents remain under Dashboard → Skills (separate)."})]})]})]})]})}function d({label:e,value:t}){return(0,a.jsxs)(l.Zp,{padding:"sm",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-text-subtle font-semibold",children:e}),(0,a.jsx)("div",{className:"text-sm text-text-main mt-1 font-medium truncate",title:t,children:t})]})}}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=5194)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4465],{55774:(e,t,r)=>{Promise.resolve().then(r.bind(r,88512))},88512:(e,t,r)=>{"use strict";r.d(t,{default:()=>w});var s=r(95155),a=r(12115),i=r(35497),l=r(28777),n=r(88105),o=r(5772);let d="basic-chat.sessions",c="basic-chat.activeSessionId",m="basic-chat.activeProviderId",u="basic-chat.draft";function p(){return globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():`chat_${Date.now()}_${Math.random().toString(16).slice(2)}`}function h(e){if("string"==typeof e)return e;if(null==e)return"";if(Array.isArray(e))return e.map(h).filter(Boolean).join(" ");if("object"==typeof e){if("string"==typeof e.message)return e.message;if("string"==typeof e.error)return e.error;try{return JSON.stringify(e)}catch{}}return String(e)}function x(e=""){let t=h(e).replace(/\s+/g," ").trim();return t?t.length>52?`${t.slice(0,52).trimEnd()}…`:t:"New chat"}async function f(e){return await new Promise((t,r)=>{let s=new FileReader;s.onload=()=>t(String(s.result||"")),s.onerror=()=>r(s.error||Error("Failed to read file")),s.readAsDataURL(e)})}function g(e){return e?.name||function(e=""){return String(e).replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()||"Unknown"}(e?.provider||e?.id||"provider")}function w(){let[e,t]=(0,a.useState)([]),[r,w]=(0,a.useState)(!0),[v,b]=(0,a.useState)(""),[N,y]=(0,a.useState)(()=>{try{let e=function(e,t){try{return JSON.parse(e)}catch{return t}}(globalThis.localStorage.getItem(d),[]);return Array.isArray(e)?e.map(e=>({...e,messages:Array.isArray(e.messages)?e.messages:[]})):[]}catch{return[]}}),[j,S]=(0,a.useState)(()=>globalThis.localStorage.getItem(c)||""),[I,A]=(0,a.useState)(()=>globalThis.localStorage.getItem(m)||""),[k,D]=(0,a.useState)(""),[O,$]=(0,a.useState)(()=>globalThis.localStorage.getItem(u)||""),[C,_]=(0,a.useState)([]),[M,E]=(0,a.useState)(!1),[T,U]=(0,a.useState)(""),[R,z]=(0,a.useState)(""),[q,P]=(0,a.useState)(!1),[J,B]=(0,a.useState)(!1),[F,K]=(0,a.useState)(!1),L=(0,a.useRef)(null),W=(0,a.useRef)(null),H=(0,a.useRef)(!1),Y=(0,a.useRef)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>{P(!0)},[]),(0,a.useEffect)(()=>{let e=!1;return async function(){w(!0),b("");try{let r=await fetch("/api/providers",{cache:"no-store"}),s=await r.json().catch(()=>({})),a=Array.isArray(s.connections)?s.connections.filter(e=>e?.isActive!==!1):[];if(0===a.length){e||(t([]),b("No providers connected yet."));return}let i=new Map;for(let e of a){let t=e.provider||e.id,r=g(e),s=(0,n.mq)(t)?"openai-compatible":(0,n.gb)(t)?"anthropic-compatible":t;i.has(t)||i.set(t,{providerId:t,providerName:r,providerType:s,connections:[],models:[]});let a=i.get(t);a.providerName=a.providerName||r,a.providerType=a.providerType||s,a.connections.push(e);let o=(0,l.KC)(t).map(t=>t?.id?{id:`${e.provider}/${t.id}`,requestModel:`${e.provider}/${t.id}`,name:t.name||t.id,providerId:e.provider,providerName:g(e),source:"static"}:null).filter(Boolean);a.models.push(...o)}for(let e of(await Promise.all(a.map(async e=>{try{let t=await fetch(`/api/providers/${e.id}/models`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)return{connection:e,models:[]};let s=(Array.isArray(r?.models)?r.models:Array.isArray(r?.data)?r.data:Array.isArray(r?.results)?r.results:Array.isArray(r)?r:[]).map(t=>(function(e,t){let r="string"==typeof e?e:e?.id||e?.name||e?.model||"";if(!r)return null;let s="string"==typeof e?e:e?.name||e?.displayName||r,a=r;return((0,n.mq)(t.provider)||(0,n.gb)(t.provider))&&!r.includes("/")&&(a=`${t.provider}/${r}`),{id:a,requestModel:a,name:s,providerId:t.provider,providerName:g(t),source:"live"}})(t,e)).filter(Boolean);return{connection:e,models:s}}catch{return{connection:e,models:[]}}})))){let t=e.connection.provider||e.connection.id,r=i.get(t);r&&r.models.push(...e.models)}let o=Array.from(i.values()).map(e=>({...e,models:(function(e){let t=new Map;for(let r of e)r?.id&&(t.has(r.id)||t.set(r.id,r));return Array.from(t.values())})(e.models).sort((e,t)=>e.name.localeCompare(t.name))})).filter(e=>e.models.length>0).sort((e,t)=>e.providerName.localeCompare(t.providerName));e||(t(o),0===o.length&&b("Providers connected but no models available."))}catch(r){e||(b(h(r?.message)||"Failed to load providers/models."),t([]))}finally{e||w(!1)}}(),()=>{e=!0}},[]),(0,a.useEffect)(()=>{let e=e=>{Y.current&&!Y.current.contains(e.target)&&B(!1),G.current&&!G.current.contains(e.target)&&K(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let Q=(0,a.useMemo)(()=>{let t=new Map;for(let r of e)for(let e of r.models)t.set(e.id,{...e,providerId:r.providerId,providerName:r.providerName});return t},[e]),V=(0,a.useMemo)(()=>e.find(e=>e.providerId===I)||e[0]||null,[e,I]),X=(0,a.useMemo)(()=>{if(k&&Q.has(k))return Q.get(k);if(j){let e=N.find(e=>e.id===j);if(e?.modelId&&Q.has(e.modelId))return Q.get(e.modelId)}return V?.models?.[0]||null},[k,Q,V,N,j]),Z=(0,a.useMemo)(()=>N.find(e=>e.id===j)||null,[N,j]),ee=Z?.messages||[],et=(0,a.useMemo)(()=>[...N].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()),[N]),er=!M&&!!X&&(O.trim().length>0||C.length>0);(0,a.useEffect)(()=>{if(q)try{globalThis.localStorage.setItem(d,JSON.stringify(N)),globalThis.localStorage.setItem(c,j),globalThis.localStorage.setItem(m,I),globalThis.localStorage.setItem(u,O)}catch{}},[q,N,j,I,O]),(0,a.useEffect)(()=>{if(!q||r||H.current||0===e.length)return;let t=e.find(e=>e.providerId===I)||e[0],s=k&&Q.has(k)?Q.get(k):t.models[0];if(N.length>0){let e=N.find(e=>e.id===j)||N[0],r=e?.modelId&&Q.has(e.modelId)?Q.get(e.modelId):s;H.current=!0,S(e.id),A(r?.providerId||t.providerId),D(r?.id||s.id);return}let a={id:p(),title:"New chat",providerId:t.providerId,providerName:t.providerName,modelId:s.id,modelName:s.name,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messages:[]};H.current=!0,y([a]),S(a.id),A(t.providerId),D(s.id)},[q,r,e,Q,N,j,I,k]);let es=(e,t)=>{y(r=>r.map(r=>r.id===e?t({...r,messages:Array.isArray(r.messages)?r.messages.map(e=>({...e})):[]}):r))},ea=e=>e?{id:p(),title:"New chat",providerId:e.providerId,providerName:e.providerName,modelId:e.id,modelName:e.name,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messages:[]}:null,ei=async e=>{let t=Array.from(e.target.files||[]);if(0===t.length)return;let r=t.filter(e=>e.type.startsWith("image/"));if(0===r.length){e.target.value="";return}let s=await Promise.all(r.map(async e=>({id:p(),name:e.name,type:e.type,size:e.size,dataUrl:await f(e)})));_(e=>[...e,...s]),e.target.value=""},el=async()=>{let e=X||V?.models?.[0]||null;if(!e)return;let t=O.trim();if(!t&&0===C.length)return;let r=j,s=N.find(e=>e.id===r);if(!s){if(!(s=ea(e)))return;r=s.id,y(e=>[s,...e]),S(r)}let a={id:p(),role:"user",content:t,attachments:C.map(e=>({id:e.id,name:e.name,type:e.type,dataUrl:e.dataUrl})),createdAt:new Date().toISOString()},i=p(),l={id:i,role:"assistant",content:"",createdAt:new Date().toISOString(),status:"streaming"},n=[...s.messages||[],a,l];y(s=>s.map(s=>s.id===r?{...s,providerId:e.providerId,providerName:e.providerName,modelId:e.id,modelName:e.name,messages:n,updatedAt:new Date().toISOString(),title:"New chat"===s.title?x(t):s.title}:s)),$(""),_([]),E(!0),U(i),z(""),W.current?.abort(),W.current=new AbortController;let o=n.filter(e=>"assistant"!==e.role||e.id!==i).map(e=>({role:e.role,content:"user"===e.role?function(e){let t=h(e.content).trim(),r=Array.isArray(e.attachments)?e.attachments:[];if(0===r.length)return t;let s=[];for(let e of(t&&s.push({type:"text",text:t}),r))e?.dataUrl&&s.push({type:"image_url",image_url:{url:e.dataUrl}});return s.length>0?s:t}(e):e.content}));try{var d;let s,a=await fetch("/api/dashboard/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({model:e.requestModel||e.id,messages:o,stream:!0}),signal:W.current.signal});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(h(e.error||e.message||`Request failed (${a.status})`))}let l=a.body?.getReader();if(!l){let e=await a.json().catch(()=>({})),t=h(e?.choices?.[0]?.message?.content||e?.output_text||e?.error||e?.message||"");es(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:t,status:"done"}:e),updatedAt:new Date().toISOString()}));return}let n=new TextDecoder,c="",m="";for(;;){let{value:e,done:t}=await l.read();if(t)break;let s=(c+=n.decode(e,{stream:!0})).split(/\r?\n/);for(let e of(c=s.pop()||"",s)){let t=e.trim();if(!t.startsWith("data:"))continue;let s=t.slice(5).trim();if(s&&"[DONE]"!==s)try{let e=JSON.parse(s),t=function(e){if(!e||"object"!=typeof e)return"";let t=e.choices?.[0];return[(t?.delta||{}).content,t?.message?.content,e.output_text,e.text].map(h).filter(Boolean)[0]||""}(e);if(!t)continue;m+=t,z(m),es(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:m,status:"streaming"}:e),updatedAt:new Date().toISOString()}))}catch{}}}es(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:m||e.content,status:"done"}:e),updatedAt:new Date().toISOString()})),d=r,s=x(t),es(d,e=>({...e,title:"New chat"===e.title?s:e.title,updatedAt:new Date().toISOString()}))}catch(e){if("AbortError"!==e.name){let t=h(e?.message||e);es(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:e.content||`Error: ${t}`,status:"error"}:e),updatedAt:new Date().toISOString()})),b(t||"Failed to send message.")}}finally{E(!1),U(""),z(""),W.current=null}},en=X?`${X.name}`:"Select model",eo=X?X.requestModel:"Choose from connected providers";return(0,s.jsx)("div",{className:"relative flex-1 flex flex-col h-full min-h-0 min-w-0 bg-[#212121] text-white overflow-hidden",children:(0,s.jsxs)("div",{className:"relative mx-auto flex flex-1 h-full min-h-0 w-full max-w-4xl flex-col",children:[(0,s.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-3 px-4 py-3 lg:px-6",children:[(0,s.jsxs)("div",{ref:Y,className:"relative",children:[(0,s.jsx)("button",{type:"button",onClick:()=>B(e=>!e),className:"flex items-center gap-3 rounded-2xl border border-white/10 bg-white/5 px-4 py-3 text-left transition hover:bg-white/8",children:(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-semibold text-white",children:en}),(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px] text-white/70",children:"expand_more"})]}),(0,s.jsx)("p",{className:"truncate text-xs text-white/55",children:eo})]})}),J?(0,s.jsxs)("div",{className:"absolute left-0 top-[calc(100%+10px)] z-30 w-[min(520px,calc(100vw-2rem))] overflow-hidden rounded-[20px] border border-white/10 bg-[#262626] shadow-2xl shadow-black/50",children:[(0,s.jsxs)("div",{className:"border-b border-white/10 px-4 py-3",children:[(0,s.jsx)("p",{className:"text-xs uppercase tracking-[0.22em] text-white/45",children:"Models"}),(0,s.jsx)("p",{className:"text-sm text-white/75",children:"Only from connected providers"})]}),(0,s.jsx)("div",{className:"max-h-[60vh] overflow-y-auto p-2 custom-scrollbar",children:e.map(e=>(0,s.jsxs)("div",{className:"mb-2 rounded-[16px] border border-white/10 bg-black/20 p-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-2 py-2",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-white",children:e.providerName}),(0,s.jsx)(i.Ex,{size:"sm",variant:"default",children:e.models.length})]}),(0,s.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:e.models.map(e=>{let t=e.id===k;return(0,s.jsx)("button",{type:"button",onClick:()=>(e=>{let t=Q.get(e);if(!t)return;let r=N.find(e=>e.id===j);if(r&&r.messages.length>0){let e=ea(t);if(!e)return;y(t=>[e,...t]),S(e.id)}else if(r)y(e=>e.map(e=>e.id===r.id?{...e,providerId:t.providerId,providerName:t.providerName,modelId:t.id,modelName:t.name}:e)),S(r.id);else{let e=ea(t);if(!e)return;y(t=>[e,...t]),S(e.id)}A(t.providerId),D(t.id),B(!1)})(e.id),className:`rounded-[14px] border px-3 py-3 text-left transition ${t?"border-blue-400/40 bg-blue-500/15":"border-white/10 bg-white/5 hover:bg-white/8"}`,children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-sm font-medium text-white",children:e.name}),(0,s.jsx)("p",{className:"truncate text-[11px] text-white/45",children:e.requestModel})]}),t?(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px] text-blue-300",children:"check_circle"}):null]})},e.id)})})]},e.providerId))})]}):null]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>K(e=>!e),className:"rounded-2xl border border-white/10 bg-white/5 px-4 py-3 text-sm text-white/80 transition hover:bg-white/8",children:"History"}),(0,s.jsx)(i.$n,{variant:"ghost",size:"sm",icon:"delete",onClick:()=>{if(!j)return;let e=N.filter(e=>e.id!==j),t=e[0]||null;y(e),t?(S(t.id),A(t.providerId),D(t.modelId)):(S(""),A(""),D(""))},disabled:!j||0===N.length,children:"Clear"})]})]}),F?(0,s.jsxs)("div",{ref:G,className:"absolute right-4 top-[72px] z-20 w-[min(360px,calc(100vw-2rem))] rounded-[20px] border border-white/10 bg-[#262626] p-2 shadow-2xl shadow-black/50 lg:right-6",children:[(0,s.jsx)("div",{className:"px-3 py-2",children:(0,s.jsx)("p",{className:"text-xs uppercase tracking-[0.22em] text-white/45",children:"Recent chats"})}),(0,s.jsx)("div",{className:"max-h-[48vh] space-y-2 overflow-y-auto p-1 custom-scrollbar",children:0===et.length?(0,s.jsx)("div",{className:"rounded-[16px] border border-dashed border-white/10 bg-white/5 p-4 text-sm text-white/55",children:"No conversations yet."}):et.map(e=>{let t=e.id===j,r=[...e.messages||[]].reverse().find(e=>"user"===e.role)||e.messages?.[0];return(0,s.jsx)("button",{type:"button",onClick:()=>{var t;let r;return t=e.id,void((r=N.find(e=>e.id===t))&&(S(t),A(r.providerId||I),D(r.modelId||k),K(!1)))},className:`w-full rounded-[16px] border px-3 py-3 text-left transition ${t?"border-blue-400/40 bg-blue-500/15":"border-white/10 bg-white/5 hover:bg-white/8"}`,children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"truncate text-sm font-medium text-white",children:e.title}),(0,s.jsx)("p",{className:"mt-1 truncate text-xs text-white/50",children:h(r?.content)||"Empty chat"})]}),(0,s.jsx)("span",{className:"text-[10px] text-white/40 shrink-0",children:function(e){if(!e)return"Now";let t=new Date(e).getTime();if(Number.isNaN(t))return"Now";let r=Math.max(1,Math.round((Date.now()-t)/6e4));if(r<60)return`${r}m`;let s=Math.round(r/60);return s<24?`${s}h`:`${Math.round(s/24)}d`}(e.updatedAt)})]})},e.id)})})]}):null,v?(0,s.jsx)("div",{className:"mt-4 rounded-[18px] border border-rose-500/20 bg-rose-500/10 px-4 py-3 text-rose-100",children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"error"}),(0,s.jsx)("p",{className:"text-sm leading-6",children:v})]})}):null,(0,s.jsxs)("div",{className:"flex flex-1 flex-col min-h-0",children:[(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto py-4 custom-scrollbar",children:[0===ee.length?(0,s.jsx)("div",{className:"flex min-h-[50vh] items-center justify-center px-4 text-center",children:(0,s.jsxs)("div",{className:"max-w-xl space-y-4",children:[(0,s.jsx)("div",{className:"mx-auto flex size-16 items-center justify-center rounded-[20px] border border-white/10 bg-white/5 text-white/80",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[30px]",children:"chat"})}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h2",{className:"text-2xl font-semibold text-white",children:"Start a conversation"}),(0,s.jsx)("p",{className:"text-sm leading-6 text-white/60",children:"Simple chat interface to interact with any AI model from connected providers. Select a model and start chatting!"})]})]})}):null,(0,s.jsx)("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-4 px-4",children:ee.map(e=>{let t="user"===e.role,r="assistant"===e.role,a=r&&e.id===T&&"streaming"===e.status,i=h(e.content)||(r?R:"");return(0,s.jsx)("div",{className:`flex w-full ${t?"justify-end":"justify-start"} mb-6`,children:(0,s.jsxs)("div",{className:`max-w-[min(88%,42rem)] ${t?"rounded-3xl bg-[#2f2f2f] px-5 py-3.5 text-white":"text-white/90"}`,children:[(0,s.jsx)("div",{className:"mb-1 flex items-center justify-between gap-3",children:(0,s.jsx)("span",{className:"text-xs font-semibold",children:t?"You":X?.name||"Assistant"})}),e.attachments?.length?(0,s.jsx)("div",{className:"mb-3 grid grid-cols-2 gap-2 sm:grid-cols-3 mt-2",children:e.attachments.map(e=>(0,s.jsx)("a",{href:e.dataUrl,target:"_blank",rel:"noreferrer",className:"overflow-hidden rounded-[18px] border border-white/10 bg-black/20",children:(0,s.jsx)(o.default,{src:e.dataUrl,alt:e.name,width:320,height:112,unoptimized:!0,className:"h-28 w-full object-cover"})},e.id))}):null,(0,s.jsxs)("div",{className:"whitespace-pre-wrap break-words text-[15px] leading-7",children:[i,r&&a&&!R?(0,s.jsx)("span",{className:"inline-block animate-pulse",children:"▋"}):null]})]})},e.id)})})]}),(0,s.jsxs)("div",{className:"shrink-0 pt-2",children:[C.length>0?(0,s.jsx)("div",{className:"mx-auto mb-3 flex w-full max-w-3xl flex-wrap gap-2 px-4",children:C.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-3 py-2",children:[(0,s.jsx)("span",{className:"text-xs text-white/80 max-w-[12rem] truncate",children:e.name}),(0,s.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.id,void _(e=>e.filter(e=>e.id!==t))},className:"text-white/55 hover:text-white","aria-label":"Remove attachment",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]},e.id))}):null,(0,s.jsx)("div",{className:"mx-auto w-full max-w-3xl px-4 pb-2",children:(0,s.jsxs)("div",{className:"rounded-[26px] bg-[#2f2f2f] px-3 pt-3 pb-2 shadow-[0_0_15px_rgba(0,0,0,0.10)] ring-1 ring-white/5",children:[(0,s.jsx)("textarea",{value:O,onChange:e=>$(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),er&&el())},placeholder:"Message AI",rows:1,className:"w-full resize-none bg-transparent px-2 text-[15px] leading-6 text-white outline-none placeholder:text-white/40 custom-scrollbar max-h-[25vh] overflow-y-auto"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>L.current?.click(),disabled:!X||r,className:"p-2 text-white/50 hover:text-white transition rounded-full hover:bg-white/5",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"attach_file"})}),(0,s.jsx)("input",{ref:L,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ei}),(0,s.jsx)("span",{className:"text-xs font-medium text-white/30 truncate max-w-[120px]",children:X?X.name:"No model"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[M?(0,s.jsx)("button",{type:"button",onClick:()=>{W.current?.abort()},className:"p-2 text-white bg-white/10 hover:bg-white/20 transition rounded-full h-8 w-8 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop"})}):null,(0,s.jsx)("button",{onClick:el,disabled:!er,className:`h-8 w-8 rounded-full flex items-center justify-center transition ${er?"bg-white text-black hover:opacity-90":"bg-white/10 text-white/30 cursor-not-allowed"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_upward"})})]})]})]})})]}),(0,s.jsx)("p",{className:"mx-auto mt-2 max-w-3xl px-4 pb-4 text-center text-[11px] text-white/30",children:"Model list is filtered from connected providers."})]})]})})}}},e=>{e.O(0,[2574,3862,782,8500,2280,1321,7592,5497,8441,3794,7358],()=>e(e.s=55774)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4465],{55774:(e,t,r)=>{Promise.resolve().then(r.bind(r,88512))},88512:(e,t,r)=>{"use strict";r.d(t,{default:()=>w});var s=r(95155),a=r(12115),i=r(35497),l=r(28777),n=r(88105),o=r(5772);let d="basic-chat.sessions",c="basic-chat.activeSessionId",m="basic-chat.activeProviderId",u="basic-chat.draft";function p(){return globalThis.crypto?.randomUUID?globalThis.crypto.randomUUID():`chat_${Date.now()}_${Math.random().toString(16).slice(2)}`}function h(e){if("string"==typeof e)return e;if(null==e)return"";if(Array.isArray(e))return e.map(h).filter(Boolean).join(" ");if("object"==typeof e){if("string"==typeof e.message)return e.message;if("string"==typeof e.error)return e.error;try{return JSON.stringify(e)}catch{}}return String(e)}function x(e=""){let t=h(e).replace(/\s+/g," ").trim();return t?t.length>52?`${t.slice(0,52).trimEnd()}…`:t:"New chat"}async function f(e){return await new Promise((t,r)=>{let s=new FileReader;s.onload=()=>t(String(s.result||"")),s.onerror=()=>r(s.error||Error("Failed to read file")),s.readAsDataURL(e)})}function g(e){return e?.name||function(e=""){return String(e).replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()||"Unknown"}(e?.provider||e?.id||"provider")}function w(){let[e,t]=(0,a.useState)([]),[r,w]=(0,a.useState)(!0),[v,b]=(0,a.useState)(""),[N,y]=(0,a.useState)(()=>{try{let e=function(e,t){try{return JSON.parse(e)}catch{return t}}(globalThis.localStorage.getItem(d),[]);return Array.isArray(e)?e.map(e=>({...e,messages:Array.isArray(e.messages)?e.messages:[]})):[]}catch{return[]}}),[j,S]=(0,a.useState)(()=>globalThis.localStorage.getItem(c)||""),[I,A]=(0,a.useState)(()=>globalThis.localStorage.getItem(m)||""),[k,D]=(0,a.useState)(""),[O,$]=(0,a.useState)(()=>globalThis.localStorage.getItem(u)||""),[C,_]=(0,a.useState)([]),[M,E]=(0,a.useState)(!1),[T,U]=(0,a.useState)(""),[R,z]=(0,a.useState)(""),[q,P]=(0,a.useState)(!1),[J,B]=(0,a.useState)(!1),[F,K]=(0,a.useState)(!1),L=(0,a.useRef)(null),W=(0,a.useRef)(null),H=(0,a.useRef)(!1),Y=(0,a.useRef)(null),G=(0,a.useRef)(null);(0,a.useEffect)(()=>{P(!0)},[]),(0,a.useEffect)(()=>{let e=!1;return async function(){w(!0),b("");try{let r=await fetch("/api/providers",{cache:"no-store"}),s=await r.json().catch(()=>({})),a=Array.isArray(s.connections)?s.connections.filter(e=>e?.isActive!==!1):[];if(0===a.length){e||(t([]),b("No providers connected yet."));return}let i=new Map;for(let e of a){let t=e.provider||e.id,r=g(e),s=(0,n.mq)(t)?"openai-compatible":(0,n.gb)(t)?"anthropic-compatible":t;i.has(t)||i.set(t,{providerId:t,providerName:r,providerType:s,connections:[],models:[]});let a=i.get(t);a.providerName=a.providerName||r,a.providerType=a.providerType||s,a.connections.push(e);let o=(0,l.KC)(t).map(t=>t?.id?{id:`${e.provider}/${t.id}`,requestModel:`${e.provider}/${t.id}`,name:t.name||t.id,providerId:e.provider,providerName:g(e),source:"static"}:null).filter(Boolean);a.models.push(...o)}for(let e of(await Promise.all(a.map(async e=>{try{let t=await fetch(`/api/providers/${e.id}/models`,{cache:"no-store"}),r=await t.json().catch(()=>({}));if(!t.ok)return{connection:e,models:[]};let s=(Array.isArray(r?.models)?r.models:Array.isArray(r?.data)?r.data:Array.isArray(r?.results)?r.results:Array.isArray(r)?r:[]).map(t=>(function(e,t){let r="string"==typeof e?e:e?.id||e?.name||e?.model||"";if(!r)return null;let s="string"==typeof e?e:e?.name||e?.displayName||r,a=r;return((0,n.mq)(t.provider)||(0,n.gb)(t.provider))&&!r.includes("/")&&(a=`${t.provider}/${r}`),{id:a,requestModel:a,name:s,providerId:t.provider,providerName:g(t),source:"live"}})(t,e)).filter(Boolean);return{connection:e,models:s}}catch{return{connection:e,models:[]}}})))){let t=e.connection.provider||e.connection.id,r=i.get(t);r&&r.models.push(...e.models)}let o=Array.from(i.values()).map(e=>({...e,models:(function(e){let t=new Map;for(let r of e)r?.id&&(t.has(r.id)||t.set(r.id,r));return Array.from(t.values())})(e.models).sort((e,t)=>e.name.localeCompare(t.name))})).filter(e=>e.models.length>0).sort((e,t)=>e.providerName.localeCompare(t.providerName));e||(t(o),0===o.length&&b("Providers connected but no models available."))}catch(r){e||(b(h(r?.message)||"Failed to load providers/models."),t([]))}finally{e||w(!1)}}(),()=>{e=!0}},[]),(0,a.useEffect)(()=>{let e=e=>{Y.current&&!Y.current.contains(e.target)&&B(!1),G.current&&!G.current.contains(e.target)&&K(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let Q=(0,a.useMemo)(()=>{let t=new Map;for(let r of e)for(let e of r.models)t.set(e.id,{...e,providerId:r.providerId,providerName:r.providerName});return t},[e]),V=(0,a.useMemo)(()=>e.find(e=>e.providerId===I)||e[0]||null,[e,I]),X=(0,a.useMemo)(()=>{if(k&&Q.has(k))return Q.get(k);if(j){let e=N.find(e=>e.id===j);if(e?.modelId&&Q.has(e.modelId))return Q.get(e.modelId)}return V?.models?.[0]||null},[k,Q,V,N,j]),Z=(0,a.useMemo)(()=>N.find(e=>e.id===j)||null,[N,j]),ee=Z?.messages||[],et=(0,a.useMemo)(()=>[...N].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()),[N]),er=!M&&!!X&&(O.trim().length>0||C.length>0);(0,a.useEffect)(()=>{if(q)try{globalThis.localStorage.setItem(d,JSON.stringify(N)),globalThis.localStorage.setItem(c,j),globalThis.localStorage.setItem(m,I),globalThis.localStorage.setItem(u,O)}catch{}},[q,N,j,I,O]),(0,a.useEffect)(()=>{if(!q||r||H.current||0===e.length)return;let t=e.find(e=>e.providerId===I)||e[0],s=k&&Q.has(k)?Q.get(k):t.models[0];if(N.length>0){let e=N.find(e=>e.id===j)||N[0],r=e?.modelId&&Q.has(e.modelId)?Q.get(e.modelId):s;H.current=!0,S(e.id),A(r?.providerId||t.providerId),D(r?.id||s.id);return}let a={id:p(),title:"New chat",providerId:t.providerId,providerName:t.providerName,modelId:s.id,modelName:s.name,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messages:[]};H.current=!0,y([a]),S(a.id),A(t.providerId),D(s.id)},[q,r,e,Q,N,j,I,k]);let es=(e,t)=>{y(r=>r.map(r=>r.id===e?t({...r,messages:Array.isArray(r.messages)?r.messages.map(e=>({...e})):[]}):r))},ea=e=>e?{id:p(),title:"New chat",providerId:e.providerId,providerName:e.providerName,modelId:e.id,modelName:e.name,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messages:[]}:null,ei=async e=>{let t=Array.from(e.target.files||[]);if(0===t.length)return;let r=t.filter(e=>e.type.startsWith("image/"));if(0===r.length){e.target.value="";return}let s=await Promise.all(r.map(async e=>({id:p(),name:e.name,type:e.type,size:e.size,dataUrl:await f(e)})));_(e=>[...e,...s]),e.target.value=""},el=async()=>{let e=X||V?.models?.[0]||null;if(!e)return;let t=O.trim();if(!t&&0===C.length)return;let r=j,s=N.find(e=>e.id===r);if(!s){if(!(s=ea(e)))return;r=s.id,y(e=>[s,...e]),S(r)}let a={id:p(),role:"user",content:t,attachments:C.map(e=>({id:e.id,name:e.name,type:e.type,dataUrl:e.dataUrl})),createdAt:new Date().toISOString()},i=p(),l={id:i,role:"assistant",content:"",createdAt:new Date().toISOString(),status:"streaming"},n=[...s.messages||[],a,l];y(s=>s.map(s=>s.id===r?{...s,providerId:e.providerId,providerName:e.providerName,modelId:e.id,modelName:e.name,messages:n,updatedAt:new Date().toISOString(),title:"New chat"===s.title?x(t):s.title}:s)),$(""),_([]),E(!0),U(i),z(""),W.current?.abort(),W.current=new AbortController;let o=n.filter(e=>"assistant"!==e.role||e.id!==i).map(e=>({role:e.role,content:"user"===e.role?function(e){let t=h(e.content).trim(),r=Array.isArray(e.attachments)?e.attachments:[];if(0===r.length)return t;let s=[];for(let e of(t&&s.push({type:"text",text:t}),r))e?.dataUrl&&s.push({type:"image_url",image_url:{url:e.dataUrl}});return s.length>0?s:t}(e):e.content}));try{var d;let s,a=await fetch("/api/dashboard/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({model:e.requestModel||e.id,messages:o,stream:!0}),signal:W.current.signal});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(h(e.error||e.message||`Request failed (${a.status})`))}let l=a.body?.getReader();if(!l){let e=await a.json().catch(()=>({})),t=h(e?.choices?.[0]?.message?.content||e?.output_text||e?.error||e?.message||"");es(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:t,status:"done"}:e),updatedAt:new Date().toISOString()}));return}let n=new TextDecoder,c="",m="";for(;;){let{value:e,done:t}=await l.read();if(t)break;let s=(c+=n.decode(e,{stream:!0})).split(/\r?\n/);for(let e of(c=s.pop()||"",s)){let t=e.trim();if(!t.startsWith("data:"))continue;let s=t.slice(5).trim();if(s&&"[DONE]"!==s)try{let e=JSON.parse(s),t=function(e){if(!e||"object"!=typeof e)return"";let t=e.choices?.[0];return[(t?.delta||{}).content,t?.message?.content,e.output_text,e.text].map(h).filter(Boolean)[0]||""}(e);if(!t)continue;m+=t,z(m),es(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:m,status:"streaming"}:e),updatedAt:new Date().toISOString()}))}catch{}}}es(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:m||e.content,status:"done"}:e),updatedAt:new Date().toISOString()})),d=r,s=x(t),es(d,e=>({...e,title:"New chat"===e.title?s:e.title,updatedAt:new Date().toISOString()}))}catch(e){if("AbortError"!==e.name){let t=h(e?.message||e);es(r,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:e.content||`Error: ${t}`,status:"error"}:e),updatedAt:new Date().toISOString()})),b(t||"Failed to send message.")}}finally{E(!1),U(""),z(""),W.current=null}},en=X?`${X.name}`:"Select model",eo=X?X.requestModel:"Choose from connected providers";return(0,s.jsx)("div",{className:"relative flex-1 flex flex-col h-full min-h-0 min-w-0 bg-[#212121] text-white overflow-hidden",children:(0,s.jsxs)("div",{className:"relative mx-auto flex flex-1 h-full min-h-0 w-full max-w-4xl flex-col",children:[(0,s.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-3 px-4 py-3 lg:px-6",children:[(0,s.jsxs)("div",{ref:Y,className:"relative",children:[(0,s.jsx)("button",{type:"button",onClick:()=>B(e=>!e),className:"flex items-center gap-3 rounded-2xl border border-white/10 bg-white/5 px-4 py-3 text-left transition hover:bg-white/8",children:(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-semibold text-white",children:en}),(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px] text-white/70",children:"expand_more"})]}),(0,s.jsx)("p",{className:"truncate text-xs text-white/55",children:eo})]})}),J?(0,s.jsxs)("div",{className:"absolute left-0 top-[calc(100%+10px)] z-30 w-[min(520px,calc(100vw-2rem))] overflow-hidden rounded-[20px] border border-white/10 bg-[#262626] shadow-2xl shadow-black/50",children:[(0,s.jsxs)("div",{className:"border-b border-white/10 px-4 py-3",children:[(0,s.jsx)("p",{className:"text-xs uppercase tracking-[0.22em] text-white/45",children:"Models"}),(0,s.jsx)("p",{className:"text-sm text-white/75",children:"Only from connected providers"})]}),(0,s.jsx)("div",{className:"max-h-[60vh] overflow-y-auto p-2 custom-scrollbar",children:e.map(e=>(0,s.jsxs)("div",{className:"mb-2 rounded-[16px] border border-white/10 bg-black/20 p-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-2 py-2",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-white",children:e.providerName}),(0,s.jsx)(i.Ex,{size:"sm",variant:"default",children:e.models.length})]}),(0,s.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:e.models.map(e=>{let t=e.id===k;return(0,s.jsx)("button",{type:"button",onClick:()=>(e=>{let t=Q.get(e);if(!t)return;let r=N.find(e=>e.id===j);if(r&&r.messages.length>0){let e=ea(t);if(!e)return;y(t=>[e,...t]),S(e.id)}else if(r)y(e=>e.map(e=>e.id===r.id?{...e,providerId:t.providerId,providerName:t.providerName,modelId:t.id,modelName:t.name}:e)),S(r.id);else{let e=ea(t);if(!e)return;y(t=>[e,...t]),S(e.id)}A(t.providerId),D(t.id),B(!1)})(e.id),className:`rounded-[14px] border px-3 py-3 text-left transition ${t?"border-blue-400/40 bg-blue-500/15":"border-white/10 bg-white/5 hover:bg-white/8"}`,children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-sm font-medium text-white",children:e.name}),(0,s.jsx)("p",{className:"truncate text-[11px] text-white/45",children:e.requestModel})]}),t?(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px] text-blue-300",children:"check_circle"}):null]})},e.id)})})]},e.providerId))})]}):null]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>K(e=>!e),className:"rounded-2xl border border-white/10 bg-white/5 px-4 py-3 text-sm text-white/80 transition hover:bg-white/8",children:"History"}),(0,s.jsx)(i.$n,{variant:"ghost",size:"sm",icon:"delete",onClick:()=>{if(!j)return;let e=N.filter(e=>e.id!==j),t=e[0]||null;y(e),t?(S(t.id),A(t.providerId),D(t.modelId)):(S(""),A(""),D(""))},disabled:!j||0===N.length,children:"Clear"})]})]}),F?(0,s.jsxs)("div",{ref:G,className:"absolute right-4 top-[72px] z-20 w-[min(360px,calc(100vw-2rem))] rounded-[20px] border border-white/10 bg-[#262626] p-2 shadow-2xl shadow-black/50 lg:right-6",children:[(0,s.jsx)("div",{className:"px-3 py-2",children:(0,s.jsx)("p",{className:"text-xs uppercase tracking-[0.22em] text-white/45",children:"Recent chats"})}),(0,s.jsx)("div",{className:"max-h-[48vh] space-y-2 overflow-y-auto p-1 custom-scrollbar",children:0===et.length?(0,s.jsx)("div",{className:"rounded-[16px] border border-dashed border-white/10 bg-white/5 p-4 text-sm text-white/55",children:"No conversations yet."}):et.map(e=>{let t=e.id===j,r=[...e.messages||[]].reverse().find(e=>"user"===e.role)||e.messages?.[0];return(0,s.jsx)("button",{type:"button",onClick:()=>{var t;let r;return t=e.id,void((r=N.find(e=>e.id===t))&&(S(t),A(r.providerId||I),D(r.modelId||k),K(!1)))},className:`w-full rounded-[16px] border px-3 py-3 text-left transition ${t?"border-blue-400/40 bg-blue-500/15":"border-white/10 bg-white/5 hover:bg-white/8"}`,children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"truncate text-sm font-medium text-white",children:e.title}),(0,s.jsx)("p",{className:"mt-1 truncate text-xs text-white/50",children:h(r?.content)||"Empty chat"})]}),(0,s.jsx)("span",{className:"text-[10px] text-white/40 shrink-0",children:function(e){if(!e)return"Now";let t=new Date(e).getTime();if(Number.isNaN(t))return"Now";let r=Math.max(1,Math.round((Date.now()-t)/6e4));if(r<60)return`${r}m`;let s=Math.round(r/60);return s<24?`${s}h`:`${Math.round(s/24)}d`}(e.updatedAt)})]})},e.id)})})]}):null,v?(0,s.jsx)("div",{className:"mt-4 rounded-[18px] border border-rose-500/20 bg-rose-500/10 px-4 py-3 text-rose-100",children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"error"}),(0,s.jsx)("p",{className:"text-sm leading-6",children:v})]})}):null,(0,s.jsxs)("div",{className:"flex flex-1 flex-col min-h-0",children:[(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto py-4 custom-scrollbar",children:[0===ee.length?(0,s.jsx)("div",{className:"flex min-h-[50vh] items-center justify-center px-4 text-center",children:(0,s.jsxs)("div",{className:"max-w-xl space-y-4",children:[(0,s.jsx)("div",{className:"mx-auto flex size-16 items-center justify-center rounded-[20px] border border-white/10 bg-white/5 text-white/80",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[30px]",children:"chat"})}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h2",{className:"text-2xl font-semibold text-white",children:"Start a conversation"}),(0,s.jsx)("p",{className:"text-sm leading-6 text-white/60",children:"Simple chat interface to interact with any AI model from connected providers. Select a model and start chatting!"})]})]})}):null,(0,s.jsx)("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-4 px-4",children:ee.map(e=>{let t="user"===e.role,r="assistant"===e.role,a=r&&e.id===T&&"streaming"===e.status,i=h(e.content)||(r?R:"");return(0,s.jsx)("div",{className:`flex w-full ${t?"justify-end":"justify-start"} mb-6`,children:(0,s.jsxs)("div",{className:`max-w-[min(88%,42rem)] ${t?"rounded-3xl bg-[#2f2f2f] px-5 py-3.5 text-white":"text-white/90"}`,children:[(0,s.jsx)("div",{className:"mb-1 flex items-center justify-between gap-3",children:(0,s.jsx)("span",{className:"text-xs font-semibold",children:t?"You":X?.name||"Assistant"})}),e.attachments?.length?(0,s.jsx)("div",{className:"mb-3 grid grid-cols-2 gap-2 sm:grid-cols-3 mt-2",children:e.attachments.map(e=>(0,s.jsx)("a",{href:e.dataUrl,target:"_blank",rel:"noreferrer",className:"overflow-hidden rounded-[18px] border border-white/10 bg-black/20",children:(0,s.jsx)(o.default,{src:e.dataUrl,alt:e.name,width:320,height:112,unoptimized:!0,className:"h-28 w-full object-cover"})},e.id))}):null,(0,s.jsxs)("div",{className:"whitespace-pre-wrap break-words text-[15px] leading-7",children:[i,r&&a&&!R?(0,s.jsx)("span",{className:"inline-block animate-pulse",children:"▋"}):null]})]})},e.id)})})]}),(0,s.jsxs)("div",{className:"shrink-0 pt-2",children:[C.length>0?(0,s.jsx)("div",{className:"mx-auto mb-3 flex w-full max-w-3xl flex-wrap gap-2 px-4",children:C.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-3 py-2",children:[(0,s.jsx)("span",{className:"text-xs text-white/80 max-w-[12rem] truncate",children:e.name}),(0,s.jsx)("button",{type:"button",onClick:()=>{var t;return t=e.id,void _(e=>e.filter(e=>e.id!==t))},className:"text-white/55 hover:text-white","aria-label":"Remove attachment",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"close"})})]},e.id))}):null,(0,s.jsx)("div",{className:"mx-auto w-full max-w-3xl px-4 pb-2",children:(0,s.jsxs)("div",{className:"rounded-[26px] bg-[#2f2f2f] px-3 pt-3 pb-2 shadow-[0_0_15px_rgba(0,0,0,0.10)] ring-1 ring-white/5",children:[(0,s.jsx)("textarea",{value:O,onChange:e=>$(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),er&&el())},placeholder:"Message AI",rows:1,className:"w-full resize-none bg-transparent px-2 text-[15px] leading-6 text-white outline-none placeholder:text-white/40 custom-scrollbar max-h-[25vh] overflow-y-auto"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>L.current?.click(),disabled:!X||r,className:"p-2 text-white/50 hover:text-white transition rounded-full hover:bg-white/5",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"attach_file"})}),(0,s.jsx)("input",{ref:L,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ei}),(0,s.jsx)("span",{className:"text-xs font-medium text-white/30 truncate max-w-[120px]",children:X?X.name:"No model"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[M?(0,s.jsx)("button",{type:"button",onClick:()=>{W.current?.abort()},className:"p-2 text-white bg-white/10 hover:bg-white/20 transition rounded-full h-8 w-8 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop"})}):null,(0,s.jsx)("button",{onClick:el,disabled:!er,className:`h-8 w-8 rounded-full flex items-center justify-center transition ${er?"bg-white text-black hover:opacity-90":"bg-white/10 text-white/30 cursor-not-allowed"}`,children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_upward"})})]})]})]})})]}),(0,s.jsx)("p",{className:"mx-auto mt-2 max-w-3xl px-4 pb-4 text-center text-[11px] text-white/30",children:"Model list is filtered from connected providers."})]})]})})}}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,8441,3794,7358],()=>e(e.s=55774)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3554],{7769:(e,s,r)=>{Promise.resolve().then(r.bind(r,85309))},85309:(e,s,r)=>{"use strict";r.d(s,{default:()=>u});var t=r(95155),a=r(12115),i=r(98500),l=r.n(i),o=r(35497),c=r(3534),d=r(28777),n=r(88105),x=r(21402),v=r(78559);function u({toolId:e,machineId:s}){let r=c.dM[e],[i,m]=(0,a.useState)([]),[h,p]=(0,a.useState)(!0),[f,P]=(0,a.useState)({}),[j,w]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=!0;return(async()=>{try{let[s,r]=await Promise.all([fetch("/api/providers"),fetch("/api/keys")]);if(!e)return;if(s.ok){let e=await s.json();m(e.connections||[])}if(r.ok){let e=await r.json();w(e.keys||[])}}catch(e){(0,v.s)("Error loading tool data:",e)}finally{e&&p(!1)}})(),()=>{e=!1}},[]);let b=()=>i.filter(e=>!1!==e.isActive).map(e=>({...e,provider:(0,n.rs)(e.provider)})),k=(0,a.useCallback)((e,s,r)=>{P(t=>t[e]?.[s]===r?t:{...t,[e]:{...t[e],[s]:r}})},[]);return r?h?(0,t.jsx)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:px-0",children:(0,t.jsx)(o.Qv,{})}):(0,t.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:px-0",children:[(0,t.jsxs)(l(),{href:"/dashboard/cli-tools",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary w-fit",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"arrow_back"}),"Back to CLI Tools"]}),s?(0,t.jsxs)("p",{className:"text-xs text-text-muted font-mono",children:["Machine: ",s]}):null,(()=>{let s,a,i,l=(s=b(),a=[],i=new Set,s.forEach(e=>{let s=(0,n.rs)(e.provider),r=d.Xg[s]||s;(0,d.KC)(s).forEach(t=>{let l=`${r}/${t.id}`;i.has(l)||(i.add(l),a.push({value:l,label:`${r}/${t.id}`,provider:s,alias:r,connectionName:e.name,modelId:t.id}))})}),a).length>0,o={tool:r,isExpanded:!0,onToggle:()=>{},baseUrl:window.location.origin,apiKeys:j,tunnelEnabled:!1,tunnelPublicUrl:"",tailscaleEnabled:!1,tailscaleUrl:"",cloudEnabled:!1};switch(e){case"claude":return(0,t.jsx)(x.Tk,{...o,activeProviders:b(),modelMappings:f[e]||{},onModelMappingChange:(s,r)=>k(e,s,r),hasActiveProviders:l});case"codex":return(0,t.jsx)(x.Ah,{...o,activeProviders:b()});case"opencode":return(0,t.jsx)(x.qO,{...o,activeProviders:b()});case"cowork":return(0,t.jsx)(x.Q6,{...o,activeProviders:b(),hasActiveProviders:l,cloudUrl:""});case"droid":return(0,t.jsx)(x.ZM,{...o,activeProviders:b(),hasActiveProviders:l});case"openclaw":return(0,t.jsx)(x.yZ,{...o,activeProviders:b(),hasActiveProviders:l});case"hermes":return(0,t.jsx)(x.RF,{...o,activeProviders:b(),hasActiveProviders:l});case"cline":return(0,t.jsx)(x.aG,{...o,activeProviders:b()});case"kilo":return(0,t.jsx)(x.c9,{...o,activeProviders:b()});case"deepseek-tui":return(0,t.jsx)(x.lF,{...o,activeProviders:b(),hasActiveProviders:l});case"jcode":return(0,t.jsx)(x.mW,{...o,activeProviders:b(),hasActiveProviders:l});case"grok":return(0,t.jsx)(x.wg,{...o,activeProviders:b(),hasActiveProviders:l});case"pi":return(0,t.jsx)(x.S3,{...o,activeProviders:b(),hasActiveProviders:l});case"aider":return(0,t.jsx)(x.qn,{...o,activeProviders:b(),hasActiveProviders:l});case"gemini-cli":return(0,t.jsx)(x.Ib,{...o,activeProviders:b(),hasActiveProviders:l});default:return(0,t.jsx)(x.a7,{toolId:e,...o,activeProviders:b()})}})()]}):(0,t.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:px-0",children:[(0,t.jsxs)(l(),{href:"/dashboard/cli-tools",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary w-fit",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"arrow_back"}),"Back to CLI Tools"]}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"Tool not found or disabled."})]})}}},e=>{e.O(0,[2574,3862,782,8500,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3554],{7769:(e,s,r)=>{Promise.resolve().then(r.bind(r,85309))},85309:(e,s,r)=>{"use strict";r.d(s,{default:()=>u});var t=r(95155),a=r(12115),i=r(98500),l=r.n(i),o=r(35497),c=r(3534),d=r(28777),n=r(88105),x=r(21402),v=r(78559);function u({toolId:e,machineId:s}){let r=c.dM[e],[i,m]=(0,a.useState)([]),[h,p]=(0,a.useState)(!0),[f,P]=(0,a.useState)({}),[j,w]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=!0;return(async()=>{try{let[s,r]=await Promise.all([fetch("/api/providers"),fetch("/api/keys")]);if(!e)return;if(s.ok){let e=await s.json();m(e.connections||[])}if(r.ok){let e=await r.json();w(e.keys||[])}}catch(e){(0,v.s)("Error loading tool data:",e)}finally{e&&p(!1)}})(),()=>{e=!1}},[]);let b=()=>i.filter(e=>!1!==e.isActive).map(e=>({...e,provider:(0,n.rs)(e.provider)})),k=(0,a.useCallback)((e,s,r)=>{P(t=>t[e]?.[s]===r?t:{...t,[e]:{...t[e],[s]:r}})},[]);return r?h?(0,t.jsx)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:px-0",children:(0,t.jsx)(o.Qv,{})}):(0,t.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:px-0",children:[(0,t.jsxs)(l(),{href:"/dashboard/cli-tools",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary w-fit",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"arrow_back"}),"Back to CLI Tools"]}),s?(0,t.jsxs)("p",{className:"text-xs text-text-muted font-mono",children:["Machine: ",s]}):null,(()=>{let s,a,i,l=(s=b(),a=[],i=new Set,s.forEach(e=>{let s=(0,n.rs)(e.provider),r=d.Xg[s]||s;(0,d.KC)(s).forEach(t=>{let l=`${r}/${t.id}`;i.has(l)||(i.add(l),a.push({value:l,label:`${r}/${t.id}`,provider:s,alias:r,connectionName:e.name,modelId:t.id}))})}),a).length>0,o={tool:r,isExpanded:!0,onToggle:()=>{},baseUrl:window.location.origin,apiKeys:j,tunnelEnabled:!1,tunnelPublicUrl:"",tailscaleEnabled:!1,tailscaleUrl:"",cloudEnabled:!1};switch(e){case"claude":return(0,t.jsx)(x.Tk,{...o,activeProviders:b(),modelMappings:f[e]||{},onModelMappingChange:(s,r)=>k(e,s,r),hasActiveProviders:l});case"codex":return(0,t.jsx)(x.Ah,{...o,activeProviders:b()});case"opencode":return(0,t.jsx)(x.qO,{...o,activeProviders:b()});case"cowork":return(0,t.jsx)(x.Q6,{...o,activeProviders:b(),hasActiveProviders:l,cloudUrl:""});case"droid":return(0,t.jsx)(x.ZM,{...o,activeProviders:b(),hasActiveProviders:l});case"openclaw":return(0,t.jsx)(x.yZ,{...o,activeProviders:b(),hasActiveProviders:l});case"hermes":return(0,t.jsx)(x.RF,{...o,activeProviders:b(),hasActiveProviders:l});case"cline":return(0,t.jsx)(x.aG,{...o,activeProviders:b()});case"kilo":return(0,t.jsx)(x.c9,{...o,activeProviders:b()});case"deepseek-tui":return(0,t.jsx)(x.lF,{...o,activeProviders:b(),hasActiveProviders:l});case"jcode":return(0,t.jsx)(x.mW,{...o,activeProviders:b(),hasActiveProviders:l});case"grok":return(0,t.jsx)(x.wg,{...o,activeProviders:b(),hasActiveProviders:l});case"pi":return(0,t.jsx)(x.S3,{...o,activeProviders:b(),hasActiveProviders:l});case"aider":return(0,t.jsx)(x.qn,{...o,activeProviders:b(),hasActiveProviders:l});case"gemini-cli":return(0,t.jsx)(x.Ib,{...o,activeProviders:b(),hasActiveProviders:l});default:return(0,t.jsx)(x.a7,{toolId:e,...o,activeProviders:b()})}})()]}):(0,t.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-4 px-1 sm:px-0",children:[(0,t.jsxs)(l(),{href:"/dashboard/cli-tools",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary w-fit",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"arrow_back"}),"Back to CLI Tools"]}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"Tool not found or disabled."})]})}}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,2493,8441,3794,7358],()=>e(e.s=7769)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2326],{12750:(e,s,l)=>{Promise.resolve().then(l.bind(l,53501))},53501:(e,s,l)=>{"use strict";l.d(s,{default:()=>g});var a=l(95155),t=l(12115),r=l(35497),i=l(3534),n=l(21402),c=l(98500),o=l.n(c),d=l(5772);function x({toolId:e,tool:s,status:l}){let t=l?l.installed?l.hasSwitchboard?{label:"Connected",cls:"bg-green-500/10 text-green-600 dark:text-green-400 border border-green-500/20"}:{label:"Installed \xb7 not configured",cls:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/25"}:{label:"Not installed",cls:"bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/25"}:{label:"Unknown",cls:"bg-gray-500/10 text-gray-500"};return(0,a.jsx)(o(),{href:`/dashboard/cli-tools/${e}`,className:"block",children:(0,a.jsx)(r.Zp,{padding:"sm",className:"h-full overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,a.jsx)("div",{className:"flex h-full flex-col gap-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:s.image?(0,a.jsx)(d.default,{src:s.image,alt:s.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}}):s.icon?(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px]",style:{color:s.color},children:s.icon}):null}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h3",{className:"font-medium text-sm truncate",children:s.name}),(0,a.jsx)("span",{className:`inline-block mt-1 px-1.5 py-0.5 text-[10px] font-medium rounded-full ${t.cls}`,children:t.label})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px] shrink-0",children:"chevron_right"})]})})})})}var m=l(78559);function g({machineId:e}){let[s,l]=(0,t.useState)(!0),[c,o]=(0,t.useState)({});if((0,t.useEffect)(()=>{let e=!0;return(async()=>{try{let s=await fetch("/api/cli-tools/all-statuses");s.ok&&e&&o(await s.json())}catch(e){(0,m.s)("Error fetching tool statuses:",e)}finally{e&&l(!1)}})(),()=>{e=!1}},[]),s)return(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:[(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{})]});let d=Object.entries(i.dM),h=Object.entries(i.wn);return(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-6 px-1 sm:px-0",children:[(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:d.map(([e,s])=>(0,a.jsx)(x,{toolId:e,tool:s,status:c[e]},e))}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"security"}),(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"MITM Tools"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:h.map(([e,s])=>(0,a.jsx)(n.gY,{tool:s},e))})]})]})}}},e=>{e.O(0,[2574,3862,782,8500,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2326],{12750:(e,s,l)=>{Promise.resolve().then(l.bind(l,53501))},53501:(e,s,l)=>{"use strict";l.d(s,{default:()=>g});var a=l(95155),t=l(12115),r=l(35497),i=l(3534),n=l(21402),c=l(98500),o=l.n(c),d=l(5772);function x({toolId:e,tool:s,status:l}){let t=l?l.installed?l.hasSwitchboard?{label:"Connected",cls:"bg-green-500/10 text-green-600 dark:text-green-400 border border-green-500/20"}:{label:"Installed \xb7 not configured",cls:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/25"}:{label:"Not installed",cls:"bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/25"}:{label:"Unknown",cls:"bg-gray-500/10 text-gray-500"};return(0,a.jsx)(o(),{href:`/dashboard/cli-tools/${e}`,className:"block",children:(0,a.jsx)(r.Zp,{padding:"sm",className:"h-full overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,a.jsx)("div",{className:"flex h-full flex-col gap-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:s.image?(0,a.jsx)(d.default,{src:s.image,alt:s.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}}):s.icon?(0,a.jsx)("span",{className:"material-symbols-outlined text-[28px]",style:{color:s.color},children:s.icon}):null}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h3",{className:"font-medium text-sm truncate",children:s.name}),(0,a.jsx)("span",{className:`inline-block mt-1 px-1.5 py-0.5 text-[10px] font-medium rounded-full ${t.cls}`,children:t.label})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px] shrink-0",children:"chevron_right"})]})})})})}var m=l(78559);function g({machineId:e}){let[s,l]=(0,t.useState)(!0),[c,o]=(0,t.useState)({});if((0,t.useEffect)(()=>{let e=!0;return(async()=>{try{let s=await fetch("/api/cli-tools/all-statuses");s.ok&&e&&o(await s.json())}catch(e){(0,m.s)("Error fetching tool statuses:",e)}finally{e&&l(!1)}})(),()=>{e=!1}},[]),s)return(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:[(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{}),(0,a.jsx)(r.Qv,{})]});let d=Object.entries(i.dM),h=Object.entries(i.wn);return(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-6 px-1 sm:px-0",children:[(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:d.map(([e,s])=>(0,a.jsx)(x,{toolId:e,tool:s,status:c[e]},e))}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-primary",children:"security"}),(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-main",children:"MITM Tools"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4",children:h.map(([e,s])=>(0,a.jsx)(n.gY,{tool:s},e))})]})]})}}},e=>{e.O(0,[2574,3862,782,8500,594,1321,7592,5497,2493,8441,3794,7358],()=>e(e.s=12750)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{41483:(e,t,a)=>{"use strict";a.d(t,{default:()=>h});var l=a(95155),r=a(12115),s=a(44923),o=a(87256),i=a(39768),n=a(5020),d=a(35497),c=a(11059);a(88105);var m=a(65921),x=a(78559),u=a(47224);let p=/^[a-zA-Z0-9_.\-]+$/;function h({initialData:e}){let t=(0,m.i)(e=>e.error),[a,s]=(0,r.useState)(()=>(e?.combos||[]).filter(e=>!e.kind||"llm"===e.kind)),[o,i]=(0,r.useState)(!e),[n,x]=(0,r.useState)(!1),[u,p]=(0,r.useState)(null),[f,g]=(0,r.useState)(e?.connections||[]),[j,y]=(0,r.useState)(e?.settings?.comboStrategies||{}),[v,k]=(0,r.useState)(e?.modelCaps||{}),[C,S]=(0,r.useState)(null),{copied:A,copy:M}=(0,c.C)(),F=(0,r.useCallback)(async()=>{try{let[e,t,a,l]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings"),fetch("/api/models")]);if(![e,t,a,l].every(e=>e.ok))throw Error("One or more combo resources failed to load");let r=await e.json(),o=await t.json(),i=await a.json();if(e.ok&&s((r.combos||[]).filter(e=>!e.kind||"llm"===e.kind)),t.ok&&g(o.connections||[]),l.ok){let e=await l.json(),t={};for(let a of e.models||[])a.caps&&(t[a.fullModel]=a.caps);k(t)}y(i.comboStrategies||{})}catch(e){t("Failed to fetch combo data")}finally{i(!1)}},[t]);(0,r.useEffect)(()=>{e?.combos?i(!1):F()},[e,F]);let R=async e=>{try{let{strategy:a,capacityAutoSwitch:l,routerModel:r,objective:s,...o}=e,i=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(i.ok){let e=await i.json().catch(()=>({})),t=o.name?.trim()||e?.name;t&&(a||void 0!==l||r||s)&&await q(t,b(a,l,r,s)),await F(),x(!1)}else{let e=await i.json();t(e.error||"Failed to create combo")}}catch(e){t("Failed to create combo")}},O=async(e,a)=>{try{let{strategy:l,capacityAutoSwitch:r,routerModel:s,objective:o,...i}=a,n=u?.name,d=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(d.ok){let e=i.name?.trim()||n;if(n&&e&&n!==e&&y(t=>{let a={...t};return n in a&&(e in a||(a[e]=a[n]),delete a[n]),a}),e&&(l||void 0!==r)){let t,a=n&&n!==e?(t={...j},n in t&&(e in t||(t[e]=t[n]),delete t[n]),t):j;await q(e,b(l,r,s,o),a)}await F(),p(null)}else{let e=await d.json();t(e.error||"Failed to update combo")}}catch(e){t("Failed to update combo")}},E=async e=>{let l=a.find(t=>t.id===e);S({title:"Delete Combo",message:l?.name?`Delete combo “${l.name}”?`:"Delete this combo?",onConfirm:async()=>{S(null);try{let a=await fetch(`/api/combos/${e}`,{method:"DELETE"});if(a.ok)s(t=>t.filter(t=>t.id!==e)),l?.name&&y(e=>{if(!(l.name in e))return e;let t={...e};return delete t[l.name],t});else{let e=await a.json().catch(()=>({}));t(e.error||`Failed to delete combo (HTTP ${a.status})`)}}catch(e){t("Failed to delete combo")}}})},q=async(e,a,l=null)=>{try{let r={...l||j},s={...r[e]||{},...a};for(let e of Object.keys(s))(""===s[e]||null===s[e]||void 0===s[e])&&delete s[e];let o=s.fallbackStrategy||"fallback";"fallback"!==o||s.judgeModel||s.routerModel||s.objective||void 0!==s.learningEnabled||void 0!==s.freezeLearning||void 0!==s.explorationRate||!1===s.capacityAutoSwitch?(!s.fallbackStrategy&&void 0===a.fallbackStrategy&&r[e]?.fallbackStrategy&&(s.fallbackStrategy=r[e].fallbackStrategy),r[e]=s):delete r[e];let i=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:r})});if(!i.ok){let e=await i.json().catch(()=>({}));t(e.error||`Failed to update combo strategy (${i.status})`);return}y(r)}catch(e){throw t("Failed to update combo strategy"),e}};return o?(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(d.Qv,{}),(0,l.jsx)(d.Qv,{})]}):(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0 max-w-3xl",children:[(0,l.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Combos"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Group models under one name, then pick a strategy per combo:"}),(0,l.jsxs)("ul",{className:"text-sm text-text-muted mt-2 flex flex-col gap-1.5",children:[(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Fallback"})," ","— tries models in order (next on failure)"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Round Robin"})," ","— rotates models across requests to spread load"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Fusion"})," ","— queries all models in parallel, then a judge synthesizes one answer. Best quality, but costs the most: every request bills all panel models + the judge (N+1 calls)"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Auto"})," ","— a router model picks one worker from the pool each request (2 calls: router + worker); optional learning from outcomes"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Capacity auto-switch"})," ","— when enabled on a combo, sends image/PDF requests to a model that supports them first (works with Fallback, Round Robin, and Fusion)"]})]})]}),(0,l.jsx)(d.$n,{icon:"add",onClick:()=>x(!0),className:"w-full sm:w-auto whitespace-nowrap shrink-0",children:"Create Combo"})]}),0===a.length?(0,l.jsx)(d.Zp,{children:(0,l.jsxs)("div",{className:"text-center py-12",children:[(0,l.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"layers"})}),(0,l.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No combos yet"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4 max-w-md mx-auto",children:"Create a named model group, choose Fallback / Round Robin / Fusion / Auto, and point clients at the combo name."}),(0,l.jsx)(d.$n,{icon:"add",onClick:()=>x(!0),className:"w-full sm:w-auto",children:"Create Combo"})]})}):(0,l.jsx)("div",{className:"flex flex-col gap-4",children:a.map(e=>(0,l.jsx)(N,{combo:e,modelCaps:v,activeProviders:f,copied:A,onCopy:M,onEdit:()=>p(e),onDelete:()=>E(e.id),strategy:j[e.name]||{},onSetStrategy:t=>q(e.name,t)},e.id))}),(0,l.jsx)(w,{isOpen:n,onClose:()=>x(!1),onSave:R,activeProviders:f,modelCaps:v,initialStrategy:{fallbackStrategy:"fallback",capacityAutoSwitch:!0}},"create"),(0,l.jsx)(w,{isOpen:!!u,combo:u,onClose:()=>p(null),onSave:e=>O(u.id,e),activeProviders:f,modelCaps:v,initialStrategy:u?j[u.name]||{fallbackStrategy:"fallback"}:{}},u?.id||"new"),(0,l.jsx)(d.uo,{isOpen:!!C,onClose:()=>S(null),onConfirm:C?.onConfirm,title:C?.title||"Confirm",message:C?.message,variant:"danger"})]})}function b(e,t,a,l){let r=e||"fallback",s={fallbackStrategy:r,...void 0!==t?{capacityAutoSwitch:t}:{}};return"auto"===r?(a&&(s.routerModel=a),l&&(s.objective=l),s.judgeModel=""):("fusion"===r?s.routerModel="":(s.routerModel="",s.judgeModel=""),s.objective="",s.learningEnabled="",s.freezeLearning="",s.explorationRate=""),s}function f(e,t,a){let l=(e||[]).filter(e=>e&&e!==t);return l.length>0&&!l.some(e=>a[e]?.vision)}function g({models:e,routerModel:t}){let a=(e||[]).filter(e=>e&&e!==t);if(a.length<2)return null;let{cheap:r,frontier:s,disabled:o}=function(e){let t=(e||[]).filter(Boolean);if(t.length<=1)return{cheap:t.slice(),frontier:[],disabled:!0};let a=t.map(e=>({m:e,t:function(e){if(!e)return 4;let[t,...a]=e.split("/"),l=a.join("/")||t,r=(0,u.PS)(t,l);if(!r||"number"!=typeof r.input)return 4;let s="number"==typeof r.output?r.output:3*r.input,o=r.input+s;return o<2?0:o<10?1:o<30?2:o<80?3:4}(e)}));if(new Set(a.map(e=>e.t)).size<=1)return{cheap:t.slice(),frontier:[],disabled:!0};let l=a.filter(e=>e.t<=1).map(e=>e.m),r=a.filter(e=>e.t>=2).map(e=>e.m);if(!l.length||!r.length){let e=a.map((e,t)=>({...e,i:t})).sort((e,t)=>e.t-t.t||e.i-t.i),t=Math.ceil(e.length/2);l=e.slice(0,t).map(e=>e.m),r=e.slice(t).map(e=>e.m)}return{cheap:l,frontier:r,disabled:!1}}(a),i=e=>String(e).split("/").pop();return o?(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Tiers"}),(0,l.jsx)("span",{className:"text-[10px] text-text-subtle",title:"All workers share one cost tier — tiered routing is off",children:"single tier (tiering off)"})]}):(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Tiers"}),r.map(e=>(0,l.jsx)("span",{className:"rounded border border-emerald-500/30 bg-emerald-500/10 px-1.5 py-0.5 font-mono text-[10px] text-emerald-600 dark:text-emerald-400",title:`${e} — cheap tier`,children:i(e)},`c-${e}`)),(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px] text-text-subtle",children:"arrow_forward"}),s.map(e=>(0,l.jsx)("span",{className:"rounded border border-amber-500/30 bg-amber-500/10 px-1.5 py-0.5 font-mono text-[10px] text-amber-600 dark:text-amber-400",title:`${e} — frontier tier`,children:i(e)},`f-${e}`))]})}let j=[{value:"fallback",label:"Fallback — try in order"},{value:"round-robin",label:"Round Robin — rotate load"},{value:"fusion",label:"Fusion — panel + judge (N+1)"},{value:"auto",label:"Auto — router picks 1 worker"}],y={fallback:"Tries models top-to-bottom; on failure uses the next.","round-robin":"Rotates models across requests to spread load.",fusion:"Calls every model, then a judge merges answers (bills N+1).",auto:"Router model chooses one worker each request (bills 2 calls)."},v=[{value:"quality",label:"Quality"},{value:"balanced",label:"Balanced"},{value:"economy",label:"Economy"},{value:"latency",label:"Latency"}];function N({combo:e,modelCaps:t={},activeProviders:a=[],copied:s,onCopy:o,onEdit:i,onDelete:n,strategy:c={},onSetStrategy:m}){let[x,u]=(0,r.useState)(!1),[p,h]=(0,r.useState)(!1),[b,k]=(0,r.useState)(!1),[w,C]=(0,r.useState)(!1),[S,A]=(0,r.useState)(""),M=c.fallbackStrategy||"fallback",F=c.judgeModel||"",R="auto"===M,O=c.routerModel||"",E=c.objective||"balanced",q=c.providerStrategy||"off",$=!1!==c.capacityAutoSwitch;return(0,l.jsxs)(d.Zp,{padding:"sm",className:"group",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("code",{className:"block truncate font-mono text-sm font-medium",children:e.name}),(0,l.jsx)("p",{className:"text-[10px] text-text-subtle mt-0.5",children:y[M]||""}),(0,l.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===e.models.length?(0,l.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models"}):e.models.slice(0,3).map((e,a)=>(0,l.jsxs)("code",{className:"inline-flex items-center gap-1 rounded bg-black/5 px-1.5 py-0.5 font-mono text-xs text-text-muted dark:bg-white/5",children:[(0,l.jsx)("span",{children:e}),(0,l.jsx)(d.nh,{caps:t[e]})]},a)),e.models.length>3&&(0,l.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",e.models.length-3," more"]})]}),"fusion"===M&&(0,l.jsxs)("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Judge"}),(0,l.jsxs)("button",{onClick:()=>u(!0),className:"inline-flex max-w-full items-center gap-1 rounded border border-dashed border-primary/40 px-1.5 py-0.5 font-mono text-[11px] text-primary hover:border-primary hover:bg-primary/5 transition-colors",title:"Pick the model that fuses panel answers",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"gavel"}),(0,l.jsx)("span",{className:"truncate",children:F||`Auto — ${e.models[0]||"first model"}`})]}),F&&(0,l.jsx)("button",{onClick:()=>m({judgeModel:""}),className:"p-0.5 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-colors",title:"Reset judge to Auto",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"close"})})]}),R&&(0,l.jsxs)("div",{className:"mt-2 flex min-w-0 flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Router"}),(0,l.jsxs)("button",{type:"button",onClick:()=>h(!0),className:"inline-flex max-w-full items-center gap-1 rounded border border-dashed border-primary/40 px-1.5 py-0.5 font-mono text-[11px] text-primary hover:border-primary hover:bg-primary/5 transition-colors",title:"Model that picks the worker each request — required for Auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"alt_route"}),(0,l.jsx)("span",{className:"truncate",children:O||"Select a router model (required)"})]})]}),O&&e.models?.includes(O)&&(0,l.jsxs)("p",{className:"text-[10px] text-amber-600 dark:text-amber-400 flex items-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"warning"}),"Router is also in the worker list — it is auto-excluded from the pool."]}),f(e.models,O,t)&&(0,l.jsxs)("p",{className:"text-[10px] text-amber-600 dark:text-amber-400 flex items-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"warning"}),"No vision-capable model — image requests will have images stripped"]}),(0,l.jsx)(g,{models:e.models,routerModel:O}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Objective"}),(0,l.jsx)("select",{value:E,onChange:e=>m({objective:e.target.value}),className:"rounded border border-border bg-surface-2 px-1.5 py-0.5 text-[11px] text-text-main",children:v.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:!1!==c.learningEnabled,onChange:e=>m({learningEnabled:e.target.checked})}),"Learn"]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted cursor-pointer",title:"Keep routing on current learning version; block relearn",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:!!c.freezeLearning,onChange:e=>m({freezeLearning:e.target.checked})}),"Freeze"]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted cursor-pointer",title:"Occasionally append a 1/2/3 feedback prompt to Auto chat replies (human chat only). Off by default.",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:!!c.feedbackAsk,onChange:e=>m({feedbackAsk:e.target.checked})}),"Ask feedback"]}),(0,l.jsxs)("button",{type:"button",disabled:w||!!c.freezeLearning,onClick:async()=>{C(!0),A("");try{let t=await fetch("/api/routing/learn",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboName:e.name})}),a=await t.json();A(a.message||(a.ok?"Done":a.error||"Failed"))}catch(e){A(e.message||"Failed")}finally{C(!1)}},className:"inline-flex items-center gap-1 rounded border border-primary/40 bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary hover:bg-primary/15 disabled:opacity-50",title:"Run learning optimizer on recent routing events",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"psychology"}),w?"Learning…":"Relearn now"]}),(0,l.jsx)("a",{href:`/dashboard/combos/routing?combo=${encodeURIComponent(e.name)}`,className:"inline-flex items-center gap-1 rounded border border-border px-2 py-0.5 text-[11px] text-text-muted hover:text-primary hover:border-primary/40",children:"Insights"})]}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Provider"}),(0,l.jsxs)("select",{value:q,onChange:e=>m({providerStrategy:e.target.value}),className:"rounded border border-border bg-surface-2 px-1.5 py-0.5 text-[11px] text-text-main",children:[(0,l.jsx)("option",{value:"off",children:"Off"}),(0,l.jsx)("option",{value:"priority",children:"Priority"}),(0,l.jsx)("option",{value:"round-robin",children:"Round robin"}),(0,l.jsx)("option",{value:"fastest",children:"Fastest"}),(0,l.jsx)("option",{value:"quota-first",children:"Quota first"})]}),"priority"===q&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{type:"text",value:Array.isArray(c.providerOrder)?c.providerOrder.join(", "):"",onChange:e=>m({providerOrder:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),placeholder:"provider-a, provider-b",className:"w-40 rounded border border-border bg-surface-2 px-1.5 py-0.5 text-[11px] text-text-main"}),(0,l.jsx)("span",{className:"text-[10px] text-text-muted",children:"comma-separated provider names, highest priority first"})]}),(0,l.jsx)("input",{type:"number",min:"1",value:c.providerLatencyGuardMs??"",onChange:e=>m({providerLatencyGuardMs:Number(e.target.value)||void 0}),placeholder:"20000",title:"Demote providers slower than this latency in milliseconds",className:"w-20 rounded border border-border bg-surface-2 px-1.5 py-0.5 text-[11px] text-text-main"})]}),"quota-first"===q&&(0,l.jsx)("p",{className:"text-[10px] text-text-muted",children:"Quota data currently available for Claude & Codex; other providers use availability (not rate-limited, lower recent use)."}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-text-muted",children:[(0,l.jsxs)("label",{className:"inline-flex items-center gap-1",children:["Window",(0,l.jsxs)("select",{value:c.learningWindowDays??14,onChange:e=>m({learningWindowDays:Number(e.target.value)||14}),className:"rounded border border-border bg-surface-2 px-1 py-0.5 text-[11px] text-text-main",children:[(0,l.jsx)("option",{value:7,children:"7d"}),(0,l.jsx)("option",{value:14,children:"14d"}),(0,l.jsx)("option",{value:30,children:"30d"})]})]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1",title:"Epsilon-greedy exploration (capped at 20%)",children:["Explore",(0,l.jsx)("select",{value:Math.round((c.explorationRate??.05)*100),onChange:e=>m({explorationRate:Number(e.target.value)/100}),className:"rounded border border-border bg-surface-2 px-1 py-0.5 text-[11px] text-text-main",children:[0,5,10,15,20].map(e=>(0,l.jsxs)("option",{value:e,children:[e,"%"]},e))})]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1",title:"0 = manual relearn only",children:["Auto-relearn",(0,l.jsxs)("select",{value:c.autoLearnIntervalHours??0,onChange:e=>m({autoLearnIntervalHours:Number(e.target.value)||0}),className:"rounded border border-border bg-surface-2 px-1 py-0.5 text-[11px] text-text-main",children:[(0,l.jsx)("option",{value:0,children:"off"}),(0,l.jsx)("option",{value:6,children:"6h"}),(0,l.jsx)("option",{value:12,children:"12h"}),(0,l.jsx)("option",{value:24,children:"24h"}),(0,l.jsx)("option",{value:72,children:"72h"})]})]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1",title:"Capacity pre-filter before router (vision/PDF)",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:!1!==c.capacityAutoSwitch,onChange:e=>m({capacityAutoSwitch:e.target.checked})}),"Heuristic first"]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1",title:"Emit X-Auto-Router-* response headers (worker, cluster, score, skipped)",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:!1!==c.emitAutoRouterHeaders,onChange:e=>m({emitAutoRouterHeaders:e.target.checked})}),"Route headers"]})]}),S?(0,l.jsx)("p",{className:"text-[11px] font-mono text-text-subtle",children:S}):(0,l.jsx)("p",{className:"text-[10px] text-text-subtle",children:"Worker pool = models list (router model excluded if listed). Every request re-routes. Router model is required — pick a connected account (a cheap, fast model such as Haiku works well)."})]})]})]}),(0,l.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,l.jsxs)("div",{className:"w-full sm:w-[220px] flex flex-col gap-1.5",children:[(0,l.jsx)(d.l6,{options:j,value:M,onChange:e=>{let t=e.target.value;if("auto"===t&&!O){k(!0),h(!0);return}m({fallbackStrategy:t})},selectClassName:"py-1.5 text-xs"}),!R&&(0,l.jsxs)("label",{className:"inline-flex items-center gap-1.5 text-[10px] text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:$,onChange:e=>m({capacityAutoSwitch:e.target.checked})}),"Capacity auto-switch (vision/PDF first)"]})]}),(0,l.jsxs)("div",{className:"grid grid-cols-3 gap-1 sm:flex",children:[(0,l.jsxs)("button",{onClick:t=>{t.stopPropagation(),o(e.name,`combo-${e.id}`)},className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Copy combo name",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:s===`combo-${e.id}`?"check":"content_copy"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Copy"})]}),(0,l.jsxs)("button",{onClick:i,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Edit",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,l.jsxs)("button",{onClick:n,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 transition-colors hover:bg-red-500/10",title:"Delete",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]})]})]}),(0,l.jsx)(d.rq,{isOpen:x,onClose:()=>u(!1),onSelect:e=>{m({judgeModel:e?.value||""}),u(!1)},activeProviders:a,title:"Select Judge Model",addedModelValues:F?[F]:[],closeOnSelect:!0}),(0,l.jsx)(d.rq,{isOpen:p,onClose:()=>{k(!1),h(!1)},onSelect:e=>{let t=e?.value||"";b?(k(!1),t&&m({fallbackStrategy:"auto",routerModel:t})):m({routerModel:t}),h(!1)},activeProviders:a,title:"Select Router Model",addedModelValues:O?[O]:[],closeOnSelect:!0})]})}function k({id:e,index:t,model:a,learned:s=null,isFirst:n,isLast:d,onEdit:c,onMoveUp:m,onMoveDown:x,onRemove:u}){let{attributes:p,listeners:h,setNodeRef:b,transform:f,isDragging:g}=(0,o.gl)({id:e}),j={transform:i.Ks.Transform.toString(f),opacity:g?.4:1,zIndex:g?999:void 0},[y,v]=(0,r.useState)(!1),[N,w]=(0,r.useState)(a),C=()=>{let e=N.trim();e&&e!==a?c(e):w(a),v(!1)};return(0,l.jsxs)("div",{ref:b,style:j,className:`group flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1 bg-black/[0.02] hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04] transition-colors ${g?"shadow-md ring-1 ring-primary/30":""}`,children:[(0,l.jsx)("button",{...p,...h,type:"button",className:"cursor-grab touch-none p-0.5 rounded text-text-muted hover:text-primary active:cursor-grabbing shrink-0",title:"Drag to reorder",children:(0,l.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,l.jsx)("circle",{cx:"9",cy:"4",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"4",r:"2"}),(0,l.jsx)("circle",{cx:"9",cy:"12",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"12",r:"2"}),(0,l.jsx)("circle",{cx:"9",cy:"20",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"20",r:"2"})]})}),(0,l.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:t+1}),y?(0,l.jsx)("input",{autoFocus:!0,value:N,onChange:e=>w(e.target.value),onBlur:C,onKeyDown:e=>{"Enter"===e.key&&C(),"Escape"===e.key&&(w(a),v(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,l.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>v(!0),title:"Click to edit",children:a}),s&&s.n>=10&&(0,l.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-text-subtle",title:"Learned routing stats (all combos, last 14d)",children:["avg ",Math.round(s.avgScore)," \xb7 n=",s.n,s.bestCluster?` \xb7 best: ${s.bestCluster}`:""]}),(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,l.jsx)("button",{onClick:m,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,l.jsx)("button",{onClick:x,disabled:d,className:`p-0.5 rounded ${d?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,l.jsx)("button",{onClick:u,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function w({isOpen:e,combo:t,onClose:a,onSave:i,activeProviders:c,modelCaps:m={},kindFilter:u=null,initialStrategy:h={}}){let[b,g]=(0,r.useState)(t?.name||""),[v,N]=(0,r.useState)(t?.models||[]),[C,S]=(0,r.useState)(h.fallbackStrategy||"fallback"),[A,M]=(0,r.useState)(!1!==h.capacityAutoSwitch),[F,R]=(0,r.useState)(!1),[O,E]=(0,r.useState)(!1),[q,$]=(0,r.useState)(""),[P,D]=(0,r.useState)({}),[L,T]=(0,r.useState)({}),_=(0,s.FR)((0,s.MS)(s.AN,{activationConstraint:{distance:5}}),(0,s.MS)(s.uN,{coordinateGetter:o.JR})),z=v.map((e,t)=>({uid:`item-${t}`,model:e})),H=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let t=await e.json();D(t.aliases||{})}}catch(e){(0,x.s)("Error fetching modal data:",e)}try{let e=await fetch("/api/routing/stats");if(!e.ok)throw Error("Failed to fetch learned routing stats");let t=await e.json(),a={};for(let e of t.global||[]){let t=Object.entries(e.clusters||{}),l=t.filter(([,e])=>e.n>=3),r=(l.length?l:t).reduce((e,t)=>{if(!e)return t;let[a,r]=e,[s,o]=t,i=l.length?r.avgScore:r.n,n=l.length?o.avgScore:o.n;return n>i||n===i&&s<a?t:e},null);a[e.worker]={avgScore:e.avgScore,n:e.n,bestCluster:r?r[0]:null}}T(a)}catch{T({})}};(0,r.useEffect)(()=>{e&&(g(t?.name||""),N(t?.models||[]),S(h.fallbackStrategy||"fallback"),M(!1!==h.capacityAutoSwitch),R(!1),E(!1),$(""),T({}),H())},[e,t?.id,t?.name]);let J=e=>e.trim()?p.test(e)?($(""),!0):($("Only letters, numbers, -, _ and . allowed"),!1):($("Name is required"),!1),B=async()=>{if(J(b)){if(0===v.length)return void(0,x.s)("Add at least one model to the combo");if("auto"===C&&v.length<2)return void(0,x.s)("Auto strategy needs at least 2 models in the worker pool (plus a connected router account)");E(!0),await i({name:b.trim(),models:v,strategy:C,capacityAutoSwitch:"auto"===C||A}),E(!1)}},I=!!t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.aF,{isOpen:e,onClose:a,title:I?"Edit Combo":"Create Combo",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("p",{className:"text-xs text-text-muted leading-relaxed",children:["Clients call this combo by name as the ",(0,l.jsx)("code",{className:"text-primary",children:"model"})," field. Strategy controls how models in the list are used."]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(d.pd,{label:"Combo Name",value:b,onChange:e=>{let t=e.target.value;g(t),t?J(t):$("")},placeholder:"my-combo",error:q}),(0,l.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and . allowed \xb7 use as model id in /v1"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Strategy"}),(0,l.jsx)(d.l6,{options:j,value:C,onChange:e=>S(e.target.value),selectClassName:"py-2 text-sm"}),(0,l.jsx)("p",{className:"text-[11px] text-text-muted mt-1.5",children:y[C]}),"auto"===C&&(0,l.jsxs)("p",{className:"text-[11px] text-amber-600 dark:text-amber-400 mt-1 flex items-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"info"}),"Auto requires a router model — select one on the combo card after saving."]}),"auto"!==C&&(0,l.jsxs)("label",{className:"mt-2 inline-flex items-center gap-2 text-xs text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:A,onChange:e=>M(e.target.checked)}),"Capacity auto-switch — prefer vision/PDF-capable models when the request needs them"]}),"auto"===C&&(0,l.jsx)("p",{className:"text-[11px] text-text-subtle mt-1.5 font-mono",children:"After create: set Router model on the combo card (must be a connected account). Workers = this model list (router excluded if listed)."}),"fusion"===C&&(0,l.jsx)("p",{className:"text-[11px] text-text-subtle mt-1.5 font-mono",children:"After create: optionally set Judge on the combo card (default = first model)."})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("label",{className:"text-sm font-medium mb-1.5 block",children:["Models ","fallback"===C?"(order = priority)":"(pool)"]}),v.length>0&&f(v,null,m)&&(0,l.jsxs)("p",{className:"text-[10px] text-amber-600 dark:text-amber-400 flex items-center gap-1 mb-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"warning"}),"No vision-capable model — image requests will have images stripped"]}),0===v.length?(0,l.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,l.jsx)(s.Mp,{sensors:_,collisionDetection:s.fp,onDragEnd:e=>{let{active:t,over:a}=e;if(a&&t.id!==a.id){let e=z.findIndex(e=>e.uid===t.id),l=z.findIndex(e=>e.uid===a.id);-1!==e&&-1!==l&&N(t=>(0,o.be)(t,e,l))}},modifiers:[n.FN,n.gj],children:(0,l.jsx)(o.gB,{items:z.map(e=>e.uid),strategy:o._G,children:(0,l.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:z.map(({uid:e,model:t},a)=>(0,l.jsx)(k,{id:e,index:a,model:t,learned:L[t]||null,isFirst:0===a,isLast:a===z.length-1,onEdit:e=>{let t=[...v];t[a]=e,N(t)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...v];[t[e-1],t[e]]=[t[e],t[e-1]],N(t)})(a),onMoveDown:()=>(e=>{if(e===v.length-1)return;let t=[...v];[t[e],t[e+1]]=[t[e+1],t[e]],N(t)})(a),onRemove:()=>{N(v.filter((e,t)=>t!==a))}},e))})})}),(0,l.jsxs)("button",{onClick:()=>R(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,l.jsx)(d.$n,{onClick:a,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,l.jsx)(d.$n,{onClick:B,fullWidth:!0,size:"sm",disabled:!b.trim()||!!q||O,children:O?"Saving...":I?"Save":"Create"})]})]})}),(0,l.jsx)(d.rq,{isOpen:F,onClose:()=>R(!1),onSelect:e=>{v.includes(e.value)||N([...v,e.value])},onDeselect:e=>{N(v.filter(t=>t!==e.value))},activeProviders:c,modelAliases:P,title:"Add Model to Combo",kindFilter:u,addedModelValues:v,closeOnSelect:!1})]})}},80063:(e,t,a)=>{Promise.resolve().then(a.bind(a,41483))}},e=>{e.O(0,[2574,3862,782,8500,2280,7055,1321,7592,5497,8441,3794,7358],()=>e(e.s=80063)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3649],{41483:(e,t,a)=>{"use strict";a.d(t,{default:()=>h});var l=a(95155),r=a(12115),s=a(44923),o=a(87256),i=a(39768),n=a(5020),d=a(35497),c=a(11059);a(88105);var m=a(65921),x=a(78559),u=a(47224);let p=/^[a-zA-Z0-9_.\-]+$/;function h({initialData:e}){let t=(0,m.i)(e=>e.error),[a,s]=(0,r.useState)(()=>(e?.combos||[]).filter(e=>!e.kind||"llm"===e.kind)),[o,i]=(0,r.useState)(!e),[n,x]=(0,r.useState)(!1),[u,p]=(0,r.useState)(null),[f,g]=(0,r.useState)(e?.connections||[]),[j,y]=(0,r.useState)(e?.settings?.comboStrategies||{}),[v,k]=(0,r.useState)(e?.modelCaps||{}),[C,S]=(0,r.useState)(null),{copied:A,copy:M}=(0,c.C)(),F=(0,r.useCallback)(async()=>{try{let[e,t,a,l]=await Promise.all([fetch("/api/combos"),fetch("/api/providers"),fetch("/api/settings"),fetch("/api/models")]);if(![e,t,a,l].every(e=>e.ok))throw Error("One or more combo resources failed to load");let r=await e.json(),o=await t.json(),i=await a.json();if(e.ok&&s((r.combos||[]).filter(e=>!e.kind||"llm"===e.kind)),t.ok&&g(o.connections||[]),l.ok){let e=await l.json(),t={};for(let a of e.models||[])a.caps&&(t[a.fullModel]=a.caps);k(t)}y(i.comboStrategies||{})}catch(e){t("Failed to fetch combo data")}finally{i(!1)}},[t]);(0,r.useEffect)(()=>{e?.combos?i(!1):F()},[e,F]);let R=async e=>{try{let{strategy:a,capacityAutoSwitch:l,routerModel:r,objective:s,...o}=e,i=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(i.ok){let e=await i.json().catch(()=>({})),t=o.name?.trim()||e?.name;t&&(a||void 0!==l||r||s)&&await q(t,b(a,l,r,s)),await F(),x(!1)}else{let e=await i.json();t(e.error||"Failed to create combo")}}catch(e){t("Failed to create combo")}},O=async(e,a)=>{try{let{strategy:l,capacityAutoSwitch:r,routerModel:s,objective:o,...i}=a,n=u?.name,d=await fetch(`/api/combos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(d.ok){let e=i.name?.trim()||n;if(n&&e&&n!==e&&y(t=>{let a={...t};return n in a&&(e in a||(a[e]=a[n]),delete a[n]),a}),e&&(l||void 0!==r)){let t,a=n&&n!==e?(t={...j},n in t&&(e in t||(t[e]=t[n]),delete t[n]),t):j;await q(e,b(l,r,s,o),a)}await F(),p(null)}else{let e=await d.json();t(e.error||"Failed to update combo")}}catch(e){t("Failed to update combo")}},E=async e=>{let l=a.find(t=>t.id===e);S({title:"Delete Combo",message:l?.name?`Delete combo “${l.name}”?`:"Delete this combo?",onConfirm:async()=>{S(null);try{let a=await fetch(`/api/combos/${e}`,{method:"DELETE"});if(a.ok)s(t=>t.filter(t=>t.id!==e)),l?.name&&y(e=>{if(!(l.name in e))return e;let t={...e};return delete t[l.name],t});else{let e=await a.json().catch(()=>({}));t(e.error||`Failed to delete combo (HTTP ${a.status})`)}}catch(e){t("Failed to delete combo")}}})},q=async(e,a,l=null)=>{try{let r={...l||j},s={...r[e]||{},...a};for(let e of Object.keys(s))(""===s[e]||null===s[e]||void 0===s[e])&&delete s[e];let o=s.fallbackStrategy||"fallback";"fallback"!==o||s.judgeModel||s.routerModel||s.objective||void 0!==s.learningEnabled||void 0!==s.freezeLearning||void 0!==s.explorationRate||!1===s.capacityAutoSwitch?(!s.fallbackStrategy&&void 0===a.fallbackStrategy&&r[e]?.fallbackStrategy&&(s.fallbackStrategy=r[e].fallbackStrategy),r[e]=s):delete r[e];let i=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboStrategies:r})});if(!i.ok){let e=await i.json().catch(()=>({}));t(e.error||`Failed to update combo strategy (${i.status})`);return}y(r)}catch(e){throw t("Failed to update combo strategy"),e}};return o?(0,l.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,l.jsx)(d.Qv,{}),(0,l.jsx)(d.Qv,{})]}):(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:px-0",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,l.jsxs)("div",{className:"min-w-0 max-w-3xl",children:[(0,l.jsx)("h1",{className:"text-[17px] font-semibold text-text-main",children:"Combos"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"Group models under one name, then pick a strategy per combo:"}),(0,l.jsxs)("ul",{className:"text-sm text-text-muted mt-2 flex flex-col gap-1.5",children:[(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Fallback"})," ","— tries models in order (next on failure)"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Round Robin"})," ","— rotates models across requests to spread load"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Fusion"})," ","— queries all models in parallel, then a judge synthesizes one answer. Best quality, but costs the most: every request bills all panel models + the judge (N+1 calls)"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Auto"})," ","— a router model picks one worker from the pool each request (2 calls: router + worker); optional learning from outcomes"]}),(0,l.jsxs)("li",{children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Capacity auto-switch"})," ","— when enabled on a combo, sends image/PDF requests to a model that supports them first (works with Fallback, Round Robin, and Fusion)"]})]})]}),(0,l.jsx)(d.$n,{icon:"add",onClick:()=>x(!0),className:"w-full sm:w-auto whitespace-nowrap shrink-0",children:"Create Combo"})]}),0===a.length?(0,l.jsx)(d.Zp,{children:(0,l.jsxs)("div",{className:"text-center py-12",children:[(0,l.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"layers"})}),(0,l.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No combos yet"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4 max-w-md mx-auto",children:"Create a named model group, choose Fallback / Round Robin / Fusion / Auto, and point clients at the combo name."}),(0,l.jsx)(d.$n,{icon:"add",onClick:()=>x(!0),className:"w-full sm:w-auto",children:"Create Combo"})]})}):(0,l.jsx)("div",{className:"flex flex-col gap-4",children:a.map(e=>(0,l.jsx)(N,{combo:e,modelCaps:v,activeProviders:f,copied:A,onCopy:M,onEdit:()=>p(e),onDelete:()=>E(e.id),strategy:j[e.name]||{},onSetStrategy:t=>q(e.name,t)},e.id))}),(0,l.jsx)(w,{isOpen:n,onClose:()=>x(!1),onSave:R,activeProviders:f,modelCaps:v,initialStrategy:{fallbackStrategy:"fallback",capacityAutoSwitch:!0}},"create"),(0,l.jsx)(w,{isOpen:!!u,combo:u,onClose:()=>p(null),onSave:e=>O(u.id,e),activeProviders:f,modelCaps:v,initialStrategy:u?j[u.name]||{fallbackStrategy:"fallback"}:{}},u?.id||"new"),(0,l.jsx)(d.uo,{isOpen:!!C,onClose:()=>S(null),onConfirm:C?.onConfirm,title:C?.title||"Confirm",message:C?.message,variant:"danger"})]})}function b(e,t,a,l){let r=e||"fallback",s={fallbackStrategy:r,...void 0!==t?{capacityAutoSwitch:t}:{}};return"auto"===r?(a&&(s.routerModel=a),l&&(s.objective=l),s.judgeModel=""):("fusion"===r?s.routerModel="":(s.routerModel="",s.judgeModel=""),s.objective="",s.learningEnabled="",s.freezeLearning="",s.explorationRate=""),s}function f(e,t,a){let l=(e||[]).filter(e=>e&&e!==t);return l.length>0&&!l.some(e=>a[e]?.vision)}function g({models:e,routerModel:t}){let a=(e||[]).filter(e=>e&&e!==t);if(a.length<2)return null;let{cheap:r,frontier:s,disabled:o}=function(e){let t=(e||[]).filter(Boolean);if(t.length<=1)return{cheap:t.slice(),frontier:[],disabled:!0};let a=t.map(e=>({m:e,t:function(e){if(!e)return 4;let[t,...a]=e.split("/"),l=a.join("/")||t,r=(0,u.PS)(t,l);if(!r||"number"!=typeof r.input)return 4;let s="number"==typeof r.output?r.output:3*r.input,o=r.input+s;return o<2?0:o<10?1:o<30?2:o<80?3:4}(e)}));if(new Set(a.map(e=>e.t)).size<=1)return{cheap:t.slice(),frontier:[],disabled:!0};let l=a.filter(e=>e.t<=1).map(e=>e.m),r=a.filter(e=>e.t>=2).map(e=>e.m);if(!l.length||!r.length){let e=a.map((e,t)=>({...e,i:t})).sort((e,t)=>e.t-t.t||e.i-t.i),t=Math.ceil(e.length/2);l=e.slice(0,t).map(e=>e.m),r=e.slice(t).map(e=>e.m)}return{cheap:l,frontier:r,disabled:!1}}(a),i=e=>String(e).split("/").pop();return o?(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Tiers"}),(0,l.jsx)("span",{className:"text-[10px] text-text-subtle",title:"All workers share one cost tier — tiered routing is off",children:"single tier (tiering off)"})]}):(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Tiers"}),r.map(e=>(0,l.jsx)("span",{className:"rounded border border-emerald-500/30 bg-emerald-500/10 px-1.5 py-0.5 font-mono text-[10px] text-emerald-600 dark:text-emerald-400",title:`${e} — cheap tier`,children:i(e)},`c-${e}`)),(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px] text-text-subtle",children:"arrow_forward"}),s.map(e=>(0,l.jsx)("span",{className:"rounded border border-amber-500/30 bg-amber-500/10 px-1.5 py-0.5 font-mono text-[10px] text-amber-600 dark:text-amber-400",title:`${e} — frontier tier`,children:i(e)},`f-${e}`))]})}let j=[{value:"fallback",label:"Fallback — try in order"},{value:"round-robin",label:"Round Robin — rotate load"},{value:"fusion",label:"Fusion — panel + judge (N+1)"},{value:"auto",label:"Auto — router picks 1 worker"}],y={fallback:"Tries models top-to-bottom; on failure uses the next.","round-robin":"Rotates models across requests to spread load.",fusion:"Calls every model, then a judge merges answers (bills N+1).",auto:"Router model chooses one worker each request (bills 2 calls)."},v=[{value:"quality",label:"Quality"},{value:"balanced",label:"Balanced"},{value:"economy",label:"Economy"},{value:"latency",label:"Latency"}];function N({combo:e,modelCaps:t={},activeProviders:a=[],copied:s,onCopy:o,onEdit:i,onDelete:n,strategy:c={},onSetStrategy:m}){let[x,u]=(0,r.useState)(!1),[p,h]=(0,r.useState)(!1),[b,k]=(0,r.useState)(!1),[w,C]=(0,r.useState)(!1),[S,A]=(0,r.useState)(""),M=c.fallbackStrategy||"fallback",F=c.judgeModel||"",R="auto"===M,O=c.routerModel||"",E=c.objective||"balanced",q=c.providerStrategy||"off",$=!1!==c.capacityAutoSwitch;return(0,l.jsxs)(d.Zp,{padding:"sm",className:"group",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3 sm:items-center",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("code",{className:"block truncate font-mono text-sm font-medium",children:e.name}),(0,l.jsx)("p",{className:"text-[10px] text-text-subtle mt-0.5",children:y[M]||""}),(0,l.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1",children:[0===e.models.length?(0,l.jsx)("span",{className:"text-xs text-text-muted italic",children:"No models"}):e.models.slice(0,3).map((e,a)=>(0,l.jsxs)("code",{className:"inline-flex items-center gap-1 rounded bg-black/5 px-1.5 py-0.5 font-mono text-xs text-text-muted dark:bg-white/5",children:[(0,l.jsx)("span",{children:e}),(0,l.jsx)(d.nh,{caps:t[e]})]},a)),e.models.length>3&&(0,l.jsxs)("span",{className:"text-[10px] text-text-muted",children:["+",e.models.length-3," more"]})]}),"fusion"===M&&(0,l.jsxs)("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Judge"}),(0,l.jsxs)("button",{onClick:()=>u(!0),className:"inline-flex max-w-full items-center gap-1 rounded border border-dashed border-primary/40 px-1.5 py-0.5 font-mono text-[11px] text-primary hover:border-primary hover:bg-primary/5 transition-colors",title:"Pick the model that fuses panel answers",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"gavel"}),(0,l.jsx)("span",{className:"truncate",children:F||`Auto — ${e.models[0]||"first model"}`})]}),F&&(0,l.jsx)("button",{onClick:()=>m({judgeModel:""}),className:"p-0.5 rounded text-text-muted hover:text-red-500 hover:bg-red-500/10 transition-colors",title:"Reset judge to Auto",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"close"})})]}),R&&(0,l.jsxs)("div",{className:"mt-2 flex min-w-0 flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Router"}),(0,l.jsxs)("button",{type:"button",onClick:()=>h(!0),className:"inline-flex max-w-full items-center gap-1 rounded border border-dashed border-primary/40 px-1.5 py-0.5 font-mono text-[11px] text-primary hover:border-primary hover:bg-primary/5 transition-colors",title:"Model that picks the worker each request — required for Auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"alt_route"}),(0,l.jsx)("span",{className:"truncate",children:O||"Select a router model (required)"})]})]}),O&&e.models?.includes(O)&&(0,l.jsxs)("p",{className:"text-[10px] text-amber-600 dark:text-amber-400 flex items-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"warning"}),"Router is also in the worker list — it is auto-excluded from the pool."]}),f(e.models,O,t)&&(0,l.jsxs)("p",{className:"text-[10px] text-amber-600 dark:text-amber-400 flex items-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"warning"}),"No vision-capable model — image requests will have images stripped"]}),(0,l.jsx)(g,{models:e.models,routerModel:O}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Objective"}),(0,l.jsx)("select",{value:E,onChange:e=>m({objective:e.target.value}),className:"rounded border border-border bg-surface-2 px-1.5 py-0.5 text-[11px] text-text-main",children:v.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:!1!==c.learningEnabled,onChange:e=>m({learningEnabled:e.target.checked})}),"Learn"]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted cursor-pointer",title:"Keep routing on current learning version; block relearn",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:!!c.freezeLearning,onChange:e=>m({freezeLearning:e.target.checked})}),"Freeze"]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1 text-[11px] text-text-muted cursor-pointer",title:"Occasionally append a 1/2/3 feedback prompt to Auto chat replies (human chat only). Off by default.",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:!!c.feedbackAsk,onChange:e=>m({feedbackAsk:e.target.checked})}),"Ask feedback"]}),(0,l.jsxs)("button",{type:"button",disabled:w||!!c.freezeLearning,onClick:async()=>{C(!0),A("");try{let t=await fetch("/api/routing/learn",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({comboName:e.name})}),a=await t.json();A(a.message||(a.ok?"Done":a.error||"Failed"))}catch(e){A(e.message||"Failed")}finally{C(!1)}},className:"inline-flex items-center gap-1 rounded border border-primary/40 bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary hover:bg-primary/15 disabled:opacity-50",title:"Run learning optimizer on recent routing events",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"psychology"}),w?"Learning…":"Relearn now"]}),(0,l.jsx)("a",{href:`/dashboard/combos/routing?combo=${encodeURIComponent(e.name)}`,className:"inline-flex items-center gap-1 rounded border border-border px-2 py-0.5 text-[11px] text-text-muted hover:text-primary hover:border-primary/40",children:"Insights"})]}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,l.jsx)("span",{className:"text-[11px] font-medium text-text-muted",children:"Provider"}),(0,l.jsxs)("select",{value:q,onChange:e=>m({providerStrategy:e.target.value}),className:"rounded border border-border bg-surface-2 px-1.5 py-0.5 text-[11px] text-text-main",children:[(0,l.jsx)("option",{value:"off",children:"Off"}),(0,l.jsx)("option",{value:"priority",children:"Priority"}),(0,l.jsx)("option",{value:"round-robin",children:"Round robin"}),(0,l.jsx)("option",{value:"fastest",children:"Fastest"}),(0,l.jsx)("option",{value:"quota-first",children:"Quota first"})]}),"priority"===q&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{type:"text",value:Array.isArray(c.providerOrder)?c.providerOrder.join(", "):"",onChange:e=>m({providerOrder:e.target.value.split(",").map(e=>e.trim()).filter(Boolean)}),placeholder:"provider-a, provider-b",className:"w-40 rounded border border-border bg-surface-2 px-1.5 py-0.5 text-[11px] text-text-main"}),(0,l.jsx)("span",{className:"text-[10px] text-text-muted",children:"comma-separated provider names, highest priority first"})]}),(0,l.jsx)("input",{type:"number",min:"1",value:c.providerLatencyGuardMs??"",onChange:e=>m({providerLatencyGuardMs:Number(e.target.value)||void 0}),placeholder:"20000",title:"Demote providers slower than this latency in milliseconds",className:"w-20 rounded border border-border bg-surface-2 px-1.5 py-0.5 text-[11px] text-text-main"})]}),"quota-first"===q&&(0,l.jsx)("p",{className:"text-[10px] text-text-muted",children:"Quota data currently available for Claude & Codex; other providers use availability (not rate-limited, lower recent use)."}),(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-text-muted",children:[(0,l.jsxs)("label",{className:"inline-flex items-center gap-1",children:["Window",(0,l.jsxs)("select",{value:c.learningWindowDays??14,onChange:e=>m({learningWindowDays:Number(e.target.value)||14}),className:"rounded border border-border bg-surface-2 px-1 py-0.5 text-[11px] text-text-main",children:[(0,l.jsx)("option",{value:7,children:"7d"}),(0,l.jsx)("option",{value:14,children:"14d"}),(0,l.jsx)("option",{value:30,children:"30d"})]})]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1",title:"Epsilon-greedy exploration (capped at 20%)",children:["Explore",(0,l.jsx)("select",{value:Math.round((c.explorationRate??.05)*100),onChange:e=>m({explorationRate:Number(e.target.value)/100}),className:"rounded border border-border bg-surface-2 px-1 py-0.5 text-[11px] text-text-main",children:[0,5,10,15,20].map(e=>(0,l.jsxs)("option",{value:e,children:[e,"%"]},e))})]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1",title:"0 = manual relearn only",children:["Auto-relearn",(0,l.jsxs)("select",{value:c.autoLearnIntervalHours??0,onChange:e=>m({autoLearnIntervalHours:Number(e.target.value)||0}),className:"rounded border border-border bg-surface-2 px-1 py-0.5 text-[11px] text-text-main",children:[(0,l.jsx)("option",{value:0,children:"off"}),(0,l.jsx)("option",{value:6,children:"6h"}),(0,l.jsx)("option",{value:12,children:"12h"}),(0,l.jsx)("option",{value:24,children:"24h"}),(0,l.jsx)("option",{value:72,children:"72h"})]})]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1",title:"Capacity pre-filter before router (vision/PDF)",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:!1!==c.capacityAutoSwitch,onChange:e=>m({capacityAutoSwitch:e.target.checked})}),"Heuristic first"]}),(0,l.jsxs)("label",{className:"inline-flex items-center gap-1",title:"Emit X-Auto-Router-* response headers (worker, cluster, score, skipped)",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:!1!==c.emitAutoRouterHeaders,onChange:e=>m({emitAutoRouterHeaders:e.target.checked})}),"Route headers"]})]}),S?(0,l.jsx)("p",{className:"text-[11px] font-mono text-text-subtle",children:S}):(0,l.jsx)("p",{className:"text-[10px] text-text-subtle",children:"Worker pool = models list (router model excluded if listed). Every request re-routes. Router model is required — pick a connected account (a cheap, fast model such as Haiku works well)."})]})]})]}),(0,l.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3 sm:shrink-0",children:[(0,l.jsxs)("div",{className:"w-full sm:w-[220px] flex flex-col gap-1.5",children:[(0,l.jsx)(d.l6,{options:j,value:M,onChange:e=>{let t=e.target.value;if("auto"===t&&!O){k(!0),h(!0);return}m({fallbackStrategy:t})},selectClassName:"py-1.5 text-xs"}),!R&&(0,l.jsxs)("label",{className:"inline-flex items-center gap-1.5 text-[10px] text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:$,onChange:e=>m({capacityAutoSwitch:e.target.checked})}),"Capacity auto-switch (vision/PDF first)"]})]}),(0,l.jsxs)("div",{className:"grid grid-cols-3 gap-1 sm:flex",children:[(0,l.jsxs)("button",{onClick:t=>{t.stopPropagation(),o(e.name,`combo-${e.id}`)},className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Copy combo name",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:s===`combo-${e.id}`?"check":"content_copy"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Copy"})]}),(0,l.jsxs)("button",{onClick:i,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted transition-colors hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",title:"Edit",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,l.jsxs)("button",{onClick:n,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 transition-colors hover:bg-red-500/10",title:"Delete",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,l.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]})]})]}),(0,l.jsx)(d.rq,{isOpen:x,onClose:()=>u(!1),onSelect:e=>{m({judgeModel:e?.value||""}),u(!1)},activeProviders:a,title:"Select Judge Model",addedModelValues:F?[F]:[],closeOnSelect:!0}),(0,l.jsx)(d.rq,{isOpen:p,onClose:()=>{k(!1),h(!1)},onSelect:e=>{let t=e?.value||"";b?(k(!1),t&&m({fallbackStrategy:"auto",routerModel:t})):m({routerModel:t}),h(!1)},activeProviders:a,title:"Select Router Model",addedModelValues:O?[O]:[],closeOnSelect:!0})]})}function k({id:e,index:t,model:a,learned:s=null,isFirst:n,isLast:d,onEdit:c,onMoveUp:m,onMoveDown:x,onRemove:u}){let{attributes:p,listeners:h,setNodeRef:b,transform:f,isDragging:g}=(0,o.gl)({id:e}),j={transform:i.Ks.Transform.toString(f),opacity:g?.4:1,zIndex:g?999:void 0},[y,v]=(0,r.useState)(!1),[N,w]=(0,r.useState)(a),C=()=>{let e=N.trim();e&&e!==a?c(e):w(a),v(!1)};return(0,l.jsxs)("div",{ref:b,style:j,className:`group flex min-w-0 items-center gap-1.5 rounded-md px-2 py-1 bg-black/[0.02] hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04] transition-colors ${g?"shadow-md ring-1 ring-primary/30":""}`,children:[(0,l.jsx)("button",{...p,...h,type:"button",className:"cursor-grab touch-none p-0.5 rounded text-text-muted hover:text-primary active:cursor-grabbing shrink-0",title:"Drag to reorder",children:(0,l.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,l.jsx)("circle",{cx:"9",cy:"4",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"4",r:"2"}),(0,l.jsx)("circle",{cx:"9",cy:"12",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"12",r:"2"}),(0,l.jsx)("circle",{cx:"9",cy:"20",r:"2"}),(0,l.jsx)("circle",{cx:"15",cy:"20",r:"2"})]})}),(0,l.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:t+1}),y?(0,l.jsx)("input",{autoFocus:!0,value:N,onChange:e=>w(e.target.value),onBlur:C,onKeyDown:e=>{"Enter"===e.key&&C(),"Escape"===e.key&&(w(a),v(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,l.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>v(!0),title:"Click to edit",children:a}),s&&s.n>=10&&(0,l.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-text-subtle",title:"Learned routing stats (all combos, last 14d)",children:["avg ",Math.round(s.avgScore)," \xb7 n=",s.n,s.bestCluster?` \xb7 best: ${s.bestCluster}`:""]}),(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,l.jsx)("button",{onClick:m,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,l.jsx)("button",{onClick:x,disabled:d,className:`p-0.5 rounded ${d?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,l.jsx)("button",{onClick:u,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function w({isOpen:e,combo:t,onClose:a,onSave:i,activeProviders:c,modelCaps:m={},kindFilter:u=null,initialStrategy:h={}}){let[b,g]=(0,r.useState)(t?.name||""),[v,N]=(0,r.useState)(t?.models||[]),[C,S]=(0,r.useState)(h.fallbackStrategy||"fallback"),[A,M]=(0,r.useState)(!1!==h.capacityAutoSwitch),[F,R]=(0,r.useState)(!1),[O,E]=(0,r.useState)(!1),[q,$]=(0,r.useState)(""),[P,D]=(0,r.useState)({}),[L,T]=(0,r.useState)({}),_=(0,s.FR)((0,s.MS)(s.AN,{activationConstraint:{distance:5}}),(0,s.MS)(s.uN,{coordinateGetter:o.JR})),z=v.map((e,t)=>({uid:`item-${t}`,model:e})),H=async()=>{try{let e=await fetch("/api/models/alias");if(e.ok){let t=await e.json();D(t.aliases||{})}}catch(e){(0,x.s)("Error fetching modal data:",e)}try{let e=await fetch("/api/routing/stats");if(!e.ok)throw Error("Failed to fetch learned routing stats");let t=await e.json(),a={};for(let e of t.global||[]){let t=Object.entries(e.clusters||{}),l=t.filter(([,e])=>e.n>=3),r=(l.length?l:t).reduce((e,t)=>{if(!e)return t;let[a,r]=e,[s,o]=t,i=l.length?r.avgScore:r.n,n=l.length?o.avgScore:o.n;return n>i||n===i&&s<a?t:e},null);a[e.worker]={avgScore:e.avgScore,n:e.n,bestCluster:r?r[0]:null}}T(a)}catch{T({})}};(0,r.useEffect)(()=>{e&&(g(t?.name||""),N(t?.models||[]),S(h.fallbackStrategy||"fallback"),M(!1!==h.capacityAutoSwitch),R(!1),E(!1),$(""),T({}),H())},[e,t?.id,t?.name]);let J=e=>e.trim()?p.test(e)?($(""),!0):($("Only letters, numbers, -, _ and . allowed"),!1):($("Name is required"),!1),B=async()=>{if(J(b)){if(0===v.length)return void(0,x.s)("Add at least one model to the combo");if("auto"===C&&v.length<2)return void(0,x.s)("Auto strategy needs at least 2 models in the worker pool (plus a connected router account)");E(!0),await i({name:b.trim(),models:v,strategy:C,capacityAutoSwitch:"auto"===C||A}),E(!1)}},I=!!t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(d.aF,{isOpen:e,onClose:a,title:I?"Edit Combo":"Create Combo",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("p",{className:"text-xs text-text-muted leading-relaxed",children:["Clients call this combo by name as the ",(0,l.jsx)("code",{className:"text-primary",children:"model"})," field. Strategy controls how models in the list are used."]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(d.pd,{label:"Combo Name",value:b,onChange:e=>{let t=e.target.value;g(t),t?J(t):$("")},placeholder:"my-combo",error:q}),(0,l.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:"Only letters, numbers, -, _ and . allowed \xb7 use as model id in /v1"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Strategy"}),(0,l.jsx)(d.l6,{options:j,value:C,onChange:e=>S(e.target.value),selectClassName:"py-2 text-sm"}),(0,l.jsx)("p",{className:"text-[11px] text-text-muted mt-1.5",children:y[C]}),"auto"===C&&(0,l.jsxs)("p",{className:"text-[11px] text-amber-600 dark:text-amber-400 mt-1 flex items-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"info"}),"Auto requires a router model — select one on the combo card after saving."]}),"auto"!==C&&(0,l.jsxs)("label",{className:"mt-2 inline-flex items-center gap-2 text-xs text-text-muted cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",className:"rounded border-border",checked:A,onChange:e=>M(e.target.checked)}),"Capacity auto-switch — prefer vision/PDF-capable models when the request needs them"]}),"auto"===C&&(0,l.jsx)("p",{className:"text-[11px] text-text-subtle mt-1.5 font-mono",children:"After create: set Router model on the combo card (must be a connected account). Workers = this model list (router excluded if listed)."}),"fusion"===C&&(0,l.jsx)("p",{className:"text-[11px] text-text-subtle mt-1.5 font-mono",children:"After create: optionally set Judge on the combo card (default = first model)."})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("label",{className:"text-sm font-medium mb-1.5 block",children:["Models ","fallback"===C?"(order = priority)":"(pool)"]}),v.length>0&&f(v,null,m)&&(0,l.jsxs)("p",{className:"text-[10px] text-amber-600 dark:text-amber-400 flex items-center gap-1 mb-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"warning"}),"No vision-capable model — image requests will have images stripped"]}),0===v.length?(0,l.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,l.jsx)(s.Mp,{sensors:_,collisionDetection:s.fp,onDragEnd:e=>{let{active:t,over:a}=e;if(a&&t.id!==a.id){let e=z.findIndex(e=>e.uid===t.id),l=z.findIndex(e=>e.uid===a.id);-1!==e&&-1!==l&&N(t=>(0,o.be)(t,e,l))}},modifiers:[n.FN,n.gj],children:(0,l.jsx)(o.gB,{items:z.map(e=>e.uid),strategy:o._G,children:(0,l.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:z.map(({uid:e,model:t},a)=>(0,l.jsx)(k,{id:e,index:a,model:t,learned:L[t]||null,isFirst:0===a,isLast:a===z.length-1,onEdit:e=>{let t=[...v];t[a]=e,N(t)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...v];[t[e-1],t[e]]=[t[e],t[e-1]],N(t)})(a),onMoveDown:()=>(e=>{if(e===v.length-1)return;let t=[...v];[t[e],t[e+1]]=[t[e+1],t[e]],N(t)})(a),onRemove:()=>{N(v.filter((e,t)=>t!==a))}},e))})})}),(0,l.jsxs)("button",{onClick:()=>R(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,l.jsx)(d.$n,{onClick:a,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,l.jsx)(d.$n,{onClick:B,fullWidth:!0,size:"sm",disabled:!b.trim()||!!q||O,children:O?"Saving...":I?"Save":"Create"})]})]})}),(0,l.jsx)(d.rq,{isOpen:F,onClose:()=>R(!1),onSelect:e=>{v.includes(e.value)||N([...v,e.value])},onDeselect:e=>{N(v.filter(t=>t!==e.value))},activeProviders:c,modelAliases:P,title:"Add Model to Combo",kindFilter:u,addedModelValues:v,closeOnSelect:!1})]})}},80063:(e,t,a)=>{Promise.resolve().then(a.bind(a,41483))}},e=>{e.O(0,[2574,3862,782,8500,594,7055,1321,7592,5497,8441,3794,7358],()=>e(e.s=80063)),_N_E=e.O()}]);
|