@copilotkit/react-core 1.56.5-canary.1777984472 → 1.56.5-canary.1777990461

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.
@@ -5641,16 +5641,28 @@ const DEFAULT_TOOL_PATTERNS = [/^bash$/];
5641
5641
  * in the SDK's run-tracking map.)
5642
5642
  *
5643
5643
  * Phase machine (per-instance, all timers local):
5644
- * - `spinner` while `agent.isRunning`
5645
- * - → `check` after `agent.isRunning` falls (debounced 500 ms to
5646
- * absorb step-boundary `RUN_FINISHED RUN_STARTED` blips inside
5647
- * one user turn)
5644
+ * - `spinner` while the run is in flight and no prose has started
5645
+ * - → `check` either when a later assistant message in the run
5646
+ * starts emitting prose (early fade the recall phase is over
5647
+ * from the user's perspective even though `isRunning` is still
5648
+ * true while prose streams) OR when `agent.isRunning` falls
5649
+ * (debounced 500 ms to absorb step-boundary
5650
+ * `RUN_FINISHED → RUN_STARTED` blips inside one user turn) — the
5651
+ * `agent.isRunning` path is the safety net for runs that end
5652
+ * without ever emitting prose (errors, max-step bail-out)
5648
5653
  * - → `fading` after a brief hold ({@link CHECK_HOLD_MS})
5649
5654
  * - → `hidden` after the fade animation
5650
5655
  * ({@link FADE_OUT_ANIMATION_MS})
5651
5656
  *
5657
+ * Mounting on a *historical* match (no live run): the indicator skips
5658
+ * the lifecycle entirely and starts in `"hidden"`. Old assistant-with-
5659
+ * tool-call messages in a previously-finished thread still satisfy
5660
+ * gates 2 + 3 when the thread is reopened, but there is no live work
5661
+ * to celebrate; replaying spinner → check → fade on every navigation
5662
+ * would be visual noise.
5663
+ *
5652
5664
  * The "exactly one pill at a time" guarantee is structural — only one
5653
- * message at any moment satisfies gates 2–4 — so no shared coordination
5665
+ * message at any moment satisfies gates 2–3 — so no shared coordination
5654
5666
  * state is required.
5655
5667
  */
5656
5668
  function IntelligenceIndicator(props) {
@@ -5673,7 +5685,7 @@ function IntelligenceIndicator(props) {
5673
5685
  }, ISRUNNING_POLL_MS);
5674
5686
  return () => clearInterval(interval);
5675
5687
  }, [agent]);
5676
- const [phase, setPhase] = useState(agent.isRunning ? "spinner" : "check");
5688
+ const [phase, setPhase] = useState(agent.isRunning ? "spinner" : "hidden");
5677
5689
  useEffect(() => {
5678
5690
  if (phase === "hidden") return void 0;
5679
5691
  if (agent.isRunning) {
@@ -5683,6 +5695,23 @@ function IntelligenceIndicator(props) {
5683
5695
  const t = setTimeout(() => setPhase("check"), RUN_IDLE_DEBOUNCE_MS);
5684
5696
  return () => clearTimeout(t);
5685
5697
  }, [agent.isRunning, phase]);
5698
+ useEffect(() => {
5699
+ if (phase !== "spinner") return void 0;
5700
+ const ourIdx = agent.messages.findIndex((m) => m.id === message.id);
5701
+ if (ourIdx < 0) return void 0;
5702
+ if (agent.messages.slice(ourIdx + 1).some((m) => {
5703
+ if (m.role !== "assistant") return false;
5704
+ if (!(typeof m.content === "string" && m.content.trim().length > 0)) return false;
5705
+ return !(Array.isArray(m.toolCalls) ? m.toolCalls : []).some((tc) => {
5706
+ const name = tc?.function?.name;
5707
+ return typeof name === "string" && DEFAULT_TOOL_PATTERNS.some((p) => p.test(name));
5708
+ });
5709
+ })) setPhase("check");
5710
+ }, [
5711
+ agent.messages,
5712
+ message.id,
5713
+ phase
5714
+ ]);
5686
5715
  useEffect(() => {
5687
5716
  if (phase !== "check") return void 0;
5688
5717
  const t = setTimeout(() => setPhase("fading"), CHECK_HOLD_MS);
@@ -9969,4 +9998,4 @@ function validateProps(props) {
9969
9998
 
9970
9999
  //#endregion
9971
10000
  export { useRenderToolCall as $, IntelligenceIndicator as A, useInterrupt as B, CopilotChatToggleButton as C, CopilotChatView_default as D, CopilotChat as E, CopilotChatAttachmentRenderer as F, useAgent as G, useSuggestions as H, CopilotChatAssistantMessage_default as I, useRenderTool as J, useHumanInTheLoop as K, CopilotChatToolCallsView as L, CopilotChatSuggestionPill as M, CopilotChatReasoningMessage_default as N, CopilotChatAttachmentQueue as O, CopilotChatUserMessage_default as P, useRenderCustomMessages as Q, useAttachments as R, CopilotModalHeader as S, DefaultOpenIcon as T, useCapabilities as U, useConfigureSuggestions as V, UseAgentUpdate as W, useFrontendTool as X, useComponent as Y, useRenderActivityMessage as Z, WildcardToolCallRender as _, ThreadsProvider as a, createA2UIMessageRenderer as at, CopilotPopupView as b, CoAgentStateRendersProvider as c, MCPAppsActivityContentSchema as ct, shouldShowDevConsole as d, CopilotKitInspector as dt, CopilotKitProvider as et, useToast as f, CopilotChatInput_default as ft, useCopilotContext as g, useCopilotChatConfiguration as gt, CopilotContext as h, CopilotChatConfigurationProvider as ht, ThreadsContext as i, defineToolCallRenderer as it, CopilotChatSuggestionView as j, CopilotChatMessageView as k, useCoAgentStateRenders as l, MCPAppsActivityRenderer as lt, useCopilotMessagesContext as m, CopilotChatAudioRecorder as mt, defaultCopilotContextCategories as n, CopilotKitCoreReact as nt, useThreads as o, SandboxFunctionsContext as ot, CopilotMessagesContext as p, AudioRecorderError as pt, useDefaultRenderTool as q, CoAgentStateRenderBridge as r, useAgentContext as rt, CoAgentStateRendersContext as s, useSandboxFunctions as st, CopilotKit as t, useCopilotKit as tt, useAsyncCallback as u, MCPAppsActivityType as ut, CopilotPopup as v, DefaultCloseIcon as w, CopilotSidebarView as x, CopilotSidebar as y, useThreads$1 as z };
9972
- //# sourceMappingURL=copilotkit-Bbrd6bmt.mjs.map
10001
+ //# sourceMappingURL=copilotkit--McKbFME.mjs.map