zidane-gui 8.2.5 → 9.0.2

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.
Files changed (39) hide show
  1. package/README.md +3 -2
  2. package/out/main/chunks/{history-pager-DWgllMof.js → history-pager-DUFgTrih.js} +2 -13
  3. package/out/main/chunks/tool-results-sql-C0MqWcQc.js +41 -0
  4. package/out/main/chunks/usage-sql-DiITGx8Q.js +67 -0
  5. package/out/main/history-worker.js +1 -4
  6. package/out/main/index.js +2183 -3189
  7. package/out/main/lsp-host.js +17 -4
  8. package/out/main/tool-results-worker.js +17 -0
  9. package/out/main/usage-worker.js +5 -19
  10. package/out/preload/index.mjs +67 -4
  11. package/out/renderer/assets/CodeEditor-in2F3Rz-.js +12771 -0
  12. package/out/renderer/assets/ComposerEditor-DzKoxH6Z.js +68 -0
  13. package/out/renderer/assets/DiffsTab-Ceh4E5wW.js +540 -0
  14. package/out/renderer/assets/EditorWorkers-Bhv2OJRb.js +67 -0
  15. package/out/renderer/assets/FileIcon-CYgGSQ59.js +781 -0
  16. package/out/renderer/assets/FilesTab-DESQMqGK.js +11763 -0
  17. package/out/renderer/assets/core-xOIU6ifr.js +9977 -0
  18. package/out/renderer/assets/file-tabs-Cozt9Sho.js +105 -0
  19. package/out/renderer/assets/{ghostty-web-wgkS5jGl.js → ghostty-web-BTHoKwMc.js} +1 -1
  20. package/out/renderer/assets/index-DkE-xvCG.js +9525 -0
  21. package/out/renderer/assets/index-DogoEzwx.js +10868 -0
  22. package/out/renderer/assets/{index-DqGrzqUj.css → index-DrLLItLS.css} +2481 -2639
  23. package/out/renderer/assets/kit-BUt8oFlT.js +64699 -0
  24. package/out/renderer/assets/pierre-theme-Bj5EAt1L.js +4312 -0
  25. package/out/renderer/assets/useDetachCleanup-Bb7k1ePf.js +3138 -0
  26. package/out/renderer/assets/useFolderChanges-B4X4n6NV.js +7896 -0
  27. package/out/renderer/assets/vendor-BvslLX9q.js +20410 -0
  28. package/out/renderer/assets/vendor-D_E2rLzO.css +388 -0
  29. package/out/renderer/assets/vendor-editor-Bx3dRdBD.js +26391 -0
  30. package/out/renderer/assets/vendor-motion-BLeNAEjH.js +9376 -0
  31. package/out/renderer/assets/vendor-react-DltKc0Ts.js +14275 -0
  32. package/out/renderer/assets/vendor-shiki-ba8IDo5s.js +459 -0
  33. package/out/renderer/index.html +11 -3
  34. package/package.json +10 -4
  35. package/scripts/postinstall.mjs +2 -1
  36. package/out/main/chunks/context-77_UZfgL.js +0 -61
  37. package/out/main/chunks/usage-sql-C2Tg1u44.js +0 -81
  38. package/out/renderer/assets/index-CebkAnp4.js +0 -191640
  39. /package/out/renderer/assets/{working-tree-parse.worker-BAW1QWyk.js → patch-parse.worker-BAW1QWyk.js} +0 -0
package/README.md CHANGED
@@ -30,7 +30,7 @@ npm uninstall -g zidane-gui
30
30
 
31
31
  ## Dev
32
32
 
33
- `gui/` is not a member of the root bun workspaces. It has its own `bun.lock`, and it compiles `@zidane/ui` from `ui/` source.
33
+ `gui/` is not a member of the root bun workspaces. It has its own `bun.lock`, and it compiles `zidane-ui` from `ui/` source.
34
34
 
35
35
  1. Run `bun install` at the monorepo root.
36
36
  2. Run `bun install` in `gui/`. Its postinstall script links `gui/node_modules/zidane` to the repo root.
@@ -51,7 +51,8 @@ Run these from `gui/`, or run `bun --cwd=gui run <script>` from the root.
51
51
  - `bun run format` formats the package with Prettier. `bun run format:check` only checks, as CI does.
52
52
  - `bun run test` builds the root `dist/` (the `pretest` script), then runs the vitest unit suite in `src/` and `scripts/`.
53
53
  - `bun run test:watch` runs vitest in watch mode.
