@assistant-ui/react 0.7.85 → 0.7.87

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 (119) hide show
  1. package/dist/api/AssistantRuntime.d.ts +10 -3
  2. package/dist/api/AssistantRuntime.d.ts.map +1 -1
  3. package/dist/api/AssistantRuntime.js +8 -6
  4. package/dist/api/AssistantRuntime.js.map +1 -1
  5. package/dist/api/AssistantRuntime.mjs +8 -8
  6. package/dist/api/AssistantRuntime.mjs.map +1 -1
  7. package/dist/cloud/useCloudThreadListRuntime.d.ts +1 -1
  8. package/dist/cloud/useCloudThreadListRuntime.d.ts.map +1 -1
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +4 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +3 -1
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/model-context/ModelContextTypes.d.ts +1 -1
  16. package/dist/model-context/ModelContextTypes.d.ts.map +1 -1
  17. package/dist/model-context/ModelContextTypes.js +2 -1
  18. package/dist/model-context/ModelContextTypes.js.map +1 -1
  19. package/dist/model-context/ModelContextTypes.mjs +2 -1
  20. package/dist/model-context/ModelContextTypes.mjs.map +1 -1
  21. package/dist/model-context/index.d.ts +2 -0
  22. package/dist/model-context/index.d.ts.map +1 -1
  23. package/dist/model-context/index.js +6 -0
  24. package/dist/model-context/index.js.map +1 -1
  25. package/dist/model-context/index.mjs +4 -0
  26. package/dist/model-context/index.mjs.map +1 -1
  27. package/dist/model-context/makeAssistantReadable.d.ts +6 -0
  28. package/dist/model-context/makeAssistantReadable.d.ts.map +1 -0
  29. package/dist/model-context/makeAssistantReadable.js +86 -0
  30. package/dist/model-context/makeAssistantReadable.js.map +1 -0
  31. package/dist/model-context/makeAssistantReadable.mjs +69 -0
  32. package/dist/model-context/makeAssistantReadable.mjs.map +1 -0
  33. package/dist/model-context/tool.d.ts +12 -0
  34. package/dist/model-context/tool.d.ts.map +1 -0
  35. package/dist/model-context/tool.js +33 -0
  36. package/dist/model-context/tool.js.map +1 -0
  37. package/dist/model-context/tool.mjs +8 -0
  38. package/dist/model-context/tool.mjs.map +1 -0
  39. package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts.map +1 -1
  40. package/dist/runtimes/core/BaseThreadRuntimeCore.js +2 -0
  41. package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
  42. package/dist/runtimes/core/BaseThreadRuntimeCore.mjs +2 -0
  43. package/dist/runtimes/core/BaseThreadRuntimeCore.mjs.map +1 -1
  44. package/dist/runtimes/dangerous-in-browser/useDangerousInBrowserRuntime.d.ts +1 -1
  45. package/dist/runtimes/dangerous-in-browser/useDangerousInBrowserRuntime.d.ts.map +1 -1
  46. package/dist/runtimes/edge/useEdgeRuntime.d.ts +1 -1
  47. package/dist/runtimes/edge/useEdgeRuntime.d.ts.map +1 -1
  48. package/dist/runtimes/external-store/useExternalStoreRuntime.d.ts +2 -1
  49. package/dist/runtimes/external-store/useExternalStoreRuntime.d.ts.map +1 -1
  50. package/dist/runtimes/external-store/useExternalStoreRuntime.js +1 -5
  51. package/dist/runtimes/external-store/useExternalStoreRuntime.js.map +1 -1
  52. package/dist/runtimes/external-store/useExternalStoreRuntime.mjs +1 -5
  53. package/dist/runtimes/external-store/useExternalStoreRuntime.mjs.map +1 -1
  54. package/dist/runtimes/index.d.ts +1 -0
  55. package/dist/runtimes/index.d.ts.map +1 -1
  56. package/dist/runtimes/index.js +9 -0
  57. package/dist/runtimes/index.js.map +1 -1
  58. package/dist/runtimes/index.mjs +4 -0
  59. package/dist/runtimes/index.mjs.map +1 -1
  60. package/dist/runtimes/local/LocalRuntimeCore.d.ts +0 -4
  61. package/dist/runtimes/local/LocalRuntimeCore.d.ts.map +1 -1
  62. package/dist/runtimes/local/LocalRuntimeCore.js +2 -23
  63. package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
  64. package/dist/runtimes/local/LocalRuntimeCore.mjs +2 -23
  65. package/dist/runtimes/local/LocalRuntimeCore.mjs.map +1 -1
  66. package/dist/runtimes/local/useLocalRuntime.d.ts +2 -6
  67. package/dist/runtimes/local/useLocalRuntime.d.ts.map +1 -1
  68. package/dist/runtimes/local/useLocalRuntime.js +2 -19
  69. package/dist/runtimes/local/useLocalRuntime.js.map +1 -1
  70. package/dist/runtimes/local/useLocalRuntime.mjs +2 -21
  71. package/dist/runtimes/local/useLocalRuntime.mjs.map +1 -1
  72. package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts +4 -4
  73. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +4 -4
  74. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.d.ts +2 -1
  75. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +1 -1
  76. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js +1 -1
  77. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
  78. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs +1 -1
  79. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.mjs.map +1 -1
  80. package/dist/runtimes/utils/MessageRepository.d.ts +7 -2
  81. package/dist/runtimes/utils/MessageRepository.d.ts.map +1 -1
  82. package/dist/runtimes/utils/MessageRepository.js +26 -0
  83. package/dist/runtimes/utils/MessageRepository.js.map +1 -1
  84. package/dist/runtimes/utils/MessageRepository.mjs +26 -1
  85. package/dist/runtimes/utils/MessageRepository.mjs.map +1 -1
  86. package/dist/tailwindcss/index.d.ts.map +1 -1
  87. package/dist/tailwindcss/index.js +1 -4
  88. package/dist/tailwindcss/index.js.map +1 -1
  89. package/dist/tailwindcss/index.mjs +6 -9
  90. package/dist/tailwindcss/index.mjs.map +1 -1
  91. package/dist/utils/json/fix-json.d.ts +1 -1
  92. package/dist/utils/json/fix-json.d.ts.map +1 -1
  93. package/dist/utils/json/fix-json.js +5 -1
  94. package/dist/utils/json/fix-json.js.map +1 -1
  95. package/dist/utils/json/fix-json.mjs +5 -1
  96. package/dist/utils/json/fix-json.mjs.map +1 -1
  97. package/dist/utils/json/parse-partial-json.d.ts +2 -0
  98. package/dist/utils/json/parse-partial-json.d.ts.map +1 -1
  99. package/dist/utils/json/parse-partial-json.js +40 -3
  100. package/dist/utils/json/parse-partial-json.js.map +1 -1
  101. package/dist/utils/json/parse-partial-json.mjs +38 -2
  102. package/dist/utils/json/parse-partial-json.mjs.map +1 -1
  103. package/package.json +4 -1
  104. package/src/api/AssistantRuntime.ts +15 -22
  105. package/src/index.ts +2 -0
  106. package/src/model-context/ModelContextTypes.ts +4 -2
  107. package/src/model-context/index.ts +3 -0
  108. package/src/model-context/makeAssistantReadable.tsx +81 -0
  109. package/src/model-context/tool.ts +26 -0
  110. package/src/runtimes/core/BaseThreadRuntimeCore.tsx +2 -1
  111. package/src/runtimes/external-store/useExternalStoreRuntime.tsx +1 -5
  112. package/src/runtimes/index.ts +2 -0
  113. package/src/runtimes/local/LocalRuntimeCore.tsx +1 -33
  114. package/src/runtimes/local/useLocalRuntime.tsx +2 -29
  115. package/src/runtimes/remote-thread-list/useRemoteThreadListRuntime.tsx +1 -1
  116. package/src/runtimes/utils/MessageRepository.tsx +33 -3
  117. package/src/tailwindcss/index.ts +6 -9
  118. package/src/utils/json/fix-json.ts +6 -2
  119. package/src/utils/json/parse-partial-json.ts +61 -1
