@adhdev/daemon-core 0.8.47 → 0.8.48

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
@@ -9988,14 +9988,18 @@ var CliProviderInstance = class {
9988
9988
  }
9989
9989
  const runtime = this.adapter.getRuntimeMetadata();
9990
9990
  this.maybeAppendRuntimeRecoveryMessage(runtime);
9991
- const parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
9991
+ let parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
9992
+ const historyMessageCount = Number.isFinite(parsedStatus?.historyMessageCount) ? Math.max(0, Number(parsedStatus.historyMessageCount)) : null;
9993
+ if (historyMessageCount !== null) {
9994
+ parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
9995
+ }
9992
9996
  const controlValues = extractProviderControlValues(this.provider.controls, parsedStatus);
9993
9997
  if (controlValues) {
9994
- this.controlValues = controlValues;
9995
- } else if (Object.keys(this.controlValues).length > 0) {
9996
- this.controlValues = {};
9998
+ this.controlValues = { ...this.controlValues, ...controlValues };
9997
9999
  }
9998
10000
  const mergedMessages = this.mergeConversationMessages(parsedMessages);
10001
+ 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;
10002
+ 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;
9999
10003
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
10000
10004
  if (parsedMessages.length > 0) {
10001
10005
  const shouldSkipReplayPersist = this.suppressIdleHistoryReplay && adapterStatus.status === "idle" && parsedStatus?.status === "idle";
@@ -10032,6 +10036,8 @@ var CliProviderInstance = class {
10032
10036
  inputContent: ""
10033
10037
  },
10034
10038
  workspace: this.workingDir,
10039
+ currentModel,
10040
+ currentPlan,
10035
10041
  instanceId: this.instanceId,
10036
10042
  providerSessionId: this.providerSessionId,
10037
10043
  lastUpdated: Date.now(),
@@ -10221,6 +10227,15 @@ var CliProviderInstance = class {
10221
10227
  }
10222
10228
  applyProviderResponse(data, options) {
10223
10229
  if (!data || typeof data !== "object") return;
10230
+ const patchedProviderSessionId = typeof data.providerSessionId === "string" ? data.providerSessionId.trim() : "";
10231
+ if (patchedProviderSessionId) {
10232
+ this.promoteProviderSessionId(patchedProviderSessionId);
10233
+ }
10234
+ if (data.sessionEvent === "new_session") {
10235
+ this.runtimeMessages = [];
10236
+ this.suppressIdleHistoryReplay = false;
10237
+ this.adapter.clearHistory();
10238
+ }
10224
10239
  const controlValues = extractProviderControlValues(this.provider.controls, data);
10225
10240
  if (controlValues) {
10226
10241
  this.controlValues = { ...this.controlValues, ...controlValues };