@adhdev/daemon-standalone 0.9.32 → 0.9.33
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
CHANGED
|
@@ -38292,6 +38292,26 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38292
38292
|
historyDedupKey: deriveHistoryDedupKey(message)
|
|
38293
38293
|
}));
|
|
38294
38294
|
}
|
|
38295
|
+
function findLastMessageIndexBySignature(messages, signature) {
|
|
38296
|
+
if (!signature) return -1;
|
|
38297
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
38298
|
+
if (getChatMessageSignature(messages[index]) === signature) {
|
|
38299
|
+
return index;
|
|
38300
|
+
}
|
|
38301
|
+
}
|
|
38302
|
+
return -1;
|
|
38303
|
+
}
|
|
38304
|
+
function buildBoundedTailSync(messages, cursor) {
|
|
38305
|
+
const totalMessages = messages.length;
|
|
38306
|
+
const tailMessages = cursor.tailLimit > 0 && totalMessages > cursor.tailLimit ? messages.slice(-cursor.tailLimit) : messages;
|
|
38307
|
+
return {
|
|
38308
|
+
syncMode: "full",
|
|
38309
|
+
replaceFrom: 0,
|
|
38310
|
+
messages: tailMessages,
|
|
38311
|
+
totalMessages,
|
|
38312
|
+
lastMessageSignature: getChatMessageSignature(messages[totalMessages - 1])
|
|
38313
|
+
};
|
|
38314
|
+
}
|
|
38295
38315
|
function computeReadChatSync(messages, cursor) {
|
|
38296
38316
|
const totalMessages = messages.length;
|
|
38297
38317
|
const lastMessageSignature = getChatMessageSignature(messages[totalMessages - 1]);
|
|
@@ -38323,6 +38343,15 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38323
38343
|
lastMessageSignature
|
|
38324
38344
|
};
|
|
38325
38345
|
}
|
|
38346
|
+
if (cursor.tailLimit > 0 && knownSignature === lastMessageSignature) {
|
|
38347
|
+
return {
|
|
38348
|
+
syncMode: "noop",
|
|
38349
|
+
replaceFrom: totalMessages,
|
|
38350
|
+
messages: [],
|
|
38351
|
+
totalMessages,
|
|
38352
|
+
lastMessageSignature
|
|
38353
|
+
};
|
|
38354
|
+
}
|
|
38326
38355
|
if (knownMessageCount < totalMessages) {
|
|
38327
38356
|
const anchorSignature = getChatMessageSignature(messages[knownMessageCount - 1]);
|
|
38328
38357
|
if (anchorSignature === knownSignature) {
|
|
@@ -38334,6 +38363,19 @@ ${effect.notification.body || ""}`.trim();
|
|
|
38334
38363
|
lastMessageSignature
|
|
38335
38364
|
};
|
|
38336
38365
|
}
|
|
38366
|
+
if (cursor.tailLimit > 0) {
|
|
38367
|
+
const signatureIndex = findLastMessageIndexBySignature(messages, knownSignature);
|
|
38368
|
+
if (signatureIndex >= 0) {
|
|
38369
|
+
return {
|
|
38370
|
+
syncMode: "append",
|
|
38371
|
+
replaceFrom: knownMessageCount,
|
|
38372
|
+
messages: messages.slice(signatureIndex + 1),
|
|
38373
|
+
totalMessages,
|
|
38374
|
+
lastMessageSignature
|
|
38375
|
+
};
|
|
38376
|
+
}
|
|
38377
|
+
return buildBoundedTailSync(messages, cursor);
|
|
38378
|
+
}
|
|
38337
38379
|
}
|
|
38338
38380
|
const replaceFrom = Math.max(0, Math.min(knownMessageCount - 1, totalMessages));
|
|
38339
38381
|
return {
|
|
@@ -44296,10 +44338,22 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44296
44338
|
setMachineProviderEnabled(type, enabled) {
|
|
44297
44339
|
return this.setMachineProviderConfig(type, { enabled });
|
|
44298
44340
|
}
|
|
44341
|
+
getEffectiveProviderAvailability(type) {
|
|
44342
|
+
const providerType = this.resolveAlias(type);
|
|
44343
|
+
const availability = this.providerAvailability.get(providerType);
|
|
44344
|
+
if (availability) return availability;
|
|
44345
|
+
const machineConfig = this.getMachineProviderConfig(providerType);
|
|
44346
|
+
const lastDetection = machineConfig.lastDetection;
|
|
44347
|
+
if (!lastDetection) return void 0;
|
|
44348
|
+
return {
|
|
44349
|
+
installed: lastDetection.ok === true,
|
|
44350
|
+
detectedPath: typeof lastDetection.path === "string" && lastDetection.path.trim() ? lastDetection.path.trim() : null
|
|
44351
|
+
};
|
|
44352
|
+
}
|
|
44299
44353
|
getMachineProviderStatus(type) {
|
|
44300
44354
|
const providerType = this.resolveAlias(type);
|
|
44301
44355
|
if (!this.isMachineProviderEnabled(providerType)) return "disabled";
|
|
44302
|
-
const availability = this.
|
|
44356
|
+
const availability = this.getEffectiveProviderAvailability(providerType);
|
|
44303
44357
|
if (!availability) return "enabled_unchecked";
|
|
44304
44358
|
return availability.installed ? "detected" : "not_detected";
|
|
44305
44359
|
}
|
|
@@ -44427,7 +44481,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44427
44481
|
}
|
|
44428
44482
|
getAvailableProviderInfos() {
|
|
44429
44483
|
return this.getAll().map((provider) => {
|
|
44430
|
-
const availability = this.
|
|
44484
|
+
const availability = this.getEffectiveProviderAvailability(provider.type);
|
|
44431
44485
|
const enabled = this.isMachineProviderEnabled(provider.type);
|
|
44432
44486
|
const machineConfig = this.getMachineProviderConfig(provider.type);
|
|
44433
44487
|
return {
|