zidane-gui 7.1.8 → 7.1.9
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 +224 -30
- package/out/preload/index.mjs +21 -1
- package/out/renderer/assets/{index-DnkpUra3.js → index-BwjXMrIt.js} +31171 -28698
- package/out/renderer/assets/index-CNGtwsYK.css +2379 -0
- package/out/renderer/index.html +44 -20
- package/package.json +2 -2
- package/out/renderer/assets/index-BZjkKf9P.css +0 -2070
package/out/main/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { fixPath, IPC_BUILD_ID, defaultSocketPath, probeSocket, ensureDaemonRunning, connectIpcClient, IpcVersionMismatchError } from "zidane/ipc";
|
|
2
2
|
import { resolve, delimiter, join, dirname, basename, isAbsolute } from "node:path";
|
|
3
3
|
import { config } from "dotenv";
|
|
4
|
-
import { app, shell, BrowserWindow, ipcMain, dialog, nativeImage } from "electron";
|
|
4
|
+
import { app, shell, BrowserWindow, ipcMain, dialog, nativeImage, session, nativeTheme } from "electron";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
import { parseEditorCommand, keybindingsPath, stripJsonComments, ensureKeybindingsFile, readProjects, writeProjects, credentialsPath, applyApiKeyEnv, BUILTIN_PROVIDERS, readCredentials, detectAuth, supportsOAuth, runOAuthLogin, DEFAULT_OAUTH_ACCOUNT_LABEL, setProviderCredential, scopeCwd, resolveConfig, DEFAULT_SETTINGS, enforceSettingsInvariants, mcpsWritePath, upsertMcpServer, discoverProjectMcps, removeMcpServer, loadMcpToolsCache, subscribeMcpToolsCache, refreshMcpToolsCatalog, createFileMcpCredentialStore, createChatHost, toTodosSnapshot, searchSessionHistory, searchableTurnText, deriveSessionTitle, toolCallPreview, modelChainMetadata, sessionModelFallbacks, resolveSessionCwd, modelSupportsReasoning, enabledModelOptions, buildModelCatalog, modelsForDescriptor, getContextWindow, truncateTurnsAt, deleteTurnSafely, generateSessionTitle, writeSessionExport, toolResultText, sumRunCosts, effectiveContextWindow, lastContextSizeFromTurns, fmtTokens, groupArtifacts, selectActiveTodos, setTodosForRun, sanitizeTodoItems, DEFAULT_MAX_TODO_ITEMS, fetchAllProviderUsage, fetchProviderUsage, listProjectFiles, discoverProjectSkills, discoverProjectPlugins, readProviderCredential, removeProviderCredential, setPreferredCredential, removeStoredCredential, setCredentialLabel, hasClaudeCodeSetup, countClaudeSessionFiles, importFromClaudeCode, isMainSession, findGitRoot, restoreModelOptions, modelOptionsFor, eventsFromTurns, watchInstalledVersion, checkForUpdate, upgradeInstalledPackages, performSelfUpdate, compareSemver, findInstalledCompanion } from "zidane/chat";
|
|
7
|
-
import {
|
|
7
|
+
import { execFile, spawn } from "node:child_process";
|
|
8
8
|
import { mkdirSync, readFileSync, writeFileSync, existsSync, accessSync, constants, statSync, readdirSync, copyFileSync, rmSync } from "node:fs";
|
|
9
9
|
import { homedir, userInfo } from "node:os";
|
|
10
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";
|
|
@@ -16,7 +16,7 @@ import { promisify } from "node:util";
|
|
|
16
16
|
import { Worker } from "node:worker_threads";
|
|
17
17
|
import { stat } from "node:fs/promises";
|
|
18
18
|
import { setImmediate as setImmediate$1 } from "node:timers/promises";
|
|
19
|
-
import { BASH_CALL_ID_PREFIX } from "zidane/chat/pure";
|
|
19
|
+
import { normalizePanelContent, BASH_CALL_ID_PREFIX } from "zidane/chat/pure";
|
|
20
20
|
import { tailTruncate } from "zidane/tools";
|
|
21
21
|
import __cjs_mod__ from "node:module";
|
|
22
22
|
const __filename = import.meta.filename;
|
|
@@ -104,6 +104,36 @@ async function openFileInEditor(path) {
|
|
|
104
104
|
}
|
|
105
105
|
return spawnDetached(cmd, [...args, path]);
|
|
106
106
|
}
|
|
107
|
+
function hasConfiguredEditor() {
|
|
108
|
+
const spec = (process.env.VISUAL ?? "").trim() || (process.env.EDITOR ?? "").trim();
|
|
109
|
+
const tokens = spec ? parseEditorCommand(spec) : [];
|
|
110
|
+
if (tokens.length === 0) return false;
|
|
111
|
+
const [cmd, ...args] = tokens;
|
|
112
|
+
if (/(?:^|[/\\])(?:vi|vim|nvim|nano|pico)(?:\.exe)?$/i.test(cmd) && !args.includes("-g")) return false;
|
|
113
|
+
if (/(?:^|[/\\])emacs(?:client)?(?:\.exe)?$/i.test(cmd) && (args.includes("-nw") || args.includes("-t")))
|
|
114
|
+
return false;
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
const repoWebBaseCache = /* @__PURE__ */ new Map();
|
|
118
|
+
const REPO_WEB_BASE_TTL_MS = 6e4;
|
|
119
|
+
async function repoWebBase(cwd) {
|
|
120
|
+
const cached2 = repoWebBaseCache.get(cwd);
|
|
121
|
+
if (cached2 && Date.now() - cached2.at < REPO_WEB_BASE_TTL_MS) return cached2.value;
|
|
122
|
+
const value = await new Promise((resolve2) => {
|
|
123
|
+
execFile("git", ["remote", "get-url", "origin"], { cwd, timeout: 3e3 }, (err, stdout) => {
|
|
124
|
+
if (err) return resolve2(null);
|
|
125
|
+
resolve2(parseRemoteToWebBase(stdout.trim()));
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
repoWebBaseCache.set(cwd, { value, at: Date.now() });
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
function parseRemoteToWebBase(remote) {
|
|
132
|
+
let m = /^(?:ssh:\/\/)?(?:[\w.-]+@)?([\w.-]+)[:/]([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/.exec(remote);
|
|
133
|
+
if (m && !remote.startsWith("http")) return `https://${m[1]}/${m[2]}/${m[3]}`;
|
|
134
|
+
m = /^https?:\/\/(?:[^@/]+@)?([\w.-]+)\/([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/.exec(remote);
|
|
135
|
+
return m ? `https://${m[1]}/${m[2]}/${m[3]}` : null;
|
|
136
|
+
}
|
|
107
137
|
function openKeybindingsInEditor() {
|
|
108
138
|
return openFileInEditor(ensureKeybindingsFile(userDataDir()));
|
|
109
139
|
}
|
|
@@ -779,7 +809,7 @@ function usageUserDaily() {
|
|
|
779
809
|
function usageSessionDaily() {
|
|
780
810
|
return usageSessionDaily$1(openDb());
|
|
781
811
|
}
|
|
782
|
-
function saveSync(database,
|
|
812
|
+
function saveSync(database, session2) {
|
|
783
813
|
database.prepare(
|
|
784
814
|
`INSERT INTO sessions (id, agent_id, project_root, status, metadata, created_at, updated_at)
|
|
785
815
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
@@ -790,26 +820,26 @@ function saveSync(database, session) {
|
|
|
790
820
|
metadata = excluded.metadata,
|
|
791
821
|
updated_at = excluded.updated_at`
|
|
792
822
|
).run(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
JSON.stringify(
|
|
798
|
-
|
|
799
|
-
|
|
823
|
+
session2.id,
|
|
824
|
+
session2.agentId ?? null,
|
|
825
|
+
session2.projectRoot ?? null,
|
|
826
|
+
session2.status,
|
|
827
|
+
JSON.stringify(session2.metadata ?? {}),
|
|
828
|
+
session2.createdAt,
|
|
829
|
+
session2.updatedAt
|
|
800
830
|
);
|
|
801
|
-
database.prepare("DELETE FROM turns WHERE session_id = ?").run(
|
|
802
|
-
database.prepare("DELETE FROM runs WHERE session_id = ?").run(
|
|
831
|
+
database.prepare("DELETE FROM turns WHERE session_id = ?").run(session2.id);
|
|
832
|
+
database.prepare("DELETE FROM runs WHERE session_id = ?").run(session2.id);
|
|
803
833
|
const insertTurn = database.prepare("INSERT INTO turns (session_id, seq, role, data) VALUES (?, ?, ?, ?)");
|
|
804
|
-
|
|
834
|
+
session2.turns.forEach((t, i) => insertTurn.run(session2.id, i, t.role ?? null, JSON.stringify(t)));
|
|
805
835
|
const upsertRun = database.prepare(`
|
|
806
836
|
INSERT INTO runs (session_id, run_id, started_at, data) VALUES (?, ?, ?, ?)
|
|
807
837
|
ON CONFLICT(session_id, run_id) DO UPDATE SET
|
|
808
838
|
data = excluded.data,
|
|
809
839
|
started_at = excluded.started_at
|
|
810
840
|
`);
|
|
811
|
-
for (const run of
|
|
812
|
-
upsertRun.run(
|
|
841
|
+
for (const run of session2.runs) {
|
|
842
|
+
upsertRun.run(session2.id, run.id, run.startedAt, JSON.stringify(run));
|
|
813
843
|
}
|
|
814
844
|
}
|
|
815
845
|
function getSessionStore() {
|
|
@@ -847,8 +877,8 @@ function getSessionStore() {
|
|
|
847
877
|
async load(id) {
|
|
848
878
|
return loadSync(database, id);
|
|
849
879
|
},
|
|
850
|
-
async save(
|
|
851
|
-
saveSync(database, { ...
|
|
880
|
+
async save(session2) {
|
|
881
|
+
saveSync(database, { ...session2, updatedAt: Date.now() });
|
|
852
882
|
},
|
|
853
883
|
async delete(id) {
|
|
854
884
|
database.prepare("DELETE FROM sessions WHERE id = ?").run(id);
|
|
@@ -2298,8 +2328,10 @@ function broadcast(signal) {
|
|
|
2298
2328
|
case "stream:progress":
|
|
2299
2329
|
case "stream:retry:cleared":
|
|
2300
2330
|
case "prompt-turns":
|
|
2301
|
-
// GUI-local: main-side extension registry invalidation push
|
|
2331
|
+
// GUI-local: main-side extension registry invalidation push, and the
|
|
2332
|
+
// debounced "an extension panel has new content" push.
|
|
2302
2333
|
case "extensions:invalidated":
|
|
2334
|
+
case "panel:changed":
|
|
2303
2335
|
sendChatStream(signal);
|
|
2304
2336
|
return;
|
|
2305
2337
|
case "event":
|
|
@@ -2854,6 +2886,111 @@ function tokenizeQuery(query) {
|
|
|
2854
2886
|
}
|
|
2855
2887
|
return tokens;
|
|
2856
2888
|
}
|
|
2889
|
+
const CHANGE_DEBOUNCE_MS = 150;
|
|
2890
|
+
const watches = /* @__PURE__ */ new Map();
|
|
2891
|
+
const watchKey = (cwd, id) => `${cwd}\0${id}`;
|
|
2892
|
+
async function panelsFor(cwd) {
|
|
2893
|
+
const config2 = await getRuntimeConfig(cwd);
|
|
2894
|
+
return config2.extensions.panels;
|
|
2895
|
+
}
|
|
2896
|
+
async function findPanel(cwd, id) {
|
|
2897
|
+
return (await panelsFor(cwd)).find((p) => p.id === id);
|
|
2898
|
+
}
|
|
2899
|
+
async function listPanels(cwd) {
|
|
2900
|
+
return (await panelsFor(cwd)).map((p) => ({
|
|
2901
|
+
id: p.id,
|
|
2902
|
+
label: p.label,
|
|
2903
|
+
owner: p.owner,
|
|
2904
|
+
...p.icon ? { icon: p.icon } : {}
|
|
2905
|
+
}));
|
|
2906
|
+
}
|
|
2907
|
+
async function loadPanel(cwd, id, ctx) {
|
|
2908
|
+
const panel = await findPanel(cwd, id);
|
|
2909
|
+
if (!panel) {
|
|
2910
|
+
return { sections: [], empty: "This panel is no longer registered." };
|
|
2911
|
+
}
|
|
2912
|
+
try {
|
|
2913
|
+
const result = await withTimeout(Promise.resolve(panel.load({ ...ctx, cwd })), 1e4);
|
|
2914
|
+
return normalizePanelContent(result);
|
|
2915
|
+
} catch (err) {
|
|
2916
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2917
|
+
return { sections: [], empty: `Panel failed to load: ${message}` };
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
async function runPanelAction(cwd, id, actionId, payload, ctx) {
|
|
2921
|
+
const panel = await findPanel(cwd, id);
|
|
2922
|
+
if (!panel?.onAction) {
|
|
2923
|
+
return { ok: false, error: "Panel has no action handler." };
|
|
2924
|
+
}
|
|
2925
|
+
try {
|
|
2926
|
+
await withTimeout(Promise.resolve(panel.onAction(actionId, payload, { ...ctx, cwd })), 3e4);
|
|
2927
|
+
return { ok: true };
|
|
2928
|
+
} catch (err) {
|
|
2929
|
+
return { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
async function watchPanel(cwd, id) {
|
|
2933
|
+
const key = watchKey(cwd, id);
|
|
2934
|
+
if (watches.has(key)) {
|
|
2935
|
+
return;
|
|
2936
|
+
}
|
|
2937
|
+
const panel = await findPanel(cwd, id);
|
|
2938
|
+
if (!panel?.subscribe) {
|
|
2939
|
+
return;
|
|
2940
|
+
}
|
|
2941
|
+
const watch = { unsubscribe: () => {
|
|
2942
|
+
}, timer: null };
|
|
2943
|
+
watches.set(key, watch);
|
|
2944
|
+
try {
|
|
2945
|
+
watch.unsubscribe = panel.subscribe(() => {
|
|
2946
|
+
if (watch.timer) {
|
|
2947
|
+
return;
|
|
2948
|
+
}
|
|
2949
|
+
watch.timer = setTimeout(() => {
|
|
2950
|
+
watch.timer = null;
|
|
2951
|
+
broadcast({ kind: "panel:changed", cwd, panelId: id });
|
|
2952
|
+
}, CHANGE_DEBOUNCE_MS);
|
|
2953
|
+
});
|
|
2954
|
+
} catch {
|
|
2955
|
+
watches.delete(key);
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
function unwatchPanel(cwd, id) {
|
|
2959
|
+
const key = watchKey(cwd, id);
|
|
2960
|
+
const watch = watches.get(key);
|
|
2961
|
+
if (!watch) {
|
|
2962
|
+
return;
|
|
2963
|
+
}
|
|
2964
|
+
watches.delete(key);
|
|
2965
|
+
if (watch.timer) {
|
|
2966
|
+
clearTimeout(watch.timer);
|
|
2967
|
+
}
|
|
2968
|
+
try {
|
|
2969
|
+
watch.unsubscribe();
|
|
2970
|
+
} catch {
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
function resetPanelSubscriptions() {
|
|
2974
|
+
for (const key of [...watches.keys()]) {
|
|
2975
|
+
const [cwd, id] = key.split("\0");
|
|
2976
|
+
unwatchPanel(cwd, id);
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
function withTimeout(p, ms) {
|
|
2980
|
+
return new Promise((resolve2, reject) => {
|
|
2981
|
+
const t = setTimeout(() => reject(new Error(`timed out after ${ms}ms`)), ms);
|
|
2982
|
+
p.then(
|
|
2983
|
+
(v) => {
|
|
2984
|
+
clearTimeout(t);
|
|
2985
|
+
resolve2(v);
|
|
2986
|
+
},
|
|
2987
|
+
(e) => {
|
|
2988
|
+
clearTimeout(t);
|
|
2989
|
+
reject(e);
|
|
2990
|
+
}
|
|
2991
|
+
);
|
|
2992
|
+
});
|
|
2993
|
+
}
|
|
2857
2994
|
const EXTENSION_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
2858
2995
|
function validateExtensionName(name) {
|
|
2859
2996
|
const trimmed = name.trim();
|
|
@@ -3152,6 +3289,7 @@ function saveHostState(patch) {
|
|
|
3152
3289
|
}
|
|
3153
3290
|
function invalidateExtensionsAndNotify() {
|
|
3154
3291
|
invalidateExtensionRegistries();
|
|
3292
|
+
resetPanelSubscriptions();
|
|
3155
3293
|
broadcast({ kind: "extensions:invalidated" });
|
|
3156
3294
|
}
|
|
3157
3295
|
const LAST_FOLDER_KEY = "last_folder";
|
|
@@ -3874,11 +4012,21 @@ function registerChatIpc() {
|
|
|
3874
4012
|
if (typeof path !== "string" || !isAbsolute(path)) return false;
|
|
3875
4013
|
const stat$1 = await stat(path).catch(() => null);
|
|
3876
4014
|
if (!stat$1) return false;
|
|
3877
|
-
if (stat$1.isDirectory())
|
|
4015
|
+
if (stat$1.isDirectory()) {
|
|
4016
|
+
if (hasConfiguredEditor()) {
|
|
4017
|
+
await openFileInEditor(path).catch(async () => shell.openPath(path));
|
|
4018
|
+
return true;
|
|
4019
|
+
}
|
|
4020
|
+
return await shell.openPath(path) === "";
|
|
4021
|
+
}
|
|
3878
4022
|
if (!stat$1.isFile()) return false;
|
|
3879
4023
|
await openFileInEditor(path);
|
|
3880
4024
|
return true;
|
|
3881
4025
|
});
|
|
4026
|
+
ipcMain.handle("system:repoWebBase", async (_e, cwd) => {
|
|
4027
|
+
if (typeof cwd !== "string" || !isAbsolute(cwd)) return null;
|
|
4028
|
+
return repoWebBase(cwd);
|
|
4029
|
+
});
|
|
3882
4030
|
ipcMain.handle("system:revealPath", async (_e, raw) => {
|
|
3883
4031
|
const path = typeof raw === "string" ? raw.replace(/^file:\/\//, "") : "";
|
|
3884
4032
|
if (!isAbsolute(path)) return false;
|
|
@@ -4008,17 +4156,17 @@ function registerChatIpc() {
|
|
|
4008
4156
|
if (applied) {
|
|
4009
4157
|
return applied;
|
|
4010
4158
|
}
|
|
4011
|
-
const
|
|
4012
|
-
if (!
|
|
4159
|
+
const session2 = await loadSession(getSessionStore(), sessionId);
|
|
4160
|
+
if (!session2) {
|
|
4013
4161
|
return null;
|
|
4014
4162
|
}
|
|
4015
|
-
const runId = selectActiveTodos(
|
|
4163
|
+
const runId = selectActiveTodos(session2).runId;
|
|
4016
4164
|
if (!runId) {
|
|
4017
4165
|
return null;
|
|
4018
4166
|
}
|
|
4019
|
-
setTodosForRun(
|
|
4020
|
-
await
|
|
4021
|
-
return toTodosSnapshot(selectActiveTodos(
|
|
4167
|
+
setTodosForRun(session2, runId, sanitizeTodoItems(items, DEFAULT_MAX_TODO_ITEMS), { clearArchive: true });
|
|
4168
|
+
await session2.save();
|
|
4169
|
+
return toTodosSnapshot(selectActiveTodos(session2));
|
|
4022
4170
|
});
|
|
4023
4171
|
ipcMain.handle("usage:fetchAll", async (_e, cwd, opts) => {
|
|
4024
4172
|
return fetchAllProviderUsage(userDataDir(), await providersFor(cwd), opts ?? {});
|
|
@@ -4246,6 +4394,19 @@ function registerChatIpc() {
|
|
|
4246
4394
|
}));
|
|
4247
4395
|
}
|
|
4248
4396
|
);
|
|
4397
|
+
ipcMain.handle("panels:list", (_e, cwd) => listPanels(cwd));
|
|
4398
|
+
ipcMain.handle(
|
|
4399
|
+
"panels:load",
|
|
4400
|
+
(_e, cwd, panelId, ctx) => loadPanel(cwd, panelId, ctx)
|
|
4401
|
+
);
|
|
4402
|
+
ipcMain.handle(
|
|
4403
|
+
"panels:action",
|
|
4404
|
+
(_e, cwd, panelId, actionId, payload, ctx) => runPanelAction(cwd, panelId, actionId, payload, ctx)
|
|
4405
|
+
);
|
|
4406
|
+
ipcMain.handle("panels:watch", (_e, cwd, panelId) => watchPanel(cwd, panelId));
|
|
4407
|
+
ipcMain.handle("panels:unwatch", (_e, cwd, panelId) => {
|
|
4408
|
+
unwatchPanel(cwd, panelId);
|
|
4409
|
+
});
|
|
4249
4410
|
ipcMain.handle("extensions:themes", async (_e, cwd) => {
|
|
4250
4411
|
const config2 = await getRuntimeConfig(cwd);
|
|
4251
4412
|
return Object.values(config2.extensions.themes).map(toGuiTheme);
|
|
@@ -4675,7 +4836,13 @@ function installAppUpdate() {
|
|
|
4675
4836
|
break;
|
|
4676
4837
|
case "install":
|
|
4677
4838
|
publish({ progress: `$ ${event.command.join(" ")}` });
|
|
4678
|
-
guiLog.info("installing update", {
|
|
4839
|
+
guiLog.info("installing update", {
|
|
4840
|
+
scope: "update",
|
|
4841
|
+
packageName: event.packageName,
|
|
4842
|
+
from: event.from,
|
|
4843
|
+
to: event.to,
|
|
4844
|
+
command: event.command.join(" ")
|
|
4845
|
+
});
|
|
4679
4846
|
break;
|
|
4680
4847
|
case "log":
|
|
4681
4848
|
publish({ progress: event.line });
|
|
@@ -4697,7 +4864,12 @@ function installAppUpdate() {
|
|
|
4697
4864
|
if (failures.length > 0) {
|
|
4698
4865
|
const error = failures.map((f) => `${f.packageName}: ${f.error ?? f.status}`).join("\n");
|
|
4699
4866
|
guiLog.warn("update failed", { scope: "update", error });
|
|
4700
|
-
return publish({
|
|
4867
|
+
return publish({
|
|
4868
|
+
phase: "failed",
|
|
4869
|
+
progress: null,
|
|
4870
|
+
error,
|
|
4871
|
+
...disk ? { installed: disk.installed, restartRequired: disk.restartRequired } : {}
|
|
4872
|
+
});
|
|
4701
4873
|
}
|
|
4702
4874
|
if (report.results.every((r) => r.status === "not-installed")) {
|
|
4703
4875
|
const error = "no zidane packages found on PATH";
|
|
@@ -4754,7 +4926,11 @@ function registerUpdateIpc() {
|
|
|
4754
4926
|
cacheDir: getResolvedConfig().paths.cacheDir,
|
|
4755
4927
|
probe: findInstalled,
|
|
4756
4928
|
onChange: (next) => {
|
|
4757
|
-
guiLog.info("installed version changed", {
|
|
4929
|
+
guiLog.info("installed version changed", {
|
|
4930
|
+
scope: "update",
|
|
4931
|
+
installed: next.installed,
|
|
4932
|
+
restartRequired: next.restartRequired
|
|
4933
|
+
});
|
|
4758
4934
|
publish({ installed: next.installed, restartRequired: next.restartRequired });
|
|
4759
4935
|
}
|
|
4760
4936
|
});
|
|
@@ -4809,7 +4985,7 @@ function createWindow() {
|
|
|
4809
4985
|
show: false,
|
|
4810
4986
|
autoHideMenuBar: true,
|
|
4811
4987
|
title: withSuffix("Zidane"),
|
|
4812
|
-
backgroundColor: "#
|
|
4988
|
+
backgroundColor: "#0d1013",
|
|
4813
4989
|
icon: icon.isEmpty() ? void 0 : icon,
|
|
4814
4990
|
/**
|
|
4815
4991
|
* Hide the OS title bar and merge the macOS traffic lights into our UI
|
|
@@ -4838,6 +5014,16 @@ function createWindow() {
|
|
|
4838
5014
|
ipcMain.handle("app:rendererReady", show);
|
|
4839
5015
|
ipcMain.handle("app:version", () => app.getVersion());
|
|
4840
5016
|
setTimeout(show, 1500);
|
|
5017
|
+
ipcMain.removeHandler("appearance:nativeTheme");
|
|
5018
|
+
ipcMain.handle("appearance:nativeTheme", (_e, mode) => {
|
|
5019
|
+
nativeTheme.themeSource = mode;
|
|
5020
|
+
});
|
|
5021
|
+
ipcMain.removeHandler("appearance:background");
|
|
5022
|
+
ipcMain.handle("appearance:background", (_e, hex) => {
|
|
5023
|
+
if (/^#[0-9a-f]{6}$/i.test(hex)) {
|
|
5024
|
+
win.setBackgroundColor(hex);
|
|
5025
|
+
}
|
|
5026
|
+
});
|
|
4841
5027
|
win.webContents.setWindowOpenHandler(({ url }) => {
|
|
4842
5028
|
try {
|
|
4843
5029
|
const parsed = new URL(url);
|
|
@@ -4866,6 +5052,14 @@ app.whenReady().then(() => {
|
|
|
4866
5052
|
app.dock?.setIcon(dockIcon);
|
|
4867
5053
|
}
|
|
4868
5054
|
applyAuthEnv();
|
|
5055
|
+
const isOurRenderer = (url) => url.startsWith("file:") || url.startsWith(process.env.ELECTRON_RENDERER_URL ?? "\0");
|
|
5056
|
+
const isLocalFonts = (permission) => permission === "local-fonts";
|
|
5057
|
+
session.defaultSession.setPermissionRequestHandler((wc, permission, callback) => {
|
|
5058
|
+
callback(isLocalFonts(permission) && isOurRenderer(wc.getURL()));
|
|
5059
|
+
});
|
|
5060
|
+
session.defaultSession.setPermissionCheckHandler((wc, permission) => {
|
|
5061
|
+
return isLocalFonts(permission) && Boolean(wc && isOurRenderer(wc.getURL()));
|
|
5062
|
+
});
|
|
4869
5063
|
registerIpc();
|
|
4870
5064
|
createWindow();
|
|
4871
5065
|
app.on("activate", () => {
|
package/out/preload/index.mjs
CHANGED
|
@@ -53,6 +53,18 @@ const api = {
|
|
|
53
53
|
// Synchronous — webFrame lives in this process; no IPC roundtrip.
|
|
54
54
|
getZoomFactor: () => webFrame.getZoomFactor()
|
|
55
55
|
},
|
|
56
|
+
appearance: {
|
|
57
|
+
// Synchronous for the same reason as getZoomFactor. A zoom change
|
|
58
|
+
// resizes the layout viewport, which fires `resize` for
|
|
59
|
+
// `useNativeChromeZoomVar` on its own.
|
|
60
|
+
setZoom: (factor) => {
|
|
61
|
+
if (webFrame.getZoomFactor() !== factor) {
|
|
62
|
+
webFrame.setZoomFactor(factor);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
setNativeTheme: (mode) => ipcRenderer.invoke("appearance:nativeTheme", mode),
|
|
66
|
+
setWindowBackground: (hex) => ipcRenderer.invoke("appearance:background", hex)
|
|
67
|
+
},
|
|
56
68
|
update: {
|
|
57
69
|
state: () => ipcRenderer.invoke("update:state"),
|
|
58
70
|
check: () => ipcRenderer.invoke("update:check"),
|
|
@@ -105,7 +117,8 @@ const api = {
|
|
|
105
117
|
},
|
|
106
118
|
system: {
|
|
107
119
|
openPath: (path) => ipcRenderer.invoke("system:openPath", path),
|
|
108
|
-
revealPath: (path) => ipcRenderer.invoke("system:revealPath", path)
|
|
120
|
+
revealPath: (path) => ipcRenderer.invoke("system:revealPath", path),
|
|
121
|
+
repoWebBase: (cwd) => ipcRenderer.invoke("system:repoWebBase", cwd)
|
|
109
122
|
},
|
|
110
123
|
shell: {
|
|
111
124
|
run: (sessionId, command) => ipcRenderer.invoke("shell:run", sessionId, command),
|
|
@@ -138,6 +151,13 @@ const api = {
|
|
|
138
151
|
inline: (cwd, text, cursor, sessionId) => ipcRenderer.invoke("autocomplete:inline", cwd, text, cursor, sessionId),
|
|
139
152
|
onSuggestChanged: (cb) => subscribe("suggest:changed", cb)
|
|
140
153
|
},
|
|
154
|
+
panels: {
|
|
155
|
+
list: (cwd) => ipcRenderer.invoke("panels:list", cwd),
|
|
156
|
+
load: (cwd, panelId, ctx) => ipcRenderer.invoke("panels:load", cwd, panelId, ctx),
|
|
157
|
+
action: (cwd, panelId, actionId, payload, ctx) => ipcRenderer.invoke("panels:action", cwd, panelId, actionId, payload, ctx),
|
|
158
|
+
watch: (cwd, panelId) => ipcRenderer.invoke("panels:watch", cwd, panelId),
|
|
159
|
+
unwatch: (cwd, panelId) => ipcRenderer.invoke("panels:unwatch", cwd, panelId)
|
|
160
|
+
},
|
|
141
161
|
extensions: {
|
|
142
162
|
list: (cwd) => ipcRenderer.invoke("extensions:list", cwd),
|
|
143
163
|
completionProviders: (cwd) => ipcRenderer.invoke("extensions:completionProviders", cwd),
|