zidane-gui 7.0.26 → 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 +61 -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) {
|
|
@@ -2369,11 +2408,10 @@ async function tryConnect() {
|
|
|
2369
2408
|
try {
|
|
2370
2409
|
const socketPath = defaultSocketPath();
|
|
2371
2410
|
if (!await probeSocket(socketPath)) {
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
scheduleRetry();
|
|
2375
|
-
return;
|
|
2411
|
+
if (!daemonEnabled()) return;
|
|
2412
|
+
await ensureDaemonRunning({ socketPath, spawnCommand: resolveDaemonSpawnCommand() });
|
|
2376
2413
|
}
|
|
2414
|
+
if (!daemonEnabled()) return;
|
|
2377
2415
|
if (getChatHost().hasActiveWork()) {
|
|
2378
2416
|
if (!deferredForLocalWork) {
|
|
2379
2417
|
deferredForLocalWork = true;
|
|
@@ -2383,24 +2421,32 @@ async function tryConnect() {
|
|
|
2383
2421
|
return;
|
|
2384
2422
|
}
|
|
2385
2423
|
deferredForLocalWork = false;
|
|
2424
|
+
let closed = false;
|
|
2386
2425
|
const next = await connectIpcClient({
|
|
2387
2426
|
socketPath,
|
|
2388
2427
|
appVersion: `zidane-gui/${app.getVersion()}`,
|
|
2389
2428
|
drainOnMismatch: false,
|
|
2390
|
-
onClose:
|
|
2429
|
+
onClose: () => {
|
|
2430
|
+
closed = true;
|
|
2431
|
+
handleDisconnect();
|
|
2432
|
+
}
|
|
2391
2433
|
});
|
|
2392
|
-
if (!daemonEnabled()) {
|
|
2434
|
+
if (!daemonEnabled() || closed || getChatHost().hasActiveWork()) {
|
|
2393
2435
|
next.close();
|
|
2436
|
+
if (daemonEnabled()) {
|
|
2437
|
+
setDaemonHealth("disconnected");
|
|
2438
|
+
scheduleRetry();
|
|
2439
|
+
}
|
|
2394
2440
|
return;
|
|
2395
2441
|
}
|
|
2396
2442
|
client = next;
|
|
2397
|
-
setDaemonSignalsLive(true);
|
|
2398
2443
|
next.onSignal((signal) => {
|
|
2399
2444
|
broadcast(signal);
|
|
2400
2445
|
if (signal.kind === "settings:changed" && !daemonEnabled()) {
|
|
2401
2446
|
setImmediate(() => refreshDaemonClient());
|
|
2402
2447
|
}
|
|
2403
2448
|
});
|
|
2449
|
+
setDaemonSignalsLive(true);
|
|
2404
2450
|
stopRetry();
|
|
2405
2451
|
console.log(`[daemon] connected (${socketPath}) — chat execution routes over the wire`);
|
|
2406
2452
|
} catch (error) {
|
|
@@ -2409,6 +2455,11 @@ async function tryConnect() {
|
|
|
2409
2455
|
scope: "daemon",
|
|
2410
2456
|
error: error.message
|
|
2411
2457
|
});
|
|
2458
|
+
} else {
|
|
2459
|
+
guiLog.warn("Daemon startup or connection failed", {
|
|
2460
|
+
scope: "daemon",
|
|
2461
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2462
|
+
});
|
|
2412
2463
|
}
|
|
2413
2464
|
setDaemonHealth("disconnected");
|
|
2414
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": {
|