@@ -167,13 +167,14 @@ export abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {
167
167
  }
168
168
  }
169
169
 
170
+ // TODO import()/export() on external store doesn't make much sense
170
171
  public export() {
171
172
  return this.repository.export();
172
173
  }
173
174
 
174
175
  public import(data: ExportedMessageRepository) {
175
176
  this.ensureInitialized();
176
-
177
+ this.repository.clear();
177
178
  this.repository.import(data);
178
179
  this._notifySubscribers();
179
180
  }
@@ -4,7 +4,6 @@ import { useEffect, useMemo, useState } from "react";
4
4
  import { ExternalStoreRuntimeCore } from "./ExternalStoreRuntimeCore";
5
5
  import { ExternalStoreAdapter } from "./ExternalStoreAdapter";
6
6
  import { AssistantRuntimeImpl } from "../../api/AssistantRuntime";
7
- import { ThreadRuntimeImpl } from "../../api/ThreadRuntime";
8
7
  import { useRuntimeAdapters } from "../adapters/RuntimeAdapterProvider";
9
8
 
10
9
  export const useExternalStoreRuntime = <T,>(store: ExternalStoreAdapter<T>) => {
@@ -21,8 +20,5 @@ export const useExternalStoreRuntime = <T,>(store: ExternalStoreAdapter<T>) => {
21
20
  return runtime.registerModelContextProvider(modelContext);
22
21
  }, [modelContext, runtime]);