54
- - `bun run test:e2e` runs Playwright end-to-end tests. It runs `build` first.
54
+ - `bun run test:e2e` runs Playwright end-to-end tests. It runs `build` first. Three projects run in order (`test/playwright.config.ts`): `functional` in parallel (half the cores; `ZG_E2E_WORKERS=n` or `--workers n` to change), then `exclusive` (tests tagged `@exclusive`: they focus their window or use the system clipboard) and `perf` (frame-time and long-task assertions) one test at a time. A project runs only if the one before it passed.
55
+ - `bun run test:e2e:functional` runs only the parallel `functional` project. `bun run test:e2e:serial` runs only `exclusive` and `perf`, one test at a time. Both build first. CI runs them only on pull requests labelled `e2e:desktop`.
55
56
  - `bun run test:visual` runs the Playwright visual regression suite. It runs `build` first.
56
57
  - `bun run package` builds a macOS arm64 app with electron-builder.
57
58
 
@@ -1,14 +1,7 @@
1
- import { existsSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { Worker } from "node:worker_threads";
4
1
  import { createReadonlySqliteSessionStore } from "zidane";
5
2
  import { createTranscriptReplayCache, transcriptPage, LOAD_EVENTS_MAX_PAGE_TURNS, HISTORY_WORKER_KILL_SWITCH, createWorkerRpcClient, WorkerRequestError, WorkerUnavailableError } from "zidane/ipc";
6
3
  import { replayTurns } from "zidane/chat";
7
4
  import { b as readTranscript } from "./transcript-sql-DbZ-a5wb.js";
8
- import __cjs_mod__ from "node:module";
9
- const __filename = import.meta.filename;
10
- const __dirname = import.meta.dirname;
11
- const require2 = __cjs_mod__.createRequire(import.meta.url);
12
5
  function settleRuns(runs, live) {
13
6
  if (live) return runs;
14
7
  return runs.map(
@@ -102,11 +95,6 @@ function createHistoryPageHandler(driver, options = HISTORY_PAGER_OPTIONS) {
102
95
  };
103
96
  return ({ sessionId, ...request }) => pager.page(sessionId, source, request);
104
97
  }
105
- function spawnHistoryWorker() {
106
- const file = join(__dirname, "history-worker.js");
107
- if (!existsSync(file)) throw new Error(`history worker: no ${file}`);
108
- return new Worker(file);
109
- }
110
98
  const debugFallback = process.env.ZIDANE_DEBUG ? (error) => console.error("[gui] history page fell back to the main thread:", error) : () => {
111
99
  };
112
100
  function createLocalHistoryPager(deps) {
@@ -125,7 +113,8 @@ function createLocalHistoryPager(deps) {
125
113
  if (closed) return local(sessionId, request);
126
114
  client ??= createWorkerRpcClient({
127
115
  name: "history worker",
128
- create: deps.create ?? spawnHistoryWorker,
116
+ create: deps.create,
117
+ ...deps.onDegraded ? { onDegraded: deps.onDegraded } : {},
129
118
  init: { dbPath: deps.dbPath() }
130
119
  });
131
120
  try {
@@ -0,0 +1,41 @@
1
+ import { toolResultToText } from "zidane";
2
+ import { p as parseRows } from "./transcript-sql-DbZ-a5wb.js";
3
+ const RESULT_WINDOW = 3;
4
+ const escapeLike = (text) => text.replace(/[\\%_]/g, (ch) => `\\${ch}`);
5
+ function resultOf(turns, callId) {
6
+ for (const turn of turns)
7
+ for (const block of turn.content) if (block.type === "tool_result" && block.callId === callId) return block.output;
8
+ return void 0;
9
+ }
10
+ function readToolResult(driver, { sessionId, callId }) {
11
+ const call = driver.prepare(
12
+ "SELECT seq FROM turns WHERE session_id = ? AND (role = 'assistant' OR role IS NULL) AND data LIKE ? ESCAPE '\\' ORDER BY seq LIMIT 1"
13
+ ).get(sessionId, `%"${escapeLike(callId)}"%`);
14
+ if (call) {
15
+ const near = driver.prepare(
16
+ "SELECT data FROM turns WHERE session_id = ? AND (role = 'user' OR role IS NULL) AND seq > ? ORDER BY seq LIMIT ?"
17
+ ).all(sessionId, call.seq, RESULT_WINDOW);
18
+ const output = resultOf(parseRows(near), callId);
19
+ if (output !== void 0) return output;
20
+ }
21
+ const all = driver.prepare("SELECT data FROM turns WHERE session_id = ? AND data LIKE ? ESCAPE '\\' ORDER BY seq LIMIT 4").all(sessionId, `%${escapeLike(callId)}%`);
22
+ return resultOf(parseRows(all), callId);
23
+ }
24
+ function readToolResultText(driver, request) {
25
+ const output = readToolResult(driver, request);
26
+ if (output === void 0) return null;
27
+ return typeof output === "string" ? output : toolResultToText(output);
28
+ }
29
+ function readToolMedia(driver, request) {
30
+ const output = readToolResult(driver, request);
31
+ if (output === void 0 || typeof output === "string") return null;
32
+ const item = output.filter((b) => b.type === "image" || b.type === "video" || b.type === "audio")[request.index];
33
+ if (!item || typeof item.data !== "string") return null;
34
+ return { mediaType: item.mediaType, data: Buffer.from(item.data, "base64") };
35
+ }
36
+ function serveToolResultsCall(driver, call) {
37
+ return call.kind === "media" ? readToolMedia(driver, call) : readToolResultText(driver, call);
38
+ }
39
+ export {
40
+ serveToolResultsCall as s
41
+ };
@@ -0,0 +1,67 @@
1
+ import { DatabaseSync } from "node:sqlite";
2
+ import { runUsageAggregates } from "zidane";
3
+ function startOfLocalDay(db, day) {
4
+ const row = db.prepare("SELECT CAST(strftime('%s', ?, 'utc') AS INTEGER) * 1000 AS ms").get(day);
5
+ if (typeof row?.ms !== "number") throw new Error(`usage scan: not a day: ${day}`);
6
+ return row.ms;
7
+ }
8
+ function fromDay(buckets, since) {
9
+ return {
10
+ assistant: buckets.assistant.filter((r) => r.day >= since),
11
+ user: buckets.user.filter((r) => r.day >= since),
12
+ sessions: buckets.sessions.filter((r) => r.day >= since)
13
+ };
14
+ }
15
+ function beforeDay(buckets, since) {
16
+ return {
17
+ assistant: buckets.assistant.filter((r) => r.day < since),
18
+ user: buckets.user.filter((r) => r.day < since),
19
+ sessions: buckets.sessions.filter((r) => r.day < since)
20
+ };
21
+ }
22
+ function aggregateUsage(db, since) {
23
+ if (since === void 0) return runUsageAggregates(db);
24
+ const floor = startOfLocalDay(db, since);
25
+ db.exec(
26
+ `CREATE TEMP VIEW turns AS SELECT * FROM main.turns WHERE session_id IN (SELECT id FROM main.sessions WHERE updated_at >= ${floor})`
27
+ );
28
+ try {
29
+ return fromDay(runUsageAggregates(db), since);
30
+ } finally {
31
+ db.exec("DROP VIEW temp.turns");
32
+ }
33
+ }
34
+ function mergeUsageBuckets(held, fresh, since) {
35
+ const older = beforeDay(held, since);
36
+ return {
37
+ assistant: [...older.assistant, ...fresh.assistant],
38
+ user: [...older.user, ...fresh.user],
39
+ sessions: [...older.sessions, ...fresh.sessions]
40
+ };
41
+ }
42
+ function newestUsageDay(buckets) {
43
+ let newest;
44
+ for (const rows of [buckets.assistant, buckets.user, buckets.sessions]) {
45
+ const last = rows.at(-1)?.day;
46
+ if (last !== void 0 && (newest === void 0 || last > newest)) newest = last;
47
+ }
48
+ return newest;
49
+ }
50
+ function createUsageScanner() {
51
+ let db = null;
52
+ return {
53
+ init({ dbPath }) {
54
+ db = new DatabaseSync(dbPath, { readOnly: true });
55
+ db.exec("PRAGMA busy_timeout = 5000");
56
+ },
57
+ handle({ since }) {
58
+ if (!db) throw new Error("usage worker: no database open");
59
+ return aggregateUsage(db, since);
60
+ }
61
+ };
62
+ }
63
+ export {
64
+ createUsageScanner as c,
65
+ mergeUsageBuckets as m,
66
+ newestUsageDay as n
67
+ };
@@ -1,10 +1,7 @@
1
1
  import { DatabaseSync } from "node:sqlite";
2
2
  import { createSqliteDriver } from "zidane";
3
3
  import { serveWorkerRpc } from "zidane/ipc";
4
- import { c as createHistoryPageHandler } from "./chunks/history-pager-DWgllMof.js";
5
- import "node:fs";
6
- import "node:path";
7
- import "node:worker_threads";
4
+ import { c as createHistoryPageHandler } from "./chunks/history-pager-DUFgTrih.js";
8
5
  import "zidane/chat";
9
6
  import "./chunks/transcript-sql-DbZ-a5wb.js";
10
7
  let handle = null;