@kaitranntt/ccs 7.50.0 → 7.51.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -4
- package/config/base-iflow.settings.json +4 -4
- package/dist/api/services/index.d.ts +2 -2
- package/dist/api/services/index.d.ts.map +1 -1
- package/dist/api/services/index.js +2 -1
- package/dist/api/services/index.js.map +1 -1
- package/dist/api/services/profile-reader.d.ts.map +1 -1
- package/dist/api/services/profile-reader.js +13 -0
- package/dist/api/services/profile-reader.js.map +1 -1
- package/dist/api/services/profile-types.d.ts +9 -0
- package/dist/api/services/profile-types.d.ts.map +1 -1
- package/dist/api/services/profile-writer.d.ts +8 -2
- package/dist/api/services/profile-writer.d.ts.map +1 -1
- package/dist/api/services/profile-writer.js +83 -8
- package/dist/api/services/profile-writer.js.map +1 -1
- package/dist/auth/account-context.d.ts +11 -0
- package/dist/auth/account-context.d.ts.map +1 -1
- package/dist/auth/account-context.js +42 -8
- package/dist/auth/account-context.js.map +1 -1
- package/dist/auth/auth-commands.d.ts.map +1 -1
- package/dist/auth/auth-commands.js +9 -0
- package/dist/auth/auth-commands.js.map +1 -1
- package/dist/auth/commands/create-command-env.d.ts +3 -0
- package/dist/auth/commands/create-command-env.d.ts.map +1 -0
- package/dist/auth/commands/create-command-env.js +55 -0
- package/dist/auth/commands/create-command-env.js.map +1 -0
- package/dist/auth/commands/create-command.d.ts.map +1 -1
- package/dist/auth/commands/create-command.js +136 -30
- package/dist/auth/commands/create-command.js.map +1 -1
- package/dist/auth/commands/list-command.d.ts.map +1 -1
- package/dist/auth/commands/list-command.js +5 -1
- package/dist/auth/commands/list-command.js.map +1 -1
- package/dist/auth/commands/show-command.d.ts.map +1 -1
- package/dist/auth/commands/show-command.js +1 -0
- package/dist/auth/commands/show-command.js.map +1 -1
- package/dist/auth/commands/types.d.ts +3 -0
- package/dist/auth/commands/types.d.ts.map +1 -1
- package/dist/auth/commands/types.js +24 -0
- package/dist/auth/commands/types.js.map +1 -1
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +8 -0
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/auth/profile-registry.d.ts +2 -0
- package/dist/auth/profile-registry.d.ts.map +1 -1
- package/dist/auth/profile-registry.js +45 -7
- package/dist/auth/profile-registry.js.map +1 -1
- package/dist/ccs.js +156 -4
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/account-safety.d.ts.map +1 -1
- package/dist/cliproxy/account-safety.js +4 -0
- package/dist/cliproxy/account-safety.js.map +1 -1
- package/dist/cliproxy/antigravity-responsibility.d.ts +36 -0
- package/dist/cliproxy/antigravity-responsibility.d.ts.map +1 -0
- package/dist/cliproxy/antigravity-responsibility.js +171 -0
- package/dist/cliproxy/antigravity-responsibility.js.map +1 -0
- package/dist/cliproxy/auth/auth-types.d.ts +2 -0
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.js +18 -0
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/env-builder.js +116 -8
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/generator.d.ts +3 -1
- package/dist/cliproxy/config/generator.d.ts.map +1 -1
- package/dist/cliproxy/config/generator.js +26 -8
- package/dist/cliproxy/config/generator.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +30 -0
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +4 -10
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/cliproxy/model-config.d.ts.map +1 -1
- package/dist/cliproxy/model-config.js +12 -11
- package/dist/cliproxy/model-config.js.map +1 -1
- package/dist/cliproxy/model-id-normalizer.d.ts +17 -2
- package/dist/cliproxy/model-id-normalizer.d.ts.map +1 -1
- package/dist/cliproxy/model-id-normalizer.js +54 -7
- package/dist/cliproxy/model-id-normalizer.js.map +1 -1
- package/dist/cliproxy/services/variant-config-adapter.d.ts +4 -35
- package/dist/cliproxy/services/variant-config-adapter.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-config-adapter.js +11 -34
- package/dist/cliproxy/services/variant-config-adapter.js.map +1 -1
- package/dist/cliproxy/services/variant-service.d.ts +5 -1
- package/dist/cliproxy/services/variant-service.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-service.js +19 -9
- package/dist/cliproxy/services/variant-service.js.map +1 -1
- package/dist/cliproxy/services/variant-settings.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-settings.js +5 -3
- package/dist/cliproxy/services/variant-settings.js.map +1 -1
- package/dist/cliproxy/sync/profile-mapper.d.ts.map +1 -1
- package/dist/cliproxy/sync/profile-mapper.js +14 -2
- package/dist/cliproxy/sync/profile-mapper.js.map +1 -1
- package/dist/commands/api-command.d.ts +2 -0
- package/dist/commands/api-command.d.ts.map +1 -1
- package/dist/commands/api-command.js +45 -10
- package/dist/commands/api-command.js.map +1 -1
- package/dist/commands/cliproxy/auth-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/auth-subcommand.js +5 -2
- package/dist/commands/cliproxy/auth-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +1 -0
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.d.ts +15 -0
- package/dist/commands/cliproxy/variant-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.js +144 -15
- package/dist/commands/cliproxy/variant-subcommand.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +34 -2
- package/dist/commands/help-command.js.map +1 -1
- package/dist/config/migration-manager.d.ts.map +1 -1
- package/dist/config/migration-manager.js +19 -0
- package/dist/config/migration-manager.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts +11 -1
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +127 -59
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +16 -0
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js +8 -1
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/delegation/headless-executor.d.ts.map +1 -1
- package/dist/delegation/headless-executor.js +4 -1
- package/dist/delegation/headless-executor.js.map +1 -1
- package/dist/management/instance-manager.d.ts +1 -0
- package/dist/management/instance-manager.d.ts.map +1 -1
- package/dist/management/instance-manager.js +14 -8
- package/dist/management/instance-manager.js.map +1 -1
- package/dist/management/profile-context-sync-lock.d.ts +14 -0
- package/dist/management/profile-context-sync-lock.d.ts.map +1 -0
- package/dist/management/profile-context-sync-lock.js +174 -0
- package/dist/management/profile-context-sync-lock.js.map +1 -0
- package/dist/management/shared-manager.d.ts +18 -0
- package/dist/management/shared-manager.d.ts.map +1 -1
- package/dist/management/shared-manager.js +145 -6
- package/dist/management/shared-manager.js.map +1 -1
- package/dist/targets/droid-adapter.d.ts +2 -4
- package/dist/targets/droid-adapter.d.ts.map +1 -1
- package/dist/targets/droid-adapter.js +20 -10
- package/dist/targets/droid-adapter.js.map +1 -1
- package/dist/targets/droid-command-router.d.ts +26 -0
- package/dist/targets/droid-command-router.d.ts.map +1 -0
- package/dist/targets/droid-command-router.js +240 -0
- package/dist/targets/droid-command-router.js.map +1 -0
- package/dist/targets/droid-config-manager.d.ts +9 -1
- package/dist/targets/droid-config-manager.d.ts.map +1 -1
- package/dist/targets/droid-config-manager.js +134 -6
- package/dist/targets/droid-config-manager.js.map +1 -1
- package/dist/targets/droid-provider.d.ts +40 -0
- package/dist/targets/droid-provider.d.ts.map +1 -0
- package/dist/targets/droid-provider.js +140 -0
- package/dist/targets/droid-provider.js.map +1 -0
- package/dist/targets/droid-reasoning-runtime.d.ts +14 -0
- package/dist/targets/droid-reasoning-runtime.d.ts.map +1 -0
- package/dist/targets/droid-reasoning-runtime.js +42 -0
- package/dist/targets/droid-reasoning-runtime.js.map +1 -0
- package/dist/targets/index.d.ts +2 -0
- package/dist/targets/index.d.ts.map +1 -1
- package/dist/targets/index.js +4 -1
- package/dist/targets/index.js.map +1 -1
- package/dist/targets/target-adapter.d.ts +6 -0
- package/dist/targets/target-adapter.d.ts.map +1 -1
- package/dist/targets/target-resolver.d.ts.map +1 -1
- package/dist/targets/target-resolver.js +6 -3
- package/dist/targets/target-resolver.js.map +1 -1
- package/dist/types/config.d.ts +7 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js.map +1 -1
- package/dist/ui/assets/accounts-Cs_Uohn7.js +1 -0
- package/dist/ui/assets/{alert-dialog-YcmZPFim.js → alert-dialog-cRwDSggu.js} +1 -1
- package/dist/ui/assets/api-C73W2Hb1.js +1 -0
- package/dist/ui/assets/auth-section-DgF431PH.js +1 -0
- package/dist/ui/assets/backups-section-9V2yDu_e.js +1 -0
- package/dist/ui/assets/{checkbox-Cfg9kbJX.js → checkbox-BeoeEcEZ.js} +1 -1
- package/dist/ui/assets/cliproxy-DAlyh7zw.js +3 -0
- package/dist/ui/assets/cliproxy-control-panel-CE4y4VDk.js +1 -0
- package/dist/ui/assets/{confirm-dialog-CRcV2Yc4.js → confirm-dialog-COTT5ztZ.js} +1 -1
- package/dist/ui/assets/copilot-Cm5PT0v6.js +3 -0
- package/dist/ui/assets/cursor-DYhCaKbC.js +1 -0
- package/dist/ui/assets/droid-eTM2_tVh.js +2 -0
- package/dist/ui/assets/{form-utils-C-pVd1--.js → form-utils-Cn_Uld6y.js} +1 -1
- package/dist/ui/assets/globalenv-section-Dzt_ECFK.js +1 -0
- package/dist/ui/assets/health-Bk8Cj2vi.js +1 -0
- package/dist/ui/assets/icons-kPbuhVdj.js +1 -0
- package/dist/ui/assets/index-BXDW5hxG.js +1 -0
- package/dist/ui/assets/index-CKnNRLzv.js +1 -0
- package/dist/ui/assets/index-Ck953xpy.css +1 -0
- package/dist/ui/assets/index-D1Gx_G_A.js +1 -0
- package/dist/ui/assets/index-hlYFfpDN.js +47 -0
- package/dist/ui/assets/index-jqDLGaO4.js +1 -0
- package/dist/ui/assets/proxy-status-widget-D-PfDCn1.js +1 -0
- package/dist/ui/assets/{radix-ui-DKgfU5rd.js → radix-ui-BR1vy4kf.js} +3 -3
- package/dist/ui/assets/{separator-CdOKc0gJ.js → separator-CjXUYlSy.js} +1 -1
- package/dist/ui/assets/shared-C9EvhZ8u.js +8 -0
- package/dist/ui/assets/{switch-B2ALi24E.js → switch-DFLN6xA0.js} +1 -1
- package/dist/ui/assets/{tanstack-5ndrQy-j.js → tanstack-e99Cjjy2.js} +1 -1
- package/dist/ui/assets/updates-FcpGeTFg.js +1 -0
- package/dist/ui/index.html +6 -6
- package/dist/utils/shell-executor.d.ts +5 -0
- package/dist/utils/shell-executor.d.ts.map +1 -1
- package/dist/utils/shell-executor.js +22 -3
- package/dist/utils/shell-executor.js.map +1 -1
- package/dist/web-server/model-pricing.d.ts.map +1 -1
- package/dist/web-server/model-pricing.js +114 -22
- package/dist/web-server/model-pricing.js.map +1 -1
- package/dist/web-server/routes/account-route-helpers.d.ts +20 -0
- package/dist/web-server/routes/account-route-helpers.d.ts.map +1 -0
- package/dist/web-server/routes/account-route-helpers.js +34 -0
- package/dist/web-server/routes/account-route-helpers.js.map +1 -0
- package/dist/web-server/routes/account-routes.d.ts.map +1 -1
- package/dist/web-server/routes/account-routes.js +160 -27
- package/dist/web-server/routes/account-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +58 -24
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +22 -3
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/dist/web-server/routes/config-routes.d.ts.map +1 -1
- package/dist/web-server/routes/config-routes.js +73 -0
- package/dist/web-server/routes/config-routes.js.map +1 -1
- package/dist/web-server/routes/droid-routes.d.ts +3 -0
- package/dist/web-server/routes/droid-routes.d.ts.map +1 -0
- package/dist/web-server/routes/droid-routes.js +61 -0
- package/dist/web-server/routes/droid-routes.js.map +1 -0
- package/dist/web-server/routes/index.d.ts.map +1 -1
- package/dist/web-server/routes/index.js +3 -0
- package/dist/web-server/routes/index.js.map +1 -1
- package/dist/web-server/routes/profile-routes.d.ts +2 -0
- package/dist/web-server/routes/profile-routes.d.ts.map +1 -1
- package/dist/web-server/routes/profile-routes.js +86 -6
- package/dist/web-server/routes/profile-routes.js.map +1 -1
- package/dist/web-server/routes/route-helpers.d.ts +2 -1
- package/dist/web-server/routes/route-helpers.d.ts.map +1 -1
- package/dist/web-server/routes/route-helpers.js +20 -1
- package/dist/web-server/routes/route-helpers.js.map +1 -1
- package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/settings-routes.js +168 -39
- package/dist/web-server/routes/settings-routes.js.map +1 -1
- package/dist/web-server/routes/variant-routes.d.ts +2 -0
- package/dist/web-server/routes/variant-routes.d.ts.map +1 -1
- package/dist/web-server/routes/variant-routes.js +50 -6
- package/dist/web-server/routes/variant-routes.js.map +1 -1
- package/dist/web-server/services/compatible-cli-docs-registry.d.ts +23 -0
- package/dist/web-server/services/compatible-cli-docs-registry.d.ts.map +1 -0
- package/dist/web-server/services/compatible-cli-docs-registry.js +81 -0
- package/dist/web-server/services/compatible-cli-docs-registry.js.map +1 -0
- package/dist/web-server/services/compatible-cli-json-file-service.d.ts +41 -0
- package/dist/web-server/services/compatible-cli-json-file-service.d.ts.map +1 -0
- package/dist/web-server/services/compatible-cli-json-file-service.js +205 -0
- package/dist/web-server/services/compatible-cli-json-file-service.js.map +1 -0
- package/dist/web-server/services/compatible-cli-types.d.ts +82 -0
- package/dist/web-server/services/compatible-cli-types.d.ts.map +1 -0
- package/dist/web-server/services/compatible-cli-types.js +3 -0
- package/dist/web-server/services/compatible-cli-types.js.map +1 -0
- package/dist/web-server/services/droid-dashboard-service.d.ts +29 -0
- package/dist/web-server/services/droid-dashboard-service.d.ts.map +1 -0
- package/dist/web-server/services/droid-dashboard-service.js +238 -0
- package/dist/web-server/services/droid-dashboard-service.js.map +1 -0
- package/dist/web-server/shared-routes.d.ts.map +1 -1
- package/dist/web-server/shared-routes.js +350 -52
- package/dist/web-server/shared-routes.js.map +1 -1
- package/lib/hooks/websearch-transformer.cjs +78 -52
- package/package.json +4 -2
- package/scripts/maintainability-check.js +163 -0
- package/dist/ui/assets/accounts-DIqClJ7z.js +0 -1
- package/dist/ui/assets/api-BWyCgbMh.js +0 -1
- package/dist/ui/assets/auth-section-Amm4rwiS.js +0 -1
- package/dist/ui/assets/backups-section-DmAsqMfq.js +0 -1
- package/dist/ui/assets/cliproxy-B-q7RjS2.js +0 -3
- package/dist/ui/assets/cliproxy-control-panel-BliRTkbb.js +0 -1
- package/dist/ui/assets/copilot-EarFqUyJ.js +0 -3
- package/dist/ui/assets/cursor-Dbe4Wtw2.js +0 -1
- package/dist/ui/assets/globalenv-section-CBp73q9k.js +0 -1
- package/dist/ui/assets/health-Cvr359ff.js +0 -1
- package/dist/ui/assets/icons-DGASzt3M.js +0 -1
- package/dist/ui/assets/index-8n-yIlea.js +0 -47
- package/dist/ui/assets/index-B5aulDs4.js +0 -1
- package/dist/ui/assets/index-BBCDm6dS.css +0 -1
- package/dist/ui/assets/index-CLBNUja8.js +0 -1
- package/dist/ui/assets/index-Cp8K9_TQ.js +0 -1
- package/dist/ui/assets/index-DTDftvd-.js +0 -1
- package/dist/ui/assets/proxy-status-widget-C0G0aOCW.js +0 -1
- package/dist/ui/assets/shared-zsUXmES2.js +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Droid BYOK provider resolution helpers.
|
|
4
|
+
*
|
|
5
|
+
* Factory BYOK accepts exactly:
|
|
6
|
+
* - anthropic
|
|
7
|
+
* - openai
|
|
8
|
+
* - generic-chat-completion-api
|
|
9
|
+
*
|
|
10
|
+
* CCS stores provider hints in profile settings as CCS_DROID_PROVIDER and
|
|
11
|
+
* resolves a best-effort provider from base URL/model when the hint is absent.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.resolveDroidProvider = exports.inferDroidProviderFromModel = exports.inferDroidProviderFromBaseUrl = exports.normalizeDroidProvider = void 0;
|
|
15
|
+
const GENERIC_PROVIDER_ALIASES = new Set([
|
|
16
|
+
'generic',
|
|
17
|
+
'generic-openai',
|
|
18
|
+
'generic-openai-api',
|
|
19
|
+
'generic-chat',
|
|
20
|
+
'generic-chat-completions',
|
|
21
|
+
'openai-compatible',
|
|
22
|
+
'chat-completions',
|
|
23
|
+
]);
|
|
24
|
+
const OPENAI_PROVIDER_ALIASES = new Set(['openai-responses', 'openai-official']);
|
|
25
|
+
const ANTHROPIC_PROVIDER_ALIASES = new Set(['anthropic-compatible']);
|
|
26
|
+
/**
|
|
27
|
+
* Normalize potentially messy provider input into a valid Factory provider.
|
|
28
|
+
*/
|
|
29
|
+
function normalizeDroidProvider(provider) {
|
|
30
|
+
if (!provider)
|
|
31
|
+
return null;
|
|
32
|
+
const normalized = provider.trim().toLowerCase();
|
|
33
|
+
if (!normalized)
|
|
34
|
+
return null;
|
|
35
|
+
if (normalized === 'anthropic' || ANTHROPIC_PROVIDER_ALIASES.has(normalized)) {
|
|
36
|
+
return 'anthropic';
|
|
37
|
+
}
|
|
38
|
+
if (normalized === 'openai' || OPENAI_PROVIDER_ALIASES.has(normalized)) {
|
|
39
|
+
return 'openai';
|
|
40
|
+
}
|
|
41
|
+
if (normalized === 'generic-chat-completion-api' || GENERIC_PROVIDER_ALIASES.has(normalized)) {
|
|
42
|
+
return 'generic-chat-completion-api';
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
exports.normalizeDroidProvider = normalizeDroidProvider;
|
|
47
|
+
/**
|
|
48
|
+
* Infer provider primarily from base URL patterns used in BYOK configs.
|
|
49
|
+
*/
|
|
50
|
+
function inferDroidProviderFromBaseUrl(baseUrl) {
|
|
51
|
+
if (!baseUrl)
|
|
52
|
+
return null;
|
|
53
|
+
const raw = baseUrl.trim();
|
|
54
|
+
if (!raw)
|
|
55
|
+
return null;
|
|
56
|
+
let parsed;
|
|
57
|
+
try {
|
|
58
|
+
parsed = new URL(raw);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const host = parsed.host.toLowerCase();
|
|
64
|
+
const pathname = parsed.pathname.toLowerCase();
|
|
65
|
+
const isLocalHost = host.startsWith('localhost') || host.startsWith('127.0.0.1') || host.startsWith('[::1]');
|
|
66
|
+
if (host.includes('api.openai.com') ||
|
|
67
|
+
host.includes('.openai.azure.com') ||
|
|
68
|
+
host.includes('.services.ai.azure.com')) {
|
|
69
|
+
return 'openai';
|
|
70
|
+
}
|
|
71
|
+
if (host.includes('anthropic.com') || pathname.includes('/anthropic')) {
|
|
72
|
+
return 'anthropic';
|
|
73
|
+
}
|
|
74
|
+
if (host.includes('openrouter.ai') ||
|
|
75
|
+
host.includes('api.groq.com') ||
|
|
76
|
+
host.includes('api.deepinfra.com') ||
|
|
77
|
+
host.includes('api.fireworks.ai') ||
|
|
78
|
+
host.includes('inference.baseten.co') ||
|
|
79
|
+
host.includes('huggingface.co') ||
|
|
80
|
+
host.includes('ollama.com') ||
|
|
81
|
+
pathname.includes('/openai') ||
|
|
82
|
+
pathname.includes('/chat/completions')) {
|
|
83
|
+
return 'generic-chat-completion-api';
|
|
84
|
+
}
|
|
85
|
+
// Local OpenAI-compatible proxies are commonly exposed at /v1.
|
|
86
|
+
if (isLocalHost && (pathname === '/v1' || pathname.startsWith('/v1/'))) {
|
|
87
|
+
return 'generic-chat-completion-api';
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
exports.inferDroidProviderFromBaseUrl = inferDroidProviderFromBaseUrl;
|
|
92
|
+
/**
|
|
93
|
+
* Infer provider from model naming when URL does not provide a clear signal.
|
|
94
|
+
*/
|
|
95
|
+
function inferDroidProviderFromModel(model) {
|
|
96
|
+
if (!model)
|
|
97
|
+
return null;
|
|
98
|
+
const normalized = model.trim().toLowerCase();
|
|
99
|
+
if (!normalized)
|
|
100
|
+
return null;
|
|
101
|
+
if (normalized.startsWith('claude-')) {
|
|
102
|
+
return 'anthropic';
|
|
103
|
+
}
|
|
104
|
+
if (normalized.startsWith('gpt-') ||
|
|
105
|
+
normalized.startsWith('o1') ||
|
|
106
|
+
normalized.startsWith('o3') ||
|
|
107
|
+
normalized.startsWith('o4')) {
|
|
108
|
+
return 'openai';
|
|
109
|
+
}
|
|
110
|
+
if (normalized.startsWith('qwen') ||
|
|
111
|
+
normalized.startsWith('deepseek') ||
|
|
112
|
+
normalized.startsWith('kimi')) {
|
|
113
|
+
return 'generic-chat-completion-api';
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
exports.inferDroidProviderFromModel = inferDroidProviderFromModel;
|
|
118
|
+
/**
|
|
119
|
+
* Resolve a provider for Droid custom model entries.
|
|
120
|
+
*
|
|
121
|
+
* Precedence:
|
|
122
|
+
* 1) explicit provider hint (CCS_DROID_PROVIDER)
|
|
123
|
+
* 2) base URL inference
|
|
124
|
+
* 3) model inference
|
|
125
|
+
* 4) anthropic (backward-compatible default for legacy CCS profiles)
|
|
126
|
+
*/
|
|
127
|
+
function resolveDroidProvider(input) {
|
|
128
|
+
const explicit = normalizeDroidProvider(input.provider);
|
|
129
|
+
if (explicit)
|
|
130
|
+
return explicit;
|
|
131
|
+
const fromUrl = inferDroidProviderFromBaseUrl(input.baseUrl);
|
|
132
|
+
if (fromUrl)
|
|
133
|
+
return fromUrl;
|
|
134
|
+
const fromModel = inferDroidProviderFromModel(input.model);
|
|
135
|
+
if (fromModel)
|
|
136
|
+
return fromModel;
|
|
137
|
+
return 'anthropic';
|
|
138
|
+
}
|
|
139
|
+
exports.resolveDroidProvider = resolveDroidProvider;
|
|
140
|
+
//# sourceMappingURL=droid-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"droid-provider.js","sourceRoot":"","sources":["../../src/targets/droid-provider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAIH,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAS;IAC/C,SAAS;IACT,gBAAgB;IAChB,oBAAoB;IACpB,cAAc;IACd,0BAA0B;IAC1B,mBAAmB;IACnB,kBAAkB;CACnB,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAS,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC,CAAC;AACzF,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAS,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAE7E;;GAEG;AACH,SAAgB,sBAAsB,CAAC,QAAmC;IACxE,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACjD,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAE7B,IAAI,UAAU,KAAK,WAAW,IAAI,0BAA0B,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7E,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,IAAI,UAAU,KAAK,QAAQ,IAAI,uBAAuB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QACvE,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,UAAU,KAAK,6BAA6B,IAAI,wBAAwB,CAAC,G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,OAAO,6BAA6B,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AA1BD,kEA0BC;AAQD;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAC,KAAgC;IACnE,MAAM,QAAQ,GAAG,sBAAsB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxD,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAE9B,MAAM,OAAO,GAAG,6BAA6B,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7D,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAE5B,MAAM,SAAS,GAAG,2BAA2B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3D,IAAI,SAAS;QAAE,OAAO,SAAS,CAAC;IAEhC,OAAO,WAAW,CAAC;AACrB,CAAC;AAXD,oDAWC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ThinkingFlag } from '../cliproxy/executor/thinking-arg-parser';
|
|
2
|
+
export declare class DroidReasoningFlagError extends Error {
|
|
3
|
+
readonly flag: ThinkingFlag;
|
|
4
|
+
constructor(message: string, flag: ThinkingFlag);
|
|
5
|
+
}
|
|
6
|
+
export interface DroidReasoningRuntime {
|
|
7
|
+
argsWithoutReasoningFlags: string[];
|
|
8
|
+
reasoningOverride: string | number | undefined;
|
|
9
|
+
sourceFlag: ThinkingFlag | undefined;
|
|
10
|
+
sourceDisplay: string | undefined;
|
|
11
|
+
duplicateDisplays: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function resolveDroidReasoningRuntime(args: string[], envThinkingValue: string | undefined): DroidReasoningRuntime;
|
|
14
|
+
//# sourceMappingURL=droid-reasoning-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"droid-reasoning-runtime.d.ts","sourceRoot":"","sources":["../../src/targets/droid-reasoning-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAGpG,qBAAa,uBAAwB,SAAQ,KAAK;aAG9B,IAAI,EAAE,YAAY;gBADlC,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,YAAY;CAKrC;AAED,MAAM,WAAW,qBAAqB;IACpC,yBAAyB,EAAE,MAAM,EAAE,CAAC;IACpC,iBAAiB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/C,UAAU,EAAE,YAAY,GAAG,SAAS,CAAC;IACrC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAYD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,EAAE,EACd,gBAAgB,EAAE,MAAM,GAAG,SAAS,GACnC,qBAAqB,CAqBvB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveDroidReasoningRuntime = exports.DroidReasoningFlagError = void 0;
|
|
4
|
+
const thinking_arg_parser_1 = require("../cliproxy/executor/thinking-arg-parser");
|
|
5
|
+
const thinking_override_resolver_1 = require("../cliproxy/executor/thinking-override-resolver");
|
|
6
|
+
class DroidReasoningFlagError extends Error {
|
|
7
|
+
constructor(message, flag) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.flag = flag;
|
|
10
|
+
this.name = 'DroidReasoningFlagError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.DroidReasoningFlagError = DroidReasoningFlagError;
|
|
14
|
+
function stripReasoningFlags(args) {
|
|
15
|
+
return args.filter((arg, idx) => {
|
|
16
|
+
if (arg === '--thinking' || arg === '--effort')
|
|
17
|
+
return false;
|
|
18
|
+
if (arg.startsWith('--thinking='))
|
|
19
|
+
return false;
|
|
20
|
+
if (arg.startsWith('--effort='))
|
|
21
|
+
return false;
|
|
22
|
+
if (args[idx - 1] === '--thinking' || args[idx - 1] === '--effort')
|
|
23
|
+
return false;
|
|
24
|
+
return true;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function resolveDroidReasoningRuntime(args, envThinkingValue) {
|
|
28
|
+
const parseResult = (0, thinking_arg_parser_1.parseThinkingOverride)(args);
|
|
29
|
+
if (parseResult.error) {
|
|
30
|
+
throw new DroidReasoningFlagError(`${parseResult.error.flag} requires a value`, parseResult.error.flag);
|
|
31
|
+
}
|
|
32
|
+
const { thinkingOverride, thinkingSource } = (0, thinking_override_resolver_1.resolveRuntimeThinkingOverride)(parseResult.value, envThinkingValue);
|
|
33
|
+
return {
|
|
34
|
+
argsWithoutReasoningFlags: stripReasoningFlags(args),
|
|
35
|
+
reasoningOverride: thinkingOverride,
|
|
36
|
+
sourceFlag: thinkingSource === 'flag' ? parseResult.sourceFlag : undefined,
|
|
37
|
+
sourceDisplay: parseResult.sourceDisplay,
|
|
38
|
+
duplicateDisplays: parseResult.duplicateDisplays,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.resolveDroidReasoningRuntime = resolveDroidReasoningRuntime;
|
|
42
|
+
//# sourceMappingURL=droid-reasoning-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"droid-reasoning-runtime.js","sourceRoot":"","sources":["../../src/targets/droid-reasoning-runtime.ts"],"names":[],"mappings":";;;AAAA,kFAAoG;AACpG,gGAAiG;AAEjG,MAAa,uBAAwB,SAAQ,KAAK;IAChD,YACE,OAAe,EACC,IAAkB;QAElC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,SAAI,GAAJ,IAAI,CAAc;QAGlC,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AARD,0DAQC;AAUD,SAAS,mBAAmB,CAAC,IAAc;IACzC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC9B,IAAI,GAAG,KAAK,YAAY,IAAI,GAAG,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QAC7D,IAAI,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC;YAAE,OAAO,KAAK,CAAC;QAChD,IAAI,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC;YAAE,OAAO,KAAK,CAAC;QAC9C,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,YAAY,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QACjF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,4BAA4B,CAC1C,IAAc,EACd,gBAAoC;IAEpC,MAAM,WAAW,GAAG,IAAA,2CAAqB,EAAC,IAAI,CAAC,CAAC;IAChD,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,IAAI,uBAAuB,CAC/B,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,mBAAmB,EAC5C,WAAW,CAAC,KAAK,CAAC,IAAI,CACvB,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,IAAA,2DAA8B,EACzE,WAAW,CAAC,KAAK,EACjB,gBAAgB,CACjB,CAAC;IAEF,OAAO;QACL,yBAAyB,EAAE,mBAAmB,CAAC,IAAI,CAAC;QACpD,iBAAiB,EAAE,gBAAgB;QACnC,UAAU,EAAE,cAAc,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;QAC1E,aAAa,EAAE,WAAW,CAAC,aAAa;QACxC,iBAAiB,EAAE,WAAW,CAAC,iBAAiB;KACjD,CAAC;AACJ,CAAC;AAxBD,oEAwBC"}
|
package/dist/targets/index.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ export { DroidAdapter } from './droid-adapter';
|
|
|
10
10
|
export { getDroidBinaryInfo, detectDroidCli, checkDroidVersion } from './droid-detector';
|
|
11
11
|
export { upsertCcsModel, removeCcsModel, listCcsModels, pruneOrphanedModels, } from './droid-config-manager';
|
|
12
12
|
export type { DroidCustomModel } from './droid-config-manager';
|
|
13
|
+
export { resolveDroidProvider, normalizeDroidProvider } from './droid-provider';
|
|
14
|
+
export type { DroidProvider } from './droid-provider';
|
|
13
15
|
export { resolveTargetType, stripTargetFlag } from './target-resolver';
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/targets/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EACL,cAAc,EACd,cAAc,EACd,aAAa,EACb,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/targets/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EACL,cAAc,EACd,cAAc,EACd,aAAa,EACb,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAChF,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/targets/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Re-exports for convenient access to target adapter types and registry.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.stripTargetFlag = exports.resolveTargetType = exports.pruneOrphanedModels = exports.listCcsModels = exports.removeCcsModel = exports.upsertCcsModel = exports.checkDroidVersion = exports.detectDroidCli = exports.getDroidBinaryInfo = exports.DroidAdapter = exports.ClaudeAdapter = exports.getRegisteredTargets = exports.hasTarget = exports.getDefaultTarget = exports.getTarget = exports.registerTarget = void 0;
|
|
8
|
+
exports.stripTargetFlag = exports.resolveTargetType = exports.normalizeDroidProvider = exports.resolveDroidProvider = exports.pruneOrphanedModels = exports.listCcsModels = exports.removeCcsModel = exports.upsertCcsModel = exports.checkDroidVersion = exports.detectDroidCli = exports.getDroidBinaryInfo = exports.DroidAdapter = exports.ClaudeAdapter = exports.getRegisteredTargets = exports.hasTarget = exports.getDefaultTarget = exports.getTarget = exports.registerTarget = void 0;
|
|
9
9
|
var target_registry_1 = require("./target-registry");
|
|
10
10
|
Object.defineProperty(exports, "registerTarget", { enumerable: true, get: function () { return target_registry_1.registerTarget; } });
|
|
11
11
|
Object.defineProperty(exports, "getTarget", { enumerable: true, get: function () { return target_registry_1.getTarget; } });
|
|
@@ -25,6 +25,9 @@ Object.defineProperty(exports, "upsertCcsModel", { enumerable: true, get: functi
|
|
|
25
25
|
Object.defineProperty(exports, "removeCcsModel", { enumerable: true, get: function () { return droid_config_manager_1.removeCcsModel; } });
|
|
26
26
|
Object.defineProperty(exports, "listCcsModels", { enumerable: true, get: function () { return droid_config_manager_1.listCcsModels; } });
|
|
27
27
|
Object.defineProperty(exports, "pruneOrphanedModels", { enumerable: true, get: function () { return droid_config_manager_1.pruneOrphanedModels; } });
|
|
28
|
+
var droid_provider_1 = require("./droid-provider");
|
|
29
|
+
Object.defineProperty(exports, "resolveDroidProvider", { enumerable: true, get: function () { return droid_provider_1.resolveDroidProvider; } });
|
|
30
|
+
Object.defineProperty(exports, "normalizeDroidProvider", { enumerable: true, get: function () { return droid_provider_1.normalizeDroidProvider; } });
|
|
28
31
|
var target_resolver_1 = require("./target-resolver");
|
|
29
32
|
Object.defineProperty(exports, "resolveTargetType", { enumerable: true, get: function () { return target_resolver_1.resolveTargetType; } });
|
|
30
33
|
Object.defineProperty(exports, "stripTargetFlag", { enumerable: true, get: function () { return target_resolver_1.stripTargetFlag; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/targets/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAQH,qDAM2B;AALzB,iHAAA,cAAc,OAAA;AACd,4GAAA,SAAS,OAAA;AACT,mHAAA,gBAAgB,OAAA;AAChB,4GAAA,SAAS,OAAA;AACT,uHAAA,oBAAoB,OAAA;AAEtB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,mDAAyF;AAAhF,oHAAA,kBAAkB,OAAA;AAAE,gHAAA,cAAc,OAAA;AAAE,mHAAA,iBAAiB,OAAA;AAC9D,+DAKgC;AAJ9B,sHAAA,cAAc,OAAA;AACd,sHAAA,cAAc,OAAA;AACd,qHAAA,aAAa,OAAA;AACb,2HAAA,mBAAmB,OAAA;AAGrB,qDAAuE;AAA9D,oHAAA,iBAAiB,OAAA;AAAE,kHAAA,eAAe,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/targets/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAQH,qDAM2B;AALzB,iHAAA,cAAc,OAAA;AACd,4GAAA,SAAS,OAAA;AACT,mHAAA,gBAAgB,OAAA;AAChB,4GAAA,SAAS,OAAA;AACT,uHAAA,oBAAoB,OAAA;AAEtB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,mDAAyF;AAAhF,oHAAA,kBAAkB,OAAA;AAAE,gHAAA,cAAc,OAAA;AAAE,mHAAA,iBAAiB,OAAA;AAC9D,+DAKgC;AAJ9B,sHAAA,cAAc,OAAA;AACd,sHAAA,cAAc,OAAA;AACd,qHAAA,aAAa,OAAA;AACb,2HAAA,mBAAmB,OAAA;AAGrB,mDAAgF;AAAvE,sHAAA,oBAAoB,OAAA;AAAE,wHAAA,sBAAsB,OAAA;AAErD,qDAAuE;AAA9D,oHAAA,iBAAiB,OAAA;AAAE,kHAAA,eAAe,OAAA"}
|
|
@@ -21,6 +21,12 @@ export interface TargetCredentials {
|
|
|
21
21
|
apiKey: string;
|
|
22
22
|
model?: string;
|
|
23
23
|
provider?: 'anthropic' | 'openai' | 'generic-chat-completion-api';
|
|
24
|
+
/**
|
|
25
|
+
* Runtime reasoning/thinking override resolved from CCS flags/env
|
|
26
|
+
* (e.g. --thinking high, --effort xhigh, CCS_THINKING=medium).
|
|
27
|
+
* Targets may ignore this when unsupported.
|
|
28
|
+
*/
|
|
29
|
+
reasoningOverride?: string | number;
|
|
24
30
|
/** Additional env vars from profile resolution (websearch, hooks, etc.) */
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AiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAEzD;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;IAEhF;;;;;OAKG;IACH,IAAI,CACF,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;KAAE,GACxD,IAAI,CAAC;IAER;;OAEG;IACH,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC;CACxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target-resolver.d.ts","sourceRoot":"","sources":["../../src/targets/target-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"target-resolver.d.ts","sourceRoot":"","sources":["../../src/targets/target-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAgG9C;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EAAE,EACd,aAAa,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,GACtC,UAAU,CAyBZ;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAExD"}
|
|
@@ -61,9 +61,12 @@ function buildArgv0TargetMap() {
|
|
|
61
61
|
* Valid target types for --target flag validation.
|
|
62
62
|
*/
|
|
63
63
|
const VALID_TARGETS = new Set(['claude', 'droid']);
|
|
64
|
+
function isValidTarget(target) {
|
|
65
|
+
return typeof target === 'string' && VALID_TARGETS.has(target);
|
|
66
|
+
}
|
|
64
67
|
function normalizeTargetValue(value) {
|
|
65
68
|
const normalized = value.toLowerCase();
|
|
66
|
-
if (
|
|
69
|
+
if (isValidTarget(normalized)) {
|
|
67
70
|
return normalized;
|
|
68
71
|
}
|
|
69
72
|
const available = Array.from(VALID_TARGETS).join(', ');
|
|
@@ -119,8 +122,8 @@ function resolveTargetType(args, profileConfig) {
|
|
|
119
122
|
return parsed.targetOverride;
|
|
120
123
|
}
|
|
121
124
|
// 2. Check per-profile config
|
|
122
|
-
if (profileConfig?.target) {
|
|
123
|
-
return profileConfig.target;
|
|
125
|
+
if (profileConfig?.target !== undefined) {
|
|
126
|
+
return isValidTarget(profileConfig.target) ? profileConfig.target : 'claude';
|
|
124
127
|
}
|
|
125
128
|
// 3. Check argv[0] (busybox pattern)
|
|
126
129
|
// Strip common wrapper extensions for Windows shims/wrappers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target-resolver.js","sourceRoot":"","sources":["../../src/targets/target-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAG7B;;;GAGG;AACH,MAAM,gBAAgB,GAA+B;IACnD,IAAI,EAAE,OAAO;CACd,CAAC;AACF,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C,SAAS,mBAAmB;IAC1B,MAAM,GAAG,GAA+B,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAChE,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACpD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC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AAI,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1E,MAAM,cAAc,GAAG,mBAAmB,EAAE,CAAC;IAC7C,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,aAAa;IACb,OAAO,QAAQ,CAAC;AAClB,CAAC;AA5BD,8CA4BC;AAED;;;GAGG;AACH,SAAgB,eAAe,CAAC,IAAc;IAC5C,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;AAC5C,CAAC;AAFD,0CAEC"}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Source: ~/.ccs/config.json
|
|
4
4
|
*/
|
|
5
5
|
import type { CLIProxyProvider } from '../cliproxy/types';
|
|
6
|
+
import type { TargetType } from '../targets/target-adapter';
|
|
6
7
|
/**
|
|
7
8
|
* Profile configuration mapping
|
|
8
9
|
* Maps profile names to settings.json paths
|
|
@@ -24,6 +25,8 @@ export interface CLIProxyVariantConfig {
|
|
|
24
25
|
account?: string;
|
|
25
26
|
/** Unique port for variant isolation (8318-8417) */
|
|
26
27
|
port?: number;
|
|
28
|
+
/** Target CLI to use for this variant (default: claude) */
|
|
29
|
+
target?: TargetType;
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
32
|
* CLIProxy variants section in config.json
|
|
@@ -39,6 +42,8 @@ export interface CLIProxyVariantsConfig {
|
|
|
39
42
|
export interface Config {
|
|
40
43
|
/** Settings-based profiles (GLM, Kimi, etc.) */
|
|
41
44
|
profiles: ProfilesConfig;
|
|
45
|
+
/** Per-profile CLI target overrides (legacy mode) */
|
|
46
|
+
profile_targets?: Record<string, TargetType>;
|
|
42
47
|
/** User-defined CLIProxy profile variants (optional) */
|
|
43
48
|
cliproxy?: CLIProxyVariantsConfig;
|
|
44
49
|
}
|
|
@@ -82,6 +87,8 @@ export interface ProfileMetadata {
|
|
|
82
87
|
context_mode?: 'isolated' | 'shared';
|
|
83
88
|
/** Context-sharing group when context_mode='shared' */
|
|
84
89
|
context_group?: string;
|
|
90
|
+
/** Shared continuity depth when context_mode='shared' */
|
|
91
|
+
continuity_mode?: 'standard' | 'deeper';
|
|
85
92
|
}
|
|
86
93
|
export interface ProfilesRegistry {
|
|
87
94
|
profiles: Record<string, ProfileMetadata>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,CAAC,WAAW,EAAE,MAAM,GAAG,qBAAqB,CAAC;CAC9C;A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AI,MAAM,CAIpD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,QAAQ,CAMxD"}
|
package/dist/types/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAuGH;;GAEG;AACH,SAAgB,QAAQ,CAAC,GAAY;IACnC,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,UAAU,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,CACjG,CAAC;AACJ,CAAC;AAJD,4BAIC;AAED,SAAgB,UAAU,CAAC,GAAY;IACrC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC1D,IAAI,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,kBAAkB;IACpD,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAClE,sCAAsC;IACtC,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AACpE,CAAC;AAND,gCAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as f,h as je}from"./react-vendor-CNOkPC89.js";import{u as ye,a as L,b as z,d as be,f as B,g as Ne}from"./tanstack-e99Cjjy2.js";import{c as y,Y as _,a as G,a7 as oe,a8 as re,a9 as le,aa as ie,ab as de,L as P,r as I,s as Z,t as Q,v as V,w as O,I as q,ap as Ce,d as u,C as S,j as k,k as D,_ as M,B as F,b as w,M as ue,N as xe,O as me,n as ve,x as X}from"./index-hlYFfpDN.js";import{A as Pe,a as Ae,b as Se,c as ke,d as De,e as we,f as _e,g as Te}from"./alert-dialog-cRwDSggu.js";import{t as b}from"./notifications-B2HqRBj7.js";import{aE as Me,aF as Le,k as E,ah as ze,z as Ge,N as Oe,m as W,aG as Fe,am as H,aH as He,aI as Re,q as he,aJ as qe,aK as Ee,U as $e,a1 as J,Z as Y,T as Ke}from"./icons-kPbuhVdj.js";import{C as ee}from"./checkbox-BeoeEcEZ.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";function Ue({className:s,...a}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:y("w-full caption-bottom text-sm",s),...a})})}function Be({className:s,...a}){return e.jsx("thead",{"data-slot":"table-header",className:y("[&_tr]:border-b",s),...a})}function Ie({className:s,...a}){return e.jsx("tbody",{"data-slot":"table-body",className:y("[&_tr:last-child]:border-0",s),...a})}function te({className:s,...a}){return e.jsx("tr",{"data-slot":"table-row",className:y("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",s),...a})}function Ze({className:s,...a}){return e.jsx("th",{"data-slot":"table-head",className:y("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function Qe({className:s,...a}){return e.jsx("td",{"data-slot":"table-cell",className:y("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function Ve(){return ye({queryKey:["accounts"],queryFn:()=>_.accounts.list(),select:s=>{const a=s.accounts.filter(l=>l.type!=="cliproxy"),t=s.accounts.length-a.length,c=a.filter(l=>l.context_mode==="shared").length,o=a.filter(l=>l.context_mode==="shared"&&l.continuity_mode==="deeper").length,x=Math.max(c-o,0),i=a.length-c,m=a.filter(l=>l.context_inferred).length,g=a.filter(l=>l.context_mode==="shared"&&l.continuity_mode!=="deeper"&&l.continuity_inferred).length,p=a.some(l=>l.name===s.default)?s.default:null;return{accounts:a,default:p,cliproxyCount:t,legacyContextCount:m,legacyContinuityCount:g,sharedCount:c,sharedStandardCount:x,deeperSharedCount:o,isolatedCount:i}}})}function Xe(){const s=L();return z({mutationFn:a=>_.accounts.setDefault(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),b.success(`Default account set to "${t}"`)},onError:a=>{b.error(a.message)}})}function We(){const s=L();return z({mutationFn:()=>_.accounts.resetDefault(),onSuccess:()=>{s.invalidateQueries({queryKey:["accounts"]}),b.success("Default account reset to CCS")},onError:a=>{b.error(a.message)}})}function Je(){const s=L();return z({mutationFn:a=>_.accounts.delete(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),b.success(`Account "${t}" deleted`)},onError:a=>{b.error(a.message)}})}function ge(){const s=L();return z({mutationFn:({name:a,context_mode:t,context_group:c,continuity_mode:o})=>_.accounts.updateContext(a,{context_mode:t,context_group:c,continuity_mode:o}),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]});const c=t.context_mode==="shared"?t.continuity_mode==="deeper"?`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, deeper continuity)`:`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, standard)`:"isolated";b.success(`Updated "${t.name}" context to ${c}`)},onError:a=>{b.error(a.message)}})}function Ye(){const s=L();return z({mutationFn:async a=>{const t=a.filter(c=>c.context_inferred||c.continuity_inferred);for(const c of t){const o=c.context_mode==="shared";await _.accounts.updateContext(c.name,{context_mode:o?"shared":"isolated",context_group:o?c.context_group||"default":void 0,continuity_mode:o?c.continuity_mode==="deeper"?"deeper":"standard":void 0})}return{updatedCount:t.length}},onSuccess:({updatedCount:a})=>{if(s.invalidateQueries({queryKey:["accounts"]}),a>0){b.success(`Confirmed explicit sync mode for ${a} legacy account${a>1?"s":""}`);return}b.info("No legacy accounts need confirmation")},onError:a=>{b.error(a.message)}})}const se=64,et=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function tt({account:s,onClose:a}){const{t}=G(),c=ge(),[o,x]=f.useState(s.context_mode==="shared"?"shared":"isolated"),[i,m]=f.useState(s.context_group||"default"),[g,p]=f.useState(s.continuity_mode==="deeper"?"deeper":"standard"),l=f.useMemo(()=>i.trim().toLowerCase().replace(/\s+/g,"-"),[i]),N=l.length>0&&l.length<=se&&et.test(l),j=o==="isolated"||N,n=()=>{j&&c.mutate({name:s.name,context_mode:o,context_group:o==="shared"?l:void 0,continuity_mode:o==="shared"?g:void 0},{onSuccess:()=>{a()}})},r=d=>{d||a()};return e.jsx(oe,{open:!0,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(ie,{children:t("editAccountContext.title")}),e.jsx(de,{children:t("editAccountContext.description",{name:s.name})})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"context-mode",children:t("editAccountContext.syncMode")}),e.jsxs(I,{value:o,onValueChange:d=>x(d),children:[e.jsx(Z,{id:"context-mode",children:e.jsx(Q,{placeholder:t("editAccountContext.selectContextMode")})}),e.jsxs(V,{children:[e.jsx(O,{value:"isolated",children:t("editAccountContext.isolatedOption")}),e.jsx(O,{value:"shared",children:t("editAccountContext.sharedOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(o==="shared"?"editAccountContext.sharedModeHint":"editAccountContext.isolatedModeHint")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"context-group",children:t("editAccountContext.historySyncGroup")}),e.jsx(q,{id:"context-group",value:i,onChange:d=>m(d.target.value),placeholder:t("editAccountContext.groupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.groupHint",{max:se})}),!N&&e.jsx("p",{className:"text-xs text-destructive",children:t("editAccountContext.invalidGroup")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"continuity-mode",children:t("editAccountContext.continuityDepth")}),e.jsxs(I,{value:g,onValueChange:d=>p(d),children:[e.jsx(Z,{id:"continuity-mode",children:e.jsx(Q,{placeholder:t("editAccountContext.selectContinuityDepth")})}),e.jsxs(V,{children:[e.jsx(O,{value:"standard",children:t("editAccountContext.standardOption")}),e.jsx(O,{value:"deeper",children:t("editAccountContext.deeperOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(g==="deeper"?"editAccountContext.deeperHint":"editAccountContext.standardHint")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.credentialsIsolated")})]}),e.jsxs(Ce,{children:[e.jsx(u,{variant:"outline",onClick:a,disabled:c.isPending,children:t("editAccountContext.cancel")}),e.jsx(u,{onClick:n,disabled:!j||c.isPending,children:c.isPending?t("editAccountContext.saving"):t("editAccountContext.save")})]})]})})}function ae({data:s,defaultAccount:a}){const{t}=G(),c=Xe(),o=Je(),x=We(),i=ge(),[m,g]=f.useState(null),[p,l]=f.useState(null),N=[{accessorKey:"name",header:t("accountsTable.name"),size:200,cell:({row:n})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.original.name}),n.original.name===a&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:t("accountsTable.defaultBadge")})]})},{accessorKey:"type",header:t("accountsTable.type"),size:100,cell:({row:n})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:n.original.type||"oauth"})},{accessorKey:"created",header:t("accountsTable.created"),size:150,cell:({row:n})=>{const r=new Date(n.original.created);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{accessorKey:"last_used",header:t("accountsTable.lastUsed"),size:150,cell:({row:n})=>{if(!n.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const r=new Date(n.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{id:"context",header:t("accountsTable.historySync"),size:170,cell:({row:n})=>{if(n.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((n.original.context_mode||"isolated")==="shared"){const d=n.original.context_group||"default";return n.original.continuity_mode==="deeper"?e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupDeeper",{group:d})}):n.original.continuity_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.sharedGroupLegacy",{group:d})}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupStandard",{group:d})})}return n.original.context_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.isolatedLegacy")}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.isolated")})}},{id:"actions",header:t("accountsTable.actions"),size:220,cell:({row:n})=>{const r=n.original.name===a,d=c.isPending||o.isPending||i.isPending,C=n.original.type==="cliproxy",A=n.original.context_inferred||n.original.continuity_inferred;return e.jsxs("div",{className:"flex items-center gap-1",children:[!C&&e.jsxs(u,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:d,onClick:()=>l(n.original),title:t("accountsTable.syncTitle"),children:[e.jsx(Me,{className:"w-3.5 h-3.5 mr-1"}),t("accountsTable.sync")]}),!C&&A&&e.jsxs(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-700 hover:text-amber-700 hover:bg-amber-500/10 dark:text-amber-400 dark:hover:text-amber-400",disabled:d,onClick:()=>i.mutate({name:n.original.name,context_mode:n.original.context_mode==="shared"?"shared":"isolated",context_group:n.original.context_mode==="shared"?n.original.context_group||"default":void 0,continuity_mode:n.original.context_mode==="shared"?n.original.continuity_mode==="deeper"?"deeper":"standard":void 0}),title:t("accountsTable.confirmLegacyTitle"),children:[e.jsx(Le,{className:"w-3 h-3 mr-1"}),t("accountsTable.confirm")]}),e.jsxs(u,{variant:r?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:r||d,onClick:()=>c.mutate(n.original.name),children:[e.jsx(E,{className:`w-3 h-3 mr-1 ${r?"opacity-50":""}`}),t(r?"accountsTable.active":"accountsTable.setDefault")]}),e.jsx(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:r||d,onClick:()=>g(n.original.name),title:t(r?"accountsTable.cannotDeleteDefault":"accountsTable.deleteAccount"),children:e.jsx(ze,{className:"w-4 h-4"})})]})}}],j=be({data:s,columns:N,getCoreRowModel:Ne()});return s.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:t("accountsTable.noAccounts")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(Ue,{children:[e.jsx(Be,{children:j.getHeaderGroups().map(n=>e.jsx(te,{children:n.headers.map(r=>{const d={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",context:"w-[170px]",actions:"w-[290px]"}[r.id]||"w-auto";return e.jsx(Ze,{className:d,children:r.isPlaceholder?null:B(r.column.columnDef.header,r.getContext())},r.id)})},n.id))}),e.jsx(Ie,{children:j.getRowModel().rows.map(n=>e.jsx(te,{children:n.getVisibleCells().map(r=>e.jsx(Qe,{children:B(r.column.columnDef.cell,r.getContext())},r.id))},n.id))})]})}),a&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>x.mutate(),disabled:x.isPending,children:[e.jsx(Ge,{className:"w-4 h-4 mr-2"}),t("accountsTable.resetToDefault")]})})]}),p&&e.jsx(tt,{account:p,onClose:()=>l(null)}),e.jsx(Pe,{open:!!m,onOpenChange:n=>!n&&g(null),children:e.jsxs(Ae,{children:[e.jsxs(Se,{children:[e.jsx(ke,{children:t("accountsTable.deleteDialogTitle")}),e.jsx(De,{children:t("accountsTable.deleteDialogDesc",{name:m??""})})]}),e.jsxs(we,{children:[e.jsx(_e,{children:t("accountsTable.cancel")}),e.jsx(Te,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{m&&(o.mutate(m),g(null))},children:t("accountsTable.delete")})]})]})})]})}const ne=64;function st({open:s,onClose:a}){const{t}=G(),[c,o]=f.useState(""),[x,i]=f.useState(!1),[m,g]=f.useState(""),[p,l]=f.useState(!1),[N,j]=f.useState(!1),n=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(c),r=m.trim().toLowerCase().replace(/\s+/g,"-"),d=r.length===0||r.length<=ne&&/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(r),C=c&&n?[`ccs auth create ${c}`,x?r.length>0?`--context-group ${r}`:"--share-context":"",x&&p?"--deeper-continuity":""].filter(Boolean).join(" "):t("createAuthProfileDialog.commandFallback"),A=async()=>{!n||x&&!d||(await navigator.clipboard.writeText(C),j(!0),setTimeout(()=>j(!1),2e3))},T=()=>{o(""),i(!1),g(""),l(!1),j(!1),a()};return e.jsx(oe,{open:s,onOpenChange:h=>!h&&T(),children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(ie,{children:t("createAuthProfileDialog.title")}),e.jsx(de,{children:t("createAuthProfileDialog.description")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-name",children:t("createAuthProfileDialog.profileName")}),e.jsx(q,{id:"profile-name",value:c,onChange:h=>o(h.target.value),placeholder:t("createAuthProfileDialog.profileNamePlaceholder"),autoComplete:"off"}),c&&!n&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidProfileName")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{id:"share-context",checked:x,onCheckedChange:h=>i(h===!0)}),e.jsx(P,{htmlFor:"share-context",className:"cursor-pointer",children:t("createAuthProfileDialog.enableSharedHistory")})]}),x&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(P,{htmlFor:"context-group",children:t("createAuthProfileDialog.historySyncGroupOptional")}),e.jsx(q,{id:"context-group",value:m,onChange:h=>g(h.target.value),placeholder:t("createAuthProfileDialog.historySyncGroupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.historySyncGroupHint")}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(ee,{id:"deeper-continuity",checked:p,onCheckedChange:h=>l(h===!0)}),e.jsx(P,{htmlFor:"deeper-continuity",className:"cursor-pointer",children:t("createAuthProfileDialog.deeperContinuity")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.deeperContinuityHint")}),m.trim().length>0&&!d&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidContextGroup",{max:ne})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{children:t("createAuthProfileDialog.command")}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(Oe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:C}),e.jsx(u,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:A,disabled:!n||x&&!d,children:N?e.jsx(E,{className:"w-4 h-4 text-green-500"}):e.jsx(W,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:t("createAuthProfileDialog.afterRunPrefix")}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep1")}),e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep2")})]}),e.jsx("p",{className:"pt-1",children:t("createAuthProfileDialog.poolingHint")})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{variant:"ghost",onClick:T,children:t("createAuthProfileDialog.close")}),e.jsx(u,{onClick:A,disabled:!n||x&&!d,children:N?e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copyCommand")]})})]})]})]})})}function R({title:s,count:a,icon:t,tone:c}){const o={isolated:{border:"border-blue-300/60 bg-blue-50/40 dark:border-blue-900/40 dark:bg-blue-900/10",icon:"text-blue-700 dark:text-blue-400",count:"text-blue-700 dark:text-blue-400"},shared:{border:"border-emerald-300/60 bg-emerald-50/40 dark:border-emerald-900/40 dark:bg-emerald-900/10",icon:"text-emerald-700 dark:text-emerald-400",count:"text-emerald-700 dark:text-emerald-400"},deeper:{border:"border-indigo-300/60 bg-indigo-50/40 dark:border-indigo-900/40 dark:bg-indigo-900/10",icon:"text-indigo-700 dark:text-indigo-400",count:"text-indigo-700 dark:text-indigo-400"}};return e.jsxs("div",{className:y("rounded-md border p-2.5",o[c].border),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs font-semibold",children:s}),e.jsx(t,{className:y("h-3.5 w-3.5",o[c].icon)})]}),e.jsx("p",{className:y("mt-1 text-lg font-mono font-semibold",o[c].count),children:a})]})}function ce({isolatedCount:s,sharedStandardCount:a,deeperSharedCount:t,sharedGroups:c,legacyTargetCount:o,cliproxyCount:x}){const{t:i}=G(),[m,g]=f.useState(!1),p=c.length>0?c:["default"];return e.jsxs(S,{className:"border-dashed",children:[e.jsx(k,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(D,{className:"text-base",children:i("historySyncLearningMap.title")}),e.jsx(M,{className:"mt-1",children:i("historySyncLearningMap.description")})]}),e.jsx(F,{variant:"outline",children:i("historySyncLearningMap.learningMap")})]})}),e.jsxs(w,{className:"space-y-3",children:[x>0&&e.jsx("div",{className:"rounded-md border border-blue-300/60 bg-blue-50/40 px-3 py-2 text-xs text-blue-800 dark:border-blue-900/40 dark:bg-blue-900/10 dark:text-blue-300",children:i("historySyncLearningMap.cliproxyManaged",{count:x})}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto_1fr_auto_1fr] sm:items-center",children:[e.jsx(R,{title:i("historySyncLearningMap.isolated"),count:s,icon:Fe,tone:"isolated"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(H,{className:"h-4 w-4"})}),e.jsx(R,{title:i("historySyncLearningMap.shared"),count:a,icon:He,tone:"shared"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(H,{className:"h-4 w-4"})}),e.jsx(R,{title:i("historySyncLearningMap.deeper"),count:t,icon:Re,tone:"deeper"})]}),e.jsxs(ue,{open:m,onOpenChange:g,children:[e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-8 w-full justify-between rounded-md px-2 text-xs text-muted-foreground hover:bg-muted/40 hover:text-foreground",children:[e.jsx("span",{children:i("historySyncLearningMap.showDetails")}),e.jsx(he,{className:y("h-4 w-4 transition-transform",m&&"rotate-180")})]})}),e.jsxs(me,{className:"pt-2",children:[e.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:i("historySyncLearningMap.modeSwitch")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:i("historySyncLearningMap.modeSwitchDesc")})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:i("historySyncLearningMap.historySyncGroup")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:i("historySyncLearningMap.historySyncGroupDesc")}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:p.map(l=>e.jsx(F,{variant:"outline",className:"font-mono text-[10px]",children:l},l))})]})]}),o>0&&e.jsxs("div",{className:"mt-2 rounded-md border border-amber-500/50 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-300",children:[o," legacy account",o>1?"s still need":" still needs"," explicit confirmation."]})]})]})]})]})}function ht(){const{t:s}=G(),a=je(),{data:t,isLoading:c}=Ve(),o=Ye(),[x,i]=f.useState(!1),[m,g]=f.useState(!1),p=t?.accounts||[],l=t?.cliproxyCount||0,N=t?.legacyContextCount||0,j=t?.legacyContinuityCount||0,n=t?.sharedCount||0,r=t?.sharedStandardCount||0,d=t?.deeperSharedCount||0,C=t?.isolatedCount||0,A=Array.from(new Set(p.filter(v=>v.context_mode==="shared").map(v=>v.context_group||"default"))).sort((v,fe)=>v.localeCompare(fe)),T=p.filter(v=>v.context_inferred||v.continuity_inferred),h=T.length,pe=h>0,$=()=>a("/cliproxy?provider=claude"),K=()=>a("/cliproxy?provider=claude&action=auth"),U=()=>o.mutate(T);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-[calc(100vh-100px)] hidden lg:flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/20 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("accountsPage.title")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.manageSuffix")]})]}),e.jsx(ve,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.primaryActions")}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:()=>i(!0),children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:K,children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),s("accountsPage.authClaudeInPool")]}),e.jsxs(u,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:$,children:[s("accountsPage.openClaudePoolSettings"),e.jsx(H,{className:"w-4 h-4 ml-auto"})]})]}),pe?e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.migrationFollowup")}),e.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ke,{className:"h-4 w-4 mt-0.5 text-amber-700 dark:text-amber-400 shrink-0"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[N>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContextPending",{count:N})}),j>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContinuityPending",{count:j})})]})]}),e.jsx(u,{variant:"secondary",size:"sm",className:"w-full justify-start",onClick:U,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}):e.jsx("div",{className:"rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground",children:s("accountsPage.noLegacyFollowup")}),e.jsx(ue,{open:m,onOpenChange:g,children:e.jsxs(S,{children:[e.jsx(k,{className:"pb-2",children:e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-auto w-full justify-between px-0 py-0",children:[e.jsxs("div",{className:"text-left",children:[e.jsx(D,{className:"text-sm",children:s("accountsPage.continuityGuide")}),e.jsx(M,{className:"mt-1",children:s("accountsPage.expandWhenNeeded")})]}),e.jsx(he,{className:y("h-4 w-4 transition-transform",m&&"rotate-180")})]})})}),e.jsx(me,{children:e.jsxs(w,{className:"space-y-3 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedStandard")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.sharedStandardDesc")})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedDeeper")}),e.jsxs("p",{className:"mt-1",children:[s("accountsPage.sharedDeeperPrefix")," ",e.jsx("code",{children:"session-env"}),","," ",e.jsx("code",{children:"file-history"}),", ",e.jsx("code",{children:"shell-snapshots"}),","," ",e.jsx("code",{children:"todos"}),"."]})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.isolated")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.isolatedDesc")})]})]})})]})}),e.jsxs(S,{children:[e.jsxs(k,{className:"pb-2",children:[e.jsx(D,{className:"text-sm",children:s("accountsPage.quickCommands")}),e.jsx(M,{children:s("accountsPage.quickCommandsDesc")})]}),e.jsxs(w,{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth create work --context-group sprint-a --deeper-continuity"}),e.jsx(X,{value:"ccs auth create work --context-group sprint-a --deeper-continuity",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs cliproxy auth claude"}),e.jsx(X,{value:"ccs cliproxy auth claude",size:"icon"})]})]})]})]})})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col bg-background",children:[e.jsxs("div",{className:"px-5 py-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{variant:"outline",children:s("accountsPage.workspaceBadge")}),e.jsx(F,{variant:"secondary",children:s("accountsPage.historySyncBadge")})]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:s("accountsPage.authAccounts")}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[s("accountsPage.tableScopePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.tableScopeMiddle"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"Sync"}),s("accountsPage.tableScopeSuffix")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 p-5 space-y-4 overflow-y-auto",children:[e.jsx(ce,{isolatedCount:C,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:A,legacyTargetCount:h,cliproxyCount:l}),e.jsxs(S,{className:"flex flex-col",children:[e.jsxs(k,{className:"pb-3",children:[e.jsx(D,{className:"text-lg",children:s("accountsPage.accountMatrix")}),e.jsx(M,{children:s("accountsPage.sharedTotalDesc",{count:n})})]}),e.jsx(w,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4 lg:hidden",children:[e.jsxs(S,{children:[e.jsxs(k,{children:[e.jsx(D,{className:"text-lg",children:s("accountsPage.title")}),e.jsxs(M,{children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.mobileManageSuffix")]})]}),e.jsxs(w,{className:"space-y-2",children:[e.jsxs(u,{className:"w-full",onClick:()=>i(!0),children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:$,children:[s("accountsPage.openCliProxyClaudePool"),e.jsx(H,{className:"w-4 h-4 ml-2"})]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:K,children:[s("accountsPage.authClaudeInPool"),e.jsx(Y,{className:"w-4 h-4 ml-2"})]}),e.jsx(u,{variant:"outline",className:"w-full",onClick:U,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}),e.jsx(ce,{isolatedCount:C,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:A,legacyTargetCount:h,cliproxyCount:l}),e.jsxs(S,{children:[e.jsx(k,{className:"pb-3",children:e.jsx(D,{className:"text-base",children:s("accountsPage.accountMatrix")})}),e.jsx(w,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]}),e.jsx(st,{open:x,onClose:()=>i(!1)})]})}export{ht as AccountsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,a4 as s,a5 as r,a6 as n,a7 as i,a8 as d,a9 as c,aa as u,ab as f}from"./radix-ui-
|
|
1
|
+
import{j as e,a4 as s,a5 as r,a6 as n,a7 as i,a8 as d,a9 as c,aa as u,ab as f}from"./radix-ui-BR1vy4kf.js";import"./react-vendor-CNOkPC89.js";import{c as o,bw as l}from"./index-hlYFfpDN.js";function A({...a}){return e.jsx(s,{"data-slot":"alert-dialog",...a})}function g({...a}){return e.jsx(u,{"data-slot":"alert-dialog-portal",...a})}function m({className:a,...t}){return e.jsx(f,{"data-slot":"alert-dialog-overlay",className:o("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",a),...t})}function D({className:a,...t}){return e.jsxs(g,{children:[e.jsx(m,{}),e.jsx(r,{"data-slot":"alert-dialog-content",className:o("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",a),...t})]})}function b({className:a,...t}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:o("flex flex-col gap-2 text-center sm:text-left",a),...t})}function N({className:a,...t}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:o("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...t})}function v({className:a,...t}){return e.jsx(n,{"data-slot":"alert-dialog-title",className:o("text-lg font-semibold",a),...t})}function w({className:a,...t}){return e.jsx(i,{"data-slot":"alert-dialog-description",className:o("text-muted-foreground text-sm",a),...t})}function y({className:a,...t}){return e.jsx(c,{className:o(l(),a),...t})}function z({className:a,...t}){return e.jsx(d,{className:o(l({variant:"outline"}),a),...t})}export{A,D as a,b,v as c,w as d,N as e,z as f,y as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as x}from"./react-vendor-CNOkPC89.js";import{B as A,c as P,T as Oe,p as ke,q as Pe,r as Se,s as _e,t as Ae,v as Me,w as ae,d as v,I as k,a as H,n as J,L as O,x as R,y as me,z as Re,A as De,D as Le,E as Ie,S as re,F,G as X,H as ue,J as He,K as Ue,M as he,N as pe,O as fe,Q as Fe,R as Ke,U as ne,V as ie,W as K,X as ze,Y as $e,Z as ee,C as Je,j as Qe,k as Be,_ as qe,b as Ve,$ as Ye,a0 as Ge,a1 as We,a2 as Xe}from"./index-hlYFfpDN.js";import{a as Ze,u as es,b as le}from"./tanstack-e99Cjjy2.js";import{C as Z}from"./confirm-dialog-COTT5ztZ.js";import{t as I}from"./notifications-B2HqRBj7.js";import{L as z,R as Q,ah as ge,ai as ss,E as ts,e as as,a1 as $,J as rs,aj as je,a2 as se,C as Ne,ak as ns,a0 as is,al as ls,n as ve,X as cs,Z as be,am as os,a5 as ds,a3 as we,an as xs,u as Ce}from"./icons-kPbuhVdj.js";import{S as ce}from"./separator-CjXUYlSy.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-cRwDSggu.js";function ms({className:s,showTooltip:r=!0}){const t=e.jsxs(A,{variant:"outline",className:P("bg-accent/10 border-accent/30 text-accent","dark:bg-accent/20 dark:border-accent/40 dark:text-accent-foreground",s),children:[e.jsx("img",{src:"/icons/openrouter.svg",alt:"OpenRouter",className:"mr-1 h-3 w-3"}),"OpenRouter"]});return r?e.jsxs(Oe,{children:[e.jsx(ke,{asChild:!0,children:t}),e.jsx(Pe,{children:e.jsx("p",{children:"Access 349+ models via OpenRouter"})})]}):t}function oe(s){return[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/^API_KEY$/,/^AUTH_TOKEN$/,/_SECRET$/,/^SECRET$/].some(t=>t.test(s))}function ye(s){return s?.env?(s.env.ANTHROPIC_BASE_URL||"").toLowerCase().includes("openrouter.ai"):!1}function us(s){return{opus:s.ANTHROPIC_DEFAULT_OPUS_MODEL||void 0,sonnet:s.ANTHROPIC_DEFAULT_SONNET_MODEL||void 0,haiku:s.ANTHROPIC_DEFAULT_HAIKU_MODEL||void 0}}function hs(s,r){const t={...s};return r.opus?t.ANTHROPIC_DEFAULT_OPUS_MODEL=r.opus:delete t.ANTHROPIC_DEFAULT_OPUS_MODEL,r.sonnet?t.ANTHROPIC_DEFAULT_SONNET_MODEL=r.sonnet:delete t.ANTHROPIC_DEFAULT_SONNET_MODEL,r.haiku?t.ANTHROPIC_DEFAULT_HAIKU_MODEL=r.haiku:delete t.ANTHROPIC_DEFAULT_HAIKU_MODEL,t}function ps({profileName:s,target:r,data:t,settings:c,isLoading:i,isSaving:f,isTargetSaving:m,hasChanges:p,isRawJsonValid:a,onTargetChange:j,onRefresh:u,onDelete:N,onSave:T}){const w=f||m,g=i||w;return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s}),t?.path&&e.jsx(A,{variant:"outline",className:"text-xs",children:t.path.replace(/^.*\//,"")}),ye(c)&&e.jsx(ms,{className:"ml-1"})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(t.mtime).toLocaleString()]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Default target:"}),e.jsxs(Se,{value:r,onValueChange:b=>{g||j(b)},disabled:g,children:[e.jsx(_e,{className:"h-7 w-[170px] text-xs",disabled:g,children:e.jsx(Ae,{})}),e.jsxs(Me,{children:[e.jsx(ae,{value:"claude",children:"Claude Code"}),e.jsx(ae,{value:"droid",children:"Factory Droid"})]})]}),m&&e.jsx(z,{className:"w-3.5 h-3.5 animate-spin text-muted-foreground"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:u,disabled:g,children:e.jsx(Q,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),N&&e.jsx(v,{variant:"ghost",size:"sm",onClick:N,disabled:w,children:e.jsx(ge,{className:"w-4 h-4 text-destructive"})}),e.jsx(v,{size:"sm",onClick:T,disabled:w||!p||!a,children:f?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function Te({label:s,...r}){const[t,c]=x.useState(!1);return e.jsxs("div",{className:"space-y-1",children:[s&&e.jsx("label",{className:"text-sm font-medium",children:s}),e.jsxs("div",{className:"relative",children:[e.jsx(k,{type:t?"text":"password",className:"pr-10 font-mono",...r}),e.jsx(v,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>c(!t),tabIndex:-1,children:t?e.jsx(ts,{className:"w-4 h-4"}):e.jsx(as,{className:"w-4 h-4"})})]})]})}function fs({currentSettings:s,newEnvKey:r,newEnvValue:t,onNewEnvKeyChange:c,onNewEnvValueChange:i,onEnvValueChange:f,onAddEnvVar:m}){const{t:p}=H();return e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-4",children:s?.env&&Object.keys(s.env).length>0?e.jsx(e.Fragment,{children:Object.entries(s.env).map(([a,j])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(O,{className:"text-xs font-medium flex items-center gap-2 text-muted-foreground",children:[a,oe(a)&&e.jsx(A,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:p("envEditor.sensitive")})]}),oe(a)?e.jsx(Te,{value:j,onChange:u=>f(a,u.target.value),className:"font-mono text-sm h-8"}):e.jsx(k,{value:j,onChange:u=>f(a,u.target.value),className:"font-mono text-sm h-8"})]},a))}):e.jsxs("div",{className:"py-8 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed text-sm",children:[e.jsx("p",{children:p("envEditor.none")}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:p("envEditor.noneHint")})]})})}),e.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[e.jsx(O,{className:"text-xs font-medium text-muted-foreground",children:p("envEditor.addVariable")}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(k,{placeholder:p("envEditor.keyPlaceholder"),value:r,onChange:a=>c(a.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:a=>a.key==="Enter"&&r.trim()&&m()}),e.jsx(k,{placeholder:p("envEditor.valuePlaceholder"),value:t,onChange:a=>i(a.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:a=>a.key==="Enter"&&r.trim()&&m()}),e.jsx(v,{variant:"outline",size:"sm",className:"h-8",onClick:m,disabled:!r.trim(),children:e.jsx($,{className:"w-4 h-4"})})]})]})]})}function gs({profileName:s,target:r,data:t}){const{t:c}=H(),i=r==="droid";return e.jsx(J,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(rs,{className:"w-4 h-4"}),c("profileEditor.profileInfo")]}),e.jsx("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:c("profileEditor.profileName")}),e.jsx("span",{className:"font-mono",children:t.profile})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:c("profileEditor.filePath")}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:t.path}),e.jsx(R,{value:t.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:c("profileEditor.lastModified")}),e.jsx("span",{className:"text-xs",children:new Date(t.mtime).toLocaleString()})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:c("profileEditor.defaultTarget")}),e.jsx("span",{className:"font-mono",children:r})]})]})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:c("profileEditor.quickUsage")}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{children:[e.jsx(O,{className:"text-xs text-muted-foreground",children:c("profileEditor.runWithProfile")}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs ",s,' "prompt"']}),e.jsx(R,{value:`ccs ${s} "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(O,{className:"text-xs text-muted-foreground",children:c(i?"profileEditor.droidAliasExplicit":"profileEditor.runOnDroid")}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:i?`ccsd ${s} "prompt"`:`ccs ${s} --target droid "prompt"`}),e.jsx(R,{value:i?`ccsd ${s} "prompt"`:`ccs ${s} --target droid "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(O,{className:"text-xs text-muted-foreground",children:c(i?"profileEditor.overrideToClaude":"profileEditor.overrideToClaudeExplicit")}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs ",s,' --target claude "prompt"']}),e.jsx(R,{value:`ccs ${s} --target claude "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(O,{className:"text-xs text-muted-foreground",children:c("profileEditor.setAsDefault")}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs default ",s]}),e.jsx(R,{value:`ccs default ${s}`,size:"icon",className:"h-6 w-6"})]})]})]})]})]})})}function js({value:s,onChange:r,placeholder:t="Search models...",className:c}){const[i,f]=x.useState(""),[m,p]=x.useState(null),{models:a,isLoading:j,isError:u,isFetching:N}=me(),T=Re(),w=x.useMemo(()=>De(a,i,{category:m??void 0}),[a,i,m]),g=x.useMemo(()=>Le(a,2),[a]),b=!i.trim()&&!m,S=x.useMemo(()=>{const l={anthropic:[],openai:[],google:[],meta:[],mistral:[],opensource:[],other:[]};w.forEach(o=>{l[o.category].push(o)});for(const o of Object.keys(l))l[o]=Ie(l[o]);return l},[w]),_=x.useCallback(()=>{T()},[T]),y=a.find(l=>l.id===s);return j&&a.length===0?e.jsxs("div",{className:P("space-y-2",c),children:[e.jsx(re,{className:"h-10 w-full"}),e.jsx(re,{className:"h-32 w-full"})]}):e.jsxs("div",{className:P("space-y-2 w-full min-w-0 overflow-hidden",c),children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(je,{className:"text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2"}),e.jsx(k,{value:i,onChange:l=>f(l.target.value),placeholder:t,className:"pl-9"})]}),e.jsx(v,{variant:"outline",size:"icon",onClick:_,disabled:N,title:"Refresh models",children:N?e.jsx(z,{className:"h-4 w-4 animate-spin"}):e.jsx(Q,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs(A,{variant:m===null?"default":"outline",className:"cursor-pointer",onClick:()=>p(null),children:["All (",a.length,")"]}),Object.keys(F).map(l=>{const o=S[l].length;return o===0?null:e.jsxs(A,{variant:m===l?"default":"outline",className:"cursor-pointer",onClick:()=>p(l),children:[F[l]," (",o,")"]},l)})]}),y&&e.jsxs("div",{className:"bg-muted rounded-md p-2 text-sm",children:[e.jsx("span",{className:"font-medium",children:y.name}),e.jsxs("span",{className:"text-muted-foreground ml-2",children:[X(y.pricing)," |"," ",ue(y.context_length)]})]}),e.jsx(J,{className:"h-72 w-full rounded-md border",children:u?e.jsxs("div",{className:"text-destructive p-4 text-center",children:["Failed to load models."," ",e.jsx(v,{variant:"link",onClick:_,children:"Retry"})]}):w.length===0?e.jsxs("div",{className:"text-muted-foreground p-4 text-center",children:['No models found matching "',i,'"']}):e.jsxs("div",{className:"space-y-6 p-3",children:[b&&g.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"text-muted-foreground bg-background sticky top-0 mb-2 flex items-center gap-1.5 py-1.5 text-xs font-semibold border-b pb-2",children:[e.jsx(se,{className:"h-3 w-3 text-accent"}),e.jsx("span",{children:"Newest Models"})]}),e.jsx("div",{className:"space-y-1",children:g.map(l=>e.jsx(de,{model:l,isSelected:l.id===s,onClick:()=>r(l.id),showAge:!0},l.id))})]}),Object.keys(F).map(l=>{const o=S[l];return o.length===0?null:e.jsxs("div",{children:[e.jsx("div",{className:"text-muted-foreground bg-background sticky top-0 mb-2 py-1.5 text-xs font-semibold border-b pb-2",children:F[l]}),e.jsx("div",{className:"space-y-1",children:o.map(n=>e.jsx(de,{model:n,isSelected:n.id===s,onClick:()=>r(n.id)},n.id))})]},l)})]})})]})}function de({model:s,isSelected:r,onClick:t,showAge:c=!1}){return e.jsxs("button",{type:"button",onClick:t,className:P("group flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors","hover:bg-accent hover:text-accent-foreground",r&&"bg-accent text-accent-foreground"),children:[e.jsx("span",{className:"flex-1 min-w-0 truncate font-medium",children:s.name}),e.jsxs("span",{className:P("flex shrink-0 items-center gap-1 text-xs whitespace-nowrap",r?"text-accent-foreground/80":"text-muted-foreground group-hover:text-accent-foreground/80"),children:[c&&s.created&&e.jsx(A,{variant:"outline",className:P("text-[10px] px-1",r?"border-accent-foreground/30 text-accent-foreground/80":"text-accent border-accent/30 group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30"),children:He(s.created)}),s.isFree?e.jsx(A,{variant:"secondary",className:P("text-[10px] px-1",r?"bg-accent-foreground/20 text-accent-foreground":"group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground"),children:"Free"}):s.isExacto?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outline",className:P("text-[10px] px-1 border-emerald-500/50 text-emerald-600",r?"border-accent-foreground/30 text-accent-foreground/80":"group-hover:border-accent-foreground/30 group-hover:text-accent-foreground/80"),children:"Exacto"}),e.jsx("span",{className:"tabular-nums",children:X(s.pricing)})]}):e.jsx("span",{className:"tabular-nums",children:X(s.pricing)}),e.jsx("span",{className:"tabular-nums",children:ue(s.context_length)})]})]})}function Ns({selectedModel:s,value:r,onChange:t,className:c}){const{t:i}=H(),{models:f}=me(),m=x.useMemo(()=>s?Ue(s,f):{},[s,f]),p=()=>{t(m)},a=(u,N)=>{t({...r,[u]:N||void 0})},j=s&&Object.keys(m).length>0;return e.jsxs(he,{className:P("group",c),children:[e.jsxs(pe,{className:"flex items-center gap-2 text-sm font-medium hover:underline",children:[e.jsx(Ne,{className:"h-4 w-4 transition-transform group-data-[state=open]:rotate-90"}),i("modelTierMapping.title"),e.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",i("modelTierMapping.advanced"),")"]})]}),e.jsxs(fe,{className:"space-y-3 pt-3",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:i("modelTierMapping.description")}),j&&e.jsxs(v,{type:"button",variant:"outline",size:"sm",onClick:p,children:[e.jsx(ns,{className:"mr-1 h-4 w-4"}),i("modelTierMapping.autoSuggest",{provider:s?.split("/")[0]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(O,{htmlFor:"tier-opus",className:"text-right",children:"Opus"}),e.jsx(k,{id:"tier-opus",value:r.opus??"",onChange:u=>a("opus",u.target.value),placeholder:i("modelTierMapping.opusPlaceholder")})]}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(O,{htmlFor:"tier-sonnet",className:"text-right",children:"Sonnet"}),e.jsx(k,{id:"tier-sonnet",value:r.sonnet??"",onChange:u=>a("sonnet",u.target.value),placeholder:i("modelTierMapping.sonnetPlaceholder")})]}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(O,{htmlFor:"tier-haiku",className:"text-right",children:"Haiku"}),e.jsx(k,{id:"tier-haiku",value:r.haiku??"",onChange:u=>a("haiku",u.target.value),placeholder:i("modelTierMapping.haikuPlaceholder")})]})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i("modelTierMapping.footer")})]})]})}function vs({profileName:s,target:r,data:t,currentSettings:c,newEnvKey:i,newEnvValue:f,onNewEnvKeyChange:m,onNewEnvValueChange:p,onEnvValueChange:a,onAddEnvVar:j,onEnvBulkChange:u}){const N=ye(c),T=c?.env,w=x.useMemo(()=>us(T??{}),[T]),g=T??{},b=n=>{if(u){const E={...g,ANTHROPIC_MODEL:n,ANTHROPIC_DEFAULT_OPUS_MODEL:n,ANTHROPIC_DEFAULT_SONNET_MODEL:n,ANTHROPIC_DEFAULT_HAIKU_MODEL:n};u(E)}else a("ANTHROPIC_MODEL",n),a("ANTHROPIC_DEFAULT_OPUS_MODEL",n),a("ANTHROPIC_DEFAULT_SONNET_MODEL",n),a("ANTHROPIC_DEFAULT_HAIKU_MODEL",n);I.success(K.t("commonToast.appliedModelAllTiers"),{duration:2e3})},S=n=>{if(u){const E=hs(g,n);u(E)}else n.opus!==void 0&&a("ANTHROPIC_DEFAULT_OPUS_MODEL",n.opus||""),n.sonnet!==void 0&&a("ANTHROPIC_DEFAULT_SONNET_MODEL",n.sonnet||""),n.haiku!==void 0&&a("ANTHROPIC_DEFAULT_HAIKU_MODEL",n.haiku||"")},[_,y]=x.useState(!1),l=new Set(["ANTHROPIC_AUTH_TOKEN"]),o=Object.entries(g).filter(([n])=>!l.has(n));return e.jsx("div",{className:"h-full w-full min-w-0 flex flex-col",children:e.jsxs(Fe,{defaultValue:"env",className:"h-full w-full min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Ke,{className:"w-full",children:[e.jsx(ne,{value:"env",className:"flex-1",children:N?"Configuration":"Environment Variables"}),e.jsx(ne,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:[e.jsx(ie,{value:"env",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden min-w-0",children:N?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsxs("div",{className:"h-full overflow-y-auto overflow-x-hidden p-4 space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(O,{className:"text-sm font-medium",children:"Model Selection"}),e.jsx(js,{value:g.ANTHROPIC_MODEL,onChange:b,placeholder:"Search OpenRouter models..."})]}),e.jsx(Ns,{selectedModel:g.ANTHROPIC_MODEL,value:w,onChange:S}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{className:"text-sm font-medium",children:"API Key"}),e.jsx(Te,{value:g.ANTHROPIC_AUTH_TOKEN||"",onChange:n=>a("ANTHROPIC_AUTH_TOKEN",n.target.value),placeholder:"sk-or-v1-...",className:"font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your API key from"," ",e.jsx("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"openrouter.ai/keys"})]})]}),o.length>0&&e.jsxs(he,{open:_,onOpenChange:y,children:[e.jsxs(pe,{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors group",children:[e.jsx(Ne,{className:P("h-4 w-4 transition-transform",_&&"rotate-90")}),e.jsx(is,{className:"h-4 w-4"}),e.jsx("span",{children:"Additional Variables"}),e.jsxs("span",{className:"text-xs font-normal opacity-70",children:["(",o.length,")"]})]}),e.jsx(fe,{className:"pt-4",children:e.jsx("div",{className:"space-y-3 border rounded-lg p-3 bg-muted/30",children:o.map(([n,E])=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(O,{className:"text-xs text-muted-foreground",children:n}),e.jsx(k,{value:E,onChange:D=>a(n,D.target.value),className:"font-mono text-xs h-8"})]},n))})})]})]})}),e.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[e.jsx(O,{className:"text-xs font-medium text-muted-foreground",children:"Add Environment Variable"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(k,{placeholder:"VARIABLE_NAME",value:i,onChange:n=>m(n.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:n=>n.key==="Enter"&&i.trim()&&j()}),e.jsx(k,{placeholder:"value",value:f,onChange:n=>p(n.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:n=>n.key==="Enter"&&i.trim()&&j()}),e.jsx(v,{variant:"outline",size:"sm",className:"h-8",onClick:j,disabled:!i.trim(),children:e.jsx($,{className:"w-4 h-4"})})]})]})]}):e.jsx(fs,{currentSettings:c,newEnvKey:i,newEnvValue:f,onNewEnvKeyChange:m,onNewEnvValueChange:p,onEnvValueChange:a,onAddEnvVar:j})}),e.jsx(ie,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(gs,{profileName:s,target:r,data:t})})]})]})})}function bs({profileName:s,profileTarget:r,onDelete:t,onHasChangesUpdate:c}){const[i,f]=x.useState({}),[m,p]=x.useState(!1),[a,j]=x.useState(null),[u,N]=x.useState(""),[T,w]=x.useState(""),g=Ze(),{data:b,isLoading:S,isError:_,refetch:y}=es({queryKey:["settings",s],queryFn:async()=>{const d=await fetch(`/api/settings/${s}/raw`);if(!d.ok)throw new Error(`Failed to load settings: ${d.status}`);return d.json()}}),l=b?.settings,o=x.useMemo(()=>{if(a!==null)try{return JSON.parse(a)}catch{}if(l)return{...l,env:{...l.env,...i}}},[l,i,a]),n=x.useMemo(()=>a!==null?a:l?JSON.stringify(l,null,2):"",[a,l]),E=x.useCallback(d=>{j(d)},[]),D=(d,C)=>{const M={...o?.env||{},[d]:C};f(L=>({...L,[d]:C})),j(JSON.stringify({...o,env:M},null,2))},B=d=>{const C={...o?.env||{},...d};f(M=>({...M,...d})),j(JSON.stringify({...o,env:C},null,2))},q=()=>{if(!u.trim())return;const d=u.trim(),C=T,M={...o?.env||{},[d]:C};f(L=>({...L,[d]:C})),j(JSON.stringify({...o,env:M},null,2)),N(""),w("")},h=x.useMemo(()=>{try{return JSON.parse(n),!0}catch{return!1}},[n]),V=x.useMemo(()=>a!==null?a!==JSON.stringify(l,null,2):Object.keys(i).length>0,[a,i,l]),Ee=x.useMemo(()=>{const d=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"],C=o?.env||{};return d.filter(M=>!C[M]?.trim())},[o]);x.useEffect(()=>{c?.(V)},[V,c]);const U=le({mutationFn:async()=>{let d;try{d=JSON.parse(n)}catch{d={...b?.settings,env:{...b?.settings?.env,...i}}}const C=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:d,expectedMtime:b?.mtime})});if(C.status===409)throw new Error("CONFLICT");if(!C.ok)throw new Error("Failed to save");return C.json()},onSuccess:()=>{g.invalidateQueries({queryKey:["settings",s]}),g.invalidateQueries({queryKey:["profiles"]}),f({}),j(null),I.success(K.t("commonToast.settingsSaved"))},onError:d=>{d.message==="CONFLICT"?p(!0):I.error(d.message)}}),Y=le({mutationFn:async d=>(await $e.profiles.update(s,{target:d}),d),onSuccess:()=>{g.invalidateQueries({queryKey:["profiles"]}),I.success(K.t("commonToast.defaultTargetUpdated"))},onError:(d,C)=>{const M=C==="droid"?"Factory Droid":"Claude Code",L=d.message.trim()?`: ${d.message}`:"";I.error(K.t("commonToast.failedUpdateDefaultTarget",{target:M,suffix:L}))}}),G=r||"claude",W=U.isPending||Y.isPending,te=async d=>{p(!1),d?(await y(),U.mutate()):(f({}),j(null))};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(ps,{profileName:s,target:G,data:b,settings:o,isLoading:S,isSaving:U.isPending,isTargetSaving:Y.isPending,hasChanges:V,isRawJsonValid:h,onTargetChange:d=>{W||d!==G&&Y.mutate(d)},onRefresh:()=>{W||y()},onDelete:t,onSave:()=>{W||U.mutate()}}),S?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(z,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):_?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load settings."}),e.jsxs(v,{variant:"outline",size:"sm",onClick:()=>y(),children:[e.jsx(Q,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):e.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5 min-w-0",children:e.jsx(vs,{profileName:s,target:G,data:b,currentSettings:o,newEnvKey:u,newEnvValue:T,onNewEnvKeyChange:N,onNewEnvValueChange:w,onEnvValueChange:D,onEnvBulkChange:B,onAddEnvVar:q})}),e.jsxs("div",{className:"flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(ls,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(ze,{rawJsonContent:n,isRawJsonValid:h,rawJsonEdits:a,settings:l,onChange:E,missingRequiredFields:Ee})]})]}),e.jsx(Z,{open:m,title:"File Modified Externally",description:"Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>te(!0),onCancel:()=>te(!1)})]},s)}const xe="ccs:openrouter-banner-dismissed";function ws({onCreateClick:s}){const[r,t]=x.useState(!0),{modelCount:c,isLoading:i}=ee();x.useEffect(()=>{const m=localStorage.getItem(xe)==="true";t(m)},[]);const f=()=>{localStorage.setItem(xe,"true"),t(!0)};return r?null:e.jsx("div",{className:"bg-gradient-to-r from-accent to-accent/90 text-white px-4 py-3 relative shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 max-w-screen-xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"p-1.5 bg-white/20 rounded-md shrink-0",children:e.jsx(se,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm",children:"NEW: OpenRouter Integration"}),e.jsxs("p",{className:"text-xs text-white/80 truncate",children:["Browse ",i?"300+":`${c}+`," models from OpenAI, Anthropic, Google, Meta and more."]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s&&e.jsx(v,{size:"sm",variant:"secondary",onClick:s,className:"bg-white text-accent hover:bg-white/90 h-8",children:"Try it now"}),e.jsxs("a",{href:"https://openrouter.ai",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-white/80 hover:text-white hidden sm:flex items-center gap-1",children:["Learn more",e.jsx(ve,{className:"w-3 h-3"})]}),e.jsxs(v,{size:"icon",variant:"ghost",onClick:f,className:"h-7 w-7 text-white/70 hover:text-white hover:bg-white/20",children:[e.jsx(cs,{className:"w-4 h-4"}),e.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})})}function Cs({onOpenRouterClick:s,onCustomClick:r}){const{t}=H(),{modelCount:c,isLoading:i}=ee();return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20 p-8",children:e.jsxs("div",{className:"max-w-lg w-full space-y-6",children:[e.jsxs(Je,{className:"border-accent/30 dark:border-accent/40 bg-gradient-to-br from-accent/5 to-background dark:from-accent/10",children:[e.jsxs(Qe,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-accent/10 dark:bg-accent/20",children:e.jsx("img",{src:"/icons/openrouter.svg",alt:"OpenRouter",className:"w-6 h-6"})}),e.jsx(A,{variant:"secondary",className:"bg-accent/10 text-accent dark:bg-accent/20 dark:text-accent-foreground",children:t("openrouterQuickStart.recommended")})]}),e.jsx(Be,{className:"text-xl",children:t("openrouterQuickStart.title")}),e.jsx(qe,{className:"text-base",children:t("openrouterQuickStart.description",{modelCountLabel:i?"300+":`${c}+`})})]}),e.jsxs(Ve,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(be,{className:"w-4 h-4 text-accent"}),e.jsx("span",{children:t("openrouterQuickStart.featureOneApi")})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(se,{className:"w-4 h-4 text-accent"}),e.jsx("span",{children:t("openrouterQuickStart.featureTierMapping")})]})]}),e.jsxs(v,{onClick:s,className:"w-full bg-accent hover:bg-accent/90 text-white",size:"lg",children:[t("openrouterQuickStart.createOpenRouterProfile"),e.jsx(os,{className:"w-4 h-4 ml-2"})]}),e.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:[t("openrouterQuickStart.getApiKeyAt")," ",e.jsxs("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:["openrouter.ai/keys",e.jsx(ve,{className:"w-3 h-3"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ce,{className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t("openrouterQuickStart.or")}),e.jsx(ce,{className:"flex-1"})]}),e.jsx(v,{variant:"outline",onClick:r,className:"w-full",children:t("openrouterQuickStart.createCustomProfile")})]})})}function ys({onCreateClick:s}){const{modelCount:r,isLoading:t}=ee();return e.jsx("div",{className:"p-3 border-t bg-gradient-to-r from-accent/5 to-accent/10 dark:from-accent/10 dark:to-accent/15",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 bg-accent/10 dark:bg-accent/20 rounded shrink-0",children:e.jsx("img",{src:"/icons/openrouter.svg",alt:"",className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-accent dark:text-accent-foreground",children:"OpenRouter"}),e.jsxs("p",{className:"text-[10px] text-muted-foreground truncate",children:[t?"300+":`${r}+`," models available"]})]}),e.jsxs(v,{size:"sm",variant:"ghost",onClick:s,className:"h-7 px-2 text-accent hover:text-accent hover:bg-accent/10 dark:hover:bg-accent/20",children:[e.jsx(be,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-xs",children:"Add"})]})]})})}function Hs(){const{t:s}=H(),{data:r,isLoading:t,isError:c,refetch:i}=Ye(),f=Ge(),[m,p]=x.useState(null),[a,j]=x.useState(""),[u,N]=x.useState(!1),[T,w]=x.useState("normal"),[g,b]=x.useState(null),[S,_]=x.useState(!1),[y,l]=x.useState(null);We();const o=x.useMemo(()=>r?.profiles||[],[r?.profiles]),n=x.useMemo(()=>o.filter(h=>h.name.toLowerCase().includes(a.toLowerCase())),[o,a]),E=m?o.find(h=>h.name===m):null,D=h=>{f.mutate(h,{onSuccess:()=>{m===h&&p(null),b(null)}})},B=h=>{N(!1),S&&m!==null?l(h):p(h)},q=h=>{S&&m!==h?l(h):p(h)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:[e.jsx(ws,{onCreateClick:()=>N(!0)}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ds,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("apiProfiles.title")})]}),e.jsxs(v,{size:"sm",onClick:()=>{N(!0)},children:[e.jsx($,{className:"w-4 h-4 mr-1"}),s("apiProfiles.new")]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(je,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(k,{placeholder:s("apiProfiles.searchPlaceholder"),className:"pl-8 h-9",value:a,onChange:h=>j(h.target.value)})]})]}),e.jsx(J,{className:"flex-1",children:t?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("apiProfiles.loadingProfiles")}):c?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(we,{className:"w-12 h-12 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("apiProfiles.failedLoadTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s("apiProfiles.failedLoadDesc")})]}),e.jsxs(v,{size:"sm",variant:"outline",onClick:()=>i(),children:[e.jsx(Q,{className:"w-4 h-4 mr-1"}),s("apiProfiles.retry")]})]})}):n.length===0?e.jsx("div",{className:"p-4 text-center",children:o.length===0?e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xs,{className:"w-12 h-12 mx-auto text-muted-foreground/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("apiProfiles.noProfilesYet")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s("apiProfiles.noProfilesDesc")})]}),e.jsxs(v,{size:"sm",variant:"outline",onClick:()=>{N(!0)},children:[e.jsx($,{className:"w-4 h-4 mr-1"}),s("apiProfiles.createProfile")]})]}):e.jsx("p",{className:"text-sm text-muted-foreground py-4",children:s("apiProfiles.noProfileMatch",{query:a})})}):e.jsx("div",{className:"p-2 space-y-1",children:n.map(h=>e.jsx(Ts,{profile:h,isSelected:m===h.name,onSelect:()=>q(h.name),onDelete:()=>b(h.name)},h.name))})}),o.length>0&&e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:s("apiProfiles.profileCount",{count:o.length})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ce,{className:"w-3 h-3 text-green-600"}),s("apiProfiles.configuredCount",{count:o.filter(h=>h.configured).length})]})]})}),e.jsx(ys,{onCreateClick:()=>{w("openrouter"),N(!0)}})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:E?e.jsx(bs,{profileName:E.name,profileTarget:E.target,onDelete:()=>b(E.name),onHasChangesUpdate:_},E.name):e.jsx(Cs,{onOpenRouterClick:()=>{w("openrouter"),N(!0)},onCustomClick:()=>{w("normal"),N(!0)}})})]}),e.jsx(Xe,{open:u,onOpenChange:N,onSuccess:B,initialMode:T}),e.jsx(Z,{open:!!g,title:s("apiProfiles.deleteProfileTitle"),description:s("apiProfiles.deleteProfileDesc",{name:g??""}),confirmText:s("apiProfiles.delete"),variant:"destructive",onConfirm:()=>g&&D(g),onCancel:()=>b(null)}),e.jsx(Z,{open:!!y,title:s("apiProfiles.unsavedChangesTitle"),description:s("apiProfiles.unsavedChangesDesc",{current:m??"",next:y??""}),confirmText:s("apiProfiles.discardSwitch"),variant:"destructive",onConfirm:()=>{_(!1),p(y),l(null)},onCancel:()=>l(null)})]})}function Ts({profile:s,isSelected:r,onSelect:t,onDelete:c}){return e.jsxs("div",{className:P("group flex items-center gap-2 px-3 py-2.5 rounded-md cursor-pointer transition-colors",r?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:t,children:[s.configured?e.jsx(Ce,{className:"w-4 h-4 text-green-600 shrink-0"}):e.jsx(we,{className:"w-4 h-4 text-yellow-600 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:s.name}),e.jsx(A,{variant:"outline",className:"text-[10px] h-4 px-1.5 uppercase",children:s.target||"claude"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("div",{className:"text-xs text-muted-foreground truncate flex-1",children:s.settingsPath}),e.jsx(R,{value:s.settingsPath,size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:i=>{i.stopPropagation(),c()},children:e.jsx(ge,{className:"w-3.5 h-3.5 text-destructive"})})]})}export{Hs as ApiPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as n}from"./react-vendor-CNOkPC89.js";import{a as V,bf as W,b6 as X,b8 as Y,n as Z,I as C,d as c}from"./index-hlYFfpDN.js";import{R as E,a3 as _,u as ee,l as se,E as K,e as T,k as z,m as R,az as te,a2 as ae,z as ne,ai as re}from"./icons-kPbuhVdj.js";import"./tanstack-e99Cjjy2.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";function pe(){const{t:s}=V(),{fetchRawConfig:o}=W(),[a,D]=n.useState(null),[j,S]=n.useState(!0),[i,m]=n.useState(!1),[p,r]=n.useState(null),[g,f]=n.useState(null),[w,P]=n.useState(!1),[y,O]=n.useState(!1),[d,N]=n.useState(null),[u,v]=n.useState(null),[$,k]=n.useState(!1),[F,b]=n.useState(!1),h=n.useCallback(async()=>{try{S(!0),r(null);const t=await fetch("/api/settings/auth/tokens/raw");if(!t.ok)throw new Error(s("settingsAuth.failedFetchTokens"));const l=await t.json();D(l)}catch(t){r(t instanceof Error?t.message:s("settings.unknownError"))}finally{S(!1)}},[s]);n.useEffect(()=>{h(),o()},[h,o]),n.useEffect(()=>{if(g){const t=setTimeout(()=>f(null),3e3);return()=>clearTimeout(t)}},[g]),n.useEffect(()=>{if(p){const t=setTimeout(()=>r(null),5e3);return()=>clearTimeout(t)}},[p]);const I=async()=>{const t=d!==null&&d!==a?.apiKey.value,l=u!==null&&u!==a?.managementSecret.value;if(!(!t&&!l))try{m(!0),r(null);const x={};t&&(x.apiKey=d),l&&(x.managementSecret=u);const A=await fetch("/api/settings/auth/tokens",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!A.ok){const Q=await A.json();throw new Error(Q.error||s("settingsAuth.failedSaveTokens"))}f(s("settingsAuth.tokensUpdated")),N(null),v(null),await h(),await o()}catch(x){r(x instanceof Error?x.message:s("settings.unknownError"))}finally{m(!1)}},U=async()=>{try{m(!0),r(null);const t=await fetch("/api/settings/auth/tokens/regenerate-secret",{method:"POST"});if(!t.ok){const l=await t.json();throw new Error(l.error||s("settingsAuth.failedRegenerate"))}f(s("settingsAuth.secretRegenerated")),await h(),await o()}catch(t){r(t instanceof Error?t.message:s("settings.unknownError"))}finally{m(!1)}},B=async()=>{try{m(!0),r(null);const t=await fetch("/api/settings/auth/tokens/reset",{method:"POST"});if(!t.ok){const l=await t.json();throw new Error(l.error||s("settingsAuth.failedReset"))}f(s("settingsAuth.tokensReset")),N(null),v(null),await h(),await o()}catch(t){r(t instanceof Error?t.message:s("settings.unknownError"))}finally{m(!1)}},J=async()=>{a&&(await navigator.clipboard.writeText(a.apiKey.value),k(!0),setTimeout(()=>k(!1),2e3))},L=async()=>{a&&(await navigator.clipboard.writeText(a.managementSecret.value),b(!0),setTimeout(()=>b(!1),2e3))},q=async()=>{j||i||(r(null),f(null),await Promise.all([h(),o()]))};if(j||!a)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(E,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})});const G=d??a.apiKey.value,H=u??a.managementSecret.value,M=d!==null&&d!==a.apiKey.value||u!==null&&u!==a.managementSecret.value;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${p||g?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[p&&e.jsxs(X,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(_,{className:"h-4 w-4"}),e.jsx(Y,{children:p})]}),g&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:g})]})]}),e.jsx(Z,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsAuth.description")}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"w-4 h-4 text-primary"}),e.jsx("h3",{className:"text-base font-medium",children:s("settingsAuth.apiKey")}),a.apiKey.isCustom&&e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300",children:s("settingsAuth.custom")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsAuth.apiKeyDesc")}),e.jsx("div",{className:"flex gap-2",children:e.jsxs("div",{className:"relative flex-1",children:[e.jsx(C,{type:w?"text":"password",value:G,onChange:t=>N(t.target.value),placeholder:s("settingsAuth.apiKeyPlaceholder"),disabled:i,className:"pr-20 font-mono text-sm"}),e.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1",children:[e.jsx(c,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>P(!w),children:w?e.jsx(K,{className:"w-4 h-4"}):e.jsx(T,{className:"w-4 h-4"})}),e.jsx(c,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:J,disabled:!a.apiKey.value,children:$?e.jsx(z,{className:"w-4 h-4 text-green-600"}):e.jsx(R,{className:"w-4 h-4"})})]})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4 text-primary"}),e.jsx("h3",{className:"text-base font-medium",children:s("settingsAuth.managementSecret")}),a.managementSecret.isCustom&&e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300",children:s("settingsAuth.custom")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsAuth.managementSecretDesc")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(C,{type:y?"text":"password",value:H,onChange:t=>v(t.target.value),placeholder:s("settingsAuth.managementSecretPlaceholder"),disabled:i,className:"pr-20 font-mono text-sm"}),e.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1",children:[e.jsx(c,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>O(!y),children:y?e.jsx(K,{className:"w-4 h-4"}):e.jsx(T,{className:"w-4 h-4"})}),e.jsx(c,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:L,disabled:!a.managementSecret.value,children:F?e.jsx(z,{className:"w-4 h-4 text-green-600"}):e.jsx(R,{className:"w-4 h-4"})})]})]}),e.jsx(c,{variant:"outline",size:"sm",onClick:U,disabled:i,title:s("settingsAuth.generateSecret"),children:e.jsx(ae,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"pt-4 border-t",children:[e.jsxs(c,{variant:"outline",size:"sm",onClick:B,disabled:i||!a.apiKey.isCustom&&!a.managementSecret.isCustom,className:"gap-2",children:[e.jsx(ne,{className:"w-4 h-4"}),s("settingsAuth.resetDefaults")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:s("settingsAuth.resetDesc")})]})]})}),e.jsxs("div",{className:"p-4 border-t bg-background flex gap-2",children:[e.jsxs(c,{variant:"outline",size:"sm",onClick:q,disabled:j||i,className:"flex-1",children:[e.jsx(E,{className:`w-4 h-4 mr-2 ${j?"animate-spin":""}`}),s("settings.refresh")]}),e.jsxs(c,{variant:"default",size:"sm",onClick:I,disabled:!M||i,className:"flex-1",children:[e.jsx(re,{className:`w-4 h-4 mr-2 ${i?"animate-pulse":""}`}),s(i?"settingsAuth.saving":"settingsAuth.save")]})]})]})}export{pe as default};
|