adhdev 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/cli/index.js CHANGED
@@ -7981,6 +7981,26 @@ function toHistoryPersistedMessages(messages) {
7981
7981
  historyDedupKey: deriveHistoryDedupKey(message)
7982
7982
  }));
7983
7983
  }
7984
+ function findLastMessageIndexBySignature(messages, signature) {
7985
+ if (!signature) return -1;
7986
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
7987
+ if (getChatMessageSignature(messages[index]) === signature) {
7988
+ return index;
7989
+ }
7990
+ }
7991
+ return -1;
7992
+ }
7993
+ function buildBoundedTailSync(messages, cursor) {
7994
+ const totalMessages = messages.length;
7995
+ const tailMessages = cursor.tailLimit > 0 && totalMessages > cursor.tailLimit ? messages.slice(-cursor.tailLimit) : messages;
7996
+ return {
7997
+ syncMode: "full",
7998
+ replaceFrom: 0,
7999
+ messages: tailMessages,
8000
+ totalMessages,
8001
+ lastMessageSignature: getChatMessageSignature(messages[totalMessages - 1])
8002
+ };
8003
+ }
7984
8004
  function computeReadChatSync(messages, cursor) {
7985
8005
  const totalMessages = messages.length;
7986
8006
  const lastMessageSignature = getChatMessageSignature(messages[totalMessages - 1]);
@@ -8012,6 +8032,15 @@ function computeReadChatSync(messages, cursor) {
8012
8032
  lastMessageSignature
8013
8033
  };
8014
8034
  }
8035
+ if (cursor.tailLimit > 0 && knownSignature === lastMessageSignature) {
8036
+ return {
8037
+ syncMode: "noop",
8038
+ replaceFrom: totalMessages,
8039
+ messages: [],
8040
+ totalMessages,
8041
+ lastMessageSignature
8042
+ };
8043
+ }
8015
8044
  if (knownMessageCount < totalMessages) {
8016
8045
  const anchorSignature = getChatMessageSignature(messages[knownMessageCount - 1]);
8017
8046
  if (anchorSignature === knownSignature) {
@@ -8023,6 +8052,19 @@ function computeReadChatSync(messages, cursor) {
8023
8052
  lastMessageSignature
8024
8053
  };
8025
8054
  }
8055
+ if (cursor.tailLimit > 0) {
8056
+ const signatureIndex = findLastMessageIndexBySignature(messages, knownSignature);
8057
+ if (signatureIndex >= 0) {
8058
+ return {
8059
+ syncMode: "append",
8060
+ replaceFrom: knownMessageCount,
8061
+ messages: messages.slice(signatureIndex + 1),
8062
+ totalMessages,
8063
+ lastMessageSignature
8064
+ };
8065
+ }
8066
+ return buildBoundedTailSync(messages, cursor);
8067
+ }
8026
8068
  }
8027
8069
  const replaceFrom = Math.max(0, Math.min(knownMessageCount - 1, totalMessages));
8028
8070
  return {
@@ -36425,10 +36467,22 @@ var init_provider_loader = __esm({
36425
36467
  setMachineProviderEnabled(type, enabled) {
36426
36468
  return this.setMachineProviderConfig(type, { enabled });
36427
36469
  }
36470
+ getEffectiveProviderAvailability(type) {
36471
+ const providerType = this.resolveAlias(type);
36472
+ const availability = this.providerAvailability.get(providerType);
36473
+ if (availability) return availability;
36474
+ const machineConfig = this.getMachineProviderConfig(providerType);
36475
+ const lastDetection = machineConfig.lastDetection;
36476
+ if (!lastDetection) return void 0;
36477
+ return {
36478
+ installed: lastDetection.ok === true,
36479
+ detectedPath: typeof lastDetection.path === "string" && lastDetection.path.trim() ? lastDetection.path.trim() : null
36480
+ };
36481
+ }
36428
36482
  getMachineProviderStatus(type) {
36429
36483
  const providerType = this.resolveAlias(type);
36430
36484
  if (!this.isMachineProviderEnabled(providerType)) return "disabled";
36431
- const availability = this.providerAvailability.get(providerType);
36485
+ const availability = this.getEffectiveProviderAvailability(providerType);
36432
36486
  if (!availability) return "enabled_unchecked";
36433
36487
  return availability.installed ? "detected" : "not_detected";
36434
36488
  }
@@ -36556,7 +36610,7 @@ var init_provider_loader = __esm({
36556
36610
  }
36557
36611
  getAvailableProviderInfos() {
36558
36612
  return this.getAll().map((provider) => {
36559
- const availability = this.providerAvailability.get(provider.type);
36613
+ const availability = this.getEffectiveProviderAvailability(provider.type);
36560
36614
  const enabled = this.isMachineProviderEnabled(provider.type);
36561
36615
  const machineConfig = this.getMachineProviderConfig(provider.type);
36562
36616
  return {
@@ -87839,7 +87893,7 @@ var init_adhdev_daemon = __esm({
87839
87893
  init_version();
87840
87894
  init_src();
87841
87895
  init_runtime_defaults();
87842
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.32" });
87896
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.33" });
87843
87897
  AdhdevDaemon = class _AdhdevDaemon {
87844
87898
  localHttpServer = null;
87845
87899
  localWss = null;