adhdev 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
@@ -10285,14 +10285,18 @@ var init_cli_provider_instance = __esm({
10285
10285
  }
10286
10286
  const runtime = this.adapter.getRuntimeMetadata();
10287
10287
  this.maybeAppendRuntimeRecoveryMessage(runtime);
10288
- const parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
10288
+ let parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
10289
+ const historyMessageCount = Number.isFinite(parsedStatus?.historyMessageCount) ? Math.max(0, Number(parsedStatus.historyMessageCount)) : null;
10290
+ if (historyMessageCount !== null) {
10291
+ parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
10292
+ }
10289
10293
  const controlValues = extractProviderControlValues(this.provider.controls, parsedStatus);
10290
10294
  if (controlValues) {
10291
- this.controlValues = controlValues;
10292
- } else if (Object.keys(this.controlValues).length > 0) {
10293
- this.controlValues = {};
10295
+ this.controlValues = { ...this.controlValues, ...controlValues };
10294
10296
  }
10295
10297
  const mergedMessages = this.mergeConversationMessages(parsedMessages);
10298
+ 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;
10299
+ 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;
10296
10300
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
10297
10301
  if (parsedMessages.length > 0) {
10298
10302
  const shouldSkipReplayPersist = this.suppressIdleHistoryReplay && adapterStatus.status === "idle" && parsedStatus?.status === "idle";
@@ -10329,6 +10333,8 @@ var init_cli_provider_instance = __esm({
10329
10333
  inputContent: ""
10330
10334
  },
10331
10335
  workspace: this.workingDir,
10336
+ currentModel,
10337
+ currentPlan,
10332
10338
  instanceId: this.instanceId,
10333
10339
  providerSessionId: this.providerSessionId,
10334
10340
  lastUpdated: Date.now(),
@@ -10518,6 +10524,15 @@ var init_cli_provider_instance = __esm({
10518
10524
  }
10519
10525
  applyProviderResponse(data, options) {
10520
10526
  if (!data || typeof data !== "object") return;
10527
+ const patchedProviderSessionId = typeof data.providerSessionId === "string" ? data.providerSessionId.trim() : "";
10528
+ if (patchedProviderSessionId) {
10529
+ this.promoteProviderSessionId(patchedProviderSessionId);
10530
+ }
10531
+ if (data.sessionEvent === "new_session") {
10532
+ this.runtimeMessages = [];
10533
+ this.suppressIdleHistoryReplay = false;
10534
+ this.adapter.clearHistory();
10535
+ }
10521
10536
  const controlValues = extractProviderControlValues(this.provider.controls, data);
10522
10537
  if (controlValues) {
10523
10538
  this.controlValues = { ...this.controlValues, ...controlValues };
@@ -49543,7 +49558,7 @@ var init_adhdev_daemon = __esm({
49543
49558
  import_ws3 = require("ws");
49544
49559
  import_chalk2 = __toESM(require("chalk"));
49545
49560
  init_version();
49546
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.47" });
49561
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.48" });
49547
49562
  ACTIVE_CHAT_POLL_STATUSES = /* @__PURE__ */ new Set([
49548
49563
  "generating",
49549
49564
  "waiting_approval",