codesesh 0.10.0 → 0.11.0

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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p align="center"><strong>One place to see every AI coding session you've ever had.</strong></p>
8
8
 
9
- CodeSesh scans your local machine, finds every AI agent session (Claude Code, Cursor, Kimi, Codex, Pi, OpenCode), and surfaces them in a unified, beautiful Web UI.
9
+ CodeSesh scans your local machine, finds every AI agent session (Claude Code, Cursor, Kimi, Codex, Pi, OpenCode, ZCode), and surfaces them in a unified, beautiful Web UI.
10
10
 
11
11
  ## Quick Start
12
12
 
@@ -45,6 +45,7 @@ Your browser will open at `http://localhost:4521` with all your sessions ready t
45
45
  | Codex | ✅ Supported |
46
46
  | Pi | ✅ Supported |
47
47
  | OpenCode | ✅ Supported |
48
+ | ZCode | ✅ Supported |
48
49
 
49
50
  ## Usage
50
51
 
@@ -33,6 +33,7 @@ import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as
33
33
  import { join as join8, normalize } from "path";
34
34
  import { existsSync as existsSync9, readFileSync as readFileSync7, readdirSync as readdirSync5, statSync as statSync6 } from "fs";
35
35
  import { basename as basename6, join as join9 } from "path";
36
+ import { join as join10 } from "path";
36
37
  import { availableParallelism } from "os";
37
38
  import { Worker } from "worker_threads";
38
39
  import { existsSync as existsSync10, readFileSync as readFileSync8 } from "fs";
@@ -41,11 +42,11 @@ import * as os from "os";
41
42
  import * as path from "path";
42
43
  import { resolve, sep } from "path";
43
44
  import { existsSync as existsSync11 } from "fs";
44
- import { join as join10 } from "path";
45
+ import { join as join11 } from "path";
45
46
  import { homedir as homedir4 } from "os";
46
47
  import { existsSync as existsSync12, rmSync, unlinkSync } from "fs";
47
48
  import { homedir as homedir5, platform as platform2 } from "os";
48
- import { join as join11 } from "path";
49
+ import { join as join12 } from "path";
49
50
  var registrations = [];
50
51
  function registerAgent(reg) {
51
52
  registrations.push(reg);
@@ -215,7 +216,8 @@ function resolveProviderRoots() {
215
216
  claudeRoot: envPath("CLAUDE_CONFIG_DIR") ?? join(home, ".claude"),
216
217
  kimiRoot: envPath("KIMI_SHARE_DIR") ?? join(home, ".kimi"),
217
218
  opencodeRoot: join(getDataHome(), "opencode"),
218
- piRoot: envPath("PI_HOME") ?? join(home, ".pi")
219
+ piRoot: envPath("PI_HOME") ?? join(home, ".pi"),
220
+ zcodeRoot: getZCodeDataPath()
219
221
  };
220
222
  }
221
223
  function getCursorDataPath() {
@@ -235,6 +237,13 @@ function getCursorDataPath() {
235
237
  }
236
238
  return null;
237
239
  }
