adhdev 0.8.81 → 0.8.82
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 +234 -42
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +234 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1062,6 +1062,96 @@ function getSessionSeenMarker(state, sessionId, providerSessionId) {
|
|
|
1062
1062
|
const providerKey = buildSessionReadStateKey(sessionId, providerSessionId);
|
|
1063
1063
|
return state.sessionReadMarkers?.[providerKey] || state.sessionReadMarkers?.[sessionId] || "";
|
|
1064
1064
|
}
|
|
1065
|
+
function getSessionNotificationDismissal(state, sessionId, providerSessionId) {
|
|
1066
|
+
const providerKey = buildSessionReadStateKey(sessionId, providerSessionId);
|
|
1067
|
+
return state.sessionNotificationDismissals?.[providerKey] || state.sessionNotificationDismissals?.[sessionId] || "";
|
|
1068
|
+
}
|
|
1069
|
+
function getSessionNotificationUnreadOverride(state, sessionId, providerSessionId) {
|
|
1070
|
+
const providerKey = buildSessionReadStateKey(sessionId, providerSessionId);
|
|
1071
|
+
return state.sessionNotificationUnreadOverrides?.[providerKey] || state.sessionNotificationUnreadOverrides?.[sessionId] || "";
|
|
1072
|
+
}
|
|
1073
|
+
function dismissSessionNotification(state, sessionId, notificationId, providerSessionId) {
|
|
1074
|
+
const dismissalId = String(notificationId || "").trim();
|
|
1075
|
+
if (!dismissalId) return state;
|
|
1076
|
+
const dismissalKeys = Array.from(new Set([
|
|
1077
|
+
sessionId,
|
|
1078
|
+
buildSessionReadStateKey(sessionId, providerSessionId)
|
|
1079
|
+
].filter(Boolean)));
|
|
1080
|
+
const nextSessionNotificationDismissals = { ...state.sessionNotificationDismissals || {} };
|
|
1081
|
+
const nextSessionNotificationUnreadOverrides = { ...state.sessionNotificationUnreadOverrides || {} };
|
|
1082
|
+
for (const key of dismissalKeys) {
|
|
1083
|
+
nextSessionNotificationDismissals[key] = dismissalId;
|
|
1084
|
+
delete nextSessionNotificationUnreadOverrides[key];
|
|
1085
|
+
}
|
|
1086
|
+
return {
|
|
1087
|
+
...state,
|
|
1088
|
+
sessionNotificationDismissals: nextSessionNotificationDismissals,
|
|
1089
|
+
sessionNotificationUnreadOverrides: nextSessionNotificationUnreadOverrides
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
function markSessionNotificationUnread(state, sessionId, notificationId, providerSessionId) {
|
|
1093
|
+
const unreadId = String(notificationId || "").trim();
|
|
1094
|
+
if (!unreadId) return state;
|
|
1095
|
+
const unreadKeys = Array.from(new Set([
|
|
1096
|
+
sessionId,
|
|
1097
|
+
buildSessionReadStateKey(sessionId, providerSessionId)
|
|
1098
|
+
].filter(Boolean)));
|
|
1099
|
+
const nextSessionNotificationDismissals = { ...state.sessionNotificationDismissals || {} };
|
|
1100
|
+
const nextSessionNotificationUnreadOverrides = { ...state.sessionNotificationUnreadOverrides || {} };
|
|
1101
|
+
for (const key of unreadKeys) {
|
|
1102
|
+
nextSessionNotificationUnreadOverrides[key] = unreadId;
|
|
1103
|
+
delete nextSessionNotificationDismissals[key];
|
|
1104
|
+
}
|
|
1105
|
+
return {
|
|
1106
|
+
...state,
|
|
1107
|
+
sessionNotificationDismissals: nextSessionNotificationDismissals,
|
|
1108
|
+
sessionNotificationUnreadOverrides: nextSessionNotificationUnreadOverrides
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
function getSessionNotificationTargetValue(session) {
|
|
1112
|
+
const providerSessionId = typeof session.providerSessionId === "string" ? session.providerSessionId.trim() : "";
|
|
1113
|
+
return providerSessionId || session.id;
|
|
1114
|
+
}
|
|
1115
|
+
function getSessionCurrentNotificationId(session) {
|
|
1116
|
+
const inboxBucket = session.inboxBucket || "idle";
|
|
1117
|
+
const isNeedsAttention = inboxBucket === "needs_attention" || session.status === "waiting_approval";
|
|
1118
|
+
const isTaskComplete = inboxBucket === "task_complete" && !!session.unread;
|
|
1119
|
+
const type = isNeedsAttention ? "needs_attention" : isTaskComplete ? "task_complete" : "";
|
|
1120
|
+
if (!type) return "";
|
|
1121
|
+
const target = getSessionNotificationTargetValue(session);
|
|
1122
|
+
const lastMessageHash = typeof session.lastMessageHash === "string" ? session.lastMessageHash : "";
|
|
1123
|
+
const timestamp = Number(session.lastMessageAt || session.lastUpdated || 0);
|
|
1124
|
+
return [type, target, lastMessageHash, String(timestamp)].join("|");
|
|
1125
|
+
}
|
|
1126
|
+
function applySessionNotificationOverlay(session, overlay) {
|
|
1127
|
+
const currentNotificationId = getSessionCurrentNotificationId(session);
|
|
1128
|
+
const taskCompleteNotificationId = (() => {
|
|
1129
|
+
const target = getSessionNotificationTargetValue(session);
|
|
1130
|
+
const lastMessageHash = typeof session.lastMessageHash === "string" ? session.lastMessageHash : "";
|
|
1131
|
+
const timestamp = Number(session.lastMessageAt || session.lastUpdated || 0);
|
|
1132
|
+
if (!target || !lastMessageHash || !timestamp) return "";
|
|
1133
|
+
return ["task_complete", target, lastMessageHash, String(timestamp)].join("|");
|
|
1134
|
+
})();
|
|
1135
|
+
const dismissedNotificationId = typeof overlay.dismissedNotificationId === "string" ? overlay.dismissedNotificationId.trim() : "";
|
|
1136
|
+
const unreadNotificationId = typeof overlay.unreadNotificationId === "string" ? overlay.unreadNotificationId.trim() : "";
|
|
1137
|
+
if (unreadNotificationId && (currentNotificationId === unreadNotificationId || taskCompleteNotificationId === unreadNotificationId)) {
|
|
1138
|
+
const forcedInboxBucket = session.inboxBucket === "needs_attention" || session.status === "waiting_approval" ? "needs_attention" : "task_complete";
|
|
1139
|
+
return {
|
|
1140
|
+
unread: true,
|
|
1141
|
+
inboxBucket: forcedInboxBucket
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
if (!currentNotificationId || !dismissedNotificationId || currentNotificationId !== dismissedNotificationId) {
|
|
1145
|
+
return {
|
|
1146
|
+
unread: !!session.unread,
|
|
1147
|
+
inboxBucket: session.inboxBucket || "idle"
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
return {
|
|
1151
|
+
unread: false,
|
|
1152
|
+
inboxBucket: "idle"
|
|
1153
|
+
};
|
|
1154
|
+
}
|
|
1065
1155
|
function markSessionSeen(state, sessionId, seenAt = Date.now(), completionMarker, providerSessionId) {
|
|
1066
1156
|
const prev = state.sessionReads || {};
|
|
1067
1157
|
const prevMarkers = state.sessionReadMarkers || {};
|
|
@@ -1072,14 +1162,20 @@ function markSessionSeen(state, sessionId, seenAt = Date.now(), completionMarker
|
|
|
1072
1162
|
].filter(Boolean)));
|
|
1073
1163
|
const nextSessionReads = { ...prev };
|
|
1074
1164
|
const nextSessionReadMarkers = { ...prevMarkers };
|
|
1165
|
+
const nextSessionNotificationDismissals = { ...state.sessionNotificationDismissals || {} };
|
|
1166
|
+
const nextSessionNotificationUnreadOverrides = { ...state.sessionNotificationUnreadOverrides || {} };
|
|
1075
1167
|
for (const key of readKeys) {
|
|
1076
1168
|
nextSessionReads[key] = Math.max(prev[key] || 0, seenAt);
|
|
1077
1169
|
if (nextMarker) nextSessionReadMarkers[key] = nextMarker;
|
|
1170
|
+
delete nextSessionNotificationDismissals[key];
|
|
1171
|
+
delete nextSessionNotificationUnreadOverrides[key];
|
|
1078
1172
|
}
|
|
1079
1173
|
return {
|
|
1080
1174
|
...state,
|
|
1081
1175
|
sessionReads: nextSessionReads,
|
|
1082
|
-
sessionReadMarkers: nextMarker ? nextSessionReadMarkers : prevMarkers
|
|
1176
|
+
sessionReadMarkers: nextMarker ? nextSessionReadMarkers : prevMarkers,
|
|
1177
|
+
sessionNotificationDismissals: nextSessionNotificationDismissals,
|
|
1178
|
+
sessionNotificationUnreadOverrides: nextSessionNotificationUnreadOverrides
|
|
1083
1179
|
};
|
|
1084
1180
|
}
|
|
1085
1181
|
var path2, MAX_ACTIVITY;
|
|
@@ -1209,11 +1305,19 @@ function normalizeState(raw) {
|
|
|
1209
1305
|
const sessionReadMarkers = Object.fromEntries(
|
|
1210
1306
|
Object.entries(isPlainObject2(parsed.sessionReadMarkers) ? parsed.sessionReadMarkers : {}).filter(([key, value]) => !isLegacyVolatileSessionReadKey(key) && typeof value === "string")
|
|
1211
1307
|
);
|
|
1308
|
+
const sessionNotificationDismissals = Object.fromEntries(
|
|
1309
|
+
Object.entries(isPlainObject2(parsed.sessionNotificationDismissals) ? parsed.sessionNotificationDismissals : {}).filter(([key, value]) => !isLegacyVolatileSessionReadKey(key) && typeof value === "string" && value.length > 0)
|
|
1310
|
+
);
|
|
1311
|
+
const sessionNotificationUnreadOverrides = Object.fromEntries(
|
|
1312
|
+
Object.entries(isPlainObject2(parsed.sessionNotificationUnreadOverrides) ? parsed.sessionNotificationUnreadOverrides : {}).filter(([key, value]) => !isLegacyVolatileSessionReadKey(key) && typeof value === "string" && value.length > 0)
|
|
1313
|
+
);
|
|
1212
1314
|
return {
|
|
1213
1315
|
recentActivity,
|
|
1214
1316
|
savedProviderSessions,
|
|
1215
1317
|
sessionReads,
|
|
1216
|
-
sessionReadMarkers
|
|
1318
|
+
sessionReadMarkers,
|
|
1319
|
+
sessionNotificationDismissals,
|
|
1320
|
+
sessionNotificationUnreadOverrides
|
|
1217
1321
|
};
|
|
1218
1322
|
}
|
|
1219
1323
|
function loadState() {
|
|
@@ -1248,7 +1352,9 @@ var init_state_store = __esm({
|
|
|
1248
1352
|
recentActivity: [],
|
|
1249
1353
|
savedProviderSessions: [],
|
|
1250
1354
|
sessionReads: {},
|
|
1251
|
-
sessionReadMarkers: {}
|
|
1355
|
+
sessionReadMarkers: {},
|
|
1356
|
+
sessionNotificationDismissals: {},
|
|
1357
|
+
sessionNotificationUnreadOverrides: {}
|
|
1252
1358
|
};
|
|
1253
1359
|
}
|
|
1254
1360
|
});
|
|
@@ -5217,7 +5323,6 @@ var init_extension_provider_instance = __esm({
|
|
|
5217
5323
|
}
|
|
5218
5324
|
pushEvent(event) {
|
|
5219
5325
|
this.events.push(event);
|
|
5220
|
-
if (this.events.length > 50) this.events = this.events.slice(-50);
|
|
5221
5326
|
}
|
|
5222
5327
|
applyProviderResponse(data, options) {
|
|
5223
5328
|
if (!data || typeof data !== "object") return;
|
|
@@ -5293,7 +5398,6 @@ var init_extension_provider_instance = __esm({
|
|
|
5293
5398
|
key: dedupKey,
|
|
5294
5399
|
message: normalizedMessage
|
|
5295
5400
|
});
|
|
5296
|
-
if (this.runtimeMessages.length > 50) this.runtimeMessages = this.runtimeMessages.slice(-50);
|
|
5297
5401
|
if (normalizedContent) {
|
|
5298
5402
|
this.historyWriter.appendNewMessages(
|
|
5299
5403
|
this.type,
|
|
@@ -5970,7 +6074,6 @@ var init_ide_provider_instance = __esm({
|
|
|
5970
6074
|
}
|
|
5971
6075
|
pushEvent(event) {
|
|
5972
6076
|
this.events.push(event);
|
|
5973
|
-
if (this.events.length > 50) this.events = this.events.slice(-50);
|
|
5974
6077
|
}
|
|
5975
6078
|
applyProviderResponse(data, options) {
|
|
5976
6079
|
if (!data || typeof data !== "object") return;
|
|
@@ -6060,7 +6163,6 @@ var init_ide_provider_instance = __esm({
|
|
|
6060
6163
|
key: dedupKey,
|
|
6061
6164
|
message: normalizedMessage
|
|
6062
6165
|
});
|
|
6063
|
-
if (this.runtimeMessages.length > 50) this.runtimeMessages = this.runtimeMessages.slice(-50);
|
|
6064
6166
|
if (normalizedContent) {
|
|
6065
6167
|
this.historyWriter.appendNewMessages(
|
|
6066
6168
|
this.type,
|
|
@@ -7687,7 +7789,14 @@ async function handleReadChat(h, args) {
|
|
|
7687
7789
|
const adapter = getTargetedCliAdapter(h, args, provider?.type);
|
|
7688
7790
|
if (adapter) {
|
|
7689
7791
|
_log(`${transport} adapter: ${adapter.cliType}`);
|
|
7690
|
-
|
|
7792
|
+
let parsedStatus = null;
|
|
7793
|
+
if (typeof adapter.getScriptParsedStatus === "function") {
|
|
7794
|
+
try {
|
|
7795
|
+
parsedStatus = parseMaybeJson(adapter.getScriptParsedStatus());
|
|
7796
|
+
} catch (error48) {
|
|
7797
|
+
return { success: false, error: error48?.message || String(error48) };
|
|
7798
|
+
}
|
|
7799
|
+
}
|
|
7691
7800
|
const parsedRecord = parsedStatus && typeof parsedStatus === "object" ? parsedStatus : null;
|
|
7692
7801
|
const status = parsedRecord || adapter.getStatus();
|
|
7693
7802
|
const title = typeof parsedRecord?.title === "string" ? parsedRecord.title : void 0;
|
|
@@ -12030,6 +12139,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
12030
12139
|
recentOutputBuffer = "";
|
|
12031
12140
|
isWaitingForResponse = false;
|
|
12032
12141
|
activeModal = null;
|
|
12142
|
+
parseErrorMessage = null;
|
|
12033
12143
|
responseTimeout = null;
|
|
12034
12144
|
idleTimeout = null;
|
|
12035
12145
|
ready = false;
|
|
@@ -13024,10 +13134,12 @@ var init_provider_cli_adapter = __esm({
|
|
|
13024
13134
|
// ─── Public API (CliAdapter) ───────────────────
|
|
13025
13135
|
getStatus() {
|
|
13026
13136
|
return {
|
|
13027
|
-
status: this.currentStatus,
|
|
13137
|
+
status: this.parseErrorMessage ? "error" : this.currentStatus,
|
|
13028
13138
|
messages: [...this.committedMessages],
|
|
13029
13139
|
workingDir: this.workingDir,
|
|
13030
|
-
activeModal: this.activeModal
|
|
13140
|
+
activeModal: this.activeModal,
|
|
13141
|
+
errorMessage: this.parseErrorMessage || void 0,
|
|
13142
|
+
errorReason: this.parseErrorMessage ? "parse_error" : void 0
|
|
13031
13143
|
};
|
|
13032
13144
|
}
|
|
13033
13145
|
seedCommittedMessages(messages) {
|
|
@@ -13081,7 +13193,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
13081
13193
|
id: "cli_session",
|
|
13082
13194
|
status: this.currentStatus,
|
|
13083
13195
|
title: this.cliName,
|
|
13084
|
-
messages: messages.
|
|
13196
|
+
messages: messages.map((message, index) => buildChatMessage({
|
|
13085
13197
|
...message,
|
|
13086
13198
|
id: message.id || `msg_${index}`,
|
|
13087
13199
|
index: typeof message.index === "number" ? message.index : index,
|
|
@@ -13112,7 +13224,10 @@ var init_provider_cli_adapter = __esm({
|
|
|
13112
13224
|
}));
|
|
13113
13225
|
}
|
|
13114
13226
|
parseCurrentTranscript(baseMessages, partialResponse, scope) {
|
|
13115
|
-
if (!this.cliScripts?.parseOutput)
|
|
13227
|
+
if (!this.cliScripts?.parseOutput) {
|
|
13228
|
+
this.parseErrorMessage = null;
|
|
13229
|
+
return null;
|
|
13230
|
+
}
|
|
13116
13231
|
try {
|
|
13117
13232
|
const input = buildCliParseInput({
|
|
13118
13233
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
@@ -13140,10 +13255,13 @@ var init_provider_cli_adapter = __esm({
|
|
|
13140
13255
|
lastAssistant.content = trimPromptEchoPrefix(lastAssistant.content, promptForTrim);
|
|
13141
13256
|
}
|
|
13142
13257
|
}
|
|
13258
|
+
this.parseErrorMessage = null;
|
|
13143
13259
|
return parsed;
|
|
13144
13260
|
} catch (e) {
|
|
13145
|
-
|
|
13146
|
-
|
|
13261
|
+
const message = e?.message || String(e);
|
|
13262
|
+
this.parseErrorMessage = message;
|
|
13263
|
+
LOG.warn("CLI", `[${this.cliType}] parseOutput error: ${message}`);
|
|
13264
|
+
throw e;
|
|
13147
13265
|
}
|
|
13148
13266
|
}
|
|
13149
13267
|
/** Whether this adapter has CLI scripts loaded */
|
|
@@ -13817,6 +13935,8 @@ var init_cli_provider_instance = __esm({
|
|
|
13817
13935
|
runtimeMessages = [];
|
|
13818
13936
|
instanceId;
|
|
13819
13937
|
suppressIdleHistoryReplay = false;
|
|
13938
|
+
errorMessage = void 0;
|
|
13939
|
+
errorReason = void 0;
|
|
13820
13940
|
presentationMode;
|
|
13821
13941
|
providerSessionId;
|
|
13822
13942
|
launchMode;
|
|
@@ -13940,9 +14060,24 @@ var init_cli_provider_instance = __esm({
|
|
|
13940
14060
|
}
|
|
13941
14061
|
getState() {
|
|
13942
14062
|
const adapterStatus = this.adapter.getStatus();
|
|
13943
|
-
|
|
14063
|
+
let parsedStatus = null;
|
|
14064
|
+
let parseErrorMessage;
|
|
14065
|
+
if (typeof this.adapter.getScriptParsedStatus === "function") {
|
|
14066
|
+
try {
|
|
14067
|
+
parsedStatus = this.adapter.getScriptParsedStatus() || null;
|
|
14068
|
+
this.errorMessage = void 0;
|
|
14069
|
+
this.errorReason = void 0;
|
|
14070
|
+
} catch (error48) {
|
|
14071
|
+
parseErrorMessage = error48?.message || String(error48);
|
|
14072
|
+
this.errorMessage = parseErrorMessage;
|
|
14073
|
+
this.errorReason = "parse_error";
|
|
14074
|
+
}
|
|
14075
|
+
} else {
|
|
14076
|
+
this.errorMessage = void 0;
|
|
14077
|
+
this.errorReason = void 0;
|
|
14078
|
+
}
|
|
13944
14079
|
const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
|
|
13945
|
-
const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
|
|
14080
|
+
const visibleStatus = parseErrorMessage ? "error" : autoApproveActive ? "generating" : adapterStatus.status;
|
|
13946
14081
|
const parsedProviderSessionId = normalizeProviderSessionId(
|
|
13947
14082
|
this.type,
|
|
13948
14083
|
typeof parsedStatus?.providerSessionId === "string" ? parsedStatus.providerSessionId : ""
|
|
@@ -13952,7 +14087,7 @@ var init_cli_provider_instance = __esm({
|
|
|
13952
14087
|
}
|
|
13953
14088
|
const runtime = this.adapter.getRuntimeMetadata();
|
|
13954
14089
|
this.maybeAppendRuntimeRecoveryMessage(runtime);
|
|
13955
|
-
let parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
|
|
14090
|
+
let parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : parseErrorMessage ? normalizeChatMessages(Array.isArray(adapterStatus.messages) ? adapterStatus.messages : []) : [];
|
|
13956
14091
|
const historyMessageCount = Number.isFinite(parsedStatus?.historyMessageCount) ? Math.max(0, Number(parsedStatus.historyMessageCount)) : null;
|
|
13957
14092
|
if (historyMessageCount !== null) {
|
|
13958
14093
|
parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
|
|
@@ -13992,7 +14127,7 @@ var init_cli_provider_instance = __esm({
|
|
|
13992
14127
|
activeChat: {
|
|
13993
14128
|
id: `${this.type}_${this.workingDir}`,
|
|
13994
14129
|
title: parsedStatus?.title || dirName,
|
|
13995
|
-
status: autoApproveActive && parsedStatus?.status === "waiting_approval" ? "generating" : parsedStatus?.status || visibleStatus,
|
|
14130
|
+
status: parseErrorMessage ? "error" : autoApproveActive && parsedStatus?.status === "waiting_approval" ? "generating" : parsedStatus?.status || visibleStatus,
|
|
13996
14131
|
messages: mergedMessages,
|
|
13997
14132
|
activeModal: autoApproveActive ? null : parsedStatus?.activeModal ?? adapterStatus.activeModal,
|
|
13998
14133
|
inputContent: ""
|
|
@@ -14018,7 +14153,9 @@ var init_cli_provider_instance = __esm({
|
|
|
14018
14153
|
resume: this.provider.resume,
|
|
14019
14154
|
controlValues: surface.controlValues,
|
|
14020
14155
|
providerControls: this.provider.controls,
|
|
14021
|
-
summaryMetadata: surface.summaryMetadata
|
|
14156
|
+
summaryMetadata: surface.summaryMetadata,
|
|
14157
|
+
errorMessage: this.errorMessage,
|
|
14158
|
+
errorReason: this.errorReason
|
|
14022
14159
|
};
|
|
14023
14160
|
}
|
|
14024
14161
|
setPresentationMode(mode) {
|
|
@@ -14205,7 +14342,6 @@ var init_cli_provider_instance = __esm({
|
|
|
14205
14342
|
}
|
|
14206
14343
|
pushEvent(event) {
|
|
14207
14344
|
this.events.push(event);
|
|
14208
|
-
if (this.events.length > 50) this.events = this.events.slice(-50);
|
|
14209
14345
|
}
|
|
14210
14346
|
flushEvents() {
|
|
14211
14347
|
const events = [...this.events];
|
|
@@ -14387,9 +14523,6 @@ ${effect.notification.body || ""}`.trim();
|
|
|
14387
14523
|
key: dedupKey,
|
|
14388
14524
|
message: normalizedMessage
|
|
14389
14525
|
});
|
|
14390
|
-
if (this.runtimeMessages.length > 50) {
|
|
14391
|
-
this.runtimeMessages = this.runtimeMessages.slice(-50);
|
|
14392
|
-
}
|
|
14393
14526
|
if (normalizedContent) {
|
|
14394
14527
|
this.historyWriter.appendNewMessages(
|
|
14395
14528
|
this.type,
|
|
@@ -30948,8 +31081,8 @@ var init_acp_provider_instance = __esm({
|
|
|
30948
31081
|
}
|
|
30949
31082
|
getState() {
|
|
30950
31083
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
30951
|
-
const recentMessages = normalizeChatMessages(this.messages.
|
|
30952
|
-
const content =
|
|
31084
|
+
const recentMessages = normalizeChatMessages(this.messages.map((m) => {
|
|
31085
|
+
const content = m.content;
|
|
30953
31086
|
return buildChatMessage({
|
|
30954
31087
|
...m,
|
|
30955
31088
|
content
|
|
@@ -31742,18 +31875,6 @@ var init_acp_provider_instance = __esm({
|
|
|
31742
31875
|
}
|
|
31743
31876
|
}
|
|
31744
31877
|
// ─── Rich Content Helpers ────────────────────────────
|
|
31745
|
-
/** Truncate content for transport (text: 2000 chars, images preserved) */
|
|
31746
|
-
truncateContent(content) {
|
|
31747
|
-
if (typeof content === "string") {
|
|
31748
|
-
return content.length > 2e3 ? content.slice(0, 2e3) + "\n... (truncated)" : content;
|
|
31749
|
-
}
|
|
31750
|
-
return content.map((b) => {
|
|
31751
|
-
if (b.type === "text" && b.text.length > 2e3) {
|
|
31752
|
-
return { ...b, text: b.text.slice(0, 2e3) + "\n... (truncated)" };
|
|
31753
|
-
}
|
|
31754
|
-
return b;
|
|
31755
|
-
});
|
|
31756
|
-
}
|
|
31757
31878
|
/** Build ContentBlock[] from current partial state */
|
|
31758
31879
|
buildPartialBlocks() {
|
|
31759
31880
|
const blocks = [];
|
|
@@ -31907,7 +32028,6 @@ ${rawInput}` : rawInput;
|
|
|
31907
32028
|
}
|
|
31908
32029
|
pushEvent(event) {
|
|
31909
32030
|
this.events.push(event);
|
|
31910
|
-
if (this.events.length > 50) this.events = this.events.slice(-50);
|
|
31911
32031
|
}
|
|
31912
32032
|
appendSystemMessage(content, timestamp = Date.now()) {
|
|
31913
32033
|
const normalizedContent = String(content || "").trim();
|
|
@@ -36423,7 +36543,9 @@ var init_command_log = __esm({
|
|
|
36423
36543
|
"heartbeat",
|
|
36424
36544
|
"status_report",
|
|
36425
36545
|
"read_chat",
|
|
36426
|
-
"mark_session_seen"
|
|
36546
|
+
"mark_session_seen",
|
|
36547
|
+
"delete_notification",
|
|
36548
|
+
"mark_notification_unread"
|
|
36427
36549
|
]);
|
|
36428
36550
|
cleanOldFiles();
|
|
36429
36551
|
}
|
|
@@ -36643,9 +36765,22 @@ function buildStatusSnapshot(options) {
|
|
|
36643
36765
|
completionMarker,
|
|
36644
36766
|
seenCompletionMarker
|
|
36645
36767
|
);
|
|
36768
|
+
const { unread: overlayUnread, inboxBucket: overlayInboxBucket } = applySessionNotificationOverlay({
|
|
36769
|
+
id: sourceSession.id,
|
|
36770
|
+
providerSessionId: sourceSession.providerSessionId,
|
|
36771
|
+
status: sourceSession.status,
|
|
36772
|
+
unread,
|
|
36773
|
+
inboxBucket,
|
|
36774
|
+
lastMessageHash: sourceSession.lastMessageHash,
|
|
36775
|
+
lastMessageAt: sourceSession.lastMessageAt,
|
|
36776
|
+
lastUpdated: sourceSession.lastUpdated
|
|
36777
|
+
}, {
|
|
36778
|
+
dismissedNotificationId: getSessionNotificationDismissal(state, sourceSession.id, sourceSession.providerSessionId),
|
|
36779
|
+
unreadNotificationId: getSessionNotificationUnreadOverride(state, sourceSession.id, sourceSession.providerSessionId)
|
|
36780
|
+
});
|
|
36646
36781
|
session.lastSeenAt = lastSeenAt;
|
|
36647
|
-
session.unread =
|
|
36648
|
-
session.inboxBucket =
|
|
36782
|
+
session.unread = overlayUnread;
|
|
36783
|
+
session.inboxBucket = overlayInboxBucket;
|
|
36649
36784
|
if (READ_DEBUG_ENABLED && (session.unread || session.inboxBucket !== "idle" || session.providerType.includes("codex"))) {
|
|
36650
36785
|
const recentReadSnapshot = {
|
|
36651
36786
|
sessionId: session.id,
|
|
@@ -36710,6 +36845,7 @@ var init_snapshot = __esm({
|
|
|
36710
36845
|
init_terminal_screen();
|
|
36711
36846
|
init_logger();
|
|
36712
36847
|
init_builders();
|
|
36848
|
+
init_recent_activity();
|
|
36713
36849
|
READ_DEBUG_ENABLED = process.argv.includes("--dev") || process.env.ADHDEV_READ_DEBUG === "1";
|
|
36714
36850
|
recentReadDebugSignatureBySession = /* @__PURE__ */ new Map();
|
|
36715
36851
|
}
|
|
@@ -37509,6 +37645,62 @@ var init_router = __esm({
|
|
|
37509
37645
|
completionMarker
|
|
37510
37646
|
};
|
|
37511
37647
|
}
|
|
37648
|
+
case "delete_notification": {
|
|
37649
|
+
const sessionId = args?.sessionId;
|
|
37650
|
+
const notificationId = typeof args?.notificationId === "string" ? args.notificationId.trim() : "";
|
|
37651
|
+
if (!sessionId || typeof sessionId !== "string") {
|
|
37652
|
+
return { success: false, error: "sessionId is required" };
|
|
37653
|
+
}
|
|
37654
|
+
if (!notificationId) {
|
|
37655
|
+
return { success: false, error: "notificationId is required" };
|
|
37656
|
+
}
|
|
37657
|
+
const sessionEntries = buildSessionEntries(
|
|
37658
|
+
this.deps.instanceManager.collectAllStates(),
|
|
37659
|
+
this.deps.cdpManagers
|
|
37660
|
+
);
|
|
37661
|
+
const targetSession = sessionEntries.find((entry) => entry.id === sessionId);
|
|
37662
|
+
const next = dismissSessionNotification(
|
|
37663
|
+
loadState(),
|
|
37664
|
+
sessionId,
|
|
37665
|
+
notificationId,
|
|
37666
|
+
targetSession?.providerSessionId
|
|
37667
|
+
);
|
|
37668
|
+
saveState(next);
|
|
37669
|
+
this.deps.onStatusChange?.();
|
|
37670
|
+
return {
|
|
37671
|
+
success: true,
|
|
37672
|
+
sessionId,
|
|
37673
|
+
notificationId
|
|
37674
|
+
};
|
|
37675
|
+
}
|
|
37676
|
+
case "mark_notification_unread": {
|
|
37677
|
+
const sessionId = args?.sessionId;
|
|
37678
|
+
const notificationId = typeof args?.notificationId === "string" ? args.notificationId.trim() : "";
|
|
37679
|
+
if (!sessionId || typeof sessionId !== "string") {
|
|
37680
|
+
return { success: false, error: "sessionId is required" };
|
|
37681
|
+
}
|
|
37682
|
+
if (!notificationId) {
|
|
37683
|
+
return { success: false, error: "notificationId is required" };
|
|
37684
|
+
}
|
|
37685
|
+
const sessionEntries = buildSessionEntries(
|
|
37686
|
+
this.deps.instanceManager.collectAllStates(),
|
|
37687
|
+
this.deps.cdpManagers
|
|
37688
|
+
);
|
|
37689
|
+
const targetSession = sessionEntries.find((entry) => entry.id === sessionId);
|
|
37690
|
+
const next = markSessionNotificationUnread(
|
|
37691
|
+
loadState(),
|
|
37692
|
+
sessionId,
|
|
37693
|
+
notificationId,
|
|
37694
|
+
targetSession?.providerSessionId
|
|
37695
|
+
);
|
|
37696
|
+
saveState(next);
|
|
37697
|
+
this.deps.onStatusChange?.();
|
|
37698
|
+
return {
|
|
37699
|
+
success: true,
|
|
37700
|
+
sessionId,
|
|
37701
|
+
notificationId
|
|
37702
|
+
};
|
|
37703
|
+
}
|
|
37512
37704
|
// ─── Daemon Self-Upgrade ───
|
|
37513
37705
|
case "daemon_upgrade": {
|
|
37514
37706
|
LOG.info("Upgrade", "Remote upgrade requested from dashboard");
|
|
@@ -85867,7 +86059,7 @@ var init_adhdev_daemon = __esm({
|
|
|
85867
86059
|
init_source();
|
|
85868
86060
|
init_version();
|
|
85869
86061
|
init_src();
|
|
85870
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
86062
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.82" });
|
|
85871
86063
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
85872
86064
|
localHttpServer = null;
|
|
85873
86065
|
localWss = null;
|