adhdev 0.8.82 → 0.8.84
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 +125 -34
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +125 -34
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/vendor/session-host-daemon/index.js +13 -1
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +14 -3
- package/vendor/session-host-daemon/index.mjs.map +1 -1
package/dist/index.js
CHANGED
|
@@ -1236,9 +1236,15 @@ function classifyHotChatSessionsForSubscriptionFlush(sessions, previousHotSessio
|
|
|
1236
1236
|
continue;
|
|
1237
1237
|
}
|
|
1238
1238
|
const status = String(session?.status || "").toLowerCase();
|
|
1239
|
+
const unread = session?.unread === true;
|
|
1240
|
+
const inboxBucket = String(session?.inboxBucket || "").toLowerCase();
|
|
1241
|
+
const runtimeSurfaceKind = String(session?.runtimeSurfaceKind || "").toLowerCase();
|
|
1242
|
+
const runtimeLifecycle = String(session?.runtimeLifecycle || "").toLowerCase();
|
|
1243
|
+
const isLiveRuntime = runtimeSurfaceKind === "live_runtime" || LIVE_RUNTIME_LIFECYCLES.has(runtimeLifecycle);
|
|
1239
1244
|
const lastMessageAt = parseMessageTimestamp(session?.lastMessageAt);
|
|
1240
1245
|
const recentlyUpdated = lastMessageAt > 0 && now - lastMessageAt <= recentMessageGraceMs;
|
|
1241
|
-
|
|
1246
|
+
const shouldKeepRecentTailHot = recentlyUpdated && (unread || inboxBucket === "task_complete" || inboxBucket === "needs_attention" || isLiveRuntime || activeStatuses.has(status));
|
|
1247
|
+
if (activeStatuses.has(status) || shouldKeepRecentTailHot) {
|
|
1242
1248
|
active.add(sessionId);
|
|
1243
1249
|
}
|
|
1244
1250
|
}
|
|
@@ -10291,10 +10297,12 @@ function logTerminalBackendSelection(preference, ghosttyAvailable, backendKind)
|
|
|
10291
10297
|
if (loggedTerminalBackends.has(key)) return;
|
|
10292
10298
|
loggedTerminalBackends.add(key);
|
|
10293
10299
|
if (backendKind === "xterm" && preference !== "xterm" && !ghosttyAvailable) {
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10300
|
+
const message = `[terminal-screen] ghostty-vt unavailable; using xterm fallback (preference=${preference})`;
|
|
10301
|
+
if (preference === "auto") {
|
|
10302
|
+
LOG.info("Terminal", message);
|
|
10303
|
+
} else {
|
|
10304
|
+
LOG.warn("Terminal", message);
|
|
10305
|
+
}
|
|
10298
10306
|
return;
|
|
10299
10307
|
}
|
|
10300
10308
|
LOG.info(
|
|
@@ -11147,6 +11155,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
11147
11155
|
"use strict";
|
|
11148
11156
|
os12 = __toESM(require("os"));
|
|
11149
11157
|
init_logger();
|
|
11158
|
+
init_debug_config();
|
|
11150
11159
|
init_terminal_screen();
|
|
11151
11160
|
init_pty_transport();
|
|
11152
11161
|
init_provider_cli_shared();
|
|
@@ -11180,7 +11189,15 @@ var init_provider_cli_adapter = __esm({
|
|
|
11180
11189
|
`[${this.cliType}] Provider resolution: providerDir=${this.providerResolutionMeta.providerDir || "-"} scriptDir=${this.providerResolutionMeta.scriptDir || "-"} scriptsPath=${this.providerResolutionMeta.scriptsPath || "-"} source=${this.providerResolutionMeta.scriptsSource || "-"} version=${this.providerResolutionMeta.resolvedVersion || "-"}`
|
|
11181
11190
|
);
|
|
11182
11191
|
} else {
|
|
11183
|
-
|
|
11192
|
+
const resolutionSummary = `providerDir=${this.providerResolutionMeta.providerDir || "-"} scriptDir=${this.providerResolutionMeta.scriptDir || "-"} scriptsPath=${this.providerResolutionMeta.scriptsPath || "-"} source=${this.providerResolutionMeta.scriptsSource || "-"} version=${this.providerResolutionMeta.resolvedVersion || "-"}`;
|
|
11193
|
+
const hasResolvedProviderScripts = Boolean(
|
|
11194
|
+
this.providerResolutionMeta.providerDir || this.providerResolutionMeta.scriptDir || this.providerResolutionMeta.scriptsPath || this.providerResolutionMeta.scriptsSource || this.providerResolutionMeta.resolvedVersion
|
|
11195
|
+
);
|
|
11196
|
+
if (hasResolvedProviderScripts) {
|
|
11197
|
+
LOG.warn("CLI", `[${this.cliType}] \u26A0 No CLI scripts loaded! Provider needs scripts/{version}/scripts.js (${resolutionSummary})`);
|
|
11198
|
+
} else {
|
|
11199
|
+
LOG.info("CLI", `[${this.cliType}] CLI scripts not yet resolved (${resolutionSummary})`);
|
|
11200
|
+
}
|
|
11184
11201
|
}
|
|
11185
11202
|
}
|
|
11186
11203
|
cliType;
|
|
@@ -11259,7 +11276,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
11259
11276
|
currentTurnScope = null;
|
|
11260
11277
|
traceEntries = [];
|
|
11261
11278
|
traceSeq = 0;
|
|
11262
|
-
traceSessionId =
|
|
11279
|
+
traceSessionId = "";
|
|
11280
|
+
parsedStatusCache = null;
|
|
11263
11281
|
static MAX_TRACE_ENTRIES = 250;
|
|
11264
11282
|
providerResolutionMeta;
|
|
11265
11283
|
static FINISH_RETRY_DELAY_MS = 300;
|
|
@@ -11500,7 +11518,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
11500
11518
|
this.terminalScreen.write(rawData);
|
|
11501
11519
|
const cleanData = sanitizeTerminalText(rawData);
|
|
11502
11520
|
const now = Date.now();
|
|
11503
|
-
const
|
|
11521
|
+
const screenText = this.terminalScreen.getText();
|
|
11522
|
+
const normalizedScreenSnapshot = normalizeScreenSnapshot(screenText);
|
|
11504
11523
|
this.lastOutputAt = now;
|
|
11505
11524
|
if (cleanData.trim()) this.lastNonEmptyOutputAt = now;
|
|
11506
11525
|
if (normalizedScreenSnapshot !== this.lastScreenSnapshot) {
|
|
@@ -11513,13 +11532,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
11513
11532
|
if (this.idleFinishCandidate && (rawData.length > 0 || cleanData.length > 0)) {
|
|
11514
11533
|
this.clearIdleFinishCandidate("new_output");
|
|
11515
11534
|
}
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11535
|
+
if (getDebugRuntimeConfig().collectDebugTrace) {
|
|
11536
|
+
this.recordTrace("output", {
|
|
11537
|
+
rawLength: rawData.length,
|
|
11538
|
+
cleanLength: cleanData.length,
|
|
11539
|
+
rawPreview: summarizeCliTraceText(rawData, 300),
|
|
11540
|
+
cleanPreview: summarizeCliTraceText(cleanData, 300)
|
|
11541
|
+
});
|
|
11542
|
+
}
|
|
11523
11543
|
if (this.startupParseGate) {
|
|
11524
11544
|
this.scheduleStartupSettleCheck();
|
|
11525
11545
|
}
|
|
@@ -12221,12 +12241,19 @@ var init_provider_cli_adapter = __esm({
|
|
|
12221
12241
|
* Called by command handler / dashboard for rich content rendering.
|
|
12222
12242
|
*/
|
|
12223
12243
|
getScriptParsedStatus() {
|
|
12244
|
+
const screenText = this.terminalScreen.getText();
|
|
12245
|
+
const cached2 = this.parsedStatusCache;
|
|
12246
|
+
if (cached2 && cached2.committedMessagesRef === this.committedMessages && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.accumulatedRawBuffer === this.accumulatedRawBuffer && cached2.screenText === screenText && cached2.currentStatus === this.currentStatus && cached2.activeModal === this.activeModal && cached2.cliName === this.cliName && cached2.lastOutputAt === this.lastOutputAt) {
|
|
12247
|
+
return cached2.result;
|
|
12248
|
+
}
|
|
12224
12249
|
const parsed = this.parseCurrentTranscript(
|
|
12225
12250
|
this.committedMessages,
|
|
12226
12251
|
this.responseBuffer,
|
|
12227
|
-
this.currentTurnScope
|
|
12252
|
+
this.currentTurnScope,
|
|
12253
|
+
screenText
|
|
12228
12254
|
);
|
|
12229
12255
|
const shouldPreferCommittedMessages = !this.currentTurnScope && this.currentStatus === "idle" && !this.activeModal;
|
|
12256
|
+
let result;
|
|
12230
12257
|
if (parsed && Array.isArray(parsed.messages)) {
|
|
12231
12258
|
const hydratedMessages = shouldPreferCommittedMessages ? this.committedMessages.map((message, index) => buildChatMessage({
|
|
12232
12259
|
...message,
|
|
@@ -12238,7 +12265,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
12238
12265
|
scope: this.currentTurnScope,
|
|
12239
12266
|
lastOutputAt: this.lastOutputAt
|
|
12240
12267
|
});
|
|
12241
|
-
|
|
12268
|
+
result = {
|
|
12242
12269
|
id: parsed.id || "cli_session",
|
|
12243
12270
|
status: parsed.status || this.currentStatus,
|
|
12244
12271
|
title: parsed.title || this.cliName,
|
|
@@ -12246,20 +12273,36 @@ var init_provider_cli_adapter = __esm({
|
|
|
12246
12273
|
activeModal: parsed.activeModal ?? this.activeModal,
|
|
12247
12274
|
providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0
|
|
12248
12275
|
};
|
|
12276
|
+
} else {
|
|
12277
|
+
const messages = [...this.committedMessages];
|
|
12278
|
+
result = {
|
|
12279
|
+
id: "cli_session",
|
|
12280
|
+
status: this.currentStatus,
|
|
12281
|
+
title: this.cliName,
|
|
12282
|
+
messages: messages.map((message, index) => buildChatMessage({
|
|
12283
|
+
...message,
|
|
12284
|
+
id: message.id || `msg_${index}`,
|
|
12285
|
+
index: typeof message.index === "number" ? message.index : index,
|
|
12286
|
+
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
12287
|
+
})),
|
|
12288
|
+
activeModal: this.activeModal
|
|
12289
|
+
};
|
|
12249
12290
|
}
|
|
12250
|
-
|
|
12251
|
-
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12291
|
+
this.parsedStatusCache = {
|
|
12292
|
+
committedMessagesRef: this.committedMessages,
|
|
12293
|
+
responseBuffer: this.responseBuffer,
|
|
12294
|
+
currentTurnScope: this.currentTurnScope,
|
|
12295
|
+
recentOutputBuffer: this.recentOutputBuffer,
|
|
12296
|
+
accumulatedBuffer: this.accumulatedBuffer,
|
|
12297
|
+
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
12298
|
+
screenText,
|
|
12299
|
+
currentStatus: this.currentStatus,
|
|
12300
|
+
activeModal: this.activeModal,
|
|
12301
|
+
cliName: this.cliName,
|
|
12302
|
+
lastOutputAt: this.lastOutputAt,
|
|
12303
|
+
result
|
|
12262
12304
|
};
|
|
12305
|
+
return result;
|
|
12263
12306
|
}
|
|
12264
12307
|
async invokeScript(scriptName, args) {
|
|
12265
12308
|
const fn = this.cliScripts?.[scriptName];
|
|
@@ -12282,17 +12325,18 @@ var init_provider_cli_adapter = __esm({
|
|
|
12282
12325
|
args: args && typeof args === "object" ? { ...args } : {}
|
|
12283
12326
|
}));
|
|
12284
12327
|
}
|
|
12285
|
-
parseCurrentTranscript(baseMessages, partialResponse, scope) {
|
|
12328
|
+
parseCurrentTranscript(baseMessages, partialResponse, scope, screenTextOverride) {
|
|
12286
12329
|
if (!this.cliScripts?.parseOutput) {
|
|
12287
12330
|
this.parseErrorMessage = null;
|
|
12288
12331
|
return null;
|
|
12289
12332
|
}
|
|
12290
12333
|
try {
|
|
12334
|
+
const screenText = typeof screenTextOverride === "string" ? screenTextOverride : this.terminalScreen.getText();
|
|
12291
12335
|
const input = buildCliParseInput({
|
|
12292
12336
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
12293
12337
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
12294
12338
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
12295
|
-
terminalScreenText:
|
|
12339
|
+
terminalScreenText: screenText,
|
|
12296
12340
|
baseMessages,
|
|
12297
12341
|
partialResponse,
|
|
12298
12342
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
@@ -12894,6 +12938,30 @@ ${data.message || ""}`.trim();
|
|
|
12894
12938
|
});
|
|
12895
12939
|
|
|
12896
12940
|
// ../../oss/packages/daemon-core/src/providers/cli-provider-instance.ts
|
|
12941
|
+
function normalizePersistableCliHistoryContent(content) {
|
|
12942
|
+
return flattenContent(content).replace(/\s+/g, " ").trim();
|
|
12943
|
+
}
|
|
12944
|
+
function buildPersistableCliHistorySignature(message) {
|
|
12945
|
+
return [
|
|
12946
|
+
String(message.role || ""),
|
|
12947
|
+
String(message.kind || ""),
|
|
12948
|
+
String(message.senderName || ""),
|
|
12949
|
+
normalizePersistableCliHistoryContent(message.content)
|
|
12950
|
+
].join("|");
|
|
12951
|
+
}
|
|
12952
|
+
function buildIncrementalHistoryAppendMessages(previousMessages, currentMessages) {
|
|
12953
|
+
if (!Array.isArray(currentMessages) || currentMessages.length === 0) return [];
|
|
12954
|
+
if (!Array.isArray(previousMessages) || previousMessages.length === 0) return currentMessages;
|
|
12955
|
+
const previousSignatures = previousMessages.map(buildPersistableCliHistorySignature);
|
|
12956
|
+
const currentSignatures = currentMessages.map(buildPersistableCliHistorySignature);
|
|
12957
|
+
let sharedPrefixLength = 0;
|
|
12958
|
+
while (sharedPrefixLength < previousSignatures.length && sharedPrefixLength < currentSignatures.length && previousSignatures[sharedPrefixLength] === currentSignatures[sharedPrefixLength]) {
|
|
12959
|
+
sharedPrefixLength += 1;
|
|
12960
|
+
}
|
|
12961
|
+
if (sharedPrefixLength === currentSignatures.length) return [];
|
|
12962
|
+
if (sharedPrefixLength === previousSignatures.length) return currentMessages.slice(sharedPrefixLength);
|
|
12963
|
+
return currentMessages;
|
|
12964
|
+
}
|
|
12897
12965
|
function getDatabaseSync() {
|
|
12898
12966
|
if (CachedDatabaseSync) return CachedDatabaseSync;
|
|
12899
12967
|
const requireFn = typeof require === "function" ? require : (0, import_node_module.createRequire)(path11.join(process.cwd(), "__adhdev_sqlite_loader__.js"));
|
|
@@ -12992,6 +13060,7 @@ var init_cli_provider_instance = __esm({
|
|
|
12992
13060
|
appliedEffectKeys = /* @__PURE__ */ new Set();
|
|
12993
13061
|
historyWriter;
|
|
12994
13062
|
runtimeMessages = [];
|
|
13063
|
+
lastPersistedHistoryMessages = [];
|
|
12995
13064
|
instanceId;
|
|
12996
13065
|
suppressIdleHistoryReplay = false;
|
|
12997
13066
|
errorMessage = void 0;
|
|
@@ -13032,6 +13101,13 @@ var init_cli_provider_instance = __esm({
|
|
|
13032
13101
|
this.providerSessionId,
|
|
13033
13102
|
this.instanceId
|
|
13034
13103
|
);
|
|
13104
|
+
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
13105
|
+
role: message.role,
|
|
13106
|
+
content: message.content,
|
|
13107
|
+
kind: message.kind,
|
|
13108
|
+
senderName: message.senderName,
|
|
13109
|
+
receivedAt: message.receivedAt
|
|
13110
|
+
}));
|
|
13035
13111
|
this.suppressIdleHistoryReplay = restoredHistory.messages.length > 0;
|
|
13036
13112
|
if (restoredHistory.messages.length > 0) {
|
|
13037
13113
|
this.adapter.seedCommittedMessages(
|
|
@@ -13062,6 +13138,7 @@ var init_cli_provider_instance = __esm({
|
|
|
13062
13138
|
}
|
|
13063
13139
|
async onTick() {
|
|
13064
13140
|
if (this.providerSessionId) return;
|
|
13141
|
+
if (this.type === "hermes-cli" && this.launchMode === "new") return;
|
|
13065
13142
|
let probedSessionId = null;
|
|
13066
13143
|
const probeConfig = this.provider.sessionProbe;
|
|
13067
13144
|
if (probeConfig) {
|
|
@@ -13162,15 +13239,24 @@ var init_cli_provider_instance = __esm({
|
|
|
13162
13239
|
messagesToSave = messagesToSave.slice(0, lastIdx);
|
|
13163
13240
|
}
|
|
13164
13241
|
}
|
|
13165
|
-
|
|
13242
|
+
const normalizedMessagesToSave = messagesToSave.map((message) => ({
|
|
13243
|
+
role: message.role,
|
|
13244
|
+
content: flattenContent(message.content),
|
|
13245
|
+
kind: typeof message.kind === "string" ? message.kind : void 0,
|
|
13246
|
+
senderName: typeof message.senderName === "string" ? message.senderName : void 0,
|
|
13247
|
+
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
13248
|
+
}));
|
|
13249
|
+
if (!shouldSkipReplayPersist && normalizedMessagesToSave.length > 0) {
|
|
13250
|
+
const incrementalMessages = buildIncrementalHistoryAppendMessages(this.lastPersistedHistoryMessages, normalizedMessagesToSave);
|
|
13166
13251
|
this.historyWriter.appendNewMessages(
|
|
13167
13252
|
this.type,
|
|
13168
|
-
|
|
13253
|
+
incrementalMessages,
|
|
13169
13254
|
parsedStatus?.title || dirName,
|
|
13170
13255
|
this.instanceId,
|
|
13171
13256
|
this.providerSessionId
|
|
13172
13257
|
);
|
|
13173
13258
|
}
|
|
13259
|
+
this.lastPersistedHistoryMessages = normalizedMessagesToSave;
|
|
13174
13260
|
}
|
|
13175
13261
|
this.applyProviderResponse(parsedStatus, { phase: "immediate" });
|
|
13176
13262
|
const surface = resolveProviderStateSurface({
|
|
@@ -13418,6 +13504,7 @@ var init_cli_provider_instance = __esm({
|
|
|
13418
13504
|
}
|
|
13419
13505
|
if (data.sessionEvent === "new_session") {
|
|
13420
13506
|
this.runtimeMessages = [];
|
|
13507
|
+
this.lastPersistedHistoryMessages = [];
|
|
13421
13508
|
this.suppressIdleHistoryReplay = false;
|
|
13422
13509
|
this.adapter.clearHistory();
|
|
13423
13510
|
}
|
|
@@ -35840,6 +35927,8 @@ function buildStatusSnapshot(options) {
|
|
|
35840
35927
|
session.lastSeenAt = lastSeenAt;
|
|
35841
35928
|
session.unread = overlayUnread;
|
|
35842
35929
|
session.inboxBucket = overlayInboxBucket;
|
|
35930
|
+
session.completionMarker = completionMarker;
|
|
35931
|
+
session.seenCompletionMarker = seenCompletionMarker;
|
|
35843
35932
|
if (READ_DEBUG_ENABLED && (session.unread || session.inboxBucket !== "idle" || session.providerType.includes("codex"))) {
|
|
35844
35933
|
const recentReadSnapshot = {
|
|
35845
35934
|
sessionId: session.id,
|
|
@@ -45333,6 +45422,8 @@ var init_server_connection = __esm({
|
|
|
45333
45422
|
if (misses >= 3 && this.ws) {
|
|
45334
45423
|
LOG.warn("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 closing stale WS`);
|
|
45335
45424
|
this.ws.terminate();
|
|
45425
|
+
} else if (misses === 1) {
|
|
45426
|
+
LOG.info("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 keeping WS open and retrying`);
|
|
45336
45427
|
} else {
|
|
45337
45428
|
LOG.warn("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 keeping WS open and retrying`);
|
|
45338
45429
|
}
|
|
@@ -54355,7 +54446,7 @@ var init_adhdev_daemon = __esm({
|
|
|
54355
54446
|
init_source2();
|
|
54356
54447
|
init_version();
|
|
54357
54448
|
init_src();
|
|
54358
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
54449
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.84" });
|
|
54359
54450
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
54360
54451
|
localHttpServer = null;
|
|
54361
54452
|
localWss = null;
|