@assistant-ui/core 0.2.0 → 0.2.2

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 (126) hide show
  1. package/README.md +45 -0
  2. package/dist/index.d.ts +2 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/react/client/Tools.d.ts +6 -1
  7. package/dist/react/client/Tools.d.ts.map +1 -1
  8. package/dist/react/client/Tools.js +16 -19
  9. package/dist/react/client/Tools.js.map +1 -1
  10. package/dist/react/index.d.ts +1 -1
  11. package/dist/react/index.d.ts.map +1 -1
  12. package/dist/react/index.js.map +1 -1
  13. package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
  14. package/dist/react/primitive-hooks/useComposerSend.js +2 -3
  15. package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
  16. package/dist/react/primitives/message/MessageAttachments.js +1 -1
  17. package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
  18. package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
  19. package/dist/react/primitives/message/MessageParts.js +14 -10
  20. package/dist/react/primitives/message/MessageParts.js.map +1 -1
  21. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +2 -0
  22. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
  23. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +2 -0
  24. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  25. package/dist/react/runtimes/cloud/auiV0.d.ts +10 -1
  26. package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
  27. package/dist/react/runtimes/cloud/auiV0.js +21 -3
  28. package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
  29. package/dist/react/runtimes/useToolInvocations.d.ts +2 -1
  30. package/dist/react/runtimes/useToolInvocations.d.ts.map +1 -1
  31. package/dist/react/runtimes/useToolInvocations.js +16 -1
  32. package/dist/react/runtimes/useToolInvocations.js.map +1 -1
  33. package/dist/react/types/scopes/tools.d.ts +4 -0
  34. package/dist/react/types/scopes/tools.d.ts.map +1 -1
  35. package/dist/runtime/api/composer-runtime.d.ts +1 -0
  36. package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
  37. package/dist/runtime/api/composer-runtime.js +2 -0
  38. package/dist/runtime/api/composer-runtime.js.map +1 -1
  39. package/dist/runtime/api/thread-runtime.d.ts +2 -0
  40. package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
  41. package/dist/runtime/base/base-composer-runtime-core.d.ts +1 -0
  42. package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
  43. package/dist/runtime/base/base-composer-runtime-core.js +1 -1
  44. package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
  45. package/dist/runtime/base/base-thread-runtime-core.d.ts +1 -0
  46. package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
  47. package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
  48. package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +1 -0
  49. package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
  50. package/dist/runtime/base/default-edit-composer-runtime-core.js +3 -0
  51. package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
  52. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +1 -0
  53. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
  54. package/dist/runtime/base/default-thread-composer-runtime-core.js +12 -1
  55. package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
  56. package/dist/runtime/interfaces/composer-runtime-core.d.ts +1 -0
  57. package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
  58. package/dist/runtime/interfaces/thread-runtime-core.d.ts +6 -0
  59. package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
  60. package/dist/runtimes/external-store/external-store-adapter.d.ts +15 -0
  61. package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
  62. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +1 -1
  63. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
  64. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +14 -12
  65. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
  66. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +1 -0
  67. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
  68. package/dist/runtimes/external-store/external-store-thread-runtime-core.js +2 -0
  69. package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
  70. package/dist/runtimes/local/local-thread-runtime-core.d.ts +1 -0
  71. package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
  72. package/dist/runtimes/local/local-thread-runtime-core.js +1 -0
  73. package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
  74. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +2 -0
  75. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
  76. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +2 -0
  77. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
  78. package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
  79. package/dist/runtimes/remote-thread-list/empty-thread-core.js +2 -0
  80. package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -1
  81. package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
  82. package/dist/store/clients/no-op-composer-client.js +1 -0
  83. package/dist/store/clients/no-op-composer-client.js.map +1 -1
  84. package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
  85. package/dist/store/runtime-clients/composer-runtime-client.js +1 -0
  86. package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
  87. package/dist/store/scopes/composer.d.ts +9 -0
  88. package/dist/store/scopes/composer.d.ts.map +1 -1
  89. package/dist/types/index.d.ts +1 -1
  90. package/dist/types/index.d.ts.map +1 -1
  91. package/dist/types/message.d.ts +28 -1
  92. package/dist/types/message.d.ts.map +1 -1
  93. package/dist/types/message.js +2 -1
  94. package/dist/types/message.js.map +1 -1
  95. package/package.json +6 -7
  96. package/src/index.ts +6 -0
  97. package/src/react/client/Tools.ts +46 -22
  98. package/src/react/index.ts +1 -1
  99. package/src/react/primitive-hooks/useComposerSend.ts +2 -3
  100. package/src/react/primitives/message/MessageAttachments.test.tsx +50 -0
  101. package/src/react/primitives/message/MessageAttachments.tsx +1 -1
  102. package/src/react/primitives/message/MessageParts.tsx +20 -9
  103. package/src/react/runtimes/cloud/auiV0.ts +37 -4
  104. package/src/react/runtimes/useToolInvocations.ts +21 -1
  105. package/src/react/types/scopes/tools.ts +5 -0
  106. package/src/runtime/api/composer-runtime.ts +3 -0
  107. package/src/runtime/base/base-composer-runtime-core.ts +2 -1
  108. package/src/runtime/base/base-thread-runtime-core.ts +1 -0
  109. package/src/runtime/base/default-edit-composer-runtime-core.ts +4 -0
  110. package/src/runtime/base/default-thread-composer-runtime-core.ts +12 -1
  111. package/src/runtime/interfaces/composer-runtime-core.ts +1 -0
  112. package/src/runtime/interfaces/thread-runtime-core.ts +6 -0
  113. package/src/runtimes/external-store/external-store-adapter.ts +15 -0
  114. package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +15 -9
  115. package/src/runtimes/external-store/external-store-thread-runtime-core.ts +2 -0
  116. package/src/runtimes/local/local-thread-runtime-core.ts +1 -0
  117. package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +2 -0
  118. package/src/runtimes/remote-thread-list/empty-thread-core.ts +2 -0
  119. package/src/store/clients/no-op-composer-client.ts +1 -0
  120. package/src/store/runtime-clients/composer-runtime-client.ts +1 -0
  121. package/src/store/scopes/composer.ts +9 -0
  122. package/src/tests/auiV0Encode.test.ts +55 -0
  123. package/src/tests/composer-can-send.test.ts +112 -0
  124. package/src/tests/external-store-thread-list-runtime-core.test.ts +34 -0
  125. package/src/types/index.ts +2 -0
  126. package/src/types/message.ts +44 -7
