@adhdev/daemon-core 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 +56 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -2
- package/dist/index.mjs.map +1 -1
- package/dist/providers/provider-loader.d.ts +1 -0
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/commands/chat-commands.ts +54 -0
- package/src/providers/provider-loader.ts +18 -2
package/dist/index.mjs
CHANGED
|
@@ -10356,6 +10356,26 @@ function toHistoryPersistedMessages(messages) {
|
|
|
10356
10356
|
historyDedupKey: deriveHistoryDedupKey(message)
|
|
10357
10357
|
}));
|
|
10358
10358
|
}
|
|
10359
|
+
function findLastMessageIndexBySignature(messages, signature) {
|
|
10360
|
+
if (!signature) return -1;
|
|
10361
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
10362
|
+
if (getChatMessageSignature(messages[index]) === signature) {
|
|
10363
|
+
return index;
|
|
10364
|
+
}
|
|
10365
|
+
}
|
|
10366
|
+
return -1;
|
|
10367
|
+
}
|
|
10368
|
+
function buildBoundedTailSync(messages, cursor) {
|
|
10369
|
+
const totalMessages = messages.length;
|
|
10370
|
+
const tailMessages = cursor.tailLimit > 0 && totalMessages > cursor.tailLimit ? messages.slice(-cursor.tailLimit) : messages;
|
|
10371
|
+
return {
|
|
10372
|
+
syncMode: "full",
|
|
10373
|
+
replaceFrom: 0,
|
|
10374
|
+
messages: tailMessages,
|
|
10375
|
+
totalMessages,
|
|
10376
|
+
lastMessageSignature: getChatMessageSignature(messages[totalMessages - 1])
|
|
10377
|
+
};
|
|
10378
|
+
}
|
|
10359
10379
|
function computeReadChatSync(messages, cursor) {
|
|
10360
10380
|
const totalMessages = messages.length;
|
|
10361
10381
|
const lastMessageSignature = getChatMessageSignature(messages[totalMessages - 1]);
|
|
@@ -10387,6 +10407,15 @@ function computeReadChatSync(messages, cursor) {
|
|
|
10387
10407
|
lastMessageSignature
|
|
10388
10408
|
};
|
|
10389
10409
|
}
|
|
10410
|
+
if (cursor.tailLimit > 0 && knownSignature === lastMessageSignature) {
|
|
10411
|
+
return {
|
|
10412
|
+
syncMode: "noop",
|
|
10413
|
+
replaceFrom: totalMessages,
|
|
10414
|
+
messages: [],
|
|
10415
|
+
totalMessages,
|
|
10416
|
+
lastMessageSignature
|
|
10417
|
+
};
|
|
10418
|
+
}
|
|
10390
10419
|
if (knownMessageCount < totalMessages) {
|
|
10391
10420
|
const anchorSignature = getChatMessageSignature(messages[knownMessageCount - 1]);
|
|
10392
10421
|
if (anchorSignature === knownSignature) {
|
|
@@ -10398,6 +10427,19 @@ function computeReadChatSync(messages, cursor) {
|
|
|
10398
10427
|
lastMessageSignature
|
|
10399
10428
|
};
|
|
10400
10429
|
}
|
|
10430
|
+
if (cursor.tailLimit > 0) {
|
|
10431
|
+
const signatureIndex = findLastMessageIndexBySignature(messages, knownSignature);
|
|
10432
|
+
if (signatureIndex >= 0) {
|
|
10433
|
+
return {
|
|
10434
|
+
syncMode: "append",
|
|
10435
|
+
replaceFrom: knownMessageCount,
|
|
10436
|
+
messages: messages.slice(signatureIndex + 1),
|
|
10437
|
+
totalMessages,
|
|
10438
|
+
lastMessageSignature
|
|
10439
|
+
};
|
|
10440
|
+
}
|
|
10441
|
+
return buildBoundedTailSync(messages, cursor);
|
|
10442
|
+
}
|
|
10401
10443
|
}
|
|
10402
10444
|
const replaceFrom = Math.max(0, Math.min(knownMessageCount - 1, totalMessages));
|
|
10403
10445
|
return {
|
|
@@ -16403,10 +16445,22 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
16403
16445
|
setMachineProviderEnabled(type, enabled) {
|
|
16404
16446
|
return this.setMachineProviderConfig(type, { enabled });
|
|
16405
16447
|
}
|
|
16448
|
+
getEffectiveProviderAvailability(type) {
|
|
16449
|
+
const providerType = this.resolveAlias(type);
|
|
16450
|
+
const availability = this.providerAvailability.get(providerType);
|
|
16451
|
+
if (availability) return availability;
|
|
16452
|
+
const machineConfig = this.getMachineProviderConfig(providerType);
|
|
16453
|
+
const lastDetection = machineConfig.lastDetection;
|
|
16454
|
+
if (!lastDetection) return void 0;
|
|
16455
|
+
return {
|
|
16456
|
+
installed: lastDetection.ok === true,
|
|
16457
|
+
detectedPath: typeof lastDetection.path === "string" && lastDetection.path.trim() ? lastDetection.path.trim() : null
|
|
16458
|
+
};
|
|
16459
|
+
}
|
|
16406
16460
|
getMachineProviderStatus(type) {
|
|
16407
16461
|
const providerType = this.resolveAlias(type);
|
|
16408
16462
|
if (!this.isMachineProviderEnabled(providerType)) return "disabled";
|
|
16409
|
-
const availability = this.
|
|
16463
|
+
const availability = this.getEffectiveProviderAvailability(providerType);
|
|
16410
16464
|
if (!availability) return "enabled_unchecked";
|
|
16411
16465
|
return availability.installed ? "detected" : "not_detected";
|
|
16412
16466
|
}
|
|
@@ -16534,7 +16588,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
16534
16588
|
}
|
|
16535
16589
|
getAvailableProviderInfos() {
|
|
16536
16590
|
return this.getAll().map((provider) => {
|
|
16537
|
-
const availability = this.
|
|
16591
|
+
const availability = this.getEffectiveProviderAvailability(provider.type);
|
|
16538
16592
|
const enabled = this.isMachineProviderEnabled(provider.type);
|
|
16539
16593
|
const machineConfig = this.getMachineProviderConfig(provider.type);
|
|
16540
16594
|
return {
|