23
22
 
24
- return useMemo(
25
- () => AssistantRuntimeImpl.create(runtime, ThreadRuntimeImpl),
26
- [runtime],
27
- );
23
+ return useMemo(() => new AssistantRuntimeImpl(runtime), [runtime]);
28
24
  };
@@ -5,3 +5,5 @@ export * from "./edge";
5
5
  export * from "./external-store";
6
6
  export * from "./local";
7
7
  export * from "./remote-thread-list";
8
+
9
+ export { ExportedMessageRepository } from "./utils/MessageRepository";
@@ -1,28 +1,9 @@
1
- import type { CoreMessage } from "../../types/AssistantTypes";
2
1
  import { BaseAssistantRuntimeCore } from "../core/BaseAssistantRuntimeCore";
3
2
  import { LocalThreadRuntimeCore } from "./LocalThreadRuntimeCore";
4
3
  import { LocalRuntimeOptionsBase } from "./LocalRuntimeOptions";
5
4
  import { LocalThreadListRuntimeCore } from "./LocalThreadListRuntimeCore";
6
5
  import { ExportedMessageRepository } from "../utils/MessageRepository";
7
6
  import { ThreadMessageLike } from "../external-store";
8
- import { fromThreadMessageLike } from "../external-store/ThreadMessageLike";
9
- import { generateId } from "../../internal";
10
- import { getAutoStatus } from "../external-store/auto-status";
11
-
12
- const getExportFromInitialMessages = (
13
- initialMessages: readonly ThreadMessageLike[],
14
- ): ExportedMessageRepository => {
15
- const messages = initialMessages.map((i, idx) => {
16
- const isLast = idx === initialMessages.length - 1;
17
- return fromThreadMessageLike(i, generateId(), getAutoStatus(isLast, false));
18
- });
19
- return {
20
- messages: messages.map((m, idx) => ({
21
- parentId: messages[idx - 1]?.id ?? null,
22
- message: m,
23
- })),
24
- };
25
- };
26
7
 
27
8
  export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
28
9
  public readonly threads;
@@ -45,20 +26,7 @@ export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
45
26
  if (initialMessages) {
46
27
  this.threads
47
28
  .getMainThreadRuntimeCore()
48
- .import(getExportFromInitialMessages(initialMessages));
29
+ .import(ExportedMessageRepository.fromArray(initialMessages));
49
30
  }
50
31
  }
