zidane-gui 7.1.1 → 7.1.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/out/main/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { resolve, delimiter, join, dirname, basename, isAbsolute } from "node:pa
|
|
|
2
2
|
import { config } from "dotenv";
|
|
3
3
|
import { app, shell, BrowserWindow, ipcMain, dialog, nativeImage } from "electron";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
|
-
import { parseEditorCommand, keybindingsPath, stripJsonComments, ensureKeybindingsFile, readProjects, writeProjects, credentialsPath, applyApiKeyEnv, BUILTIN_PROVIDERS, readCredentials, detectAuth, supportsOAuth, runOAuthLogin, setProviderCredential, scopeCwd, resolveConfig, DEFAULT_SETTINGS, enforceSettingsInvariants, mcpsWritePath, upsertMcpServer, discoverProjectMcps, removeMcpServer, loadMcpToolsCache, subscribeMcpToolsCache, refreshMcpToolsCatalog, createFileMcpCredentialStore, createChatHost, toTodosSnapshot, searchSessionHistory, searchableTurnText, deriveSessionTitle, toolCallPreview, modelChainMetadata, sessionModelFallbacks, resolveSessionCwd, modelSupportsReasoning, enabledModelOptions, buildModelCatalog, modelsForDescriptor, getContextWindow, truncateTurnsAt, deleteTurnSafely, generateSessionTitle, writeSessionExport, toolResultText, sumRunCosts, effectiveContextWindow, lastContextSizeFromTurns, fmtTokens, groupArtifacts, selectActiveTodos, setTodosForRun, sanitizeTodoItems, DEFAULT_MAX_TODO_ITEMS, fetchAllProviderUsage, fetchProviderUsage, listProjectFiles, discoverProjectSkills, discoverProjectPlugins, readProviderCredential, removeProviderCredential, setPreferredCredential, hasClaudeCodeSetup, countClaudeSessionFiles, importFromClaudeCode, isMainSession, findGitRoot, restoreModelOptions, modelOptionsFor, eventsFromTurns, watchInstalledVersion, checkForUpdate, upgradeInstalledPackages, performSelfUpdate, compareSemver, findInstalledCompanion } from "zidane/chat";
|
|
5
|
+
import { parseEditorCommand, keybindingsPath, stripJsonComments, ensureKeybindingsFile, readProjects, writeProjects, credentialsPath, applyApiKeyEnv, BUILTIN_PROVIDERS, readCredentials, detectAuth, supportsOAuth, runOAuthLogin, DEFAULT_OAUTH_ACCOUNT_LABEL, setProviderCredential, scopeCwd, resolveConfig, DEFAULT_SETTINGS, enforceSettingsInvariants, mcpsWritePath, upsertMcpServer, discoverProjectMcps, removeMcpServer, loadMcpToolsCache, subscribeMcpToolsCache, refreshMcpToolsCatalog, createFileMcpCredentialStore, createChatHost, toTodosSnapshot, searchSessionHistory, searchableTurnText, deriveSessionTitle, toolCallPreview, modelChainMetadata, sessionModelFallbacks, resolveSessionCwd, modelSupportsReasoning, enabledModelOptions, buildModelCatalog, modelsForDescriptor, getContextWindow, truncateTurnsAt, deleteTurnSafely, generateSessionTitle, writeSessionExport, toolResultText, sumRunCosts, effectiveContextWindow, lastContextSizeFromTurns, fmtTokens, groupArtifacts, selectActiveTodos, setTodosForRun, sanitizeTodoItems, DEFAULT_MAX_TODO_ITEMS, fetchAllProviderUsage, fetchProviderUsage, listProjectFiles, discoverProjectSkills, discoverProjectPlugins, readProviderCredential, removeProviderCredential, setPreferredCredential, removeStoredCredential, setCredentialLabel, hasClaudeCodeSetup, countClaudeSessionFiles, importFromClaudeCode, isMainSession, findGitRoot, restoreModelOptions, modelOptionsFor, eventsFromTurns, watchInstalledVersion, checkForUpdate, upgradeInstalledPackages, performSelfUpdate, compareSemver, findInstalledCompanion } from "zidane/chat";
|
|
6
6
|
import { spawn, execFile } from "node:child_process";
|
|
7
7
|
import { mkdirSync, readFileSync, writeFileSync, existsSync, accessSync, constants, statSync, readdirSync, copyFileSync, rmSync } from "node:fs";
|
|
8
8
|
import { homedir, userInfo } from "node:os";
|
|
@@ -185,7 +185,7 @@ function broadcastOAuth(signal) {
|
|
|
185
185
|
function descriptorFor$1(provider) {
|
|
186
186
|
return BUILTIN_PROVIDERS[provider] ?? null;
|
|
187
187
|
}
|
|
188
|
-
function startOAuth(provider) {
|
|
188
|
+
function startOAuth(provider, options = {}) {
|
|
189
189
|
const descriptor = descriptorFor$1(provider);
|
|
190
190
|
if (!descriptor) {
|
|
191
191
|
throw new Error(`Unknown provider: ${provider}`);
|
|
@@ -212,7 +212,13 @@ function startOAuth(provider) {
|
|
|
212
212
|
},
|
|
213
213
|
signal: controller.signal
|
|
214
214
|
}).then((creds) => {
|
|
215
|
-
|
|
215
|
+
const label = options.label?.trim() || DEFAULT_OAUTH_ACCOUNT_LABEL;
|
|
216
|
+
setProviderCredential(
|
|
217
|
+
userDataDir(),
|
|
218
|
+
descriptor,
|
|
219
|
+
{ kind: "oauth", ...creds, label },
|
|
220
|
+
options.replaceKey ? { replaceKey: options.replaceKey } : {}
|
|
221
|
+
);
|
|
216
222
|
applyAuthEnv();
|
|
217
223
|
broadcastOAuth({ requestId, kind: "success" });
|
|
218
224
|
}).catch((err) => {
|
|
@@ -4449,21 +4455,54 @@ function registerChatIpc() {
|
|
|
4449
4455
|
});
|
|
4450
4456
|
ipcMain.handle(
|
|
4451
4457
|
"auth:setPreferredCredential",
|
|
4452
|
-
async (_e, provider,
|
|
4458
|
+
async (_e, provider, target, cwd) => {
|
|
4453
4459
|
const providers = await providersFor(cwd);
|
|
4454
4460
|
const desc = descriptorFor(provider, providers);
|
|
4455
4461
|
if (!desc) {
|
|
4456
4462
|
throw new Error(`Unknown provider: ${provider}`);
|
|
4457
4463
|
}
|
|
4458
|
-
const outcome = setPreferredCredential(userDataDir(), desc,
|
|
4464
|
+
const outcome = setPreferredCredential(userDataDir(), desc, target);
|
|
4465
|
+
const what = typeof target === "string" ? `${target} credential` : `credential ${target.key}`;
|
|
4459
4466
|
if (outcome === "not-stored") {
|
|
4460
|
-
throw new Error(`no stored ${
|
|
4467
|
+
throw new Error(`no stored ${what} for ${desc.label} — sign in with it first`);
|
|
4468
|
+
}
|
|
4469
|
+
applyAuthEnv();
|
|
4470
|
+
return detectAuth(userDataDir(), providers).map((r) => toAuthStatus(r, providers));
|
|
4471
|
+
}
|
|
4472
|
+
);
|
|
4473
|
+
ipcMain.handle(
|
|
4474
|
+
"auth:removeCredential",
|
|
4475
|
+
async (_e, provider, key, cwd) => {
|
|
4476
|
+
const providers = await providersFor(cwd);
|
|
4477
|
+
const desc = descriptorFor(provider, providers);
|
|
4478
|
+
if (!desc) {
|
|
4479
|
+
throw new Error(`Unknown provider: ${provider}`);
|
|
4480
|
+
}
|
|
4481
|
+
if (!removeStoredCredential(userDataDir(), desc, key)) {
|
|
4482
|
+
throw new Error(`no stored credential ${key} for ${desc.label}`);
|
|
4461
4483
|
}
|
|
4462
4484
|
applyAuthEnv();
|
|
4463
4485
|
return detectAuth(userDataDir(), providers).map((r) => toAuthStatus(r, providers));
|
|
4464
4486
|
}
|
|
4465
4487
|
);
|
|
4466
|
-
ipcMain.handle(
|
|
4488
|
+
ipcMain.handle(
|
|
4489
|
+
"auth:renameCredential",
|
|
4490
|
+
async (_e, provider, key, label, cwd) => {
|
|
4491
|
+
const providers = await providersFor(cwd);
|
|
4492
|
+
const desc = descriptorFor(provider, providers);
|
|
4493
|
+
if (!desc) {
|
|
4494
|
+
throw new Error(`Unknown provider: ${provider}`);
|
|
4495
|
+
}
|
|
4496
|
+
if (!setCredentialLabel(userDataDir(), desc, key, label)) {
|
|
4497
|
+
throw new Error(`no stored OAuth account ${key} for ${desc.label}`);
|
|
4498
|
+
}
|
|
4499
|
+
return detectAuth(userDataDir(), providers).map((r) => toAuthStatus(r, providers));
|
|
4500
|
+
}
|
|
4501
|
+
);
|
|
4502
|
+
ipcMain.handle(
|
|
4503
|
+
"auth:startOAuth",
|
|
4504
|
+
(_e, provider, options) => startOAuth(provider, options)
|
|
4505
|
+
);
|
|
4467
4506
|
ipcMain.handle("auth:cancelOAuth", (_e, requestId) => cancelOAuth(requestId));
|
|
4468
4507
|
ipcMain.handle("settings:get", () => {
|
|
4469
4508
|
return readSettings();
|
package/out/preload/index.mjs
CHANGED
|
@@ -204,8 +204,10 @@ const api = {
|
|
|
204
204
|
setApiKey: (provider, key, cwd) => ipcRenderer.invoke("auth:setApiKey", provider, key, cwd),
|
|
205
205
|
configureProvider: (provider, input, cwd) => ipcRenderer.invoke("auth:configureProvider", provider, input, cwd),
|
|
206
206
|
clear: (provider, cwd) => ipcRenderer.invoke("auth:clear", provider, cwd),
|
|
207
|
-
setPreferredCredential: (provider,
|
|
208
|
-
|
|
207
|
+
setPreferredCredential: (provider, target, cwd) => ipcRenderer.invoke("auth:setPreferredCredential", provider, target, cwd),
|
|
208
|
+
removeCredential: (provider, key, cwd) => ipcRenderer.invoke("auth:removeCredential", provider, key, cwd),
|
|
209
|
+
renameCredential: (provider, key, label, cwd) => ipcRenderer.invoke("auth:renameCredential", provider, key, label, cwd),
|
|
210
|
+
startOAuth: (provider, options) => ipcRenderer.invoke("auth:startOAuth", provider, options),
|
|
209
211
|
cancelOAuth: (requestId) => ipcRenderer.invoke("auth:cancelOAuth", requestId),
|
|
210
212
|
onOAuthProgress: (cb) => subscribe("auth:oauth", cb)
|
|
211
213
|
},
|
|
@@ -12507,6 +12507,7 @@ function utf8ByteLength(text2) {
|
|
|
12507
12507
|
}
|
|
12508
12508
|
return bytes;
|
|
12509
12509
|
}
|
|
12510
|
+
const DEFAULT_OAUTH_ACCOUNT_LABEL = "Default";
|
|
12510
12511
|
function fmtTokens(n) {
|
|
12511
12512
|
if (n < 1e3) return String(n);
|
|
12512
12513
|
if (n < 1e6) return `${(n / 1e3).toFixed(n < 1e4 ? 2 : 1)}k`;
|
|
@@ -89249,7 +89250,7 @@ const PROVIDERS = [
|
|
|
89249
89250
|
{
|
|
89250
89251
|
key: "anthropic",
|
|
89251
89252
|
label: "Anthropic",
|
|
89252
|
-
description: "Claude
|
|
89253
|
+
description: "Claude Opus, Sonnet and Haiku. API key or OAuth.",
|
|
89253
89254
|
placeholder: "sk-ant-…",
|
|
89254
89255
|
supportsOAuth: true
|
|
89255
89256
|
},
|
|
@@ -89257,13 +89258,13 @@ const PROVIDERS = [
|
|
|
89257
89258
|
key: "openai",
|
|
89258
89259
|
label: "OpenAI Codex",
|
|
89259
89260
|
description: "GPT-5 family via Codex. OAuth-only (Sign in with ChatGPT).",
|
|
89260
|
-
placeholder: "(OAuth only
|
|
89261
|
+
placeholder: "(OAuth only, use Sign in)",
|
|
89261
89262
|
supportsOAuth: true
|
|
89262
89263
|
},
|
|
89263
89264
|
{
|
|
89264
89265
|
key: "openrouter",
|
|
89265
89266
|
label: "OpenRouter",
|
|
89266
|
-
description: "Cross-model proxy
|
|
89267
|
+
description: "Cross-model proxy: any model, one API key.",
|
|
89267
89268
|
placeholder: "sk-or-…",
|
|
89268
89269
|
supportsOAuth: false
|
|
89269
89270
|
},
|
|
@@ -89328,12 +89329,12 @@ function AuthPanel({ cwd: cwd2 }) {
|
|
|
89328
89329
|
});
|
|
89329
89330
|
return () => unsubscribe();
|
|
89330
89331
|
}, [refresh]);
|
|
89331
|
-
const handleStartOAuth = reactExports.useCallback(async (provider) => {
|
|
89332
|
+
const handleStartOAuth = reactExports.useCallback(async (provider, options) => {
|
|
89332
89333
|
try {
|
|
89333
|
-
const { requestId } = await window.api.auth.startOAuth(provider);
|
|
89334
|
+
const { requestId } = await window.api.auth.startOAuth(provider, options);
|
|
89334
89335
|
setFlows((prev) => [
|
|
89335
89336
|
...prev.filter((f2) => f2.provider !== provider),
|
|
89336
|
-
{ requestId, provider, phase: { kind: "progress", message: "Starting…" } }
|
|
89337
|
+
{ requestId, provider, phase: { kind: "progress", message: "Starting…" }, options }
|
|
89337
89338
|
]);
|
|
89338
89339
|
} catch (err) {
|
|
89339
89340
|
setFlows((prev) => [
|
|
@@ -89341,7 +89342,8 @@ function AuthPanel({ cwd: cwd2 }) {
|
|
|
89341
89342
|
{
|
|
89342
89343
|
requestId: `${provider}-error-${Date.now()}`,
|
|
89343
89344
|
provider,
|
|
89344
|
-
phase: { kind: "error", error: err.message }
|
|
89345
|
+
phase: { kind: "error", error: err.message },
|
|
89346
|
+
options
|
|
89345
89347
|
}
|
|
89346
89348
|
]);
|
|
89347
89349
|
}
|
|
@@ -89375,9 +89377,9 @@ function AuthPanel({ cwd: cwd2 }) {
|
|
|
89375
89377
|
flow: flow2,
|
|
89376
89378
|
cwd: cwd2,
|
|
89377
89379
|
onChanged: () => void refresh(),
|
|
89378
|
-
onStartOAuth: () => void handleStartOAuth(meta.key),
|
|
89380
|
+
onStartOAuth: (options) => void handleStartOAuth(meta.key, options),
|
|
89379
89381
|
onCancelFlow: (requestId) => void handleCancelFlow(requestId),
|
|
89380
|
-
onRetryFlow: () => void handleStartOAuth(meta.key)
|
|
89382
|
+
onRetryFlow: () => void handleStartOAuth(meta.key, flow2?.options)
|
|
89381
89383
|
},
|
|
89382
89384
|
meta.key
|
|
89383
89385
|
);
|
|
@@ -89409,6 +89411,16 @@ function ProviderRow$1({
|
|
|
89409
89411
|
const [fieldValues, setFieldValues] = reactExports.useState({});
|
|
89410
89412
|
const [busy, setBusy] = reactExports.useState(null);
|
|
89411
89413
|
const [rowError, setRowError] = reactExports.useState(null);
|
|
89414
|
+
const [namingAccount, setNamingAccount] = reactExports.useState(false);
|
|
89415
|
+
const [accountName, setAccountName] = reactExports.useState("");
|
|
89416
|
+
const trimmedAccountName = accountName.trim();
|
|
89417
|
+
const startNamedAccount = () => {
|
|
89418
|
+
if (!trimmedAccountName) {
|
|
89419
|
+
return;
|
|
89420
|
+
}
|
|
89421
|
+
setNamingAccount(false);
|
|
89422
|
+
onStartOAuth({ label: trimmedAccountName });
|
|
89423
|
+
};
|
|
89412
89424
|
const customFields = status?.customFields ?? [];
|
|
89413
89425
|
const hasCustomFields = customFields.length > 0;
|
|
89414
89426
|
const apiKeySupported = !hasCustomFields && meta.key !== "openai";
|
|
@@ -89484,13 +89496,21 @@ function ProviderRow$1({
|
|
|
89484
89496
|
] }),
|
|
89485
89497
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-[var(--zg-text-muted)] mt-0.5", children: meta.description })
|
|
89486
89498
|
] }),
|
|
89487
|
-
!editing && meta.supportsOAuth && !flow2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89499
|
+
!editing && !namingAccount && meta.supportsOAuth && !flow2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89488
89500
|
"button",
|
|
89489
89501
|
{
|
|
89490
89502
|
type: "button",
|
|
89491
|
-
onClick:
|
|
89503
|
+
onClick: () => {
|
|
89504
|
+
if (hasOAuth) {
|
|
89505
|
+
setRowError(null);
|
|
89506
|
+
setAccountName("");
|
|
89507
|
+
setNamingAccount(true);
|
|
89508
|
+
} else {
|
|
89509
|
+
onStartOAuth();
|
|
89510
|
+
}
|
|
89511
|
+
},
|
|
89492
89512
|
className: `${BTN_PRIMARY} focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-accent)]`,
|
|
89493
|
-
children: hasOAuth ? "
|
|
89513
|
+
children: hasOAuth ? "Add account" : `Sign in with ${meta.label}`
|
|
89494
89514
|
}
|
|
89495
89515
|
),
|
|
89496
89516
|
!editing && (apiKeySupported || hasCustomFields) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -89522,6 +89542,46 @@ function ProviderRow$1({
|
|
|
89522
89542
|
onRetry: onRetryFlow
|
|
89523
89543
|
}
|
|
89524
89544
|
),
|
|
89545
|
+
namingAccount && !flow2 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
89546
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89547
|
+
"input",
|
|
89548
|
+
{
|
|
89549
|
+
autoFocus: true,
|
|
89550
|
+
type: "text",
|
|
89551
|
+
placeholder: "Account name, for example work or personal",
|
|
89552
|
+
value: accountName,
|
|
89553
|
+
onChange: (e) => setAccountName(e.target.value),
|
|
89554
|
+
onKeyDown: (e) => {
|
|
89555
|
+
if (e.key === "Enter") {
|
|
89556
|
+
startNamedAccount();
|
|
89557
|
+
}
|
|
89558
|
+
if (e.key === "Escape") {
|
|
89559
|
+
setNamingAccount(false);
|
|
89560
|
+
}
|
|
89561
|
+
},
|
|
89562
|
+
className: "flex-1 text-sm bg-[var(--zg-bg)] border border-[var(--zg-border)] rounded-md px-3 py-2 text-[var(--zg-text)] outline-none focus:border-[var(--zg-accent)] focus:ring-2 focus:ring-[var(--zg-accent)]/20"
|
|
89563
|
+
}
|
|
89564
|
+
),
|
|
89565
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89566
|
+
"button",
|
|
89567
|
+
{
|
|
89568
|
+
type: "button",
|
|
89569
|
+
disabled: !trimmedAccountName,
|
|
89570
|
+
onClick: startNamedAccount,
|
|
89571
|
+
className: `${BTN_PRIMARY} focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-accent)]`,
|
|
89572
|
+
children: "Sign in"
|
|
89573
|
+
}
|
|
89574
|
+
),
|
|
89575
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89576
|
+
"button",
|
|
89577
|
+
{
|
|
89578
|
+
type: "button",
|
|
89579
|
+
onClick: () => setNamingAccount(false),
|
|
89580
|
+
className: `${BTN_SECONDARY} focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-accent)]`,
|
|
89581
|
+
children: "Cancel"
|
|
89582
|
+
}
|
|
89583
|
+
)
|
|
89584
|
+
] }),
|
|
89525
89585
|
editing && (hasCustomFields ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3 space-y-3", children: [
|
|
89526
89586
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-2", children: customFields.map((field, index2) => {
|
|
89527
89587
|
const valueForField = fieldValues[field.key] ?? "";
|
|
@@ -89614,7 +89674,16 @@ function ProviderRow$1({
|
|
|
89614
89674
|
}
|
|
89615
89675
|
)
|
|
89616
89676
|
] })),
|
|
89617
|
-
status && isExpandableProvider(status) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89677
|
+
status && isExpandableProvider(status) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89678
|
+
CredentialSources,
|
|
89679
|
+
{
|
|
89680
|
+
status,
|
|
89681
|
+
cwd: cwd2 ?? null,
|
|
89682
|
+
onChanged,
|
|
89683
|
+
onError: setRowError,
|
|
89684
|
+
onReauth: meta.supportsOAuth && !flow2 ? (options) => onStartOAuth(options) : void 0
|
|
89685
|
+
}
|
|
89686
|
+
),
|
|
89618
89687
|
rowError && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 text-xs text-[#ef4444]", children: rowError })
|
|
89619
89688
|
] });
|
|
89620
89689
|
}
|
|
@@ -89694,14 +89763,40 @@ function CredentialSources({
|
|
|
89694
89763
|
status,
|
|
89695
89764
|
cwd: cwd2,
|
|
89696
89765
|
onChanged,
|
|
89697
|
-
onError
|
|
89766
|
+
onError,
|
|
89767
|
+
onReauth
|
|
89698
89768
|
}) {
|
|
89699
89769
|
const [busy, setBusy] = reactExports.useState(null);
|
|
89700
|
-
const
|
|
89770
|
+
const [renaming, setRenaming] = reactExports.useState(null);
|
|
89771
|
+
const identity = (method) => method.key ?? method.source;
|
|
89772
|
+
const use = async (method) => {
|
|
89773
|
+
try {
|
|
89774
|
+
onError(null);
|
|
89775
|
+
setBusy(`use:${identity(method)}`);
|
|
89776
|
+
await window.api.auth.setPreferredCredential(
|
|
89777
|
+
status.key,
|
|
89778
|
+
method.key ? { key: method.key } : method.source,
|
|
89779
|
+
cwd2 ?? void 0
|
|
89780
|
+
);
|
|
89781
|
+
onChanged();
|
|
89782
|
+
} catch (err) {
|
|
89783
|
+
onError(err.message);
|
|
89784
|
+
} finally {
|
|
89785
|
+
setBusy(null);
|
|
89786
|
+
}
|
|
89787
|
+
};
|
|
89788
|
+
const remove = async (method) => {
|
|
89789
|
+
if (!method.key) {
|
|
89790
|
+
return;
|
|
89791
|
+
}
|
|
89792
|
+
const name2 = method.label ?? method.source;
|
|
89793
|
+
if (!confirm(`Remove ${status.label} ${name2}${method.active ? " (in use)" : ""}?`)) {
|
|
89794
|
+
return;
|
|
89795
|
+
}
|
|
89701
89796
|
try {
|
|
89702
89797
|
onError(null);
|
|
89703
|
-
setBusy(
|
|
89704
|
-
await window.api.auth.
|
|
89798
|
+
setBusy(`remove:${method.key}`);
|
|
89799
|
+
await window.api.auth.removeCredential(status.key, method.key, cwd2 ?? void 0);
|
|
89705
89800
|
onChanged();
|
|
89706
89801
|
} catch (err) {
|
|
89707
89802
|
onError(err.message);
|
|
@@ -89709,9 +89804,35 @@ function CredentialSources({
|
|
|
89709
89804
|
setBusy(null);
|
|
89710
89805
|
}
|
|
89711
89806
|
};
|
|
89807
|
+
const commitRename = async (method) => {
|
|
89808
|
+
if (!renaming || !method.key) {
|
|
89809
|
+
return;
|
|
89810
|
+
}
|
|
89811
|
+
const next = renaming.draft.trim();
|
|
89812
|
+
setRenaming(null);
|
|
89813
|
+
if (next === (method.label ?? "")) {
|
|
89814
|
+
return;
|
|
89815
|
+
}
|
|
89816
|
+
try {
|
|
89817
|
+
onError(null);
|
|
89818
|
+
setBusy(`rename:${method.key}`);
|
|
89819
|
+
await window.api.auth.renameCredential(status.key, method.key, next, cwd2 ?? void 0);
|
|
89820
|
+
onChanged();
|
|
89821
|
+
} catch (err) {
|
|
89822
|
+
onError(err.message);
|
|
89823
|
+
} finally {
|
|
89824
|
+
setBusy(null);
|
|
89825
|
+
}
|
|
89826
|
+
};
|
|
89827
|
+
const ROW_BTN = "zg-press ml-1 h-5 px-1.5 shrink-0 rounded text-[11px] leading-none text-[var(--zg-text-muted)] hover:text-[var(--zg-text)] hover:bg-[var(--zg-bg-hover)] border border-[var(--zg-border)] bg-transparent cursor-pointer disabled:opacity-40";
|
|
89712
89828
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "mt-2 ml-6 flex flex-col gap-1 list-none m-0 p-0", "aria-label": `${status.label} credential sources`, children: status.methods.map((method) => {
|
|
89713
89829
|
const isEnv = method.source === "env";
|
|
89714
89830
|
const selectable = !isEnv && !method.active;
|
|
89831
|
+
const id = identity(method);
|
|
89832
|
+
const title = method.label ?? method.source;
|
|
89833
|
+
const detail = method.label && method.detail.startsWith(`${method.label} · `) ? `${method.source} · ${method.detail.slice(method.label.length + 3)}` : method.detail;
|
|
89834
|
+
const isRenaming = renaming !== null && renaming.key === method.key;
|
|
89835
|
+
const renamable = method.source === "oauth" && !!method.key;
|
|
89715
89836
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-2 text-xs", children: [
|
|
89716
89837
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89717
89838
|
"span",
|
|
@@ -89721,21 +89842,84 @@ function CredentialSources({
|
|
|
89721
89842
|
children: isEnv || method.active ? "●" : "○"
|
|
89722
89843
|
}
|
|
89723
89844
|
),
|
|
89724
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89725
|
-
|
|
89845
|
+
isRenaming ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89846
|
+
"input",
|
|
89847
|
+
{
|
|
89848
|
+
autoFocus: true,
|
|
89849
|
+
type: "text",
|
|
89850
|
+
"aria-label": `New name for ${title}`,
|
|
89851
|
+
placeholder: DEFAULT_OAUTH_ACCOUNT_LABEL,
|
|
89852
|
+
value: renaming.draft,
|
|
89853
|
+
onChange: (e) => setRenaming({ key: renaming.key, draft: e.target.value }),
|
|
89854
|
+
onKeyDown: (e) => {
|
|
89855
|
+
if (e.key === "Enter") {
|
|
89856
|
+
void commitRename(method);
|
|
89857
|
+
}
|
|
89858
|
+
if (e.key === "Escape") {
|
|
89859
|
+
setRenaming(null);
|
|
89860
|
+
}
|
|
89861
|
+
},
|
|
89862
|
+
className: "font-mono text-xs h-5 px-1.5 min-w-0 flex-1 bg-[var(--zg-bg)] border border-[var(--zg-accent)] rounded text-[var(--zg-text)] outline-none"
|
|
89863
|
+
}
|
|
89864
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
89865
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `font-mono ${method.active ? "text-[var(--zg-accent)]" : "text-[var(--zg-text)]"}`, children: title }),
|
|
89866
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[var(--zg-text-muted)] truncate min-w-0 shrink", title: detail, children: detail })
|
|
89867
|
+
] }),
|
|
89726
89868
|
method.active && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[var(--zg-text-muted)] shrink-0", children: "(in use)" }),
|
|
89727
|
-
|
|
89869
|
+
isRenaming && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
89870
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => void commitRename(method), className: ROW_BTN, title: "Save name", children: "Save" }),
|
|
89871
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => setRenaming(null), className: ROW_BTN, title: "Cancel rename", children: "Cancel" })
|
|
89872
|
+
] }),
|
|
89873
|
+
selectable && !isRenaming && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89874
|
+
"button",
|
|
89875
|
+
{
|
|
89876
|
+
type: "button",
|
|
89877
|
+
disabled: busy !== null,
|
|
89878
|
+
onClick: () => void use(method),
|
|
89879
|
+
className: ROW_BTN,
|
|
89880
|
+
title: `Make this ${method.source} credential the one zidane uses for ${status.label}`,
|
|
89881
|
+
children: busy === `use:${id}` ? "Switching…" : "Use"
|
|
89882
|
+
}
|
|
89883
|
+
),
|
|
89884
|
+
renamable && !isRenaming && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89885
|
+
"button",
|
|
89886
|
+
{
|
|
89887
|
+
type: "button",
|
|
89888
|
+
disabled: busy !== null,
|
|
89889
|
+
onClick: () => {
|
|
89890
|
+
if (method.key) {
|
|
89891
|
+
onError(null);
|
|
89892
|
+
setRenaming({ key: method.key, draft: method.label ?? "" });
|
|
89893
|
+
}
|
|
89894
|
+
},
|
|
89895
|
+
className: ROW_BTN,
|
|
89896
|
+
title: `Rename ${title}`,
|
|
89897
|
+
children: busy === `rename:${id}` ? "Renaming…" : "Rename"
|
|
89898
|
+
}
|
|
89899
|
+
),
|
|
89900
|
+
renamable && !isRenaming && onReauth && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89901
|
+
"button",
|
|
89902
|
+
{
|
|
89903
|
+
type: "button",
|
|
89904
|
+
disabled: busy !== null,
|
|
89905
|
+
onClick: () => onReauth({ replaceKey: method.key, ...method.label ? { label: method.label } : {} }),
|
|
89906
|
+
className: ROW_BTN,
|
|
89907
|
+
title: `Sign in again for ${title}`,
|
|
89908
|
+
children: "Re-auth"
|
|
89909
|
+
}
|
|
89910
|
+
),
|
|
89911
|
+
method.key && !isRenaming && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
89728
89912
|
"button",
|
|
89729
89913
|
{
|
|
89730
89914
|
type: "button",
|
|
89731
89915
|
disabled: busy !== null,
|
|
89732
|
-
onClick: () => void
|
|
89733
|
-
className:
|
|
89734
|
-
title: `
|
|
89735
|
-
children: busy ===
|
|
89916
|
+
onClick: () => void remove(method),
|
|
89917
|
+
className: `${ROW_BTN} hover:text-[#ef4444]`,
|
|
89918
|
+
title: `Remove ${title} from ${status.label}`,
|
|
89919
|
+
children: busy === `remove:${id}` ? "Removing…" : "Remove"
|
|
89736
89920
|
}
|
|
89737
89921
|
)
|
|
89738
|
-
] },
|
|
89922
|
+
] }, id);
|
|
89739
89923
|
}) });
|
|
89740
89924
|
}
|
|
89741
89925
|
function McpsPanel({ cwd: cwd2 }) {
|
package/out/renderer/index.html
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
pointer-events: none;
|
|
62
62
|
}
|
|
63
63
|
</style>
|
|
64
|
-
<script type="module" crossorigin src="./assets/index-
|
|
64
|
+
<script type="module" crossorigin src="./assets/index-CFb88BYZ.js"></script>
|
|
65
65
|
<link rel="stylesheet" crossorigin href="./assets/index-BZjkKf9P.css">
|
|
66
66
|
</head>
|
|
67
67
|
<body>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zidane-gui",
|
|
3
3
|
"productName": "Zidane",
|
|
4
|
-
"version": "7.1.
|
|
4
|
+
"version": "7.1.4",
|
|
5
5
|
"description": "Zidane Desktop",
|
|
6
6
|
"author": "StackBlitz",
|
|
7
7
|
"type": "module",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"shiki": "^4.1.0",
|
|
60
60
|
"electron": "^41.7.0",
|
|
61
61
|
"tippy.js": "^6.3.7",
|
|
62
|
-
"zidane": "7.1.
|
|
62
|
+
"zidane": "7.1.4",
|
|
63
63
|
"zod": "^4.4.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|