@kaitranntt/ccs 7.53.0-dev.3 → 7.53.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.
Files changed (72) hide show
  1. package/README.md +38 -0
  2. package/dist/commands/config-command.d.ts.map +1 -1
  3. package/dist/commands/config-command.js +7 -0
  4. package/dist/commands/config-command.js.map +1 -1
  5. package/dist/commands/env-command.d.ts.map +1 -1
  6. package/dist/commands/env-command.js +31 -76
  7. package/dist/commands/env-command.js.map +1 -1
  8. package/dist/commands/help-command.d.ts.map +1 -1
  9. package/dist/commands/help-command.js +10 -2
  10. package/dist/commands/help-command.js.map +1 -1
  11. package/dist/commands/persist-command.d.ts +4 -4
  12. package/dist/commands/persist-command.d.ts.map +1 -1
  13. package/dist/commands/persist-command.js +76 -83
  14. package/dist/commands/persist-command.js.map +1 -1
  15. package/dist/shared/claude-extension-hosts.d.ts +12 -0
  16. package/dist/shared/claude-extension-hosts.d.ts.map +1 -0
  17. package/dist/shared/claude-extension-hosts.js +33 -0
  18. package/dist/shared/claude-extension-hosts.js.map +1 -0
  19. package/dist/shared/claude-extension-setup.d.ts +30 -0
  20. package/dist/shared/claude-extension-setup.d.ts.map +1 -0
  21. package/dist/shared/claude-extension-setup.js +232 -0
  22. package/dist/shared/claude-extension-setup.js.map +1 -0
  23. package/dist/ui/assets/{accounts--cwNsQjP.js → accounts-CZEg1_PX.js} +1 -1
  24. package/dist/ui/assets/{alert-dialog-p36g1qQ3.js → alert-dialog-DhwS38kc.js} +1 -1
  25. package/dist/ui/assets/{api-CV5n6K6m.js → api-sWNND4wP.js} +1 -1
  26. package/dist/ui/assets/{auth-section-BbAkkPVY.js → auth-section-nJIpOcnm.js} +1 -1
  27. package/dist/ui/assets/{backups-section-23AZLa6a.js → backups-section-D3A6hmrU.js} +1 -1
  28. package/dist/ui/assets/{checkbox-DevzY7b0.js → checkbox-CZrxD1iS.js} +1 -1
  29. package/dist/ui/assets/claude-extension-BjInaILv.js +1 -0
  30. package/dist/ui/assets/{cliproxy-Bp7J8ubf.js → cliproxy-BGiSCGkl.js} +2 -2
  31. package/dist/ui/assets/{cliproxy-control-panel-C5CoSr0Y.js → cliproxy-control-panel-CKO2Sn9B.js} +1 -1
  32. package/dist/ui/assets/{confirm-dialog-B9YhXYaX.js → confirm-dialog-DTKxwrat.js} +1 -1
  33. package/dist/ui/assets/{copilot-C9ZTzmsE.js → copilot-CuRngdBg.js} +2 -2
  34. package/dist/ui/assets/{cursor-rzsYFYdN.js → cursor-Dxo0uIiU.js} +1 -1
  35. package/dist/ui/assets/{droid-C2HW6CP4.js → droid-Cl8QsJJL.js} +1 -1
  36. package/dist/ui/assets/{globalenv-section-DqoqH7aV.js → globalenv-section-C3dxxoD9.js} +1 -1
  37. package/dist/ui/assets/{health-U_NWGsbk.js → health-BUifaDU7.js} +1 -1
  38. package/dist/ui/assets/icons-DrEfTmfX.js +1 -0
  39. package/dist/ui/assets/{index-Cr6v7B1R.js → index-BOsbrhaa.js} +1 -1
  40. package/dist/ui/assets/index-Btf_ow2V.css +1 -0
  41. package/dist/ui/assets/{index-BS1NTGOE.js → index-CPdceT1C.js} +1 -1
  42. package/dist/ui/assets/index-CYo-E5rU.js +1 -0
  43. package/dist/ui/assets/index-Cw9Urr0S.js +47 -0
  44. package/dist/ui/assets/{index-CjAEUCa2.js → index-xayyyR26.js} +1 -1
  45. package/dist/ui/assets/{proxy-status-widget-BGYEE40m.js → proxy-status-widget-D94htBPb.js} +1 -1
  46. package/dist/ui/assets/{separator-ynn1LawO.js → separator-3fBbTn-V.js} +1 -1
  47. package/dist/ui/assets/{shared-C5T5_OVk.js → shared-q_FNNbjD.js} +1 -1
  48. package/dist/ui/assets/{switch-DqRgvjvy.js → switch-5N8qBdBr.js} +1 -1
  49. package/dist/ui/assets/updates-CubQ54J0.js +1 -0
  50. package/dist/ui/index.html +3 -3
  51. package/dist/web-server/routes/claude-extension-routes.d.ts +3 -0
  52. package/dist/web-server/routes/claude-extension-routes.d.ts.map +1 -0
  53. package/dist/web-server/routes/claude-extension-routes.js +161 -0
  54. package/dist/web-server/routes/claude-extension-routes.js.map +1 -0
  55. package/dist/web-server/routes/index.d.ts.map +1 -1
  56. package/dist/web-server/routes/index.js +2 -0
  57. package/dist/web-server/routes/index.js.map +1 -1
  58. package/dist/web-server/services/claude-extension-binding-service.d.ts +30 -0
  59. package/dist/web-server/services/claude-extension-binding-service.d.ts.map +1 -0
  60. package/dist/web-server/services/claude-extension-binding-service.js +240 -0
  61. package/dist/web-server/services/claude-extension-binding-service.js.map +1 -0
  62. package/dist/web-server/services/claude-extension-settings-service.d.ts +23 -0
  63. package/dist/web-server/services/claude-extension-settings-service.d.ts.map +1 -0
  64. package/dist/web-server/services/claude-extension-settings-service.js +493 -0
  65. package/dist/web-server/services/claude-extension-settings-service.js.map +1 -0
  66. package/package.json +1 -1
  67. package/scripts/completion/ccs.bash +11 -4
  68. package/dist/ui/assets/icons-D2eEmpHv.js +0 -1
  69. package/dist/ui/assets/index-BL_PxzDX.js +0 -47
  70. package/dist/ui/assets/index-BusjPRWX.css +0 -1
  71. package/dist/ui/assets/index-dRF49n0b.js +0 -1
  72. package/dist/ui/assets/updates-oGwlC9O3.js +0 -1
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getClaudeSharedSettingsPath = exports.getClaudeExtensionHostMetadata = exports.renderSharedClaudeSettingsJson = exports.renderClaudeExtensionSettingsJson = exports.buildSharedClaudeSettingsObject = exports.buildClaudeExtensionSettingsObject = exports.resolveClaudeExtensionSetup = exports.listClaudeExtensionProfiles = exports.CLAUDE_EXTENSION_MANAGED_ENV_KEYS = void 0;
7
+ const profile_detector_1 = require("../auth/profile-detector");
8
+ const profile_detector_2 = __importDefault(require("../auth/profile-detector"));
9
+ const profile_continuity_inheritance_1 = require("../auth/profile-continuity-inheritance");
10
+ const account_context_1 = require("../auth/account-context");
11
+ const env_builder_1 = require("../cliproxy/config/env-builder");
12
+ const port_manager_1 = require("../cliproxy/config/port-manager");
13
+ const proxy_target_resolver_1 = require("../cliproxy/proxy-target-resolver");
14
+ const copilot_executor_1 = require("../copilot/copilot-executor");
15
+ const instance_manager_1 = __importDefault(require("../management/instance-manager"));
16
+ const helpers_1 = require("../utils/helpers");
17
+ const claude_config_path_1 = require("../utils/claude-config-path");
18
+ const claude_extension_hosts_1 = require("./claude-extension-hosts");
19
+ exports.CLAUDE_EXTENSION_MANAGED_ENV_KEYS = [
20
+ 'ANTHROPIC_API_KEY',
21
+ 'ANTHROPIC_AUTH_TOKEN',
22
+ 'ANTHROPIC_BASE_URL',
23
+ 'ANTHROPIC_MODEL',
24
+ 'ANTHROPIC_MAX_TOKENS',
25
+ 'ANTHROPIC_SAFE_MODE',
26
+ 'ANTHROPIC_TEMPERATURE',
27
+ 'ANTHROPIC_SMALL_FAST_MODEL',
28
+ 'ANTHROPIC_DEFAULT_OPUS_MODEL',
29
+ 'ANTHROPIC_DEFAULT_SONNET_MODEL',
30
+ 'ANTHROPIC_DEFAULT_HAIKU_MODEL',
31
+ 'API_TIMEOUT_MS',
32
+ 'CLAUDE_CONFIG_DIR',
33
+ 'DISABLE_NON_ESSENTIAL_MODEL_CALLS',
34
+ 'CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC',
35
+ 'ENABLE_STREAMING',
36
+ 'MAX_THINKING_TOKENS',
37
+ ];
38
+ function sortUniqueEnvKeys(keys) {
39
+ return [...new Set(keys)].sort((left, right) => left.localeCompare(right));
40
+ }
41
+ function sortEnvRecord(env) {
42
+ const normalized = {};
43
+ for (const [key, value] of Object.entries(env)) {
44
+ if (typeof value === 'string') {
45
+ normalized[key] = value;
46
+ }
47
+ }
48
+ return Object.fromEntries(Object.entries(normalized).sort(([left], [right]) => left.localeCompare(right)));
49
+ }
50
+ function describeProfile(profileName, result) {
51
+ if (profileName === 'default') {
52
+ return result.name === 'default'
53
+ ? 'Use Claude Code defaults with no CCS-specific transport override.'
54
+ : `Use the current default profile resolution for "${result.name}".`;
55
+ }
56
+ if (result.type === 'cliproxy')
57
+ return 'OAuth or CLIProxy-backed profile for Anthropic-compatible routing.';
58
+ if (result.type === 'settings')
59
+ return 'API profile backed by a CCS settings file.';
60
+ if (result.type === 'account')
61
+ return 'Claude account instance isolated through CLAUDE_CONFIG_DIR.';
62
+ if (result.type === 'copilot')
63
+ return 'GitHub Copilot profile routed through copilot-api.';
64
+ return 'Native Claude profile resolution.';
65
+ }
66
+ function createProfileOption(profileName, result) {
67
+ return {
68
+ name: profileName,
69
+ profileType: result.type,
70
+ label: profileName === 'default' ? 'default' : result.name,
71
+ description: describeProfile(profileName, result),
72
+ };
73
+ }
74
+ function listClaudeExtensionProfiles() {
75
+ const detector = new profile_detector_2.default();
76
+ const all = detector.getAllProfiles();
77
+ const orderedNames = [
78
+ 'default',
79
+ ...all.accounts,
80
+ ...all.settings,
81
+ ...all.cliproxy,
82
+ ...all.cliproxyVariants,
83
+ ];
84
+ const deduped = [...new Set(orderedNames)];
85
+ try {
86
+ detector.detectProfileType('copilot');
87
+ deduped.push('copilot');
88
+ }
89
+ catch {
90
+ // Copilot disabled; skip from setup UI.
91
+ }
92
+ return deduped
93
+ .map((profileName) => createProfileOption(profileName, detector.detectProfileType(profileName)))
94
+ .sort((left, right) => deduped.indexOf(left.name) - deduped.indexOf(right.name));
95
+ }
96
+ exports.listClaudeExtensionProfiles = listClaudeExtensionProfiles;
97
+ async function resolveExtensionEnv(requestedProfile, result) {
98
+ const warnings = [];
99
+ const notes = [];
100
+ const requestedIsDefault = requestedProfile === 'default';
101
+ if (result.type === 'account') {
102
+ const instanceManager = new instance_manager_1.default();
103
+ const policy = (0, account_context_1.resolveAccountContextPolicy)((0, account_context_1.isAccountContextMetadata)(result.profile) ? result.profile : undefined);
104
+ const instancePath = await instanceManager.ensureInstance(result.name, policy, {
105
+ bare: result.profile?.bare === true,
106
+ });
107
+ notes.push('Account profiles authenticate through the isolated Claude config directory.');
108
+ return {
109
+ extensionEnv: { CLAUDE_CONFIG_DIR: instancePath },
110
+ warnings,
111
+ notes,
112
+ disableLoginPrompt: false,
113
+ };
114
+ }
115
+ if (result.type === 'default') {
116
+ const continuity = await (0, profile_continuity_inheritance_1.resolveProfileContinuityInheritance)({
117
+ profileName: requestedProfile,
118
+ profileType: result.type,
119
+ target: 'claude',
120
+ });
121
+ if (continuity.claudeConfigDir) {
122
+ notes.push(`Default profile inherits continuity from account "${continuity.sourceAccount}".`);
123
+ return {
124
+ extensionEnv: { CLAUDE_CONFIG_DIR: continuity.claudeConfigDir },
125
+ warnings,
126
+ notes,
127
+ disableLoginPrompt: false,
128
+ };
129
+ }
130
+ notes.push('Default profile clears CCS-managed transport overrides and uses native Claude defaults.');
131
+ return { extensionEnv: {}, warnings, notes, disableLoginPrompt: false };
132
+ }
133
+ const continuity = await (0, profile_continuity_inheritance_1.resolveProfileContinuityInheritance)({
134
+ profileName: requestedProfile,
135
+ profileType: result.type,
136
+ target: 'claude',
137
+ });
138
+ const env = result.type === 'settings'
139
+ ? (result.env ??
140
+ (result.settingsPath ? (0, profile_detector_1.loadSettingsFromFile)((0, helpers_1.expandPath)(result.settingsPath)) : {}))
141
+ : result.type === 'copilot'
142
+ ? (() => {
143
+ if (!result.copilotConfig) {
144
+ throw new Error(`Profile "${requestedProfile}" is missing copilot configuration.`);
145
+ }
146
+ return (0, copilot_executor_1.generateCopilotEnv)(result.copilotConfig, continuity.claudeConfigDir);
147
+ })()
148
+ : (() => {
149
+ if (!result.provider) {
150
+ throw new Error(`Profile "${requestedProfile}" is missing CLIProxy provider metadata.`);
151
+ }
152
+ const proxyTarget = (0, proxy_target_resolver_1.getProxyTarget)();
153
+ const port = result.port || port_manager_1.CLIPROXY_DEFAULT_PORT;
154
+ if (proxyTarget.isRemote) {
155
+ warnings.push(`CLIProxy is configured for remote routing via ${proxyTarget.protocol}://${proxyTarget.host}:${proxyTarget.port}.`);
156
+ return result.isComposite && result.compositeTiers && result.compositeDefaultTier
157
+ ? (0, env_builder_1.getCompositeEnvVars)(result.compositeTiers, result.compositeDefaultTier, port, result.settingsPath, proxyTarget)
158
+ : (0, env_builder_1.getRemoteEnvVars)(result.provider, proxyTarget, result.settingsPath);
159
+ }
160
+ warnings.push('CLIProxy-backed profiles require the local or remote proxy endpoint to be reachable.');
161
+ return result.isComposite && result.compositeTiers && result.compositeDefaultTier
162
+ ? (0, env_builder_1.getCompositeEnvVars)(result.compositeTiers, result.compositeDefaultTier, port, result.settingsPath)
163
+ : (0, env_builder_1.getEffectiveEnvVars)(result.provider, port, result.settingsPath);
164
+ })();
165
+ if (!requestedIsDefault && continuity.claudeConfigDir && !env.CLAUDE_CONFIG_DIR) {
166
+ env.CLAUDE_CONFIG_DIR = continuity.claudeConfigDir;
167
+ notes.push(`Continuity inheritance adds CLAUDE_CONFIG_DIR from account "${continuity.sourceAccount}".`);
168
+ }
169
+ if (result.type === 'copilot') {
170
+ warnings.push('copilot-api must stay reachable for this profile to work inside the IDE extension.');
171
+ }
172
+ if (Object.keys(env).length === 0) {
173
+ throw new Error(`Profile "${requestedProfile}" has no extension environment to export.`);
174
+ }
175
+ return { extensionEnv: sortEnvRecord(env), warnings, notes, disableLoginPrompt: true };
176
+ }
177
+ async function resolveClaudeExtensionSetup(requestedProfile) {
178
+ const detector = new profile_detector_2.default();
179
+ const result = detector.detectProfileType(requestedProfile);
180
+ const resolved = await resolveExtensionEnv(requestedProfile, result);
181
+ return {
182
+ requestedProfile,
183
+ resolvedProfileName: result.name,
184
+ profileType: result.type,
185
+ profileLabel: requestedProfile === 'default' ? 'default' : result.name,
186
+ profileDescription: describeProfile(requestedProfile, result),
187
+ extensionEnv: resolved.extensionEnv,
188
+ removeEnvKeys: sortUniqueEnvKeys([
189
+ ...exports.CLAUDE_EXTENSION_MANAGED_ENV_KEYS,
190
+ ...Object.keys(resolved.extensionEnv),
191
+ ]),
192
+ warnings: resolved.warnings,
193
+ notes: resolved.notes,
194
+ disableLoginPrompt: resolved.disableLoginPrompt,
195
+ };
196
+ }
197
+ exports.resolveClaudeExtensionSetup = resolveClaudeExtensionSetup;
198
+ function buildClaudeExtensionSettingsObject(setup, host) {
199
+ const definition = (0, claude_extension_hosts_1.getClaudeExtensionHostDefinition)(host);
200
+ const payload = {
201
+ [definition.settingsKey]: Object.entries(setup.extensionEnv).map(([name, value]) => ({
202
+ name,
203
+ value,
204
+ })),
205
+ };
206
+ if (definition.disableLoginPromptKey && setup.disableLoginPrompt) {
207
+ payload[definition.disableLoginPromptKey] = true;
208
+ }
209
+ return payload;
210
+ }
211
+ exports.buildClaudeExtensionSettingsObject = buildClaudeExtensionSettingsObject;
212
+ function buildSharedClaudeSettingsObject(setup) {
213
+ return { env: setup.extensionEnv };
214
+ }
215
+ exports.buildSharedClaudeSettingsObject = buildSharedClaudeSettingsObject;
216
+ function renderClaudeExtensionSettingsJson(setup, host) {
217
+ return JSON.stringify(buildClaudeExtensionSettingsObject(setup, host), null, 2);
218
+ }
219
+ exports.renderClaudeExtensionSettingsJson = renderClaudeExtensionSettingsJson;
220
+ function renderSharedClaudeSettingsJson(setup) {
221
+ return JSON.stringify(buildSharedClaudeSettingsObject(setup), null, 2);
222
+ }
223
+ exports.renderSharedClaudeSettingsJson = renderSharedClaudeSettingsJson;
224
+ function getClaudeExtensionHostMetadata(host) {
225
+ return (0, claude_extension_hosts_1.getClaudeExtensionHostDefinition)(host);
226
+ }
227
+ exports.getClaudeExtensionHostMetadata = getClaudeExtensionHostMetadata;
228
+ function getClaudeSharedSettingsPath() {
229
+ return (0, claude_config_path_1.getClaudeSettingsPath)();
230
+ }
231
+ exports.getClaudeSharedSettingsPath = getClaudeSharedSettingsPath;
232
+ //# sourceMappingURL=claude-extension-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-extension-setup.js","sourceRoot":"","sources":["../../src/shared/claude-extension-setup.ts"],"names":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ClF,CAAC;AALD,8EAKC;AAED,SAAgB,8BAA8B,CAAC,KAA2B;IACxE,OAAO,IAAI,CAAC,SAAS,CAAC,+BAA+B,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzE,CAAC;AAFD,wEAEC;AAED,SAAgB,8BAA8B,CAC5C,IAAyB;IAEzB,OAAO,IAAA,yDAAgC,EAAC,IAAI,CAAC,CAAC;AAChD,CAAC;AAJD,wEAIC;AAED,SAAgB,2BAA2B;IACzC,OAAO,IAAA,0CAAqB,GAAE,CAAC;AACjC,CAAC;AAFD,kEAEC"}
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as f,h as je}from"./react-vendor-CNOkPC89.js";import{u as ye,a as L,b as z,d as be,f as B,g as Ne}from"./tanstack-e99Cjjy2.js";import{c as y,Y as T,a as G,ad as oe,ae as re,af as le,ag as ie,ah as de,L as P,r as I,s as Z,t as Q,v as V,w as O,I as q,av as Ce,d as u,C as D,j as S,k,_ as M,B as F,b as w,M as ue,N as xe,O as me,n as ve,x as X}from"./index-BL_PxzDX.js";import{A as Pe,a as Ae,b as De,c as Se,d as ke,e as we,f as Te,g as _e}from"./alert-dialog-p36g1qQ3.js";import{t as b}from"./notifications-B2HqRBj7.js";import{aG as Me,aH as Le,k as $,ah as ze,D as Ge,O as Oe,m as W,aI as Fe,am as H,aJ as He,aK as Re,q as he,aL as qe,aM as $e,U as Ee,a2 as J,Z as Y,T as Ke}from"./icons-D2eEmpHv.js";import{C as ee}from"./checkbox-DevzY7b0.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Ue({className:s,...a}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:y("w-full caption-bottom text-sm",s),...a})})}function Be({className:s,...a}){return e.jsx("thead",{"data-slot":"table-header",className:y("[&_tr]:border-b",s),...a})}function Ie({className:s,...a}){return e.jsx("tbody",{"data-slot":"table-body",className:y("[&_tr:last-child]:border-0",s),...a})}function te({className:s,...a}){return e.jsx("tr",{"data-slot":"table-row",className:y("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",s),...a})}function Ze({className:s,...a}){return e.jsx("th",{"data-slot":"table-head",className:y("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function Qe({className:s,...a}){return e.jsx("td",{"data-slot":"table-cell",className:y("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function Ve(){return ye({queryKey:["accounts"],queryFn:()=>T.accounts.list(),select:s=>{const a=s.accounts.filter(l=>l.type!=="cliproxy"),t=s.accounts.length-a.length,c=a.filter(l=>l.context_mode==="shared").length,o=a.filter(l=>l.context_mode==="shared"&&l.continuity_mode==="deeper").length,x=Math.max(c-o,0),i=a.length-c,m=a.filter(l=>l.context_inferred).length,g=a.filter(l=>l.context_mode==="shared"&&l.continuity_mode!=="deeper"&&l.continuity_inferred).length,p=a.some(l=>l.name===s.default)?s.default:null;return{accounts:a,default:p,cliproxyCount:t,legacyContextCount:m,legacyContinuityCount:g,sharedCount:c,sharedStandardCount:x,deeperSharedCount:o,isolatedCount:i}}})}function Xe(){const s=L();return z({mutationFn:a=>T.accounts.setDefault(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),b.success(`Default account set to "${t}"`)},onError:a=>{b.error(a.message)}})}function We(){const s=L();return z({mutationFn:()=>T.accounts.resetDefault(),onSuccess:()=>{s.invalidateQueries({queryKey:["accounts"]}),b.success("Default account reset to CCS")},onError:a=>{b.error(a.message)}})}function Je(){const s=L();return z({mutationFn:a=>T.accounts.delete(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),b.success(`Account "${t}" deleted`)},onError:a=>{b.error(a.message)}})}function ge(){const s=L();return z({mutationFn:({name:a,context_mode:t,context_group:c,continuity_mode:o})=>T.accounts.updateContext(a,{context_mode:t,context_group:c,continuity_mode:o}),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]});const c=t.context_mode==="shared"?t.continuity_mode==="deeper"?`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, deeper continuity)`:`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, standard)`:"isolated";b.success(`Updated "${t.name}" context to ${c}`)},onError:a=>{b.error(a.message)}})}function Ye(){const s=L();return z({mutationFn:async a=>{const t=a.filter(c=>c.context_inferred||c.continuity_inferred);for(const c of t){const o=c.context_mode==="shared";await T.accounts.updateContext(c.name,{context_mode:o?"shared":"isolated",context_group:o?c.context_group||"default":void 0,continuity_mode:o?c.continuity_mode==="deeper"?"deeper":"standard":void 0})}return{updatedCount:t.length}},onSuccess:({updatedCount:a})=>{if(s.invalidateQueries({queryKey:["accounts"]}),a>0){b.success(`Confirmed explicit sync mode for ${a} legacy account${a>1?"s":""}`);return}b.info("No legacy accounts need confirmation")},onError:a=>{b.error(a.message)}})}const se=64,et=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function tt({account:s,onClose:a}){const{t}=G(),c=ge(),[o,x]=f.useState(s.context_mode==="shared"?"shared":"isolated"),[i,m]=f.useState(s.context_group||"default"),[g,p]=f.useState(s.continuity_mode==="deeper"?"deeper":"standard"),l=f.useMemo(()=>i.trim().toLowerCase().replace(/\s+/g,"-"),[i]),N=l.length>0&&l.length<=se&&et.test(l),j=o==="isolated"||N,n=()=>{j&&c.mutate({name:s.name,context_mode:o,context_group:o==="shared"?l:void 0,continuity_mode:o==="shared"?g:void 0},{onSuccess:()=>{a()}})},r=d=>{d||a()};return e.jsx(oe,{open:!0,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(ie,{children:t("editAccountContext.title")}),e.jsx(de,{children:t("editAccountContext.description",{name:s.name})})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"context-mode",children:t("editAccountContext.syncMode")}),e.jsxs(I,{value:o,onValueChange:d=>x(d),children:[e.jsx(Z,{id:"context-mode",children:e.jsx(Q,{placeholder:t("editAccountContext.selectContextMode")})}),e.jsxs(V,{children:[e.jsx(O,{value:"isolated",children:t("editAccountContext.isolatedOption")}),e.jsx(O,{value:"shared",children:t("editAccountContext.sharedOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(o==="shared"?"editAccountContext.sharedModeHint":"editAccountContext.isolatedModeHint")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"context-group",children:t("editAccountContext.historySyncGroup")}),e.jsx(q,{id:"context-group",value:i,onChange:d=>m(d.target.value),placeholder:t("editAccountContext.groupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.groupHint",{max:se})}),!N&&e.jsx("p",{className:"text-xs text-destructive",children:t("editAccountContext.invalidGroup")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"continuity-mode",children:t("editAccountContext.continuityDepth")}),e.jsxs(I,{value:g,onValueChange:d=>p(d),children:[e.jsx(Z,{id:"continuity-mode",children:e.jsx(Q,{placeholder:t("editAccountContext.selectContinuityDepth")})}),e.jsxs(V,{children:[e.jsx(O,{value:"standard",children:t("editAccountContext.standardOption")}),e.jsx(O,{value:"deeper",children:t("editAccountContext.deeperOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(g==="deeper"?"editAccountContext.deeperHint":"editAccountContext.standardHint")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.credentialsIsolated")})]}),e.jsxs(Ce,{children:[e.jsx(u,{variant:"outline",onClick:a,disabled:c.isPending,children:t("editAccountContext.cancel")}),e.jsx(u,{onClick:n,disabled:!j||c.isPending,children:c.isPending?t("editAccountContext.saving"):t("editAccountContext.save")})]})]})})}function ae({data:s,defaultAccount:a}){const{t}=G(),c=Xe(),o=Je(),x=We(),i=ge(),[m,g]=f.useState(null),[p,l]=f.useState(null),N=[{accessorKey:"name",header:t("accountsTable.name"),size:200,cell:({row:n})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.original.name}),n.original.name===a&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:t("accountsTable.defaultBadge")})]})},{accessorKey:"type",header:t("accountsTable.type"),size:100,cell:({row:n})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:n.original.type||"oauth"})},{accessorKey:"created",header:t("accountsTable.created"),size:150,cell:({row:n})=>{const r=new Date(n.original.created);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{accessorKey:"last_used",header:t("accountsTable.lastUsed"),size:150,cell:({row:n})=>{if(!n.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const r=new Date(n.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{id:"context",header:t("accountsTable.historySync"),size:170,cell:({row:n})=>{if(n.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((n.original.context_mode||"isolated")==="shared"){const d=n.original.context_group||"default";return n.original.continuity_mode==="deeper"?e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupDeeper",{group:d})}):n.original.continuity_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.sharedGroupLegacy",{group:d})}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupStandard",{group:d})})}return n.original.context_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.isolatedLegacy")}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.isolated")})}},{id:"actions",header:t("accountsTable.actions"),size:220,cell:({row:n})=>{const r=n.original.name===a,d=c.isPending||o.isPending||i.isPending,C=n.original.type==="cliproxy",A=n.original.context_inferred||n.original.continuity_inferred;return e.jsxs("div",{className:"flex items-center gap-1",children:[!C&&e.jsxs(u,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:d,onClick:()=>l(n.original),title:t("accountsTable.syncTitle"),children:[e.jsx(Me,{className:"w-3.5 h-3.5 mr-1"}),t("accountsTable.sync")]}),!C&&A&&e.jsxs(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-700 hover:text-amber-700 hover:bg-amber-500/10 dark:text-amber-400 dark:hover:text-amber-400",disabled:d,onClick:()=>i.mutate({name:n.original.name,context_mode:n.original.context_mode==="shared"?"shared":"isolated",context_group:n.original.context_mode==="shared"?n.original.context_group||"default":void 0,continuity_mode:n.original.context_mode==="shared"?n.original.continuity_mode==="deeper"?"deeper":"standard":void 0}),title:t("accountsTable.confirmLegacyTitle"),children:[e.jsx(Le,{className:"w-3 h-3 mr-1"}),t("accountsTable.confirm")]}),e.jsxs(u,{variant:r?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:r||d,onClick:()=>c.mutate(n.original.name),children:[e.jsx($,{className:`w-3 h-3 mr-1 ${r?"opacity-50":""}`}),t(r?"accountsTable.active":"accountsTable.setDefault")]}),e.jsx(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:r||d,onClick:()=>g(n.original.name),title:t(r?"accountsTable.cannotDeleteDefault":"accountsTable.deleteAccount"),children:e.jsx(ze,{className:"w-4 h-4"})})]})}}],j=be({data:s,columns:N,getCoreRowModel:Ne()});return s.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:t("accountsTable.noAccounts")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(Ue,{children:[e.jsx(Be,{children:j.getHeaderGroups().map(n=>e.jsx(te,{children:n.headers.map(r=>{const d={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",context:"w-[170px]",actions:"w-[290px]"}[r.id]||"w-auto";return e.jsx(Ze,{className:d,children:r.isPlaceholder?null:B(r.column.columnDef.header,r.getContext())},r.id)})},n.id))}),e.jsx(Ie,{children:j.getRowModel().rows.map(n=>e.jsx(te,{children:n.getVisibleCells().map(r=>e.jsx(Qe,{children:B(r.column.columnDef.cell,r.getContext())},r.id))},n.id))})]})}),a&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>x.mutate(),disabled:x.isPending,children:[e.jsx(Ge,{className:"w-4 h-4 mr-2"}),t("accountsTable.resetToDefault")]})})]}),p&&e.jsx(tt,{account:p,onClose:()=>l(null)}),e.jsx(Pe,{open:!!m,onOpenChange:n=>!n&&g(null),children:e.jsxs(Ae,{children:[e.jsxs(De,{children:[e.jsx(Se,{children:t("accountsTable.deleteDialogTitle")}),e.jsx(ke,{children:t("accountsTable.deleteDialogDesc",{name:m??""})})]}),e.jsxs(we,{children:[e.jsx(Te,{children:t("accountsTable.cancel")}),e.jsx(_e,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{m&&(o.mutate(m),g(null))},children:t("accountsTable.delete")})]})]})})]})}const ne=64;function st({open:s,onClose:a}){const{t}=G(),[c,o]=f.useState(""),[x,i]=f.useState(!1),[m,g]=f.useState(""),[p,l]=f.useState(!1),[N,j]=f.useState(!1),n=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(c),r=m.trim().toLowerCase().replace(/\s+/g,"-"),d=r.length===0||r.length<=ne&&/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(r),C=c&&n?[`ccs auth create ${c}`,x?r.length>0?`--context-group ${r}`:"--share-context":"",x&&p?"--deeper-continuity":""].filter(Boolean).join(" "):t("createAuthProfileDialog.commandFallback"),A=async()=>{!n||x&&!d||(await navigator.clipboard.writeText(C),j(!0),setTimeout(()=>j(!1),2e3))},_=()=>{o(""),i(!1),g(""),l(!1),j(!1),a()};return e.jsx(oe,{open:s,onOpenChange:h=>!h&&_(),children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(ie,{children:t("createAuthProfileDialog.title")}),e.jsx(de,{children:t("createAuthProfileDialog.description")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-name",children:t("createAuthProfileDialog.profileName")}),e.jsx(q,{id:"profile-name",value:c,onChange:h=>o(h.target.value),placeholder:t("createAuthProfileDialog.profileNamePlaceholder"),autoComplete:"off"}),c&&!n&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidProfileName")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{id:"share-context",checked:x,onCheckedChange:h=>i(h===!0)}),e.jsx(P,{htmlFor:"share-context",className:"cursor-pointer",children:t("createAuthProfileDialog.enableSharedHistory")})]}),x&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(P,{htmlFor:"context-group",children:t("createAuthProfileDialog.historySyncGroupOptional")}),e.jsx(q,{id:"context-group",value:m,onChange:h=>g(h.target.value),placeholder:t("createAuthProfileDialog.historySyncGroupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.historySyncGroupHint")}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(ee,{id:"deeper-continuity",checked:p,onCheckedChange:h=>l(h===!0)}),e.jsx(P,{htmlFor:"deeper-continuity",className:"cursor-pointer",children:t("createAuthProfileDialog.deeperContinuity")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.deeperContinuityHint")}),m.trim().length>0&&!d&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidContextGroup",{max:ne})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{children:t("createAuthProfileDialog.command")}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(Oe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:C}),e.jsx(u,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:A,disabled:!n||x&&!d,children:N?e.jsx($,{className:"w-4 h-4 text-green-500"}):e.jsx(W,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:t("createAuthProfileDialog.afterRunPrefix")}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep1")}),e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep2")})]}),e.jsx("p",{className:"pt-1",children:t("createAuthProfileDialog.poolingHint")})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{variant:"ghost",onClick:_,children:t("createAuthProfileDialog.close")}),e.jsx(u,{onClick:A,disabled:!n||x&&!d,children:N?e.jsxs(e.Fragment,{children:[e.jsx($,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copyCommand")]})})]})]})]})})}function R({title:s,count:a,icon:t,tone:c}){const o={isolated:{border:"border-blue-300/60 bg-blue-50/40 dark:border-blue-900/40 dark:bg-blue-900/10",icon:"text-blue-700 dark:text-blue-400",count:"text-blue-700 dark:text-blue-400"},shared:{border:"border-emerald-300/60 bg-emerald-50/40 dark:border-emerald-900/40 dark:bg-emerald-900/10",icon:"text-emerald-700 dark:text-emerald-400",count:"text-emerald-700 dark:text-emerald-400"},deeper:{border:"border-indigo-300/60 bg-indigo-50/40 dark:border-indigo-900/40 dark:bg-indigo-900/10",icon:"text-indigo-700 dark:text-indigo-400",count:"text-indigo-700 dark:text-indigo-400"}};return e.jsxs("div",{className:y("rounded-md border p-2.5",o[c].border),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs font-semibold",children:s}),e.jsx(t,{className:y("h-3.5 w-3.5",o[c].icon)})]}),e.jsx("p",{className:y("mt-1 text-lg font-mono font-semibold",o[c].count),children:a})]})}function ce({isolatedCount:s,sharedStandardCount:a,deeperSharedCount:t,sharedGroups:c,legacyTargetCount:o,cliproxyCount:x}){const{t:i}=G(),[m,g]=f.useState(!1),p=c.length>0?c:["default"];return e.jsxs(D,{className:"border-dashed",children:[e.jsx(S,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-base",children:i("historySyncLearningMap.title")}),e.jsx(M,{className:"mt-1",children:i("historySyncLearningMap.description")})]}),e.jsx(F,{variant:"outline",children:i("historySyncLearningMap.learningMap")})]})}),e.jsxs(w,{className:"space-y-3",children:[x>0&&e.jsx("div",{className:"rounded-md border border-blue-300/60 bg-blue-50/40 px-3 py-2 text-xs text-blue-800 dark:border-blue-900/40 dark:bg-blue-900/10 dark:text-blue-300",children:i("historySyncLearningMap.cliproxyManaged",{count:x})}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto_1fr_auto_1fr] sm:items-center",children:[e.jsx(R,{title:i("historySyncLearningMap.isolated"),count:s,icon:Fe,tone:"isolated"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(H,{className:"h-4 w-4"})}),e.jsx(R,{title:i("historySyncLearningMap.shared"),count:a,icon:He,tone:"shared"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(H,{className:"h-4 w-4"})}),e.jsx(R,{title:i("historySyncLearningMap.deeper"),count:t,icon:Re,tone:"deeper"})]}),e.jsxs(ue,{open:m,onOpenChange:g,children:[e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-8 w-full justify-between rounded-md px-2 text-xs text-muted-foreground hover:bg-muted/40 hover:text-foreground",children:[e.jsx("span",{children:i("historySyncLearningMap.showDetails")}),e.jsx(he,{className:y("h-4 w-4 transition-transform",m&&"rotate-180")})]})}),e.jsxs(me,{className:"pt-2",children:[e.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:i("historySyncLearningMap.modeSwitch")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:i("historySyncLearningMap.modeSwitchDesc")})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:i("historySyncLearningMap.historySyncGroup")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:i("historySyncLearningMap.historySyncGroupDesc")}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:p.map(l=>e.jsx(F,{variant:"outline",className:"font-mono text-[10px]",children:l},l))})]})]}),o>0&&e.jsx("div",{className:"mt-2 rounded-md border border-amber-500/50 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-300",children:i("historySyncLearningMap.legacyConfirmation",{count:o})})]})]})]})]})}function ht(){const{t:s}=G(),a=je(),{data:t,isLoading:c}=Ve(),o=Ye(),[x,i]=f.useState(!1),[m,g]=f.useState(!1),p=t?.accounts||[],l=t?.cliproxyCount||0,N=t?.legacyContextCount||0,j=t?.legacyContinuityCount||0,n=t?.sharedCount||0,r=t?.sharedStandardCount||0,d=t?.deeperSharedCount||0,C=t?.isolatedCount||0,A=Array.from(new Set(p.filter(v=>v.context_mode==="shared").map(v=>v.context_group||"default"))).sort((v,fe)=>v.localeCompare(fe)),_=p.filter(v=>v.context_inferred||v.continuity_inferred),h=_.length,pe=h>0,E=()=>a("/cliproxy?provider=claude"),K=()=>a("/cliproxy?provider=claude&action=auth"),U=()=>o.mutate(_);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-[calc(100vh-100px)] hidden lg:flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/20 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("accountsPage.title")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.manageSuffix")]})]}),e.jsx(ve,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.primaryActions")}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:()=>i(!0),children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:K,children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),s("accountsPage.authClaudeInPool")]}),e.jsxs(u,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:E,children:[s("accountsPage.openClaudePoolSettings"),e.jsx(H,{className:"w-4 h-4 ml-auto"})]})]}),pe?e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.migrationFollowup")}),e.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ke,{className:"h-4 w-4 mt-0.5 text-amber-700 dark:text-amber-400 shrink-0"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[N>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContextPending",{count:N})}),j>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContinuityPending",{count:j})})]})]}),e.jsx(u,{variant:"secondary",size:"sm",className:"w-full justify-start",onClick:U,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}):e.jsx("div",{className:"rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground",children:s("accountsPage.noLegacyFollowup")}),e.jsx(ue,{open:m,onOpenChange:g,children:e.jsxs(D,{children:[e.jsx(S,{className:"pb-2",children:e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-auto w-full justify-between px-0 py-0",children:[e.jsxs("div",{className:"text-left",children:[e.jsx(k,{className:"text-sm",children:s("accountsPage.continuityGuide")}),e.jsx(M,{className:"mt-1",children:s("accountsPage.expandWhenNeeded")})]}),e.jsx(he,{className:y("h-4 w-4 transition-transform",m&&"rotate-180")})]})})}),e.jsx(me,{children:e.jsxs(w,{className:"space-y-3 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedStandard")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.sharedStandardDesc")})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedDeeper")}),e.jsxs("p",{className:"mt-1",children:[s("accountsPage.sharedDeeperPrefix")," ",e.jsx("code",{children:"session-env"}),","," ",e.jsx("code",{children:"file-history"}),", ",e.jsx("code",{children:"shell-snapshots"}),","," ",e.jsx("code",{children:"todos"}),"."]})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.isolated")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.isolatedDesc")})]})]})})]})}),e.jsxs(D,{children:[e.jsxs(S,{className:"pb-2",children:[e.jsx(k,{className:"text-sm",children:s("accountsPage.quickCommands")}),e.jsx(M,{children:s("accountsPage.quickCommandsDesc")})]}),e.jsxs(w,{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth create work --context-group sprint-a --deeper-continuity"}),e.jsx(X,{value:"ccs auth create work --context-group sprint-a --deeper-continuity",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs cliproxy auth claude"}),e.jsx(X,{value:"ccs cliproxy auth claude",size:"icon"})]})]})]})]})})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col bg-background",children:[e.jsxs("div",{className:"px-5 py-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{variant:"outline",children:s("accountsPage.workspaceBadge")}),e.jsx(F,{variant:"secondary",children:s("accountsPage.historySyncBadge")})]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:s("accountsPage.authAccounts")}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[s("accountsPage.tableScopePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.tableScopeMiddle"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:s("accountsTable.sync")}),s("accountsPage.tableScopeSuffix")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 p-5 space-y-4 overflow-y-auto",children:[e.jsx(ce,{isolatedCount:C,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:A,legacyTargetCount:h,cliproxyCount:l}),e.jsxs(D,{className:"flex flex-col",children:[e.jsxs(S,{className:"pb-3",children:[e.jsx(k,{className:"text-lg",children:s("accountsPage.accountMatrix")}),e.jsx(M,{children:s("accountsPage.sharedTotalDesc",{count:n})})]}),e.jsx(w,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4 lg:hidden",children:[e.jsxs(D,{children:[e.jsxs(S,{children:[e.jsx(k,{className:"text-lg",children:s("accountsPage.title")}),e.jsxs(M,{children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.mobileManageSuffix")]})]}),e.jsxs(w,{className:"space-y-2",children:[e.jsxs(u,{className:"w-full",onClick:()=>i(!0),children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:E,children:[s("accountsPage.openCliProxyClaudePool"),e.jsx(H,{className:"w-4 h-4 ml-2"})]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:K,children:[s("accountsPage.authClaudeInPool"),e.jsx(Y,{className:"w-4 h-4 ml-2"})]}),e.jsx(u,{variant:"outline",className:"w-full",onClick:U,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}),e.jsx(ce,{isolatedCount:C,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:A,legacyTargetCount:h,cliproxyCount:l}),e.jsxs(D,{children:[e.jsx(S,{className:"pb-3",children:e.jsx(k,{className:"text-base",children:s("accountsPage.accountMatrix")})}),e.jsx(w,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]}),e.jsx(st,{open:x,onClose:()=>i(!1)})]})}export{ht as AccountsPage};
1
+ import{j as e}from"./radix-ui-BR1vy4kf.js";import{r as f,h as je}from"./react-vendor-CNOkPC89.js";import{u as ye,a as L,b as z,d as be,f as B,g as Ne}from"./tanstack-e99Cjjy2.js";import{c as y,Y as T,a as G,ad as oe,ae as re,af as le,ag as ie,ah as de,L as P,r as I,s as Q,t as Z,v as V,w as O,I as $,av as Ce,d as u,C as S,j as D,k,_ as M,B as F,b as w,M as ue,N as xe,O as me,n as ve,x as X}from"./index-Cw9Urr0S.js";import{A as Pe,a as Ae,b as Se,c as De,d as ke,e as we,f as Te,g as _e}from"./alert-dialog-DhwS38kc.js";import{t as b}from"./notifications-B2HqRBj7.js";import{aH as Me,aI as Le,l as q,ai as ze,I as Ge,Q as Oe,n as W,aJ as Fe,an as H,aK as He,aL as Re,r as he,aM as $e,aN as qe,U as Ee,a3 as J,Z as Y,T as Ke}from"./icons-DrEfTmfX.js";import{C as ee}from"./checkbox-CZrxD1iS.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Ue({className:s,...a}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:y("w-full caption-bottom text-sm",s),...a})})}function Be({className:s,...a}){return e.jsx("thead",{"data-slot":"table-header",className:y("[&_tr]:border-b",s),...a})}function Ie({className:s,...a}){return e.jsx("tbody",{"data-slot":"table-body",className:y("[&_tr:last-child]:border-0",s),...a})}function te({className:s,...a}){return e.jsx("tr",{"data-slot":"table-row",className:y("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",s),...a})}function Qe({className:s,...a}){return e.jsx("th",{"data-slot":"table-head",className:y("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function Ze({className:s,...a}){return e.jsx("td",{"data-slot":"table-cell",className:y("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...a})}function Ve(){return ye({queryKey:["accounts"],queryFn:()=>T.accounts.list(),select:s=>{const a=s.accounts.filter(l=>l.type!=="cliproxy"),t=s.accounts.length-a.length,c=a.filter(l=>l.context_mode==="shared").length,o=a.filter(l=>l.context_mode==="shared"&&l.continuity_mode==="deeper").length,x=Math.max(c-o,0),i=a.length-c,m=a.filter(l=>l.context_inferred).length,g=a.filter(l=>l.context_mode==="shared"&&l.continuity_mode!=="deeper"&&l.continuity_inferred).length,p=a.some(l=>l.name===s.default)?s.default:null;return{accounts:a,default:p,cliproxyCount:t,legacyContextCount:m,legacyContinuityCount:g,sharedCount:c,sharedStandardCount:x,deeperSharedCount:o,isolatedCount:i}}})}function Xe(){const s=L();return z({mutationFn:a=>T.accounts.setDefault(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),b.success(`Default account set to "${t}"`)},onError:a=>{b.error(a.message)}})}function We(){const s=L();return z({mutationFn:()=>T.accounts.resetDefault(),onSuccess:()=>{s.invalidateQueries({queryKey:["accounts"]}),b.success("Default account reset to CCS")},onError:a=>{b.error(a.message)}})}function Je(){const s=L();return z({mutationFn:a=>T.accounts.delete(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),b.success(`Account "${t}" deleted`)},onError:a=>{b.error(a.message)}})}function ge(){const s=L();return z({mutationFn:({name:a,context_mode:t,context_group:c,continuity_mode:o})=>T.accounts.updateContext(a,{context_mode:t,context_group:c,continuity_mode:o}),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]});const c=t.context_mode==="shared"?t.continuity_mode==="deeper"?`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, deeper continuity)`:`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, standard)`:"isolated";b.success(`Updated "${t.name}" context to ${c}`)},onError:a=>{b.error(a.message)}})}function Ye(){const s=L();return z({mutationFn:async a=>{const t=a.filter(c=>c.context_inferred||c.continuity_inferred);for(const c of t){const o=c.context_mode==="shared";await T.accounts.updateContext(c.name,{context_mode:o?"shared":"isolated",context_group:o?c.context_group||"default":void 0,continuity_mode:o?c.continuity_mode==="deeper"?"deeper":"standard":void 0})}return{updatedCount:t.length}},onSuccess:({updatedCount:a})=>{if(s.invalidateQueries({queryKey:["accounts"]}),a>0){b.success(`Confirmed explicit sync mode for ${a} legacy account${a>1?"s":""}`);return}b.info("No legacy accounts need confirmation")},onError:a=>{b.error(a.message)}})}const se=64,et=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function tt({account:s,onClose:a}){const{t}=G(),c=ge(),[o,x]=f.useState(s.context_mode==="shared"?"shared":"isolated"),[i,m]=f.useState(s.context_group||"default"),[g,p]=f.useState(s.continuity_mode==="deeper"?"deeper":"standard"),l=f.useMemo(()=>i.trim().toLowerCase().replace(/\s+/g,"-"),[i]),N=l.length>0&&l.length<=se&&et.test(l),j=o==="isolated"||N,n=()=>{j&&c.mutate({name:s.name,context_mode:o,context_group:o==="shared"?l:void 0,continuity_mode:o==="shared"?g:void 0},{onSuccess:()=>{a()}})},r=d=>{d||a()};return e.jsx(oe,{open:!0,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(ie,{children:t("editAccountContext.title")}),e.jsx(de,{children:t("editAccountContext.description",{name:s.name})})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"context-mode",children:t("editAccountContext.syncMode")}),e.jsxs(I,{value:o,onValueChange:d=>x(d),children:[e.jsx(Q,{id:"context-mode",children:e.jsx(Z,{placeholder:t("editAccountContext.selectContextMode")})}),e.jsxs(V,{children:[e.jsx(O,{value:"isolated",children:t("editAccountContext.isolatedOption")}),e.jsx(O,{value:"shared",children:t("editAccountContext.sharedOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(o==="shared"?"editAccountContext.sharedModeHint":"editAccountContext.isolatedModeHint")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"context-group",children:t("editAccountContext.historySyncGroup")}),e.jsx($,{id:"context-group",value:i,onChange:d=>m(d.target.value),placeholder:t("editAccountContext.groupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.groupHint",{max:se})}),!N&&e.jsx("p",{className:"text-xs text-destructive",children:t("editAccountContext.invalidGroup")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"continuity-mode",children:t("editAccountContext.continuityDepth")}),e.jsxs(I,{value:g,onValueChange:d=>p(d),children:[e.jsx(Q,{id:"continuity-mode",children:e.jsx(Z,{placeholder:t("editAccountContext.selectContinuityDepth")})}),e.jsxs(V,{children:[e.jsx(O,{value:"standard",children:t("editAccountContext.standardOption")}),e.jsx(O,{value:"deeper",children:t("editAccountContext.deeperOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(g==="deeper"?"editAccountContext.deeperHint":"editAccountContext.standardHint")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.credentialsIsolated")})]}),e.jsxs(Ce,{children:[e.jsx(u,{variant:"outline",onClick:a,disabled:c.isPending,children:t("editAccountContext.cancel")}),e.jsx(u,{onClick:n,disabled:!j||c.isPending,children:c.isPending?t("editAccountContext.saving"):t("editAccountContext.save")})]})]})})}function ae({data:s,defaultAccount:a}){const{t}=G(),c=Xe(),o=Je(),x=We(),i=ge(),[m,g]=f.useState(null),[p,l]=f.useState(null),N=[{accessorKey:"name",header:t("accountsTable.name"),size:200,cell:({row:n})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.original.name}),n.original.name===a&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:t("accountsTable.defaultBadge")})]})},{accessorKey:"type",header:t("accountsTable.type"),size:100,cell:({row:n})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:n.original.type||"oauth"})},{accessorKey:"created",header:t("accountsTable.created"),size:150,cell:({row:n})=>{const r=new Date(n.original.created);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{accessorKey:"last_used",header:t("accountsTable.lastUsed"),size:150,cell:({row:n})=>{if(!n.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const r=new Date(n.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{id:"context",header:t("accountsTable.historySync"),size:170,cell:({row:n})=>{if(n.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((n.original.context_mode||"isolated")==="shared"){const d=n.original.context_group||"default";return n.original.continuity_mode==="deeper"?e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupDeeper",{group:d})}):n.original.continuity_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.sharedGroupLegacy",{group:d})}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupStandard",{group:d})})}return n.original.context_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.isolatedLegacy")}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.isolated")})}},{id:"actions",header:t("accountsTable.actions"),size:220,cell:({row:n})=>{const r=n.original.name===a,d=c.isPending||o.isPending||i.isPending,C=n.original.type==="cliproxy",A=n.original.context_inferred||n.original.continuity_inferred;return e.jsxs("div",{className:"flex items-center gap-1",children:[!C&&e.jsxs(u,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:d,onClick:()=>l(n.original),title:t("accountsTable.syncTitle"),children:[e.jsx(Me,{className:"w-3.5 h-3.5 mr-1"}),t("accountsTable.sync")]}),!C&&A&&e.jsxs(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-700 hover:text-amber-700 hover:bg-amber-500/10 dark:text-amber-400 dark:hover:text-amber-400",disabled:d,onClick:()=>i.mutate({name:n.original.name,context_mode:n.original.context_mode==="shared"?"shared":"isolated",context_group:n.original.context_mode==="shared"?n.original.context_group||"default":void 0,continuity_mode:n.original.context_mode==="shared"?n.original.continuity_mode==="deeper"?"deeper":"standard":void 0}),title:t("accountsTable.confirmLegacyTitle"),children:[e.jsx(Le,{className:"w-3 h-3 mr-1"}),t("accountsTable.confirm")]}),e.jsxs(u,{variant:r?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:r||d,onClick:()=>c.mutate(n.original.name),children:[e.jsx(q,{className:`w-3 h-3 mr-1 ${r?"opacity-50":""}`}),t(r?"accountsTable.active":"accountsTable.setDefault")]}),e.jsx(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:r||d,onClick:()=>g(n.original.name),title:t(r?"accountsTable.cannotDeleteDefault":"accountsTable.deleteAccount"),children:e.jsx(ze,{className:"w-4 h-4"})})]})}}],j=be({data:s,columns:N,getCoreRowModel:Ne()});return s.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:t("accountsTable.noAccounts")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(Ue,{children:[e.jsx(Be,{children:j.getHeaderGroups().map(n=>e.jsx(te,{children:n.headers.map(r=>{const d={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",context:"w-[170px]",actions:"w-[290px]"}[r.id]||"w-auto";return e.jsx(Qe,{className:d,children:r.isPlaceholder?null:B(r.column.columnDef.header,r.getContext())},r.id)})},n.id))}),e.jsx(Ie,{children:j.getRowModel().rows.map(n=>e.jsx(te,{children:n.getVisibleCells().map(r=>e.jsx(Ze,{children:B(r.column.columnDef.cell,r.getContext())},r.id))},n.id))})]})}),a&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>x.mutate(),disabled:x.isPending,children:[e.jsx(Ge,{className:"w-4 h-4 mr-2"}),t("accountsTable.resetToDefault")]})})]}),p&&e.jsx(tt,{account:p,onClose:()=>l(null)}),e.jsx(Pe,{open:!!m,onOpenChange:n=>!n&&g(null),children:e.jsxs(Ae,{children:[e.jsxs(Se,{children:[e.jsx(De,{children:t("accountsTable.deleteDialogTitle")}),e.jsx(ke,{children:t("accountsTable.deleteDialogDesc",{name:m??""})})]}),e.jsxs(we,{children:[e.jsx(Te,{children:t("accountsTable.cancel")}),e.jsx(_e,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{m&&(o.mutate(m),g(null))},children:t("accountsTable.delete")})]})]})})]})}const ne=64;function st({open:s,onClose:a}){const{t}=G(),[c,o]=f.useState(""),[x,i]=f.useState(!1),[m,g]=f.useState(""),[p,l]=f.useState(!1),[N,j]=f.useState(!1),n=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(c),r=m.trim().toLowerCase().replace(/\s+/g,"-"),d=r.length===0||r.length<=ne&&/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(r),C=c&&n?[`ccs auth create ${c}`,x?r.length>0?`--context-group ${r}`:"--share-context":"",x&&p?"--deeper-continuity":""].filter(Boolean).join(" "):t("createAuthProfileDialog.commandFallback"),A=async()=>{!n||x&&!d||(await navigator.clipboard.writeText(C),j(!0),setTimeout(()=>j(!1),2e3))},_=()=>{o(""),i(!1),g(""),l(!1),j(!1),a()};return e.jsx(oe,{open:s,onOpenChange:h=>!h&&_(),children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(ie,{children:t("createAuthProfileDialog.title")}),e.jsx(de,{children:t("createAuthProfileDialog.description")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"profile-name",children:t("createAuthProfileDialog.profileName")}),e.jsx($,{id:"profile-name",value:c,onChange:h=>o(h.target.value),placeholder:t("createAuthProfileDialog.profileNamePlaceholder"),autoComplete:"off"}),c&&!n&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidProfileName")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{id:"share-context",checked:x,onCheckedChange:h=>i(h===!0)}),e.jsx(P,{htmlFor:"share-context",className:"cursor-pointer",children:t("createAuthProfileDialog.enableSharedHistory")})]}),x&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(P,{htmlFor:"context-group",children:t("createAuthProfileDialog.historySyncGroupOptional")}),e.jsx($,{id:"context-group",value:m,onChange:h=>g(h.target.value),placeholder:t("createAuthProfileDialog.historySyncGroupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.historySyncGroupHint")}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(ee,{id:"deeper-continuity",checked:p,onCheckedChange:h=>l(h===!0)}),e.jsx(P,{htmlFor:"deeper-continuity",className:"cursor-pointer",children:t("createAuthProfileDialog.deeperContinuity")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.deeperContinuityHint")}),m.trim().length>0&&!d&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidContextGroup",{max:ne})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{children:t("createAuthProfileDialog.command")}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(Oe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:C}),e.jsx(u,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:A,disabled:!n||x&&!d,children:N?e.jsx(q,{className:"w-4 h-4 text-green-500"}):e.jsx(W,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:t("createAuthProfileDialog.afterRunPrefix")}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep1")}),e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep2")})]}),e.jsx("p",{className:"pt-1",children:t("createAuthProfileDialog.poolingHint")})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{variant:"ghost",onClick:_,children:t("createAuthProfileDialog.close")}),e.jsx(u,{onClick:A,disabled:!n||x&&!d,children:N?e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copyCommand")]})})]})]})]})})}function R({title:s,count:a,icon:t,tone:c}){const o={isolated:{border:"border-blue-300/60 bg-blue-50/40 dark:border-blue-900/40 dark:bg-blue-900/10",icon:"text-blue-700 dark:text-blue-400",count:"text-blue-700 dark:text-blue-400"},shared:{border:"border-emerald-300/60 bg-emerald-50/40 dark:border-emerald-900/40 dark:bg-emerald-900/10",icon:"text-emerald-700 dark:text-emerald-400",count:"text-emerald-700 dark:text-emerald-400"},deeper:{border:"border-indigo-300/60 bg-indigo-50/40 dark:border-indigo-900/40 dark:bg-indigo-900/10",icon:"text-indigo-700 dark:text-indigo-400",count:"text-indigo-700 dark:text-indigo-400"}};return e.jsxs("div",{className:y("rounded-md border p-2.5",o[c].border),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs font-semibold",children:s}),e.jsx(t,{className:y("h-3.5 w-3.5",o[c].icon)})]}),e.jsx("p",{className:y("mt-1 text-lg font-mono font-semibold",o[c].count),children:a})]})}function ce({isolatedCount:s,sharedStandardCount:a,deeperSharedCount:t,sharedGroups:c,legacyTargetCount:o,cliproxyCount:x}){const{t:i}=G(),[m,g]=f.useState(!1),p=c.length>0?c:["default"];return e.jsxs(S,{className:"border-dashed",children:[e.jsx(D,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-base",children:i("historySyncLearningMap.title")}),e.jsx(M,{className:"mt-1",children:i("historySyncLearningMap.description")})]}),e.jsx(F,{variant:"outline",children:i("historySyncLearningMap.learningMap")})]})}),e.jsxs(w,{className:"space-y-3",children:[x>0&&e.jsx("div",{className:"rounded-md border border-blue-300/60 bg-blue-50/40 px-3 py-2 text-xs text-blue-800 dark:border-blue-900/40 dark:bg-blue-900/10 dark:text-blue-300",children:i("historySyncLearningMap.cliproxyManaged",{count:x})}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto_1fr_auto_1fr] sm:items-center",children:[e.jsx(R,{title:i("historySyncLearningMap.isolated"),count:s,icon:Fe,tone:"isolated"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(H,{className:"h-4 w-4"})}),e.jsx(R,{title:i("historySyncLearningMap.shared"),count:a,icon:He,tone:"shared"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(H,{className:"h-4 w-4"})}),e.jsx(R,{title:i("historySyncLearningMap.deeper"),count:t,icon:Re,tone:"deeper"})]}),e.jsxs(ue,{open:m,onOpenChange:g,children:[e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-8 w-full justify-between rounded-md px-2 text-xs text-muted-foreground hover:bg-muted/40 hover:text-foreground",children:[e.jsx("span",{children:i("historySyncLearningMap.showDetails")}),e.jsx(he,{className:y("h-4 w-4 transition-transform",m&&"rotate-180")})]})}),e.jsxs(me,{className:"pt-2",children:[e.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:i("historySyncLearningMap.modeSwitch")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:i("historySyncLearningMap.modeSwitchDesc")})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:i("historySyncLearningMap.historySyncGroup")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:i("historySyncLearningMap.historySyncGroupDesc")}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:p.map(l=>e.jsx(F,{variant:"outline",className:"font-mono text-[10px]",children:l},l))})]})]}),o>0&&e.jsx("div",{className:"mt-2 rounded-md border border-amber-500/50 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-300",children:i("historySyncLearningMap.legacyConfirmation",{count:o})})]})]})]})]})}function ht(){const{t:s}=G(),a=je(),{data:t,isLoading:c}=Ve(),o=Ye(),[x,i]=f.useState(!1),[m,g]=f.useState(!1),p=t?.accounts||[],l=t?.cliproxyCount||0,N=t?.legacyContextCount||0,j=t?.legacyContinuityCount||0,n=t?.sharedCount||0,r=t?.sharedStandardCount||0,d=t?.deeperSharedCount||0,C=t?.isolatedCount||0,A=Array.from(new Set(p.filter(v=>v.context_mode==="shared").map(v=>v.context_group||"default"))).sort((v,fe)=>v.localeCompare(fe)),_=p.filter(v=>v.context_inferred||v.continuity_inferred),h=_.length,pe=h>0,E=()=>a("/cliproxy?provider=claude"),K=()=>a("/cliproxy?provider=claude&action=auth"),U=()=>o.mutate(_);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"h-[calc(100vh-100px)] hidden lg:flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/20 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("accountsPage.title")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.manageSuffix")]})]}),e.jsx(ve,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.primaryActions")}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:()=>i(!0),children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:K,children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),s("accountsPage.authClaudeInPool")]}),e.jsxs(u,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:E,children:[s("accountsPage.openClaudePoolSettings"),e.jsx(H,{className:"w-4 h-4 ml-auto"})]})]}),pe?e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.migrationFollowup")}),e.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ke,{className:"h-4 w-4 mt-0.5 text-amber-700 dark:text-amber-400 shrink-0"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[N>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContextPending",{count:N})}),j>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContinuityPending",{count:j})})]})]}),e.jsx(u,{variant:"secondary",size:"sm",className:"w-full justify-start",onClick:U,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}):e.jsx("div",{className:"rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground",children:s("accountsPage.noLegacyFollowup")}),e.jsx(ue,{open:m,onOpenChange:g,children:e.jsxs(S,{children:[e.jsx(D,{className:"pb-2",children:e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-auto w-full justify-between px-0 py-0",children:[e.jsxs("div",{className:"text-left",children:[e.jsx(k,{className:"text-sm",children:s("accountsPage.continuityGuide")}),e.jsx(M,{className:"mt-1",children:s("accountsPage.expandWhenNeeded")})]}),e.jsx(he,{className:y("h-4 w-4 transition-transform",m&&"rotate-180")})]})})}),e.jsx(me,{children:e.jsxs(w,{className:"space-y-3 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedStandard")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.sharedStandardDesc")})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedDeeper")}),e.jsxs("p",{className:"mt-1",children:[s("accountsPage.sharedDeeperPrefix")," ",e.jsx("code",{children:"session-env"}),","," ",e.jsx("code",{children:"file-history"}),", ",e.jsx("code",{children:"shell-snapshots"}),","," ",e.jsx("code",{children:"todos"}),"."]})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.isolated")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.isolatedDesc")})]})]})})]})}),e.jsxs(S,{children:[e.jsxs(D,{className:"pb-2",children:[e.jsx(k,{className:"text-sm",children:s("accountsPage.quickCommands")}),e.jsx(M,{children:s("accountsPage.quickCommandsDesc")})]}),e.jsxs(w,{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth create work --context-group sprint-a --deeper-continuity"}),e.jsx(X,{value:"ccs auth create work --context-group sprint-a --deeper-continuity",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs cliproxy auth claude"}),e.jsx(X,{value:"ccs cliproxy auth claude",size:"icon"})]})]})]})]})})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col bg-background",children:[e.jsxs("div",{className:"px-5 py-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{variant:"outline",children:s("accountsPage.workspaceBadge")}),e.jsx(F,{variant:"secondary",children:s("accountsPage.historySyncBadge")})]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:s("accountsPage.authAccounts")}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[s("accountsPage.tableScopePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.tableScopeMiddle"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:s("accountsTable.sync")}),s("accountsPage.tableScopeSuffix")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 p-5 space-y-4 overflow-y-auto",children:[e.jsx(ce,{isolatedCount:C,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:A,legacyTargetCount:h,cliproxyCount:l}),e.jsxs(S,{className:"flex flex-col",children:[e.jsxs(D,{className:"pb-3",children:[e.jsx(k,{className:"text-lg",children:s("accountsPage.accountMatrix")}),e.jsx(M,{children:s("accountsPage.sharedTotalDesc",{count:n})})]}),e.jsx(w,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4 lg:hidden",children:[e.jsxs(S,{children:[e.jsxs(D,{children:[e.jsx(k,{className:"text-lg",children:s("accountsPage.title")}),e.jsxs(M,{children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.mobileManageSuffix")]})]}),e.jsxs(w,{className:"space-y-2",children:[e.jsxs(u,{className:"w-full",onClick:()=>i(!0),children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:E,children:[s("accountsPage.openCliProxyClaudePool"),e.jsx(H,{className:"w-4 h-4 ml-2"})]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:K,children:[s("accountsPage.authClaudeInPool"),e.jsx(Y,{className:"w-4 h-4 ml-2"})]}),e.jsx(u,{variant:"outline",className:"w-full",onClick:U,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}),e.jsx(ce,{isolatedCount:C,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:A,legacyTargetCount:h,cliproxyCount:l}),e.jsxs(S,{children:[e.jsx(D,{className:"pb-3",children:e.jsx(k,{className:"text-base",children:s("accountsPage.accountMatrix")})}),e.jsx(w,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]}),e.jsx(st,{open:x,onClose:()=>i(!1)})]})}export{ht as AccountsPage};
@@ -1 +1 @@
1
- import{j as e,a4 as s,a5 as r,a6 as n,a7 as i,a8 as d,a9 as c,aa as u,ab as f}from"./radix-ui-BR1vy4kf.js";import"./react-vendor-CNOkPC89.js";import{c as o,bD as l}from"./index-BL_PxzDX.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
+ import{j as e,a4 as s,a5 as r,a6 as n,a7 as i,a8 as d,a9 as c,aa as u,ab as f}from"./radix-ui-BR1vy4kf.js";import"./react-vendor-CNOkPC89.js";import{c as o,bD as l}from"./index-Cw9Urr0S.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};