@adhdev/daemon-core 0.9.21 → 0.9.23
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/index.js +38 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -1
- package/dist/index.mjs.map +1 -1
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +1 -5
- package/src/commands/chat-commands.ts +42 -0
- package/src/providers/cli-provider-instance.ts +19 -0
package/dist/index.mjs
CHANGED
|
@@ -2878,7 +2878,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2878
2878
|
const screenText = this.terminalScreen.getText() || "";
|
|
2879
2879
|
const effectiveScreenText = screenText || this.accumulatedBuffer;
|
|
2880
2880
|
const noActiveTurn = !this.currentTurnScope;
|
|
2881
|
-
const looksIdleChrome = /(^|\n)\s*[❯›>]\s*(?:\n|$)/m.test(effectiveScreenText)
|
|
2881
|
+
const looksIdleChrome = /(^|\n)\s*[❯›>]\s*(?:\n|$)/m.test(effectiveScreenText);
|
|
2882
2882
|
const parsedShowsLiveAssistantProgress = parsedStatus === "generating" && !!lastParsedAssistant && parsedMessages.length > this.committedMessages.length;
|
|
2883
2883
|
if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome && !parsedShowsLiveAssistantProgress) {
|
|
2884
2884
|
return;
|
|
@@ -10208,13 +10208,40 @@ function shouldCollapseReadChatReplayDuplicate(message) {
|
|
|
10208
10208
|
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
10209
10209
|
return role === "assistant" || role === "system";
|
|
10210
10210
|
}
|
|
10211
|
+
function normalizeReadChatReplayText(message) {
|
|
10212
|
+
return flattenContent(message?.content || "").replace(/\s+/g, " ").trim();
|
|
10213
|
+
}
|
|
10214
|
+
function isStableReadChatAssistantAnswer(message) {
|
|
10215
|
+
if (!message) return false;
|
|
10216
|
+
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
10217
|
+
const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
|
|
10218
|
+
if (role !== "assistant") return false;
|
|
10219
|
+
if (kind && kind !== "standard") return false;
|
|
10220
|
+
const content = normalizeReadChatReplayText(message);
|
|
10221
|
+
if (content.length < 160) return false;
|
|
10222
|
+
if (/^(bash|shell|terminal) command\b/i.test(content)) return false;
|
|
10223
|
+
return true;
|
|
10224
|
+
}
|
|
10225
|
+
function isReplayedAssistantAnswerAfterStableAnswer(message, stableAnswer) {
|
|
10226
|
+
if (!message || !stableAnswer) return false;
|
|
10227
|
+
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
10228
|
+
const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
|
|
10229
|
+
if (role !== "assistant") return false;
|
|
10230
|
+
if (kind && kind !== "standard") return false;
|
|
10231
|
+
const content = normalizeReadChatReplayText(message);
|
|
10232
|
+
const stableContent = normalizeReadChatReplayText(stableAnswer);
|
|
10233
|
+
if (content.length < 80 || stableContent.length < 80) return false;
|
|
10234
|
+
return content === stableContent || content.startsWith(stableContent) || stableContent.startsWith(content);
|
|
10235
|
+
}
|
|
10211
10236
|
function collapseReplayDuplicatesFromReadChat(messages) {
|
|
10212
10237
|
const collapsed = [];
|
|
10213
10238
|
const replaySignaturesInCurrentTurn = /* @__PURE__ */ new Set();
|
|
10239
|
+
let stableAssistantAnswerInCurrentTurn = null;
|
|
10214
10240
|
for (const message of messages) {
|
|
10215
10241
|
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
10216
10242
|
if (role === "user") {
|
|
10217
10243
|
replaySignaturesInCurrentTurn.clear();
|
|
10244
|
+
stableAssistantAnswerInCurrentTurn = null;
|
|
10218
10245
|
}
|
|
10219
10246
|
const signature = buildReadChatReplayCollapseSignature(message);
|
|
10220
10247
|
const previous = collapsed[collapsed.length - 1];
|
|
@@ -10222,11 +10249,15 @@ function collapseReplayDuplicatesFromReadChat(messages) {
|
|
|
10222
10249
|
if (shouldCollapseReadChatReplayDuplicate(message) && signature) {
|
|
10223
10250
|
if (previousSignature === signature) continue;
|
|
10224
10251
|
if (replaySignaturesInCurrentTurn.has(signature)) continue;
|
|
10252
|
+
if (isReplayedAssistantAnswerAfterStableAnswer(message, stableAssistantAnswerInCurrentTurn)) continue;
|
|
10225
10253
|
}
|
|
10226
10254
|
collapsed.push(message);
|
|
10227
10255
|
if (shouldCollapseReadChatReplayDuplicate(message) && signature) {
|
|
10228
10256
|
replaySignaturesInCurrentTurn.add(signature);
|
|
10229
10257
|
}
|
|
10258
|
+
if (isStableReadChatAssistantAnswer(message)) {
|
|
10259
|
+
stableAssistantAnswerInCurrentTurn = message;
|
|
10260
|
+
}
|
|
10230
10261
|
}
|
|
10231
10262
|
return collapsed;
|
|
10232
10263
|
}
|
|
@@ -12986,6 +13017,12 @@ var CliProviderInstance = class {
|
|
|
12986
13017
|
if (historyMessageCount !== null) {
|
|
12987
13018
|
parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
|
|
12988
13019
|
}
|
|
13020
|
+
const committedMessages = Array.isArray(adapterStatus.messages) ? adapterStatus.messages : [];
|
|
13021
|
+
const isActiveNonIdle = adapterStatus.status !== "idle";
|
|
13022
|
+
const shouldApplyCommittedFloor = parsedMessages.length < committedMessages.length && (adapterStatus.status === "waiting_approval" || isActiveNonIdle && historyMessageCount === null);
|
|
13023
|
+
if (shouldApplyCommittedFloor) {
|
|
13024
|
+
parsedMessages = normalizeChatMessages(committedMessages);
|
|
13025
|
+
}
|
|
12989
13026
|
const mergedMessages = this.mergeConversationMessages(parsedMessages);
|
|
12990
13027
|
const canonicalBackedHistory = this.syncCanonicalSavedHistoryIfNeeded();
|
|
12991
13028
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|