@@ -1,5 +1,7 @@
1
1
  import type { ReadonlyJSONObject, ReadonlyJSONValue } from "assistant-stream/utils";
2
+ import type { ToolModelContentPart } from "assistant-stream";
2
3
  import type { CompleteAttachment } from "./attachment.js";
4
+ export type { ToolModelContentPart };
3
5
  export type TextMessagePart = {
4
6
  readonly type: "text";
5
7
  readonly text: string;
@@ -10,12 +12,26 @@ export type ReasoningMessagePart = {
10
12
  readonly text: string;
11
13
  readonly parentId?: string;
12
14
  };
15
+ export type SourceProviderMetadata = {
16
+ readonly [providerName: string]: ReadonlyJSONObject;
17
+ };
13
18
  export type SourceMessagePart = {
14
19
  readonly type: "source";
15
20
  readonly sourceType: "url";
16
21
  readonly id: string;
17
22
  readonly url: string;
18
23
  readonly title?: string;
24
+ readonly providerMetadata?: SourceProviderMetadata;
25
+ readonly parentId?: string;
26
+ } | {
27
+ readonly type: "source";
28
+ readonly sourceType: "document";
29
+ readonly id: string;
30
+ readonly url?: undefined;
31
+ readonly title: string;
32
+ readonly mediaType: string;
33
+ readonly filename?: string;
34
+ readonly providerMetadata?: SourceProviderMetadata;
19
35
  readonly parentId?: string;
20
36
  };
21
37
  export type ImageMessagePart = {
@@ -42,6 +58,16 @@ export type DataMessagePart<T = any> = {
42
58
  readonly name: string;
43
59
  readonly data: T;
44
60
  };
61
+ export type McpAppMetadata = {
62
+ readonly resourceUri: string;
63
+ readonly mimeType?: string;
64
+ readonly visibility?: readonly ("model" | "app")[];
65
+ };
66
+ export declare const MCP_APP_URI_SCHEME = "ui://";
67
+ export declare const isMcpAppUri: (uri: string | undefined) => boolean;
68
+ export type ToolCallMessagePartMcpMetadata = {
69
+ readonly app?: McpAppMetadata;
70
+ };
45
71
  export type ToolCallMessagePart<TArgs = ReadonlyJSONObject, TResult = unknown> = {
46
72
  readonly type: "tool-call";
47
73
  readonly toolCallId: string;
@@ -51,6 +77,8 @@ export type ToolCallMessagePart<TArgs = ReadonlyJSONObject, TResult = unknown> =
51
77
  readonly isError?: boolean | undefined;
52
78
  readonly argsText: string;
53
79
  readonly artifact?: unknown;
80
+ readonly mcp?: ToolCallMessagePartMcpMetadata;
81
+ readonly modelContent?: readonly ToolModelContentPart[] | undefined;
54
82
  readonly interrupt?: {
55
83
  type: "human";
56
84
  payload: unknown;
@@ -176,5 +204,4 @@ export type AppendMessage = Omit<ThreadMessage, "id"> & {
176
204
  runConfig: RunConfig | undefined;
177
205
  startRun?: boolean | undefined;
178
206
  };
179
- export {};
180
207
  //# sourceMappingURL=message.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAqB;AAEvD,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAA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AAS,UAAU,EAAE,CAAC;QACvC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;YAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAA;SAAE,CAAC;QACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;QAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC1C,CAAC;IACF,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,CAAC,mBAAmB,GAAG,iBAAiB,GAAG,sBAAsB,CAAC,CAAC;AAErE,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG;IACtD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC,CAAC"}
@@ -1,2 +1,3 @@
1
- export {};
1
+ export const MCP_APP_URI_SCHEME = "ui://";
2
+ export const isMcpAppUri = (uri) => !!uri?.startsWith(MCP_APP_URI_SCHEME);
2
3
  //# sourceMappingURL=message.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":"AAiFA,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAE1C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAuB,EAAW,EAAE,CAC9D,CAAC,CAAC,GAAG,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assistant-ui/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Framework-agnostic core runtime for assistant-ui",
5
5
  "keywords": [
6
6
  "assistant",
@@ -59,7 +59,7 @@
59
59
  ],
60
60
  "sideEffects": false,
61
61
  "dependencies": {
62
- "assistant-stream": "^0.3.13",
62
+ "assistant-stream": "^0.3.14",
63
63
  "nanoid": "^5.1.11"
64
64
  },
65
65
  "peerDependencies": {
@@ -89,14 +89,13 @@
89
89
  "react": "^19.2.5",
90
90
  "vitest": "^4.1.5",
91
91
  "zustand": "^5.0.13",
92
- "@assistant-ui/store": "0.2.10",
93
- "@assistant-ui/tap": "0.5.11",
94
92
  "@assistant-ui/x-buildutils": "0.0.7",
95
- "assistant-cloud": "0.1.27"
93
+ "@assistant-ui/store": "0.2.10",
94
+ "assistant-cloud": "0.1.27",
95
+ "@assistant-ui/tap": "0.5.11"
96
96
  },
97
97
  "publishConfig": {
98
- "access": "public",
99
- "provenance": true
98
+ "access": "public"
100
99
  },
101
100
  "homepage": "https://www.assistant-ui.com/",
102
101
  "repository": {
package/src/index.ts CHANGED
@@ -4,12 +4,16 @@ export type {
4
4
  // Message parts
5
5
  TextMessagePart,
6
6
  ReasoningMessagePart,
7
+ SourceProviderMetadata,
7
8
  SourceMessagePart,
8
9
  ImageMessagePart,
9
10
  FileMessagePart,
10
11
  DataMessagePart,
11
12
  Unstable_AudioMessagePart,
12
13
  ToolCallMessagePart,
14
+ ToolCallMessagePartMcpMetadata,
15
+ McpAppMetadata,
16
+ ToolModelContentPart,
13
17
  ThreadUserMessagePart,
14
18
  ThreadAssistantMessagePart,
15
19
  // Message status
@@ -29,6 +33,8 @@ export type {
29
33
  AppendMessage,
30
34
  } from "./types/message";
31
35
 
36
+ export { MCP_APP_URI_SCHEME, isMcpAppUri } from "./types/message";
37
+
32
38
  export type {
33
39
  Attachment,
34
40
  PendingAttachment,
@@ -1,46 +1,70 @@
1
- import { resource, tapState, tapEffect, tapCallback } from "@assistant-ui/tap";
1
+ import {
2
+ resource,
3
+ tapState,
4
+ tapEffect,
5
+ tapCallback,
6
+ tapMemo,
7
+ tapResources,
8
+ withKey,
9
+ type ResourceElement,
10
+ } from "@assistant-ui/tap";
2
11
  import {
3
12
  tapAssistantClientRef,
4
13
  type ClientOutput,
5
14
  attachTransformScopes,
6
15
  } from "@assistant-ui/store";
7
- import type { ToolsState } from "../types/scopes/tools";
16
+ import type { McpAppResourceOutput, ToolsState } from "../types/scopes/tools";
8
17
  import type { Tool } from "assistant-stream";
9
18
  import type { Toolkit } from "../model-context/toolbox";
10
19
  import type { ToolCallMessagePartComponent } from "../types/MessagePartComponentTypes";
11
20
  import { ModelContext } from "../../store";
12
21
 
22
+ export type { McpAppResourceOutput };
23
+
13
24
  export const Tools = resource(
14
- ({ toolkit }: { toolkit?: Toolkit }): ClientOutput<"tools"> => {
15
- const [state, setState] = tapState<ToolsState>(() => ({
25
+ ({
26
+ toolkit,
27
+ mcpApp,
28
+ }: {
29
+ toolkit?: Toolkit;
30
+ mcpApp?: ResourceElement<McpAppResourceOutput> | undefined;
31
+ }): ClientOutput<"tools"> => {
32
+ const mcpAppOutputs = tapResources(
33
+ () => (mcpApp ? [withKey("mcpApp", mcpApp)] : []),
34
+ [mcpApp],
35
+ );
36
+ const mcpAppOutput = mcpAppOutputs[0];
37
+
38
+ const [toolsState, setToolsState] = tapState<{
39
+ tools: ToolsState["tools"];
40
+ }>(() => ({
16
41
  tools: {},
17
42
  }));
18
43
 
44
+ const state = tapMemo(
45
+ (): ToolsState => ({ tools: toolsState.tools, mcpApp: mcpAppOutput }),
46
+ [toolsState, mcpAppOutput],
47
+ );
48
+
19
49
  const clientRef = tapAssistantClientRef();
20
50
 
21
51
  const setToolUI = tapCallback(
22
52
  (toolName: string, render: ToolCallMessagePartComponent) => {
23
- setState((prev) => {
24
- return {
25
- ...prev,
53
+ setToolsState((prev) => ({
54
+ tools: {
55
+ ...prev.tools,
56
+ [toolName]: [...(prev.tools[toolName] ?? []), render],
57
+ },
58
+ }));
59
+
60
+ return () => {
61
+ setToolsState((prev) => ({
26
62
  tools: {
27
63
  ...prev.tools,
28
- [toolName]: [...(prev.tools[toolName] ?? []), render],
64
+ [toolName]:
65
+ prev.tools[toolName]?.filter((r) => r !== render) ?? [],
29
66
  },
30
- };
31
- });
32
-
33
- return () => {
34
- setState((prev) => {
35
- return {
36
- ...prev,
37
- tools: {
38
- ...prev.tools,
39
- [toolName]:
40
- prev.tools[toolName]?.filter((r) => r !== render) ?? [],
41
- },
42
- };
43
- });
67
+ }));
44
68
  };
45
69
  },
46
70
  [],
@@ -43,7 +43,7 @@ export {
43
43
  } from "./model-context/useToolArgsStatus";
44
44
 
45
45
  // client
46
- export { Tools } from "./client/Tools";
46
+ export { Tools, type McpAppResourceOutput } from "./client/Tools";
47
47
  export { DataRenderers } from "./client/DataRenderers";
48
48
  export { Interactables } from "./client/Interactables";
49
49
 
@@ -6,9 +6,8 @@ export const useComposerSend = () => {
6
6
  const aui = useAui();
7
7
  const disabled = useAuiState(
8
8
  (s) =>
9
- (s.thread.isRunning && !s.thread.capabilities.queue) ||
10
- !s.composer.isEditing ||
11
- s.composer.isEmpty,
9
+ !s.composer.canSend ||
10
+ (s.thread.isRunning && !s.thread.capabilities.queue),
12
11
  );
13
12
 
14
13
  const send = useCallback(
@@ -0,0 +1,50 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import type { ReactElement } from "react";
3
+ import { MessagePrimitiveAttachments } from "./MessageAttachments";
4
+
5
+ const mockUseAuiState = vi.fn();
6
+ type UseAuiStateSelector = Parameters<
7
+ typeof import("@assistant-ui/store")["useAuiState"]
8
+ >[0];
9
+ type AttachmentsElement = ReactElement<{ children: () => null }>;
10
+
11
+ vi.mock("react", async (importOriginal) => {
12
+ const actual = await importOriginal<typeof import("react")>();
13
+ return {
14
+ ...actual,
15
+ useMemo: (factory: () => unknown) => factory(),
16
+ };
17
+ });
18
+
19
+ vi.mock("@assistant-ui/store", async (importOriginal) => {
20
+ const actual = await importOriginal<typeof import("@assistant-ui/store")>();
21
+ return {
22
+ ...actual,
23
+ useAuiState: (selector: UseAuiStateSelector) => mockUseAuiState(selector),
24
+ };
25
+ });
26
+
27
+ const renderAttachmentsInner = () => {
28
+ const element = MessagePrimitiveAttachments({
29
+ children: () => null,
30
+ }) as AttachmentsElement;
31
+
32
+ const Inner = element.type as (props: typeof element.props) => unknown;
33
+ return Inner(element.props);
34
+ };
35
+
36
+ describe("MessagePrimitiveAttachments", () => {
37
+ it("treats missing user message attachments as empty", () => {
38
+ mockUseAuiState.mockImplementation((selector: UseAuiStateSelector) =>
39
+ selector({
40
+ message: {
41
+ role: "user",
42
+ attachments: undefined,
43
+ },
44
+ } as never),
45
+ );
46
+
47
+ expect(() => renderAttachmentsInner()).not.toThrow();
48
+ expect(renderAttachmentsInner()).toEqual([]);
49
+ });
50
+ });
@@ -93,7 +93,7 @@ const MessagePrimitiveAttachmentsInner: FC<{
93
93
  }> = ({ children }) => {
94
94
  const attachmentsCount = useAuiState((s) => {
95
95
  if (s.message.role !== "user") return 0;
96
- return s.message.attachments.length;
96
+ return (s.message.attachments ?? []).length;
97
97
  });
98
98
 
99
99
  return useMemo(
@@ -31,8 +31,9 @@ import type {
31
31
  ReasoningGroupComponent,
32
32
  QuoteMessagePartComponent,
33
33
  } from "../../types/MessagePartComponentTypes";
34
- import type { MessagePartStatus } from "../../../types/message";
34
+ import { isMcpAppUri, type MessagePartStatus } from "../../../types/message";
35
35
  import type { DataRenderersState } from "../../types/scopes/dataRenderers";
36
+ import type { ToolsState } from "../../types/scopes/tools";
36
37
  import { useShallow } from "zustand/shallow";
37
38
 
38
39
  type MessagePartRange =
@@ -511,6 +512,19 @@ const QuoteRendererImpl: FC<{ Quote: QuoteMessagePartComponent }> = ({
511
512
 
512
513
  const QuoteRenderer = memo(QuoteRendererImpl);
513
514
 
515
+ function resolveToolRender(
516
+ toolsState: ToolsState,
517
+ part: Extract<PartState, { type: "tool-call" }>,
518
+ ): ToolCallMessagePartComponent | null {
519
+ const entry = toolsState.tools[part.toolName];
520
+ const named = Array.isArray(entry) ? (entry[0] ?? null) : (entry ?? null);
521
+ if (named) return named;
522
+ if (isMcpAppUri(part.mcp?.app?.resourceUri) && toolsState.mcpApp) {
523
+ return toolsState.mcpApp.render;
524
+ }
525
+ return null;
526
+ }
527
+
514
528
  /**
515
529
  * Stable propless component that renders the registered tool UI for the
516
530
  * current part context. Reads tool registry and part state from context.
@@ -518,12 +532,9 @@ const QuoteRenderer = memo(QuoteRendererImpl);
518
532
  const RegisteredToolUI: FC = () => {
519
533
  const aui = useAui();
520
534
  const part = useAuiState((s) => s.part);
521
- const Render = useAuiState((s) => {
522
- if (s.part.type !== "tool-call") return null;
523
- const entry = s.tools.tools[s.part.toolName];
524
- if (Array.isArray(entry)) return entry[0] ?? null;
525
- return entry ?? null;
526
- });
535
+ const Render = useAuiState((s) =>
536
+ s.part.type === "tool-call" ? resolveToolRender(s.tools, s.part) : null,
537
+ );
527
538
 
528
539
  if (!Render || part.type !== "tool-call") return null;
529
540
 
@@ -638,8 +649,8 @@ export const MessagePartChildren: FC<{
638
649
  get part() {
639
650
  const state = getItem();
640
651
  if (state.type === "tool-call") {
641
- const entry = aui.tools().getState().tools[state.toolName];
642
- const hasUI = Array.isArray(entry) ? !!entry[0] : !!entry;
652
+ const toolsState = aui.tools().getState();
653
+ const hasUI = resolveToolRender(toolsState, state) !== null;
643
654
  const partMethods = aui.message().part({ index });
644
655
  return {
645
656
  ...state,
@@ -1,4 +1,8 @@
1
- import type { MessageStatus, ThreadMessage } from "../../../types/message";
1
+ import type {
2
+ MessageStatus,
3
+ SourceProviderMetadata,
4
+ ThreadMessage,
5
+ } from "../../../types/message";
2
6
  import { fromThreadMessageLike } from "../../../runtime/utils/thread-message-like";
3
7
  import type { CloudMessage } from "assistant-cloud";
4
8
  import { isJSONValue } from "../../../utils/json/is-json";
@@ -23,6 +27,16 @@ type AuiV0MessagePart =
23
27
  readonly id: string;
24
28
  readonly url: string;
25
29
  readonly title?: string;
30
+ readonly providerMetadata?: SourceProviderMetadata;
31
+ }
32
+ | {
33
+ readonly type: "source";
34
+ readonly sourceType: "document";
35
+ readonly id: string;
36
+ readonly title: string;
37
+ readonly mediaType: string;
38
+ readonly filename?: string;
39
+ readonly providerMetadata?: SourceProviderMetadata;
26
40
  }
27
41
  | {
28
42
  readonly type: "tool-call";
@@ -90,12 +104,31 @@ export function auiV0Encode(message: ThreadMessage): AuiV0Message {
90
104
  return { type: "reasoning", text: part.text };
91
105
 
92
106
  case "source":
107
+ if (part.sourceType === "url") {
108
+ return {
109
+ type: "source",
110
+ sourceType: "url",
111
+ id: part.id,
112
+ url: part.url,
113
+ ...(part.title != null ? { title: part.title } : undefined),
114
+ ...(part.providerMetadata != null
115
+ ? { providerMetadata: part.providerMetadata }
116
+ : undefined),
117
+ };
118
+ }
119
+
93
120
  return {
94
121
  type: "source",
95
- sourceType: part.sourceType,
122
+ sourceType: "document",
96
123
  id: part.id,
97
- url: part.url,
98
- ...(part.title ? { title: part.title } : undefined),
124
+ title: part.title,
125
+ mediaType: part.mediaType,
126
+ ...(part.filename != null
127
+ ? { filename: part.filename }
128
+ : undefined),
129
+ ...(part.providerMetadata != null
130
+ ? { providerMetadata: part.providerMetadata }
131
+ : undefined),
99
132
  };
100
133
 
101
134
  case "tool-call": {
@@ -7,6 +7,7 @@ import {
7
7
  ToolResponse,
8
8
  unstable_toolResultStream,
9
9
  type Tool,
10
+ type ToolModelContentPart,
10
11
  } from "assistant-stream";
11
12
  import {
12
13
  AssistantMetaTransformStream,
@@ -28,6 +29,7 @@ export type AddToolResultCommand = {
28
29
  readonly result: ReadonlyJSONValue;
29
30
  readonly isError: boolean;
30
31
  readonly artifact?: ReadonlyJSONValue;
32
+ readonly modelContent?: readonly ToolModelContentPart[];
31
33
  };
32
34
 
33
35
  const isArgsTextComplete = (argsText: string) => {
@@ -124,6 +126,7 @@ export function useToolInvocations({
124
126
  Object.entries(tools).map(([name, tool]) => {
125
127
  const execute = tool.execute;
126
128
  const streamCall = tool.streamCall;
129
+ const toModelOutput = tool.toModelOutput;
127
130
 
128
131
  const wrappedTool = {
129
132
  ...tool,
@@ -145,6 +148,15 @@ export function useToolInvocations({
145
148
  toolCallId: getLogicalToolCallId(context.toolCallId),
146
149
  }),
147
150
  }),
151
+ ...(toModelOutput !== undefined && {
152
+ toModelOutput: (
153
+ options: Parameters<NonNullable<typeof toModelOutput>>[0],
154
+ ) =>
155
+ toModelOutput({
156
+ ...options,
157
+ toolCallId: getLogicalToolCallId(options.toolCallId),
158
+ }),
159
+ }),
148
160
  } as Tool;
149
161
  return [name, wrappedTool];
150
162
  }),
@@ -249,7 +261,12 @@ export function useToolInvocations({
249
261
  toolName: chunk.meta.toolName,
250
262
  result: chunk.result,
251
263
  isError: chunk.isError,
252
- ...(chunk.artifact && { artifact: chunk.artifact }),
264
+ ...(chunk.artifact !== undefined && {
265
+ artifact: chunk.artifact,
266
+ }),
267
+ ...(chunk.modelContent !== undefined && {
268
+ modelContent: chunk.modelContent,
269
+ }),
253
270
  });
254
271
  }
255
272
  },
@@ -533,6 +550,9 @@ export function useToolInvocations({
533
550
  result: content.result as ReadonlyJSONValue,
534
551
  artifact: content.artifact as ReadonlyJSONValue | undefined,
535
552
  isError: content.isError,
553
+ ...(content.modelContent !== undefined
554
+ ? { modelContent: content.modelContent }
555
+ : {}),
536
556
  }),
537
557
  );
538
558
  lastState.controller.close();
@@ -1,8 +1,13 @@
1
1
  import type { ToolCallMessagePartComponent } from "../MessagePartComponentTypes";
2
2
  import type { Unsubscribe } from "../../..";
3
3
 
4
+ export type McpAppResourceOutput = {
5
+ readonly render: ToolCallMessagePartComponent;
6
+ };
7
+
4
8
  export type ToolsState = {
5
9
  tools: Record<string, ToolCallMessagePartComponent[]>;
10
+ mcpApp?: McpAppResourceOutput | undefined;
6
11
  };
7
12
 
8
13
  export type ToolsMethods = {
@@ -41,6 +41,7 @@ export type {
41
41
 
42
42
  type BaseComposerState = {
43
43
  readonly canCancel: boolean;
44
+ readonly canSend: boolean;
44
45
  readonly isEditing: boolean;
45
46
  readonly isEmpty: boolean;
46
47
 
@@ -86,6 +87,7 @@ const getThreadComposerState = (
86
87
 
87
88
  isEditing: runtime?.isEditing ?? false,
88
89
  canCancel: runtime?.canCancel ?? false,
90
+ canSend: runtime?.canSend ?? false,
89
91
  isEmpty: runtime?.isEmpty ?? true,
90
92
 
91
93
  attachments: runtime?.attachments ?? EMPTY_ARRAY,
@@ -108,6 +110,7 @@ const getEditComposerState = (
108
110
 
109
111
  isEditing: runtime?.isEditing ?? false,
110
112
  canCancel: runtime?.canCancel ?? false,
113
+ canSend: runtime?.canSend ?? false,
111
114
  isEmpty: runtime?.isEmpty ?? true,
112
115
 
113
116
  text: runtime?.text ?? "",
@@ -52,6 +52,7 @@ export abstract class BaseComposerRuntimeCore
52
52
  }
53
53
 
54
54
  public abstract get canCancel(): boolean;
55
+ public abstract get canSend(): boolean;
55
56
 
56
57
  public get isEmpty() {
57
58
  return !this.text.trim() && !this.attachments.length;
@@ -157,7 +158,7 @@ export abstract class BaseComposerRuntimeCore
157
158
  }
158
159
 
159
160
  public async send(options?: SendOptions) {
160
- if (this.isEmpty) return;
161
+ if (!this.canSend) return;
161
162
 
162
163
  if (this._dictationSession) {
163
164
  this._dictationSession.cancel();
@@ -48,6 +48,7 @@ export abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {
48
48
  protected readonly repository = new MessageRepository();
49
49
  public abstract get adapters(): BaseThreadAdapters | undefined;
50
50
  public abstract get isDisabled(): boolean;
51
+ public abstract get isSendDisabled(): boolean;
51
52
  public abstract get isLoading(): boolean;
52
53
  public abstract get suggestions(): readonly ThreadSuggestion[];
53
54
  public abstract get extras(): unknown;
@@ -13,6 +13,10 @@ export class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {
13
13
  return true;
14
14
  }
15
15
 
16
+ public get canSend() {
17
+ return !this.isEmpty;
18
+ }
19
+
16
20
  protected getAttachmentAdapter() {
17
21
  return this.runtime.adapters?.attachments;
18
22
  }
@@ -17,6 +17,10 @@ export class DefaultThreadComposerRuntimeCore
17
17
  return this._canCancel;
18
18
  }
19
19
 
20
+ public get canSend() {
21
+ return !this.isEmpty && !this.runtime.isSendDisabled;
22
+ }
23
+
20
24
  protected getAttachmentAdapter() {
21
25
  return this.runtime.adapters?.attachments;
22
26
  }
@@ -40,11 +44,18 @@ export class DefaultThreadComposerRuntimeCore
40
44
  }
41
45
 
42
46
  public connect() {
47
+ let lastIsSendDisabled = this.runtime.isSendDisabled;
43
48
  return this.runtime.subscribe(() => {
49
+ let changed = false;
44
50
  if (this.canCancel !== this.runtime.capabilities.cancel) {
45
51
  this._canCancel = this.runtime.capabilities.cancel;
46
- this._notifySubscribers();
52
+ changed = true;
53
+ }
54
+ if (lastIsSendDisabled !== this.runtime.isSendDisabled) {
55
+ lastIsSendDisabled = this.runtime.isSendDisabled;
56
+ changed = true;
47
57
  }
58
+ if (changed) this._notifySubscribers();
48
59
  });
49
60
  }
50
61
 
@@ -51,6 +51,7 @@ export type ComposerRuntimeCore = Readonly<{
51
51
  isEditing: boolean;
52
52
 
53
53
  canCancel: boolean;
54
+ canSend: boolean;
54
55
  isEmpty: boolean;
55
56
 
56
57
  attachments: readonly Attachment[];
@@ -158,6 +158,12 @@ export type ThreadRuntimeCore = Readonly<{
158
158
 
159
159
  capabilities: Readonly<RuntimeCapabilities>;
160
160
  isDisabled: boolean;
161
+ /**
162
+ * Whether sending from this thread's composer is disabled. Surfaces the
163
+ * `isSendDisabled` flag from external-store adapters; internal runtimes
164
+ * default to `false`. Composer state derives `canSend` from this.
165
+ */
166
+ isSendDisabled: boolean;
161
167
  isLoading: boolean;
162
168
  /**
163
169
  * Optional explicit thread-level running flag. When provided, takes