@cadraos/sdk 0.3.8 → 0.3.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.
@@ -1624,14 +1624,6 @@ interface AgentChatProps {
1624
1624
  onClarification?: (data: ClarificationData) => void;
1625
1625
  /** Initial messages to populate the chat */
1626
1626
  initialMessages?: ChatMessage$1[];
1627
- /**
1628
- * Extra messages MERGED into the rendered list by timestamp on every render
1629
- * (interleaved chronologically, deduped by id). Use for durable turns that
1630
- * arrive out-of-band on a separate delivery plane — e.g. human-operator /
1631
- * system replies in a webchat handoff — so they don't dock at the bottom.
1632
- * Unlike `initialMessages`, these are NOT seeded into internal state.
1633
- */
1634
- injectedMessages?: ChatMessage$1[];
1635
1627
  /** Placeholder text for the input */
1636
1628
  placeholder?: string;
1637
1629
  /** Welcome message shown when chat is empty */
@@ -1795,7 +1787,7 @@ interface AgentChatProps {
1795
1787
  * />
1796
1788
  * ```
1797
1789
  */
1798
- declare function AgentChat({ agentId, teamId, sessionId, adapter, onMessage, onError, onSessionCreated, onSessionStart, onToolCall, onToolResult, onClarification, initialMessages, placeholder, welcomeMessage, renderWelcome, maxHeight, className, theme, layout, enableAttachments, enableMarkdown, showToolCalls, toolCallVerbosity, markdownComponents, markdownUrlTransform, markdownContentTransform, onImageClick, hideHeader, renderAboveInput, renderBelowMessages, renderMessage, renderToolCall, messageVariant, showThinking, showDelegation, showImages, pollingInterval, pollingEnabled, onDelegation, onAttachmentsReady, hideAvatars, agentName, hideHeaderWhileEmpty, hideTypingIndicator, onInputChange, onInputControlReady, injectedMessages, }: AgentChatProps): react_jsx_runtime.JSX.Element;
1790
+ declare function AgentChat({ agentId, teamId, sessionId, adapter, onMessage, onError, onSessionCreated, onSessionStart, onToolCall, onToolResult, onClarification, initialMessages, placeholder, welcomeMessage, renderWelcome, maxHeight, className, theme, layout, enableAttachments, enableMarkdown, showToolCalls, toolCallVerbosity, markdownComponents, markdownUrlTransform, markdownContentTransform, onImageClick, hideHeader, renderAboveInput, renderBelowMessages, renderMessage, renderToolCall, messageVariant, showThinking, showDelegation, showImages, pollingInterval, pollingEnabled, onDelegation, onAttachmentsReady, hideAvatars, agentName, hideHeaderWhileEmpty, hideTypingIndicator, onInputChange, onInputControlReady, }: AgentChatProps): react_jsx_runtime.JSX.Element;
1799
1791
 
1800
1792
  /**
1801
1793
  * Retry utility with exponential backoff
@@ -3825,6 +3817,13 @@ interface KanbanCard {
3825
3817
  executionId?: string;
3826
3818
  /** Summary of the card's current/last run, if any. */
3827
3819
  run?: KanbanRunSummary;
3820
+ /**
3821
+ * When this card next becomes DUE on a scheduled lane (ISO string) — maps to
3822
+ * `agentic_card.next_due_at` (spec §3a / STORY-003/004). Drives the board's
3823
+ * ⧗ "due" chip: `next_due_at ≤ now` → due (the next sweep will pick it up).
3824
+ * OPTIONAL — absent → no due chip (today's render).
3825
+ */
3826
+ nextDueAt?: string;
3828
3827
  /** Who created the card. */
3829
3828
  createdBy?: string;
3830
3829
  /** When the card was created (ISO string). */
@@ -1624,14 +1624,6 @@ interface AgentChatProps {
1624
1624
  onClarification?: (data: ClarificationData) => void;
1625
1625
  /** Initial messages to populate the chat */
1626
1626
  initialMessages?: ChatMessage$1[];
1627
- /**
1628
- * Extra messages MERGED into the rendered list by timestamp on every render
1629
- * (interleaved chronologically, deduped by id). Use for durable turns that
1630
- * arrive out-of-band on a separate delivery plane — e.g. human-operator /
1631
- * system replies in a webchat handoff — so they don't dock at the bottom.
1632
- * Unlike `initialMessages`, these are NOT seeded into internal state.
1633
- */
1634
- injectedMessages?: ChatMessage$1[];
1635
1627
  /** Placeholder text for the input */
1636
1628
  placeholder?: string;
1637
1629
  /** Welcome message shown when chat is empty */
@@ -1795,7 +1787,7 @@ interface AgentChatProps {
1795
1787
  * />
1796
1788
  * ```
1797
1789
  */
1798
- declare function AgentChat({ agentId, teamId, sessionId, adapter, onMessage, onError, onSessionCreated, onSessionStart, onToolCall, onToolResult, onClarification, initialMessages, placeholder, welcomeMessage, renderWelcome, maxHeight, className, theme, layout, enableAttachments, enableMarkdown, showToolCalls, toolCallVerbosity, markdownComponents, markdownUrlTransform, markdownContentTransform, onImageClick, hideHeader, renderAboveInput, renderBelowMessages, renderMessage, renderToolCall, messageVariant, showThinking, showDelegation, showImages, pollingInterval, pollingEnabled, onDelegation, onAttachmentsReady, hideAvatars, agentName, hideHeaderWhileEmpty, hideTypingIndicator, onInputChange, onInputControlReady, injectedMessages, }: AgentChatProps): react_jsx_runtime.JSX.Element;
1790
+ declare function AgentChat({ agentId, teamId, sessionId, adapter, onMessage, onError, onSessionCreated, onSessionStart, onToolCall, onToolResult, onClarification, initialMessages, placeholder, welcomeMessage, renderWelcome, maxHeight, className, theme, layout, enableAttachments, enableMarkdown, showToolCalls, toolCallVerbosity, markdownComponents, markdownUrlTransform, markdownContentTransform, onImageClick, hideHeader, renderAboveInput, renderBelowMessages, renderMessage, renderToolCall, messageVariant, showThinking, showDelegation, showImages, pollingInterval, pollingEnabled, onDelegation, onAttachmentsReady, hideAvatars, agentName, hideHeaderWhileEmpty, hideTypingIndicator, onInputChange, onInputControlReady, }: AgentChatProps): react_jsx_runtime.JSX.Element;
1799
1791
 
1800
1792
  /**
1801
1793
  * Retry utility with exponential backoff
@@ -3825,6 +3817,13 @@ interface KanbanCard {
3825
3817
  executionId?: string;
3826
3818
  /** Summary of the card's current/last run, if any. */
3827
3819
  run?: KanbanRunSummary;
3820
+ /**
3821
+ * When this card next becomes DUE on a scheduled lane (ISO string) — maps to
3822
+ * `agentic_card.next_due_at` (spec §3a / STORY-003/004). Drives the board's
3823
+ * ⧗ "due" chip: `next_due_at ≤ now` → due (the next sweep will pick it up).
3824
+ * OPTIONAL — absent → no due chip (today's render).
3825
+ */
3826
+ nextDueAt?: string;
3828
3827
  /** Who created the card. */
3829
3828
  createdBy?: string;
3830
3829
  /** When the card was created (ISO string). */
@@ -682,15 +682,6 @@ var ExecutionStreamControllerImpl = class {
682
682
  sseClient = null;
683
683
  status = "connecting";
684
684
  reconnectAttempts = 0;
685
- // CAD-39 / webchat dual-plane create-connect race. `hasConnected` flips true on
686
- // the first successful SSE open; `notFoundRetries` bounds retries of a 404
687
- // encountered BEFORE we ever connect (the run row is persisted slightly AFTER
688
- // the client opens the stream — the norm on the webchat path where msg-api owns
689
- // the executionId and cadra persists the agent_executions row via an async
690
- // worker callback). See handleConnectionError.
691
- hasConnected = false;
692
- notFoundRetries = 0;
693
- maxConnectRaceRetries = 3;
694
685
  seenEventIds = /* @__PURE__ */ new Set();
695
686
  _lastEventId = null;
696
687
  activityTimeoutId = null;
@@ -830,8 +821,6 @@ var ExecutionStreamControllerImpl = class {
830
821
  if (connected) {
831
822
  this.status = "connected";
832
823
  this.reconnectAttempts = 0;
833
- this.hasConnected = true;
834
- this.notFoundRetries = 0;
835
824
  this.resetActivityTimeout();
836
825
  }
837
826
  this.emit("connectionChange", { connected, usingFallback: false });
@@ -1121,38 +1110,6 @@ var ExecutionStreamControllerImpl = class {
1121
1110
  return;
1122
1111
  }
1123
1112
  const msg = error instanceof Error ? error.message : String(error);
1124
- const isNotFound = /\b404\b/.test(msg);
1125
- const isAuthFailure = /\b40[13]\b/.test(msg) || /INVALID_API_KEY|INVALID_REQUEST/.test(msg);
1126
- if (isNotFound && !isAuthFailure && !this.hasConnected) {
1127
- if (this.notFoundRetries < this.maxConnectRaceRetries) {
1128
- this.notFoundRetries++;
1129
- this.status = "reconnecting";
1130
- const delay = Math.min(
1131
- this.config.reconnectBaseDelayMs * this.notFoundRetries,
1132
- this.config.reconnectMaxDelayMs
1133
- );
1134
- await new Promise((resolve) => setTimeout(resolve, delay));
1135
- if (this.status === "closed") {
1136
- return;
1137
- }
1138
- try {
1139
- await this.connectSSE();
1140
- } catch (retryError) {
1141
- await this.handleConnectionError(retryError);
1142
- }
1143
- return;
1144
- }
1145
- if (this.pollingEnabled) {
1146
- if (this.sseClient) {
1147
- this.sseClient.disconnect();
1148
- this.sseClient = null;
1149
- }
1150
- this.status = "fallback_polling";
1151
- this.emit("connectionChange", { connected: false, usingFallback: true });
1152
- this.startPolling();
1153
- return;
1154
- }
1155
- }
1156
1113
  if (/\b4\d\d\b/.test(msg) || /INVALID_API_KEY|INVALID_REQUEST/.test(msg)) {
1157
1114
  if (this.sseClient) {
1158
1115
  this.sseClient.disconnect();
@@ -1402,6 +1359,7 @@ var AgentsAPI = class extends BaseResourceAPI {
1402
1359
  super(http, "/api/v1/agents");
1403
1360
  this.getStreamConfig = getStreamConfig;
1404
1361
  }
1362
+ getStreamConfig;
1405
1363
  // ===== LIST Operations =====
1406
1364
  /**
1407
1365
  * List all agents in the organization
@@ -2307,6 +2265,7 @@ var SessionsAPI = class extends BaseResourceAPI {
2307
2265
  super(http, "/api/v1/sessions");
2308
2266
  this.getStreamConfig = getStreamConfig;
2309
2267
  }
2268
+ getStreamConfig;
2310
2269
  // ===== LIST Operations =====
2311
2270
  /**
2312
2271
  * List all sessions in the organization
@@ -2626,6 +2585,7 @@ var KanbanAPI = class extends BaseResourceAPI {
2626
2585
  super(http, "/api/v1/kanban");
2627
2586
  this.getStreamConfig = getStreamConfig;
2628
2587
  }
2588
+ getStreamConfig;
2629
2589
  // ===== BOARD =====
2630
2590
  /**
2631
2591
  * Get the current org's board (lanes in declared order). Auto-provisions
@@ -2827,6 +2787,7 @@ var RemoteAgentsAPI = class extends BaseResourceAPI {
2827
2787
  super(http, "/api/v1/remote-agents");
2828
2788
  this.getStreamConfig = getStreamConfig;
2829
2789
  }
2790
+ getStreamConfig;
2830
2791
  /**
2831
2792
  * List all remote agents in the organization
2832
2793
  *
@@ -8630,8 +8591,7 @@ function AgentChat({
8630
8591
  hideHeaderWhileEmpty = false,
8631
8592
  hideTypingIndicator = false,
8632
8593
  onInputChange,
8633
- onInputControlReady,
8634
- injectedMessages
8594
+ onInputControlReady
8635
8595
  }) {
8636
8596
  const {
8637
8597
  messages,
@@ -8695,9 +8655,8 @@ function AgentChat({
8695
8655
  },
8696
8656
  [enableAttachments, attachments, sendMessage]
8697
8657
  );
8698
- const renderedMessages = injectedMessages && injectedMessages.length > 0 ? [...messages, ...injectedMessages].filter((m, i, arr) => arr.findIndex((x) => x.id === m.id) === i).sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime()) : messages;
8699
8658
  const messageListProps = {
8700
- messages: renderedMessages,
8659
+ messages,
8701
8660
  welcomeMessage: hideHeader ? void 0 : welcomeMessage,
8702
8661
  renderWelcome: hideHeader ? void 0 : renderWelcome,
8703
8662
  isLoading,