@agent-native/core 0.80.9 → 0.80.11

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.
Files changed (148) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +13 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/agent/production-agent.ts +108 -15
  5. package/corpus/core/src/cli/design-connect.ts +28 -2
  6. package/corpus/core/src/cli/skills.ts +45 -24
  7. package/corpus/core/src/client/AssistantChat.tsx +123 -26
  8. package/corpus/core/src/client/sse-event-processor.ts +9 -0
  9. package/corpus/templates/assets/.agents/skills/image-generation/SKILL.md +9 -2
  10. package/corpus/templates/assets/AGENTS.md +4 -0
  11. package/corpus/templates/assets/actions/_tool-activity.ts +46 -0
  12. package/corpus/templates/assets/actions/generate-image-batch.ts +26 -5
  13. package/corpus/templates/assets/actions/generate-image.ts +118 -67
  14. package/corpus/templates/assets/actions/list-draft-assets.ts +50 -0
  15. package/corpus/templates/assets/actions/rerun-generation-run.ts +52 -31
  16. package/corpus/templates/assets/app/components/create/RecentDraftsSection.tsx +100 -0
  17. package/corpus/templates/assets/app/i18n/zh-TW.ts +7 -0
  18. package/corpus/templates/assets/app/i18n-data.ts +61 -0
  19. package/corpus/templates/assets/app/routes/_index.tsx +4 -0
  20. package/corpus/templates/assets/app/routes/library.tsx +145 -38
  21. package/corpus/templates/assets/changelog/2026-06-29-image-generation-can-now-render-requested-text-and-respect-b.md +6 -0
  22. package/corpus/templates/assets/changelog/2026-06-30-image-generation-no-longer-looks-stuck-while-the-provider-is-still-working.md +6 -0
  23. package/corpus/templates/assets/changelog/2026-06-30-tagged-presets-now-control-the-image-aspect-ratio.md +6 -0
  24. package/corpus/templates/assets/server/lib/generation.ts +135 -11
  25. package/corpus/templates/assets/shared/api.ts +4 -0
  26. package/corpus/templates/clips/actions/list-ai-requests.ts +60 -0
  27. package/corpus/templates/clips/app/hooks/use-auto-title.ts +24 -25
  28. package/corpus/templates/design/DESIGN-STUDIO-PLAN.md +717 -0
  29. package/corpus/templates/design/actions/add-breakpoint.ts +143 -0
  30. package/corpus/templates/design/actions/add-localhost-screens.ts +5 -0
  31. package/corpus/templates/design/actions/apply-a11y-fix.ts +317 -0
  32. package/corpus/templates/design/actions/apply-component-prop-edit.ts +441 -0
  33. package/corpus/templates/design/actions/apply-design-state.ts +213 -0
  34. package/corpus/templates/design/actions/apply-design-token-edit.ts +202 -0
  35. package/corpus/templates/design/actions/apply-motion-edit.ts +413 -0
  36. package/corpus/templates/design/actions/apply-shader-fill.ts +404 -0
  37. package/corpus/templates/design/actions/apply-visual-edit.ts +191 -5
  38. package/corpus/templates/design/actions/capture-design-state.ts +224 -0
  39. package/corpus/templates/design/actions/connect-builder-app.ts +162 -0
  40. package/corpus/templates/design/actions/create-component.ts +447 -0
  41. package/corpus/templates/design/actions/create-design-branch.ts +263 -0
  42. package/corpus/templates/design/actions/create-design-state.ts +162 -0
  43. package/corpus/templates/design/actions/delete-design-state.ts +55 -0
  44. package/corpus/templates/design/actions/delete-design.ts +20 -0
  45. package/corpus/templates/design/actions/deploy-design-preview.ts +275 -0
  46. package/corpus/templates/design/actions/get-component-details.ts +251 -0
  47. package/corpus/templates/design/actions/get-design-branch-diff.ts +362 -0
  48. package/corpus/templates/design/actions/get-design-review.ts +314 -0
  49. package/corpus/templates/design/actions/get-design-surface-index.ts +582 -0
  50. package/corpus/templates/design/actions/get-motion-timeline.ts +99 -0
  51. package/corpus/templates/design/actions/index-components.ts +258 -0
  52. package/corpus/templates/design/actions/index-design-tokens.ts +277 -0
  53. package/corpus/templates/design/actions/list-design-extensions.ts +309 -0
  54. package/corpus/templates/design/actions/list-design-source-capabilities.ts +153 -0
  55. package/corpus/templates/design/actions/list-design-states.ts +90 -0
  56. package/corpus/templates/design/actions/migrate-inline-design-to-app.ts +298 -0
  57. package/corpus/templates/design/actions/open-component-source.ts +242 -0
  58. package/corpus/templates/design/actions/preview-component-prop-edit.ts +260 -0
  59. package/corpus/templates/design/actions/preview-design-token-edit.ts +113 -0
  60. package/corpus/templates/design/actions/preview-shader-fill.ts +187 -0
  61. package/corpus/templates/design/actions/remove-breakpoint.ts +103 -0
  62. package/corpus/templates/design/actions/remove-motion-timeline.ts +196 -0
  63. package/corpus/templates/design/actions/run-design-audit.ts +436 -0
  64. package/corpus/templates/design/actions/run-design-extension-action.ts +284 -0
  65. package/corpus/templates/design/actions/set-active-breakpoint.ts +39 -0
  66. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +1550 -82
  67. package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +649 -43
  68. package/corpus/templates/design/app/components/design/DrawOverlay.tsx +1 -1
  69. package/corpus/templates/design/app/components/design/EditPanel.tsx +1788 -52
  70. package/corpus/templates/design/app/components/design/LayersPanel.tsx +114 -33
  71. package/corpus/templates/design/app/components/design/LocalSourceEditBanner.tsx +157 -0
  72. package/corpus/templates/design/app/components/design/MotionDock.tsx +1071 -0
  73. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +1053 -99
  74. package/corpus/templates/design/app/components/design/ReviewPanel.tsx +766 -0
  75. package/corpus/templates/design/app/components/design/StatesPanel.tsx +581 -0
  76. package/corpus/templates/design/app/components/design/TokensPanel.tsx +578 -0
  77. package/corpus/templates/design/app/components/design/canvas-primitive-style.ts +241 -0
  78. package/corpus/templates/design/app/components/design/index.ts +16 -0
  79. package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +15 -6
  80. package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +66 -3
  81. package/corpus/templates/design/app/components/design/inspector/InspectorAiActions.tsx +145 -0
  82. package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +42 -12
  83. package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +1 -1
  84. package/corpus/templates/design/app/hooks/useAgentEditRequest.ts +131 -0
  85. package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +3 -1
  86. package/corpus/templates/design/app/i18n/zh-TW.ts +32 -0
  87. package/corpus/templates/design/app/i18n-data.ts +280 -0
  88. package/corpus/templates/design/app/pages/DesignEditor.tsx +3087 -490
  89. package/corpus/templates/design/changelog/2026-06-29-added-a-review-panel-in-the-design-editor-s-inspector-with-a.md +6 -0
  90. package/corpus/templates/design/changelog/2026-06-29-copying-and-pasting-layers-no-longer-shows-success-notificat.md +6 -0
  91. package/corpus/templates/design/changelog/2026-06-29-device-presets-in-all-screens-view-resize-the-selected-previ.md +6 -0
  92. package/corpus/templates/design/changelog/2026-06-29-layer-and-canvas-drags-keep-the-layer-list-stable-while-chan.md +6 -0
  93. package/corpus/templates/design/changelog/2026-06-29-layer-moves-can-be-undone-and-redone-without-flashing-the-ca.md +6 -0
  94. package/corpus/templates/design/changelog/2026-06-29-screen-previews-use-a-single-blue-hover-border-in-all-screen.md +6 -0
  95. package/corpus/templates/design/changelog/2026-06-29-selected-containers-show-draggable-padding-and-gap-guides-on.md +6 -0
  96. package/corpus/templates/design/changelog/2026-06-29-the-design-editor-adds-a-studio-layer-with-tokens-respon.md +6 -0
  97. package/corpus/templates/design/changelog/2026-06-30-accessibility-findings-now-offer-a-one-click-fix.md +6 -0
  98. package/corpus/templates/design/changelog/2026-06-30-component-instances-now-have-editable-props-in-the-inspe.md +6 -0
  99. package/corpus/templates/design/changelog/2026-06-30-design-token-edits-now-stay-visible-in-previews-and-token-li.md +6 -0
  100. package/corpus/templates/design/changelog/2026-06-30-inspect-code-now-shows-the-elements-opening-tag-at-a-gla.md +6 -0
  101. package/corpus/templates/design/changelog/2026-06-30-shader-fill-presets-can-now-be-applied-to-an-element.md +6 -0
  102. package/corpus/templates/design/changelog/2026-06-30-the-motion-timeline-can-now-add-a-track-to-any-element-a.md +6 -0
  103. package/corpus/templates/design/changelog/2026-06-30-visual-editor-selection-layer-paint-and-drawing-controls-are-more-reliable.md +6 -0
  104. package/corpus/templates/design/e2e/global-setup.ts +94 -2
  105. package/corpus/templates/design/e2e/helpers.ts +10 -4
  106. package/corpus/templates/design/server/db/schema.ts +123 -0
  107. package/corpus/templates/design/server/plugins/db.ts +90 -0
  108. package/corpus/templates/design/shared/builder-app.ts +297 -0
  109. package/corpus/templates/design/shared/capability-resolver.ts +123 -0
  110. package/corpus/templates/design/shared/capture-sanitize.ts +70 -0
  111. package/corpus/templates/design/shared/code-layer.ts +1016 -71
  112. package/corpus/templates/design/shared/component-model.ts +274 -0
  113. package/corpus/templates/design/shared/design-review.ts +275 -0
  114. package/corpus/templates/design/shared/design-source-capabilities.ts +286 -0
  115. package/corpus/templates/design/shared/design-state.ts +112 -0
  116. package/corpus/templates/design/shared/design-surface-index.ts +258 -0
  117. package/corpus/templates/design/shared/motion-compiler.ts +349 -0
  118. package/corpus/templates/design/shared/motion-timeline.ts +193 -0
  119. package/corpus/templates/design/shared/resolve-tweaks.ts +32 -9
  120. package/corpus/templates/design/shared/responsive-classes.ts +452 -0
  121. package/corpus/templates/design/shared/shader-fill.ts +323 -0
  122. package/corpus/templates/design/shared/source-mode.ts +245 -0
  123. package/corpus/templates/plan/app/components/plan/CanvasArea.tsx +6 -2
  124. package/corpus/templates/plan/changelog/2026-06-29-plan-canvases-open-without-an-initial-pan-and-zoom-flicker.md +6 -0
  125. package/dist/agent/production-agent.d.ts.map +1 -1
  126. package/dist/agent/production-agent.js +94 -10
  127. package/dist/agent/production-agent.js.map +1 -1
  128. package/dist/cli/design-connect.d.ts.map +1 -1
  129. package/dist/cli/design-connect.js +28 -2
  130. package/dist/cli/design-connect.js.map +1 -1
  131. package/dist/cli/skills.d.ts.map +1 -1
  132. package/dist/cli/skills.js +37 -21
  133. package/dist/cli/skills.js.map +1 -1
  134. package/dist/client/AssistantChat.d.ts +14 -0
  135. package/dist/client/AssistantChat.d.ts.map +1 -1
  136. package/dist/client/AssistantChat.js +115 -22
  137. package/dist/client/AssistantChat.js.map +1 -1
  138. package/dist/client/sse-event-processor.d.ts.map +1 -1
  139. package/dist/client/sse-event-processor.js +10 -0
  140. package/dist/client/sse-event-processor.js.map +1 -1
  141. package/dist/collab/routes.d.ts +1 -1
  142. package/dist/file-upload/actions/upload-image.d.ts +2 -2
  143. package/dist/notifications/routes.d.ts +2 -2
  144. package/dist/observability/routes.d.ts +8 -8
  145. package/dist/resources/handlers.d.ts +2 -2
  146. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  147. package/dist/server/transcribe-voice.d.ts +1 -1
  148. package/package.json +1 -1
