zidane-gui 7.1.4 → 7.1.7

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,3 +1,4 @@
1
+ import { fixPath, IPC_BUILD_ID, defaultSocketPath, probeSocket, ensureDaemonRunning, connectIpcClient, IpcVersionMismatchError } from "zidane/ipc";
1
2
  import { resolve, delimiter, join, dirname, basename, isAbsolute } from "node:path";
2
3
  import { config } from "dotenv";
3
4
  import { app, shell, BrowserWindow, ipcMain, dialog, nativeImage } from "electron";
@@ -7,7 +8,6 @@ import { spawn, execFile } from "node:child_process";
7
8
  import { mkdirSync, readFileSync, writeFileSync, existsSync, accessSync, constants, statSync, readdirSync, copyFileSync, rmSync } from "node:fs";
8
9
  import { homedir, userInfo } from "node:os";
9
10
  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, ensureDaemonRunning, connectIpcClient, IpcVersionMismatchError } from "zidane/ipc";
11
11
  import { createRequire } from "node:module";
12
12
  import { DatabaseSync } from "node:sqlite";
13
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";
@@ -22,6 +22,7 @@ import __cjs_mod__ from "node:module";
22
22
  const __filename = import.meta.filename;
23
23
  const __dirname = import.meta.dirname;
24
24
  const require2 = __cjs_mod__.createRequire(import.meta.url);
25
+ fixPath();
25
26
  let resolvedDir = null;
