zidane-gui 7.0.25 → 7.0.27
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 +64 -10
- package/package.json +2 -2
package/out/main/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { resolve, join, dirname,
|
|
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,
|
|
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";
|
|
@@ -231,6 +232,44 @@ function cancelAllOAuth() {
|
|
|
231
232
|
}
|
|
232
233
|
oauthFlights.clear();
|
|
233
234
|
}
|
|
235
|
+
function resolveDaemonSpawnCommand(options = {}) {
|
|
236
|
+
const directories = options.directories ?? [
|
|
237
|
+
...(process.env.PATH ?? "").split(delimiter).filter(Boolean),
|
|
238
|
+
join(homedir(), ".bun", "bin"),
|
|
239
|
+
join(homedir(), ".local", "bin"),
|
|
240
|
+
"/opt/homebrew/bin",
|
|
241
|
+
"/usr/local/bin"
|
|
242
|
+
];
|
|
243
|
+
const executable = (name) => {
|
|
244
|
+
for (const directory of directories) {
|
|
245
|
+
const path = join(directory, name);
|
|
246
|
+
try {
|
|
247
|
+
accessSync(path, constants.X_OK);
|
|
248
|
+
if (statSync(path).isFile()) return path;
|
|
249
|
+
} catch {
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return void 0;
|
|
253
|
+
};
|
|
254
|
+
let entry = options.daemonEntry;
|
|
255
|
+
if (entry === void 0) {
|
|
256
|
+
try {
|
|
257
|
+
entry = join(dirname(createRequire(import.meta.url).resolve("zidane")), "daemon-cli.js");
|
|
258
|
+
} catch {
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const bun = executable("bun");
|
|
262
|
+
if (bun && entry && !entry.includes(".asar/") && existsSync(entry)) {
|
|
263
|
+
return [bun, entry];
|
|
264
|
+
}
|
|
265
|
+
const zidane = executable("zidane");
|
|
266
|
+
if (zidane) return [zidane, "daemon"];
|
|
267
|
+
const daemon = executable("zidane-daemon");
|
|
268
|
+
if (bun && daemon) return [bun, daemon];
|
|
269
|
+
throw new Error(
|
|
270
|
+
"Cannot start daemon. Install the Zidane CLI, or install Bun with an accessible zidane daemon entry."
|
|
271
|
+
);
|
|
272
|
+
}
|
|
234
273
|
const buffer = createRingBufferSink();
|
|
235
274
|
let broadcast$2 = null;
|
|
236
275
|
function installLogBroadcast(fn) {
|
|
@@ -2109,6 +2148,9 @@ function broadcast(signal) {
|
|
|
2109
2148
|
invalidateUsageSummaryCache();
|
|
2110
2149
|
}
|
|
2111
2150
|
switch (signal.kind) {
|
|
2151
|
+
case "provider:diagnostic":
|
|
2152
|
+
guiLog.debug("provider:diagnostic", { sessionId: signal.sessionId, ...signal.diagnostic });
|
|
2153
|
+
return;
|
|
2112
2154
|
case "interaction:request":
|
|
2113
2155
|
sendToAllWindows("interactions:request", {
|
|
2114
2156
|
sessionId: signal.sessionId,
|
|
@@ -2366,11 +2408,10 @@ async function tryConnect() {
|
|
|
2366
2408
|
try {
|
|
2367
2409
|
const socketPath = defaultSocketPath();
|
|
2368
2410
|
if (!await probeSocket(socketPath)) {
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
scheduleRetry();
|
|
2372
|
-
return;
|
|
2411
|
+
if (!daemonEnabled()) return;
|
|
2412
|
+
await ensureDaemonRunning({ socketPath, spawnCommand: resolveDaemonSpawnCommand() });
|
|
2373
2413
|
}
|
|
2414
|
+
if (!daemonEnabled()) return;
|
|
2374
2415
|
if (getChatHost().hasActiveWork()) {
|
|
2375
2416
|
if (!deferredForLocalWork) {
|
|
2376
2417
|
deferredForLocalWork = true;
|
|
@@ -2380,24 +2421,32 @@ async function tryConnect() {
|
|
|
2380
2421
|
return;
|
|
2381
2422
|
}
|
|
2382
2423
|
deferredForLocalWork = false;
|
|
2424
|
+
let closed = false;
|
|
2383
2425
|
const next = await connectIpcClient({
|
|
2384
2426
|
socketPath,
|
|
2385
2427
|
appVersion: `zidane-gui/${app.getVersion()}`,
|
|
2386
2428
|
drainOnMismatch: false,
|
|
2387
|
-
onClose:
|
|
2429
|
+
onClose: () => {
|
|
2430
|
+
closed = true;
|
|
2431
|
+
handleDisconnect();
|
|
2432
|
+
}
|
|
2388
2433
|
});
|
|
2389
|
-
if (!daemonEnabled()) {
|
|
2434
|
+
if (!daemonEnabled() || closed || getChatHost().hasActiveWork()) {
|
|
2390
2435
|
next.close();
|
|
2436
|
+
if (daemonEnabled()) {
|
|
2437
|
+
setDaemonHealth("disconnected");
|
|
2438
|
+
scheduleRetry();
|
|
2439
|
+
}
|
|
2391
2440
|
return;
|
|
2392
2441
|
}
|
|
2393
2442
|
client = next;
|
|
2394
|
-
setDaemonSignalsLive(true);
|
|
2395
2443
|
next.onSignal((signal) => {
|
|
2396
2444
|
broadcast(signal);
|
|
2397
2445
|
if (signal.kind === "settings:changed" && !daemonEnabled()) {
|
|
2398
2446
|
setImmediate(() => refreshDaemonClient());
|
|
2399
2447
|
}
|
|
2400
2448
|
});
|
|
2449
|
+
setDaemonSignalsLive(true);
|
|
2401
2450
|
stopRetry();
|
|
2402
2451
|
console.log(`[daemon] connected (${socketPath}) — chat execution routes over the wire`);
|
|
2403
2452
|
} catch (error) {
|
|
@@ -2406,6 +2455,11 @@ async function tryConnect() {
|
|
|
2406
2455
|
scope: "daemon",
|
|
2407
2456
|
error: error.message
|
|
2408
2457
|
});
|
|
2458
|
+
} else {
|
|
2459
|
+
guiLog.warn("Daemon startup or connection failed", {
|
|
2460
|
+
scope: "daemon",
|
|
2461
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2462
|
+
});
|
|
2409
2463
|
}
|
|
2410
2464
|
setDaemonHealth("disconnected");
|
|
2411
2465
|
rehydratePendingApprovals();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zidane-gui",
|
|
3
3
|
"productName": "Zidane",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.27",
|
|
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.
|
|
62
|
+
"zidane": "7.0.27",
|
|
63
63
|
"zod": "^4.4.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|