zidane-gui 7.0.24 → 7.0.26

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
@@ -2109,6 +2109,9 @@ function broadcast(signal) {
2109
2109
  invalidateUsageSummaryCache();
2110
2110
  }
2111
2111
  switch (signal.kind) {
2112
+ case "provider:diagnostic":
2113
+ guiLog.debug("provider:diagnostic", { sessionId: signal.sessionId, ...signal.diagnostic });
2114
+ return;
2112
2115
  case "interaction:request":
2113
2116
  sendToAllWindows("interactions:request", {
2114
2117
  sessionId: signal.sessionId,
@@ -2436,11 +2439,10 @@ function sendPrompt(opts) {
2436
2439
  }
2437
2440
  return getChatHost().sendPrompt(opts);
2438
2441
  }
2439
- function interruptChat(sessionId) {
2442
+ async function interruptChat(sessionId) {
2440
2443
  const daemon = getDaemonClient();
2441
2444
  if (daemon) {
2442
- void daemon.request("chat.interrupt", { sessionId }).catch(() => {
2443
- });
2445
+ await daemon.request("chat.interrupt", { sessionId });
2444
2446
  return;
2445
2447
  }
2446
2448
  getChatHost().interrupt(sessionId);
@@ -2463,6 +2465,10 @@ function followUpSession(sessionId, message) {
2463
2465
  }
2464
2466
  getChatHost().followUp(sessionId, message);
2465
2467
  }
2468
+ async function isRuntimeSessionRunning(sessionId) {
2469
+ const daemon = getDaemonClient();
2470
+ return daemon ? daemon.request("chat.isRunning", { sessionId }) : getChatHost().isSessionRunning(sessionId);
2471
+ }
2466
2472
  function listRunningWork(sessionId) {
2467
2473
  const daemon = getDaemonClient();
2468
2474
  if (daemon) {
@@ -3752,6 +3758,7 @@ function registerChatIpc() {
3752
3758
  return sendPrompt(opts);
3753
3759
  });
3754
3760
  ipcMain.handle("chat:interrupt", (_e, sessionId) => interruptChat(sessionId));
3761
+ ipcMain.handle("chat:isRunning", (_e, sessionId) => isRuntimeSessionRunning(sessionId));
3755
3762
  ipcMain.handle("system:revealPath", async (_e, raw) => {
3756
3763
  const path = typeof raw === "string" ? raw.replace(/^file:\/\//, "") : "";
3757
3764
  if (!isAbsolute(path)) return false;
@@ -56,6 +56,7 @@ const api = {
56
56
  chat: {
57
57
  send: (opts) => ipcRenderer.invoke("chat:send", opts),
58
58
  interrupt: (sessionId) => ipcRenderer.invoke("chat:interrupt", sessionId),
59
+ isRunning: (sessionId) => ipcRenderer.invoke("chat:isRunning", sessionId),
59
60
  steer: (sessionId, message) => ipcRenderer.invoke("chat:steer", sessionId, message),
60
61
  followUp: (sessionId, message) => ipcRenderer.invoke("chat:followUp", sessionId, message),
61
62
  pushQueued: (sessionId, message, activatedSkills) => ipcRenderer.invoke("chat:pushQueued", sessionId, message, activatedSkills),
@@ -15888,6 +15888,7 @@ const ALL_SESSIONS_KEY = "*";
15888
15888
  class StreamStore {
15889
15889
  _events = /* @__PURE__ */ new Map();
15890
15890
  _running = /* @__PURE__ */ new Map();
15891
+ runStateVersion = 0;
15891
15892
  /**
15892
15893
  * Per-session run-sticky fallback target — set by the `model:fallback`
15893
15894
  * signal when the agent's stream failed terminally on the picked model
@@ -16133,6 +16134,7 @@ class StreamStore {
16133
16134
  * re-establish the flags.
16134
16135
  */
16135
16136
  dropAll() {
16137
+ this.runStateVersion++;
16136
16138
  const had = this._events.size > 0;
16137
16139
  const sessionIds = /* @__PURE__ */ new Set([...this._events.keys(), ...this._running.keys(), ...this._systemMd.keys()]);
16138
16140
  this._events.clear();
@@ -16262,6 +16264,7 @@ class StreamStore {
16262
16264
  applySignal(signal) {
16263
16265
  switch (signal.kind) {
16264
16266
  case "run:start": {
16267
+ this.runStateVersion++;
16265
16268
  const had = this._events.has(signal.sessionId);
16266
16269
  if (!had) {
16267
16270
  this._events.set(signal.sessionId, []);
@@ -16275,6 +16278,7 @@ class StreamStore {
16275
16278
  return;
16276
16279
  }
16277
16280
  case "run:end": {
16281
+ this.runStateVersion++;
16278
16282
  const prior = this._events.get(signal.sessionId) ?? [];
16279
16283
  let next = finalizeStreamingMarkdown(closeThinkingSegment(prior));
16280
16284
  if (!signal.ok && signal.error) {
@@ -16593,6 +16597,11 @@ function StreamProvider({ children }) {
16593
16597
  appendErrorEvent: (sessionId, text2) => store.appendErrorEvent(sessionId, text2),
16594
16598
  hasEvents: (sessionId) => store.hasEvents(sessionId),
16595
16599
  markRunning: (sessionId) => store.markRunning(sessionId),
16600
+ confirmIdle: (sessionId) => {
16601
+ const signal = { kind: "run:end", sessionId, runId: "", ok: true };
16602
+ store.applyDrainPlan(planDrainBeforeSignal(bucketsRef.current, signal));
16603
+ store.applySignal(signal);
16604
+ },
16596
16605
  noteActiveSession: (sessionId) => {
16597
16606
  activeSessionRef.current = sessionId;
16598
16607
  for (const deferred of [...deferredCompactRef.current]) {
@@ -16854,6 +16863,16 @@ function useStreamReset() {
16854
16863
  function useSetEventsPage() {
16855
16864
  return useStreamCtx().actions.setEventsPage;
16856
16865
  }
16866
+ function useCaptureRunState() {
16867
+ const { store } = useStreamCtx();
16868
+ return reactExports.useCallback(() => {
16869
+ const version = store.runStateVersion;
16870
+ return () => store.runStateVersion === version;
16871
+ }, [store]);
16872
+ }
16873
+ function useConfirmIdle() {
16874
+ return useStreamCtx().actions.confirmIdle;
16875
+ }
16857
16876
  function useMarkRunning() {
16858
16877
  return useStreamCtx().actions.markRunning;
16859
16878
  }
@@ -17028,6 +17047,8 @@ function SessionsProvider({ children }) {
17028
17047
  const resetStream = useStreamReset();
17029
17048
  const setEventsPage = useSetEventsPage();
17030
17049
  const markRunning = useMarkRunning();
17050
+ const captureRunState = useCaptureRunState();
17051
+ const confirmIdle = useConfirmIdle();
17031
17052
  const peekHasEvents = usePeekHasEvents();
17032
17053
  const peekRunning = usePeekRunning();
17033
17054
  const peekRunSeq = usePeekRunSeq();
@@ -17146,16 +17167,44 @@ function SessionsProvider({ children }) {
17146
17167
  filterRef.current = {
17147
17168
  archive: archiveFilter
17148
17169
  };
17170
+ const refreshVersion = reactExports.useRef(0);
17149
17171
  const refresh = reactExports.useCallback(async () => {
17172
+ const version = ++refreshVersion.current;
17173
+ const unchanged = captureRunState();
17150
17174
  const { archive } = filterRef.current;
17151
17175
  const next = await window.api.sessions.list({ archive });
17176
+ if (version !== refreshVersion.current) {
17177
+ return;
17178
+ }
17179
+ const idle = await Promise.all(
17180
+ next.map(async (row) => {
17181
+ if (row.status === "running" || !peekRunning(row.id)) {
17182
+ return false;
17183
+ }
17184
+ return window.api.chat.isRunning(row.id).then((running) => running === false).catch(() => false);
17185
+ })
17186
+ );
17187
+ if (version !== refreshVersion.current || !unchanged()) {
17188
+ return;
17189
+ }
17190
+ rawSessionsRef.current = next;
17152
17191
  setSessions(next);
17153
- for (const row of next) {
17192
+ for (const [index2, row] of next.entries()) {
17154
17193
  if (row.status === "running") {
17155
17194
  markRunning(row.id);
17195
+ } else if (idle[index2]) {
17196
+ confirmIdle(row.id);
17156
17197
  }
17157
17198
  }
17158
- }, [markRunning]);
17199
+ const active = activeRef.current;
17200
+ if (active && next.some((row, index2) => row.id === active && idle[index2])) {
17201
+ const stillIdle = captureRunState();
17202
+ const page = await window.api.sessions.loadEvents(active);
17203
+ if (version === refreshVersion.current && stillIdle() && activeRef.current === active && !peekRunning(active)) {
17204
+ setEventsPage(active, page);
17205
+ }
17206
+ }
17207
+ }, [markRunning, captureRunState, confirmIdle, peekRunning, setEventsPage]);
17159
17208
  const dropAllStreams = useDropAllStreams();
17160
17209
  const runtimeStateRef = reactExports.useRef(null);
17161
17210
  reactExports.useEffect(() => {
@@ -82500,6 +82549,7 @@ function Center({
82500
82549
  defaultProviderKey,
82501
82550
  defaultModelId,
82502
82551
  setArchived,
82552
+ refresh,
82503
82553
  sessions
82504
82554
  } = useSessions();
82505
82555
  const recentFolders = reactExports.useMemo(() => {
@@ -82805,7 +82855,10 @@ function Center({
82805
82855
  if (!activeSession) {
82806
82856
  return;
82807
82857
  }
82808
- void window.api.chat.interrupt(activeSession.id);
82858
+ const sessionId = activeSession.id;
82859
+ void window.api.chat.interrupt(sessionId).then(() => refresh()).catch((err) => {
82860
+ appendErrorEvent(sessionId, err?.message ?? String(err));
82861
+ });
82809
82862
  };
82810
82863
  const onDropQueued = (id) => {
82811
82864
  if (!activeSession) {
@@ -61,7 +61,7 @@
61
61
  pointer-events: none;
62
62
  }
63
63
  </style>
64
- <script type="module" crossorigin src="./assets/index-DbQe5BlN.js"></script>
64
+ <script type="module" crossorigin src="./assets/index-DmKhvrZs.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.24",
4
+ "version": "7.0.26",
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.24",
62
+ "zidane": "7.0.26",
63
63
  "zod": "^4.4.3"
64
64
  },
65
65
  "devDependencies": {