zidane-gui 7.0.26 → 7.0.28

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
@@ -1,13 +1,14 @@
1
- import { resolve, join, dirname, delimiter, basename, isAbsolute } from "node:path";
1
+ import { resolve, delimiter, join, dirname, basename, isAbsolute } from "node:path";
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
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, enabledModelOptions, buildModelCatalog, modelsForDescriptor, modelSupportsReasoning, getContextWindow, truncateTurnsAt, deleteTurnSafely, generateSessionTitle, writeSessionExport, toolResultText, sumRunCosts, resolveSessionCwd, 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 } from "zidane/chat";
6
6
  import { spawn, execFile } from "node:child_process";
7
- import { mkdirSync, readFileSync, writeFileSync, readdirSync, existsSync, copyFileSync, rmSync } from "node:fs";
7
+ import { mkdirSync, readFileSync, writeFileSync, existsSync, accessSync, constants, statSync, readdirSync, copyFileSync, rmSync } from "node:fs";
8
8
  import { homedir, userInfo } from "node:os";
9
9
  import { migrateSessionArtifactDirs, createRingBufferSink, fanoutSink, consoleSink, createLogger, mergeArtifact, selectArtifactEvictions, createExtensionBus, createExtensionHostRuntimeBridge, toWireConfigSchema, resolveCompletionSubmit, inlineLoadedExtension, discoverAndBuildExtensionRegistry, disposeExtensionRegistry, installExtensionFromSpec, ExtensionInstallError, updateInstalledExtension, removeInstalledExtension, sanitizeExtensionConfigActionPatch, loginMcpServer, McpOAuthProvider, refreshArtifact, extensionScaffold, resolveInlineSuggestion, createPathAutocompleteProvider, editSessionMetadata, renderArtifactRow, loadSession } from "zidane";
10
- import { IPC_BUILD_ID, defaultSocketPath, probeSocket, connectIpcClient, IpcVersionMismatchError } from "zidane/ipc";
10
+ import { IPC_BUILD_ID, defaultSocketPath, probeSocket, ensureDaemonRunning, connectIpcClient, IpcVersionMismatchError } from "zidane/ipc";
11
+ import { createRequire } from "node:module";
11
12
  import { DatabaseSync } from "node:sqlite";
12
13
  import { P as PARENT_USER_TURN, u as usageAssistantDaily$1, b as usageUserDaily$1, a as usageSessionDaily$1 } from "./chunks/usage-sql-BdDLRz11.js";
13
14
  import { installSkillFromSpec, SkillInstallError } from "zidane/skills";
