@adhdev/daemon-standalone 0.9.7 → 0.9.9

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
@@ -28719,6 +28719,18 @@ var require_dist2 = __commonJS({
28719
28719
  }
28720
28720
  return role;
28721
28721
  }
28722
+ function validateBubbleState(state, source, index) {
28723
+ if (typeof state !== "string" || !VALID_BUBBLE_STATES.includes(state)) {
28724
+ throw new Error(`${source}: messages[${index}].bubbleState must be one of ${VALID_BUBBLE_STATES.join(", ")}`);
28725
+ }
28726
+ return state;
28727
+ }
28728
+ function validateTurnStatus(turnStatus, source) {
28729
+ if (typeof turnStatus !== "string" || !VALID_TURN_STATUSES.includes(turnStatus)) {
28730
+ throw new Error(`${source}: turnStatus must be one of ${VALID_TURN_STATUSES.join(", ")}`);
28731
+ }
28732
+ return turnStatus;
28733
+ }
28722
28734
  function validateMessageContent(content, source, index) {
28723
28735
  if (typeof content === "string") return content;
28724
28736
  if (Array.isArray(content)) return normalizeMessageParts(content);
@@ -28734,6 +28746,9 @@ var require_dist2 = __commonJS({
28734
28746
  };
28735
28747
  if (typeof message.kind === "string") normalized.kind = message.kind;
28736
28748
  if (typeof message.id === "string") normalized.id = message.id;
28749
+ if (typeof message.bubbleId === "string") normalized.bubbleId = message.bubbleId;
28750
+ if (typeof message.providerUnitKey === "string") normalized.providerUnitKey = message.providerUnitKey;
28751
+ if (message.bubbleState !== void 0) normalized.bubbleState = validateBubbleState(message.bubbleState, source, index);
28737
28752
  if (isFiniteNumber(message.index)) normalized.index = message.index;
28738
28753
  if (isFiniteNumber(message.timestamp)) normalized.timestamp = message.timestamp;
28739
28754
  if (isFiniteNumber(message.receivedAt)) normalized.receivedAt = message.receivedAt;
@@ -28801,6 +28816,8 @@ var require_dist2 = __commonJS({
28801
28816
  if (activeModal !== void 0) normalized.activeModal = activeModal;
28802
28817
  if (typeof raw.id === "string") normalized.id = raw.id;
28803
28818
  if (typeof raw.title === "string") normalized.title = raw.title;
28819
+ if (typeof raw.currentTurnId === "string") normalized.currentTurnId = raw.currentTurnId;
28820
+ if (raw.turnStatus !== void 0) normalized.turnStatus = validateTurnStatus(raw.turnStatus, source);
28804
28821
  if (typeof raw.agentType === "string") normalized.agentType = raw.agentType;
28805
28822
  if (typeof raw.agentName === "string") normalized.agentName = raw.agentName;
28806
28823
  if (typeof raw.extensionId === "string") normalized.extensionId = raw.extensionId;
@@ -28815,12 +28832,16 @@ var require_dist2 = __commonJS({
28815
28832
  }
28816
28833
  var VALID_STATUSES;
28817
28834
  var VALID_ROLES;
28835
+ var VALID_BUBBLE_STATES;
28836
+ var VALID_TURN_STATUSES;
28818
28837
  var init_read_chat_contract = __esm2({
28819
28838
  "src/providers/read-chat-contract.ts"() {
28820
28839
  "use strict";
28821
28840
  init_contracts();
28822
28841
  VALID_STATUSES = ["idle", "generating", "waiting_approval", "error", "panel_hidden", "streaming", "long_generating"];
28823
28842
  VALID_ROLES = ["user", "assistant", "system", "human"];
28843
+ VALID_BUBBLE_STATES = ["draft", "streaming", "final", "removed"];
28844
+ VALID_TURN_STATUSES = ["open", "waiting_approval", "complete", "error"];
28824
28845
  }
28825
28846
  });
28826
28847
  function normalizeCategories(categories) {
@@ -30507,7 +30528,8 @@ var require_dist2 = __commonJS({
30507
30528
  );
30508
30529
  const parsedModal = parsedTranscript?.activeModal && Array.isArray(parsedTranscript.activeModal.buttons) && parsedTranscript.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsedTranscript.activeModal : null;
30509
30530
  const modal = this.runParseApproval(tail) || parsedModal;
30510
- const scriptStatus = this.runDetectStatus(tail);
30531
+ const rawScriptStatus = this.runDetectStatus(tail);
30532
+ const scriptStatus = parsedTranscript?.status === "waiting_approval" && modal ? "waiting_approval" : rawScriptStatus;
30511
30533
  const parsedMessages = Array.isArray(parsedTranscript?.messages) ? normalizeCliParsedMessages(parsedTranscript.messages, {
30512
30534
  committedMessages: this.committedMessages,
30513
30535
  scope: this.currentTurnScope,