@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.js
CHANGED
|
@@ -2851,6 +2851,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
2851
2851
|
}
|
|
2852
2852
|
this.resolveStartupState("settled");
|
|
2853
2853
|
if (this.startupParseGate) return;
|
|
2854
|
+
if (!this.isWaitingForResponse && !this.currentTurnScope && !this.activeModal && !this.parseErrorMessage) {
|
|
2855
|
+
const tail = this.settledBuffer || this.recentOutputBuffer;
|
|
2856
|
+
const modal2 = this.runParseApproval(tail);
|
|
2857
|
+
const lightweightStatus = this.cliScripts?.detectStatus ? this.runDetectStatus(tail) : null;
|
|
2858
|
+
if (!modal2 && lightweightStatus === "idle" && this.currentStatus === "idle") {
|
|
2859
|
+
return;
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2854
2862
|
const session = this.runParseSession();
|
|
2855
2863
|
if (!session) return;
|
|
2856
2864
|
const { status, messages, modal, parsedStatus } = session;
|
|
@@ -13290,17 +13298,24 @@ function buildPersistableCliHistorySignature(message) {
|
|
|
13290
13298
|
normalizePersistableCliHistoryContent(message.content)
|
|
13291
13299
|
].join("|");
|
|
13292
13300
|
}
|
|
13301
|
+
function hasSamePersistableCliHistoryIdentity(a, b) {
|
|
13302
|
+
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 || "");
|
|
13303
|
+
}
|
|
13293
13304
|
function buildIncrementalHistoryAppendMessages(previousMessages, currentMessages) {
|
|
13294
13305
|
if (!Array.isArray(currentMessages) || currentMessages.length === 0) return [];
|
|
13295
13306
|
if (!Array.isArray(previousMessages) || previousMessages.length === 0) return currentMessages;
|
|
13296
|
-
const
|
|
13297
|
-
const currentSignatures = currentMessages.map(buildPersistableCliHistorySignature);
|
|
13307
|
+
const comparableLength = Math.min(previousMessages.length, currentMessages.length);
|
|
13298
13308
|
let sharedPrefixLength = 0;
|
|
13299
|
-
while (sharedPrefixLength <
|
|
13309
|
+
while (sharedPrefixLength < comparableLength && hasSamePersistableCliHistoryIdentity(previousMessages[sharedPrefixLength], currentMessages[sharedPrefixLength])) {
|
|
13300
13310
|
sharedPrefixLength += 1;
|
|
13301
13311
|
}
|
|
13302
|
-
if (sharedPrefixLength ===
|
|
13303
|
-
if (sharedPrefixLength ===
|
|
13312
|
+
if (sharedPrefixLength === currentMessages.length) return [];
|
|
13313
|
+
if (sharedPrefixLength === previousMessages.length) return currentMessages.slice(sharedPrefixLength);
|
|
13314
|
+
while (sharedPrefixLength < comparableLength && buildPersistableCliHistorySignature(previousMessages[sharedPrefixLength]) === buildPersistableCliHistorySignature(currentMessages[sharedPrefixLength])) {
|
|
13315
|
+
sharedPrefixLength += 1;
|
|
13316
|
+
}
|
|
13317
|
+
if (sharedPrefixLength === currentMessages.length) return [];
|
|
13318
|
+
if (sharedPrefixLength === previousMessages.length) return currentMessages.slice(sharedPrefixLength);
|
|
13304
13319
|
return currentMessages;
|
|
13305
13320
|
}
|
|
13306
13321
|
var CachedDatabaseSync = null;
|
|
@@ -13546,13 +13561,15 @@ var CliProviderInstance = class {
|
|
|
13546
13561
|
}));
|
|
13547
13562
|
if (!canonicalBackedHistory && !shouldSkipReplayPersist && normalizedMessagesToSave.length > 0) {
|
|
13548
13563
|
const incrementalMessages = buildIncrementalHistoryAppendMessages(this.lastPersistedHistoryMessages, normalizedMessagesToSave);
|
|
13549
|
-
|
|
13550
|
-
this.
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13555
|
-
|
|
13564
|
+
if (incrementalMessages.length > 0) {
|
|
13565
|
+
this.historyWriter.appendNewMessages(
|
|
13566
|
+
this.type,
|
|
13567
|
+
incrementalMessages,
|
|
13568
|
+
parsedStatus?.title || dirName,
|
|
13569
|
+
this.instanceId,
|
|
13570
|
+
this.providerSessionId
|
|
13571
|
+
);
|
|
13572
|
+
}
|
|
13556
13573
|
}
|
|
13557
13574
|
if (!canonicalBackedHistory) {
|
|
13558
13575
|
this.lastPersistedHistoryMessages = normalizedMessagesToSave;
|
|
@@ -13687,8 +13704,8 @@ var CliProviderInstance = class {
|
|
|
13687
13704
|
}
|
|
13688
13705
|
detectStatusTransition() {
|
|
13689
13706
|
const now = Date.now();
|
|
13690
|
-
const adapterStatus = this.adapter.getStatus();
|
|
13691
|
-
const parsedStatus =
|
|
13707
|
+
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
13708
|
+
const parsedStatus = null;
|
|
13692
13709
|
const rawStatus = adapterStatus.status;
|
|
13693
13710
|
const autoApproveActive = rawStatus === "waiting_approval" && this.shouldAutoApprove();
|
|
13694
13711
|
if (autoApproveActive && !this.autoApproveBusy) {
|
|
@@ -13781,7 +13798,7 @@ var CliProviderInstance = class {
|
|
|
13781
13798
|
this.completedDebouncePending = { chatTitle, duration, timestamp: now };
|
|
13782
13799
|
this.completedDebounceTimer = setTimeout(() => {
|
|
13783
13800
|
if (this.completedDebouncePending) {
|
|
13784
|
-
const latestStatus = this.adapter.getStatus();
|
|
13801
|
+
const latestStatus = this.adapter.getStatus({ allowParse: false });
|
|
13785
13802
|
const latestAutoApproveActive = latestStatus.status === "waiting_approval" && this.shouldAutoApprove();
|
|
13786
13803
|
const latestVisibleStatus = latestAutoApproveActive ? "generating" : latestStatus.status;
|
|
13787
13804
|
if (latestVisibleStatus !== "idle") {
|