@@ -17,6 +17,20 @@ export interface AssistantChatSendOptions {
17
17
  trackInRunsTray?: boolean;
18
18
  requestMode?: AgentRequestMode;
19
19
  }
20
+ /**
21
+ * Decide whether a reconnect should give up with "no progress". The signal is
22
+ * *time since the last streamed event*, NOT total reconnect duration: a healthy
23
+ * long-running tool (e.g. image generation, which emits `activity` heartbeats
24
+ * every few seconds) makes continuous progress and must never be aborted just
25
+ * for running longer than the threshold. Only genuine silence for the full
26
+ * stuck threshold counts as stuck. Pure + exported so the decision is unit
27
+ * testable without driving the whole reconnect lifecycle.
28
+ */
29
+ export declare function reconnectProgressTimedOut(args: {
30
+ lastProgressAt: number;
31
+ now: number;
32
+ thresholdMs?: number;
33
+ }): boolean;
20
34
  export declare function latestNonRecoveryUserMessageText(messages: readonly unknown[]): string;
21
35
  export declare function resolveAssistantChatSubmitIntent({ isRunning, requestedIntent, }: {
22
36
  isRunning: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAW7B,OAAO,KASN,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAOrE,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAQL,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAqCzB,OAAO,E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,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,CAAC;AA6sF7B,eAAO,MAAM,aAAa,gGA2GxB,CAAC"}
@@ -68,6 +68,12 @@ const PENDING_SELECTION_KEY = "pending-selection-context";
68
68
  const ACTIVE_RUN_CLEAR_TIMEOUT_MS = 5_000;
69
69
  const ACTIVE_RUN_STUCK_THRESHOLD_MS = 90_000;
70
70
  const ACTIVE_RUN_POLL_INTERVAL_MS = 150;
71
+ // How long a single activity (model call, tool prep, long tool) must stay
72
+ // in-flight before its label is surfaced in the running indicator. Below this
73
+ // the indicator stays a steady "Thinking" so normal fast turns don't flicker
74
+ // through transient labels ("Contacting model", "Preparing X action"); past it
75
+ // the live label appears so a genuinely slow step reads as working, not hung.
76
+ const ACTIVITY_LABEL_REVEAL_DELAY_MS = 6_000;
71
77
  const SUBMIT_ENGINE_STATUS_TIMEOUT_MS = 1000;
72
78
  function activeRunLooksStale(runInfo) {
73
79
  const lastProgressAt = typeof runInfo.lastProgressAt === "number" ? runInfo.lastProgressAt : null;
@@ -76,6 +82,19 @@ function activeRunLooksStale(runInfo) {
76
82
  lastProgressAt != null &&
77
83
  nowMs - lastProgressAt > ACTIVE_RUN_STUCK_THRESHOLD_MS);
78
84
  }
85
+ /**
86
+ * Decide whether a reconnect should give up with "no progress". The signal is
87
+ * *time since the last streamed event*, NOT total reconnect duration: a healthy
88
+ * long-running tool (e.g. image generation, which emits `activity` heartbeats
89
+ * every few seconds) makes continuous progress and must never be aborted just
90
+ * for running longer than the threshold. Only genuine silence for the full
91
+ * stuck threshold counts as stuck. Pure + exported so the decision is unit
92
+ * testable without driving the whole reconnect lifecycle.
93
+ */
94
+ export function reconnectProgressTimedOut(args) {
95
+ const threshold = args.thresholdMs ?? ACTIVE_RUN_STUCK_THRESHOLD_MS;
96
+ return args.now - args.lastProgressAt >= threshold;
97
+ }
79
98
  function isAssistantUiDuplicateMessageIdError(error) {
80
99
  const message = error instanceof Error ? error.message : String(error ?? "");
81
100
  return (message.includes("MessageRepository") &&
@@ -690,6 +709,22 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
690
709
  // True during the 250ms continuation window and startup of the next chunk
691
710
  // (adapter's auto-continue delay before POSTing the next chunk).
692
711
  const [isAutoResuming, setIsAutoResuming] = useState(false);
712
+ const [runningActivityLabel, setRunningActivityLabel] = useState(null);
713
+ // Delayed-reveal state for the activity label (see ACTIVITY_LABEL_REVEAL_DELAY_MS).
714
+ // `latest` holds the most recent activity label; `surfaced` flips true once the
715
+ // reveal timer fires; `timer` is the pending one-shot reveal.
716
+ const activityLabelTimerRef = useRef(null);
717
+ const latestActivityLabelRef = useRef(null);
718
+ const activityLabelSurfacedRef = useRef(false);
719
+ const resetRunningActivity = useCallback(() => {
720
+ if (activityLabelTimerRef.current !== null) {
721
+ window.clearTimeout(activityLabelTimerRef.current);
722
+ activityLabelTimerRef.current = null;
723
+ }
724
+ latestActivityLabelRef.current = null;
725
+ activityLabelSurfacedRef.current = false;
726
+ setRunningActivityLabel(null);
727
+ }, []);
693
728
  const [reconnectContent, setReconnectContent] = useState([]);
694
729
  // When stop is clicked during reconnect, keep content visible (don't wipe it)
695
730
  const [reconnectFrozen, setReconnectFrozen] = useState(false);
@@ -708,6 +743,19 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
708
743
  const textStreaming = isRunning || externalStreaming;
709
744
  // UI-only running state — drives the stop button and thinking indicator.
710
745
  const showRunningInUI = isRunning;
746
+ // A revealed activity label wins; otherwise stay a steady "Thinking" by
747
+ // default. We only surface "Reconnecting" while we are actively replaying
748
+ // recovered content (reconnectContent populated). A bare reconnect with no
749
+ // replayed content — e.g. a tail-resume after the serverless wall, where
750
+ // `scheduleUpdate` intentionally leaves reconnectContent empty — is normal
751
+ // ongoing work, so it must read as "Thinking", never a perpetual "Working".
752
+ const runningStatusLabel = runningActivityLabel
753
+ ? runningActivityLabel
754
+ : isAutoResuming
755
+ ? "Resuming"
756
+ : isReconnecting && reconnectContent.length > 0
757
+ ? "Reconnecting"
758
+ : "Thinking";
711
759
  const lastBroadcastRunningRef = useRef(isRunning);
712
760
  const tiptapRef = useRef(null);
713
761
  // Stable ref to the "stop active run" action so addToQueue can abort
@@ -938,11 +986,30 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
938
986
  }
939
987
  }, 1000);
940
988
  let reconnectTimedOut = false;
941
- const maxReconnectTimer = setTimeout(() => {
989
+ // Idle deadline, NOT a total-duration cap. A long-but-healthy run (image
990
+ // generation emits `activity` heartbeats every few seconds) keeps
991
+ // advancing `lastReconnectProgressAt`, so it is never aborted for simply
992
+ // taking longer than the threshold. Only true silence for the full stuck
993
+ // threshold trips it — the same semantics as `activeRunLooksStale` and the
994
+ // SSE-level no-progress timeout. `markReconnectProgress` resets it on every
995
+ // streamed event (see the `onSeq` callback below, which fires for every
996
+ // event including activity, for both fresh and tail-resume reconnects).
997
+ let lastReconnectProgressAt = Date.now();
998
+ const markReconnectProgress = () => {
999
+ lastReconnectProgressAt = Date.now();
1000
+ };
1001
+ const idleCheck = setInterval(() => {
1002
+ if (!reconnectProgressTimedOut({
1003
+ lastProgressAt: lastReconnectProgressAt,
1004
+ now: Date.now(),
1005
+ })) {
1006
+ return;
1007
+ }
942
1008
  reconnectTimedOut = true;
943
1009
  abortCtrl.abort();
944
1010
  clearInterval(watchdog);
945
- }, 20_000);
1011
+ clearInterval(idleCheck);
1012
+ }, 1000);
946
1013
  const streamReconnect = async () => {
947
1014
  let noProgressDuringReconnect = false;
948
1015
  let latestContent = [];
@@ -973,7 +1040,10 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
973
1040
  setReconnectContent(latestSnapshot);
974
1041
  });
