sessiongraph-app-darwin-arm64 1.0.25 → 1.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/package.json +2 -2
- package/payload/SessionGraph.app/Contents/Info.plist +2 -2
- package/payload/SessionGraph.app/Contents/MacOS/sessiongraph +0 -0
- package/payload/SessionGraph.app/Contents/Resources/resources/cli-package.json +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/cli.mjs +236 -83
- package/payload/SessionGraph.app/Contents/Resources/resources/server.mjs +261 -117
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{index-D4p45n7i.js → index-BDlenc5U.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{index-YT1ntRdY.js → index-BVcGr0Qy.js} +7 -7
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{index-B05th82t.js → index-CI08Hryc.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{index-DFcP_XK3.js → index-Ds6_5DlV.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{public-viewer-DZqNLaJW.js → public-viewer-BR7Jvjf3.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{scene-BkT0QJrf.js → scene-CaX0r4Hf.js} +1 -1
- package/payload/SessionGraph.app/Contents/Resources/resources/web/assets/{share-jfnlc0aB.js → share-C0Ryjhbj.js} +3 -3
- package/payload/SessionGraph.app/Contents/Resources/resources/web/index.html +1 -1
- package/payload/SessionGraph.app/Contents/_CodeSignature/CodeResources +40 -40
|
@@ -2413,16 +2413,16 @@ async function publish(file, info, handoff) {
|
|
|
2413
2413
|
await rename(temporary, file + ".pty-handoff").finally(() => rm(temporary, { force: true }));
|
|
2414
2414
|
}
|
|
2415
2415
|
async function environment2(file, env2) {
|
|
2416
|
-
const
|
|
2416
|
+
const record2 = await read(file);
|
|
2417
2417
|
const current = await readFile(file, "utf8").then((text2) => JSON.parse(text2)).catch(() => {
|
|
2418
2418
|
return;
|
|
2419
2419
|
});
|
|
2420
|
-
const handoff =
|
|
2420
|
+
const handoff = record2 !== void 0 && record2.expiresAt > Date.now() && (current === void 0 || same(record2.source, current)) ? record2.handoff : void 0;
|
|
2421
2421
|
return { ...env2, OPENCODE_PTY_HANDOFF: handoff == null ? void 0 : JSON.stringify(handoff) };
|
|
2422
2422
|
}
|
|
2423
2423
|
async function complete2(file, info) {
|
|
2424
|
-
const
|
|
2425
|
-
if (
|
|
2424
|
+
const record2 = await read(file);
|
|
2425
|
+
if (record2 !== void 0 && !same(record2.source, info))
|
|
2426
2426
|
await clear2(file);
|
|
2427
2427
|
}
|
|
2428
2428
|
async function clear2(file) {
|
|
@@ -31187,7 +31187,7 @@ function piHistory(value) {
|
|
|
31187
31187
|
nativeID: header.id,
|
|
31188
31188
|
messages,
|
|
31189
31189
|
partial,
|
|
31190
|
-
session: { directory: text(header.cwd), created: time(header.timestamp), title: text([...rows2].reverse().find((r) => r.type === "session_info")?.name), model: text(lastModel?.modelId || lastModel?.message?.model) || "Unknown model", provider: text(lastModel?.provider || lastModel?.message?.provider) },
|
|
31190
|
+
session: { directory: text(header.cwd), created: time(header.timestamp), title: text([...rows2].reverse().find((r) => r.type === "session_info" && text(r.name).trim())?.name).trim(), model: text(lastModel?.modelId || lastModel?.message?.model) || "Unknown model", provider: text(lastModel?.provider || lastModel?.message?.provider) },
|
|
31191
31191
|
note: "Includes all saved branches in this transcript."
|
|
31192
31192
|
};
|
|
31193
31193
|
}
|
|
@@ -31278,7 +31278,7 @@ function jcodeHistory(path, files) {
|
|
|
31278
31278
|
function codebuffHistory(path, files, free) {
|
|
31279
31279
|
const records = json3(files.get(path));
|
|
31280
31280
|
if (!Array.isArray(records)) throw new Error("Unsupported Codebuff chat.");
|
|
31281
|
-
const isFree = records.some((m) => text(m.metadata?.runState?.sessionState?.mainAgentState?.agentType).
|
|
31281
|
+
const isFree = records.some((m) => text(m.metadata?.runState?.sessionState?.mainAgentState?.agentType).split("-").includes("free"));
|
|
31282
31282
|
if (isFree !== free) return;
|
|
31283
31283
|
const messages = records.flatMap((r, i) => {
|
|
31284
31284
|
const content = r.content ?? (Array.isArray(r.blocks) ? r.blocks.filter((b) => typeof b.content === "string").map((b) => ({ type: "text", text: b.content })) : void 0);
|
|
@@ -31830,6 +31830,7 @@ function codexRecord(raw, offset, candidate) {
|
|
|
31830
31830
|
if (!p || typeof p !== "object") return;
|
|
31831
31831
|
if (raw.type === "session_meta" || raw.type === "turn_context") candidate.locator.executionCwd = typeof p.cwd === "string" ? p.cwd : "";
|
|
31832
31832
|
if (raw.type === "turn_context" && typeof p.model === "string") candidate.session.model = p.model;
|
|
31833
|
+
if (raw.type === "world_state" && typeof p.state?.model === "string" && p.state.model && candidate.session.model === "Unknown model") candidate.session.model = p.state.model;
|
|
31833
31834
|
if (raw.type === "event_msg" && p.type === "item_completed" && ["FileChange", "fileChange"].includes(p.item?.type)) {
|
|
31834
31835
|
const msg2 = blankMessage(`event:${p.item.id || raw.ordinal || offset}`, p.completed_at_ms || Date.parse(raw.timestamp) || 0, "tool");
|
|
31835
31836
|
msg2.events = [eventFor(msg2, "change", "event", "File-change result", eventText(p.item), { nativeType: p.type, status: ["completed", "Completed"].includes(p.item.status) ? "completed" : "unknown" })];
|
|
@@ -33428,7 +33429,8 @@ var continueAdapter = localFileAdapter({
|
|
|
33428
33429
|
});
|
|
33429
33430
|
|
|
33430
33431
|
// server/adapters/harness-files.ts
|
|
33431
|
-
import {
|
|
33432
|
+
import { readdirSync as readdirSync3 } from "node:fs";
|
|
33433
|
+
import { basename as basename11, dirname as dirname10, join as join24 } from "node:path";
|
|
33432
33434
|
|
|
33433
33435
|
// server/adapters/harness-extra-formats.ts
|
|
33434
33436
|
import { basename as basename9, dirname as dirname8, join as join22 } from "node:path";
|
|
@@ -33508,23 +33510,163 @@ function devinDesktopHistory(path, files) {
|
|
|
33508
33510
|
return acpHistory(path, normalized.map((r) => JSON.stringify(r)).join("\n"));
|
|
33509
33511
|
}
|
|
33510
33512
|
|
|
33513
|
+
// server/adapters/minimax.ts
|
|
33514
|
+
import { readdirSync as readdirSync2, realpathSync as realpathSync2, statSync as statSync2 } from "node:fs";
|
|
33515
|
+
import { basename as basename10, dirname as dirname9, join as join23 } from "node:path";
|
|
33516
|
+
var bases = [".minimax", ".mavis"];
|
|
33517
|
+
var SNAPSHOT_BUDGET = 24e6;
|
|
33518
|
+
function minimaxRoots() {
|
|
33519
|
+
const override = process.env.MINIMAX_DATA_DIR?.trim() || process.env.MAVIS_DATA_DIR?.trim();
|
|
33520
|
+
let dirs = override ? [override] : bases.map((b) => homePath(b));
|
|
33521
|
+
if (!override) {
|
|
33522
|
+
try {
|
|
33523
|
+
dirs.push(...readdirSync2(homePath()).filter((n) => bases.some((b) => n.startsWith(`${b}-`) && n.length > b.length + 1)).sort().map((n) => homePath(n)));
|
|
33524
|
+
} catch {
|
|
33525
|
+
}
|
|
33526
|
+
}
|
|
33527
|
+
const seen = /* @__PURE__ */ new Set();
|
|
33528
|
+
return dirs.map((d) => join23(d, "v2", "sessions")).filter((root2) => {
|
|
33529
|
+
let key = root2;
|
|
33530
|
+
try {
|
|
33531
|
+
key = realpathSync2(root2);
|
|
33532
|
+
} catch {
|
|
33533
|
+
}
|
|
33534
|
+
return !seen.has(key) && Boolean(seen.add(key));
|
|
33535
|
+
});
|
|
33536
|
+
}
|
|
33537
|
+
var minimaxNative = (path) => /(?:^|\/)[^/]*session_[^/]+\/messages\.jsonl$/.test(path);
|
|
33538
|
+
var generation = (name) => Number(/^g(\d+)--/.exec(name)?.[1] ?? Infinity);
|
|
33539
|
+
function snapshotFiles2(path) {
|
|
33540
|
+
const dir = join23(dirname9(path), "snapshots");
|
|
33541
|
+
try {
|
|
33542
|
+
return readdirSync2(dir).filter((n) => n.endsWith(".jsonl")).sort((a, b) => generation(a) - generation(b) || a.localeCompare(b)).map((n) => join23(dir, n));
|
|
33543
|
+
} catch {
|
|
33544
|
+
return [];
|
|
33545
|
+
}
|
|
33546
|
+
}
|
|
33547
|
+
function minimaxExtras(path) {
|
|
33548
|
+
const dir = dirname9(path);
|
|
33549
|
+
let budget2 = SNAPSHOT_BUDGET;
|
|
33550
|
+
try {
|
|
33551
|
+
budget2 -= statSync2(path).size;
|
|
33552
|
+
} catch {
|
|
33553
|
+
}
|
|
33554
|
+
const kept = [];
|
|
33555
|
+
for (const file of snapshotFiles2(path).reverse()) {
|
|
33556
|
+
let size = 0;
|
|
33557
|
+
try {
|
|
33558
|
+
size = statSync2(file).size;
|
|
33559
|
+
} catch {
|
|
33560
|
+
continue;
|
|
33561
|
+
}
|
|
33562
|
+
if (size > budget2) break;
|
|
33563
|
+
budget2 -= size;
|
|
33564
|
+
kept.unshift(file);
|
|
33565
|
+
}
|
|
33566
|
+
return [join23(dir, "manifest.json"), ...kept];
|
|
33567
|
+
}
|
|
33568
|
+
function minimaxFolderID(path) {
|
|
33569
|
+
const encoded = /session_([A-Za-z0-9_-]+)$/.exec(basename10(dirname9(path)))?.[1];
|
|
33570
|
+
if (!encoded) return "";
|
|
33571
|
+
const decoded = Buffer.from(encoded, "base64url").toString("utf8");
|
|
33572
|
+
return /^[\x21-\x7e]{1,256}$/.test(decoded) ? decoded : encoded;
|
|
33573
|
+
}
|
|
33574
|
+
var runtime;
|
|
33575
|
+
function runtimeSession(path, nativeID) {
|
|
33576
|
+
const sessions = dirname9(dirname9(dirname9(dirname9(dirname9(path))))), v22 = dirname9(sessions);
|
|
33577
|
+
if (basename10(sessions) !== "sessions" || basename10(v22) !== "v2") return;
|
|
33578
|
+
const db2 = join23(v22, "sqlite", "runtime-state.sqlite");
|
|
33579
|
+
try {
|
|
33580
|
+
const revision2 = sqliteRevision(db2);
|
|
33581
|
+
if (runtime?.path !== db2 || runtime.revision !== revision2) {
|
|
33582
|
+
runtime = { path: db2, revision: revision2, sessions: withSqliteSnapshot(db2, (d) => {
|
|
33583
|
+
const rows2 = /* @__PURE__ */ new Map();
|
|
33584
|
+
if (!hasTable(d, "local_runtime_sessions")) return rows2;
|
|
33585
|
+
const columns2 = new Set(d.prepare("PRAGMA table_info(local_runtime_sessions)").all().map((c) => String(c.name)));
|
|
33586
|
+
const pick = (name) => columns2.has(name) ? name : "NULL";
|
|
33587
|
+
if (!columns2.has("session_id")) return rows2;
|
|
33588
|
+
const workspace = `CASE WHEN ${pick("is_default_workspace")} = 1 THEN NULL ELSE COALESCE(NULLIF(${pick("project_workspace_dir")}, ''), ${pick("workspace_dir")}) END`;
|
|
33589
|
+
for (const r of d.prepare(`SELECT session_id, ${pick("title")} AS title, ${workspace} AS directory, ${pick("parent_session_id")} AS parent FROM local_runtime_sessions LIMIT 100000`).all())
|
|
33590
|
+
if (text(r.session_id)) rows2.set(text(r.session_id), { title: text(r.title).trim(), directory: text(r.directory), parent: text(r.parent) });
|
|
33591
|
+
return rows2;
|
|
33592
|
+
}, revision2) };
|
|
33593
|
+
}
|
|
33594
|
+
return runtime.sessions.get(nativeID);
|
|
33595
|
+
} catch {
|
|
33596
|
+
return;
|
|
33597
|
+
}
|
|
33598
|
+
}
|
|
33599
|
+
var minimaxTime = (v3) => typeof v3 === "number" && v3 > 0 && v3 < 1e11 ? seconds(v3) : time(v3);
|
|
33600
|
+
function record(r, i) {
|
|
33601
|
+
const body2 = object3(r.message), id2 = text(r.message_id) || text(body2.id) || `record:${i}`, at2 = minimaxTime(body2.timestamp ?? r.timestamp);
|
|
33602
|
+
if (body2.role === "compactionSummary" || body2.archonCompaction) return recordEvent(r, id2, "Compaction summary", at2, body2.summary ?? body2.content);
|
|
33603
|
+
const content = body2.role === "user" && typeof body2.genuineUserQueryText === "string" ? body2.genuineUserQueryText : body2.content;
|
|
33604
|
+
return message({ ...body2, id: id2, content }, id2, at2);
|
|
33605
|
+
}
|
|
33606
|
+
function minimaxHistory(path, files) {
|
|
33607
|
+
const manifestPath = join23(dirname9(path), "manifest.json");
|
|
33608
|
+
const manifest = object3(files.has(manifestPath) ? json3(files.get(manifestPath)) : void 0);
|
|
33609
|
+
const nativeID = text(manifest.sessionId) || minimaxFolderID(path);
|
|
33610
|
+
if (!nativeID) throw new Error("MiniMax session has no native identity.");
|
|
33611
|
+
const snapshots = [...files.keys()].filter((f) => dirname9(f) === join23(dirname9(path), "snapshots"));
|
|
33612
|
+
const omitted = snapshotFiles2(path).length > snapshots.length;
|
|
33613
|
+
const byID = /* @__PURE__ */ new Map(), rows2 = [];
|
|
33614
|
+
let partial = false;
|
|
33615
|
+
for (const file of [...snapshots, path]) {
|
|
33616
|
+
const parsed = jsonLines(files.get(file));
|
|
33617
|
+
partial ||= parsed.partial;
|
|
33618
|
+
rows2.push(...parsed.rows);
|
|
33619
|
+
parsed.rows.forEach((r, i) => {
|
|
33620
|
+
const m = record(r, i);
|
|
33621
|
+
if (m && !byID.has(m.id)) byID.set(m.id, m);
|
|
33622
|
+
});
|
|
33623
|
+
}
|
|
33624
|
+
const meta = runtimeSession(path, nativeID);
|
|
33625
|
+
const last2 = [...rows2].reverse().map((r) => object3(r.message)).find((m) => m.role === "assistant" && text(m.model));
|
|
33626
|
+
return {
|
|
33627
|
+
nativeID,
|
|
33628
|
+
messages: [...byID.values()],
|
|
33629
|
+
partial: partial || omitted,
|
|
33630
|
+
parent: meta?.parent || void 0,
|
|
33631
|
+
session: { created: minimaxTime(manifest.createdAtMs), title: meta?.title, directory: meta?.directory, model: text(last2?.model) || "Unknown model", provider: text(last2?.provider) },
|
|
33632
|
+
note: omitted ? "The oldest compacted history exceeds the snapshot size limit and is summarized, not imported." : partial ? "Some transcript records could not be imported." : void 0
|
|
33633
|
+
};
|
|
33634
|
+
}
|
|
33635
|
+
|
|
33511
33636
|
// server/adapters/harness-files.ts
|
|
33512
33637
|
var piParse = (path, files) => piHistory(files.get(path));
|
|
33513
33638
|
var jsonl = (path) => path.endsWith(".jsonl");
|
|
33639
|
+
var claudeStyle = (path) => jsonl(path) && !path.endsWith(".checkpoints.jsonl") && !(path.includes("subagents/") && basename11(path) === "journal.jsonl");
|
|
33640
|
+
function claudeStyleHistory(path, files) {
|
|
33641
|
+
const history = envelopeHistory(path, files.get(path));
|
|
33642
|
+
const agent = /^agent-(.+)\.jsonl$/.exec(basename11(path))?.[1];
|
|
33643
|
+
if (!agent || basename11(dirname10(path)) !== "subagents") return history;
|
|
33644
|
+
const recorded = jsonLines(files.get(path)).rows.map((r) => text(r.agentId)).find(Boolean) || agent;
|
|
33645
|
+
history.parent = history.nativeID;
|
|
33646
|
+
history.nativeID = `${history.nativeID}/agent/${recorded}`;
|
|
33647
|
+
return history;
|
|
33648
|
+
}
|
|
33514
33649
|
var piSources = [
|
|
33515
33650
|
{ id: "prime-agent", name: "Prime Agent", roots: () => [process.env.PRIME_AGENT_SESSION_DIR || process.env.PRIME_AGENT_CODING_AGENT_SESSION_DIR || envHome("PRIME_AGENT_CODING_AGENT_DIR", ".prime/agent", "sessions"), envHome("PRIME_AGENT_CODING_AGENT_DIR", ".prime/agent", "session-artifacts")] },
|
|
33516
33651
|
{ id: "omp", name: "Oh My Pi", roots: () => [envHome("PI_CODING_AGENT_DIR_OMP", ".omp/agent", "sessions")] },
|
|
33517
|
-
{ id: "senpi", name: "Senpi / OmO Native", roots: () => [envHome("SENPI_CODING_AGENT_DIR", ".senpi/agent", "sessions"), homePath(".omo/agent/sessions")] },
|
|
33518
|
-
{ id: "kimchi", name: "Kimchi", roots: () => [
|
|
33519
|
-
{ id: "gajae", name: "Gajae-Code", roots: () => [
|
|
33652
|
+
{ id: "senpi", name: "Senpi / OmO Native", roots: () => [envHome("SENPI_CODING_AGENT_DIR", ".senpi/agent", "sessions"), homePath(".omo/agent/sessions"), ...omoChildRoots()] },
|
|
33653
|
+
{ id: "kimchi", name: "Kimchi", roots: () => [join24(process.env.KIMCHI_CODING_AGENT_DIR || configPath("kimchi/harness"), "sessions")] },
|
|
33654
|
+
{ id: "gajae", name: "Gajae-Code", roots: () => [join24(process.env.GJC_CODING_AGENT_DIR || (process.env.GJC_CONFIG_DIR || process.env.PI_CONFIG_DIR ? join24(process.env.GJC_CONFIG_DIR || process.env.PI_CONFIG_DIR, "agent") : homePath(".gjc/agent")), "sessions"), dataPath("gjc/sessions")] }
|
|
33520
33655
|
].map((s) => ({ ...s, parse: piParse }));
|
|
33656
|
+
var omoChildRoots = () => [[".omo/agent/projects", "senpi-task/children"], [".omo/memory/agents", "runtime/transcripts"]].flatMap(([parent2, child]) => {
|
|
33657
|
+
try {
|
|
33658
|
+
return readdirSync3(homePath(parent2), { withFileTypes: true }).filter((e10) => e10.isDirectory()).map((e10) => homePath(parent2, e10.name, child));
|
|
33659
|
+
} catch {
|
|
33660
|
+
return [];
|
|
33661
|
+
}
|
|
33662
|
+
});
|
|
33521
33663
|
var openclawRoots = () => [envHome("OPENCLAW_STATE_DIR", ".openclaw", "agents"), ...[".clawdbot", ".moltbot", ".moldbot"].map((p) => homePath(p, "agents"))];
|
|
33522
33664
|
var promaRoots = () => [".proma", ".proma-dev"].flatMap((p) => ["agent-sessions", "sdk-config/sessions", "sdk-config/projects"].map((s) => homePath(p, s)));
|
|
33523
33665
|
function kimiHistory(path, files) {
|
|
33524
33666
|
const { rows: rows2 } = jsonLines(files.get(path));
|
|
33525
|
-
const folder =
|
|
33526
|
-
const nativeID = agent ? `${
|
|
33527
|
-
const wire =
|
|
33667
|
+
const folder = dirname10(path), id2 = basename11(folder), agent = basename11(dirname10(folder)) === "agents";
|
|
33668
|
+
const nativeID = agent ? `${basename11(dirname10(dirname10(folder)))}/agent/${id2}` : id2;
|
|
33669
|
+
const wire = join24(folder, "wire.jsonl"), wireRows = files.has(wire) ? jsonLines(files.get(wire)).rows : [];
|
|
33528
33670
|
const messages = rows2.flatMap((r, i) => {
|
|
33529
33671
|
const m = message(r, nativeText(r.id) || `context:${i}`);
|
|
33530
33672
|
return m ? [m] : [];
|
|
@@ -33543,7 +33685,7 @@ function museHistory(path, files) {
|
|
|
33543
33685
|
const meta = rows2.find((r) => r.payload_type === "runtime.session.metadata");
|
|
33544
33686
|
const ids = new Set(rows2.map((r) => text(r.stream?.id)).filter(Boolean));
|
|
33545
33687
|
if (!meta || ids.size > 1) throw new Error("Unsupported Muse stream.");
|
|
33546
|
-
const nativeID = [...ids][0] ||
|
|
33688
|
+
const nativeID = [...ids][0] || basename11(dirname10(path));
|
|
33547
33689
|
const messages = rows2.flatMap((r, i) => {
|
|
33548
33690
|
const event = object3(r.payload?.event), body2 = object3(event.message);
|
|
33549
33691
|
const at2 = typeof r.recorded_at === "number" && r.recorded_at >= 1e15 ? r.recorded_at / 1e3 : typeof r.recorded_at === "number" && r.recorded_at < 1e12 ? seconds(r.recorded_at) : time(r.recorded_at);
|
|
@@ -33561,7 +33703,7 @@ function junieHistory(path, files) {
|
|
|
33561
33703
|
return [recordEvent(r, text(r.id) || `event:${i}`, kind, r.timestampMs, e10.text ?? e10.prompt ?? e10.message)];
|
|
33562
33704
|
});
|
|
33563
33705
|
if (!messages.length) throw new Error("No supported Junie events.");
|
|
33564
|
-
return { nativeID:
|
|
33706
|
+
return { nativeID: basename11(dirname10(path)), messages, partial: true, note: "Recorded events only." };
|
|
33565
33707
|
}
|
|
33566
33708
|
function augmentHistory(path, files) {
|
|
33567
33709
|
const r = object3(json3(files.get(path)));
|
|
@@ -33573,7 +33715,7 @@ function augmentHistory(path, files) {
|
|
|
33573
33715
|
return { nativeID: r.sessionId, messages, partial: true, session: { title: text(r.title), created: time(r.created), model: text(r.agentState?.modelId) || "Unknown model" }, note: "Recorded exchanges only." };
|
|
33574
33716
|
}
|
|
33575
33717
|
function fxHistory(path, files) {
|
|
33576
|
-
const usage = object3(json3(files.get(path))), meta = sidecar2(files,
|
|
33718
|
+
const usage = object3(json3(files.get(path))), meta = sidecar2(files, join24(dirname10(path), "session.json"));
|
|
33577
33719
|
const id2 = text(usage.session_id) || text(meta.id);
|
|
33578
33720
|
if (!id2 || !usage.snapshot || meta.id && meta.id !== id2) throw new Error("Unsupported Fx session metadata.");
|
|
33579
33721
|
const snapshot2 = object3(usage.snapshot);
|
|
@@ -33602,18 +33744,19 @@ function fxHistory(path, files) {
|
|
|
33602
33744
|
}
|
|
33603
33745
|
var definitions = [
|
|
33604
33746
|
...piSources,
|
|
33605
|
-
{ id: "kiro", name: "Kiro", roots: () => [homePath(".kiro/sessions"), appPath("Kiro/User/globalStorage/kiro.kiroagent")], match: (p) => p.endsWith("/session.json") || /^cli\/[^/]+\.json$/.test(p), extras: (p) => [
|
|
33606
|
-
{ id: "mux", name: "Mux", roots: () => [envHome("MUX_ROOT", ".mux", "sessions")], match: (p) => p.endsWith("/chat.jsonl"), extras: (p) => [
|
|
33747
|
+
{ id: "kiro", name: "Kiro", roots: () => [homePath(".kiro/sessions"), appPath("Kiro/User/globalStorage/kiro.kiroagent")], match: (p) => p.endsWith("/session.json") || /^cli\/[^/]+\.json$/.test(p), extras: (p) => [basename11(p) === "session.json" ? join24(dirname10(p), "messages.jsonl") : p.replace(/\.json$/, ".jsonl")], parse: kiroHistory },
|
|
33748
|
+
{ id: "mux", name: "Mux", roots: () => [envHome("MUX_ROOT", ".mux", "sessions")], match: (p) => p.endsWith("/chat.jsonl"), extras: (p) => [join24(dirname10(p), "chat-archive.jsonl"), join24(dirname10(p), "session-usage.json")], parse: muxHistory },
|
|
33607
33749
|
{ id: "devin-desktop", name: "Devin Desktop", roots: () => [appPath("Devin/User/acp-events")], match: (p) => /\.(ndjson|jsonl)$/.test(p), parse: devinDesktopHistory },
|
|
33608
33750
|
{ id: "openclaw", name: "OpenClaw", roots: openclawRoots, match: (p) => /(?:^|\/)sessions\/.*\.jsonl(?:\.[\w.-]+)?$/.test(p) || /session-sqlite-import-archive\/.*\.jsonl\./.test(p), parse: piParse },
|
|
33609
33751
|
{ id: "amp", name: "Amp", roots: () => [dataPath("amp/threads"), tokscalePath("amp-cache/threads")], match: (p) => p.endsWith(".json"), parse: ampHistory },
|
|
33610
33752
|
{ id: "droid", name: "Factory Droid", roots: () => [envHome("FACTORY_HOME", ".factory", "sessions")] },
|
|
33611
33753
|
{ id: "codebuff", name: "Codebuff", roots: () => process.env.CODEBUFF_DATA_DIR ? [process.env.CODEBUFF_DATA_DIR] : ["manicode", "manicode-dev", "manicode-staging"].map((p) => configPath(p)), match: (p) => p.endsWith("/chat-messages.json"), parse: (p, f) => codebuffHistory(p, f, false) },
|
|
33612
33754
|
{ id: "freebuff", name: "Freebuff", roots: () => process.env.FREEBUFF_DATA_DIR ? [process.env.FREEBUFF_DATA_DIR] : process.env.CODEBUFF_DATA_DIR ? [process.env.CODEBUFF_DATA_DIR] : ["manicode", "manicode-dev", "manicode-staging"].map((p) => configPath(p)), match: (p) => p.endsWith("/chat-messages.json"), parse: (p, f) => codebuffHistory(p, f, true) },
|
|
33613
|
-
{ id: "kimi", name: "Kimi CLI / Code", roots: () => [envHome("KIMI_HOME", ".kimi", "sessions"), envHome("KIMI_CODE_HOME", ".kimi-code", "sessions")], match: (p) => p.endsWith("/context.jsonl"), extras: (p) => [
|
|
33755
|
+
{ id: "kimi", name: "Kimi CLI / Code", roots: () => [envHome("KIMI_HOME", ".kimi", "sessions"), envHome("KIMI_CODE_HOME", ".kimi-code", "sessions")], match: (p) => p.endsWith("/context.jsonl"), extras: (p) => [join24(dirname10(p), "wire.jsonl")], parse: kimiHistory },
|
|
33614
33756
|
{ id: "grok", name: "Grok Build", roots: () => [envHome("GROK_HOME", ".grok", "sessions")], match: (p) => p.endsWith("/updates.jsonl"), parse: (p, f) => acpHistory(p, f.get(p)) },
|
|
33615
33757
|
{ id: "jcode", name: "Jcode", roots: () => [envHome("JCODE_HOME", ".jcode", "sessions")], match: (p) => /(?:^|\/)session_[^/]+\.json$/.test(p), extras: (p) => [p.replace(/\.json$/, ".journal.jsonl")], parse: jcodeHistory },
|
|
33616
33758
|
{ id: "cherry-studio", name: "Cherry Studio", roots: () => [appPath("CherryStudio/Data/Agents/.claude/projects"), appPath("CherryStudio/.claude/projects")] },
|
|
33759
|
+
{ id: "qoder", name: "Qoder", roots: () => [envHome("QODER_CONFIG_DIR", ".qoder", "projects"), envHome("QODERCN_CONFIG_DIR", ".qoder-cn", "projects")] },
|
|
33617
33760
|
{ id: "command-code", name: "Command Code", roots: () => [homePath(".commandcode/projects")] },
|
|
33618
33761
|
{ id: "zcode", name: "ZCode", roots: () => [homePath(".zcode/projects")] },
|
|
33619
33762
|
{ id: "codebuddy", name: "CodeBuddy", roots: () => [homePath(".codebuddy/projects")] },
|
|
@@ -33622,23 +33765,25 @@ var definitions = [
|
|
|
33622
33765
|
{ id: "deepseek-harness", name: "DeepSeek Harness", roots: () => [envHome("DSH_HOME", ".dsh", "sessions")], match: (p) => /(?:^|\/)session(?:\.v\d+)?\.jsonl(?:\.zstd)?$/.test(p), parse: (p, f) => dshHistory(f.get(p)) },
|
|
33623
33766
|
{ id: "aside", name: "Aside", roots: () => [homePath(".aside/u")], match: (p) => /^[^/]+\/sessions\/[^/]+\/messages\.jsonl$/.test(p), parse(p, f) {
|
|
33624
33767
|
const h3 = envelopeHistory(p, f.get(p));
|
|
33625
|
-
h3.nativeID = `${
|
|
33768
|
+
h3.nativeID = `${basename11(dirname10(dirname10(dirname10(p))))}/${basename11(dirname10(p))}`;
|
|
33626
33769
|
return h3;
|
|
33627
33770
|
} },
|
|
33628
|
-
{ id: "vibe", name: "Mistral Vibe", roots: () => [envHome("VIBE_HOME", ".vibe", "logs/session")], match: (p) => p.endsWith("/meta.json") || /^[^/]+\.json$/.test(p), extras: (p) =>
|
|
33771
|
+
{ id: "vibe", name: "Mistral Vibe", roots: () => [envHome("VIBE_HOME", ".vibe", "logs/session")], match: (p) => p.endsWith("/meta.json") || /^[^/]+\.json$/.test(p), extras: (p) => basename11(p) === "meta.json" ? [join24(dirname10(p), "messages.jsonl")] : [], parse: vibeHistory },
|
|
33629
33772
|
{ id: "muse", name: "Muse Code", roots: () => [dataPath("muse/sessions")], match: (p) => p.endsWith("/session.jsonl"), parse: museHistory },
|
|
33630
33773
|
{ id: "junie", name: "Junie", roots: () => [homePath(".junie/sessions")], match: (p) => p.endsWith("/events.jsonl"), parse: junieHistory, description: "Local agent event history \xB7 partial conversation coverage" },
|
|
33631
33774
|
{ id: "augment", name: "Augment Code", roots: () => [homePath(".augment/sessions")], match: (p) => p.endsWith(".json"), parse: augmentHistory, description: "Local exchange records \xB7 partial conversation coverage" },
|
|
33632
|
-
{ id: "fx", name: "Fx", roots: () => [homePath(".fx/sessions")], match: (p) => p.endsWith("/usage-v2.json"), extras: (p) => [
|
|
33633
|
-
{
|
|
33634
|
-
|
|
33635
|
-
|
|
33636
|
-
|
|
33637
|
-
|
|
33638
|
-
|
|
33639
|
-
|
|
33640
|
-
|
|
33641
|
-
|
|
33775
|
+
{ id: "fx", name: "Fx", roots: () => [homePath(".fx/sessions")], match: (p) => p.endsWith("/usage-v2.json"), extras: (p) => [join24(dirname10(p), "session.json")], parse: fxHistory, history: false, description: "Session metadata only" },
|
|
33776
|
+
{
|
|
33777
|
+
id: "minimax-code",
|
|
33778
|
+
name: "MiniMax Code",
|
|
33779
|
+
description: "Local runtime transcripts (CLI and desktop)",
|
|
33780
|
+
roots: minimaxRoots,
|
|
33781
|
+
children: true,
|
|
33782
|
+
// Session folders hold other JSONL logs (ledger, display, snapshots); only messages.jsonl is the transcript.
|
|
33783
|
+
match: minimaxNative,
|
|
33784
|
+
extras: minimaxExtras,
|
|
33785
|
+
parse: minimaxHistory
|
|
33786
|
+
},
|
|
33642
33787
|
{ id: "opencodereview", name: "OpenCodeReview", roots: () => [homePath(".opencodereview/sessions")], parse(p, f) {
|
|
33643
33788
|
const { rows: rows2 } = jsonLines(f.get(p)), header = rows2.find((r) => r.type === "session_start");
|
|
33644
33789
|
if (!header) throw new Error("Unsupported review session.");
|
|
@@ -33648,15 +33793,15 @@ var definitions = [
|
|
|
33648
33793
|
var fileHarnessAdapters = definitions.map((source) => localFileAdapter({
|
|
33649
33794
|
...source,
|
|
33650
33795
|
roots: harnessRoots(source.id, source.roots),
|
|
33651
|
-
match: source.match ||
|
|
33796
|
+
match: source.match || claudeStyle,
|
|
33652
33797
|
description: source.description || "Local session transcripts",
|
|
33653
|
-
capabilities: { history: source.history !== false, forks: false, children:
|
|
33654
|
-
parse: source.parse ||
|
|
33798
|
+
capabilities: { history: source.history !== false, forks: false, children: source.children === true || !source.parse, files: false },
|
|
33799
|
+
parse: source.parse || claudeStyleHistory
|
|
33655
33800
|
}));
|
|
33656
33801
|
|
|
33657
33802
|
// server/adapters/harness-databases.ts
|
|
33658
33803
|
import { lstat as lstat9, readFile as readFile4 } from "node:fs/promises";
|
|
33659
|
-
import { isAbsolute as isAbsolute5, join as
|
|
33804
|
+
import { isAbsolute as isAbsolute5, join as join25 } from "node:path";
|
|
33660
33805
|
function hermesContent(value) {
|
|
33661
33806
|
if (typeof value !== "string" || !value.startsWith("\0json:")) return value;
|
|
33662
33807
|
try {
|
|
@@ -33736,7 +33881,7 @@ var hermes = {
|
|
|
33736
33881
|
var goose = {
|
|
33737
33882
|
id: "goose",
|
|
33738
33883
|
name: "Goose",
|
|
33739
|
-
paths: dbPaths("goose", () => process.env.GOOSE_PATH_ROOT && isAbsolute5(process.env.GOOSE_PATH_ROOT) ? [
|
|
33884
|
+
paths: dbPaths("goose", () => process.env.GOOSE_PATH_ROOT && isAbsolute5(process.env.GOOSE_PATH_ROOT) ? [join25(process.env.GOOSE_PATH_ROOT, "data/sessions/sessions.db")] : [dataPath("goose/sessions/sessions.db"), dataPath("Block/goose/sessions/sessions.db"), appPath("goose/sessions/sessions.db"), appPath("Block/goose/sessions/sessions.db"), appPath("Block/goose/data/sessions/sessions.db")], (p) => p.endsWith("sessions.db")),
|
|
33740
33885
|
table: "sessions",
|
|
33741
33886
|
key: "id",
|
|
33742
33887
|
fields: [
|
|
@@ -33830,7 +33975,7 @@ function forkStore(id2, name, defaultPath, desktop) {
|
|
|
33830
33975
|
var zed = {
|
|
33831
33976
|
id: "zed",
|
|
33832
33977
|
name: "Zed Agent",
|
|
33833
|
-
paths: dbPaths("zed", () => [process.platform === "darwin" ? appPath("Zed/threads/threads.db") : process.platform === "win32" ?
|
|
33978
|
+
paths: dbPaths("zed", () => [process.platform === "darwin" ? appPath("Zed/threads/threads.db") : process.platform === "win32" ? join25(process.env.LOCALAPPDATA || homePath("AppData/Local"), "Zed/threads/threads.db") : dataPath("zed/threads/threads.db")], (p) => p.endsWith("threads.db")),
|
|
33834
33979
|
table: "threads",
|
|
33835
33980
|
key: "id",
|
|
33836
33981
|
fields: ["id", "summary", "created_at", "updated_at", "data_type", "data", "folder_paths"],
|
|
@@ -33879,7 +34024,7 @@ var crush = {
|
|
|
33879
34024
|
paths: async () => {
|
|
33880
34025
|
const override = sourcePath("crush") || process.env.SESSIONGRAPH_CRUSH_HISTORY_DIR;
|
|
33881
34026
|
if (override) return (await historyFiles([override], (p) => p.endsWith("crush.db"))).files;
|
|
33882
|
-
const registry =
|
|
34027
|
+
const registry = join25(process.env.CRUSH_GLOBAL_DATA || dataPath("crush"), "projects.json");
|
|
33883
34028
|
try {
|
|
33884
34029
|
const stat6 = await lstat9(registry);
|
|
33885
34030
|
if (!stat6.isFile() || stat6.size > 2e6) throw new Error("Unsupported Crush registry.");
|
|
@@ -33887,7 +34032,7 @@ var crush = {
|
|
|
33887
34032
|
const paths2 = [];
|
|
33888
34033
|
for (const p of Array.isArray(raw.projects) ? raw.projects.slice(0, 2e4) : []) {
|
|
33889
34034
|
if (!isAbsolute5(text(p.path)) || !text(p.data_dir)) continue;
|
|
33890
|
-
const path =
|
|
34035
|
+
const path = join25(isAbsolute5(p.data_dir) ? p.data_dir : join25(p.path, p.data_dir), "crush.db");
|
|
33891
34036
|
paths2.push(path);
|
|
33892
34037
|
crushDirectories.set(path, p.path);
|
|
33893
34038
|
}
|
|
@@ -34005,7 +34150,7 @@ var databaseHarnessAdapters = [
|
|
|
34005
34150
|
].map(sqliteHistoryAdapter);
|
|
34006
34151
|
|
|
34007
34152
|
// server/adapters/harness-metadata.ts
|
|
34008
|
-
import { basename as
|
|
34153
|
+
import { basename as basename12 } from "node:path";
|
|
34009
34154
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
34010
34155
|
function protoFields(value) {
|
|
34011
34156
|
if (value.length > 2e6) throw new Error("Trajectory metadata exceeds 2 MB.");
|
|
@@ -34061,28 +34206,12 @@ var antigravityDatabaseAdapters = ["antigravity-cli", "antigravity-extension"].m
|
|
|
34061
34206
|
}
|
|
34062
34207
|
}
|
|
34063
34208
|
if (!created) throw new Error("Trajectory creation time is unavailable.");
|
|
34064
|
-
return { nativeID:
|
|
34209
|
+
return { nativeID: basename12(path, ".db"), messages: [], partial: true, session: { created, directory: directory3 }, note: "Session metadata only." };
|
|
34065
34210
|
}
|
|
34066
34211
|
}));
|
|
34067
|
-
var antigravityCacheAdapter = localFileAdapter({
|
|
34068
|
-
id: "antigravity",
|
|
34069
|
-
name: "Antigravity",
|
|
34070
|
-
description: "Cached session metadata only",
|
|
34071
|
-
capabilities: { history: false, forks: false, children: false, files: false },
|
|
34072
|
-
roots: harnessRoots("antigravity", () => [tokscalePath("antigravity-cache/sessions")]),
|
|
34073
|
-
match: (p) => p.endsWith(".jsonl"),
|
|
34074
|
-
parse(path, files) {
|
|
34075
|
-
const { rows: rows2 } = jsonLines(files.get(path));
|
|
34076
|
-
const ids = new Set(rows2.map((r) => text(r.sessionId)).filter(Boolean));
|
|
34077
|
-
if (ids.size !== 1) throw new Error("Unsupported Antigravity cache identity.");
|
|
34078
|
-
const created = rows2.map((r) => time(r.timestamp)).filter(Boolean).sort((a, b) => a - b)[0];
|
|
34079
|
-
if (!created) throw new Error("Antigravity cache has no recorded date.");
|
|
34080
|
-
return { nativeID: [...ids][0], messages: [], partial: true, session: { created, model: text(rows2.find((r) => r.modelId)?.modelId) || "Unknown model" }, note: "Session metadata only. Date based on first recorded usage." };
|
|
34081
|
-
}
|
|
34082
|
-
});
|
|
34083
34212
|
|
|
34084
34213
|
// server/adapters/index.ts
|
|
34085
|
-
var extra = [...databaseHarnessAdapters, ...fileHarnessAdapters,
|
|
34214
|
+
var extra = [...databaseHarnessAdapters, ...fileHarnessAdapters, ...antigravityDatabaseAdapters];
|
|
34086
34215
|
var grouped = /* @__PURE__ */ new Map();
|
|
34087
34216
|
for (const adapter of extra) grouped.set(adapter.id, [...grouped.get(adapter.id) || [], adapter]);
|
|
34088
34217
|
var adapters = [opencodeAdapter, claudeAdapter, codexAdapter, t3CodeAdapter, cursorAdapter, geminiAdapter, qwenAdapter, piAdapter, copilotAdapter, copilotChatAdapter, clineAdapter, rooAdapter, kiloAdapter, continueAdapter, ...[...grouped.values()].map((parts) => parts.length === 1 ? parts[0] : combineAdapters(parts))];
|
|
@@ -34090,7 +34219,7 @@ var adapters = [opencodeAdapter, claudeAdapter, codexAdapter, t3CodeAdapter, cur
|
|
|
34090
34219
|
// server/store.ts
|
|
34091
34220
|
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
34092
34221
|
import { mkdirSync as mkdirSync2, chmodSync as chmodSync3 } from "node:fs";
|
|
34093
|
-
import { dirname as
|
|
34222
|
+
import { dirname as dirname11 } from "node:path";
|
|
34094
34223
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
34095
34224
|
|
|
34096
34225
|
// src/search/persistence.ts
|
|
@@ -34651,11 +34780,11 @@ var SessionGraphStore = class {
|
|
|
34651
34780
|
this.path = path;
|
|
34652
34781
|
let db2;
|
|
34653
34782
|
try {
|
|
34654
|
-
if (path !== ":memory:") mkdirSync2(
|
|
34783
|
+
if (path !== ":memory:") mkdirSync2(dirname11(path), { recursive: true, mode: 448 });
|
|
34655
34784
|
this.db = db2 = new DatabaseSync3(path);
|
|
34656
34785
|
this.db.exec("PRAGMA busy_timeout=5000;");
|
|
34657
34786
|
const version = Number(this.db.prepare("PRAGMA user_version").get().user_version);
|
|
34658
|
-
if (version >
|
|
34787
|
+
if (version > 9) throw new LibraryError("LIBRARY_VERSION", "This library requires a newer version of SessionGraph.");
|
|
34659
34788
|
if (path !== ":memory:") chmodSync3(path, 384);
|
|
34660
34789
|
this.db.exec("PRAGMA journal_mode=WAL; PRAGMA foreign_keys=ON;");
|
|
34661
34790
|
this.initialize(version);
|
|
@@ -34732,15 +34861,7 @@ var SessionGraphStore = class {
|
|
|
34732
34861
|
if (version < 6) {
|
|
34733
34862
|
this.db.exec("BEGIN IMMEDIATE");
|
|
34734
34863
|
try {
|
|
34735
|
-
|
|
34736
|
-
const selected = this.setting("selected");
|
|
34737
|
-
if (selected) this.setting("selected", selected.filter((id2) => !retired.has(id2)));
|
|
34738
|
-
const paths2 = this.setting("sourcePaths");
|
|
34739
|
-
if (paths2) this.setting("sourcePaths", Object.fromEntries(Object.entries(paths2).filter(([id2]) => !retired.has(id2))));
|
|
34740
|
-
const view = this.setting("viewState");
|
|
34741
|
-
if (view && typeof view.sourceID === "string" && retired.has(view.sourceID)) this.setting("viewState", { ...view, sourceID: "" });
|
|
34742
|
-
const remove2 = this.db.prepare("DELETE FROM sources WHERE id=?");
|
|
34743
|
-
for (const id2 of retired) remove2.run(id2);
|
|
34864
|
+
this.retireSources(["reasonix", "trae", "warp", "lm-studio", "hindsight"]);
|
|
34744
34865
|
this.db.exec("PRAGMA user_version=6; COMMIT");
|
|
34745
34866
|
} catch (error) {
|
|
34746
34867
|
this.db.exec("ROLLBACK");
|
|
@@ -34770,8 +34891,30 @@ var SessionGraphStore = class {
|
|
|
34770
34891
|
throw error;
|
|
34771
34892
|
}
|
|
34772
34893
|
}
|
|
34894
|
+
if (version < 9) {
|
|
34895
|
+
this.db.exec("BEGIN IMMEDIATE");
|
|
34896
|
+
try {
|
|
34897
|
+
this.retireSources(["antigravity", "minimax-code"]);
|
|
34898
|
+
this.db.exec("PRAGMA user_version=9; COMMIT");
|
|
34899
|
+
} catch (error) {
|
|
34900
|
+
this.db.exec("ROLLBACK");
|
|
34901
|
+
throw error;
|
|
34902
|
+
}
|
|
34903
|
+
}
|
|
34773
34904
|
if (!this.setting("libraryID")) this.setting("libraryID", randomUUID2());
|
|
34774
34905
|
}
|
|
34906
|
+
/** Drops selections, custom paths, status records and active filters for removed sources. */
|
|
34907
|
+
retireSources(ids) {
|
|
34908
|
+
const retired = new Set(ids);
|
|
34909
|
+
const selected = this.setting("selected");
|
|
34910
|
+
if (selected) this.setting("selected", selected.filter((id2) => !retired.has(id2)));
|
|
34911
|
+
const paths2 = this.setting("sourcePaths");
|
|
34912
|
+
if (paths2) this.setting("sourcePaths", Object.fromEntries(Object.entries(paths2).filter(([id2]) => !retired.has(id2))));
|
|
34913
|
+
const view = this.setting("viewState");
|
|
34914
|
+
if (view && typeof view.sourceID === "string" && retired.has(view.sourceID)) this.setting("viewState", { ...view, sourceID: "" });
|
|
34915
|
+
const remove2 = this.db.prepare("DELETE FROM sources WHERE id=?");
|
|
34916
|
+
for (const id2 of retired) remove2.run(id2);
|
|
34917
|
+
}
|
|
34775
34918
|
setting(key, value) {
|
|
34776
34919
|
if (value !== void 0) this.db.prepare("INSERT INTO settings VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value").run(key, JSON.stringify(value));
|
|
34777
34920
|
const row = this.db.prepare("SELECT value FROM settings WHERE key=?").get(key);
|
|
@@ -35102,33 +35245,33 @@ var SessionGraphStore = class {
|
|
|
35102
35245
|
const rows2 = this.db.prepare("SELECT id,data FROM search_cache WHERE id>? ORDER BY id LIMIT 51").all(after);
|
|
35103
35246
|
const records = [];
|
|
35104
35247
|
for (const row of rows2.slice(0, 50)) {
|
|
35105
|
-
const
|
|
35106
|
-
if (validRecord(
|
|
35248
|
+
const record2 = JSON.parse(String(row.data));
|
|
35249
|
+
if (validRecord(record2, this.getSession(String(row.id)))) records.push(record2);
|
|
35107
35250
|
else this.db.prepare("DELETE FROM search_cache WHERE id=?").run(row.id);
|
|
35108
35251
|
}
|
|
35109
35252
|
return { records, cursor: rows2.length > 50 ? String(rows2[49].id) : void 0, epoch: this.setting("indexEpoch") || 0 };
|
|
35110
35253
|
}
|
|
35111
|
-
saveCheckpoint(
|
|
35254
|
+
saveCheckpoint(record2, epoch) {
|
|
35112
35255
|
this.db.exec("BEGIN IMMEDIATE");
|
|
35113
35256
|
try {
|
|
35114
|
-
if (epoch !== (this.setting("indexEpoch") || 0) || !validRecord(
|
|
35257
|
+
if (epoch !== (this.setting("indexEpoch") || 0) || !validRecord(record2, this.getSession(record2.id))) {
|
|
35115
35258
|
this.db.exec("ROLLBACK");
|
|
35116
35259
|
return false;
|
|
35117
35260
|
}
|
|
35118
|
-
const total = Number(this.db.prepare("SELECT COALESCE(SUM(characters),0) AS n FROM search_cache WHERE id<>?").get(
|
|
35119
|
-
if (total +
|
|
35261
|
+
const total = Number(this.db.prepare("SELECT COALESCE(SUM(characters),0) AS n FROM search_cache WHERE id<>?").get(record2.id).n);
|
|
35262
|
+
if (total + record2.characters > MAX_CHARACTERS) {
|
|
35120
35263
|
this.db.exec("ROLLBACK");
|
|
35121
35264
|
return false;
|
|
35122
35265
|
}
|
|
35123
|
-
const previous = this.db.prepare("SELECT data FROM search_cache WHERE id=?").get(
|
|
35266
|
+
const previous = this.db.prepare("SELECT data FROM search_cache WHERE id=?").get(record2.id);
|
|
35124
35267
|
if (previous) {
|
|
35125
35268
|
const old = JSON.parse(String(previous.data));
|
|
35126
|
-
if (old.version ===
|
|
35269
|
+
if (old.version === record2.version && old.pages > record2.pages) {
|
|
35127
35270
|
this.db.exec("ROLLBACK");
|
|
35128
35271
|
return false;
|
|
35129
35272
|
}
|
|
35130
35273
|
}
|
|
35131
|
-
this.db.prepare("INSERT INTO search_cache (id,data,characters) VALUES (?,?,?) ON CONFLICT(id) DO UPDATE SET data=excluded.data,characters=excluded.characters").run(
|
|
35274
|
+
this.db.prepare("INSERT INTO search_cache (id,data,characters) VALUES (?,?,?) ON CONFLICT(id) DO UPDATE SET data=excluded.data,characters=excluded.characters").run(record2.id, JSON.stringify(record2), record2.characters);
|
|
35132
35275
|
this.db.exec("COMMIT");
|
|
35133
35276
|
return true;
|
|
35134
35277
|
} catch (error) {
|
|
@@ -35311,7 +35454,7 @@ var Importer = class {
|
|
|
35311
35454
|
import { execFile, spawn as spawn2 } from "node:child_process";
|
|
35312
35455
|
import { promisify } from "node:util";
|
|
35313
35456
|
import { stat as stat4 } from "node:fs/promises";
|
|
35314
|
-
import { basename as
|
|
35457
|
+
import { basename as basename13, dirname as dirname12, isAbsolute as isAbsolute8 } from "node:path";
|
|
35315
35458
|
|
|
35316
35459
|
// src/launch-links.ts
|
|
35317
35460
|
var HARNESSES = [
|
|
@@ -35347,13 +35490,13 @@ function resumeArgs(value) {
|
|
|
35347
35490
|
import { access, stat as stat3 } from "node:fs/promises";
|
|
35348
35491
|
import { constants as constants6 } from "node:fs";
|
|
35349
35492
|
import { homedir as homedir15 } from "node:os";
|
|
35350
|
-
import { delimiter, isAbsolute as isAbsolute7, join as
|
|
35493
|
+
import { delimiter, isAbsolute as isAbsolute7, join as join26 } from "node:path";
|
|
35351
35494
|
async function executable(name) {
|
|
35352
35495
|
const home = homedir15();
|
|
35353
|
-
const directories = [...(process.env.PATH || "").split(delimiter),
|
|
35354
|
-
if (process.platform === "win32" && process.env.APPDATA) directories.push(
|
|
35355
|
-
if (process.platform === "win32" && process.env.SystemRoot) directories.push(
|
|
35356
|
-
const candidates = isAbsolute7(name) ? [name] : directories.filter((dir) => isAbsolute7(dir)).flatMap((dir) => (process.platform === "win32" ? [".exe", ".cmd", ".bat", ""] : [""]).map((extension) =>
|
|
35496
|
+
const directories = [...(process.env.PATH || "").split(delimiter), join26(home, ".local", "bin"), join26(home, ".opencode", "bin"), join26(home, ".bun", "bin"), join26(home, "Library", "pnpm"), "/opt/homebrew/bin", "/usr/local/bin"];
|
|
35497
|
+
if (process.platform === "win32" && process.env.APPDATA) directories.push(join26(process.env.APPDATA, "npm"));
|
|
35498
|
+
if (process.platform === "win32" && process.env.SystemRoot) directories.push(join26(process.env.SystemRoot, "System32", "WindowsPowerShell", "v1.0"));
|
|
35499
|
+
const candidates = isAbsolute7(name) ? [name] : directories.filter((dir) => isAbsolute7(dir)).flatMap((dir) => (process.platform === "win32" ? [".exe", ".cmd", ".bat", ""] : [""]).map((extension) => join26(dir, name + extension)));
|
|
35357
35500
|
for (const path of candidates) {
|
|
35358
35501
|
try {
|
|
35359
35502
|
if ((await stat3(path)).isFile()) {
|
|
@@ -35369,7 +35512,7 @@ async function harnessExecutable(target) {
|
|
|
35369
35512
|
const path = await executable(name);
|
|
35370
35513
|
if (path) return path;
|
|
35371
35514
|
if (target === "codex" && process.platform === "darwin") {
|
|
35372
|
-
return await executable("/Applications/Codex.app/Contents/Resources/codex") || await executable(
|
|
35515
|
+
return await executable("/Applications/Codex.app/Contents/Resources/codex") || await executable(join26(homedir15(), "Applications/Codex.app/Contents/Resources/codex"));
|
|
35373
35516
|
}
|
|
35374
35517
|
}
|
|
35375
35518
|
async function terminalExecutable() {
|
|
@@ -35395,7 +35538,7 @@ function launchCommand(binary, args, directory3, platform = process.platform) {
|
|
|
35395
35538
|
import { createHash as createHash4, randomUUID as randomUUID3 } from "node:crypto";
|
|
35396
35539
|
import { mkdir, writeFile as writeFile2, rename as rename2, rm as rm4 } from "node:fs/promises";
|
|
35397
35540
|
import { renameSync as renameSync2 } from "node:fs";
|
|
35398
|
-
import { join as
|
|
35541
|
+
import { join as join27 } from "node:path";
|
|
35399
35542
|
function handoffDocument(snapshot2) {
|
|
35400
35543
|
const { session, messages, firstUser, totalMessages } = snapshot2;
|
|
35401
35544
|
if (!messages.length) invalid("Import the conversation before continuing.");
|
|
@@ -35462,9 +35605,9 @@ async function saveHandoff(snapshot2, directory3, store) {
|
|
|
35462
35605
|
const epoch = store?.setting("indexEpoch") || 0;
|
|
35463
35606
|
const { text: text2, ...coverage2 } = handoffDocument(snapshot2);
|
|
35464
35607
|
const digest2 = createHash4("sha256").update(text2).digest("hex");
|
|
35465
|
-
const root2 =
|
|
35608
|
+
const root2 = join27(directory3, "handoffs");
|
|
35466
35609
|
await mkdir(root2, { recursive: true, mode: 448 });
|
|
35467
|
-
const path =
|
|
35610
|
+
const path = join27(root2, `${digest2}.md`), temporary = join27(root2, `.${randomUUID3()}.tmp`);
|
|
35468
35611
|
try {
|
|
35469
35612
|
await writeFile2(temporary, text2, { mode: 384, flag: "wx" });
|
|
35470
35613
|
if (store) {
|
|
@@ -35521,7 +35664,7 @@ async function prepareLaunch(store, session, target, directory3 = session.direct
|
|
|
35521
35664
|
}
|
|
35522
35665
|
const mode = args ? "resume" : "handoff";
|
|
35523
35666
|
if (mode === "handoff" && store.path === ":memory:") invalid("Save this library before creating a context handoff.");
|
|
35524
|
-
const context2 = mode === "handoff" ? await saveHandoff(store.handoff(session.id),
|
|
35667
|
+
const context2 = mode === "handoff" ? await saveHandoff(store.handoff(session.id), dirname12(store.path), store).catch((error) => {
|
|
35525
35668
|
throw storageFailure(error, true) ?? new LibraryError("HANDOFF_FAILED", "Could not save the session handoff.");
|
|
35526
35669
|
}) : void 0;
|
|
35527
35670
|
if (context2) {
|
|
@@ -35540,7 +35683,7 @@ function commandInvocation(command, terminal, platform = process.platform) {
|
|
|
35540
35683
|
const encoded = Buffer.from(command, "utf16le").toString("base64");
|
|
35541
35684
|
return { file: terminal, args: ["-NoProfile", "-NonInteractive", "-Command", `Start-Process powershell.exe -ArgumentList '-NoExit','-NoProfile','-EncodedCommand','${encoded}'`] };
|
|
35542
35685
|
}
|
|
35543
|
-
return { file: terminal, args: [
|
|
35686
|
+
return { file: terminal, args: [basename13(terminal) === "gnome-terminal" ? "--" : "-e", "sh", "-lc", command] };
|
|
35544
35687
|
}
|
|
35545
35688
|
async function launchTerminal(session, prepared) {
|
|
35546
35689
|
if (!prepared.terminalAvailable) invalid("Copy the command and run it in your terminal.");
|
|
@@ -35571,7 +35714,7 @@ async function launchTerminal(session, prepared) {
|
|
|
35571
35714
|
// server/publishing.ts
|
|
35572
35715
|
import { createHash as createHash5, randomBytes } from "node:crypto";
|
|
35573
35716
|
import { chmod, mkdir as mkdir2, readFile as readFile5, rename as rename3, rm as rm5, writeFile as writeFile3 } from "node:fs/promises";
|
|
35574
|
-
import { dirname as
|
|
35717
|
+
import { dirname as dirname13, join as join28 } from "node:path";
|
|
35575
35718
|
|
|
35576
35719
|
// packages/core/src/sources.ts
|
|
35577
35720
|
var sources = {
|
|
@@ -35617,6 +35760,7 @@ var sources = {
|
|
|
35617
35760
|
augment: { name: "Augment Code", icon: "augment" },
|
|
35618
35761
|
fx: { name: "Fx", icon: "fx" },
|
|
35619
35762
|
"minimax-code": { name: "MiniMax Code", icon: "minimax" },
|
|
35763
|
+
qoder: { name: "Qoder", icon: "generic" },
|
|
35620
35764
|
opencodereview: { name: "OpenCodeReview", icon: "opencode" },
|
|
35621
35765
|
goose: { name: "Goose", icon: "goose" },
|
|
35622
35766
|
zed: { name: "Zed Agent", icon: "zed" },
|
|
@@ -35848,7 +35992,7 @@ function preparePublicGraph(store, ids, inputSettings) {
|
|
|
35848
35992
|
}
|
|
35849
35993
|
}
|
|
35850
35994
|
var PublishingClient = class {
|
|
35851
|
-
constructor(credentialPath =
|
|
35995
|
+
constructor(credentialPath = join28(dirname13(databasePath()), "account.json"), fetcher = fetch) {
|
|
35852
35996
|
this.credentialPath = credentialPath;
|
|
35853
35997
|
this.fetcher = fetcher;
|
|
35854
35998
|
}
|
|
@@ -35877,7 +36021,7 @@ var PublishingClient = class {
|
|
|
35877
36021
|
}
|
|
35878
36022
|
}
|
|
35879
36023
|
async save(value) {
|
|
35880
|
-
await mkdir2(
|
|
36024
|
+
await mkdir2(dirname13(this.credentialPath), { recursive: true, mode: 448 });
|
|
35881
36025
|
const temporary = `${this.credentialPath}.${randomBytes(8).toString("hex")}`;
|
|
35882
36026
|
try {
|
|
35883
36027
|
await writeFile3(temporary, JSON.stringify(value), { mode: 384, flag: "wx" });
|
|
@@ -35972,7 +36116,7 @@ var PublishingClient = class {
|
|
|
35972
36116
|
// server/git-checkouts.ts
|
|
35973
36117
|
import { execFile as execFile2 } from "node:child_process";
|
|
35974
36118
|
import { createHash as createHash6 } from "node:crypto";
|
|
35975
|
-
import { basename as
|
|
36119
|
+
import { basename as basename14, isAbsolute as isAbsolute9 } from "node:path";
|
|
35976
36120
|
import { promisify as promisify2 } from "node:util";
|
|
35977
36121
|
var exec2 = promisify2(execFile2);
|
|
35978
36122
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -36013,7 +36157,7 @@ async function inspect(directory3) {
|
|
|
36013
36157
|
return {
|
|
36014
36158
|
worktree,
|
|
36015
36159
|
repository: createHash6("sha256").update(key).digest("hex"),
|
|
36016
|
-
repositoryLabel: remote?.label || (
|
|
36160
|
+
repositoryLabel: remote?.label || (basename14(common) === ".git" ? basename14(common.slice(0, -5)) : basename14(common))
|
|
36017
36161
|
};
|
|
36018
36162
|
} catch {
|
|
36019
36163
|
return;
|
|
@@ -36041,7 +36185,7 @@ async function annotateGitCheckouts(sessions) {
|
|
|
36041
36185
|
}
|
|
36042
36186
|
|
|
36043
36187
|
// server/library-service.ts
|
|
36044
|
-
import { basename as
|
|
36188
|
+
import { basename as basename16, dirname as dirname14, isAbsolute as isAbsolute10 } from "node:path";
|
|
36045
36189
|
|
|
36046
36190
|
// node_modules/.pnpm/minisearch@7.2.0/node_modules/minisearch/dist/es/index.js
|
|
36047
36191
|
var ENTRIES = "ENTRIES";
|
|
@@ -38030,13 +38174,13 @@ function sampleContent(page2, budget2) {
|
|
|
38030
38174
|
|
|
38031
38175
|
// server/purge-handoffs.ts
|
|
38032
38176
|
import { closeSync as closeSync2, constants as constants7, fstatSync, lstatSync as lstatSync4, openSync as openSync2, opendirSync, readSync as readSync2, unlinkSync as unlinkSync2 } from "node:fs";
|
|
38033
|
-
import { basename as
|
|
38177
|
+
import { basename as basename15, join as join29 } from "node:path";
|
|
38034
38178
|
var MAX_ENTRIES = 2e4;
|
|
38035
38179
|
var HEADER_BYTES = 64 * 1024;
|
|
38036
38180
|
var generatedName = /^(?:[a-f0-9]{64}\.md|\.[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\.tmp)$/;
|
|
38037
38181
|
var missing = (error) => error.code === "ENOENT";
|
|
38038
38182
|
function findPurgeHandoffs(directory3, sources2, all = false) {
|
|
38039
|
-
const root2 =
|
|
38183
|
+
const root2 = join29(directory3, "handoffs"), paths2 = [], warnings = [], foundSources = /* @__PURE__ */ new Set();
|
|
38040
38184
|
try {
|
|
38041
38185
|
if (!lstatSync4(root2).isDirectory()) return { paths: paths2, sources: [], warnings: ["Handoff cleanup skipped: handoffs is not a regular directory."] };
|
|
38042
38186
|
const entries2 = opendirSync(root2);
|
|
@@ -38052,7 +38196,7 @@ function findPurgeHandoffs(directory3, sources2, all = false) {
|
|
|
38052
38196
|
warnings.push(`Handoff cleanup skipped non-regular file ${entry.name}.`);
|
|
38053
38197
|
continue;
|
|
38054
38198
|
}
|
|
38055
|
-
const path =
|
|
38199
|
+
const path = join29(root2, entry.name);
|
|
38056
38200
|
let fd2;
|
|
38057
38201
|
try {
|
|
38058
38202
|
fd2 = openSync2(path, constants7.O_RDONLY | (constants7.O_NOFOLLOW || 0) | (constants7.O_NONBLOCK || 0));
|
|
@@ -38089,7 +38233,7 @@ function removePurgeHandoffs(paths2) {
|
|
|
38089
38233
|
unlinkSync2(path);
|
|
38090
38234
|
removed++;
|
|
38091
38235
|
} catch (error) {
|
|
38092
|
-
if (!missing(error)) warnings.push(`Could not delete handoff ${
|
|
38236
|
+
if (!missing(error)) warnings.push(`Could not delete handoff ${basename15(path)}. Check permissions and retry purge.`);
|
|
38093
38237
|
}
|
|
38094
38238
|
}
|
|
38095
38239
|
return { removed, warnings };
|
|
@@ -38207,7 +38351,7 @@ var LibraryService = class {
|
|
|
38207
38351
|
this.store.db.exec("BEGIN IMMEDIATE");
|
|
38208
38352
|
let result;
|
|
38209
38353
|
try {
|
|
38210
|
-
const handoffs = this.store.path === ":memory:" ? { paths: [], sources: [], warnings: [] } : findPurgeHandoffs(
|
|
38354
|
+
const handoffs = this.store.path === ":memory:" ? { paths: [], sources: [], warnings: [] } : findPurgeHandoffs(dirname14(this.store.path), ids, options.all);
|
|
38211
38355
|
const known = [.../* @__PURE__ */ new Set([...this.importer.adapters.map((adapter) => adapter.id), ...this.store.savedSources(), ...handoffs.sources])];
|
|
38212
38356
|
for (const id2 of ids) if (!known.includes(id2)) invalid(`Unknown source "${id2}". Run sessiongraph sources list.`);
|
|
38213
38357
|
const sources2 = [...new Set(options.all ? known : ids)];
|
|
@@ -38254,7 +38398,7 @@ var LibraryService = class {
|
|
|
38254
38398
|
title: s.title,
|
|
38255
38399
|
source: s.source,
|
|
38256
38400
|
projectID: s.projectID,
|
|
38257
|
-
projectLabel: names.get(s.projectID) ||
|
|
38401
|
+
projectLabel: names.get(s.projectID) || basename16(s.directory) || "Unknown project",
|
|
38258
38402
|
created: utc(s.created),
|
|
38259
38403
|
lastActivity: utc(sessionEnd(s)),
|
|
38260
38404
|
relationship: relationshipOf(s),
|
|
@@ -38311,8 +38455,8 @@ var LibraryService = class {
|
|
|
38311
38455
|
if (plan2.error) invalid(plan2.error);
|
|
38312
38456
|
return this.snapshot(() => {
|
|
38313
38457
|
const { sessions, projects } = this.sessions(filters2);
|
|
38314
|
-
const
|
|
38315
|
-
const indexKey = fingerprint2([filters2,
|
|
38458
|
+
const generation3 = [this.store.db.prepare("PRAGMA data_version").get(), this.store.db.prepare("SELECT total_changes() AS n").get()];
|
|
38459
|
+
const indexKey = fingerprint2([filters2, generation3]);
|
|
38316
38460
|
if (this.searchCache?.key !== indexKey) {
|
|
38317
38461
|
this.searchCache = void 0;
|
|
38318
38462
|
const index2 = new SessionSearchIndex();
|
|
@@ -38381,7 +38525,7 @@ var LibraryService = class {
|
|
|
38381
38525
|
}
|
|
38382
38526
|
const groups = [...grouped2].sort(([a], [b]) => a.localeCompare(b)).map(([key, values]) => ({
|
|
38383
38527
|
key,
|
|
38384
|
-
label: groupBy === "project" ? names.get(key) ||
|
|
38528
|
+
label: groupBy === "project" ? names.get(key) || basename16(values[0].directory) || "Unknown project" : groupBy === "repository" ? values[0].checkout?.repositoryLabel || "Unverified repository" : key,
|
|
38385
38529
|
...groupBy === "repository" ? { worktrees: [...new Set(values.flatMap((s) => s.checkout?.worktree || []))].sort() } : {},
|
|
38386
38530
|
...groupBy === "relationship" ? { origins: values.reduce((counts, s) => {
|
|
38387
38531
|
counts[s.origin ?? "unknown"]++;
|
|
@@ -38429,24 +38573,24 @@ var LibraryService = class {
|
|
|
38429
38573
|
|
|
38430
38574
|
// server/middleware.ts
|
|
38431
38575
|
var publishingClient;
|
|
38432
|
-
var
|
|
38433
|
-
var
|
|
38576
|
+
var generation2 = /* @__PURE__ */ Symbol("sessiongraph-backend");
|
|
38577
|
+
var runtime2 = globalThis;
|
|
38434
38578
|
function library() {
|
|
38435
|
-
if (
|
|
38436
|
-
for (const live of
|
|
38579
|
+
if (runtime2.sessionGraphRuntime?.importer.status.running && runtime2.sessionGraphRuntime.generation !== generation2) {
|
|
38580
|
+
for (const live of runtime2.sessionGraphRuntime.importer.adapters) {
|
|
38437
38581
|
const updated = adapters.find((adapter) => adapter.id === live.id);
|
|
38438
|
-
if (updated) Object.assign(live, withSourcePaths(updated, () =>
|
|
38582
|
+
if (updated) Object.assign(live, withSourcePaths(updated, () => runtime2.sessionGraphRuntime.store.setting("sourcePaths") || {}));
|
|
38439
38583
|
}
|
|
38440
38584
|
}
|
|
38441
|
-
if (
|
|
38442
|
-
|
|
38443
|
-
|
|
38585
|
+
if (runtime2.sessionGraphRuntime && runtime2.sessionGraphRuntime.generation !== generation2 && !runtime2.sessionGraphRuntime.importer.status.running) {
|
|
38586
|
+
runtime2.sessionGraphRuntime.store.close();
|
|
38587
|
+
runtime2.sessionGraphRuntime = void 0;
|
|
38444
38588
|
}
|
|
38445
|
-
if (!
|
|
38589
|
+
if (!runtime2.sessionGraphRuntime) {
|
|
38446
38590
|
const store = new SessionGraphStore();
|
|
38447
|
-
|
|
38591
|
+
runtime2.sessionGraphRuntime = { store, importer: new Importer(store, adapters), generation: generation2 };
|
|
38448
38592
|
}
|
|
38449
|
-
return
|
|
38593
|
+
return runtime2.sessionGraphRuntime;
|
|
38450
38594
|
}
|
|
38451
38595
|
async function body(req) {
|
|
38452
38596
|
let size = 0;
|