51
-
52
- public reset({
53
- initialMessages,
54
- }: {
55
- initialMessages?: readonly CoreMessage[] | undefined;
56
- } = {}) {
57
- this.threads.switchToNewThread();
58
- if (!initialMessages) return;
59
-
60
- this.threads
61
- .getMainThreadRuntimeCore()
62
- .import(getExportFromInitialMessages(initialMessages));
63
- }
64
32
  }
@@ -4,37 +4,10 @@ import { useEffect, useMemo, useState } from "react";
4
4
  import type { ChatModelAdapter } from "./ChatModelAdapter";
5
5
  import { LocalRuntimeCore } from "./LocalRuntimeCore";
6
6
  import { LocalRuntimeOptions } from "./LocalRuntimeOptions";
7
- import {
8
- AssistantRuntime,
9
- AssistantRuntimeImpl,
10
- } from "../../api/AssistantRuntime";
11
- import { ThreadRuntimeImpl } from "../../internal";
12
7
  import { useRuntimeAdapters } from "../adapters/RuntimeAdapterProvider";
13
8
  import { useRemoteThreadListRuntime } from "../remote-thread-list/useRemoteThreadListRuntime";
14
9
  import { useCloudThreadListAdapter } from "../remote-thread-list/adapter/cloud";
15
-
16
- export type LocalRuntime = AssistantRuntime & {
17
- reset: (options?: Parameters<LocalRuntimeCore["reset"]>[0]) => void;
18
- };
19
-
20
- class LocalRuntimeImpl extends AssistantRuntimeImpl implements LocalRuntime {
21
- private constructor(private core: LocalRuntimeCore) {
22
- super(core, ThreadRuntimeImpl);
23
- }
24
-
25
- public override __internal_bindMethods() {
26
- super.__internal_bindMethods();
27
- this.reset = this.reset.bind(this);
28
- }
29
-
30
- public reset(options?: Parameters<LocalRuntimeCore["reset"]>[0]) {
31
- this.core.reset(options);
32
- }
33
-
34
- public static override create(_core: LocalRuntimeCore): LocalRuntime {
35
- return new LocalRuntimeImpl(_core);
36
- }
37
- }
10
+ import { AssistantRuntimeImpl } from "../../internal";
38
11
 
39
12
  const useLocalThreadRuntime = (
40
13
  adapter: ChatModelAdapter,
@@ -65,7 +38,7 @@ const useLocalThreadRuntime = (
65
38
  return runtime.registerModelContextProvider(modelContext);
66
39
  }, [modelContext, runtime]);
67
40
 
68
- return useMemo(() => LocalRuntimeImpl.create(runtime), [runtime]);
41
+ return useMemo(() => new AssistantRuntimeImpl(runtime), [runtime]);
69
42
  };
70
43
 
71
44
  export const useLocalRuntime = (
@@ -34,5 +34,5 @@ export const useRemoteThreadListRuntime = (
34
34
  runtime.threads.__internal_setOptions(options);
35
35
  runtime.threads.__internal_load();
36
36
  }, [runtime, options]);
37
- return useMemo(() => AssistantRuntimeImpl.create(runtime), [runtime]);
37
+ return useMemo(() => new AssistantRuntimeImpl(runtime), [runtime]);
38
38
  };
@@ -1,6 +1,9 @@
1
1
  import type { CoreMessage, ThreadMessage } from "../../types/AssistantTypes";
2
- import { generateOptimisticId } from "../../utils/idUtils";
2
+ import { generateId, generateOptimisticId } from "../../utils/idUtils";
3
3
  import { fromCoreMessage } from "../edge/converters/fromCoreMessage";
4
+ import { ThreadMessageLike } from "../external-store";
5
+ import { getAutoStatus } from "../external-store/auto-status";
6
+ import { fromThreadMessageLike } from "../external-store/ThreadMessageLike";
4
7
 