@@ -88,13 +89,18 @@ function saveKeybindings(map) {
88
89
  function keybindingsFilePath() {
89
90
  return keybindingsPath(userDataDir());
90
91
  }
91
- function openFileInEditor(path) {
92
+ async function openFileInEditor(path) {
92
93
  const spec = (process.env.VISUAL ?? "").trim() || (process.env.EDITOR ?? "").trim();
93
94
  const tokens = spec ? parseEditorCommand(spec) : [];
94
95
  if (tokens.length === 0) {
95
- return spawnDetached("open", [path]);
96
+ const error = await shell.openPath(path);
97
+ if (error) throw new Error(error);
98
+ return;
96
99
  }
97
100
  const [cmd, ...args] = tokens;
101
+ if (/(?:^|[/\\])(?:vi|vim|nvim|nano|pico)(?:\.exe)?$/i.test(cmd) && !args.includes("-g") || /(?:^|[/\\])emacs(?:client)?(?:\.exe)?$/i.test(cmd) && (args.includes("-nw") || args.includes("-t"))) {
102
+ throw new Error("Set $VISUAL to a graphical editor for the GUI, or open this artifact in the TUI.");
103
+ }
98
104
  return spawnDetached(cmd, [...args, path]);
99
105
  }
100
106
  function openKeybindingsInEditor() {
@@ -231,6 +237,44 @@ function cancelAllOAuth() {
231
237
  }
232
238
  oauthFlights.clear();
233
239
  }
240
+ function resolveDaemonSpawnCommand(options = {}) {
241
+ const directories = options.directories ?? [
242
+ ...(process.env.PATH ?? "").split(delimiter).filter(Boolean),
243
+ join(homedir(), ".bun", "bin"),
244
+ join(homedir(), ".local", "bin"),
245
+ "/opt/homebrew/bin",
246
+ "/usr/local/bin"
247
+ ];
248
+ const executable = (name) => {
249
+ for (const directory of directories) {
250
+ const path = join(directory, name);
251
+ try {
252
+ accessSync(path, constants.X_OK);
253
+ if (statSync(path).isFile()) return path;
254
+ } catch {
255
+ }
256
+ }
257
+ return void 0;
258
+ };
259
+ let entry = options.daemonEntry;
260
+ if (entry === void 0) {
261
+ try {
262
+ entry = join(dirname(createRequire(import.meta.url).resolve("zidane")), "daemon-cli.js");
263
+ } catch {
264
+ }
265
+ }
266
+ const bun = executable("bun");
267
+ if (bun && entry && !entry.includes(".asar/") && existsSync(entry)) {
268
+ return [bun, entry];
269
+ }
270
+ const zidane = executable("zidane");
271
+ if (zidane) return [zidane, "daemon"];
272
+ const daemon = executable("zidane-daemon");
273
+ if (bun && daemon) return [bun, daemon];
274
+ throw new Error(
275
+ "Cannot start daemon. Install the Zidane CLI, or install Bun with an accessible zidane daemon entry."
276
+ );
277
+ }
234
278
  const buffer = createRingBufferSink();
235
279
  let broadcast$2 = null;
236
280
  function installLogBroadcast(fn) {
@@ -2369,11 +2413,10 @@ async function tryConnect() {
2369
2413
  try {
2370
2414
  const socketPath = defaultSocketPath();
2371
2415
  if (!await probeSocket(socketPath)) {
2372
- setDaemonHealth("disconnected");
2373
- rehydratePendingApprovals();
2374
- scheduleRetry();
2375
- return;
2416
+ if (!daemonEnabled()) return;
2417
+ await ensureDaemonRunning({ socketPath, spawnCommand: resolveDaemonSpawnCommand() });
2376
2418
  }
2419
+ if (!daemonEnabled()) return;
2377
2420
  if (getChatHost().hasActiveWork()) {
2378
2421
  if (!deferredForLocalWork) {
2379
2422
  deferredForLocalWork = true;
@@ -2383,24 +2426,32 @@ async function tryConnect() {
2383
2426
  return;
2384
2427
  }
2385
2428
  deferredForLocalWork = false;
2429
+ let closed = false;
2386
2430
  const next = await connectIpcClient({
2387
2431
  socketPath,
2388
2432
  appVersion: `zidane-gui/${app.getVersion()}`,
2389
2433
  drainOnMismatch: false,
2390
- onClose: handleDisconnect
2434
+ onClose: () => {
2435
+ closed = true;
2436
+ handleDisconnect();
2437
+ }
2391
2438
  });
2392
- if (!daemonEnabled()) {
2439
+ if (!daemonEnabled() || closed || getChatHost().hasActiveWork()) {
2393
2440
  next.close();
2441
+ if (daemonEnabled()) {
2442
+ setDaemonHealth("disconnected");
2443
+ scheduleRetry();
2444
+ }
2394
2445
  return;
2395
2446
  }
2396
2447
  client = next;
2397
- setDaemonSignalsLive(true);
2398
2448
  next.onSignal((signal) => {
2399
2449
  broadcast(signal);
2400
2450
  if (signal.kind === "settings:changed" && !daemonEnabled()) {
2401
2451
  setImmediate(() => refreshDaemonClient());
2402
2452
  }
2403
2453
  });
2454
+ setDaemonSignalsLive(true);
2404
2455
  stopRetry();
2405
2456
  console.log(`[daemon] connected (${socketPath}) — chat execution routes over the wire`);
2406
2457
  } catch (error) {
@@ -2409,6 +2460,11 @@ async function tryConnect() {
2409
2460
  scope: "daemon",
2410
2461
  error: error.message
2411
2462
  });
2463
+ } else {
2464
+ guiLog.warn("Daemon startup or connection failed", {
2465
+ scope: "daemon",
2466
+ error: error instanceof Error ? error.message : String(error)
2467
+ });
2412
2468
  }
2413
2469
  setDaemonHealth("disconnected");
2414
2470
  rehydratePendingApprovals();
@@ -3759,6 +3815,15 @@ function registerChatIpc() {
3759
3815
  });
3760
3816
  ipcMain.handle("chat:interrupt", (_e, sessionId) => interruptChat(sessionId));
3761
3817
  ipcMain.handle("chat:isRunning", (_e, sessionId) => isRuntimeSessionRunning(sessionId));
3818
+ ipcMain.handle("system:openPath", async (_e, path) => {
3819
+ if (typeof path !== "string" || !isAbsolute(path)) return false;
3820
+ const stat$1 = await stat(path).catch(() => null);
3821
+ if (!stat$1) return false;
3822
+ if (stat$1.isDirectory()) return await shell.openPath(path) === "";
3823
+ if (!stat$1.isFile()) return false;
3824
+ await openFileInEditor(path);
3825
+ return true;
3826
+ });
3762
3827
  ipcMain.handle("system:revealPath", async (_e, raw) => {
3763
3828
  const path = typeof raw === "string" ? raw.replace(/^file:\/\//, "") : "";
3764
3829
  if (!isAbsolute(path)) return false;
@@ -97,6 +97,7 @@ const api = {
97
97
  searchAll: (query, sessionIds, excerptLimit) => ipcRenderer.invoke("history:searchAll", query, sessionIds, excerptLimit)
98
98
  },
99
99
  system: {
100
+ openPath: (path) => ipcRenderer.invoke("system:openPath", path),
100
101
  revealPath: (path) => ipcRenderer.invoke("system:revealPath", path)
101
102
  },
102
103
  shell: {
@@ -76440,13 +76440,24 @@ function ArtifactRow({ row, onFocus, onRemove }) {
76440
76440
  const isUrl2 = href !== void 0 && /^https?:\/\//.test(href);
76441
76441
  const subtitle = view.subtitle && view.subtitle !== view.title ? view.subtitle : void 0;
76442
76442
  const [menu, setMenu] = reactExports.useState(null);
76443
+ const [openError, setOpenError] = reactExports.useState(null);
76444
+ const open = async () => {
76445
+ setOpenError(null);
76446
+ try {
76447
+ if (href && !await window.api.system.openPath(href)) setOpenError("Path unavailable.");
76448
+ } catch (err) {
76449
+ setOpenError(err instanceof Error ? err.message : String(err));
76450
+ }
76451
+ };
76443
76452
  const menuItems = reactExports.useMemo(
76444
76453
  () => [
76445
76454
  {
76446
76455
  id: "copy",
76447
- label: isUrl2 ? "Copy link" : "Copy path",
76456
+ label: artifact.kind === "commit" ? "Copy SHA" : isUrl2 ? "Copy link" : "Copy path",
76448
76457
  shortcut: "c",
76449
- onSelect: () => void navigator.clipboard.writeText(href ?? artifact.uri)
76458
+ onSelect: () => void navigator.clipboard.writeText(
76459
+ artifact.kind === "commit" ? artifact.uri.replace(/^git:commit:/, "") : href ?? artifact.uri
76460
+ )
76450
76461
  },
76451
76462
  ...href && !isUrl2 ? [
76452
76463
  {
@@ -76458,7 +76469,7 @@ function ArtifactRow({ row, onFocus, onRemove }) {
76458
76469
  ] : [],
76459
76470
  { id: "remove", label: "Remove from session", shortcut: "r", destructive: true, onSelect: onRemove }
76460
76471
  ],
76461
- [isUrl2, href, artifact.uri, onRemove]
76472
+ [isUrl2, href, artifact.kind, artifact.uri, onRemove]
76462
76473
  );
76463
76474
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
76464
76475
  "li",
@@ -76488,15 +76499,14 @@ function ArtifactRow({ row, onFocus, onRemove }) {
76488
76499
  }
76489
76500
  )
76490
76501
  ) : href ? (
76491
- // Local path → reveal in Finder / Explorer (file selected in its
76492
- // folder, directory opened). Rendered as a button, not a link.
76502
+ // Editor launch stays in main; directories use the OS file manager.
76493
76503
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76494
76504
  "button",
76495
76505
  {
76496
76506
  type: "button",
76497
- onClick: () => void window.api.system.revealPath(href),
76507
+ onClick: () => void open(),
76498
76508
  className: "truncate text-left text-[13px] text-[var(--zg-text)] bg-transparent border-0 p-0 cursor-pointer hover:underline",
76499
- title: `Reveal ${href}`,
76509
+ title: `Open ${href}`,
76500
76510
  children: view.title
76501
76511
  }
76502
76512
  )
@@ -76510,6 +76520,7 @@ function ArtifactRow({ row, onFocus, onRemove }) {
76510
76520
  }
76511
76521
  )
76512
76522
  ] }),
76523
+ openError && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { role: "alert", className: "text-xs text-[var(--zg-warn)]", children: openError }),
76513
76524
  subtitle && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "truncate text-[11px] text-[var(--zg-text-muted)] font-mono", title: subtitle, children: subtitle }),
76514
76525
  view.badges && view.badges.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 flex flex-wrap items-center gap-1.5 text-[10px] leading-4 tabular-nums", children: view.badges.map(
76515
76526
  (badge) => badge.tone === "diff" ? /* @__PURE__ */ jsxRuntimeExports.jsx(DiffBadge, { text: badge.text, title: badge.title }, badge.text) : /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -61,7 +61,7 @@
61
61
  pointer-events: none;
62
62
  }
63
63
  </style>
64
- <script type="module" crossorigin src="./assets/index-DmKhvrZs.js"></script>
64
+ <script type="module" crossorigin src="./assets/index-Dz5Ybpow.js"></script>
65
65
  <link rel="stylesheet" crossorigin href="./assets/index-D3KopBrL.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.0.26",
4
+ "version": "7.0.28",
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.0.26",
62
+ "zidane": "7.0.28",
63
63
  "zod": "^4.4.3"
64
64
  },
65
65
  "devDependencies": {