26
27
  function userDataDir() {
27
28
  if (resolvedDir) {
@@ -14645,6 +14645,13 @@ function splitPromptSegments(text2, refs) {
14645
14645
  }
14646
14646
  return out;
14647
14647
  }
14648
+ function showsAccount(snapshot, all2) {
14649
+ return snapshot.account !== null && all2.some((s2) => s2 !== snapshot && s2.providerKey === snapshot.providerKey);
14650
+ }
14651
+ function activeSnapshotFor(all2, providerKey) {
14652
+ const mine = all2.filter((s2) => s2.providerKey === providerKey);
14653
+ return mine.find((s2) => s2.activeCredential) ?? mine[0] ?? null;
14654
+ }
14648
14655
  function mostConstrainedWindow(snapshot) {
14649
14656
  let worst = null;
14650
14657
  for (const win of snapshot.windows) if (!worst || win.usedPercent > worst.usedPercent) worst = win;
@@ -14671,6 +14678,14 @@ function resetLabel(resetsAt, now = Date.now()) {
14671
14678
  }
14672
14679
  return `resets in ${Math.max(1, Math.floor(hours / 24))}d`;
14673
14680
  }
14681
+ function updatedLabel(snapshots, now = Date.now()) {
14682
+ let newest = -Infinity;
14683
+ for (const s2 of snapshots) newest = Math.max(newest, s2.fetchedAt);
14684
+ if (!Number.isFinite(newest)) return null;
14685
+ const seconds = Math.max(0, Math.floor((now - newest) / 1e3));
14686
+ if (seconds < 60) return `updated ${seconds}s ago`;
14687
+ return `updated ${Math.floor(seconds / 60)}m ago`;
14688
+ }
14674
14689
  function formatCredits(value) {
14675
14690
  return value >= 100 ? value.toFixed(0) : value.toFixed(2);
14676
14691
  }
@@ -86447,16 +86462,25 @@ function ProviderUsageProvider({ children }) {
86447
86462
  const [loading, setLoading] = reactExports.useState(false);
86448
86463
  const [loaded, setLoaded] = reactExports.useState(false);
86449
86464
  const inFlight = reactExports.useRef(false);
86465
+ const pendingRefresh = reactExports.useRef(false);
86450
86466
  const load = reactExports.useCallback(async (refresh2) => {
86451
86467
  if (inFlight.current) {
86468
+ if (refresh2) {
86469
+ pendingRefresh.current = true;
86470
+ }
86452
86471
  return;
86453
86472
  }
86454
86473
  inFlight.current = true;
86455
86474
  setLoading(true);
86456
86475
  try {
86457
- const next = await window.api.providerUsage.fetchAll(void 0, refresh2 ? { refresh: true } : void 0);
86458
- setSnapshots(next);
86459
- setLoaded(true);
86476
+ let force = refresh2;
86477
+ do {
86478
+ pendingRefresh.current = false;
86479
+ const next = await window.api.providerUsage.fetchAll(void 0, force ? { refresh: true } : void 0);
86480
+ setSnapshots(next);
86481
+ setLoaded(true);
86482
+ force = true;
86483
+ } while (pendingRefresh.current);
86460
86484
  } finally {
86461
86485
  inFlight.current = false;
86462
86486
  setLoading(false);
@@ -86791,7 +86815,7 @@ function UsageIndicator() {
86791
86815
  const { settings } = useSettings();
86792
86816
  const active = sessions.find((s2) => s2.id === activeSessionId) ?? null;
86793
86817
  const { snapshots } = useProviderUsage();
86794
- const snapshot = active ? snapshots.find((s2) => s2.providerKey === active.providerKey) ?? null : null;
86818
+ const snapshot = active?.providerKey ? activeSnapshotFor(snapshots, active.providerKey) : null;
86795
86819
  const worst = snapshot && snapshot.status === "ok" ? mostConstrainedWindow(snapshot) : null;
86796
86820
  if (!worst) {
86797
86821
  return null;
@@ -86802,7 +86826,7 @@ function UsageIndicator() {
86802
86826
  "span",
86803
86827
  {
86804
86828
  className: `inline-flex items-center gap-1 h-5 px-1.5 rounded bg-[var(--zg-bg-hover)] font-mono tabular-nums shrink-0 ${toneCls}`,
86805
- title: `${snapshot?.label ?? ""} · ${worst.label} window ${formatUsagePercent(worst.usedPercent)}% used${worst.resetsAt ? ` · ${resetLabel(worst.resetsAt) ?? ""}` : ""}
86829
+ title: `${snapshot?.label ?? ""}${snapshot?.account ? ` (${snapshot.account})` : ""} · ${worst.label} window ${formatUsagePercent(worst.usedPercent)}% used${worst.resetsAt ? ` · ${resetLabel(worst.resetsAt) ?? ""}` : ""}
86806
86830
  Ctrl+P opens the usage panel.`,
86807
86831
  children: [
86808
86832
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, children: "▰" }),
@@ -92793,6 +92817,7 @@ function UsagePanelModal({ activeProviderKey }) {
92793
92817
  const autoLoad = settings.subscriptionUsage !== false;
92794
92818
  const { snapshots, loading, loaded, refresh } = useProviderUsage();
92795
92819
  const empty2 = snapshots.length === 0;
92820
+ const updated = updatedLabel(snapshots);
92796
92821
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
92797
92822
  ModalShell,
92798
92823
  {
@@ -92800,19 +92825,27 @@ function UsagePanelModal({ activeProviderKey }) {
92800
92825
  description: empty2 ? autoLoad || loaded ? loading ? "Checking signed-in providers…" : "No signed-in provider reports usage." : "Usage checks are off — refresh fetches once." : "Rate-limit windows and credits for signed-in providers. Read-only.",
92801
92826
  onClose: close2,
92802
92827
  size: "medium",
92803
- footer: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-end gap-2 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN, disabled: loading, onClick: refresh, children: loading ? "Refreshing…" : "Refresh" }) }),
92828
+ footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-2 w-full", children: [
92829
+ updated && !loading && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-[var(--zg-text-muted)]", children: updated }),
92830
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN, disabled: loading, onClick: refresh, children: loading ? "Refreshing…" : "Refresh" })
92831
+ ] }),
92804
92832
  children: empty2 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "flex flex-col gap-3 p-4 m-0 list-none overflow-y-auto", children: snapshots.map((snapshot) => /* @__PURE__ */ jsxRuntimeExports.jsx(
92805
92833
  ProviderRow,
92806
92834
  {
92807
92835
  snapshot,
92808
- active: snapshot.providerKey === activeProviderKey
92836
+ account: showsAccount(snapshot, snapshots) ? snapshot.account : null,
92837
+ active: snapshot.providerKey === activeProviderKey && snapshot.activeCredential
92809
92838
  },
92810
- snapshot.providerKey
92839
+ snapshot.credentialKey
92811
92840
  )) })
92812
92841
  }
92813
92842
  );
92814
92843
  }
92815
- function ProviderRow({ snapshot, active }) {
92844
+ function ProviderRow({
92845
+ snapshot,
92846
+ account,
92847
+ active
92848
+ }) {
92816
92849
  const creditsWindow = snapshot.windows.some((win) => win.id === "credits");
92817
92850
  const looseCredits = creditsWindow ? null : snapshot.credits;
92818
92851
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex flex-col gap-2 px-3 py-2.5 rounded-md bg-[var(--zg-bg)] border border-[var(--zg-border)]", children: [
@@ -92825,6 +92858,10 @@ function ProviderRow({ snapshot, active }) {
92825
92858
  children: snapshot.label
92826
92859
  }
92827
92860
  ),
92861
+ account && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-xs text-[var(--zg-text-muted)] truncate", children: [
92862
+ "· ",
92863
+ account
92864
+ ] }),
92828
92865
  snapshot.plan && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-xs text-[var(--zg-text-muted)] truncate", children: [
92829
92866
  "· ",
92830
92867
  snapshot.plan
@@ -61,7 +61,7 @@
61
61
  pointer-events: none;
62
62
  }
63
63
  </style>
64
- <script type="module" crossorigin src="./assets/index-CFb88BYZ.js"></script>
64
+ <script type="module" crossorigin src="./assets/index-DnkpUra3.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",
4
+ "version": "7.1.7",
5
5
  "description": "Zidane Desktop",
6
6
  "author": "StackBlitz",
7
7
  "type": "module",
@@ -52,14 +52,14 @@
52
52
  "@tiptap/starter-kit": "^3.23.6",
53
53
  "@tiptap/suggestion": "^3.23.6",
54
54
  "dotenv": "^17.4.2",
55
+ "electron": "^41.7.0",
55
56
  "react": "^19.2.6",
56
57
  "react-dom": "^19.2.6",
57
58
  "react-markdown": "^10.1.0",
58
59
  "remark-gfm": "^4.0.1",
59
60
  "shiki": "^4.1.0",
60
- "electron": "^41.7.0",
61
61
  "tippy.js": "^6.3.7",
62
- "zidane": "7.1.4",
62
+ "zidane": "7.1.7",
63
63
  "zod": "^4.4.3"
64
64
  },
65
65
  "devDependencies": {