975
1042
  };
976
- await readSSEStreamRaw(sseRes.body, content, toolCallCounter, tabId, scheduleUpdate, (seq) => updateActiveRunSeq(seq));
1043
+ await readSSEStreamRaw(sseRes.body, content, toolCallCounter, tabId, scheduleUpdate, (seq) => {
1044
+ markReconnectProgress();
1045
+ updateActiveRunSeq(seq);
1046
+ });
977
1047
  if (afterSeq === 0) {
978
1048
  setReconnectContent([...content]);
979
1049
  }
@@ -995,7 +1065,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
995
1065
  window.clearInterval(threadPollInterval);
996
1066
  }
997
1067
  clearInterval(watchdog);
998
- clearTimeout(maxReconnectTimer);
1068
+ clearInterval(idleCheck);
999
1069
  }
1000
1070
  if (noProgressDuringReconnect && reconnectRunIdRef.current === runId) {
1001
1071
  captureError(new Error("agent-chat:reconnect_no_progress"), {
@@ -1530,23 +1600,52 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
1530
1600
  window.addEventListener("agent-chat:run-error", handler);
1531
1601
  return () => window.removeEventListener("agent-chat:run-error", handler);
1532
1602
  }, [tabId]);
1533
- // Real activity means the next chunk has started leave the auto-resume
1534
- // ("Resuming") state so the indicator settles back to "Thinking". The
1535
- // activity label itself is intentionally not surfaced: the running
1536
- // indicator stays a steady "Thinking" rather than flipping through
1537
- // transient step labels.
1603
+ // Real activity means the next chunk has started. Surface longer-lived
1604
+ // activity such as "Still generating image" so active-run reconnects do not
1605
+ // look like failures while the server is still making progress.
1538
1606
  useEffect(() => {
1539
1607
  const handler = (e) => {
1540
1608
  const detail = e.detail;
1541
1609
  if (tabId && detail?.tabId && detail.tabId !== tabId)
1542
1610
  return;
1543
- if (typeof detail?.label === "string" && detail.label.trim()) {
1544
- setIsAutoResuming(false);
1611
+ const label = typeof detail?.label === "string" ? detail.label.trim() : "";
1612
+ if (!label)
1613
+ return;
1614
+ setIsAutoResuming(false);
1615
+ latestActivityLabelRef.current = label;
1616
+ // Already past the delay → keep the visible label current.
1617
+ if (activityLabelSurfacedRef.current) {
1618
+ setRunningActivityLabel(label);
1619
+ return;
1620
+ }
1621
+ // Not yet surfaced → arm a single reveal timer on the FIRST activity of
1622
+ // this in-flight period. A burst of quick steps that all finish (clear)
1623
+ // before the timer fires never surfaces anything, so normal fast turns
1624
+ // stay a steady "Thinking". A step still in-flight at the deadline reveals
1625
+ // the latest label so a slow operation reads as working, not hung.
1626
+ if (activityLabelTimerRef.current === null) {
1627
+ activityLabelTimerRef.current = window.setTimeout(() => {
1628
+ activityLabelTimerRef.current = null;
1629
+ activityLabelSurfacedRef.current = true;
1630
+ if (latestActivityLabelRef.current) {
1631
+ setRunningActivityLabel(latestActivityLabelRef.current);
1632
+ }
1633
+ }, ACTIVITY_LABEL_REVEAL_DELAY_MS);
1545
1634
  }
1546
1635
  };
1636
+ const clear = (e) => {
1637
+ const detail = e.detail;
1638
+ if (tabId && detail?.tabId && detail.tabId !== tabId)
1639
+ return;
1640
+ resetRunningActivity();
1641
+ };
1547
1642
  window.addEventListener("agent-chat:activity", handler);
1548
- return () => window.removeEventListener("agent-chat:activity", handler);
1549
- }, [tabId]);
1643
+ window.addEventListener("agent-chat:activity-clear", clear);
1644
+ return () => {
1645
+ window.removeEventListener("agent-chat:activity", handler);
1646
+ window.removeEventListener("agent-chat:activity-clear", clear);
1647
+ };
1648
+ }, [resetRunningActivity, tabId]);
1550
1649
  // Show "Resuming…" during the adapter's auto-continuation window (the
