@agent-native/toolkit 0.210.0 → 0.210.1-nightly-20261020010058

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/toolkit",
3
- "version": "0.210.0",
3
+ "version": "0.210.1-nightly-20261020010058",
4
4
  "description": "Reusable app-building UI and helpers for Agent-Native apps.",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -678,7 +678,7 @@
678
678
  "y-protocols": "^1.0.7",
679
679
  "yjs": "^13.6.33",
680
680
  "zod": "^4.3.6",
681
- "@agent-native/agentkit": "^0.210.0"
681
+ "@agent-native/agentkit": "^0.210.1-nightly-20261020010058"
682
682
  },
683
683
  "devDependencies": {
684
684
  "@excalidraw/excalidraw": "0.18.1",
@@ -702,10 +702,10 @@
702
702
  "typescript-7": "npm:typescript@^7.0.2",
703
703
  "vite": "8.1.0",
704
704
  "vitest": "^4.1.5",
705
- "@agent-native/core": "^0.210.0"
705
+ "@agent-native/core": "^0.210.1-nightly-20261020010058"
706
706
  },
707
707
  "peerDependencies": {
708
- "@agent-native/core": ">=0.205.1",
708
+ "@agent-native/core": "0.210.1-nightly-20261020010058",
709
709
  "@excalidraw/excalidraw": ">=0.18",
710
710
  "@excalidraw/mermaid-to-excalidraw": ">=2",
711
711
  "@tanstack/react-query": "^5.99.2",
@@ -179,8 +179,8 @@ describe("ToolCallDisplay native renderers", () => {
179
179
  vi.unstubAllGlobals();
180
180
  });
181
181
 
182
- it("waits five minutes before showing the long-running hint", () => {
183
- expect(TOOL_LONG_RUNNING_HINT_DELAY_MS).toBe(5 * 60_000);
182
+ it("shows the long-running hint after 30 seconds", () => {
183
+ expect(TOOL_LONG_RUNNING_HINT_DELAY_MS).toBe(30_000);
184
184
  });
185
185
 
186
186
  it("does not reopen storage setup for a restored tool result", () => {
@@ -1467,7 +1467,15 @@ describe("ToolCallDisplay native renderers", () => {
1467
1467
  );
1468
1468
 
1469
1469
  act(() => {
1470
- vi.advanceTimersByTime(TOOL_LONG_RUNNING_HINT_DELAY_MS);
1470
+ vi.advanceTimersByTime(TOOL_LONG_RUNNING_HINT_DELAY_MS - 1);
1471
+ });
1472
+
1473
+ expect(container.textContent).not.toContain(
1474
+ "Still working. Large updates can take a minute or two.",
1475
+ );
1476
+
1477
+ act(() => {
1478
+ vi.advanceTimersByTime(1);
1471
1479
  });
1472
1480
 
1473
1481
  expect(container.textContent).toContain(
@@ -166,7 +166,7 @@ export function toolCallHasPendingApproval(part: {
166
166
  );
167
167
  }
168
168
 
169
- export const TOOL_LONG_RUNNING_HINT_DELAY_MS = 5 * 60_000;
169
+ export const TOOL_LONG_RUNNING_HINT_DELAY_MS = 30_000;
170
170
 
171
171
  export function ToolActivityPresentation({
172
172
  toolName,
@@ -28,6 +28,7 @@ import {
28
28
  compactComposerReasoningEffortLabel,
29
29
  composerModelCostTier,
30
30
  createTiptapComposerExtensions,
31
+ focusComposerEditorWhenVisible,
31
32
  displayableComposerModeMessage,
32
33
  getComposerSendTooltipKey,
33
34
  getComposerSubmitIntentForEnterKey,
@@ -74,6 +75,51 @@ afterEach(() => {
74
75
  });
75
76
 
76
77
  describe("createTiptapComposerExtensions", () => {
78
+ it("ignores a resize queued after the hidden-shell editor is destroyed", () => {
79
+ let resizeObserverCallback: ResizeObserverCallback | undefined;
80
+ const observer = {
81
+ disconnect: vi.fn(),
82
+ observe: vi.fn(),
83
+ unobserve: vi.fn(),
84
+ };
85
+ class MockResizeObserver {
86
+ constructor(callback: ResizeObserverCallback) {
87
+ resizeObserverCallback = callback;
88
+ }
89
+ observe = observer.observe;
90
+ unobserve = observer.unobserve;
91
+ disconnect = observer.disconnect;
92
+ }
93
+ vi.stubGlobal("ResizeObserver", MockResizeObserver);
94
+
95
+ const shell = document.createElement("div");
96
+ shell.style.display = "none";
97
+ document.body.appendChild(shell);
98
+ const element = document.createElement("div");
99
+ shell.appendChild(element);
100
+ const editor = new Editor({
101
+ element,
102
+ extensions: createTiptapComposerExtensions(() => "Message agent..."),
103
+ });
104
+
105
+ try {
106
+ focusComposerEditorWhenVisible(editor);
107
+ expect(observer.observe).toHaveBeenCalledWith(editor.view.dom);
108
+ expect(resizeObserverCallback).toBeTypeOf("function");
109
+
110
+ editor.destroy();
111
+ shell.style.display = "block";
112
+
113
+ expect(observer.disconnect).toHaveBeenCalled();
114
+ expect(() =>
115
+ resizeObserverCallback?.([], observer as ResizeObserver),
116
+ ).not.toThrow();
117
+ } finally {
118
+ if (!editor.isDestroyed) editor.destroy();
119
+ shell.remove();
120
+ }
121
+ });
122
+
77
123
  it("keeps consecutive prefills in the editor through the chat recovery boundary", async () => {
78
124
  let prefill: (text: string) => void;
79
125
  function Harness() {
@@ -17,6 +17,7 @@ import {
17
17
  IconLoader2,
18
18
  IconRefresh,
19
19
  } from "@tabler/icons-react";
20
+ import type { Editor } from "@tiptap/core";
20
21
  import Placeholder from "@tiptap/extension-placeholder";
21
22
  import { TextSelection } from "@tiptap/pm/state";
22
23
  import type { EditorView } from "@tiptap/pm/view";
@@ -1325,6 +1326,33 @@ export function isComposerEditorUsable<T extends { isDestroyed?: boolean }>(
1325
1326
  return Boolean(editor && editor.isDestroyed !== true);
1326
1327
  }
1327
1328
 
1329
+ export function focusComposerEditorWhenVisible(
1330
+ editor: Editor | null | undefined,
1331
+ ): void {
1332
+ if (!isComposerEditorUsable(editor)) return;
1333
+ const dom = editor.view.dom;
1334
+ if (isInsideHiddenShell(dom) && typeof ResizeObserver !== "undefined") {
1335
+ let observer: ResizeObserver;
1336
+ const disconnect = () => {
1337
+ observer.disconnect();
1338
+ editor.off("destroy", disconnect);
1339
+ };
1340
+ observer = new ResizeObserver(() => {
1341
+ if (!isComposerEditorUsable(editor)) {
1342
+ disconnect();
1343
+ return;
1344
+ }
1345
+ if (isInsideHiddenShell(dom)) return;
1346
+ disconnect();
1347
+ if (isComposerEditorUsable(editor)) editor.commands.focus("end");
1348
+ });
1349
+ editor.on("destroy", disconnect);
1350
+ observer.observe(dom);
1351
+ return;
1352
+ }
1353
+ editor.commands.focus("end");
1354
+ }
1355
+
1328
1356
  export function createTiptapComposerExtensions(
1329
1357
  getPlaceholder: () => string | undefined,
1330
1358
  ) {
@@ -4072,20 +4100,9 @@ export function TiptapComposer({
4072
4100
 
4073
4101
  useImperativeHandle(focusRef, () => ({
4074
4102
  focus() {
4075
- if (!isComposerEditorUsable(editor)) return;
4076
4103
  // An editor inside a hidden session shell cannot take focus, and nothing
4077
4104
  // re-runs this when the shell is shown. Focus on the first size change.
4078
- const dom = editor.view.dom;
4079
- if (isInsideHiddenShell(dom) && typeof ResizeObserver !== "undefined") {
4080
- const observer = new ResizeObserver(() => {
4081
- if (isInsideHiddenShell(dom)) return;
4082
- observer.disconnect();
4083
- editor.commands.focus("end");
4084
- });
4085
- observer.observe(dom);
4086
- return;
4087
- }
4088
- editor.commands.focus("end");
4105
+ focusComposerEditorWhenVisible(editor);
4089
4106
  },
4090
4107
  addAttachment(file: File) {
4091
4108
  return addAttachmentForCurrentScope(file);