@kaitranntt/ccs 7.39.0-dev.2 → 7.39.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/dist/cliproxy/config/extended-context-config.d.ts.map +1 -1
- package/dist/cliproxy/config/extended-context-config.js +17 -5
- package/dist/cliproxy/config/extended-context-config.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +4 -2
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/cliproxy/tool-sanitization-proxy.d.ts +1 -1
- package/dist/cliproxy/tool-sanitization-proxy.d.ts.map +1 -1
- package/dist/cliproxy/tool-sanitization-proxy.js +34 -5
- package/dist/cliproxy/tool-sanitization-proxy.js.map +1 -1
- package/dist/ui/assets/{accounts-ResKjvou.js → accounts-CauLPwhm.js} +1 -1
- package/dist/ui/assets/{alert-dialog-BnSvEwhd.js → alert-dialog-CnqWzqcb.js} +1 -1
- package/dist/ui/assets/{api-ClPWraVr.js → api-C8BAaArd.js} +1 -1
- package/dist/ui/assets/{auth-section-CZmgtezT.js → auth-section-oONPGRu9.js} +1 -1
- package/dist/ui/assets/{backups-section-CcQsXemH.js → backups-section-BiU2NC4P.js} +1 -1
- package/dist/ui/assets/{cliproxy-C0JgtLfO.js → cliproxy--HoyOGqW.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-CBO7xTqe.js → cliproxy-control-panel-CX1nJ7UW.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-Cjs1FPCy.js → confirm-dialog-DQNWHnTM.js} +1 -1
- package/dist/ui/assets/{copilot-DCA0pQV3.js → copilot-HhTGdwXH.js} +2 -2
- package/dist/ui/assets/{globalenv-section-D_GVHsDN.js → globalenv-section-DYVSsVRf.js} +1 -1
- package/dist/ui/assets/{health-riN3OSz-.js → health-D8FrkoFi.js} +1 -1
- package/dist/ui/assets/{index-BjiZGSfI.js → index-BrbxUDeK.js} +1 -1
- package/dist/ui/assets/{index-CK0URaBN.js → index-D-2xVPhY.js} +1 -1
- package/dist/ui/assets/{index-7gcYb5Oq.js → index-DDYIvYka.js} +2 -2
- package/dist/ui/assets/{index-sdtPg8Gr.js → index-DWuqNEbT.js} +1 -1
- package/dist/ui/assets/{index-BXTtPkoG.js → index-uaM_zTPt.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-B-LQxeOH.js → proxy-status-widget-Bf-pwG_G.js} +1 -1
- package/dist/ui/assets/{shared-PuUIRrgy.js → shared-CxCgaH3V.js} +1 -1
- package/dist/ui/assets/{switch-CCYYFslZ.js → switch-DgqWOtd_.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extended-context-config.d.ts","sourceRoot":"","sources":["../../../src/cliproxy/config/extended-context-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAO5C;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOhE;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,MAAM,EACf,uBAAuB,CAAC,EAAE,OAAO,GAChC,OAAO,CAsBT;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,CAAC,UAAU,EAC1B,QAAQ,EAAE,gBAAgB,EAC1B,uBAAuB,CAAC,EAAE,OAAO,GAChC,IAAI,
|
|
1
|
+
{"version":3,"file":"extended-context-config.d.ts","sourceRoot":"","sources":["../../../src/cliproxy/config/extended-context-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAO5C;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOhE;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,MAAM,EACf,uBAAuB,CAAC,EAAE,OAAO,GAChC,OAAO,CAsBT;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,CAAC,UAAU,EAC1B,QAAQ,EAAE,gBAAgB,EAC1B,uBAAuB,CAAC,EAAE,OAAO,GAChC,IAAI,CA2CN"}
|
|
@@ -74,7 +74,24 @@ function applyExtendedContextConfig(envVars, provider, extendedContextOverride)
|
|
|
74
74
|
// Get base model to check support (strip any existing suffixes for lookup)
|
|
75
75
|
const baseModel = envVars.ANTHROPIC_MODEL || '';
|
|
76
76
|
const cleanModelId = stripModelSuffixes(baseModel);
|
|
77
|
+
// Tier model env vars to apply/strip extended context suffix
|
|
78
|
+
const tierModels = [
|
|
79
|
+
'ANTHROPIC_DEFAULT_OPUS_MODEL',
|
|
80
|
+
'ANTHROPIC_DEFAULT_SONNET_MODEL',
|
|
81
|
+
'ANTHROPIC_DEFAULT_HAIKU_MODEL',
|
|
82
|
+
];
|
|
77
83
|
if (!shouldApplyExtendedContext(provider, cleanModelId, extendedContextOverride)) {
|
|
84
|
+
// Strip [1m] suffix from models that no longer support extended context
|
|
85
|
+
// (e.g., user had it enabled before backend dropped support)
|
|
86
|
+
if (envVars.ANTHROPIC_MODEL?.toLowerCase().endsWith('[1m]')) {
|
|
87
|
+
envVars.ANTHROPIC_MODEL = envVars.ANTHROPIC_MODEL.replace(/\[1m\]$/i, '');
|
|
88
|
+
}
|
|
89
|
+
for (const tierVar of tierModels) {
|
|
90
|
+
const model = envVars[tierVar];
|
|
91
|
+
if (model?.toLowerCase().endsWith('[1m]')) {
|
|
92
|
+
envVars[tierVar] = model.replace(/\[1m\]$/i, '');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
78
95
|
return;
|
|
79
96
|
}
|
|
80
97
|
// Apply suffix to main model
|
|
@@ -82,11 +99,6 @@ function applyExtendedContextConfig(envVars, provider, extendedContextOverride)
|
|
|
82
99
|
envVars.ANTHROPIC_MODEL = applyExtendedContextSuffix(envVars.ANTHROPIC_MODEL);
|
|
83
100
|
}
|
|
84
101
|
// Apply to tier models if they support extended context
|
|
85
|
-
const tierModels = [
|
|
86
|
-
'ANTHROPIC_DEFAULT_OPUS_MODEL',
|
|
87
|
-
'ANTHROPIC_DEFAULT_SONNET_MODEL',
|
|
88
|
-
'ANTHROPIC_DEFAULT_HAIKU_MODEL',
|
|
89
|
-
];
|
|
90
102
|
for (const tierVar of tierModels) {
|
|
91
103
|
const model = envVars[tierVar];
|
|
92
104
|
if (model) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extended-context-config.js","sourceRoot":"","sources":["../../../src/cliproxy/config/extended-context-config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,oDAAgF;AAChF,uCAAsC;AAEtC,wDAAwD;AACxD,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAEvC;;;;;;GAMG;AACH,SAAgB,0BAA0B,CAAC,KAAa;IACtD,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,2EAA2E;IAC3E,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACxE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,GAAG,KAAK,GAAG,uBAAuB,EAAE,CAAC;AAC9C,CAAC;AAPD,gEAOC;AAED;;;;;;;GAOG;AACH,SAAgB,0BAA0B,CACxC,QAA0B,EAC1B,OAAe,EACf,uBAAiC;IAEjC,mCAAmC;IACnC,IAAI,uBAAuB,KAAK,IAAI,EAAE,CAAC;QACrC,iCAAiC;QACjC,MAAM,SAAS,GAAG,IAAA,uCAAuB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,IAAA,SAAI,EAAC,UAAU,OAAO,uDAAuD,CAAC,CAAC,CAAC;QAChG,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,uBAAuB,KAAK,KAAK,EAAE,CAAC;QACtC,wCAAwC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,sDAAsD;IACtD,IAAI,IAAA,mCAAmB,EAAC,OAAO,CAAC,EAAE,CAAC;QACjC,OAAO,IAAA,uCAAuB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,0EAA0E;IAC1E,OAAO,KAAK,CAAC;AACf,CAAC;AA1BD,gEA0BC;AAED;;;;;;;GAOG;AACH,SAAgB,0BAA0B,CACxC,OAA0B,EAC1B,QAA0B,EAC1B,uBAAiC;IAEjC,2EAA2E;IAC3E,MAAM,SAAS,GAAG,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC;IAChD,MAAM,YAAY,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAEnD,IAAI,CAAC,0BAA0B,CAAC,QAAQ,EAAE,YAAY,EAAE,uBAAuB,CAAC,EAAE,CAAC;QACjF,OAAO;IACT,CAAC;IAED,6BAA6B;IAC7B,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC5B,OAAO,CAAC,eAAe,GAAG,0BAA0B,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAChF,CAAC;IAED,wDAAwD;
|
|
1
|
+
{"version":3,"file":"extended-context-config.js","sourceRoot":"","sources":["../../../src/cliproxy/config/extended-context-config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,oDAAgF;AAChF,uCAAsC;AAEtC,wDAAwD;AACxD,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAEvC;;;;;;GAMG;AACH,SAAgB,0BAA0B,CAAC,KAAa;IACtD,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,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AEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAGtF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAGpB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,MAAM,GACd,eAAe,GAAG,SAAS,CAG7B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,MAAM,GACd,eAAe,CAAC,UAAU,CAAC,GAAG,SAAS,CAGzC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAGrF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAG5F;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG5D"}
|
|
@@ -21,7 +21,7 @@ exports.MODEL_CATALOG = {
|
|
|
21
21
|
{
|
|
22
22
|
id: 'gemini-claude-opus-4-6-thinking',
|
|
23
23
|
name: 'Claude Opus 4.6 Thinking',
|
|
24
|
-
description: 'Latest flagship,
|
|
24
|
+
description: 'Latest flagship, extended thinking',
|
|
25
25
|
thinking: {
|
|
26
26
|
type: 'budget',
|
|
27
27
|
min: 1024,
|
|
@@ -29,7 +29,9 @@ exports.MODEL_CATALOG = {
|
|
|
29
29
|
zeroAllowed: true,
|
|
30
30
|
dynamicAllowed: true,
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
// TODO: Re-enable when Antigravity backend supports 1M context (currently 256k)
|
|
33
|
+
// extendedContext: true,
|
|
34
|
+
extendedContext: false,
|
|
33
35
|
},
|
|
34
36
|
{
|
|
35
37
|
id: 'gemini-claude-opus-4-5-thinking',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-catalog.js","sourceRoot":"","sources":["../../src/cliproxy/model-catalog.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA6DH;;;;GAIG;AACU,QAAA,aAAa,GAAuD;IAC/E,GAAG,EAAE;QACH,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE,iCAAiC;QAC/C,MAAM,EAAE;YACN;gBACE,EAAE,EAAE,iCAAiC;gBACrC,IAAI,EAAE,0BAA0B;gBAChC,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"model-catalog.js","sourceRoot":"","sources":["../../src/cliproxy/model-catalog.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA6DH;;;;GAIG;AACU,QAAA,aAAa,GAAuD;IAC/E,GAAG,EAAE;QACH,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE,iCAAiC;QAC/C,MAAM,EAAE;YACN;gBACE,EAAE,EAAE,iCAAiC;gBACrC,IAAI,EAAE,0BAA0B;gBAChC,WAAW,EAAE,oCAAoC;gBACjD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,GAAG,EAAE,IAAI;oBACT,GAAG,EAAE,MAAM;oBACX,WAAW,EAAE,IAAI;oBACjB,cAAc,EAAE,IAAI;iBACrB;gBACD,gFAAgF;gBAChF,yBAAyB;gBACzB,eAAe,EAAE,KAAK;aACvB;YACD;gBACE,EAAE,EAAE,iCAAiC;gBACrC,IAAI,EAAE,0BAA0B;gBAChC,WAAW,EAAE,sCAAsC;gBACnD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,GAAG,EAAE,IAAI;oBACT,GAAG,EAAE,MAAM;oBACX,WAAW,EAAE,KAAK;oBAClB,cAAc,EAAE,IAAI;iBACrB;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EAC1B,OAAe;IAEf,MAAM,QAAQ,GAAG,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5D,OAAO,QAAQ,EAAE,QAAQ,CAAC;AAC5B,CAAC;AAND,4CAMC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,QAA0B,EAAE,OAAe;IAC1E,MAAM,QAAQ,GAAG,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5D,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC;AAC5D,CAAC;AAHD,4CAGC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,QAA0B,EAAE,OAAe;IACjF,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3C,OAAO,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;AACzC,CAAC;AAHD,0DAGC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,OAAe;IACjD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACpC,OAAO,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;AAC5E,CAAC;AAHD,kDAGC"}
|
|
@@ -70,7 +70,7 @@ export declare class ToolSanitizationProxy {
|
|
|
70
70
|
/**
|
|
71
71
|
* Build a synthetic minimal SSE response when upstream returns empty content.
|
|
72
72
|
* Prevents Claude Code from crashing with "No assistant message found".
|
|
73
|
-
* Omits
|
|
73
|
+
* Omits lifecycle events that upstream already sent to avoid protocol violations.
|
|
74
74
|
*/
|
|
75
75
|
private buildSyntheticErrorResponse;
|
|
76
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-sanitization-proxy.d.ts","sourceRoot":"","sources":["../../src/cliproxy/tool-sanitization-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;G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C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAUD,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;gBAExB,MAAM,EAAE,2BAA2B;IAW/C;;OAEG;IACH,OAAO,CAAC,WAAW;IAoBnB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAkBhB,OAAO,CAAC,GAAG;IAMX,OAAO,CAAC,IAAI;IAMZ;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAmB9B;;OAEG;IACH,IAAI,IAAI,IAAI;IAOZ;;OAEG;IACH,OAAO,IAAI,MAAM,GAAG,IAAI;IAIxB,OAAO,CAAC,QAAQ;YAqBF,aAAa;IA+F3B,OAAO,CAAC,mBAAmB;IAmC3B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,UAAU;IA+BlB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAsE3B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAqK5B;;OAEG;IACH,OAAO,CAAC,eAAe;IAsDvB;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;CAiCpC"}
|
|
@@ -376,6 +376,8 @@ class ToolSanitizationProxy {
|
|
|
376
376
|
let hasReceivedContent = false;
|
|
377
377
|
let hasReceivedData = false;
|
|
378
378
|
let hasReceivedMessageStart = false;
|
|
379
|
+
let hasReceivedMessageDelta = false;
|
|
380
|
+
let hasReceivedMessageStop = false;
|
|
379
381
|
const isSuccessResponse = (upstreamRes.statusCode || 200) >= 200 && (upstreamRes.statusCode || 200) < 300;
|
|
380
382
|
// If no changes were made, intercept to detect empty responses.
|
|
381
383
|
// In the real failure case (issue #350), upstream sends message_start but
|
|
@@ -392,13 +394,19 @@ class ToolSanitizationProxy {
|
|
|
392
394
|
if (chunkStr.includes('"message_start"')) {
|
|
393
395
|
hasReceivedMessageStart = true;
|
|
394
396
|
}
|
|
397
|
+
if (chunkStr.includes('"message_delta"')) {
|
|
398
|
+
hasReceivedMessageDelta = true;
|
|
399
|
+
}
|
|
400
|
+
if (chunkStr.includes('"message_stop"')) {
|
|
401
|
+
hasReceivedMessageStop = true;
|
|
402
|
+
}
|
|
395
403
|
clientRes.write(chunk);
|
|
396
404
|
});
|
|
397
405
|
upstreamRes.on('end', () => {
|
|
398
406
|
try {
|
|
399
407
|
if (!hasReceivedContent && isSuccessResponse && hasReceivedData) {
|
|
400
408
|
this.writeLog('warn', '[tool-sanitization-proxy] Empty response detected from upstream (no content blocks). Injecting synthetic response to prevent client crash.');
|
|
401
|
-
clientRes.write(this.buildSyntheticErrorResponse(hasReceivedMessageStart));
|
|
409
|
+
clientRes.write(this.buildSyntheticErrorResponse(hasReceivedMessageStart, hasReceivedMessageDelta, hasReceivedMessageStop));
|
|
402
410
|
}
|
|
403
411
|
clientRes.end();
|
|
404
412
|
}
|
|
@@ -427,6 +435,12 @@ class ToolSanitizationProxy {
|
|
|
427
435
|
if (event.includes('"message_start"')) {
|
|
428
436
|
hasReceivedMessageStart = true;
|
|
429
437
|
}
|
|
438
|
+
if (event.includes('"message_delta"')) {
|
|
439
|
+
hasReceivedMessageDelta = true;
|
|
440
|
+
}
|
|
441
|
+
if (event.includes('"message_stop"')) {
|
|
442
|
+
hasReceivedMessageStop = true;
|
|
443
|
+
}
|
|
430
444
|
const processedEvent = this.processSSEEvent(event, mapper);
|
|
431
445
|
clientRes.write(processedEvent + '\n\n');
|
|
432
446
|
}
|
|
@@ -438,13 +452,22 @@ class ToolSanitizationProxy {
|
|
|
438
452
|
if (buffer.includes('"content_block_start"')) {
|
|
439
453
|
hasReceivedContent = true;
|
|
440
454
|
}
|
|
455
|
+
if (buffer.includes('"message_start"')) {
|
|
456
|
+
hasReceivedMessageStart = true;
|
|
457
|
+
}
|
|
458
|
+
if (buffer.includes('"message_delta"')) {
|
|
459
|
+
hasReceivedMessageDelta = true;
|
|
460
|
+
}
|
|
461
|
+
if (buffer.includes('"message_stop"')) {
|
|
462
|
+
hasReceivedMessageStop = true;
|
|
463
|
+
}
|
|
441
464
|
const processedEvent = this.processSSEEvent(buffer, mapper);
|
|
442
465
|
clientRes.write(processedEvent + '\n\n');
|
|
443
466
|
}
|
|
444
467
|
// Safety net: if upstream sent data but no content blocks, inject synthetic response
|
|
445
468
|
if (!hasReceivedContent && isSuccessResponse && hasReceivedData) {
|
|
446
469
|
this.writeLog('warn', '[tool-sanitization-proxy] Empty response detected from upstream (no content blocks). Injecting synthetic response to prevent client crash.');
|
|
447
|
-
clientRes.write(this.buildSyntheticErrorResponse(hasReceivedMessageStart));
|
|
470
|
+
clientRes.write(this.buildSyntheticErrorResponse(hasReceivedMessageStart, hasReceivedMessageDelta, hasReceivedMessageStop));
|
|
448
471
|
}
|
|
449
472
|
clientRes.end();
|
|
450
473
|
}
|
|
@@ -513,16 +536,22 @@ class ToolSanitizationProxy {
|
|
|
513
536
|
/**
|
|
514
537
|
* Build a synthetic minimal SSE response when upstream returns empty content.
|
|
515
538
|
* Prevents Claude Code from crashing with "No assistant message found".
|
|
516
|
-
* Omits
|
|
539
|
+
* Omits lifecycle events that upstream already sent to avoid protocol violations.
|
|
517
540
|
*/
|
|
518
|
-
buildSyntheticErrorResponse(upstreamSentMessageStart = false) {
|
|
541
|
+
buildSyntheticErrorResponse(upstreamSentMessageStart = false, upstreamSentMessageDelta = false, upstreamSentMessageStop = false) {
|
|
519
542
|
const events = [];
|
|
520
543
|
// Only include message_start if upstream didn't already send one
|
|
521
544
|
if (!upstreamSentMessageStart) {
|
|
522
545
|
const msgId = `msg_synthetic_${Date.now()}`;
|
|
523
546
|
events.push(`event: message_start\ndata: {"type":"message_start","message":{"id":"${msgId}","type":"message","role":"assistant","content":[],"model":"unknown","stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":0,"output_tokens":0}}}`);
|
|
524
547
|
}
|
|
525
|
-
events.push(`event: content_block_start\ndata: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}`, `event: content_block_delta\ndata: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"[Proxy Error] The upstream API returned an empty response. This typically occurs when the proxy drops unsigned thinking blocks during sub-agent execution. Please retry the request."}}`, `event: content_block_stop\ndata: {"type":"content_block_stop","index":0}
|
|
548
|
+
events.push(`event: content_block_start\ndata: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}`, `event: content_block_delta\ndata: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"[Proxy Error] The upstream API returned an empty response. This typically occurs when the proxy drops unsigned thinking blocks during sub-agent execution. Please retry the request."}}`, `event: content_block_stop\ndata: {"type":"content_block_stop","index":0}`);
|
|
549
|
+
if (!upstreamSentMessageDelta) {
|
|
550
|
+
events.push(`event: message_delta\ndata: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":0,"output_tokens":0}}`);
|
|
551
|
+
}
|
|
552
|
+
if (!upstreamSentMessageStop) {
|
|
553
|
+
events.push(`event: message_stop\ndata: {"type":"message_stop"}`);
|
|
554
|
+
}
|
|
526
555
|
return events.join('\n\n') + '\n\n';
|
|
527
556
|
}
|
|
528
557
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-sanitization-proxy.js","sourceRoot":"","sources":["../../src/cliproxy/tool-sanitization-proxy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,6CAA+B;AAC/B,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,6BAA0B;AAC1B,yDAAkF;AAClF,yDAAyD;AACzD,4DAAoD;AAapD;;;GAGG;AACH,SAAS,QAAQ,CAAC,KAAc;I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B,MAAM,CAAC,IAAI,CACT,2JAA2J,CAC5J,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACtC,CAAC;CACF;AA7nBD,sDA6nBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as p}from"./react-vendor-CNOkPC89.js";import{u as D,a as b,b as N,d as A,f as y,g as T}from"./tanstack-De4wvi8X.js";import{c as m,ae as f,b as d,a4 as k,a5 as R,a6 as S,a7 as z,a8 as P,L as C,I as q}from"./index-
|
|
1
|
+
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as p}from"./react-vendor-CNOkPC89.js";import{u as D,a as b,b as N,d as A,f as y,g as T}from"./tanstack-De4wvi8X.js";import{c as m,ae as f,b as d,a4 as k,a5 as R,a6 as S,a7 as z,a8 as P,L as C,I as q}from"./index-DDYIvYka.js";import{A as F,a as _,b as K,c as L,d as M,e as $,f as E,g as H}from"./alert-dialog-CnqWzqcb.js";import{t as u}from"./notifications-B2HqRBj7.js";import{v as Q,j,ag as O,y as I,l as v,$ as B}from"./icons-D5eAI-GR.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";function U({className:t,...s}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:m("w-full caption-bottom text-sm",t),...s})})}function V({className:t,...s}){return e.jsx("thead",{"data-slot":"table-header",className:m("[&_tr]:border-b",t),...s})}function Z({className:t,...s}){return e.jsx("tbody",{"data-slot":"table-body",className:m("[&_tr:last-child]:border-0",t),...s})}function w({className:t,...s}){return e.jsx("tr",{"data-slot":"table-row",className:m("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...s})}function G({className:t,...s}){return e.jsx("th",{"data-slot":"table-head",className:m("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function J({className:t,...s}){return e.jsx("td",{"data-slot":"table-cell",className:m("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function W(){return D({queryKey:["accounts"],queryFn:()=>f.accounts.list()})}function X(){const t=b();return N({mutationFn:s=>f.accounts.setDefault(s),onSuccess:(s,l)=>{t.invalidateQueries({queryKey:["accounts"]}),u.success(`Default account set to "${l}"`)},onError:s=>{u.error(s.message)}})}function Y(){const t=b();return N({mutationFn:()=>f.accounts.resetDefault(),onSuccess:()=>{t.invalidateQueries({queryKey:["accounts"]}),u.success("Default account reset to CCS")},onError:s=>{u.error(s.message)}})}function ee(){const t=b();return N({mutationFn:s=>f.accounts.delete(s),onSuccess:(s,l)=>{t.invalidateQueries({queryKey:["accounts"]}),u.success(`Account "${l}" deleted`)},onError:s=>{u.error(s.message)}})}function se({data:t,defaultAccount:s}){const l=X(),i=ee(),r=Y(),[c,o]=p.useState(null),x=A({data:t,columns:[{accessorKey:"name",header:"Name",size:200,cell:({row:a})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:a.original.name}),a.original.name===s&&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:a})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:a.original.type||"oauth"})},{accessorKey:"created",header:"Created",size:150,cell:({row:a})=>{const n=new Date(a.original.created);return e.jsx("span",{className:"text-muted-foreground",children:n.toLocaleDateString()})}},{accessorKey:"last_used",header:"Last Used",size:150,cell:({row:a})=>{if(!a.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const n=new Date(a.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:n.toLocaleDateString()})}},{id:"actions",header:"Actions",size:180,cell:({row:a})=>{const n=a.original.name===s,h=l.isPending||i.isPending;return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(d,{variant:n?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:n||h,onClick:()=>l.mutate(a.original.name),children:[e.jsx(j,{className:`w-3 h-3 mr-1 ${n?"opacity-50":""}`}),n?"Active":"Set Default"]}),e.jsx(d,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:n||h,onClick:()=>o(a.original.name),title:n?"Cannot delete default account":"Delete account",children:e.jsx(O,{className:"w-4 h-4"})})]})}}],getCoreRowModel:T()});return t.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(U,{children:[e.jsx(V,{children:x.getHeaderGroups().map(a=>e.jsx(w,{children:a.headers.map(n=>{const h={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",actions:"w-[180px]"}[n.id]||"w-auto";return e.jsx(G,{className:h,children:n.isPlaceholder?null:y(n.column.columnDef.header,n.getContext())},n.id)})},a.id))}),e.jsx(Z,{children:x.getRowModel().rows.map(a=>e.jsx(w,{children:a.getVisibleCells().map(n=>e.jsx(J,{children:y(n.column.columnDef.cell,n.getContext())},n.id))},a.id))})]})}),s&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(d,{variant:"outline",size:"sm",onClick:()=>r.mutate(),disabled:r.isPending,children:[e.jsx(Q,{className:"w-4 h-4 mr-2"}),"Reset to CCS Default"]})})]}),e.jsx(F,{open:!!c,onOpenChange:a=>!a&&o(null),children:e.jsxs(_,{children:[e.jsxs(K,{children:[e.jsx(L,{children:"Delete Account"}),e.jsxs(M,{children:['Are you sure you want to delete the account "',c,'"? This will remove the profile and all its session data. This action cannot be undone.']})]}),e.jsxs($,{children:[e.jsx(E,{children:"Cancel"}),e.jsx(H,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{c&&(i.mutate(c),o(null))},children:"Delete"})]})]})})]})}function te({open:t,onClose:s}){const[l,i]=p.useState(""),[r,c]=p.useState(!1),o=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(l),g=l?`ccs auth create ${l}`:"ccs auth create <name>",x=async()=>{o&&(await navigator.clipboard.writeText(g),c(!0),setTimeout(()=>c(!1),2e3))},a=()=>{i(""),c(!1),s()};return e.jsx(k,{open:t,onOpenChange:n=>!n&&a(),children:e.jsxs(R,{className:"sm:max-w-md",children:[e.jsxs(S,{children:[e.jsx(z,{children:"Create New Account"}),e.jsx(P,{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(C,{htmlFor:"profile-name",children:"Profile Name"}),e.jsx(q,{id:"profile-name",value:l,onChange:n=>i(n.target.value),placeholder:"e.g., work, personal, client",autoComplete:"off"}),l&&!o&&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-2",children:[e.jsx(C,{children:"Command"}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(I,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:g}),e.jsx(d,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:x,disabled:!o,children:r?e.jsx(j,{className:"w-4 h-4 text-green-500"}):e.jsx(v,{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(d,{variant:"ghost",onClick:a,children:"Close"}),e.jsx(d,{onClick:x,disabled:!o,children:r?e.jsxs(e.Fragment,{children:[e.jsx(j,{className:"w-4 h-4 mr-2"}),"Copied!"]}):e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"w-4 h-4 mr-2"}),"Copy Command"]})})]})]})]})})}function xe(){const{data:t,isLoading:s,refetch:l}=W(),[i,r]=p.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(d,{onClick:()=>r(!0),children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),"Create Account"]})]}),s?e.jsx("div",{className:"text-muted-foreground",children:"Loading accounts..."}):e.jsx(se,{data:t?.accounts||[],defaultAccount:t?.default??null,onRefresh:l}),e.jsx(te,{open:i,onClose:()=>r(!1)})]})}export{xe 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-qEZD5MMp.js";import"./react-vendor-CNOkPC89.js";import{c as o,a_ as l}from"./index-
|
|
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-qEZD5MMp.js";import"./react-vendor-CNOkPC89.js";import{c as o,a_ as l}from"./index-DDYIvYka.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{B as S,c as E,T as Ne,o as ve,p as be,b as g,I as y,m as I,L as T,q as M,r as ne,s as we,t as Ce,v as ye,w as Oe,S as W,x as L,y as $,z as re,A as Ae,D as Ee,E as ie,F as le,G as ce,H as Te,J as _e,K as X,M as Z,R as ke,N as q,C as Se,i as Re,j as Pe,O as Le,a as Me,Q as De,U as Ie,V as Ue,W as He}from"./index-7gcYb5Oq.js";import{a as Fe,u as Ke,b as ze}from"./tanstack-De4wvi8X.js";import{C as B,S as ee}from"./confirm-dialog-Cjs1FPCy.js";import{t as Q}from"./notifications-B2HqRBj7.js";import{R as U,ag as oe,L as G,ah as Je,E as $e,d as Be,$ as D,I as Qe,ai as de,a0 as V,b as xe,aj as qe,_ as Ge,ak as Ve,m as me,X as Ye,Z as ue,al as We,a4 as Xe,a1 as he,am as Ze,q as fe}from"./icons-D5eAI-GR.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-BnSvEwhd.js";function es({className:s,showTooltip:t=!0}){const i=e.jsxs(S,{variant:"outline",className:E("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 t?e.jsxs(Ne,{children:[e.jsx(ve,{asChild:!0,children:i}),e.jsx(be,{children:e.jsx("p",{children:"Access 349+ models via OpenRouter"})})]}):i}function se(s){return[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/^API_KEY$/,/^AUTH_TOKEN$/,/_SECRET$/,/^SECRET$/].some(i=>i.test(s))}function pe(s){return s?.env?(s.env.ANTHROPIC_BASE_URL||"").toLowerCase().includes("openrouter.ai"):!1}function ss(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 ts(s,t){const i={...s};return t.opus?i.ANTHROPIC_DEFAULT_OPUS_MODEL=t.opus:delete i.ANTHROPIC_DEFAULT_OPUS_MODEL,t.sonnet?i.ANTHROPIC_DEFAULT_SONNET_MODEL=t.sonnet:delete i.ANTHROPIC_DEFAULT_SONNET_MODEL,t.haiku?i.ANTHROPIC_DEFAULT_HAIKU_MODEL=t.haiku:delete i.ANTHROPIC_DEFAULT_HAIKU_MODEL,i}function as({profileName:s,data:t,settings:i,isLoading:l,isSaving:d,hasChanges:f,isRawJsonValid:x,onRefresh:n,onDelete:o,onSave:m}){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(S,{variant:"outline",className:"text-xs",children:t.path.replace(/^.*\//,"")}),pe(i)&&e.jsx(es,{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:"flex items-center gap-2",children:[e.jsx(g,{variant:"ghost",size:"sm",onClick:n,disabled:l,children:e.jsx(U,{className:`w-4 h-4 ${l?"animate-spin":""}`})}),o&&e.jsx(g,{variant:"ghost",size:"sm",onClick:o,children:e.jsx(oe,{className:"w-4 h-4 text-destructive"})}),e.jsx(g,{size:"sm",onClick:m,disabled:d||!f||!x,children:d?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function ge({label:s,...t}){const[i,l]=c.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(y,{type:i?"text":"password",className:"pr-10 font-mono",...t}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>l(!i),tabIndex:-1,children:i?e.jsx($e,{className:"w-4 h-4"}):e.jsx(Be,{className:"w-4 h-4"})})]})]})}function ns({currentSettings:s,newEnvKey:t,newEnvValue:i,onNewEnvKeyChange:l,onNewEnvValueChange:d,onEnvValueChange:f,onAddEnvVar:x}){return e.jsxs(e.Fragment,{children:[e.jsx(I,{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(([n,o])=>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:[n,se(n)&&e.jsx(S,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:"sensitive"})]}),se(n)?e.jsx(ge,{value:o,onChange:m=>f(n,m.target.value),className:"font-mono text-sm h-8"}):e.jsx(y,{value:o,onChange:m=>f(n,m.target.value),className:"font-mono text-sm h-8"})]},n))}):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(y,{placeholder:"VARIABLE_NAME",value:t,onChange:n=>l(n.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:n=>n.key==="Enter"&&t.trim()&&x()}),e.jsx(y,{placeholder:"value",value:i,onChange:n=>d(n.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:n=>n.key==="Enter"&&t.trim()&&x()}),e.jsx(g,{variant:"outline",size:"sm",className:"h-8",onClick:x,disabled:!t.trim(),children:e.jsx(D,{className:"w-4 h-4"})})]})]})]})}function rs({profileName:s,data:t}){return e.jsx(I,{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(Qe,{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(M,{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",{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(M,{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:"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(M,{value:`ccs default ${s}`,size:"icon",className:"h-6 w-6"})]})]})]})]})]})})}function is({value:s,onChange:t,placeholder:i="Search models...",className:l}){const[d,f]=c.useState(""),[x,n]=c.useState(null),{models:o,isLoading:m,isError:j,isFetching:O}=ne(),A=we(),N=c.useMemo(()=>Ce(o,d,{category:x??void 0}),[o,d,x]),b=c.useMemo(()=>ye(o,2),[o]),k=!d.trim()&&!x,_=c.useMemo(()=>{const r={anthropic:[],openai:[],google:[],meta:[],mistral:[],opensource:[],other:[]};N.forEach(a=>{r[a.category].push(a)});for(const a of Object.keys(r))r[a]=Oe(r[a]);return r},[N]),C=c.useCallback(()=>{A()},[A]),p=o.find(r=>r.id===s);return m&&o.length===0?e.jsxs("div",{className:E("space-y-2",l),children:[e.jsx(W,{className:"h-10 w-full"}),e.jsx(W,{className:"h-32 w-full"})]}):e.jsxs("div",{className:E("space-y-2 w-full min-w-0 overflow-hidden",l),children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(de,{className:"text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2"}),e.jsx(y,{value:d,onChange:r=>f(r.target.value),placeholder:i,className:"pl-9"})]}),e.jsx(g,{variant:"outline",size:"icon",onClick:C,disabled:O,title:"Refresh models",children:O?e.jsx(G,{className:"h-4 w-4 animate-spin"}):e.jsx(U,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs(S,{variant:x===null?"default":"outline",className:"cursor-pointer",onClick:()=>n(null),children:["All (",o.length,")"]}),Object.keys(L).map(r=>{const a=_[r].length;return a===0?null:e.jsxs(S,{variant:x===r?"default":"outline",className:"cursor-pointer",onClick:()=>n(r),children:[L[r]," (",a,")"]},r)})]}),p&&e.jsxs("div",{className:"bg-muted rounded-md p-2 text-sm",children:[e.jsx("span",{className:"font-medium",children:p.name}),e.jsxs("span",{className:"text-muted-foreground ml-2",children:[$(p.pricing)," |"," ",re(p.context_length)]})]}),e.jsx(I,{className:"h-72 w-full rounded-md border",children:j?e.jsxs("div",{className:"text-destructive p-4 text-center",children:["Failed to load models."," ",e.jsx(g,{variant:"link",onClick:C,children:"Retry"})]}):N.length===0?e.jsxs("div",{className:"text-muted-foreground p-4 text-center",children:['No models found matching "',d,'"']}):e.jsxs("div",{className:"space-y-6 p-3",children:[k&&b.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(V,{className:"h-3 w-3 text-accent"}),e.jsx("span",{children:"Newest Models"})]}),e.jsx("div",{className:"space-y-1",children:b.map(r=>e.jsx(te,{model:r,isSelected:r.id===s,onClick:()=>t(r.id),showAge:!0},r.id))})]}),Object.keys(L).map(r=>{const a=_[r];return a.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:L[r]}),e.jsx("div",{className:"space-y-1",children:a.map(v=>e.jsx(te,{model:v,isSelected:v.id===s,onClick:()=>t(v.id)},v.id))})]},r)})]})})]})}function te({model:s,isSelected:t,onClick:i,showAge:l=!1}){return e.jsxs("button",{type:"button",onClick:i,className:E("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",t&&"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:E("flex shrink-0 items-center gap-1 text-xs whitespace-nowrap",t?"text-accent-foreground/80":"text-muted-foreground group-hover:text-accent-foreground/80"),children:[l&&s.created&&e.jsx(S,{variant:"outline",className:E("text-[10px] px-1",t?"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:Ae(s.created)}),s.isFree?e.jsx(S,{variant:"secondary",className:E("text-[10px] px-1",t?"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(S,{variant:"outline",className:E("text-[10px] px-1 border-emerald-500/50 text-emerald-600",t?"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:$(s.pricing)})]}):e.jsx("span",{className:"tabular-nums",children:$(s.pricing)}),e.jsx("span",{className:"tabular-nums",children:re(s.context_length)})]})]})}function ls({selectedModel:s,value:t,onChange:i,className:l}){const{models:d}=ne(),f=c.useMemo(()=>s?Ee(s,d):{},[s,d]),x=()=>{i(f)},n=(m,j)=>{i({...t,[m]:j||void 0})},o=s&&Object.keys(f).length>0;return e.jsxs(ie,{className:E("group",l),children:[e.jsxs(le,{className:"flex items-center gap-2 text-sm font-medium hover:underline",children:[e.jsx(xe,{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(ce,{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."}),o&&e.jsxs(g,{type:"button",variant:"outline",size:"sm",onClick:x,children:[e.jsx(qe,{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(y,{id:"tier-opus",value:t.opus??"",onChange:m=>n("opus",m.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(y,{id:"tier-sonnet",value:t.sonnet??"",onChange:m=>n("sonnet",m.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(y,{id:"tier-haiku",value:t.haiku??"",onChange:m=>n("haiku",m.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 cs({profileName:s,data:t,currentSettings:i,newEnvKey:l,newEnvValue:d,onNewEnvKeyChange:f,onNewEnvValueChange:x,onEnvValueChange:n,onAddEnvVar:o,onEnvBulkChange:m}){const j=pe(i),O=i?.env,A=c.useMemo(()=>ss(O??{}),[O]),N=O??{},b=a=>{if(m){const v={...N,ANTHROPIC_MODEL:a,ANTHROPIC_DEFAULT_OPUS_MODEL:a,ANTHROPIC_DEFAULT_SONNET_MODEL:a,ANTHROPIC_DEFAULT_HAIKU_MODEL:a};m(v)}else n("ANTHROPIC_MODEL",a),n("ANTHROPIC_DEFAULT_OPUS_MODEL",a),n("ANTHROPIC_DEFAULT_SONNET_MODEL",a),n("ANTHROPIC_DEFAULT_HAIKU_MODEL",a);Q.success("Applied model to all tiers",{duration:2e3})},k=a=>{if(m){const v=ts(N,a);m(v)}else a.opus!==void 0&&n("ANTHROPIC_DEFAULT_OPUS_MODEL",a.opus||""),a.sonnet!==void 0&&n("ANTHROPIC_DEFAULT_SONNET_MODEL",a.sonnet||""),a.haiku!==void 0&&n("ANTHROPIC_DEFAULT_HAIKU_MODEL",a.haiku||"")},[_,C]=c.useState(!1),p=new Set(["ANTHROPIC_AUTH_TOKEN"]),r=Object.entries(N).filter(([a])=>!p.has(a));return e.jsx("div",{className:"h-full w-full min-w-0 flex flex-col",children:e.jsxs(Te,{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(_e,{className:"w-full",children:[e.jsx(X,{value:"env",className:"flex-1",children:j?"Configuration":"Environment Variables"}),e.jsx(X,{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(Z,{value:"env",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden min-w-0",children:j?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(is,{value:N.ANTHROPIC_MODEL,onChange:b,placeholder:"Search OpenRouter models..."})]}),e.jsx(ls,{selectedModel:N.ANTHROPIC_MODEL,value:A,onChange:k}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"API Key"}),e.jsx(ge,{value:N.ANTHROPIC_AUTH_TOKEN||"",onChange:a=>n("ANTHROPIC_AUTH_TOKEN",a.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"})]})]}),r.length>0&&e.jsxs(ie,{open:_,onOpenChange:C,children:[e.jsxs(le,{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors group",children:[e.jsx(xe,{className:E("h-4 w-4 transition-transform",_&&"rotate-90")}),e.jsx(Ge,{className:"h-4 w-4"}),e.jsx("span",{children:"Additional Variables"}),e.jsxs("span",{className:"text-xs font-normal opacity-70",children:["(",r.length,")"]})]}),e.jsx(ce,{className:"pt-4",children:e.jsx("div",{className:"space-y-3 border rounded-lg p-3 bg-muted/30",children:r.map(([a,v])=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:a}),e.jsx(y,{value:v,onChange:P=>n(a,P.target.value),className:"font-mono text-xs h-8"})]},a))})})]})]})}),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(y,{placeholder:"VARIABLE_NAME",value:l,onChange:a=>f(a.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:a=>a.key==="Enter"&&l.trim()&&o()}),e.jsx(y,{placeholder:"value",value:d,onChange:a=>x(a.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:a=>a.key==="Enter"&&l.trim()&&o()}),e.jsx(g,{variant:"outline",size:"sm",className:"h-8",onClick:o,disabled:!l.trim(),children:e.jsx(D,{className:"w-4 h-4"})})]})]})]}):e.jsx(ns,{currentSettings:i,newEnvKey:l,newEnvValue:d,onNewEnvKeyChange:f,onNewEnvValueChange:x,onEnvValueChange:n,onAddEnvVar:o})}),e.jsx(Z,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(rs,{profileName:s,data:t})})]})]})})}function os({profileName:s,onDelete:t,onHasChangesUpdate:i}){const[l,d]=c.useState({}),[f,x]=c.useState(!1),[n,o]=c.useState(null),[m,j]=c.useState(""),[O,A]=c.useState(""),N=Fe(),{data:b,isLoading:k,isError:_,refetch:C}=Ke({queryKey:["settings",s],queryFn:async()=>{const h=await fetch(`/api/settings/${s}/raw`);if(!h.ok)throw new Error(`Failed to load settings: ${h.status}`);return h.json()}}),p=b?.settings,r=c.useMemo(()=>{if(n!==null)try{return JSON.parse(n)}catch{}if(p)return{...p,env:{...p.env,...l}}},[p,l,n]),a=c.useMemo(()=>n!==null?n:p?JSON.stringify(p,null,2):"",[n,p]),v=c.useCallback(h=>{o(h)},[]),P=(h,w)=>{const R={...r?.env||{},[h]:w};d(J=>({...J,[h]:w})),o(JSON.stringify({...r,env:R},null,2))},H=h=>{const w={...r?.env||{},...h};d(R=>({...R,...h})),o(JSON.stringify({...r,env:w},null,2))},F=()=>{if(!m.trim())return;const h=m.trim(),w=O,R={...r?.env||{},[h]:w};d(J=>({...J,[h]:w})),o(JSON.stringify({...r,env:R},null,2)),j(""),A("")},u=c.useMemo(()=>{try{return JSON.parse(a),!0}catch{return!1}},[a]),K=c.useMemo(()=>n!==null?n!==JSON.stringify(p,null,2):Object.keys(l).length>0,[n,l,p]),je=c.useMemo(()=>{const h=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"],w=r?.env||{};return h.filter(R=>!w[R]?.trim())},[r]);c.useEffect(()=>{i?.(K)},[K,i]);const z=ze({mutationFn:async()=>{let h;try{h=JSON.parse(a)}catch{h={...b?.settings,env:{...b?.settings?.env,...l}}}const w=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:h,expectedMtime:b?.mtime})});if(w.status===409)throw new Error("CONFLICT");if(!w.ok)throw new Error("Failed to save");return w.json()},onSuccess:()=>{N.invalidateQueries({queryKey:["settings",s]}),N.invalidateQueries({queryKey:["profiles"]}),d({}),o(null),Q.success("Settings saved")},onError:h=>{h.message==="CONFLICT"?x(!0):Q.error(h.message)}}),Y=async h=>{x(!1),h?(await C(),z.mutate()):(d({}),o(null))};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(as,{profileName:s,data:b,settings:r,isLoading:k,isSaving:z.isPending,hasChanges:K,isRawJsonValid:u,onRefresh:()=>C(),onDelete:t,onSave:()=>z.mutate()}),k?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(G,{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(g,{variant:"outline",size:"sm",onClick:()=>C(),children:[e.jsx(U,{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(cs,{profileName:s,data:b,currentSettings:r,newEnvKey:m,newEnvValue:O,onNewEnvKeyChange:j,onNewEnvValueChange:A,onEnvValueChange:P,onEnvBulkChange:H,onAddEnvVar:F})}),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(Ve,{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(ke,{rawJsonContent:a,isRawJsonValid:u,rawJsonEdits:n,settings:p,onChange:v,missingRequiredFields:je})]})]}),e.jsx(B,{open:f,title:"File Modified Externally",description:"Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>Y(!0),onCancel:()=>Y(!1)})]},s)}const ae="ccs:openrouter-banner-dismissed";function ds({onCreateClick:s}){const[t,i]=c.useState(!0),{modelCount:l,isLoading:d}=q();c.useEffect(()=>{const x=localStorage.getItem(ae)==="true";i(x)},[]);const f=()=>{localStorage.setItem(ae,"true"),i(!0)};return t?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(V,{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 ",d?"300+":`${l}+`," models from OpenAI, Anthropic, Google, Meta and more."]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s&&e.jsx(g,{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(me,{className:"w-3 h-3"})]}),e.jsxs(g,{size:"icon",variant:"ghost",onClick:f,className:"h-7 w-7 text-white/70 hover:text-white hover:bg-white/20",children:[e.jsx(Ye,{className:"w-4 h-4"}),e.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})})}function xs({onOpenRouterClick:s,onCustomClick:t}){const{modelCount:i,isLoading:l}=q();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(Se,{className:"border-accent/30 dark:border-accent/40 bg-gradient-to-br from-accent/5 to-background dark:from-accent/10",children:[e.jsxs(Re,{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(S,{variant:"secondary",className:"bg-accent/10 text-accent dark:bg-accent/20 dark:text-accent-foreground",children:"Recommended"})]}),e.jsx(Pe,{className:"text-xl",children:"Start with OpenRouter"}),e.jsxs(Le,{className:"text-base",children:["Access ",l?"300+":`${i}+`," models from OpenAI, Anthropic, Google, Meta and more - all through one API."]})]}),e.jsxs(Me,{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(ue,{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(V,{className:"w-4 h-4 text-accent"}),e.jsx("span",{children:"Model tier mapping"})]})]}),e.jsxs(g,{onClick:s,className:"w-full bg-accent hover:bg-accent/90 text-white",size:"lg",children:["Create OpenRouter Profile",e.jsx(We,{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(me,{className:"w-3 h-3"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ee,{className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx(ee,{className:"flex-1"})]}),e.jsx(g,{variant:"outline",onClick:t,className:"w-full",children:"Create Custom API Profile"})]})})}function ms({onCreateClick:s}){const{modelCount:t,isLoading:i}=q();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:[i?"300+":`${t}+`," models available"]})]}),e.jsxs(g,{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(ue,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-xs",children:"Add"})]})]})})}function Os(){const{data:s,isLoading:t,isError:i,refetch:l}=De(),d=Ie(),[f,x]=c.useState(null),[n,o]=c.useState(""),[m,j]=c.useState(!1),[O,A]=c.useState("normal"),[N,b]=c.useState(null),[k,_]=c.useState(!1),[C,p]=c.useState(null);Ue();const r=c.useMemo(()=>s?.profiles||[],[s?.profiles]),a=c.useMemo(()=>r.filter(u=>u.name.toLowerCase().includes(n.toLowerCase())),[r,n]),v=f?r.find(u=>u.name===f):null,P=u=>{d.mutate(u,{onSuccess:()=>{f===u&&x(null),b(null)}})},H=u=>{j(!1),k&&f!==null?p(u):x(u)},F=u=>{k&&f!==u?p(u):x(u)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:[e.jsx(ds,{onCreateClick:()=>j(!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(Xe,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"API Profiles"})]}),e.jsxs(g,{size:"sm",onClick:()=>{j(!0)},children:[e.jsx(D,{className:"w-4 h-4 mr-1"}),"New"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(de,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(y,{placeholder:"Search profiles...",className:"pl-8 h-9",value:n,onChange:u=>o(u.target.value)})]})]}),e.jsx(I,{className:"flex-1",children:t?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading profiles..."}):i?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(he,{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(g,{size:"sm",variant:"outline",onClick:()=>l(),children:[e.jsx(U,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):a.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(Ze,{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(g,{size:"sm",variant:"outline",onClick:()=>{j(!0)},children:[e.jsx(D,{className:"w-4 h-4 mr-1"}),"Create Profile"]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:['No profiles match "',n,'"']})}):e.jsx("div",{className:"p-2 space-y-1",children:a.map(u=>e.jsx(us,{profile:u,isSelected:f===u.name,onSelect:()=>F(u.name),onDelete:()=>b(u.name)},u.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(fe,{className:"w-3 h-3 text-green-600"}),r.filter(u=>u.configured).length," configured"]})]})}),e.jsx(ms,{onCreateClick:()=>{A("openrouter"),j(!0)}})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:v?e.jsx(os,{profileName:v.name,onDelete:()=>b(v.name),onHasChangesUpdate:_},v.name):e.jsx(xs,{onOpenRouterClick:()=>{A("openrouter"),j(!0)},onCustomClick:()=>{A("normal"),j(!0)}})})]}),e.jsx(He,{open:m,onOpenChange:j,onSuccess:H,initialMode:O}),e.jsx(B,{open:!!N,title:"Delete Profile",description:`Are you sure you want to delete "${N}"? This will remove the settings file and cannot be undone.`,confirmText:"Delete",variant:"destructive",onConfirm:()=>N&&P(N),onCancel:()=>b(null)}),e.jsx(B,{open:!!C,title:"Unsaved Changes",description:`You have unsaved changes in "${f}". Discard and switch to "${C}"?`,confirmText:"Discard & Switch",variant:"destructive",onConfirm:()=>{_(!1),x(C),p(null)},onCancel:()=>p(null)})]})}function us({profile:s,isSelected:t,onSelect:i,onDelete:l}){return e.jsxs("div",{className:E("group flex items-center gap-2 px-3 py-2.5 rounded-md cursor-pointer transition-colors",t?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:i,children:[s.configured?e.jsx(fe,{className:"w-4 h-4 text-green-600 shrink-0"}):e.jsx(he,{className:"w-4 h-4 text-yellow-600 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:s.name}),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(M,{value:s.settingsPath,size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsx(g,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:d=>{d.stopPropagation(),l()},children:e.jsx(oe,{className:"w-3.5 h-3.5 text-destructive"})})]})}export{Os as ApiPage};
|
|
1
|
+
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{B as S,c as E,T as Ne,o as ve,p as be,b as g,I as y,m as I,L as T,q as M,r as ne,s as we,t as Ce,v as ye,w as Oe,S as W,x as L,y as $,z as re,A as Ae,D as Ee,E as ie,F as le,G as ce,H as Te,J as _e,K as X,M as Z,R as ke,N as q,C as Se,i as Re,j as Pe,O as Le,a as Me,Q as De,U as Ie,V as Ue,W as He}from"./index-DDYIvYka.js";import{a as Fe,u as Ke,b as ze}from"./tanstack-De4wvi8X.js";import{C as B,S as ee}from"./confirm-dialog-DQNWHnTM.js";import{t as Q}from"./notifications-B2HqRBj7.js";import{R as U,ag as oe,L as G,ah as Je,E as $e,d as Be,$ as D,I as Qe,ai as de,a0 as V,b as xe,aj as qe,_ as Ge,ak as Ve,m as me,X as Ye,Z as ue,al as We,a4 as Xe,a1 as he,am as Ze,q as fe}from"./icons-D5eAI-GR.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-CnqWzqcb.js";function es({className:s,showTooltip:t=!0}){const i=e.jsxs(S,{variant:"outline",className:E("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 t?e.jsxs(Ne,{children:[e.jsx(ve,{asChild:!0,children:i}),e.jsx(be,{children:e.jsx("p",{children:"Access 349+ models via OpenRouter"})})]}):i}function se(s){return[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/^API_KEY$/,/^AUTH_TOKEN$/,/_SECRET$/,/^SECRET$/].some(i=>i.test(s))}function pe(s){return s?.env?(s.env.ANTHROPIC_BASE_URL||"").toLowerCase().includes("openrouter.ai"):!1}function ss(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 ts(s,t){const i={...s};return t.opus?i.ANTHROPIC_DEFAULT_OPUS_MODEL=t.opus:delete i.ANTHROPIC_DEFAULT_OPUS_MODEL,t.sonnet?i.ANTHROPIC_DEFAULT_SONNET_MODEL=t.sonnet:delete i.ANTHROPIC_DEFAULT_SONNET_MODEL,t.haiku?i.ANTHROPIC_DEFAULT_HAIKU_MODEL=t.haiku:delete i.ANTHROPIC_DEFAULT_HAIKU_MODEL,i}function as({profileName:s,data:t,settings:i,isLoading:l,isSaving:d,hasChanges:f,isRawJsonValid:x,onRefresh:n,onDelete:o,onSave:m}){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(S,{variant:"outline",className:"text-xs",children:t.path.replace(/^.*\//,"")}),pe(i)&&e.jsx(es,{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:"flex items-center gap-2",children:[e.jsx(g,{variant:"ghost",size:"sm",onClick:n,disabled:l,children:e.jsx(U,{className:`w-4 h-4 ${l?"animate-spin":""}`})}),o&&e.jsx(g,{variant:"ghost",size:"sm",onClick:o,children:e.jsx(oe,{className:"w-4 h-4 text-destructive"})}),e.jsx(g,{size:"sm",onClick:m,disabled:d||!f||!x,children:d?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function ge({label:s,...t}){const[i,l]=c.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(y,{type:i?"text":"password",className:"pr-10 font-mono",...t}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>l(!i),tabIndex:-1,children:i?e.jsx($e,{className:"w-4 h-4"}):e.jsx(Be,{className:"w-4 h-4"})})]})]})}function ns({currentSettings:s,newEnvKey:t,newEnvValue:i,onNewEnvKeyChange:l,onNewEnvValueChange:d,onEnvValueChange:f,onAddEnvVar:x}){return e.jsxs(e.Fragment,{children:[e.jsx(I,{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(([n,o])=>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:[n,se(n)&&e.jsx(S,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:"sensitive"})]}),se(n)?e.jsx(ge,{value:o,onChange:m=>f(n,m.target.value),className:"font-mono text-sm h-8"}):e.jsx(y,{value:o,onChange:m=>f(n,m.target.value),className:"font-mono text-sm h-8"})]},n))}):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(y,{placeholder:"VARIABLE_NAME",value:t,onChange:n=>l(n.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:n=>n.key==="Enter"&&t.trim()&&x()}),e.jsx(y,{placeholder:"value",value:i,onChange:n=>d(n.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:n=>n.key==="Enter"&&t.trim()&&x()}),e.jsx(g,{variant:"outline",size:"sm",className:"h-8",onClick:x,disabled:!t.trim(),children:e.jsx(D,{className:"w-4 h-4"})})]})]})]})}function rs({profileName:s,data:t}){return e.jsx(I,{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(Qe,{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(M,{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",{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(M,{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:"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(M,{value:`ccs default ${s}`,size:"icon",className:"h-6 w-6"})]})]})]})]})]})})}function is({value:s,onChange:t,placeholder:i="Search models...",className:l}){const[d,f]=c.useState(""),[x,n]=c.useState(null),{models:o,isLoading:m,isError:j,isFetching:O}=ne(),A=we(),N=c.useMemo(()=>Ce(o,d,{category:x??void 0}),[o,d,x]),b=c.useMemo(()=>ye(o,2),[o]),k=!d.trim()&&!x,_=c.useMemo(()=>{const r={anthropic:[],openai:[],google:[],meta:[],mistral:[],opensource:[],other:[]};N.forEach(a=>{r[a.category].push(a)});for(const a of Object.keys(r))r[a]=Oe(r[a]);return r},[N]),C=c.useCallback(()=>{A()},[A]),p=o.find(r=>r.id===s);return m&&o.length===0?e.jsxs("div",{className:E("space-y-2",l),children:[e.jsx(W,{className:"h-10 w-full"}),e.jsx(W,{className:"h-32 w-full"})]}):e.jsxs("div",{className:E("space-y-2 w-full min-w-0 overflow-hidden",l),children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(de,{className:"text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2"}),e.jsx(y,{value:d,onChange:r=>f(r.target.value),placeholder:i,className:"pl-9"})]}),e.jsx(g,{variant:"outline",size:"icon",onClick:C,disabled:O,title:"Refresh models",children:O?e.jsx(G,{className:"h-4 w-4 animate-spin"}):e.jsx(U,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs(S,{variant:x===null?"default":"outline",className:"cursor-pointer",onClick:()=>n(null),children:["All (",o.length,")"]}),Object.keys(L).map(r=>{const a=_[r].length;return a===0?null:e.jsxs(S,{variant:x===r?"default":"outline",className:"cursor-pointer",onClick:()=>n(r),children:[L[r]," (",a,")"]},r)})]}),p&&e.jsxs("div",{className:"bg-muted rounded-md p-2 text-sm",children:[e.jsx("span",{className:"font-medium",children:p.name}),e.jsxs("span",{className:"text-muted-foreground ml-2",children:[$(p.pricing)," |"," ",re(p.context_length)]})]}),e.jsx(I,{className:"h-72 w-full rounded-md border",children:j?e.jsxs("div",{className:"text-destructive p-4 text-center",children:["Failed to load models."," ",e.jsx(g,{variant:"link",onClick:C,children:"Retry"})]}):N.length===0?e.jsxs("div",{className:"text-muted-foreground p-4 text-center",children:['No models found matching "',d,'"']}):e.jsxs("div",{className:"space-y-6 p-3",children:[k&&b.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(V,{className:"h-3 w-3 text-accent"}),e.jsx("span",{children:"Newest Models"})]}),e.jsx("div",{className:"space-y-1",children:b.map(r=>e.jsx(te,{model:r,isSelected:r.id===s,onClick:()=>t(r.id),showAge:!0},r.id))})]}),Object.keys(L).map(r=>{const a=_[r];return a.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:L[r]}),e.jsx("div",{className:"space-y-1",children:a.map(v=>e.jsx(te,{model:v,isSelected:v.id===s,onClick:()=>t(v.id)},v.id))})]},r)})]})})]})}function te({model:s,isSelected:t,onClick:i,showAge:l=!1}){return e.jsxs("button",{type:"button",onClick:i,className:E("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",t&&"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:E("flex shrink-0 items-center gap-1 text-xs whitespace-nowrap",t?"text-accent-foreground/80":"text-muted-foreground group-hover:text-accent-foreground/80"),children:[l&&s.created&&e.jsx(S,{variant:"outline",className:E("text-[10px] px-1",t?"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:Ae(s.created)}),s.isFree?e.jsx(S,{variant:"secondary",className:E("text-[10px] px-1",t?"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(S,{variant:"outline",className:E("text-[10px] px-1 border-emerald-500/50 text-emerald-600",t?"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:$(s.pricing)})]}):e.jsx("span",{className:"tabular-nums",children:$(s.pricing)}),e.jsx("span",{className:"tabular-nums",children:re(s.context_length)})]})]})}function ls({selectedModel:s,value:t,onChange:i,className:l}){const{models:d}=ne(),f=c.useMemo(()=>s?Ee(s,d):{},[s,d]),x=()=>{i(f)},n=(m,j)=>{i({...t,[m]:j||void 0})},o=s&&Object.keys(f).length>0;return e.jsxs(ie,{className:E("group",l),children:[e.jsxs(le,{className:"flex items-center gap-2 text-sm font-medium hover:underline",children:[e.jsx(xe,{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(ce,{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."}),o&&e.jsxs(g,{type:"button",variant:"outline",size:"sm",onClick:x,children:[e.jsx(qe,{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(y,{id:"tier-opus",value:t.opus??"",onChange:m=>n("opus",m.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(y,{id:"tier-sonnet",value:t.sonnet??"",onChange:m=>n("sonnet",m.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(y,{id:"tier-haiku",value:t.haiku??"",onChange:m=>n("haiku",m.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 cs({profileName:s,data:t,currentSettings:i,newEnvKey:l,newEnvValue:d,onNewEnvKeyChange:f,onNewEnvValueChange:x,onEnvValueChange:n,onAddEnvVar:o,onEnvBulkChange:m}){const j=pe(i),O=i?.env,A=c.useMemo(()=>ss(O??{}),[O]),N=O??{},b=a=>{if(m){const v={...N,ANTHROPIC_MODEL:a,ANTHROPIC_DEFAULT_OPUS_MODEL:a,ANTHROPIC_DEFAULT_SONNET_MODEL:a,ANTHROPIC_DEFAULT_HAIKU_MODEL:a};m(v)}else n("ANTHROPIC_MODEL",a),n("ANTHROPIC_DEFAULT_OPUS_MODEL",a),n("ANTHROPIC_DEFAULT_SONNET_MODEL",a),n("ANTHROPIC_DEFAULT_HAIKU_MODEL",a);Q.success("Applied model to all tiers",{duration:2e3})},k=a=>{if(m){const v=ts(N,a);m(v)}else a.opus!==void 0&&n("ANTHROPIC_DEFAULT_OPUS_MODEL",a.opus||""),a.sonnet!==void 0&&n("ANTHROPIC_DEFAULT_SONNET_MODEL",a.sonnet||""),a.haiku!==void 0&&n("ANTHROPIC_DEFAULT_HAIKU_MODEL",a.haiku||"")},[_,C]=c.useState(!1),p=new Set(["ANTHROPIC_AUTH_TOKEN"]),r=Object.entries(N).filter(([a])=>!p.has(a));return e.jsx("div",{className:"h-full w-full min-w-0 flex flex-col",children:e.jsxs(Te,{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(_e,{className:"w-full",children:[e.jsx(X,{value:"env",className:"flex-1",children:j?"Configuration":"Environment Variables"}),e.jsx(X,{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(Z,{value:"env",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden min-w-0",children:j?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(is,{value:N.ANTHROPIC_MODEL,onChange:b,placeholder:"Search OpenRouter models..."})]}),e.jsx(ls,{selectedModel:N.ANTHROPIC_MODEL,value:A,onChange:k}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"API Key"}),e.jsx(ge,{value:N.ANTHROPIC_AUTH_TOKEN||"",onChange:a=>n("ANTHROPIC_AUTH_TOKEN",a.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"})]})]}),r.length>0&&e.jsxs(ie,{open:_,onOpenChange:C,children:[e.jsxs(le,{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors group",children:[e.jsx(xe,{className:E("h-4 w-4 transition-transform",_&&"rotate-90")}),e.jsx(Ge,{className:"h-4 w-4"}),e.jsx("span",{children:"Additional Variables"}),e.jsxs("span",{className:"text-xs font-normal opacity-70",children:["(",r.length,")"]})]}),e.jsx(ce,{className:"pt-4",children:e.jsx("div",{className:"space-y-3 border rounded-lg p-3 bg-muted/30",children:r.map(([a,v])=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:a}),e.jsx(y,{value:v,onChange:P=>n(a,P.target.value),className:"font-mono text-xs h-8"})]},a))})})]})]})}),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(y,{placeholder:"VARIABLE_NAME",value:l,onChange:a=>f(a.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:a=>a.key==="Enter"&&l.trim()&&o()}),e.jsx(y,{placeholder:"value",value:d,onChange:a=>x(a.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:a=>a.key==="Enter"&&l.trim()&&o()}),e.jsx(g,{variant:"outline",size:"sm",className:"h-8",onClick:o,disabled:!l.trim(),children:e.jsx(D,{className:"w-4 h-4"})})]})]})]}):e.jsx(ns,{currentSettings:i,newEnvKey:l,newEnvValue:d,onNewEnvKeyChange:f,onNewEnvValueChange:x,onEnvValueChange:n,onAddEnvVar:o})}),e.jsx(Z,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(rs,{profileName:s,data:t})})]})]})})}function os({profileName:s,onDelete:t,onHasChangesUpdate:i}){const[l,d]=c.useState({}),[f,x]=c.useState(!1),[n,o]=c.useState(null),[m,j]=c.useState(""),[O,A]=c.useState(""),N=Fe(),{data:b,isLoading:k,isError:_,refetch:C}=Ke({queryKey:["settings",s],queryFn:async()=>{const h=await fetch(`/api/settings/${s}/raw`);if(!h.ok)throw new Error(`Failed to load settings: ${h.status}`);return h.json()}}),p=b?.settings,r=c.useMemo(()=>{if(n!==null)try{return JSON.parse(n)}catch{}if(p)return{...p,env:{...p.env,...l}}},[p,l,n]),a=c.useMemo(()=>n!==null?n:p?JSON.stringify(p,null,2):"",[n,p]),v=c.useCallback(h=>{o(h)},[]),P=(h,w)=>{const R={...r?.env||{},[h]:w};d(J=>({...J,[h]:w})),o(JSON.stringify({...r,env:R},null,2))},H=h=>{const w={...r?.env||{},...h};d(R=>({...R,...h})),o(JSON.stringify({...r,env:w},null,2))},F=()=>{if(!m.trim())return;const h=m.trim(),w=O,R={...r?.env||{},[h]:w};d(J=>({...J,[h]:w})),o(JSON.stringify({...r,env:R},null,2)),j(""),A("")},u=c.useMemo(()=>{try{return JSON.parse(a),!0}catch{return!1}},[a]),K=c.useMemo(()=>n!==null?n!==JSON.stringify(p,null,2):Object.keys(l).length>0,[n,l,p]),je=c.useMemo(()=>{const h=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"],w=r?.env||{};return h.filter(R=>!w[R]?.trim())},[r]);c.useEffect(()=>{i?.(K)},[K,i]);const z=ze({mutationFn:async()=>{let h;try{h=JSON.parse(a)}catch{h={...b?.settings,env:{...b?.settings?.env,...l}}}const w=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:h,expectedMtime:b?.mtime})});if(w.status===409)throw new Error("CONFLICT");if(!w.ok)throw new Error("Failed to save");return w.json()},onSuccess:()=>{N.invalidateQueries({queryKey:["settings",s]}),N.invalidateQueries({queryKey:["profiles"]}),d({}),o(null),Q.success("Settings saved")},onError:h=>{h.message==="CONFLICT"?x(!0):Q.error(h.message)}}),Y=async h=>{x(!1),h?(await C(),z.mutate()):(d({}),o(null))};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(as,{profileName:s,data:b,settings:r,isLoading:k,isSaving:z.isPending,hasChanges:K,isRawJsonValid:u,onRefresh:()=>C(),onDelete:t,onSave:()=>z.mutate()}),k?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(G,{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(g,{variant:"outline",size:"sm",onClick:()=>C(),children:[e.jsx(U,{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(cs,{profileName:s,data:b,currentSettings:r,newEnvKey:m,newEnvValue:O,onNewEnvKeyChange:j,onNewEnvValueChange:A,onEnvValueChange:P,onEnvBulkChange:H,onAddEnvVar:F})}),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(Ve,{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(ke,{rawJsonContent:a,isRawJsonValid:u,rawJsonEdits:n,settings:p,onChange:v,missingRequiredFields:je})]})]}),e.jsx(B,{open:f,title:"File Modified Externally",description:"Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>Y(!0),onCancel:()=>Y(!1)})]},s)}const ae="ccs:openrouter-banner-dismissed";function ds({onCreateClick:s}){const[t,i]=c.useState(!0),{modelCount:l,isLoading:d}=q();c.useEffect(()=>{const x=localStorage.getItem(ae)==="true";i(x)},[]);const f=()=>{localStorage.setItem(ae,"true"),i(!0)};return t?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(V,{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 ",d?"300+":`${l}+`," models from OpenAI, Anthropic, Google, Meta and more."]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s&&e.jsx(g,{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(me,{className:"w-3 h-3"})]}),e.jsxs(g,{size:"icon",variant:"ghost",onClick:f,className:"h-7 w-7 text-white/70 hover:text-white hover:bg-white/20",children:[e.jsx(Ye,{className:"w-4 h-4"}),e.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})})}function xs({onOpenRouterClick:s,onCustomClick:t}){const{modelCount:i,isLoading:l}=q();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(Se,{className:"border-accent/30 dark:border-accent/40 bg-gradient-to-br from-accent/5 to-background dark:from-accent/10",children:[e.jsxs(Re,{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(S,{variant:"secondary",className:"bg-accent/10 text-accent dark:bg-accent/20 dark:text-accent-foreground",children:"Recommended"})]}),e.jsx(Pe,{className:"text-xl",children:"Start with OpenRouter"}),e.jsxs(Le,{className:"text-base",children:["Access ",l?"300+":`${i}+`," models from OpenAI, Anthropic, Google, Meta and more - all through one API."]})]}),e.jsxs(Me,{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(ue,{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(V,{className:"w-4 h-4 text-accent"}),e.jsx("span",{children:"Model tier mapping"})]})]}),e.jsxs(g,{onClick:s,className:"w-full bg-accent hover:bg-accent/90 text-white",size:"lg",children:["Create OpenRouter Profile",e.jsx(We,{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(me,{className:"w-3 h-3"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ee,{className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx(ee,{className:"flex-1"})]}),e.jsx(g,{variant:"outline",onClick:t,className:"w-full",children:"Create Custom API Profile"})]})})}function ms({onCreateClick:s}){const{modelCount:t,isLoading:i}=q();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:[i?"300+":`${t}+`," models available"]})]}),e.jsxs(g,{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(ue,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-xs",children:"Add"})]})]})})}function Os(){const{data:s,isLoading:t,isError:i,refetch:l}=De(),d=Ie(),[f,x]=c.useState(null),[n,o]=c.useState(""),[m,j]=c.useState(!1),[O,A]=c.useState("normal"),[N,b]=c.useState(null),[k,_]=c.useState(!1),[C,p]=c.useState(null);Ue();const r=c.useMemo(()=>s?.profiles||[],[s?.profiles]),a=c.useMemo(()=>r.filter(u=>u.name.toLowerCase().includes(n.toLowerCase())),[r,n]),v=f?r.find(u=>u.name===f):null,P=u=>{d.mutate(u,{onSuccess:()=>{f===u&&x(null),b(null)}})},H=u=>{j(!1),k&&f!==null?p(u):x(u)},F=u=>{k&&f!==u?p(u):x(u)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:[e.jsx(ds,{onCreateClick:()=>j(!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(Xe,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"API Profiles"})]}),e.jsxs(g,{size:"sm",onClick:()=>{j(!0)},children:[e.jsx(D,{className:"w-4 h-4 mr-1"}),"New"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(de,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(y,{placeholder:"Search profiles...",className:"pl-8 h-9",value:n,onChange:u=>o(u.target.value)})]})]}),e.jsx(I,{className:"flex-1",children:t?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading profiles..."}):i?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(he,{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(g,{size:"sm",variant:"outline",onClick:()=>l(),children:[e.jsx(U,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):a.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(Ze,{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(g,{size:"sm",variant:"outline",onClick:()=>{j(!0)},children:[e.jsx(D,{className:"w-4 h-4 mr-1"}),"Create Profile"]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:['No profiles match "',n,'"']})}):e.jsx("div",{className:"p-2 space-y-1",children:a.map(u=>e.jsx(us,{profile:u,isSelected:f===u.name,onSelect:()=>F(u.name),onDelete:()=>b(u.name)},u.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(fe,{className:"w-3 h-3 text-green-600"}),r.filter(u=>u.configured).length," configured"]})]})}),e.jsx(ms,{onCreateClick:()=>{A("openrouter"),j(!0)}})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:v?e.jsx(os,{profileName:v.name,onDelete:()=>b(v.name),onHasChangesUpdate:_},v.name):e.jsx(xs,{onOpenRouterClick:()=>{A("openrouter"),j(!0)},onCustomClick:()=>{A("normal"),j(!0)}})})]}),e.jsx(He,{open:m,onOpenChange:j,onSuccess:H,initialMode:O}),e.jsx(B,{open:!!N,title:"Delete Profile",description:`Are you sure you want to delete "${N}"? This will remove the settings file and cannot be undone.`,confirmText:"Delete",variant:"destructive",onConfirm:()=>N&&P(N),onCancel:()=>b(null)}),e.jsx(B,{open:!!C,title:"Unsaved Changes",description:`You have unsaved changes in "${f}". Discard and switch to "${C}"?`,confirmText:"Discard & Switch",variant:"destructive",onConfirm:()=>{_(!1),x(C),p(null)},onCancel:()=>p(null)})]})}function us({profile:s,isSelected:t,onSelect:i,onDelete:l}){return e.jsxs("div",{className:E("group flex items-center gap-2 px-3 py-2.5 rounded-md cursor-pointer transition-colors",t?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:i,children:[s.configured?e.jsx(fe,{className:"w-4 h-4 text-green-600 shrink-0"}):e.jsx(he,{className:"w-4 h-4 text-yellow-600 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:s.name}),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(M,{value:s.settingsPath,size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsx(g,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:d=>{d.stopPropagation(),l()},children:e.jsx(oe,{className:"w-3.5 h-3.5 text-destructive"})})]})}export{Os as ApiPage};
|