@adhdev/daemon-standalone 0.8.47 → 0.8.49

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
@@ -37718,14 +37718,18 @@ ${effect.notification.body || ""}`.trim();
37718
37718
  }
37719
37719
  const runtime = this.adapter.getRuntimeMetadata();
37720
37720
  this.maybeAppendRuntimeRecoveryMessage(runtime);
37721
- const parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
37721
+ let parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
37722
+ const historyMessageCount = Number.isFinite(parsedStatus?.historyMessageCount) ? Math.max(0, Number(parsedStatus.historyMessageCount)) : null;
37723
+ if (historyMessageCount !== null) {
37724
+ parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
37725
+ }
37722
37726
  const controlValues = extractProviderControlValues(this.provider.controls, parsedStatus);
37723
37727
  if (controlValues) {
37724
- this.controlValues = controlValues;
37725
- } else if (Object.keys(this.controlValues).length > 0) {
37726
- this.controlValues = {};
37728
+ this.controlValues = { ...this.controlValues, ...controlValues };
37727
37729
  }
37728
37730
  const mergedMessages = this.mergeConversationMessages(parsedMessages);
37731
+ const currentModel = typeof parsedStatus?.model === "string" && parsedStatus.model.trim() ? parsedStatus.model.trim() : typeof this.controlValues.model === "string" && this.controlValues.model.trim() ? this.controlValues.model.trim() : void 0;
37732
+ const currentPlan = typeof parsedStatus?.mode === "string" && parsedStatus.mode.trim() ? parsedStatus.mode.trim() : typeof this.controlValues.mode === "string" && this.controlValues.mode.trim() ? this.controlValues.mode.trim() : void 0;
37729
37733
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
37730
37734
  if (parsedMessages.length > 0) {
37731
37735
  const shouldSkipReplayPersist = this.suppressIdleHistoryReplay && adapterStatus.status === "idle" && parsedStatus?.status === "idle";
@@ -37762,6 +37766,8 @@ ${effect.notification.body || ""}`.trim();
37762
37766
  inputContent: ""
37763
37767
  },
37764
37768
  workspace: this.workingDir,
37769
+ currentModel,
37770
+ currentPlan,
37765
37771
  instanceId: this.instanceId,
37766
37772
  providerSessionId: this.providerSessionId,
37767
37773
  lastUpdated: Date.now(),
@@ -37951,6 +37957,15 @@ ${effect.notification.body || ""}`.trim();
37951
37957
  }
37952
37958
  applyProviderResponse(data, options) {
37953
37959
  if (!data || typeof data !== "object") return;
37960
+ const patchedProviderSessionId = typeof data.providerSessionId === "string" ? data.providerSessionId.trim() : "";
37961
+ if (patchedProviderSessionId) {
37962
+ this.promoteProviderSessionId(patchedProviderSessionId);
37963
+ }
37964
+ if (data.sessionEvent === "new_session") {
37965
+ this.runtimeMessages = [];
37966
+ this.suppressIdleHistoryReplay = false;
37967
+ this.adapter.clearHistory();
37968
+ }
37954
37969
  const controlValues = extractProviderControlValues(this.provider.controls, data);
37955
37970
  if (controlValues) {
37956
37971
  this.controlValues = { ...this.controlValues, ...controlValues };