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/cli/index.js
CHANGED
|
@@ -1756,9 +1756,15 @@ function classifyHotChatSessionsForSubscriptionFlush(sessions, previousHotSessio
|
|
|
1756
1756
|
continue;
|
|
1757
1757
|
}
|
|
1758
1758
|
const status = String(session?.status || "").toLowerCase();
|
|
1759
|
+
const unread = session?.unread === true;
|
|
1760
|
+
const inboxBucket = String(session?.inboxBucket || "").toLowerCase();
|
|
1761
|
+
const runtimeSurfaceKind = String(session?.runtimeSurfaceKind || "").toLowerCase();
|
|
1762
|
+
const runtimeLifecycle = String(session?.runtimeLifecycle || "").toLowerCase();
|
|
1763
|
+
const isLiveRuntime = runtimeSurfaceKind === "live_runtime" || LIVE_RUNTIME_LIFECYCLES.has(runtimeLifecycle);
|
|
1759
1764
|
const lastMessageAt = parseMessageTimestamp(session?.lastMessageAt);
|
|
1760
1765
|
const recentlyUpdated = lastMessageAt > 0 && now - lastMessageAt <= recentMessageGraceMs;
|
|
1761
|
-
|
|
1766
|
+
const shouldKeepRecentTailHot = recentlyUpdated && (unread || inboxBucket === "task_complete" || inboxBucket === "needs_attention" || isLiveRuntime || activeStatuses.has(status));
|
|
1767
|
+
if (activeStatuses.has(status) || shouldKeepRecentTailHot) {
|
|
1762
1768
|
active.add(sessionId);
|
|
1763
1769
|
}
|
|
1764
1770
|
}
|
|
@@ -10811,10 +10817,12 @@ function logTerminalBackendSelection(preference, ghosttyAvailable, backendKind)
|
|
|
10811
10817
|
if (loggedTerminalBackends.has(key)) return;
|
|
10812
10818
|
loggedTerminalBackends.add(key);
|
|
10813
10819
|
if (backendKind === "xterm" && preference !== "xterm" && !ghosttyAvailable) {
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10820
|
+
const message = `[terminal-screen] ghostty-vt unavailable; using xterm fallback (preference=${preference})`;
|
|
10821
|
+
if (preference === "auto") {
|
|
10822
|
+
LOG.info("Terminal", message);
|
|
10823
|
+
} else {
|
|
10824
|
+
LOG.warn("Terminal", message);
|
|
10825
|
+
}
|
|
10818
10826
|
return;
|
|
10819
10827
|
}
|
|
10820
10828
|
LOG.info(
|
|
@@ -12088,6 +12096,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
12088
12096
|
"use strict";
|
|
12089
12097
|
os13 = __toESM(require("os"));
|
|
12090
12098
|
init_logger();
|
|
12099
|
+
init_debug_config();
|
|
12091
12100
|
init_terminal_screen();
|
|
12092
12101
|
init_pty_transport();
|
|
12093
12102
|
init_provider_cli_shared();
|
|
@@ -12121,7 +12130,15 @@ var init_provider_cli_adapter = __esm({
|
|
|
12121
12130
|
`[${this.cliType}] Provider resolution: providerDir=${this.providerResolutionMeta.providerDir || "-"} scriptDir=${this.providerResolutionMeta.scriptDir || "-"} scriptsPath=${this.providerResolutionMeta.scriptsPath || "-"} source=${this.providerResolutionMeta.scriptsSource || "-"} version=${this.providerResolutionMeta.resolvedVersion || "-"}`
|
|
12122
12131
|
);
|
|
12123
12132
|
} else {
|
|
12124
|
-
|
|
12133
|
+
const resolutionSummary = `providerDir=${this.providerResolutionMeta.providerDir || "-"} scriptDir=${this.providerResolutionMeta.scriptDir || "-"} scriptsPath=${this.providerResolutionMeta.scriptsPath || "-"} source=${this.providerResolutionMeta.scriptsSource || "-"} version=${this.providerResolutionMeta.resolvedVersion || "-"}`;
|
|
12134
|
+
const hasResolvedProviderScripts = Boolean(
|
|
12135
|
+
this.providerResolutionMeta.providerDir || this.providerResolutionMeta.scriptDir || this.providerResolutionMeta.scriptsPath || this.providerResolutionMeta.scriptsSource || this.providerResolutionMeta.resolvedVersion
|
|
12136
|
+
);
|
|
12137
|
+
if (hasResolvedProviderScripts) {
|
|
12138
|
+
LOG.warn("CLI", `[${this.cliType}] \u26A0 No CLI scripts loaded! Provider needs scripts/{version}/scripts.js (${resolutionSummary})`);
|
|
12139
|
+
} else {
|
|
12140
|
+
LOG.info("CLI", `[${this.cliType}] CLI scripts not yet resolved (${resolutionSummary})`);
|
|
12141
|
+
}
|
|
12125
12142
|
}
|
|
12126
12143
|
}
|
|
12127
12144
|
cliType;
|
|
@@ -12200,7 +12217,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
12200
12217
|
currentTurnScope = null;
|
|
12201
12218
|
traceEntries = [];
|
|
12202
12219
|
traceSeq = 0;
|
|
12203
|
-
traceSessionId =
|
|
12220
|
+
traceSessionId = "";
|
|
12221
|
+
parsedStatusCache = null;
|
|
12204
12222
|
static MAX_TRACE_ENTRIES = 250;
|
|
12205
12223
|
providerResolutionMeta;
|
|
12206
12224
|
static FINISH_RETRY_DELAY_MS = 300;
|
|
@@ -12441,7 +12459,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
12441
12459
|
this.terminalScreen.write(rawData);
|
|
12442
12460
|
const cleanData = sanitizeTerminalText(rawData);
|
|
12443
12461
|
const now = Date.now();
|
|
12444
|
-
const
|
|
12462
|
+
const screenText = this.terminalScreen.getText();
|
|
12463
|
+
const normalizedScreenSnapshot = normalizeScreenSnapshot(screenText);
|
|
12445
12464
|
this.lastOutputAt = now;
|
|
12446
12465
|
if (cleanData.trim()) this.lastNonEmptyOutputAt = now;
|
|
12447
12466
|
if (normalizedScreenSnapshot !== this.lastScreenSnapshot) {
|
|
@@ -12454,13 +12473,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
12454
12473
|
if (this.idleFinishCandidate && (rawData.length > 0 || cleanData.length > 0)) {
|
|
12455
12474
|
this.clearIdleFinishCandidate("new_output");
|
|
12456
12475
|
}
|
|
12457
|
-
|
|
12458
|
-
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12476
|
+
if (getDebugRuntimeConfig().collectDebugTrace) {
|
|
12477
|
+
this.recordTrace("output", {
|
|
12478
|
+
rawLength: rawData.length,
|
|
12479
|
+
cleanLength: cleanData.length,
|
|
12480
|
+
rawPreview: summarizeCliTraceText(rawData, 300),
|
|
12481
|
+
cleanPreview: summarizeCliTraceText(cleanData, 300)
|
|
12482
|
+
});
|
|
12483
|
+
}
|
|
12464
12484
|
if (this.startupParseGate) {
|
|
12465
12485
|
this.scheduleStartupSettleCheck();
|
|
12466
12486
|
}
|
|
@@ -13162,12 +13182,19 @@ var init_provider_cli_adapter = __esm({
|
|
|
13162
13182
|
* Called by command handler / dashboard for rich content rendering.
|
|
13163
13183
|
*/
|
|
13164
13184
|
getScriptParsedStatus() {
|
|
13185
|
+
const screenText = this.terminalScreen.getText();
|
|
13186
|
+
const cached2 = this.parsedStatusCache;
|
|
13187
|
+
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) {
|
|
13188
|
+
return cached2.result;
|
|
13189
|
+
}
|
|
13165
13190
|
const parsed = this.parseCurrentTranscript(
|
|
13166
13191
|
this.committedMessages,
|
|
13167
13192
|
this.responseBuffer,
|
|
13168
|
-
this.currentTurnScope
|
|
13193
|
+
this.currentTurnScope,
|
|
13194
|
+
screenText
|
|
13169
13195
|
);
|
|
13170
13196
|
const shouldPreferCommittedMessages = !this.currentTurnScope && this.currentStatus === "idle" && !this.activeModal;
|
|
13197
|
+
let result;
|
|
13171
13198
|
if (parsed && Array.isArray(parsed.messages)) {
|
|
13172
13199
|
const hydratedMessages = shouldPreferCommittedMessages ? this.committedMessages.map((message, index) => buildChatMessage({
|
|
13173
13200
|
...message,
|
|
@@ -13179,7 +13206,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
13179
13206
|
scope: this.currentTurnScope,
|
|
13180
13207
|
lastOutputAt: this.lastOutputAt
|
|
13181
13208
|
});
|
|
13182
|
-
|
|
13209
|
+
result = {
|
|
13183
13210
|
id: parsed.id || "cli_session",
|
|
13184
13211
|
status: parsed.status || this.currentStatus,
|
|
13185
13212
|
title: parsed.title || this.cliName,
|
|
@@ -13187,20 +13214,36 @@ var init_provider_cli_adapter = __esm({
|
|
|
13187
13214
|
activeModal: parsed.activeModal ?? this.activeModal,
|
|
13188
13215
|
providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0
|
|
13189
13216
|
};
|
|
13217
|
+
} else {
|
|
13218
|
+
const messages = [...this.committedMessages];
|
|
13219
|
+
result = {
|
|
13220
|
+
id: "cli_session",
|
|
13221
|
+
status: this.currentStatus,
|
|
13222
|
+
title: this.cliName,
|
|
13223
|
+
messages: messages.map((message, index) => buildChatMessage({
|
|
13224
|
+
...message,
|
|
13225
|
+
id: message.id || `msg_${index}`,
|
|
13226
|
+
index: typeof message.index === "number" ? message.index : index,
|
|
13227
|
+
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
13228
|
+
})),
|
|
13229
|
+
activeModal: this.activeModal
|
|
13230
|
+
};
|
|
13190
13231
|
}
|
|
13191
|
-
|
|
13192
|
-
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
|
|
13202
|
-
|
|
13232
|
+
this.parsedStatusCache = {
|
|
13233
|
+
committedMessagesRef: this.committedMessages,
|
|
13234
|
+
responseBuffer: this.responseBuffer,
|
|
13235
|
+
currentTurnScope: this.currentTurnScope,
|
|
13236
|
+
recentOutputBuffer: this.recentOutputBuffer,
|
|
13237
|
+
accumulatedBuffer: this.accumulatedBuffer,
|
|
13238
|
+
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
13239
|
+
screenText,
|
|
13240
|
+
currentStatus: this.currentStatus,
|
|
13241
|
+
activeModal: this.activeModal,
|
|
13242
|
+
cliName: this.cliName,
|
|
13243
|
+
lastOutputAt: this.lastOutputAt,
|
|
13244
|
+
result
|
|
13203
13245
|
};
|
|
13246
|
+
return result;
|
|
13204
13247
|
}
|
|
13205
13248
|
async invokeScript(scriptName, args) {
|
|
13206
13249
|
const fn = this.cliScripts?.[scriptName];
|
|
@@ -13223,17 +13266,18 @@ var init_provider_cli_adapter = __esm({
|
|
|
13223
13266
|
args: args && typeof args === "object" ? { ...args } : {}
|
|
13224
13267
|
}));
|
|
13225
13268
|
}
|
|
13226
|
-
parseCurrentTranscript(baseMessages, partialResponse, scope) {
|
|
13269
|
+
parseCurrentTranscript(baseMessages, partialResponse, scope, screenTextOverride) {
|
|
13227
13270
|
if (!this.cliScripts?.parseOutput) {
|
|
13228
13271
|
this.parseErrorMessage = null;
|
|
13229
13272
|
return null;
|
|
13230
13273
|
}
|
|
13231
13274
|
try {
|
|
13275
|
+
const screenText = typeof screenTextOverride === "string" ? screenTextOverride : this.terminalScreen.getText();
|
|
13232
13276
|
const input = buildCliParseInput({
|
|
13233
13277
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
13234
13278
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
13235
13279
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
13236
|
-
terminalScreenText:
|
|
13280
|
+
terminalScreenText: screenText,
|
|
13237
13281
|
baseMessages,
|
|
13238
13282
|
partialResponse,
|
|
13239
13283
|
isWaitingForResponse: this.isWaitingForResponse,
|
|
@@ -13835,6 +13879,30 @@ ${data.message || ""}`.trim();
|
|
|
13835
13879
|
});
|
|
13836
13880
|
|
|
13837
13881
|
// ../../oss/packages/daemon-core/src/providers/cli-provider-instance.ts
|
|
13882
|
+
function normalizePersistableCliHistoryContent(content) {
|
|
13883
|
+
return flattenContent(content).replace(/\s+/g, " ").trim();
|
|
13884
|
+
}
|
|
13885
|
+
function buildPersistableCliHistorySignature(message) {
|
|
13886
|
+
return [
|
|
13887
|
+
String(message.role || ""),
|
|
13888
|
+
String(message.kind || ""),
|
|
13889
|
+
String(message.senderName || ""),
|
|
13890
|
+
normalizePersistableCliHistoryContent(message.content)
|
|
13891
|
+
].join("|");
|
|
13892
|
+
}
|
|
13893
|
+
function buildIncrementalHistoryAppendMessages(previousMessages, currentMessages) {
|
|
13894
|
+
if (!Array.isArray(currentMessages) || currentMessages.length === 0) return [];
|
|
13895
|
+
if (!Array.isArray(previousMessages) || previousMessages.length === 0) return currentMessages;
|
|
13896
|
+
const previousSignatures = previousMessages.map(buildPersistableCliHistorySignature);
|
|
13897
|
+
const currentSignatures = currentMessages.map(buildPersistableCliHistorySignature);
|
|
13898
|
+
let sharedPrefixLength = 0;
|
|
13899
|
+
while (sharedPrefixLength < previousSignatures.length && sharedPrefixLength < currentSignatures.length && previousSignatures[sharedPrefixLength] === currentSignatures[sharedPrefixLength]) {
|
|
13900
|
+
sharedPrefixLength += 1;
|
|
13901
|
+
}
|
|
13902
|
+
if (sharedPrefixLength === currentSignatures.length) return [];
|
|
13903
|
+
if (sharedPrefixLength === previousSignatures.length) return currentMessages.slice(sharedPrefixLength);
|
|
13904
|
+
return currentMessages;
|
|
13905
|
+
}
|
|
13838
13906
|
function getDatabaseSync() {
|
|
13839
13907
|
if (CachedDatabaseSync) return CachedDatabaseSync;
|
|
13840
13908
|
const requireFn = typeof require === "function" ? require : (0, import_node_module.createRequire)(path12.join(process.cwd(), "__adhdev_sqlite_loader__.js"));
|
|
@@ -13933,6 +14001,7 @@ var init_cli_provider_instance = __esm({
|
|
|
13933
14001
|
appliedEffectKeys = /* @__PURE__ */ new Set();
|
|
13934
14002
|
historyWriter;
|
|
13935
14003
|
runtimeMessages = [];
|
|
14004
|
+
lastPersistedHistoryMessages = [];
|
|
13936
14005
|
instanceId;
|
|
13937
14006
|
suppressIdleHistoryReplay = false;
|
|
13938
14007
|
errorMessage = void 0;
|
|
@@ -13973,6 +14042,13 @@ var init_cli_provider_instance = __esm({
|
|
|
13973
14042
|
this.providerSessionId,
|
|
13974
14043
|
this.instanceId
|
|
13975
14044
|
);
|
|
14045
|
+
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
14046
|
+
role: message.role,
|
|
14047
|
+
content: message.content,
|
|
14048
|
+
kind: message.kind,
|
|
14049
|
+
senderName: message.senderName,
|
|
14050
|
+
receivedAt: message.receivedAt
|
|
14051
|
+
}));
|
|
13976
14052
|
this.suppressIdleHistoryReplay = restoredHistory.messages.length > 0;
|
|
13977
14053
|
if (restoredHistory.messages.length > 0) {
|
|
13978
14054
|
this.adapter.seedCommittedMessages(
|
|
@@ -14003,6 +14079,7 @@ var init_cli_provider_instance = __esm({
|
|
|
14003
14079
|
}
|
|
14004
14080
|
async onTick() {
|
|
14005
14081
|
if (this.providerSessionId) return;
|
|
14082
|
+
if (this.type === "hermes-cli" && this.launchMode === "new") return;
|
|
14006
14083
|
let probedSessionId = null;
|
|
14007
14084
|
const probeConfig = this.provider.sessionProbe;
|
|
14008
14085
|
if (probeConfig) {
|
|
@@ -14103,15 +14180,24 @@ var init_cli_provider_instance = __esm({
|
|
|
14103
14180
|
messagesToSave = messagesToSave.slice(0, lastIdx);
|
|
14104
14181
|
}
|
|
14105
14182
|
}
|
|
14106
|
-
|
|
14183
|
+
const normalizedMessagesToSave = messagesToSave.map((message) => ({
|
|
14184
|
+
role: message.role,
|
|
14185
|
+
content: flattenContent(message.content),
|
|
14186
|
+
kind: typeof message.kind === "string" ? message.kind : void 0,
|
|
14187
|
+
senderName: typeof message.senderName === "string" ? message.senderName : void 0,
|
|
14188
|
+
receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
|
|
14189
|
+
}));
|
|
14190
|
+
if (!shouldSkipReplayPersist && normalizedMessagesToSave.length > 0) {
|
|
14191
|
+
const incrementalMessages = buildIncrementalHistoryAppendMessages(this.lastPersistedHistoryMessages, normalizedMessagesToSave);
|
|
14107
14192
|
this.historyWriter.appendNewMessages(
|
|
14108
14193
|
this.type,
|
|
14109
|
-
|
|
14194
|
+
incrementalMessages,
|
|
14110
14195
|
parsedStatus?.title || dirName,
|
|
14111
14196
|
this.instanceId,
|
|
14112
14197
|
this.providerSessionId
|
|
14113
14198
|
);
|
|
14114
14199
|
}
|
|
14200
|
+
this.lastPersistedHistoryMessages = normalizedMessagesToSave;
|
|
14115
14201
|
}
|
|
14116
14202
|
this.applyProviderResponse(parsedStatus, { phase: "immediate" });
|
|
14117
14203
|
const surface = resolveProviderStateSurface({
|
|
@@ -14359,6 +14445,7 @@ var init_cli_provider_instance = __esm({
|
|
|
14359
14445
|
}
|
|
14360
14446
|
if (data.sessionEvent === "new_session") {
|
|
14361
14447
|
this.runtimeMessages = [];
|
|
14448
|
+
this.lastPersistedHistoryMessages = [];
|
|
14362
14449
|
this.suppressIdleHistoryReplay = false;
|
|
14363
14450
|
this.adapter.clearHistory();
|
|
14364
14451
|
}
|
|
@@ -36781,6 +36868,8 @@ function buildStatusSnapshot(options) {
|
|
|
36781
36868
|
session.lastSeenAt = lastSeenAt;
|
|
36782
36869
|
session.unread = overlayUnread;
|
|
36783
36870
|
session.inboxBucket = overlayInboxBucket;
|
|
36871
|
+
session.completionMarker = completionMarker;
|
|
36872
|
+
session.seenCompletionMarker = seenCompletionMarker;
|
|
36784
36873
|
if (READ_DEBUG_ENABLED && (session.unread || session.inboxBucket !== "idle" || session.providerType.includes("codex"))) {
|
|
36785
36874
|
const recentReadSnapshot = {
|
|
36786
36875
|
sessionId: session.id,
|
|
@@ -77504,6 +77593,8 @@ var init_server_connection = __esm({
|
|
|
77504
77593
|
if (misses >= 3 && this.ws) {
|
|
77505
77594
|
LOG.warn("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 closing stale WS`);
|
|
77506
77595
|
this.ws.terminate();
|
|
77596
|
+
} else if (misses === 1) {
|
|
77597
|
+
LOG.info("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 keeping WS open and retrying`);
|
|
77507
77598
|
} else {
|
|
77508
77599
|
LOG.warn("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 keeping WS open and retrying`);
|
|
77509
77600
|
}
|
|
@@ -86059,7 +86150,7 @@ var init_adhdev_daemon = __esm({
|
|
|
86059
86150
|
init_source();
|
|
86060
86151
|
init_version();
|
|
86061
86152
|
init_src();
|
|
86062
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
86153
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.84" });
|
|
86063
86154
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
86064
86155
|
localHttpServer = null;
|
|
86065
86156
|
localWss = null;
|