@adhdev/daemon-core 0.9.37 → 0.9.39
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 +32 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -15
- 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 +11 -0
- package/src/providers/cli-provider-instance.ts +42 -18
package/dist/index.mjs
CHANGED
|
@@ -2848,6 +2848,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
2848
2848
|
}
|
|
2849
2849
|
this.resolveStartupState("settled");
|
|
2850
2850
|
if (this.startupParseGate) return;
|
|
2851
|
+
if (!this.isWaitingForResponse && !this.currentTurnScope && !this.activeModal && !this.parseErrorMessage) {
|
|
2852
|
+
const tail = this.settledBuffer || this.recentOutputBuffer;
|
|
2853
|
+
const modal2 = this.runParseApproval(tail);
|
|
2854
|
+
const lightweightStatus = this.cliScripts?.detectStatus ? this.runDetectStatus(tail) : null;
|
|
2855
|
+
if (!modal2 && lightweightStatus === "idle" && this.currentStatus === "idle") {
|
|
2856
|
+
return;
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2851
2859
|
const session = this.runParseSession();
|
|
2852
2860
|
if (!session) return;
|
|
2853
2861
|
const { status, messages, modal, parsedStatus } = session;
|
|
@@ -13137,17 +13145,24 @@ function buildPersistableCliHistorySignature(message) {
|
|
|
13137
13145
|
normalizePersistableCliHistoryContent(message.content)
|
|
13138
13146
|
].join("|");
|
|
13139
13147
|
}
|
|
13148
|
+
function hasSamePersistableCliHistoryIdentity(a, b) {
|
|
13149
|
+
return String(a?.role || "") === String(b?.role || "") && String(a?.kind || "") === String(b?.kind || "") && String(a?.senderName || "") === String(b?.senderName || "") && String(a?.content || "") === String(b?.content || "");
|
|
13150
|
+
}
|
|
13140
13151
|
function buildIncrementalHistoryAppendMessages(previousMessages, currentMessages) {
|
|
13141
13152
|
if (!Array.isArray(currentMessages) || currentMessages.length === 0) return [];
|
|
13142
13153
|
if (!Array.isArray(previousMessages) || previousMessages.length === 0) return currentMessages;
|
|
13143
|
-
const
|
|
13144
|
-
const currentSignatures = currentMessages.map(buildPersistableCliHistorySignature);
|
|
13154
|
+
const comparableLength = Math.min(previousMessages.length, currentMessages.length);
|
|
13145
13155
|
let sharedPrefixLength = 0;
|
|
13146
|
-
while (sharedPrefixLength <
|
|
13156
|
+
while (sharedPrefixLength < comparableLength && hasSamePersistableCliHistoryIdentity(previousMessages[sharedPrefixLength], currentMessages[sharedPrefixLength])) {
|
|
13147
13157
|
sharedPrefixLength += 1;
|
|
13148
13158
|
}
|
|
13149
|
-
if (sharedPrefixLength ===
|
|
13150
|
-
if (sharedPrefixLength ===
|
|
13159
|
+
if (sharedPrefixLength === currentMessages.length) return [];
|
|
13160
|
+
if (sharedPrefixLength === previousMessages.length) return currentMessages.slice(sharedPrefixLength);
|
|
13161
|
+
while (sharedPrefixLength < comparableLength && buildPersistableCliHistorySignature(previousMessages[sharedPrefixLength]) === buildPersistableCliHistorySignature(currentMessages[sharedPrefixLength])) {
|
|
13162
|
+
sharedPrefixLength += 1;
|
|
13163
|
+
}
|
|
13164
|
+
if (sharedPrefixLength === currentMessages.length) return [];
|
|
13165
|
+
if (sharedPrefixLength === previousMessages.length) return currentMessages.slice(sharedPrefixLength);
|
|
13151
13166
|
return currentMessages;
|
|
13152
13167
|
}
|
|
13153
13168
|
var CachedDatabaseSync = null;
|
|
@@ -13393,13 +13408,15 @@ var CliProviderInstance = class {
|
|
|
13393
13408
|
}));
|
|
13394
13409
|
if (!canonicalBackedHistory && !shouldSkipReplayPersist && normalizedMessagesToSave.length > 0) {
|
|
13395
13410
|
const incrementalMessages = buildIncrementalHistoryAppendMessages(this.lastPersistedHistoryMessages, normalizedMessagesToSave);
|
|
13396
|
-
|
|
13397
|
-
this.
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13411
|
+
if (incrementalMessages.length > 0) {
|
|
13412
|
+
this.historyWriter.appendNewMessages(
|
|
13413
|
+
this.type,
|
|
13414
|
+
incrementalMessages,
|
|
13415
|
+
parsedStatus?.title || dirName,
|
|
13416
|
+
this.instanceId,
|
|
13417
|
+
this.providerSessionId
|
|
13418
|
+
);
|
|
13419
|
+
}
|
|
13403
13420
|
}
|
|
13404
13421
|
if (!canonicalBackedHistory) {
|
|
13405
13422
|
this.lastPersistedHistoryMessages = normalizedMessagesToSave;
|
|
@@ -13534,8 +13551,8 @@ var CliProviderInstance = class {
|
|
|
13534
13551
|
}
|
|
13535
13552
|
detectStatusTransition() {
|
|
13536
13553
|
const now = Date.now();
|
|
13537
|
-
const adapterStatus = this.adapter.getStatus();
|
|
13538
|
-
const parsedStatus =
|
|
13554
|
+
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
13555
|
+
const parsedStatus = null;
|
|
13539
13556
|
const rawStatus = adapterStatus.status;
|
|
13540
13557
|
const autoApproveActive = rawStatus === "waiting_approval" && this.shouldAutoApprove();
|
|
13541
13558
|
if (autoApproveActive && !this.autoApproveBusy) {
|
|
@@ -13628,7 +13645,7 @@ var CliProviderInstance = class {
|
|
|
13628
13645
|
this.completedDebouncePending = { chatTitle, duration, timestamp: now };
|
|
13629
13646
|
this.completedDebounceTimer = setTimeout(() => {
|
|
13630
13647
|
if (this.completedDebouncePending) {
|
|
13631
|
-
const latestStatus = this.adapter.getStatus();
|
|
13648
|
+
const latestStatus = this.adapter.getStatus({ allowParse: false });
|
|
13632
13649
|
const latestAutoApproveActive = latestStatus.status === "waiting_approval" && this.shouldAutoApprove();
|
|
13633
13650
|
const latestVisibleStatus = latestAutoApproveActive ? "generating" : latestStatus.status;
|
|
13634
13651
|
if (latestVisibleStatus !== "idle") {
|