240
+ function getZCodeDataPath() {
241
+ const p = platform();
242
+ if (p === "darwin" || p === "win32") {
243
+ return join(homedir(), ".zcode");
244
+ }
245
+ return null;
246
+ }
238
247
  function* parseJsonlLines(content) {
239
248
  for (const line of content.split("\n")) {
240
249
  const trimmed = line.trim();
@@ -1726,9 +1735,16 @@ function openDb(dbPath) {
1726
1735
  function isSqliteAvailable() {
1727
1736
  return DatabaseConstructor !== null;
1728
1737
  }
1729
- var OpenCodeAgent = class extends DatabaseSessionSource {
1730
- name = "opencode";
1731
- displayName = "OpenCode";
1738
+ var OpenCodeSqliteAgent = class extends DatabaseSessionSource {
1739
+ constructor(config) {
1740
+ super();
1741
+ this.config = config;
1742
+ this.name = config.name;
1743
+ this.displayName = config.displayName;
1744
+ }
1745
+ config;
1746
+ name;
1747
+ displayName;
1732
1748
  dbPath = null;
1733
1749
  getDatabasePath() {
1734
1750
  if (!this.dbPath) {
@@ -1737,9 +1753,7 @@ var OpenCodeAgent = class extends DatabaseSessionSource {
1737
1753
  return this.dbPath;
1738
1754
  }
1739
1755
  findDbPath() {
1740
- if (!isSqliteAvailable()) return null;
1741
- const roots = resolveProviderRoots();
1742
- return firstExisting(join5(roots.opencodeRoot, "opencode.db"), "data/opencode/opencode.db");
1756
+ return this.config.findDbPath();
1743
1757
  }
1744
1758
  isAvailable() {
1745
1759
  this.dbPath = this.findDbPath();
@@ -1814,7 +1828,7 @@ var OpenCodeAgent = class extends DatabaseSessionSource {
1814
1828
  const messageTitle = context?.messageTitle ?? null;
1815
1829
  return parsedSession({
1816
1830
  id,
1817
- slug: `opencode/${id}`,
1831
+ slug: `${this.name}/${id}`,
1818
1832
  title: resolveSessionTitle(String(row.title ?? ""), messageTitle, null),
1819
1833
  directory: String(row.directory ?? ""),
1820
1834
  time_created: timeCreated,
@@ -1954,11 +1968,11 @@ var OpenCodeAgent = class extends DatabaseSessionSource {
1954
1968
  this.dbPath = this.findDbPath();
1955
1969
  }
1956
1970
  if (!this.dbPath) {
1957
- throw new Error("OpenCode database is missing");
1971
+ throw new Error(`${this.displayName} database is missing`);
1958
1972
  }
1959
1973
  const db = openDbReadOnly(this.dbPath);
1960
1974
  if (!db) {
1961
- throw new Error("OpenCode database is missing");
1975
+ throw new Error(`${this.displayName} database is missing`);
1962
1976
  }
1963
1977
  try {
1964
1978
  const sessionRow = db.prepare("SELECT * FROM session WHERE id = ?").get(sessionId);
@@ -1966,7 +1980,7 @@ var OpenCodeAgent = class extends DatabaseSessionSource {
1966
1980
  throw new Error(`Session not found: ${sessionId}`);
1967
1981
  }
1968
1982
  const id = String(sessionRow.id ?? sessionId);
1969
- const slug = `opencode/${id}`;
1983
+ const slug = `${this.name}/${id}`;
1970
1984
  const directory = String(sessionRow.directory ?? "");
1971
1985
  const timeCreated = Number(sessionRow.time_created ?? 0);
1972
1986
  const timeUpdated = Number(sessionRow.time_updated ?? timeCreated);
@@ -2037,6 +2051,20 @@ var OpenCodeAgent = class extends DatabaseSessionSource {
2037
2051
  }
2038
2052
  }
2039
2053
  };
2054
+ function findOpenCodeDbPath() {
2055
+ if (!isSqliteAvailable()) return null;
2056
+ const roots = resolveProviderRoots();
2057
+ return firstExisting(join5(roots.opencodeRoot, "opencode.db"), "data/opencode/opencode.db");
2058
+ }
2059
+ var OpenCodeAgent = class extends OpenCodeSqliteAgent {
2060
+ constructor() {
2061
+ super({
2062
+ name: "opencode",
2063
+ displayName: "OpenCode",
2064
+ findDbPath: findOpenCodeDbPath
2065
+ });
2066
+ }
2067
+ };
2040
2068
  var KIMI_TOOL_TITLE_MAP = {
2041
2069
  ReadFile: "read",
2042
2070
  Glob: "glob",
@@ -4981,6 +5009,21 @@ var PiAgent = class extends FileSystemSessionSource {
4981
5009
  };
4982
5010
  }
4983
5011
  };
5012
+ function findZCodeDbPath() {
5013
+ if (!isSqliteAvailable()) return null;
5014
+ const roots = resolveProviderRoots();
5015
+ if (!roots.zcodeRoot) return null;
5016
+ return firstExisting(join10(roots.zcodeRoot, "cli", "db", "db.sqlite"));
5017
+ }
5018
+ var ZCodeAgent = class extends OpenCodeSqliteAgent {
5019
+ constructor() {
5020
+ super({
5021
+ name: "zcode",
5022
+ displayName: "ZCode",
5023
+ findDbPath: findZCodeDbPath
5024
+ });
5025
+ }
5026
+ };
4984
5027
  registerAgent({
4985
5028
  name: "claudecode",
4986
5029
  displayName: "Claude Code",
@@ -4993,6 +5036,12 @@ registerAgent({
4993
5036
  icon: "/icon/agent/opencode.svg",
4994
5037
  create: () => new OpenCodeAgent()
4995
5038
  });
5039
+ registerAgent({
5040
+ name: "zcode",
5041
+ displayName: "ZCode",
5042
+ icon: "/icon/agent/zcode.svg",
5043
+ create: () => new ZCodeAgent()
5044
+ });
4996
5045
  registerAgent({
4997
5046
  name: "kimi",
4998
5047
  displayName: "Kimi-Cli",
@@ -5523,13 +5572,13 @@ function setFtsIntegrityCheckedPath(path2) {
5523
5572
  ftsIntegrityCheckedPath = path2;
5524
5573
  }
5525
5574
  function getCacheDir2() {
5526
- return join10(homedir4(), ".cache", "codesesh");
5575
+ return join11(homedir4(), ".cache", "codesesh");
5527
5576
  }
5528
5577
  function getCachePath2() {
5529
- return join10(getCacheDir2(), CACHE_FILENAME);
5578
+ return join11(getCacheDir2(), CACHE_FILENAME);
5530
5579
  }
5531
5580
  function getLegacyCachePath() {
5532
- return join10(getCacheDir2(), LEGACY_CACHE_FILENAME);
5581
+ return join11(getCacheDir2(), LEGACY_CACHE_FILENAME);
5533
5582
  }
5534
5583
  function hasCacheStorage() {
5535
5584
  return existsSync11(getCachePath2());
@@ -8535,16 +8584,16 @@ function getStateDir() {
8535
8584
  }
8536
8585
  const p = platform2();
8537
8586
  if (p === "darwin") {
8538
- return join11(homedir5(), "Library", "Application Support", "codesesh");
8587
+ return join12(homedir5(), "Library", "Application Support", "codesesh");
8539
8588
  }
8540
8589
  if (p === "win32") {
8541
8590
  const appData = process.env.APPDATA ?? process.env.LOCALAPPDATA;
8542
- return join11(appData ?? join11(homedir5(), "AppData", "Roaming"), "codesesh");
8591
+ return join12(appData ?? join12(homedir5(), "AppData", "Roaming"), "codesesh");
8543
8592
  }
8544
- return join11(process.env.XDG_DATA_HOME ?? join11(homedir5(), ".local", "share"), "codesesh");
8593
+ return join12(process.env.XDG_DATA_HOME ?? join12(homedir5(), ".local", "share"), "codesesh");
8545
8594
  }
8546
8595
  function getStateDbPath() {
8547
- return join11(getStateDir(), BOOKMARK_DB_FILENAME);
8596
+ return join12(getStateDir(), BOOKMARK_DB_FILENAME);
8548
8597
  }
8549
8598
  function useMemoryStateStore() {
8550
8599
  return process.env.CODESESH_STATE_STORE === MEMORY_STATE_STORE;
@@ -9081,4 +9130,4 @@ export {
9081
9130
  startOfLocalDay,
9082
9131
  buildDashboard
9083
9132
  };
9084
- //# sourceMappingURL=chunk-ZQMIB7QO.js.map
9133
+ //# sourceMappingURL=chunk-BIXOP5QX.js.map