@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.js
CHANGED
|
@@ -2881,7 +2881,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2881
2881
|
const screenText = this.terminalScreen.getText() || "";
|
|
2882
2882
|
const effectiveScreenText = screenText || this.accumulatedBuffer;
|
|
2883
2883
|
const noActiveTurn = !this.currentTurnScope;
|
|
2884
|
-
const looksIdleChrome = /(^|\n)\s*[❯›>]\s*(?:\n|$)/m.test(effectiveScreenText)
|
|
2884
|
+
const looksIdleChrome = /(^|\n)\s*[❯›>]\s*(?:\n|$)/m.test(effectiveScreenText);
|
|
2885
2885
|
const parsedShowsLiveAssistantProgress = parsedStatus === "generating" && !!lastParsedAssistant && parsedMessages.length > this.committedMessages.length;
|
|
2886
2886
|
if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome && !parsedShowsLiveAssistantProgress) {
|
|
2887
2887
|
return;
|
|
@@ -10361,13 +10361,40 @@ function shouldCollapseReadChatReplayDuplicate(message) {
|
|
|
10361
10361
|
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
10362
10362
|
return role === "assistant" || role === "system";
|
|
10363
10363
|
}
|
|
10364
|
+
function normalizeReadChatReplayText(message) {
|
|
10365
|
+
return flattenContent(message?.content || "").replace(/\s+/g, " ").trim();
|
|
10366
|
+
}
|
|
10367
|
+
function isStableReadChatAssistantAnswer(message) {
|
|
10368
|
+
if (!message) return false;
|
|
10369
|
+
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
10370
|
+
const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
|
|
10371
|
+
if (role !== "assistant") return false;
|
|
10372
|
+
if (kind && kind !== "standard") return false;
|
|
10373
|
+
const content = normalizeReadChatReplayText(message);
|
|
10374
|
+
if (content.length < 160) return false;
|
|
10375
|
+
if (/^(bash|shell|terminal) command\b/i.test(content)) return false;
|
|
10376
|
+
return true;
|
|
10377
|
+
}
|
|
10378
|
+
function isReplayedAssistantAnswerAfterStableAnswer(message, stableAnswer) {
|
|
10379
|
+
if (!message || !stableAnswer) return false;
|
|
10380
|
+
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
10381
|
+
const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
|
|
10382
|
+
if (role !== "assistant") return false;
|
|
10383
|
+
if (kind && kind !== "standard") return false;
|
|
10384
|
+
const content = normalizeReadChatReplayText(message);
|
|
10385
|
+
const stableContent = normalizeReadChatReplayText(stableAnswer);
|
|
10386
|
+
if (content.length < 80 || stableContent.length < 80) return false;
|
|
10387
|
+
return content === stableContent || content.startsWith(stableContent) || stableContent.startsWith(content);
|
|
10388
|
+
}
|
|
10364
10389
|
function collapseReplayDuplicatesFromReadChat(messages) {
|
|
10365
10390
|
const collapsed = [];
|
|
10366
10391
|
const replaySignaturesInCurrentTurn = /* @__PURE__ */ new Set();
|
|
10392
|
+
let stableAssistantAnswerInCurrentTurn = null;
|
|
10367
10393
|
for (const message of messages) {
|
|
10368
10394
|
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
10369
10395
|
if (role === "user") {
|
|
10370
10396
|
replaySignaturesInCurrentTurn.clear();
|
|
10397
|
+
stableAssistantAnswerInCurrentTurn = null;
|
|
10371
10398
|
}
|
|
10372
10399
|
const signature = buildReadChatReplayCollapseSignature(message);
|
|
10373
10400
|
const previous = collapsed[collapsed.length - 1];
|
|
@@ -10375,11 +10402,15 @@ function collapseReplayDuplicatesFromReadChat(messages) {
|
|
|
10375
10402
|
if (shouldCollapseReadChatReplayDuplicate(message) && signature) {
|
|
10376
10403
|
if (previousSignature === signature) continue;
|
|
10377
10404
|
if (replaySignaturesInCurrentTurn.has(signature)) continue;
|
|
10405
|
+
if (isReplayedAssistantAnswerAfterStableAnswer(message, stableAssistantAnswerInCurrentTurn)) continue;
|
|
10378
10406
|
}
|
|
10379
10407
|
collapsed.push(message);
|
|
10380
10408
|
if (shouldCollapseReadChatReplayDuplicate(message) && signature) {
|
|
10381
10409
|
replaySignaturesInCurrentTurn.add(signature);
|
|
10382
10410
|
}
|
|
10411
|
+
if (isStableReadChatAssistantAnswer(message)) {
|
|
10412
|
+
stableAssistantAnswerInCurrentTurn = message;
|
|
10413
|
+
}
|
|
10383
10414
|
}
|
|
10384
10415
|
return collapsed;
|
|
10385
10416
|
}
|
|
@@ -13139,6 +13170,12 @@ var CliProviderInstance = class {
|
|
|
13139
13170
|
if (historyMessageCount !== null) {
|
|
13140
13171
|
parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
|
|
13141
13172
|
}
|
|
13173
|
+
const committedMessages = Array.isArray(adapterStatus.messages) ? adapterStatus.messages : [];
|
|
13174
|
+
const isActiveNonIdle = adapterStatus.status !== "idle";
|
|
13175
|
+
const shouldApplyCommittedFloor = parsedMessages.length < committedMessages.length && (adapterStatus.status === "waiting_approval" || isActiveNonIdle && historyMessageCount === null);
|
|
13176
|
+
if (shouldApplyCommittedFloor) {
|
|
13177
|
+
parsedMessages = normalizeChatMessages(committedMessages);
|
|
13178
|
+
}
|
|
13142
13179
|
const mergedMessages = this.mergeConversationMessages(parsedMessages);
|
|
13143
13180
|
const canonicalBackedHistory = this.syncCanonicalSavedHistoryIfNeeded();
|
|
13144
13181
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|