@adhdev/daemon-core 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.mjs CHANGED
@@ -9901,14 +9901,18 @@ var CliProviderInstance = class {
9901
9901
  }
9902
9902
  const runtime = this.adapter.getRuntimeMetadata();
9903
9903
  this.maybeAppendRuntimeRecoveryMessage(runtime);
9904
- const parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
9904
+ let parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
9905
+ const historyMessageCount = Number.isFinite(parsedStatus?.historyMessageCount) ? Math.max(0, Number(parsedStatus.historyMessageCount)) : null;
9906
+ if (historyMessageCount !== null) {
9907
+ parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
9908
+ }
9905
9909
  const controlValues = extractProviderControlValues(this.provider.controls, parsedStatus);
9906
9910
  if (controlValues) {
9907
- this.controlValues = controlValues;
9908
- } else if (Object.keys(this.controlValues).length > 0) {
9909
- this.controlValues = {};
9911
+ this.controlValues = { ...this.controlValues, ...controlValues };
9910
9912
  }
9911
9913
  const mergedMessages = this.mergeConversationMessages(parsedMessages);
9914
+ 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;
9915
+ 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;
9912
9916
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
9913
9917
  if (parsedMessages.length > 0) {
9914
9918
  const shouldSkipReplayPersist = this.suppressIdleHistoryReplay && adapterStatus.status === "idle" && parsedStatus?.status === "idle";
@@ -9945,6 +9949,8 @@ var CliProviderInstance = class {
9945
9949
  inputContent: ""
9946
9950
  },
9947
9951
  workspace: this.workingDir,
9952
+ currentModel,
9953
+ currentPlan,
9948
9954
  instanceId: this.instanceId,
9949
9955
  providerSessionId: this.providerSessionId,
9950
9956
  lastUpdated: Date.now(),
@@ -10134,6 +10140,15 @@ var CliProviderInstance = class {
10134
10140
  }
10135
10141
  applyProviderResponse(data, options) {
10136
10142
  if (!data || typeof data !== "object") return;
10143
+ const patchedProviderSessionId = typeof data.providerSessionId === "string" ? data.providerSessionId.trim() : "";
10144
+ if (patchedProviderSessionId) {
10145
+ this.promoteProviderSessionId(patchedProviderSessionId);
10146
+ }
10147
+ if (data.sessionEvent === "new_session") {
10148
+ this.runtimeMessages = [];
10149
+ this.suppressIdleHistoryReplay = false;
10150
+ this.adapter.clearHistory();
10151
+ }
10137
10152
  const controlValues = extractProviderControlValues(this.provider.controls, data);
10138
10153
  if (controlValues) {
10139
10154
  this.controlValues = { ...this.controlValues, ...controlValues };