@kaitranntt/ccs 7.49.1 → 7.50.0-dev.2
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 +48 -0
- 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 +54 -0
- package/dist/auth/account-context.d.ts.map +1 -0
- package/dist/auth/account-context.js +124 -0
- package/dist/auth/account-context.js.map +1 -0
- 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.d.ts.map +1 -1
- package/dist/auth/commands/create-command.js +28 -5
- 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 +8 -2
- 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 +5 -0
- package/dist/auth/commands/show-command.js.map +1 -1
- package/dist/auth/commands/types.d.ts +4 -0
- package/dist/auth/commands/types.d.ts.map +1 -1
- package/dist/auth/commands/types.js +27 -1
- 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 +9 -0
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/auth/profile-registry.d.ts +11 -5
- package/dist/auth/profile-registry.d.ts.map +1 -1
- package/dist/auth/profile-registry.js +48 -7
- package/dist/auth/profile-registry.js.map +1 -1
- package/dist/ccs.js +121 -3
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/env-builder.js +67 -11
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/generator.d.ts.map +1 -1
- package/dist/cliproxy/config/generator.js +2 -0
- package/dist/cliproxy/config/generator.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +18 -0
- 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 +3 -2
- package/dist/cliproxy/model-config.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/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 +10 -2
- package/dist/commands/help-command.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +4 -0
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/management/instance-manager.d.ts +2 -1
- package/dist/management/instance-manager.d.ts.map +1 -1
- package/dist/management/instance-manager.js +4 -3
- package/dist/management/instance-manager.js.map +1 -1
- package/dist/management/shared-manager.d.ts +21 -0
- package/dist/management/shared-manager.d.ts.map +1 -1
- package/dist/management/shared-manager.js +136 -0
- 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 +19 -10
- package/dist/targets/droid-adapter.js.map +1 -1
- package/dist/targets/droid-config-manager.d.ts +8 -1
- package/dist/targets/droid-config-manager.d.ts.map +1 -1
- package/dist/targets/droid-config-manager.js +28 -3
- 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/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-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 +9 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js.map +1 -1
- package/dist/ui/assets/accounts-BKK-Lc16.js +1 -0
- package/dist/ui/assets/{alert-dialog-CFpc3HGP.js → alert-dialog-DmrIcJav.js} +1 -1
- package/dist/ui/assets/api-DzTwRtww.js +1 -0
- package/dist/ui/assets/{auth-section-856y9ZpH.js → auth-section-CP_2r8oJ.js} +1 -1
- package/dist/ui/assets/{backups-section-Bjxv4_pg.js → backups-section-jwtuA5Ay.js} +1 -1
- package/dist/ui/assets/checkbox-CNqHZx7Z.js +1 -0
- package/dist/ui/assets/cliproxy-CtO9BwgG.js +3 -0
- package/dist/ui/assets/cliproxy-control-panel--WUVyBIk.js +1 -0
- package/dist/ui/assets/{confirm-dialog-DxtbIbqy.js → confirm-dialog-CQNxkz9X.js} +1 -1
- package/dist/ui/assets/{copilot-DdeJ4TJs.js → copilot-DLxxmnsW.js} +2 -2
- package/dist/ui/assets/{cursor-CevrJcAp.js → cursor-YRIza7sP.js} +1 -1
- package/dist/ui/assets/{form-utils-C-pVd1--.js → form-utils-Cn_Uld6y.js} +1 -1
- package/dist/ui/assets/{globalenv-section-BqZQzUQ1.js → globalenv-section-vUSIK5rf.js} +1 -1
- package/dist/ui/assets/{health-D-7zneJI.js → health-BWPd6F4h.js} +1 -1
- package/dist/ui/assets/icons-Dk2sL3Mr.js +1 -0
- package/dist/ui/assets/index-B9dJZNls.js +1 -0
- package/dist/ui/assets/index-BZdHAol5.js +1 -0
- package/dist/ui/assets/{index-zwg9LfSN.js → index-BlldLmNl.js} +1 -1
- package/dist/ui/assets/{index-CcVqwkjG.js → index-D244tv89.js} +1 -1
- package/dist/ui/assets/index-DEDy1J8t.css +1 -0
- package/dist/ui/assets/index-PWMOllOf.js +47 -0
- package/dist/ui/assets/proxy-status-widget-MlyNgoPh.js +1 -0
- package/dist/ui/assets/{radix-ui-CwcVwplj.js → radix-ui-DIWAxjEp.js} +1 -1
- package/dist/ui/assets/separator-OcJLDgYQ.js +1 -0
- package/dist/ui/assets/{shared-VSWE7ipr.js → shared-LxAdbm4g.js} +1 -1
- package/dist/ui/assets/{switch-B1VCWktQ.js → switch-s8pp-m8L.js} +1 -1
- package/dist/ui/assets/{tanstack-matWclUm.js → tanstack-Hn82hibe.js} +1 -1
- package/dist/ui/assets/updates-BQRhDVbP.js +1 -0
- package/dist/ui/index.html +6 -6
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.d.ts.map +1 -1
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.js +2 -1
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.js.map +1 -1
- package/dist/utils/websearch/profile-hook-injector.d.ts.map +1 -1
- package/dist/utils/websearch/profile-hook-injector.js +2 -1
- package/dist/utils/websearch/profile-hook-injector.js.map +1 -1
- package/dist/web-server/routes/account-routes.d.ts.map +1 -1
- package/dist/web-server/routes/account-routes.js +4 -0
- package/dist/web-server/routes/account-routes.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/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/package.json +1 -1
- package/dist/ui/assets/accounts-BKNcAuvp.js +0 -1
- package/dist/ui/assets/api-CcrDOIR7.js +0 -1
- package/dist/ui/assets/cliproxy-CgqwQWL0.js +0 -3
- package/dist/ui/assets/cliproxy-control-panel-fVNMCVo2.js +0 -1
- package/dist/ui/assets/icons-DGASzt3M.js +0 -1
- package/dist/ui/assets/index-5pyU75fR.js +0 -1
- package/dist/ui/assets/index-Bqt9Obz8.css +0 -1
- package/dist/ui/assets/index-DiWdJxAN.js +0 -47
- package/dist/ui/assets/index-euQBQnD4.js +0 -1
- package/dist/ui/assets/proxy-status-widget-nDPpIwJt.js +0 -1
- package/dist/ui/assets/separator-CrJ4MtV5.js +0 -1
|
@@ -42,14 +42,14 @@ const LOCK_RETRY_MIN_MS = 200;
|
|
|
42
42
|
const LOCK_RETRY_MAX_MS = 1000;
|
|
43
43
|
/**
|
|
44
44
|
* Validate profile name to prevent filesystem/security issues.
|
|
45
|
-
* Only alphanumeric, underscore, hyphen allowed.
|
|
45
|
+
* Only alphanumeric, dot, underscore, hyphen allowed.
|
|
46
46
|
*/
|
|
47
47
|
function isValidProfileName(profile) {
|
|
48
|
-
return !!profile && /^[a-zA-Z0-
|
|
48
|
+
return !!profile && /^[a-zA-Z0-9._-]+$/.test(profile);
|
|
49
49
|
}
|
|
50
50
|
function validateProfileName(profile) {
|
|
51
51
|
if (!isValidProfileName(profile)) {
|
|
52
|
-
throw new Error(`Invalid profile name "${profile}": must contain only alphanumeric characters, underscores, or hyphens`);
|
|
52
|
+
throw new Error(`Invalid profile name "${profile}": must contain only alphanumeric characters, dots, underscores, or hyphens`);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
function isSupportedProvider(value) {
|
|
@@ -85,6 +85,10 @@ function parseManagedProfile(displayName) {
|
|
|
85
85
|
function asModelEntry(value) {
|
|
86
86
|
return isDroidCustomModelEntry(value) ? value : null;
|
|
87
87
|
}
|
|
88
|
+
function buildSelectorAlias(displayName, index) {
|
|
89
|
+
const normalizedDisplayName = displayName.trim().replace(/\s+/g, '-');
|
|
90
|
+
return `${normalizedDisplayName}-${index}`;
|
|
91
|
+
}
|
|
88
92
|
function normalizeCustomModels(value) {
|
|
89
93
|
if (Array.isArray(value)) {
|
|
90
94
|
return value
|
|
@@ -274,6 +278,7 @@ async function upsertCcsModel(profile, model) {
|
|
|
274
278
|
validateProfileName(profile);
|
|
275
279
|
ensureFactoryDir();
|
|
276
280
|
let release;
|
|
281
|
+
let ref = null;
|
|
277
282
|
try {
|
|
278
283
|
release = await acquireFactoryLock(10);
|
|
279
284
|
const settings = readDroidSettings();
|
|
@@ -290,12 +295,32 @@ async function upsertCcsModel(profile, model) {
|
|
|
290
295
|
else {
|
|
291
296
|
settings.customModels.push(entry);
|
|
292
297
|
}
|
|
298
|
+
const index = settings.customModels.findIndex((entry) => parseManagedProfile(entry.displayName) === profile);
|
|
299
|
+
const safeIndex = index >= 0 ? index : 0;
|
|
300
|
+
const selectorAlias = buildSelectorAlias(entry.displayName, safeIndex);
|
|
301
|
+
const selector = `custom:${selectorAlias}`;
|
|
302
|
+
// Droid interactive mode uses settings.model for default model selection.
|
|
303
|
+
settings.model = selector;
|
|
293
304
|
writeDroidSettings(settings);
|
|
305
|
+
ref = {
|
|
306
|
+
profile,
|
|
307
|
+
displayName: entry.displayName,
|
|
308
|
+
index: safeIndex,
|
|
309
|
+
selectorAlias,
|
|
310
|
+
selector,
|
|
311
|
+
};
|
|
294
312
|
}
|
|
295
313
|
finally {
|
|
296
314
|
if (release)
|
|
297
315
|
await release();
|
|
298
316
|
}
|
|
317
|
+
return (ref || {
|
|
318
|
+
profile,
|
|
319
|
+
displayName: `CCS ${profile}`,
|
|
320
|
+
index: 0,
|
|
321
|
+
selectorAlias: `CCS-${profile}-0`,
|
|
322
|
+
selector: `custom:CCS-${profile}-0`,
|
|
323
|
+
});
|
|
299
324
|
}
|
|
300
325
|
exports.upsertCcsModel = upsertCcsModel;
|
|
301
326
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"droid-config-manager.js","sourceRoot":"","sources":["../../src/targets/droid-config-manager.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,0DAA4C;AAE5C,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,qDAAqD;AACrD,MAAM,aAAa,GAAG,K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AC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;YACzD,MAAM,OAAO,GAAG,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;YACnD,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACvC,CAAC;YAED,6DAA6D;YAC7D,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC;QAChD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAChB,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;YAAS,CAAC;QACT,IAAI,OAAO;YAAE,MAAM,OAAO,EAAE,CAAC;IAC/B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AA3CD,kDA2CC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Droid BYOK provider resolution helpers.
|
|
3
|
+
*
|
|
4
|
+
* Factory BYOK accepts exactly:
|
|
5
|
+
* - anthropic
|
|
6
|
+
* - openai
|
|
7
|
+
* - generic-chat-completion-api
|
|
8
|
+
*
|
|
9
|
+
* CCS stores provider hints in profile settings as CCS_DROID_PROVIDER and
|
|
10
|
+
* resolves a best-effort provider from base URL/model when the hint is absent.
|
|
11
|
+
*/
|
|
12
|
+
export type DroidProvider = 'anthropic' | 'openai' | 'generic-chat-completion-api';
|
|
13
|
+
/**
|
|
14
|
+
* Normalize potentially messy provider input into a valid Factory provider.
|
|
15
|
+
*/
|
|
16
|
+
export declare function normalizeDroidProvider(provider: string | undefined | null): DroidProvider | null;
|
|
17
|
+
/**
|
|
18
|
+
* Infer provider primarily from base URL patterns used in BYOK configs.
|
|
19
|
+
*/
|
|
20
|
+
export declare function inferDroidProviderFromBaseUrl(baseUrl: string | undefined | null): DroidProvider | null;
|
|
21
|
+
/**
|
|
22
|
+
* Infer provider from model naming when URL does not provide a clear signal.
|
|
23
|
+
*/
|
|
24
|
+
export declare function inferDroidProviderFromModel(model: string | undefined | null): DroidProvider | null;
|
|
25
|
+
export interface DroidProviderResolveInput {
|
|
26
|
+
provider?: string | null;
|
|
27
|
+
baseUrl?: string | null;
|
|
28
|
+
model?: string | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Resolve a provider for Droid custom model entries.
|
|
32
|
+
*
|
|
33
|
+
* Precedence:
|
|
34
|
+
* 1) explicit provider hint (CCS_DROID_PROVIDER)
|
|
35
|
+
* 2) base URL inference
|
|
36
|
+
* 3) model inference
|
|
37
|
+
* 4) anthropic (backward-compatible default for legacy CCS profiles)
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveDroidProvider(input: DroidProviderResolveInput): DroidProvider;
|
|
40
|
+
//# sourceMappingURL=droid-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"droid-provider.d.ts","sourceRoot":"","sources":["../../src/targets/droid-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,6BAA6B,CAAC;AAenF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,aAAa,GAAG,IAAI,CAgBhG;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GACjC,aAAa,GAAG,IAAI,CAiDtB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAC/B,aAAa,GAAG,IAAI,CAwBtB;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,aAAa,CAWpF"}
|
|
@@ -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,CAA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,CAAC,IAAI,CAAC,EAC3B,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IACE,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC;QAC7B,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC;QACjC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,EAC7B,CAAC;QACD,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"}
|
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"}
|
|
@@ -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;QAC7C,M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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
|
}
|
|
@@ -78,6 +83,10 @@ export interface ProfileMetadata {
|
|
|
78
83
|
type?: string;
|
|
79
84
|
created: string;
|
|
80
85
|
last_used?: string | null;
|
|
86
|
+
/** Context mode for project workspace data */
|
|
87
|
+
context_mode?: 'isolated' | 'shared';
|
|
88
|
+
/** Context-sharing group when context_mode='shared' */
|
|
89
|
+
context_group?: string;
|
|
81
90
|
}
|
|
82
91
|
export interface ProfilesRegistry {
|
|
83
92
|
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,CAA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,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;;;AAqGH;;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-DIWAxjEp.js";import{r as x}from"./react-vendor-CNOkPC89.js";import{u as R,a as b,b as v,d as _,f as k,g as F}from"./tanstack-Hn82hibe.js";import{c as p,W as C,b as m,a5 as L,a6 as P,a7 as q,a8 as K,a9 as M,L as j,I as T}from"./index-PWMOllOf.js";import{A as $,a as G,b as E,c as H,d as Q,e as O,f as Z,g as B}from"./alert-dialog-DmrIcJav.js";import{t as h}from"./notifications-B2HqRBj7.js";import{v as I,j as y,ag as V,y as U,l as S,$ as W}from"./icons-Dk2sL3Mr.js";import{C as J}from"./checkbox-CNqHZx7Z.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";function X({className:n,...t}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:p("w-full caption-bottom text-sm",n),...t})})}function Y({className:n,...t}){return e.jsx("thead",{"data-slot":"table-header",className:p("[&_tr]:border-b",n),...t})}function ee({className:n,...t}){return e.jsx("tbody",{"data-slot":"table-body",className:p("[&_tr:last-child]:border-0",n),...t})}function z({className:n,...t}){return e.jsx("tr",{"data-slot":"table-row",className:p("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",n),...t})}function te({className:n,...t}){return e.jsx("th",{"data-slot":"table-head",className:p("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...t})}function se({className:n,...t}){return e.jsx("td",{"data-slot":"table-cell",className:p("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...t})}function ae(){return R({queryKey:["accounts"],queryFn:()=>C.accounts.list()})}function ne(){const n=b();return v({mutationFn:t=>C.accounts.setDefault(t),onSuccess:(t,r)=>{n.invalidateQueries({queryKey:["accounts"]}),h.success(`Default account set to "${r}"`)},onError:t=>{h.error(t.message)}})}function re(){const n=b();return v({mutationFn:()=>C.accounts.resetDefault(),onSuccess:()=>{n.invalidateQueries({queryKey:["accounts"]}),h.success("Default account reset to CCS")},onError:t=>{h.error(t.message)}})}function le(){const n=b();return v({mutationFn:t=>C.accounts.delete(t),onSuccess:(t,r)=>{n.invalidateQueries({queryKey:["accounts"]}),h.success(`Account "${r}" deleted`)},onError:t=>{h.error(t.message)}})}function oe({data:n,defaultAccount:t}){const r=ne(),c=le(),l=re(),[i,d]=x.useState(null),g=_({data:n,columns:[{accessorKey:"name",header:"Name",size:200,cell:({row:s})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:s.original.name}),s.original.name===t&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:"default"})]})},{accessorKey:"type",header:"Type",size:100,cell:({row:s})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:s.original.type||"oauth"})},{accessorKey:"created",header:"Created",size:150,cell:({row:s})=>{const a=new Date(s.original.created);return e.jsx("span",{className:"text-muted-foreground",children:a.toLocaleDateString()})}},{accessorKey:"last_used",header:"Last Used",size:150,cell:({row:s})=>{if(!s.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const a=new Date(s.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:a.toLocaleDateString()})}},{id:"context",header:"Context",size:170,cell:({row:s})=>{if(s.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((s.original.context_mode||"isolated")==="shared"){const o=s.original.context_group||"default";return e.jsxs("span",{className:"text-muted-foreground",children:["shared (",o,")"]})}return e.jsx("span",{className:"text-muted-foreground",children:"isolated"})}},{id:"actions",header:"Actions",size:180,cell:({row:s})=>{const a=s.original.name===t,o=r.isPending||c.isPending;return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(m,{variant:a?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:a||o,onClick:()=>r.mutate(s.original.name),children:[e.jsx(y,{className:`w-3 h-3 mr-1 ${a?"opacity-50":""}`}),a?"Active":"Set Default"]}),e.jsx(m,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:a||o,onClick:()=>d(s.original.name),title:a?"Cannot delete default account":"Delete account",children:e.jsx(V,{className:"w-4 h-4"})})]})}}],getCoreRowModel:F()});return n.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:["No accounts found. Use"," ",e.jsx("code",{className:"text-sm bg-muted px-1 rounded",children:"ccs auth create"})," to add accounts."]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(X,{children:[e.jsx(Y,{children:g.getHeaderGroups().map(s=>e.jsx(z,{children:s.headers.map(a=>{const o={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",context:"w-[170px]",actions:"w-[180px]"}[a.id]||"w-auto";return e.jsx(te,{className:o,children:a.isPlaceholder?null:k(a.column.columnDef.header,a.getContext())},a.id)})},s.id))}),e.jsx(ee,{children:g.getRowModel().rows.map(s=>e.jsx(z,{children:s.getVisibleCells().map(a=>e.jsx(se,{children:k(a.column.columnDef.cell,a.getContext())},a.id))},s.id))})]})}),t&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>l.mutate(),disabled:l.isPending,children:[e.jsx(I,{className:"w-4 h-4 mr-2"}),"Reset to CCS Default"]})})]}),e.jsx($,{open:!!i,onOpenChange:s=>!s&&d(null),children:e.jsxs(G,{children:[e.jsxs(E,{children:[e.jsx(H,{children:"Delete Account"}),e.jsxs(Q,{children:['Are you sure you want to delete the account "',i,'"? This will remove the profile and all its session data. This action cannot be undone.']})]}),e.jsxs(O,{children:[e.jsx(Z,{children:"Cancel"}),e.jsx(B,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{i&&(c.mutate(i),d(null))},children:"Delete"})]})]})})]})}function ce({open:n,onClose:t}){const[r,c]=x.useState(""),[l,i]=x.useState(!1),[d,N]=x.useState(""),[g,s]=x.useState(!1),a=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(r),o=d.trim().toLowerCase(),f=o.length===0||/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(o),w=r&&a?[`ccs auth create ${r}`,l?o.length>0?`--context-group ${o}`:"--share-context":""].filter(Boolean).join(" "):"ccs auth create <name>",D=async()=>{!a||l&&!f||(await navigator.clipboard.writeText(w),s(!0),setTimeout(()=>s(!1),2e3))},A=()=>{c(""),i(!1),N(""),s(!1),t()};return e.jsx(L,{open:n,onOpenChange:u=>!u&&A(),children:e.jsxs(P,{className:"sm:max-w-md",children:[e.jsxs(q,{children:[e.jsx(K,{children:"Create New Account"}),e.jsx(M,{children:"Auth profiles require Claude CLI login. Run the command below in your terminal."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"profile-name",children:"Profile Name"}),e.jsx(T,{id:"profile-name",value:r,onChange:u=>c(u.target.value),placeholder:"e.g., work, personal, client",autoComplete:"off"}),r&&!a&&e.jsx("p",{className:"text-xs text-destructive",children:"Name must start with a letter and contain only letters, numbers, dashes, or underscores."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{id:"share-context",checked:l,onCheckedChange:u=>i(u===!0)}),e.jsx(j,{htmlFor:"share-context",className:"cursor-pointer",children:"Share project context with other accounts"})]}),l&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(j,{htmlFor:"context-group",children:"Context Group (optional)"}),e.jsx(T,{id:"context-group",value:d,onChange:u=>N(u.target.value),placeholder:"default, sprint-a, client-x",autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave empty to use the default shared group."}),d.trim().length>0&&!f&&e.jsx("p",{className:"text-xs text-destructive",children:"Group must start with a letter and use only letters, numbers, dashes, or underscores."})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{children:"Command"}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(U,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:w}),e.jsx(m,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:D,disabled:!a||l&&!f,children:g?e.jsx(y,{className:"w-4 h-4 text-green-500"}):e.jsx(S,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:"After running the command:"}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:"Complete the Claude login in your browser"}),e.jsx("li",{children:"Return here and refresh to see the new account"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(m,{variant:"ghost",onClick:A,children:"Close"}),e.jsx(m,{onClick:D,disabled:!a||l&&!f,children:g?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-4 h-4 mr-2"}),"Copied!"]}):e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),"Copy Command"]})})]})]})]})})}function Ne(){const{data:n,isLoading:t,refetch:r}=ae(),[c,l]=x.useState(!1);return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-8",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Accounts"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage multi-account Claude sessions (profiles.json)"})]}),e.jsxs(m,{onClick:()=>l(!0),children:[e.jsx(W,{className:"w-4 h-4 mr-2"}),"Create Account"]})]}),t?e.jsx("div",{className:"text-muted-foreground",children:"Loading accounts..."}):e.jsx(oe,{data:n?.accounts||[],defaultAccount:n?.default??null,onRefresh:r}),e.jsx(ce,{open:c,onClose:()=>l(!1)})]})}export{Ne 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-DIWAxjEp.js";import"./react-vendor-CNOkPC89.js";import{c as o,bf as l}from"./index-PWMOllOf.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-DIWAxjEp.js";import{r as o}from"./react-vendor-CNOkPC89.js";import{B as k,c as _,T as Oe,o as Te,p as Ae,q as Ee,r as _e,s as Se,t as ke,v as se,b as N,I as A,m as K,L as T,w as D,x as de,y as Pe,z as Re,A as De,D as Me,S as te,E as H,F as Y,G as xe,H as Le,J as Ie,K as me,M as ue,N as he,O as Ue,Q as He,R as ae,U as ne,V as Fe,W as $e,X as W,C as Ke,i as ze,j as Je,Y as Be,a as Qe,Z as qe,_ as Ve,$ as Ye,a0 as Ge}from"./index-PWMOllOf.js";import{a as We,u as Xe,b as re}from"./tanstack-Hn82hibe.js";import{C as G}from"./confirm-dialog-CQNxkz9X.js";import{t as I}from"./notifications-B2HqRBj7.js";import{L as F,R as z,ag as fe,ah as Ze,E as es,d as ss,$,I as ts,ai as pe,a0 as X,b as ge,aj as as,_ as ns,ak as rs,m as je,X as is,Z as Ne,al as ls,a4 as cs,a1 as ve,am as os,q as be}from"./icons-Dk2sL3Mr.js";import{S as ie}from"./separator-OcJLDgYQ.js";import"./utils-CzKF5WmX.js";import"./form-utils-Cn_Uld6y.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-DmrIcJav.js";function ds({className:s,showTooltip:a=!0}){const t=e.jsxs(k,{variant:"outline",className:_("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 a?e.jsxs(Oe,{children:[e.jsx(Te,{asChild:!0,children:t}),e.jsx(Ae,{children:e.jsx("p",{children:"Access 349+ models via OpenRouter"})})]}):t}function le(s){return[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/^API_KEY$/,/^AUTH_TOKEN$/,/_SECRET$/,/^SECRET$/].some(t=>t.test(s))}function we(s){return s?.env?(s.env.ANTHROPIC_BASE_URL||"").toLowerCase().includes("openrouter.ai"):!1}function xs(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 ms(s,a){const t={...s};return a.opus?t.ANTHROPIC_DEFAULT_OPUS_MODEL=a.opus:delete t.ANTHROPIC_DEFAULT_OPUS_MODEL,a.sonnet?t.ANTHROPIC_DEFAULT_SONNET_MODEL=a.sonnet:delete t.ANTHROPIC_DEFAULT_SONNET_MODEL,a.haiku?t.ANTHROPIC_DEFAULT_HAIKU_MODEL=a.haiku:delete t.ANTHROPIC_DEFAULT_HAIKU_MODEL,t}function us({profileName:s,target:a,data:t,settings:d,isLoading:x,isSaving:m,isTargetSaving:f,hasChanges:l,isRawJsonValid:i,onTargetChange:u,onRefresh:g,onDelete:O,onSave:b}){const v=m||f,j=x||v;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(k,{variant:"outline",className:"text-xs",children:t.path.replace(/^.*\//,"")}),we(d)&&e.jsx(ds,{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(Ee,{value:a,onValueChange:w=>{j||u(w)},disabled:j,children:[e.jsx(_e,{className:"h-7 w-[170px] text-xs",disabled:j,children:e.jsx(Se,{})}),e.jsxs(ke,{children:[e.jsx(se,{value:"claude",children:"Claude Code"}),e.jsx(se,{value:"droid",children:"Factory Droid"})]})]}),f&&e.jsx(F,{className:"w-3.5 h-3.5 animate-spin text-muted-foreground"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:"ghost",size:"sm",onClick:g,disabled:j,children:e.jsx(z,{className:`w-4 h-4 ${x?"animate-spin":""}`})}),O&&e.jsx(N,{variant:"ghost",size:"sm",onClick:O,disabled:v,children:e.jsx(fe,{className:"w-4 h-4 text-destructive"})}),e.jsx(N,{size:"sm",onClick:b,disabled:v||!l||!i,children:m?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function Ce({label:s,...a}){const[t,d]=o.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(A,{type:t?"text":"password",className:"pr-10 font-mono",...a}),e.jsx(N,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>d(!t),tabIndex:-1,children:t?e.jsx(es,{className:"w-4 h-4"}):e.jsx(ss,{className:"w-4 h-4"})})]})]})}function hs({currentSettings:s,newEnvKey:a,newEnvValue:t,onNewEnvKeyChange:d,onNewEnvValueChange:x,onEnvValueChange:m,onAddEnvVar:f}){return e.jsxs(e.Fragment,{children:[e.jsx(K,{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(([l,i])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(T,{className:"text-xs font-medium flex items-center gap-2 text-muted-foreground",children:[l,le(l)&&e.jsx(k,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:"sensitive"})]}),le(l)?e.jsx(Ce,{value:i,onChange:u=>m(l,u.target.value),className:"font-mono text-sm h-8"}):e.jsx(A,{value:i,onChange:u=>m(l,u.target.value),className:"font-mono text-sm h-8"})]},l))}):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:"No environment variables configured."}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:"Add variables using the input below or edit the JSON directly."})]})})}),e.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[e.jsx(T,{className:"text-xs font-medium text-muted-foreground",children:"Add Environment Variable"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(A,{placeholder:"VARIABLE_NAME",value:a,onChange:l=>d(l.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:l=>l.key==="Enter"&&a.trim()&&f()}),e.jsx(A,{placeholder:"value",value:t,onChange:l=>x(l.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:l=>l.key==="Enter"&&a.trim()&&f()}),e.jsx(N,{variant:"outline",size:"sm",className:"h-8",onClick:f,disabled:!a.trim(),children:e.jsx($,{className:"w-4 h-4"})})]})]})]})}function fs({profileName:s,target:a,data:t}){const d=a==="droid";return e.jsx(K,{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(ts,{className:"w-4 h-4"}),"Profile Information"]}),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:"Profile Name"}),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:"File Path"}),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(D,{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:"Last Modified"}),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:"Default Target"}),e.jsx("span",{className:"font-mono",children:a})]})]})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"Run with profile"}),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(D,{value:`ccs ${s} "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:d?"Droid alias (explicit)":"Run on Droid"}),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:d?`ccsd ${s} "prompt"`:`ccs ${s} --target droid "prompt"`}),e.jsx(D,{value:d?`ccsd ${s} "prompt"`:`ccs ${s} --target droid "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:d?"Override to Claude":"Override to Claude (explicit)"}),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(D,{value:`ccs ${s} --target claude "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"Set as default"}),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(D,{value:`ccs default ${s}`,size:"icon",className:"h-6 w-6"})]})]})]})]})]})})}function ps({value:s,onChange:a,placeholder:t="Search models...",className:d}){const[x,m]=o.useState(""),[f,l]=o.useState(null),{models:i,isLoading:u,isError:g,isFetching:O}=de(),b=Pe(),v=o.useMemo(()=>Re(i,x,{category:f??void 0}),[i,x,f]),j=o.useMemo(()=>De(i,2),[i]),w=!x.trim()&&!f,S=o.useMemo(()=>{const r={anthropic:[],openai:[],google:[],meta:[],mistral:[],opensource:[],other:[]};v.forEach(h=>{r[h.category].push(h)});for(const h of Object.keys(r))r[h]=Me(r[h]);return r},[v]),E=o.useCallback(()=>{b()},[b]),C=i.find(r=>r.id===s);return u&&i.length===0?e.jsxs("div",{className:_("space-y-2",d),children:[e.jsx(te,{className:"h-10 w-full"}),e.jsx(te,{className:"h-32 w-full"})]}):e.jsxs("div",{className:_("space-y-2 w-full min-w-0 overflow-hidden",d),children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(pe,{className:"text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2"}),e.jsx(A,{value:x,onChange:r=>m(r.target.value),placeholder:t,className:"pl-9"})]}),e.jsx(N,{variant:"outline",size:"icon",onClick:E,disabled:O,title:"Refresh models",children:O?e.jsx(F,{className:"h-4 w-4 animate-spin"}):e.jsx(z,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs(k,{variant:f===null?"default":"outline",className:"cursor-pointer",onClick:()=>l(null),children:["All (",i.length,")"]}),Object.keys(H).map(r=>{const h=S[r].length;return h===0?null:e.jsxs(k,{variant:f===r?"default":"outline",className:"cursor-pointer",onClick:()=>l(r),children:[H[r]," (",h,")"]},r)})]}),C&&e.jsxs("div",{className:"bg-muted rounded-md p-2 text-sm",children:[e.jsx("span",{className:"font-medium",children:C.name}),e.jsxs("span",{className:"text-muted-foreground ml-2",children:[Y(C.pricing)," |"," ",xe(C.context_length)]})]}),e.jsx(K,{className:"h-72 w-full rounded-md border",children:g?e.jsxs("div",{className:"text-destructive p-4 text-center",children:["Failed to load models."," ",e.jsx(N,{variant:"link",onClick:E,children:"Retry"})]}):v.length===0?e.jsxs("div",{className:"text-muted-foreground p-4 text-center",children:['No models found matching "',x,'"']}):e.jsxs("div",{className:"space-y-6 p-3",children:[w&&j.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(X,{className:"h-3 w-3 text-accent"}),e.jsx("span",{children:"Newest Models"})]}),e.jsx("div",{className:"space-y-1",children:j.map(r=>e.jsx(ce,{model:r,isSelected:r.id===s,onClick:()=>a(r.id),showAge:!0},r.id))})]}),Object.keys(H).map(r=>{const h=S[r];return h.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:H[r]}),e.jsx("div",{className:"space-y-1",children:h.map(n=>e.jsx(ce,{model:n,isSelected:n.id===s,onClick:()=>a(n.id)},n.id))})]},r)})]})})]})}function ce({model:s,isSelected:a,onClick:t,showAge:d=!1}){return e.jsxs("button",{type:"button",onClick:t,className:_("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",a&&"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:_("flex shrink-0 items-center gap-1 text-xs whitespace-nowrap",a?"text-accent-foreground/80":"text-muted-foreground group-hover:text-accent-foreground/80"),children:[d&&s.created&&e.jsx(k,{variant:"outline",className:_("text-[10px] px-1",a?"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:Le(s.created)}),s.isFree?e.jsx(k,{variant:"secondary",className:_("text-[10px] px-1",a?"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(k,{variant:"outline",className:_("text-[10px] px-1 border-emerald-500/50 text-emerald-600",a?"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:Y(s.pricing)})]}):e.jsx("span",{className:"tabular-nums",children:Y(s.pricing)}),e.jsx("span",{className:"tabular-nums",children:xe(s.context_length)})]})]})}function gs({selectedModel:s,value:a,onChange:t,className:d}){const{models:x}=de(),m=o.useMemo(()=>s?Ie(s,x):{},[s,x]),f=()=>{t(m)},l=(u,g)=>{t({...a,[u]:g||void 0})},i=s&&Object.keys(m).length>0;return e.jsxs(me,{className:_("group",d),children:[e.jsxs(ue,{className:"flex items-center gap-2 text-sm font-medium hover:underline",children:[e.jsx(ge,{className:"h-4 w-4 transition-transform group-data-[state=open]:rotate-90"}),"Model Tier Mapping",e.jsx("span",{className:"text-muted-foreground font-normal",children:"(Advanced)"})]}),e.jsxs(he,{className:"space-y-3 pt-3",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Configure different models for Claude Code's opus/sonnet/haiku tiers."}),i&&e.jsxs(N,{type:"button",variant:"outline",size:"sm",onClick:f,children:[e.jsx(as,{className:"mr-1 h-4 w-4"}),"Auto-suggest based on ",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(T,{htmlFor:"tier-opus",className:"text-right",children:"Opus"}),e.jsx(A,{id:"tier-opus",value:a.opus??"",onChange:u=>l("opus",u.target.value),placeholder:"e.g., anthropic/claude-opus-4"})]}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(T,{htmlFor:"tier-sonnet",className:"text-right",children:"Sonnet"}),e.jsx(A,{id:"tier-sonnet",value:a.sonnet??"",onChange:u=>l("sonnet",u.target.value),placeholder:"e.g., anthropic/claude-sonnet-4"})]}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(T,{htmlFor:"tier-haiku",className:"text-right",children:"Haiku"}),e.jsx(A,{id:"tier-haiku",value:a.haiku??"",onChange:u=>l("haiku",u.target.value),placeholder:"e.g., anthropic/claude-3.5-haiku"})]})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"These set ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL."})]})]})}function js({profileName:s,target:a,data:t,currentSettings:d,newEnvKey:x,newEnvValue:m,onNewEnvKeyChange:f,onNewEnvValueChange:l,onEnvValueChange:i,onAddEnvVar:u,onEnvBulkChange:g}){const O=we(d),b=d?.env,v=o.useMemo(()=>xs(b??{}),[b]),j=b??{},w=n=>{if(g){const P={...j,ANTHROPIC_MODEL:n,ANTHROPIC_DEFAULT_OPUS_MODEL:n,ANTHROPIC_DEFAULT_SONNET_MODEL:n,ANTHROPIC_DEFAULT_HAIKU_MODEL:n};g(P)}else i("ANTHROPIC_MODEL",n),i("ANTHROPIC_DEFAULT_OPUS_MODEL",n),i("ANTHROPIC_DEFAULT_SONNET_MODEL",n),i("ANTHROPIC_DEFAULT_HAIKU_MODEL",n);I.success("Applied model to all tiers",{duration:2e3})},S=n=>{if(g){const P=ms(j,n);g(P)}else n.opus!==void 0&&i("ANTHROPIC_DEFAULT_OPUS_MODEL",n.opus||""),n.sonnet!==void 0&&i("ANTHROPIC_DEFAULT_SONNET_MODEL",n.sonnet||""),n.haiku!==void 0&&i("ANTHROPIC_DEFAULT_HAIKU_MODEL",n.haiku||"")},[E,C]=o.useState(!1),r=new Set(["ANTHROPIC_AUTH_TOKEN"]),h=Object.entries(j).filter(([n])=>!r.has(n));return e.jsx("div",{className:"h-full w-full min-w-0 flex flex-col",children:e.jsxs(Ue,{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(He,{className:"w-full",children:[e.jsx(ae,{value:"env",className:"flex-1",children:O?"Configuration":"Environment Variables"}),e.jsx(ae,{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(ne,{value:"env",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden min-w-0",children:O?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(T,{className:"text-sm font-medium",children:"Model Selection"}),e.jsx(ps,{value:j.ANTHROPIC_MODEL,onChange:w,placeholder:"Search OpenRouter models..."})]}),e.jsx(gs,{selectedModel:j.ANTHROPIC_MODEL,value:v,onChange:S}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"API Key"}),e.jsx(Ce,{value:j.ANTHROPIC_AUTH_TOKEN||"",onChange:n=>i("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"})]})]}),h.length>0&&e.jsxs(me,{open:E,onOpenChange:C,children:[e.jsxs(ue,{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors group",children:[e.jsx(ge,{className:_("h-4 w-4 transition-transform",E&&"rotate-90")}),e.jsx(ns,{className:"h-4 w-4"}),e.jsx("span",{children:"Additional Variables"}),e.jsxs("span",{className:"text-xs font-normal opacity-70",children:["(",h.length,")"]})]}),e.jsx(he,{className:"pt-4",children:e.jsx("div",{className:"space-y-3 border rounded-lg p-3 bg-muted/30",children:h.map(([n,P])=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:n}),e.jsx(A,{value:P,onChange:M=>i(n,M.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(T,{className:"text-xs font-medium text-muted-foreground",children:"Add Environment Variable"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(A,{placeholder:"VARIABLE_NAME",value:x,onChange:n=>f(n.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:n=>n.key==="Enter"&&x.trim()&&u()}),e.jsx(A,{placeholder:"value",value:m,onChange:n=>l(n.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:n=>n.key==="Enter"&&x.trim()&&u()}),e.jsx(N,{variant:"outline",size:"sm",className:"h-8",onClick:u,disabled:!x.trim(),children:e.jsx($,{className:"w-4 h-4"})})]})]})]}):e.jsx(hs,{currentSettings:d,newEnvKey:x,newEnvValue:m,onNewEnvKeyChange:f,onNewEnvValueChange:l,onEnvValueChange:i,onAddEnvVar:u})}),e.jsx(ne,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(fs,{profileName:s,target:a,data:t})})]})]})})}function Ns({profileName:s,profileTarget:a,onDelete:t,onHasChangesUpdate:d}){const[x,m]=o.useState({}),[f,l]=o.useState(!1),[i,u]=o.useState(null),[g,O]=o.useState(""),[b,v]=o.useState(""),j=We(),{data:w,isLoading:S,isError:E,refetch:C}=Xe({queryKey:["settings",s],queryFn:async()=>{const c=await fetch(`/api/settings/${s}/raw`);if(!c.ok)throw new Error(`Failed to load settings: ${c.status}`);return c.json()}}),r=w?.settings,h=o.useMemo(()=>{if(i!==null)try{return JSON.parse(i)}catch{}if(r)return{...r,env:{...r.env,...x}}},[r,x,i]),n=o.useMemo(()=>i!==null?i:r?JSON.stringify(r,null,2):"",[i,r]),P=o.useCallback(c=>{u(c)},[]),M=(c,y)=>{const R={...h?.env||{},[c]:y};m(L=>({...L,[c]:y})),u(JSON.stringify({...h,env:R},null,2))},J=c=>{const y={...h?.env||{},...c};m(R=>({...R,...c})),u(JSON.stringify({...h,env:y},null,2))},p=()=>{if(!g.trim())return;const c=g.trim(),y=b,R={...h?.env||{},[c]:y};m(L=>({...L,[c]:y})),u(JSON.stringify({...h,env:R},null,2)),O(""),v("")},Z=o.useMemo(()=>{try{return JSON.parse(n),!0}catch{return!1}},[n]),B=o.useMemo(()=>i!==null?i!==JSON.stringify(r,null,2):Object.keys(x).length>0,[i,x,r]),ye=o.useMemo(()=>{const c=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"],y=h?.env||{};return c.filter(R=>!y[R]?.trim())},[h]);o.useEffect(()=>{d?.(B)},[B,d]);const U=re({mutationFn:async()=>{let c;try{c=JSON.parse(n)}catch{c={...w?.settings,env:{...w?.settings?.env,...x}}}const y=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:c,expectedMtime:w?.mtime})});if(y.status===409)throw new Error("CONFLICT");if(!y.ok)throw new Error("Failed to save");return y.json()},onSuccess:()=>{j.invalidateQueries({queryKey:["settings",s]}),j.invalidateQueries({queryKey:["profiles"]}),m({}),u(null),I.success("Settings saved")},onError:c=>{c.message==="CONFLICT"?l(!0):I.error(c.message)}}),Q=re({mutationFn:async c=>(await $e.profiles.update(s,{target:c}),c),onSuccess:()=>{j.invalidateQueries({queryKey:["profiles"]}),I.success("Default target updated")},onError:(c,y)=>{const R=y==="droid"?"Factory Droid":"Claude Code",L=c.message.trim()?`: ${c.message}`:"";I.error(`Failed to update default target to ${R}${L}`)}}),q=a||"claude",V=U.isPending||Q.isPending,ee=async c=>{l(!1),c?(await C(),U.mutate()):(m({}),u(null))};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(us,{profileName:s,target:q,data:w,settings:h,isLoading:S,isSaving:U.isPending,isTargetSaving:Q.isPending,hasChanges:B,isRawJsonValid:Z,onTargetChange:c=>{V||c!==q&&Q.mutate(c)},onRefresh:()=>{V||C()},onDelete:t,onSave:()=>{V||U.mutate()}}),S?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(F,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):E?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(N,{variant:"outline",size:"sm",onClick:()=>C(),children:[e.jsx(z,{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(js,{profileName:s,target:q,data:w,currentSettings:h,newEnvKey:g,newEnvValue:b,onNewEnvKeyChange:O,onNewEnvValueChange:v,onEnvValueChange:M,onEnvBulkChange:J,onAddEnvVar:p})}),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(rs,{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(Fe,{rawJsonContent:n,isRawJsonValid:Z,rawJsonEdits:i,settings:r,onChange:P,missingRequiredFields:ye})]})]}),e.jsx(G,{open:f,title:"File Modified Externally",description:"Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>ee(!0),onCancel:()=>ee(!1)})]},s)}const oe="ccs:openrouter-banner-dismissed";function vs({onCreateClick:s}){const[a,t]=o.useState(!0),{modelCount:d,isLoading:x}=W();o.useEffect(()=>{const f=localStorage.getItem(oe)==="true";t(f)},[]);const m=()=>{localStorage.setItem(oe,"true"),t(!0)};return a?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(X,{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 ",x?"300+":`${d}+`," models from OpenAI, Anthropic, Google, Meta and more."]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s&&e.jsx(N,{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(je,{className:"w-3 h-3"})]}),e.jsxs(N,{size:"icon",variant:"ghost",onClick:m,className:"h-7 w-7 text-white/70 hover:text-white hover:bg-white/20",children:[e.jsx(is,{className:"w-4 h-4"}),e.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})})}function bs({onOpenRouterClick:s,onCustomClick:a}){const{modelCount:t,isLoading:d}=W();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(Ke,{className:"border-accent/30 dark:border-accent/40 bg-gradient-to-br from-accent/5 to-background dark:from-accent/10",children:[e.jsxs(ze,{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(k,{variant:"secondary",className:"bg-accent/10 text-accent dark:bg-accent/20 dark:text-accent-foreground",children:"Recommended"})]}),e.jsx(Je,{className:"text-xl",children:"Start with OpenRouter"}),e.jsxs(Be,{className:"text-base",children:["Access ",d?"300+":`${t}+`," models from OpenAI, Anthropic, Google, Meta and more - all through one API."]})]}),e.jsxs(Qe,{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(Ne,{className:"w-4 h-4 text-accent"}),e.jsx("span",{children:"One API, all providers"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(X,{className:"w-4 h-4 text-accent"}),e.jsx("span",{children:"Model tier mapping"})]})]}),e.jsxs(N,{onClick:s,className:"w-full bg-accent hover:bg-accent/90 text-white",size:"lg",children:["Create OpenRouter Profile",e.jsx(ls,{className:"w-4 h-4 ml-2"})]}),e.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Get your API key at"," ",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(je,{className:"w-3 h-3"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ie,{className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx(ie,{className:"flex-1"})]}),e.jsx(N,{variant:"outline",onClick:a,className:"w-full",children:"Create Custom API Profile"})]})})}function ws({onCreateClick:s}){const{modelCount:a,isLoading:t}=W();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+":`${a}+`," models available"]})]}),e.jsxs(N,{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(Ne,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-xs",children:"Add"})]})]})})}function Ls(){const{data:s,isLoading:a,isError:t,refetch:d}=qe(),x=Ve(),[m,f]=o.useState(null),[l,i]=o.useState(""),[u,g]=o.useState(!1),[O,b]=o.useState("normal"),[v,j]=o.useState(null),[w,S]=o.useState(!1),[E,C]=o.useState(null);Ye();const r=o.useMemo(()=>s?.profiles||[],[s?.profiles]),h=o.useMemo(()=>r.filter(p=>p.name.toLowerCase().includes(l.toLowerCase())),[r,l]),n=m?r.find(p=>p.name===m):null,P=p=>{x.mutate(p,{onSuccess:()=>{m===p&&f(null),j(null)}})},M=p=>{g(!1),w&&m!==null?C(p):f(p)},J=p=>{w&&m!==p?C(p):f(p)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:[e.jsx(vs,{onCreateClick:()=>g(!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(cs,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"API Profiles"})]}),e.jsxs(N,{size:"sm",onClick:()=>{g(!0)},children:[e.jsx($,{className:"w-4 h-4 mr-1"}),"New"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(pe,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(A,{placeholder:"Search profiles...",className:"pl-8 h-9",value:l,onChange:p=>i(p.target.value)})]})]}),e.jsx(K,{className:"flex-1",children:a?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading profiles..."}):t?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(ve,{className:"w-12 h-12 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Failed to load profiles"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Unable to fetch API profiles. Please try again."})]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>d(),children:[e.jsx(z,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):h.length===0?e.jsx("div",{className:"p-4 text-center",children:r.length===0?e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(os,{className:"w-12 h-12 mx-auto text-muted-foreground/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"No API profiles yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Create your first profile to connect to custom API endpoints"})]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>{g(!0)},children:[e.jsx($,{className:"w-4 h-4 mr-1"}),"Create Profile"]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:['No profiles match "',l,'"']})}):e.jsx("div",{className:"p-2 space-y-1",children:h.map(p=>e.jsx(Cs,{profile:p,isSelected:m===p.name,onSelect:()=>J(p.name),onDelete:()=>j(p.name)},p.name))})}),r.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.jsxs("span",{children:[r.length," profile",r.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(be,{className:"w-3 h-3 text-green-600"}),r.filter(p=>p.configured).length," configured"]})]})}),e.jsx(ws,{onCreateClick:()=>{b("openrouter"),g(!0)}})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:n?e.jsx(Ns,{profileName:n.name,profileTarget:n.target,onDelete:()=>j(n.name),onHasChangesUpdate:S},n.name):e.jsx(bs,{onOpenRouterClick:()=>{b("openrouter"),g(!0)},onCustomClick:()=>{b("normal"),g(!0)}})})]}),e.jsx(Ge,{open:u,onOpenChange:g,onSuccess:M,initialMode:O}),e.jsx(G,{open:!!v,title:"Delete Profile",description:`Are you sure you want to delete "${v}"? This will remove the settings file and cannot be undone.`,confirmText:"Delete",variant:"destructive",onConfirm:()=>v&&P(v),onCancel:()=>j(null)}),e.jsx(G,{open:!!E,title:"Unsaved Changes",description:`You have unsaved changes in "${m}". Discard and switch to "${E}"?`,confirmText:"Discard & Switch",variant:"destructive",onConfirm:()=>{S(!1),f(E),C(null)},onCancel:()=>C(null)})]})}function Cs({profile:s,isSelected:a,onSelect:t,onDelete:d}){return e.jsxs("div",{className:_("group flex items-center gap-2 px-3 py-2.5 rounded-md cursor-pointer transition-colors",a?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:t,children:[s.configured?e.jsx(be,{className:"w-4 h-4 text-green-600 shrink-0"}):e.jsx(ve,{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(k,{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(D,{value:s.settingsPath,size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsx(N,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:x=>{x.stopPropagation(),d()},children:e.jsx(fe,{className:"w-3.5 h-3.5 text-destructive"})})]})}export{Ls as ApiPage};
|