5
8
  type RepositoryParent = {
6
9
  children: string[];
@@ -18,13 +21,30 @@ export type ExportedMessageRepositoryItem = {
18
21
  parentId: string | null;
19
22
  };
20
23
 
21
- export interface ExportedMessageRepository {
24
+ export type ExportedMessageRepository = {
22
25
  headId?: string | null;
23
26
  messages: Array<{
24
27
  message: ThreadMessage;
25
28
  parentId: string | null;
26
29
  }>;
27
- }
30
+ };
31
+
32
+ export const ExportedMessageRepository = {
33
+ fromArray: (
34
+ messages: readonly ThreadMessageLike[],
35
+ ): ExportedMessageRepository => {
36
+ const conv = messages.map((m) =>
37
+ fromThreadMessageLike(m, generateId(), getAutoStatus(false, false)),
38
+ );
39
+
40
+ return {
41
+ messages: conv.map((m, idx) => ({
42
+ parentId: idx > 0 ? conv[idx - 1]!.id : null,
43
+ message: m,
44
+ })),
45
+ };
46
+ },
47
+ };
28
48
 
29
49
  const findHead = (
30
50
  message: RepositoryMessage | RepositoryParent,
@@ -287,6 +307,16 @@ export class MessageRepository {
287
307
  this._messages.dirty();
288
308
  }
289
309
 
310
+ clear(): void {
311
+ this.messages.clear();
312
+ this.head = null;
313
+ this.root = {
314
+ children: [],
315
+ next: null,
316
+ };
317
+ this._messages.dirty();
318
+ }
319
+
290
320
  export(): ExportedMessageRepository {
291
321
  const exportItems: ExportedMessageRepository["messages"] = [];
292
322
 
@@ -1,9 +1,9 @@
1
1
  import plugin from "tailwindcss/plugin.js";
2
- import baseComponentsCSS from "../../dist/styles/tailwindcss/base-components.css.json";
3
- import threadCSS from "../../dist/styles/tailwindcss/thread.css.json";
4
- import modalCSS from "../../dist/styles/tailwindcss/modal.css.json";
5
- import defaultThemeCSS from "../../dist/styles/themes/default.css.json";
6
- import shadcnExtrasCSS from "../../dist/styles/themes/shadcn-extras.css.json";
2
+ import baseComponentsCSS from "../../dist/styles/tailwindcss/base-components.css.json" with { type: "json" };
3
+ import threadCSS from "../../dist/styles/tailwindcss/thread.css.json" with { type: "json" };
4
+ import modalCSS from "../../dist/styles/tailwindcss/modal.css.json" with { type: "json" };
5
+ import defaultThemeCSS from "../../dist/styles/themes/default.css.json" with { type: "json" };
6
+ import shadcnExtrasCSS from "../../dist/styles/themes/shadcn-extras.css.json" with { type: "json" };
7
7
 
8
8
  type AssistantTailwindPluginColors = {
9
9
  border: string;
@@ -77,10 +77,7 @@ const auiPlugin = plugin.withOptions<AssisstantTailwindPluginOptions>(
77
77
  addComponents(modalCSS);
78
78
  }
79
79
  },
80
- ({
81
- colors = {},
82
- shadcn = false,
83
- } = {}) => {
80
+ ({ colors = {}, shadcn = false } = {}) => {
84
81
  const prefix = !shadcn ? "--aui-" : "--";
85
82
  return {
86
83
  safelist: [{ pattern: /^aui-/ }],
@@ -40,7 +40,7 @@ type State =
40
40
  // Please note that invalid JSON is not considered/covered, because it
41
41
  // is assumed that the resulting JSON will be processed by a standard
42
42
  // JSON parser that will detect any invalid JSON.
43
- export function fixJson(input: string): string {
43
+ export function fixJson(input: string): [string, number] {
44
44
  const stack: State[] = ["ROOT"];
45
45
  let lastValidIndex = -1;
46
46
  let literalStart: number | null = null;
@@ -372,6 +372,7 @@ export function fixJson(input: string): string {
372
372
  }
373
373
 
374
374
  let result = input.slice(0, lastValidIndex + 1);
375
+ let partialCount = 0;
375
376
 
376
377
  for (let i = stack.length - 1; i >= 0; i--) {
377
378
  const state = stack[i];
@@ -379,6 +380,7 @@ export function fixJson(input: string): string {
379
380
  switch (state) {
380
381
  case "INSIDE_STRING": {
381
382
  result += '"';
383
+ partialCount++;
382
384
  break;
383
385
  }
384
386
 
@@ -389,6 +391,7 @@ export function fixJson(input: string): string {
389
391
  case "INSIDE_OBJECT_BEFORE_VALUE":
390
392
  case "INSIDE_OBJECT_AFTER_VALUE": {
391
393
  result += "}";
394
+ partialCount++;
392
395
  break;
393
396
  }
394
397
 
@@ -396,6 +399,7 @@ export function fixJson(input: string): string {
396
399
  case "INSIDE_ARRAY_AFTER_COMMA":
397
400
  case "INSIDE_ARRAY_AFTER_VALUE": {
398
401
  result += "]";
402
+ partialCount++;
399
403
  break;
400
404
  }
401
405
 
@@ -413,5 +417,5 @@ export function fixJson(input: string): string {
413
417
  }
414
418
  }
415
419
 
416
- return result;
420
+ return [result, partialCount];
417
421
  }
@@ -1,14 +1,74 @@
1
1
  import sjson from "secure-json-parse";
2
2
  import { fixJson } from "./fix-json";
3
+ import {
4
+ ContentPartStatus,
5
+ ToolCallContentPartStatus,
6
+ } from "../../types/AssistantTypes";
7
+ import { useContentPart } from "../../context";
3
8
 
9
+ const PARTIAL_JSON_COUNT_SYMBOL = Symbol("partial-json-count");
4
10
  export const parsePartialJson = (json: string) => {
5
11
  try {
6
12
  return sjson.parse(json);
7
13
  } catch {
8
14
  try {
9
- return sjson.parse(fixJson(json));
15
+ const [fixedJson, partialCount] = fixJson(json);
16
+ const res = sjson.parse(fixedJson);
17
+ res[PARTIAL_JSON_COUNT_SYMBOL] = partialCount;
18
+ return res;
10
19
  } catch {
11
20
  return undefined;
12
21
  }
13
22
  }
14
23
  };
24
+
25
+ const COMPLETE_STATUS = Object.freeze({ type: "complete" });
26
+
27
+ const getFieldStatus = (
28
+ lastState: ContentPartStatus,
29
+ args: unknown,
30
+ fieldPath: string[],
31
+ partialCount: number,
32
+ ): ContentPartStatus => {
33
+ if (fieldPath.length === 0) return lastState;
34
+ if (typeof args !== "object" || args === null) return COMPLETE_STATUS;
35
+
36
+ const path = fieldPath.at(-1)!;
37
+
38
+ // If the expected property does not exist, mark as incomplete
39
+ if (!Object.prototype.hasOwnProperty.call(args, path)) {
40
+ return lastState;
41
+ }
42
+
43
+ const argsKeys = Object.keys(args);
44
+ const isLast = argsKeys[argsKeys.length - 1] === path;
45
+ if (!isLast) return COMPLETE_STATUS;
46
+
47
+ return getFieldStatus(
48
+ lastState,
49
+ (args as Record<string, unknown>)[path],
50
+ fieldPath.slice(0, -1),
51
+ partialCount - 1,
52
+ );
53
+ };
54
+
55
+ const getToolArgsFieldStatus = (
56
+ status: ToolCallContentPartStatus,
57
+ args: Record<string, unknown>,
58
+ fieldPath: string[],
59
+ ): ContentPartStatus => {
60
+ const partialCount = (args as any)[PARTIAL_JSON_COUNT_SYMBOL] ?? 0;
61
+ if (partialCount === 0) return COMPLETE_STATUS;
62
+
63
+ const lastState: ContentPartStatus =
64
+ status.type !== "requires-action" ? status : COMPLETE_STATUS;
65
+
66
+ return getFieldStatus(lastState, args, fieldPath, partialCount);
67
+ };
68
+
69
+ export const useToolArgsFieldStatus = (fieldPath: string[]) => {
70
+ return useContentPart((p) => {
71
+ if (p.type !== "tool-call") throw new Error("not a tool call");
72
+ return getToolArgsFieldStatus(p.status, p.args, fieldPath);
73
+ });
74
+ };