adhdev 0.8.97 → 0.8.99
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/dist/cli/index.js +265 -47
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +248 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/session-host-daemon/index.js +4 -4
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +13 -6
- package/vendor/session-host-daemon/index.mjs.map +1 -1
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/defaults.d.mts +6 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/defaults.d.ts +6 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/defaults.js +49 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/defaults.js.map +1 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/defaults.mjs +21 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/defaults.mjs.map +1 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.d.mts +1 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.d.ts +1 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.js +25 -2
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.js.map +1 -1
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.mjs +21 -2
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.mjs.map +1 -1
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/defaults.d.mts +6 -0
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/defaults.d.ts +6 -0
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/defaults.js +49 -0
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/defaults.js.map +1 -0
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/defaults.mjs +21 -0
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/defaults.mjs.map +1 -0
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.d.mts +1 -0
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.d.ts +1 -0
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.js +25 -2
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.js.map +1 -1
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.mjs +21 -2
- package/vendor/terminal-mux-cli/node_modules/@adhdev/session-host-core/index.mjs.map +1 -1
package/dist/index.js
CHANGED
|
@@ -739,6 +739,9 @@ function normalizeProviderSessionId(providerType, providerSessionId) {
|
|
|
739
739
|
if (normalizedProviderType === "hermes-cli" && !HERMES_SESSION_ID_RE.test(normalizedId)) {
|
|
740
740
|
return "";
|
|
741
741
|
}
|
|
742
|
+
if (normalizedProviderType === "claude-cli" && !CLAUDE_SESSION_ID_RE.test(normalizedId)) {
|
|
743
|
+
return "";
|
|
744
|
+
}
|
|
742
745
|
return normalizedId;
|
|
743
746
|
}
|
|
744
747
|
function isLegacyVolatileSessionReadKey(key) {
|
|
@@ -746,11 +749,12 @@ function isLegacyVolatileSessionReadKey(key) {
|
|
|
746
749
|
if (!normalizedKey) return false;
|
|
747
750
|
return normalizedKey.startsWith("provider:codex:vscode-webview://");
|
|
748
751
|
}
|
|
749
|
-
var HERMES_SESSION_ID_RE;
|
|
752
|
+
var HERMES_SESSION_ID_RE, CLAUDE_SESSION_ID_RE;
|
|
750
753
|
var init_provider_session_id = __esm({
|
|
751
754
|
"../../oss/packages/daemon-core/src/providers/provider-session-id.ts"() {
|
|
752
755
|
"use strict";
|
|
753
756
|
HERMES_SESSION_ID_RE = /^\d{8}_\d{6}_[a-z0-9]+$/i;
|
|
757
|
+
CLAUDE_SESSION_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
754
758
|
}
|
|
755
759
|
});
|
|
756
760
|
|
|
@@ -4157,9 +4161,16 @@ function extractCanonicalHermesMessageTimestamp(message, fallbackTs) {
|
|
|
4157
4161
|
if (Number.isFinite(stringTimestamp) && stringTimestamp > 0) return stringTimestamp;
|
|
4158
4162
|
return fallbackTs;
|
|
4159
4163
|
}
|
|
4160
|
-
function
|
|
4164
|
+
function extractTimestampValue(value) {
|
|
4165
|
+
const numericTimestamp = Number(value || 0);
|
|
4166
|
+
if (Number.isFinite(numericTimestamp) && numericTimestamp > 0) return numericTimestamp;
|
|
4167
|
+
const stringTimestamp = typeof value === "string" ? Date.parse(value) : NaN;
|
|
4168
|
+
if (Number.isFinite(stringTimestamp) && stringTimestamp > 0) return stringTimestamp;
|
|
4169
|
+
return 0;
|
|
4170
|
+
}
|
|
4171
|
+
function readExistingSessionStartRecord(agentType, historySessionId) {
|
|
4161
4172
|
try {
|
|
4162
|
-
const dir = path7.join(HISTORY_DIR,
|
|
4173
|
+
const dir = path7.join(HISTORY_DIR, agentType);
|
|
4163
4174
|
if (!fs3.existsSync(dir)) return null;
|
|
4164
4175
|
const files = listHistoryFiles(dir, historySessionId).sort();
|
|
4165
4176
|
for (const file2 of files) {
|
|
@@ -4180,6 +4191,28 @@ function readExistingHermesSessionStartRecord(historySessionId) {
|
|
|
4180
4191
|
return null;
|
|
4181
4192
|
}
|
|
4182
4193
|
}
|
|
4194
|
+
function rewriteCanonicalSavedHistory(agentType, historySessionId, records) {
|
|
4195
|
+
if (records.length === 0) return false;
|
|
4196
|
+
try {
|
|
4197
|
+
const dir = path7.join(HISTORY_DIR, agentType);
|
|
4198
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
4199
|
+
const prefix = `${historySessionId.replace(/[^a-zA-Z0-9_-]/g, "_")}_`;
|
|
4200
|
+
for (const file2 of fs3.readdirSync(dir)) {
|
|
4201
|
+
if (file2.startsWith(prefix) && file2.endsWith(".jsonl")) {
|
|
4202
|
+
fs3.unlinkSync(path7.join(dir, file2));
|
|
4203
|
+
}
|
|
4204
|
+
}
|
|
4205
|
+
const targetDate = new Date(records[records.length - 1].receivedAt || Date.now()).toISOString().slice(0, 10);
|
|
4206
|
+
const filePath = path7.join(dir, `${prefix}${targetDate}.jsonl`);
|
|
4207
|
+
fs3.writeFileSync(filePath, `${records.map((record2) => JSON.stringify(record2)).join("\n")}
|
|
4208
|
+
`, "utf-8");
|
|
4209
|
+
invalidatePersistedSavedHistoryIndex(agentType, dir);
|
|
4210
|
+
savedHistorySessionCache.delete(agentType.replace(/[^a-zA-Z0-9_-]/g, "_"));
|
|
4211
|
+
return true;
|
|
4212
|
+
} catch {
|
|
4213
|
+
return false;
|
|
4214
|
+
}
|
|
4215
|
+
}
|
|
4183
4216
|
function rebuildHermesSavedHistoryFromCanonicalSession(historySessionId) {
|
|
4184
4217
|
const normalizedSessionId = normalizeSavedHistorySessionId("hermes-cli", historySessionId);
|
|
4185
4218
|
if (!normalizedSessionId) return false;
|
|
@@ -4190,7 +4223,7 @@ function rebuildHermesSavedHistoryFromCanonicalSession(historySessionId) {
|
|
|
4190
4223
|
const canonicalMessages = Array.isArray(raw.messages) ? raw.messages : [];
|
|
4191
4224
|
const dir = path7.join(HISTORY_DIR, "hermes-cli");
|
|
4192
4225
|
fs3.mkdirSync(dir, { recursive: true });
|
|
4193
|
-
const existingSessionStart =
|
|
4226
|
+
const existingSessionStart = readExistingSessionStartRecord("hermes-cli", normalizedSessionId);
|
|
4194
4227
|
const records = [];
|
|
4195
4228
|
if (existingSessionStart) {
|
|
4196
4229
|
records.push({
|
|
@@ -4242,20 +4275,167 @@ function rebuildHermesSavedHistoryFromCanonicalSession(historySessionId) {
|
|
|
4242
4275
|
});
|
|
4243
4276
|
}
|
|
4244
4277
|
}
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4278
|
+
return rewriteCanonicalSavedHistory("hermes-cli", normalizedSessionId, records);
|
|
4279
|
+
} catch {
|
|
4280
|
+
return false;
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
function resolveClaudeProjectTranscriptPath(historySessionId, workspace) {
|
|
4284
|
+
const claudeProjectsDir = path7.join(os5.homedir(), ".claude", "projects");
|
|
4285
|
+
if (!fs3.existsSync(claudeProjectsDir)) return null;
|
|
4286
|
+
const normalizedWorkspace = typeof workspace === "string" ? workspace.trim() : "";
|
|
4287
|
+
if (normalizedWorkspace) {
|
|
4288
|
+
const directPath = path7.join(claudeProjectsDir, normalizedWorkspace.replace(/[\\/]/g, "-"), `${historySessionId}.jsonl`);
|
|
4289
|
+
if (fs3.existsSync(directPath)) return directPath;
|
|
4290
|
+
}
|
|
4291
|
+
const stack = [claudeProjectsDir];
|
|
4292
|
+
while (stack.length > 0) {
|
|
4293
|
+
const current = stack.pop();
|
|
4294
|
+
if (!current) continue;
|
|
4295
|
+
for (const entry of fs3.readdirSync(current, { withFileTypes: true })) {
|
|
4296
|
+
const entryPath = path7.join(current, entry.name);
|
|
4297
|
+
if (entry.isDirectory()) {
|
|
4298
|
+
stack.push(entryPath);
|
|
4299
|
+
continue;
|
|
4300
|
+
}
|
|
4301
|
+
if (entry.isFile() && entry.name === `${historySessionId}.jsonl`) {
|
|
4302
|
+
return entryPath;
|
|
4250
4303
|
}
|
|
4251
4304
|
}
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
return
|
|
4305
|
+
}
|
|
4306
|
+
return null;
|
|
4307
|
+
}
|
|
4308
|
+
function extractClaudeAssistantContentParts(content) {
|
|
4309
|
+
if (typeof content === "string") {
|
|
4310
|
+
const trimmed = content.trim();
|
|
4311
|
+
return trimmed ? [{ content: trimmed, kind: "standard", role: "assistant" }] : [];
|
|
4312
|
+
}
|
|
4313
|
+
if (!Array.isArray(content)) return [];
|
|
4314
|
+
const parts = [];
|
|
4315
|
+
for (const block of content) {
|
|
4316
|
+
if (!block || typeof block !== "object") continue;
|
|
4317
|
+
const record2 = block;
|
|
4318
|
+
const type = String(record2.type || "").trim();
|
|
4319
|
+
if (type === "text") {
|
|
4320
|
+
const text = String(record2.text || "").trim();
|
|
4321
|
+
if (text) parts.push({ content: text, kind: "standard", role: "assistant" });
|
|
4322
|
+
continue;
|
|
4323
|
+
}
|
|
4324
|
+
if (type === "tool_use") {
|
|
4325
|
+
const name = String(record2.name || "").trim() || "Tool";
|
|
4326
|
+
const input = record2.input && typeof record2.input === "object" ? record2.input : null;
|
|
4327
|
+
const command = input ? String(input.command || "").trim() : "";
|
|
4328
|
+
const summary = command ? `${name}: ${command}` : name;
|
|
4329
|
+
if (summary) parts.push({ content: summary, kind: "tool", senderName: "Tool", role: "assistant" });
|
|
4330
|
+
}
|
|
4331
|
+
}
|
|
4332
|
+
return parts;
|
|
4333
|
+
}
|
|
4334
|
+
function extractClaudeUserContentParts(content) {
|
|
4335
|
+
if (typeof content === "string") {
|
|
4336
|
+
const trimmed = content.trim();
|
|
4337
|
+
return trimmed ? [{ role: "user", content: trimmed, kind: "standard" }] : [];
|
|
4338
|
+
}
|
|
4339
|
+
if (!Array.isArray(content)) return [];
|
|
4340
|
+
const parts = [];
|
|
4341
|
+
for (const block of content) {
|
|
4342
|
+
if (!block || typeof block !== "object") continue;
|
|
4343
|
+
const record2 = block;
|
|
4344
|
+
const type = String(record2.type || "").trim();
|
|
4345
|
+
if (type === "text") {
|
|
4346
|
+
const text = String(record2.text || "").trim();
|
|
4347
|
+
if (text) parts.push({ role: "user", content: text, kind: "standard" });
|
|
4348
|
+
continue;
|
|
4349
|
+
}
|
|
4350
|
+
if (type === "tool_result") {
|
|
4351
|
+
const rawContent = record2.content;
|
|
4352
|
+
const text = typeof rawContent === "string" ? rawContent.trim() : Array.isArray(rawContent) ? rawContent.map((entry) => {
|
|
4353
|
+
if (typeof entry === "string") return entry.trim();
|
|
4354
|
+
if (!entry || typeof entry !== "object") return "";
|
|
4355
|
+
const nested = entry;
|
|
4356
|
+
if (typeof nested.text === "string") return nested.text.trim();
|
|
4357
|
+
if (typeof nested.content === "string") return nested.content.trim();
|
|
4358
|
+
return "";
|
|
4359
|
+
}).filter(Boolean).join("\n") : "";
|
|
4360
|
+
if (text) parts.push({ role: "assistant", content: text, kind: "tool", senderName: "Tool" });
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
return parts;
|
|
4364
|
+
}
|
|
4365
|
+
function rebuildClaudeSavedHistoryFromNativeProject(historySessionId, workspace) {
|
|
4366
|
+
const normalizedSessionId = normalizeSavedHistorySessionId("claude-cli", historySessionId);
|
|
4367
|
+
if (!normalizedSessionId) return false;
|
|
4368
|
+
try {
|
|
4369
|
+
const transcriptPath = resolveClaudeProjectTranscriptPath(normalizedSessionId, workspace);
|
|
4370
|
+
if (!transcriptPath) return false;
|
|
4371
|
+
const lines = fs3.readFileSync(transcriptPath, "utf-8").split("\n").filter(Boolean);
|
|
4372
|
+
const records = [];
|
|
4373
|
+
const existingSessionStart = readExistingSessionStartRecord("claude-cli", normalizedSessionId);
|
|
4374
|
+
if (existingSessionStart) {
|
|
4375
|
+
records.push({
|
|
4376
|
+
...existingSessionStart,
|
|
4377
|
+
historySessionId: normalizedSessionId
|
|
4378
|
+
});
|
|
4379
|
+
}
|
|
4380
|
+
let fallbackTs = Date.now();
|
|
4381
|
+
for (const line of lines) {
|
|
4382
|
+
let parsed = null;
|
|
4383
|
+
try {
|
|
4384
|
+
parsed = JSON.parse(line);
|
|
4385
|
+
} catch {
|
|
4386
|
+
parsed = null;
|
|
4387
|
+
}
|
|
4388
|
+
if (!parsed) continue;
|
|
4389
|
+
const parsedSessionId = String(parsed.sessionId || "").trim();
|
|
4390
|
+
if (parsedSessionId && parsedSessionId !== normalizedSessionId) continue;
|
|
4391
|
+
const receivedAt = extractTimestampValue(parsed.timestamp) || fallbackTs;
|
|
4392
|
+
fallbackTs = receivedAt + 1;
|
|
4393
|
+
const parsedWorkspace = String(parsed.cwd || workspace || "").trim();
|
|
4394
|
+
if (records.length === 0 && parsedWorkspace) {
|
|
4395
|
+
records.push({
|
|
4396
|
+
ts: new Date(receivedAt).toISOString(),
|
|
4397
|
+
receivedAt,
|
|
4398
|
+
role: "system",
|
|
4399
|
+
kind: "session_start",
|
|
4400
|
+
content: parsedWorkspace,
|
|
4401
|
+
agent: "claude-cli",
|
|
4402
|
+
historySessionId: normalizedSessionId,
|
|
4403
|
+
workspace: parsedWorkspace
|
|
4404
|
+
});
|
|
4405
|
+
}
|
|
4406
|
+
const type = String(parsed.type || "").trim();
|
|
4407
|
+
const message = parsed.message && typeof parsed.message === "object" ? parsed.message : null;
|
|
4408
|
+
if (type === "user" && message) {
|
|
4409
|
+
for (const part of extractClaudeUserContentParts(message.content)) {
|
|
4410
|
+
records.push({
|
|
4411
|
+
ts: new Date(receivedAt).toISOString(),
|
|
4412
|
+
receivedAt,
|
|
4413
|
+
role: part.role,
|
|
4414
|
+
content: part.content,
|
|
4415
|
+
kind: part.kind,
|
|
4416
|
+
senderName: part.senderName,
|
|
4417
|
+
agent: "claude-cli",
|
|
4418
|
+
historySessionId: normalizedSessionId
|
|
4419
|
+
});
|
|
4420
|
+
}
|
|
4421
|
+
continue;
|
|
4422
|
+
}
|
|
4423
|
+
if (type === "assistant" && message) {
|
|
4424
|
+
for (const part of extractClaudeAssistantContentParts(message.content)) {
|
|
4425
|
+
records.push({
|
|
4426
|
+
ts: new Date(receivedAt).toISOString(),
|
|
4427
|
+
receivedAt,
|
|
4428
|
+
role: "assistant",
|
|
4429
|
+
content: part.content,
|
|
4430
|
+
kind: part.kind,
|
|
4431
|
+
senderName: part.senderName,
|
|
4432
|
+
agent: "claude-cli",
|
|
4433
|
+
historySessionId: normalizedSessionId
|
|
4434
|
+
});
|
|
4435
|
+
}
|
|
4436
|
+
}
|
|
4437
|
+
}
|
|
4438
|
+
return rewriteCanonicalSavedHistory("claude-cli", normalizedSessionId, records);
|
|
4259
4439
|
} catch {
|
|
4260
4440
|
return false;
|
|
4261
4441
|
}
|
|
@@ -10615,7 +10795,7 @@ function ensureNodePtySpawnHelperPermissions(logFn) {
|
|
|
10615
10795
|
} catch {
|
|
10616
10796
|
}
|
|
10617
10797
|
}
|
|
10618
|
-
var os8, path22, net, import_crypto3, os22, path32, __require, SessionHostClient;
|
|
10798
|
+
var os8, path22, net, import_crypto3, os22, path32, __require, DEFAULT_SESSION_HOST_COLS, DEFAULT_SESSION_HOST_ROWS, SessionHostClient;
|
|
10619
10799
|
var init_dist = __esm({
|
|
10620
10800
|
"../../oss/packages/session-host-core/dist/index.mjs"() {
|
|
10621
10801
|
"use strict";
|
|
@@ -10631,6 +10811,8 @@ var init_dist = __esm({
|
|
|
10631
10811
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
10632
10812
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
10633
10813
|
});
|
|
10814
|
+
DEFAULT_SESSION_HOST_COLS = 80;
|
|
10815
|
+
DEFAULT_SESSION_HOST_ROWS = 48;
|
|
10634
10816
|
SessionHostClient = class {
|
|
10635
10817
|
endpoint;
|
|
10636
10818
|
socket = null;
|
|
@@ -11253,8 +11435,8 @@ function resolveCliSpawnPlan(options) {
|
|
|
11253
11435
|
isWin,
|
|
11254
11436
|
useShell,
|
|
11255
11437
|
ptyOptions: {
|
|
11256
|
-
cols:
|
|
11257
|
-
rows:
|
|
11438
|
+
cols: DEFAULT_SESSION_HOST_COLS,
|
|
11439
|
+
rows: DEFAULT_SESSION_HOST_ROWS,
|
|
11258
11440
|
cwd: workingDir,
|
|
11259
11441
|
env: buildCliSpawnEnv(process.env, spawnConfig.env)
|
|
11260
11442
|
}
|
|
@@ -11311,6 +11493,7 @@ var init_provider_cli_runtime = __esm({
|
|
|
11311
11493
|
"use strict";
|
|
11312
11494
|
os11 = __toESM(require("os"));
|
|
11313
11495
|
path10 = __toESM(require("path"));
|
|
11496
|
+
init_dist();
|
|
11314
11497
|
init_provider_cli_shared();
|
|
11315
11498
|
}
|
|
11316
11499
|
});
|
|
@@ -13698,7 +13881,7 @@ var init_cli_provider_instance = __esm({
|
|
|
13698
13881
|
parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
|
|
13699
13882
|
}
|
|
13700
13883
|
const mergedMessages = this.mergeConversationMessages(parsedMessages);
|
|
13701
|
-
const
|
|
13884
|
+
const canonicalBackedHistory = this.syncCanonicalSavedHistoryIfNeeded();
|
|
13702
13885
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
13703
13886
|
if (parsedMessages.length > 0) {
|
|
13704
13887
|
const shouldSkipReplayPersist = this.suppressIdleHistoryReplay && adapterStatus.status === "idle" && parsedStatus?.status === "idle";
|
|
@@ -13716,7 +13899,7 @@ var init_cli_provider_instance = __esm({
|
|
|
13716
13899
|
senderName: typeof message.senderName === "string" ? message.senderName : void 0,
|
|
13717
13900
|
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
13718
13901
|
}));
|
|
13719
|
-
if (!
|
|
13902
|
+
if (!canonicalBackedHistory && !shouldSkipReplayPersist && normalizedMessagesToSave.length > 0) {
|
|
13720
13903
|
const incrementalMessages = buildIncrementalHistoryAppendMessages(this.lastPersistedHistoryMessages, normalizedMessagesToSave);
|
|
13721
13904
|
this.historyWriter.appendNewMessages(
|
|
13722
13905
|
this.type,
|
|
@@ -13726,7 +13909,7 @@ var init_cli_provider_instance = __esm({
|
|
|
13726
13909
|
this.providerSessionId
|
|
13727
13910
|
);
|
|
13728
13911
|
}
|
|
13729
|
-
if (!
|
|
13912
|
+
if (!canonicalBackedHistory) {
|
|
13730
13913
|
this.lastPersistedHistoryMessages = normalizedMessagesToSave;
|
|
13731
13914
|
}
|
|
13732
13915
|
}
|
|
@@ -14203,32 +14386,52 @@ ${effect.notification.body || ""}`.trim();
|
|
|
14203
14386
|
});
|
|
14204
14387
|
LOG.info("CLI", `[${this.type}] discovered provider session id: ${nextSessionId}`);
|
|
14205
14388
|
}
|
|
14206
|
-
|
|
14207
|
-
if (
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
|
|
14220
|
-
|
|
14221
|
-
|
|
14222
|
-
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14389
|
+
syncCanonicalSavedHistoryIfNeeded() {
|
|
14390
|
+
if (!this.providerSessionId) return false;
|
|
14391
|
+
if (this.type === "hermes-cli") {
|
|
14392
|
+
try {
|
|
14393
|
+
const canonicalPath = path11.join(os13.homedir(), ".hermes", "sessions", `session_${this.providerSessionId}.json`);
|
|
14394
|
+
if (!fs5.existsSync(canonicalPath)) return false;
|
|
14395
|
+
const stat4 = fs5.statSync(canonicalPath);
|
|
14396
|
+
if (stat4.mtimeMs <= this.lastCanonicalHermesSyncMtimeMs) return true;
|
|
14397
|
+
const rebuilt = rebuildHermesSavedHistoryFromCanonicalSession(this.providerSessionId);
|
|
14398
|
+
if (!rebuilt) return false;
|
|
14399
|
+
this.lastCanonicalHermesSyncMtimeMs = stat4.mtimeMs;
|
|
14400
|
+
const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId);
|
|
14401
|
+
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
14402
|
+
role: message.role,
|
|
14403
|
+
content: message.content,
|
|
14404
|
+
kind: message.kind,
|
|
14405
|
+
senderName: message.senderName,
|
|
14406
|
+
receivedAt: message.receivedAt
|
|
14407
|
+
}));
|
|
14408
|
+
return true;
|
|
14409
|
+
} catch {
|
|
14410
|
+
return false;
|
|
14411
|
+
}
|
|
14227
14412
|
}
|
|
14413
|
+
if (this.type === "claude-cli") {
|
|
14414
|
+
try {
|
|
14415
|
+
const rebuilt = rebuildClaudeSavedHistoryFromNativeProject(this.providerSessionId, this.workingDir);
|
|
14416
|
+
if (!rebuilt) return false;
|
|
14417
|
+
const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId);
|
|
14418
|
+
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
14419
|
+
role: message.role,
|
|
14420
|
+
content: message.content,
|
|
14421
|
+
kind: message.kind,
|
|
14422
|
+
senderName: message.senderName,
|
|
14423
|
+
receivedAt: message.receivedAt
|
|
14424
|
+
}));
|
|
14425
|
+
return true;
|
|
14426
|
+
} catch {
|
|
14427
|
+
return false;
|
|
14428
|
+
}
|
|
14429
|
+
}
|
|
14430
|
+
return false;
|
|
14228
14431
|
}
|
|
14229
14432
|
restorePersistedHistoryFromCurrentSession() {
|
|
14230
14433
|
if (!this.providerSessionId) return;
|
|
14231
|
-
this.
|
|
14434
|
+
this.syncCanonicalSavedHistoryIfNeeded();
|
|
14232
14435
|
this.historyWriter.compactHistorySession(this.type, this.providerSessionId);
|
|
14233
14436
|
const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId);
|
|
14234
14437
|
this.historyWriter.seedSessionHistory(
|
|
@@ -55127,7 +55330,7 @@ var init_adhdev_daemon = __esm({
|
|
|
55127
55330
|
init_version();
|
|
55128
55331
|
init_src();
|
|
55129
55332
|
init_runtime_defaults();
|
|
55130
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
55333
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.99" });
|
|
55131
55334
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
55132
55335
|
localHttpServer = null;
|
|
55133
55336
|
localWss = null;
|