1551
1650
  // ~250ms gap between the end of one serverless chunk and the POST for the
1552
1651
  // next). The adapter dispatches `agent-chat:auto-continue` at that moment.
@@ -1564,8 +1663,9 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
1564
1663
  useEffect(() => {
1565
1664
  if (!isRunning) {
1566
1665
  setIsAutoResuming(false);
1666
+ resetRunningActivity();
1567
1667
  }
1568
- }, [isRunning]);
1668
+ }, [isRunning, resetRunningActivity]);
1569
1669
  // Auto-dequeue: when the agent is idle, send the next queued message. This
1570
1670
  // intentionally does not depend on observing the running -> idle transition:
1571
1671
  // restored queues can exist after a reload where this component never saw the
@@ -2245,14 +2345,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
2245
2345
  setRunErrorInfo(null);
2246
2346
  } })), (isReconnecting || reconnectFrozen) &&
2247
2347
  reconnectAfterSeq === 0 &&
2248
- reconnectContent.length > 0 && (_jsx(ReconnectStreamMessage, { content: reconnectContent })), showRunningInUI && (_jsx(RunningActivityStatus, { label: isReconnecting
2249
- ? "Reconnecting"
2250
- : isAutoResuming
2251
- ? "Resuming"
2252
- : // Keep a steady "Thinking" while the model works —
2253
- // never flip through transient activity labels
2254
- // (e.g. "Contacting model", "Preparing X action").
2255
- "Thinking" })), queuedMessages.map((msg) => {
2348
+ reconnectContent.length > 0 && (_jsx(ReconnectStreamMessage, { content: reconnectContent })), showRunningInUI && (_jsx(RunningActivityStatus, { label: runningStatusLabel })), queuedMessages.map((msg) => {
2256
2349
  const displayText = msg.text
2257
2350
  .replace(/<context>[\s\S]*?<\/context>\n?/g, "")
2258
2351
  .trim();