@jini-ai/chat 0.7.2 → 0.7.3-next.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 (202) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +3 -3
  3. package/dist/contracts/chat-bubble-style.d.ts +1 -1
  4. package/dist/contracts/chat-bubble-style.js +1 -1
  5. package/dist/core/ag-ui/event-projection.d.ts +125 -0
  6. package/dist/core/ag-ui/event-projection.js +275 -0
  7. package/dist/core/ag-ui/event-reduction.d.ts +39 -0
  8. package/dist/core/ag-ui/event-reduction.js +99 -0
  9. package/dist/core/ag-ui/run-input.d.ts +53 -0
  10. package/dist/core/ag-ui/run-input.js +87 -0
  11. package/dist/core/agentic/chat-capabilities.d.ts +1 -1
  12. package/dist/core/agentic/index.d.ts +2 -4
  13. package/dist/core/agentic/index.js +2 -3
  14. package/dist/core/agents-port.d.ts +50 -0
  15. package/dist/core/agents-port.js +2 -0
  16. package/dist/core/assistant-client/ag-ui-fetch-agent.d.ts +16 -0
  17. package/dist/core/assistant-client/ag-ui-fetch-agent.js +24 -0
  18. package/dist/core/assistant-client/ag-ui-transport.d.ts +15 -1
  19. package/dist/core/assistant-client/ag-ui-transport.js +167 -145
  20. package/dist/core/assistant-client/attachment-liveness.js +13 -11
  21. package/dist/core/assistant-client/durable-run-subscription.d.ts +3 -2
  22. package/dist/core/assistant-client/durable-run-subscription.js +6 -5
  23. package/dist/core/assistant-client/messages.d.ts +7 -4
  24. package/dist/core/assistant-client/messages.js +5 -4
  25. package/dist/core/assistant-client/transport.d.ts +1 -1
  26. package/dist/core/assistant-client/transport.js +4 -4
  27. package/dist/core/index.d.ts +2 -0
  28. package/dist/core/index.js +1 -0
  29. package/dist/core/page-port.d.ts +15 -0
  30. package/dist/core/page-port.js +2 -0
  31. package/dist/core/run-activity.js +1 -1
  32. package/dist/core/run-events/entry.js +1 -0
  33. package/dist/core/user-text-redaction.d.ts +1 -3
  34. package/dist/core/user-text-redaction.js +3 -61
  35. package/dist/embed-widget/browser/agent-inventory.d.ts +37 -0
  36. package/dist/embed-widget/browser/agent-inventory.js +36 -0
  37. package/dist/embed-widget/browser/frontend-session-bridge.d.ts +2 -2
  38. package/dist/embed-widget/browser/frontend-session-bridge.js +17 -14
  39. package/dist/embed-widget/react/dialog.hooks.d.ts +16 -0
  40. package/dist/embed-widget/react/dialog.hooks.js +15 -0
  41. package/dist/embed-widget/react/embed.d.ts +7 -2
  42. package/dist/embed-widget/react/embed.js +6 -16
  43. package/dist/embed-widget/react/header.d.ts +4 -1
  44. package/dist/embed-widget/react/header.js +2 -2
  45. package/dist/embed-widget/vanilla/state.js +2 -2
  46. package/dist/embed-widget/vanilla/style.css +4 -4
  47. package/dist/react/components/A2uiSurfaceCard.d.ts +18 -4
  48. package/dist/react/components/A2uiSurfaceCard.hooks.d.ts +36 -0
  49. package/dist/react/components/A2uiSurfaceCard.hooks.js +174 -0
  50. package/dist/react/components/A2uiSurfaceCard.js +14 -227
  51. package/dist/react/components/A2uiSurfaceCard.rules.d.ts +14 -0
  52. package/dist/react/components/A2uiSurfaceCard.rules.js +24 -0
  53. package/dist/react/components/AttachmentPreviewModal.d.ts +21 -1
  54. package/dist/react/components/AttachmentPreviewModal.hooks.js +1 -3
  55. package/dist/react/components/AttachmentPreviewModal.js +11 -9
  56. package/dist/react/components/AttachmentTray.d.ts +11 -1
  57. package/dist/react/components/AttachmentTray.js +12 -8
  58. package/dist/react/components/ChatFab.d.ts +10 -1
  59. package/dist/react/components/ChatFab.js +2 -2
  60. package/dist/react/components/ChatSettingsDialog.d.ts +4 -3
  61. package/dist/react/components/ChatSettingsDialog.js +9 -6
  62. package/dist/react/components/ChatSettingsSegmented.d.ts +1 -1
  63. package/dist/react/components/ChatSettingsSegmented.js +1 -1
  64. package/dist/react/components/Composer.d.ts +9 -1
  65. package/dist/react/components/Composer.hooks.d.ts +79 -0
  66. package/dist/react/components/Composer.hooks.js +336 -0
  67. package/dist/react/components/Composer.js +40 -341
  68. package/dist/react/components/ComposerDiscovery.js +1 -1
  69. package/dist/react/components/ConversationList.d.ts +34 -1
  70. package/dist/react/components/ConversationList.hooks.d.ts +37 -0
  71. package/dist/react/components/ConversationList.hooks.js +177 -1
  72. package/dist/react/components/ConversationList.js +7 -174
  73. package/dist/react/components/ConversationTitleEditor.d.ts +17 -2
  74. package/dist/react/components/ConversationTitleEditor.hooks.d.ts +15 -0
  75. package/dist/react/components/ConversationTitleEditor.hooks.js +36 -0
  76. package/dist/react/components/ConversationTitleEditor.js +11 -34
  77. package/dist/react/components/CopyMessageButton.d.ts +6 -1
  78. package/dist/react/components/CopyMessageButton.js +4 -4
  79. package/dist/react/components/ExtEventErrorBoundary.d.ts +2 -0
  80. package/dist/react/components/ExtEventErrorBoundary.js +5 -3
  81. package/dist/react/components/FolderChips.d.ts +11 -1
  82. package/dist/react/components/FolderChips.hooks.d.ts +12 -0
  83. package/dist/react/components/FolderChips.hooks.js +10 -0
  84. package/dist/react/components/FolderChips.js +9 -9
  85. package/dist/react/components/Markdown.js +7 -5
  86. package/dist/react/components/McpUiSurfaceCard.d.ts +29 -5
  87. package/dist/react/components/McpUiSurfaceCard.js +29 -16
  88. package/dist/react/components/MessageList.d.ts +10 -1
  89. package/dist/react/components/MessageList.hooks.js +4 -2
  90. package/dist/react/components/MessageList.js +12 -8
  91. package/dist/react/components/MessageRow.d.ts +46 -2
  92. package/dist/react/components/MessageRow.hooks.d.ts +60 -0
  93. package/dist/react/components/MessageRow.hooks.js +94 -0
  94. package/dist/react/components/MessageRow.js +53 -113
  95. package/dist/react/components/MidRunUserMessage.d.ts +6 -1
  96. package/dist/react/components/MidRunUserMessage.js +5 -5
  97. package/dist/react/components/NextStepActions.d.ts +3 -1
  98. package/dist/react/components/NextStepActions.js +3 -3
  99. package/dist/react/components/QuestionForm.answers.hooks.d.ts +26 -0
  100. package/dist/react/components/QuestionForm.answers.hooks.js +89 -0
  101. package/dist/react/components/QuestionForm.d.ts +6 -0
  102. package/dist/react/components/QuestionForm.js +23 -261
  103. package/dist/react/components/QuestionForm.values.d.ts +22 -0
  104. package/dist/react/components/QuestionForm.values.js +58 -0
  105. package/dist/react/components/QuestionFormField.d.ts +17 -0
  106. package/dist/react/components/QuestionFormField.js +114 -0
  107. package/dist/react/components/QuestionsPanel.d.ts +3 -1
  108. package/dist/react/components/QuestionsPanel.js +7 -3
  109. package/dist/react/components/SentAttachment.d.ts +11 -2
  110. package/dist/react/components/SentAttachment.hooks.d.ts +1 -1
  111. package/dist/react/components/SentAttachment.hooks.js +6 -5
  112. package/dist/react/components/SentAttachment.js +5 -3
  113. package/dist/react/components/TodoCard.d.ts +3 -1
  114. package/dist/react/components/TodoCard.js +9 -4
  115. package/dist/react/components/ToolCallGroup.d.ts +11 -1
  116. package/dist/react/components/ToolCallGroup.js +10 -4
  117. package/dist/react/components/ToolCard.d.ts +6 -1
  118. package/dist/react/components/ToolCard.js +79 -69
  119. package/dist/react/components/mcp-ui-question-input.d.ts +1 -1
  120. package/dist/react/components/mcp-ui-question-input.js +3 -3
  121. package/dist/react/components/mcp-ui-surface-state.d.ts +1 -1
  122. package/dist/react/features/chat-pane/agent-tools.d.ts +1 -1
  123. package/dist/react/features/chat-pane/antigravity/model-options.d.ts +2 -0
  124. package/dist/react/features/chat-pane/antigravity/model-options.js +2 -0
  125. package/dist/react/features/chat-pane/claude/model-options.d.ts +2 -0
  126. package/dist/react/features/chat-pane/claude/model-options.js +2 -0
  127. package/dist/react/features/chat-pane/codex/model-options.d.ts +2 -0
  128. package/dist/react/features/chat-pane/codex/model-options.js +2 -0
  129. package/dist/react/features/chat-pane/components/AgentPluginUsage.d.ts +4 -1
  130. package/dist/react/features/chat-pane/components/AgentPluginUsage.js +2 -2
  131. package/dist/react/features/chat-pane/components/AgentRuntimePicker.d.ts +10 -6
  132. package/dist/react/features/chat-pane/components/AgentRuntimePicker.js +18 -132
  133. package/dist/react/features/chat-pane/components/ChatPane.d.ts +24 -2
  134. package/dist/react/features/chat-pane/components/ChatPane.js +45 -297
  135. package/dist/react/features/chat-pane/components/ChatPaneComposerArea.d.ts +33 -0
  136. package/dist/react/features/chat-pane/components/ChatPaneComposerArea.js +119 -0
  137. package/dist/react/features/chat-pane/components/ChatPaneLayout.d.ts +42 -0
  138. package/dist/react/features/chat-pane/components/ChatPaneLayout.js +54 -0
  139. package/dist/react/features/chat-pane/components/ChatPaneStatus.d.ts +27 -0
  140. package/dist/react/features/chat-pane/components/ChatPaneStatus.js +91 -0
  141. package/dist/react/features/chat-pane/components/RuntimeDropUp.d.ts +6 -1
  142. package/dist/react/features/chat-pane/components/RuntimeDropUp.js +20 -19
  143. package/dist/react/features/chat-pane/components/RuntimePickerSections.d.ts +62 -0
  144. package/dist/react/features/chat-pane/components/RuntimePickerSections.js +122 -0
  145. package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.d.ts +1 -1
  146. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.d.ts +5 -3
  147. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js +78 -26
  148. package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.js +6 -6
  149. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.d.ts +5 -1
  150. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.js +7 -7
  151. package/dist/react/features/chat-pane/hooks/useRuntimeDropUp.hooks.d.ts +7 -0
  152. package/dist/react/features/chat-pane/hooks/useRuntimeDropUp.hooks.js +5 -0
  153. package/dist/react/features/chat-pane/model-options.js +7 -4
  154. package/dist/react/features/chat-pane/styles.d.ts +1 -1
  155. package/dist/react/features/chat-pane/styles.js +14 -14
  156. package/dist/react/features/chat-pane/types.d.ts +29 -1
  157. package/dist/react/hooks/assistant-chats-contracts.d.ts +1 -1
  158. package/dist/react/hooks/attachment-preview-cache.d.ts +1 -1
  159. package/dist/react/hooks/attachment-preview-cache.js +1 -1
  160. package/dist/react/hooks/fab-position.js +16 -18
  161. package/dist/react/hooks/useConversation.d.ts +6 -1
  162. package/dist/react/hooks/useConversation.js +11 -10
  163. package/dist/react/hooks/useRunStream.d.ts +3 -0
  164. package/dist/react/hooks/useRunStream.js +12 -12
  165. package/dist/react/hooks/useSurfaceRecovery.d.ts +1 -1
  166. package/dist/react/hooks/useSurfaceRecovery.js +2 -2
  167. package/dist/react/index.d.ts +6 -3
  168. package/dist/react/index.js +5 -3
  169. package/dist/react/styles/chat-settings.css +9 -9
  170. package/dist/react/surfaces.d.ts +91 -0
  171. package/dist/react/surfaces.js +28 -0
  172. package/dist/server/durable-runs/recover.d.ts +4 -3
  173. package/dist/server/durable-runs/recover.js +4 -3
  174. package/dist/store/legacy/sqlite/conversations.d.ts +1 -2
  175. package/dist/store/legacy/sqlite/conversations.js +1 -1
  176. package/dist/store/legacy/sqlite/messages.d.ts +2 -3
  177. package/dist/store/legacy/sqlite/messages.js +6 -6
  178. package/dist/store/pglite/index.d.ts +7 -7
  179. package/dist/store/pglite/index.js +1 -1
  180. package/dist/store/ports.d.ts +5 -2
  181. package/dist/store/postgres/index.d.ts +7 -7
  182. package/dist/store/postgres/index.js +1 -1
  183. package/dist/store/runtime/chat-expiry-sweep.js +2 -4
  184. package/dist/store/runtime/chat-history-store.js +2 -3
  185. package/dist/store/runtime/durable-run-store.js +16 -2
  186. package/dist/store/runtime/history-tools.js +33 -11
  187. package/dist/store/runtime/kernel.d.ts +3 -2
  188. package/dist/store/runtime/run-ledger.js +2 -2
  189. package/dist/store/sql/boundary.d.ts +5 -5
  190. package/dist/store/sql/maintenance.d.ts +3 -2
  191. package/dist/store/sql/store.d.ts +16 -8
  192. package/dist/store/sql/store.js +31 -14
  193. package/dist/store/sqlite/index.d.ts +11 -12
  194. package/dist/store/sqlite/index.js +5 -5
  195. package/dist/store/sqlite/schema.d.ts +1 -1
  196. package/package.json +49 -27
  197. package/dist/core/ag-ui/entry.d.ts +0 -84
  198. package/dist/core/ag-ui/entry.js +0 -225
  199. package/dist/core/browser/page-actions.d.ts +0 -121
  200. package/dist/core/browser/page-actions.js +0 -113
  201. package/dist/embed-widget/browser/page-actions.d.ts +0 -2
  202. package/dist/embed-widget/browser/page-actions.js +0 -3
@@ -8,7 +8,7 @@
8
8
  * else - a non-image, a reload, the cache's eviction cap, a browser that cannot decode the format -
9
9
  * stays the filename chip, which still opens the preview modal's honest fallback.
10
10
  */
11
- import { useEffect, useState } from 'react';
11
+ import { useEffect, useMemo, useState } from 'react';
12
12
  import { getAttachmentPreviewSource } from '../hooks/attachment-preview-cache.js';
13
13
  import { canCreateObjectUrl, looksLikeImageAttachment } from './AttachmentPreviewModal.hooks.js';
14
14
  /** The platform's Blob URLs, or `undefined` where they do not exist (jsdom, non-browser hosts). */
@@ -35,7 +35,9 @@ export function sentAttachmentThumbnailSource({ attachment }, { getSource = getA
35
35
  * @param options.getSource - Preview-cache lookup; defaults to the shared cache.
36
36
  * @complexity O(1) per attachment.
37
37
  */
38
- export function useSentAttachmentThumbnail({ attachment, hostRendered = false }, { objectUrls = platformObjectUrls(), getSource = getAttachmentPreviewSource } = {}) {
38
+ export function useSentAttachmentThumbnail({ attachment, hostRendered = false }, { objectUrls: suppliedObjectUrls, getSource = getAttachmentPreviewSource } = {}) {
39
+ // The default factory returns a fresh object, so keep it stable until the supplied port changes.
40
+ const objectUrls = useMemo(() => suppliedObjectUrls ?? platformObjectUrls(), [suppliedObjectUrls]);
39
41
  const [failed, setFailed] = useState(false);
40
42
  const [thumbnailUrl, setThumbnailUrl] = useState(undefined);
41
43
  // A host `renderAttachment` owns the chip's content, so no thumbnail URL is made for it.
@@ -48,9 +50,8 @@ export function useSentAttachmentThumbnail({ attachment, hostRendered = false },
48
50
  const url = objectUrls.create(source);
49
51
  setThumbnailUrl(url);
50
52
  return () => objectUrls.revoke(url);
51
- // `objectUrls` is a fresh object per render by default; the file is what the URL is made from.
52
- // eslint-disable-next-line react-hooks/exhaustive-deps
53
- }, [source]);
53
+ // The stable port and the source file both determine the URL and its matching cleanup.
54
+ }, [source, objectUrls]);
54
55
  return { thumbnailUrl, onThumbnailError: () => setFailed(true) };
55
56
  }
56
57
  //# sourceMappingURL=SentAttachment.hooks.js.map
@@ -1,14 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useT } from '../hooks/context.js';
3
3
  import { useSentAttachmentThumbnail } from './SentAttachment.hooks.js';
4
+ /** Hooks SentAttachmentButton calls; defaults to the real ones, a test hands in fakes. */
5
+ export const defaultSentAttachmentButtonHooks = { useT, useSentAttachmentThumbnail };
4
6
  /**
5
7
  * One attachment on a sent user message: a small image thumbnail when this browser still holds the
6
8
  * image's bytes, otherwise the filename chip. Either way a click opens the preview modal, and the
7
9
  * accessible name stays "Open {name}".
8
10
  */
9
- export function SentAttachmentButton({ attachment, onOpen, renderAttachment, objectUrls }) {
10
- const t = useT();
11
- const { thumbnailUrl, onThumbnailError } = useSentAttachmentThumbnail({ attachment, hostRendered: renderAttachment !== undefined }, objectUrls === undefined ? {} : { objectUrls });
11
+ export function SentAttachmentButton({ attachment, onOpen, renderAttachment, objectUrls, hooks = defaultSentAttachmentButtonHooks }) {
12
+ const t = hooks.useT();
13
+ const { thumbnailUrl, onThumbnailError } = hooks.useSentAttachmentThumbnail({ attachment, hostRendered: renderAttachment !== undefined }, objectUrls === undefined ? {} : { objectUrls });
12
14
  const fallback = thumbnailUrl
13
15
  ? _jsx("img", { className: "jini-message-attachment-thumb", src: thumbnailUrl, alt: "", onError: onThumbnailError })
14
16
  : attachment.name;
@@ -1,8 +1,10 @@
1
1
  import type { TodoItem } from '../../core/index.js';
2
+ import { useT } from '../hooks/context.js';
2
3
  export interface TodoCardProps {
3
4
  todos: TodoItem[];
4
5
  runStreaming?: boolean;
5
6
  onDismiss?: () => void;
7
+ useTHook?: typeof useT;
6
8
  }
7
- export declare function TodoCard({ todos, runStreaming, onDismiss }: TodoCardProps): import("react").JSX.Element;
9
+ export declare function TodoCard({ todos, runStreaming, onDismiss, useTHook }: TodoCardProps): import("react").JSX.Element;
8
10
  //# sourceMappingURL=TodoCard.d.ts.map
@@ -12,13 +12,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  import { useState } from 'react';
13
13
  import { useT } from '../hooks/context.js';
14
14
  import { Icon } from './Icon.js';
15
- export function TodoCard({ todos, runStreaming, onDismiss }) {
16
- const t = useT();
15
+ export function TodoCard({ todos, runStreaming, onDismiss, useTHook = useT }) {
16
+ const t = useTHook();
17
17
  const { defaultExpanded, inProgressTodo, done, allComplete } = todoProgress({ todos }, { runStreaming });
18
18
  const [overrideExpanded, setOverrideExpanded] = useState(null);
19
19
  const expanded = overrideExpanded ?? defaultExpanded;
20
- const showDismiss = Boolean(onDismiss) && allComplete;
21
- return (_jsxs("div", { className: `op-card op-todo${expanded ? '' : ' op-todo-collapsed'}`, children: [_jsxs("div", { className: "op-card-head op-todo-head", children: [_jsxs("button", { type: "button", className: "op-todo-toggle", "aria-expanded": expanded, onClick: () => setOverrideExpanded(!expanded), title: expanded ? t('Collapse todos') : t('Expand todos'), children: [_jsx("span", { className: "op-icon", "aria-hidden": true, children: "\u2610" }), _jsx("span", { className: "op-title", children: t('Todos') }), _jsxs("span", { className: "op-meta", children: [done, "/", todos.length] }), !expanded && inProgressTodo ? _jsx("span", { className: "op-todo-current", children: todoLabel({ todo: inProgressTodo }) }) : null, _jsx("span", { className: "op-todo-chev", "aria-hidden": true, children: expanded ? _jsx(Icon, { name: "chevron-down", size: 11 }) : _jsx(Icon, { name: "chevron-right", size: 11 }) })] }), showDismiss ? (_jsx("button", { type: "button", className: "op-todo-done", onClick: () => onDismiss?.(), title: t('Dismiss'), children: t('Done') })) : null] }), _jsx("div", { className: `accordion-collapsible${expanded ? ' open' : ''}`, children: _jsx("div", { className: "accordion-collapsible-inner", children: _jsx("ul", { className: "todo-list", children: todos.map((todo, i) => (_jsxs("li", { className: `todo-item todo-${todo.status}`, children: [_jsx("span", { className: "todo-check", "aria-hidden": true, children: todoStatusGlyph({ status: todo.status }) }), _jsx("span", { className: "todo-text", children: todoLabel({ todo }) })] }, i))) }) }) })] }));
20
+ return (_jsxs("div", { className: `op-card op-todo${expanded ? '' : ' op-todo-collapsed'}`, children: [_jsxs("div", { className: "op-card-head jini-op-todo-head", children: [_jsxs("button", { type: "button", className: "jini-op-todo-toggle", "aria-expanded": expanded, onClick: () => setOverrideExpanded(!expanded), title: expanded ? t('Collapse todos') : t('Expand todos'), children: [_jsx("span", { className: "jini-op-icon", "aria-hidden": true, children: "\u2610" }), _jsx("span", { className: "op-title", children: t('Todos') }), _jsxs("span", { className: "jini-op-meta", children: [done, "/", todos.length] }), !expanded && inProgressTodo ? _jsx("span", { className: "jini-op-todo-current", children: todoLabel({ todo: inProgressTodo }) }) : null, _jsx("span", { className: "jini-op-todo-chev", "aria-hidden": true, children: expanded ? _jsx(Icon, { name: "chevron-down", size: 11 }) : _jsx(Icon, { name: "chevron-right", size: 11 }) })] }), _jsx(TodoDismissButton, { onDismiss: onDismiss, allComplete: allComplete, t: t })] }), _jsx("div", { className: `accordion-collapsible${expanded ? ' open' : ''}`, children: _jsx("div", { className: "jini-accordion-collapsible-inner", children: _jsx("ul", { className: "jini-todo-list", children: todos.map((todo, i) => (_jsxs("li", { className: `todo-item todo-${todo.status}`, children: [_jsx("span", { className: "jini-todo-check", "aria-hidden": true, children: todoStatusGlyph({ status: todo.status }) }), _jsx("span", { className: "jini-todo-text", children: todoLabel({ todo }) })] }, i))) }) }) })] }));
21
+ }
22
+ /** The "Done" action; only a fully completed list the host can dismiss shows it. */
23
+ function TodoDismissButton({ onDismiss, allComplete, t }) {
24
+ if (!onDismiss || !allComplete)
25
+ return null;
26
+ return (_jsx("button", { type: "button", className: "jini-op-todo-done", onClick: () => onDismiss(), title: t('Dismiss'), children: t('Done') }));
22
27
  }
23
28
  function todoProgress({ todos }, { runStreaming = false } = {}) {
24
29
  const hasPending = todos.some((todo) => todo.status === 'pending' || todo.status === 'in_progress');
@@ -1,13 +1,23 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ToolDisplayRow } from '../tool-call-display.js';
3
+ import { useToolCallGroup } from './ToolCallGroup.hooks.js';
4
+ import { useT } from '../hooks/context.js';
5
+ /** Hooks ToolCallGroup calls; defaults to the real ones, a test hands in fakes. */
6
+ export declare const defaultToolCallGroupHooks: {
7
+ useToolCallGroup: typeof useToolCallGroup;
8
+ useT: typeof useT;
9
+ };
10
+ export type ToolCallGroupHooks = typeof defaultToolCallGroupHooks;
3
11
  /**
4
12
  * One turn's tool cards folded into a single line ("Used 3 tools ▸") that opens on click — the
5
13
  * `toolCallDisplay: 'collapsed'` layout, or the compact failure notice in 'hidden'. The disclosure
6
14
  * state lives in `useToolCallGroup`; copy uses the host's translator.
7
15
  */
8
- export declare function ToolCallGroup<Row extends ToolDisplayRow>({ rows, renderRow, failureOnly }: {
16
+ export declare function ToolCallGroup<Row extends ToolDisplayRow>({ rows, renderRow, failureOnly, hooks }: {
9
17
  rows: readonly Row[];
10
18
  failureOnly?: boolean;
11
19
  renderRow: (row: Row) => ReactNode;
20
+ } & {
21
+ hooks?: ToolCallGroupHooks | undefined;
12
22
  }): import("react").JSX.Element;
13
23
  //# sourceMappingURL=ToolCallGroup.d.ts.map
@@ -2,14 +2,20 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useToolCallGroup } from './ToolCallGroup.hooks.js';
3
3
  import { useT } from '../hooks/context.js';
4
4
  import { Icon } from './Icon.js';
5
+ /** Hooks ToolCallGroup calls; defaults to the real ones, a test hands in fakes. */
6
+ export const defaultToolCallGroupHooks = { useToolCallGroup, useT };
5
7
  /**
6
8
  * One turn's tool cards folded into a single line ("Used 3 tools ▸") that opens on click — the
7
9
  * `toolCallDisplay: 'collapsed'` layout, or the compact failure notice in 'hidden'. The disclosure
8
10
  * state lives in `useToolCallGroup`; copy uses the host's translator.
9
11
  */
10
- export function ToolCallGroup({ rows, renderRow, failureOnly = false }) {
11
- const group = useToolCallGroup({ rows });
12
- const t = useT();
13
- return (_jsxs("div", { className: "jini-tool-group", "data-failed": group.failed ? 'true' : undefined, children: [failureOnly ? _jsxs("span", { className: "jini-tool-group__label", children: [t('A step failed'), " "] }) : null, _jsxs("button", { type: "button", className: "jini-tool-group__toggle", "aria-expanded": group.open, onClick: group.toggle, children: [_jsx("span", { className: `jini-tool-group__label${group.running ? ' shimmer-text' : ''}`, children: failureOnly ? t('Show') : group.label }), !failureOnly && group.failureLabel ? _jsxs("span", { className: "jini-tool-group__failed", children: [" \u00B7 ", group.failureLabel] }) : null, _jsx(Icon, { name: group.open ? 'chevron-down' : 'chevron-right', size: 12 })] }), group.open ? _jsx("div", { className: "jini-message-tools", children: rows.map(renderRow) }) : null] }));
12
+ export function ToolCallGroup({ rows, renderRow, failureOnly = false, hooks = defaultToolCallGroupHooks }) {
13
+ const group = hooks.useToolCallGroup({ rows });
14
+ const t = hooks.useT();
15
+ return (_jsxs("div", { className: "jini-tool-group", "data-failed": group.failed ? 'true' : undefined, children: [failureOnly ? _jsxs("span", { className: "jini-tool-group__label", children: [t('A step failed'), " "] }) : null, _jsx(ToolGroupToggle, { group: group, failureOnly: failureOnly, t: t }), group.open ? _jsx("div", { className: "jini-message-tools", children: rows.map(renderRow) }) : null] }));
16
+ }
17
+ /** The one-line disclosure button: the tool summary, or a bare "Show" under the failure-only layout. */
18
+ function ToolGroupToggle({ group, failureOnly, t }) {
19
+ return (_jsxs("button", { type: "button", className: "jini-tool-group__toggle", "aria-expanded": group.open, onClick: group.toggle, children: [_jsx("span", { className: `jini-tool-group__label${group.running ? ' shimmer-text' : ''}`, children: failureOnly ? t('Show') : group.label }), !failureOnly && group.failureLabel ? _jsxs("span", { className: "jini-tool-group__failed", children: [" \u00B7 ", group.failureLabel] }) : null, _jsx(Icon, { name: group.open ? 'chevron-down' : 'chevron-right', size: 12 })] }));
14
20
  }
15
21
  //# sourceMappingURL=ToolCallGroup.js.map
@@ -1,4 +1,6 @@
1
+ import { type Logger } from '@jini-ai/core/primitives';
1
2
  import type { AgentEvent } from '../../core/index.js';
3
+ import { useToolRendererRegistry } from '../hooks/context.js';
2
4
  type ToolUseEvent = Extract<AgentEvent, {
3
5
  kind: 'tool_use';
4
6
  }>;
@@ -6,6 +8,7 @@ type ToolResultEvent = Extract<AgentEvent, {
6
8
  kind: 'tool_result';
7
9
  }>;
8
10
  export interface ToolCardProps {
11
+ report?: Pick<Logger, 'error'> | undefined;
9
12
  use: ToolUseEvent;
10
13
  result?: ToolResultEvent | undefined;
11
14
  /** Whether the owning run is still streaming. Forwarded to registered renderers via `status`. */
@@ -19,6 +22,8 @@ export interface ToolCardProps {
19
22
  /** A later call of the same tool in this turn succeeded (`retriedToolRowIds`): a failure shows a neutral "Retried" badge, not red. */
20
23
  retried?: boolean;
21
24
  }
22
- export declare function ToolCard({ use, result, runStreaming, runSucceeded, projectFileNames, onRequestOpenFile, retried }: ToolCardProps): import("react").JSX.Element | null;
25
+ export declare function ToolCard({ use, result, runStreaming, runSucceeded, projectFileNames, onRequestOpenFile, retried, report, useToolRendererRegistryHook }: ToolCardProps & {
26
+ useToolRendererRegistryHook?: typeof useToolRendererRegistry;
27
+ }): import("react").JSX.Element | null;
23
28
  export {};
24
29
  //# sourceMappingURL=ToolCard.d.ts.map
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { formatErrorForLog } from '@jini-ai/core';
2
+ import { createConsoleLogger } from '@jini-ai/core/primitives';
3
3
  const RUNNING_TITLE_CLASS = ' shimmer-text';
4
4
  /**
5
5
  * @module ToolCard
6
6
  *
7
7
  * Renders a single `tool_use` (optionally paired with its `tool_result`) as
8
8
  * an inline card. Lookup order: (1) a user-registered renderer
9
- * (`registerToolRenderer` — `../../tool-renderer-registry.js`), (2) a
9
+ * (`registerToolRenderer` — `packages/chat/src/react/tool-renderer-registry.ts`), (2) a
10
10
  * hardcoded family card for tools shipped with this package (TodoWrite /
11
11
  * Write / Edit / Read / Bash / Glob / Grep / WebFetch / WebSearch), (3) a
12
12
  * generic command/output fallback.
@@ -37,14 +37,14 @@ import { toolPresentation } from '../../core/tool-presentation.js';
37
37
  const RetriedContext = createContext(false);
38
38
  /** A Jini registry tool id: dotted, lowercase, snake_case segments — `page.fill`, `daemon.db.vacuum`, `chat.send_message`. Never matches an agent-vendor tool name (`Bash`, `Write`, `mcp__jini__execute_delegated_tool`), which is the point — this is how a canonical delegated-tool event is told apart from everything else. */
39
39
  const JINI_TOOL_ID_PATTERN = /^[a-z][a-z_]*(\.[a-z][a-z_]*)+$/;
40
- export function ToolCard({ use, result, runStreaming, runSucceeded, projectFileNames, onRequestOpenFile, retried = false }) {
41
- const registry = useToolRendererRegistry();
40
+ export function ToolCard({ use, result, runStreaming, runSucceeded, projectFileNames, onRequestOpenFile, retried = false, report, useToolRendererRegistryHook = useToolRendererRegistry }) {
41
+ const registry = useToolRendererRegistryHook();
42
42
  // Resolve vendor dialects for rendering only; tool ids and stored events stay intact.
43
43
  const presentation = toolPresentation(use);
44
44
  use = { ...use, ...presentation };
45
45
  const name = use.name;
46
46
  const card = { input: use.input, result: result, runStreaming: runStreaming ?? false, runSucceeded: runSucceeded ?? false };
47
- const content = renderToolCardBody({ use, card, wrapper: presentation.wrapper, fileCtx: { projectFileNames, onRequestOpenFile }, registry });
47
+ const content = renderToolCardBody({ use, card, wrapper: presentation.wrapper, fileCtx: { projectFileNames, onRequestOpenFile }, registry, report });
48
48
  if (content === null)
49
49
  return null;
50
50
  // Tagged once here, at the single dispatch point every branch below funnels through, rather than
@@ -70,7 +70,7 @@ const FAMILY_CARDS = new Map([
70
70
  [['describe_tool', 'mcp__jini__describe_tool'], (card) => _jsx(DescribeToolCard, { ...card })],
71
71
  ].flatMap(([names, render]) => names.map((name) => [name, render])));
72
72
  /** A host-registered renderer's output, or `undefined` when none is registered, it renders nothing, or it throws (logged) — every one of those falls back to the built-in cards. */
73
- function renderRegistered({ use, card, registry }) {
73
+ function renderRegistered({ use, card, registry, report }) {
74
74
  const custom = registry.get({ name: use.name });
75
75
  if (!custom)
76
76
  return undefined;
@@ -80,7 +80,8 @@ function renderRegistered({ use, card, registry }) {
80
80
  return node;
81
81
  }
82
82
  catch (err) {
83
- console.error(`[ToolCard] custom renderer for "${use.name}" threw; falling back`, formatErrorForLog({ error: err }));
83
+ const logger = report ?? createConsoleLogger({ prefix: '' });
84
+ logger.error({ message: `[ToolCard] custom renderer for "${use.name}" threw; falling back` }, { error: err });
84
85
  }
85
86
  return undefined;
86
87
  }
@@ -127,8 +128,8 @@ function renderToolCardBody(args) {
127
128
  * target ({@link toolRowTarget}). One place, so a tool id the family table doesn't know (`content_post_update`,
128
129
  * `mcp__acme__theme_list_files`) still reads as a label and never as its raw name and JSON args.
129
130
  */
130
- function ToolRowHead({ name, input, result, runStreaming, runSucceeded }) {
131
- const t = useT();
131
+ function ToolRowHead({ name, input, result, runStreaming, runSucceeded, useTHook = useT }) {
132
+ const t = useTHook();
132
133
  // Streaming deltas recreate result envelopes; parse only when the target's inputs change.
133
134
  // A failed event's payload describes the error even when it contains human-looking names.
134
135
  const resultContent = result?.content;
@@ -143,7 +144,7 @@ function ToolRowHead({ name, input, result, runStreaming, runSucceeded }) {
143
144
  // The "Tool call · " prefix is visually hidden (owner bug 11-01: it took half a ~333px dock row, so
144
145
  // names read "Tool call · Cont…") but stays in the row's accessible name. The name's tooltip must
145
146
  // not repeat it: trees that read a child's title before its text announced "Tool call · Tool call ·".
146
- return (_jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: "op-sr-prefix", children: prefix }), _jsx("span", { className: `op-title${isRunning ? RUNNING_TITLE_CLASS : ''}`, title: toolName, children: toolName }), summary ? _jsx("span", { className: "op-meta op-target", title: summary, children: summary }) : null] }));
147
+ return (_jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: "jini-op-sr-prefix", children: prefix }), _jsx("span", { className: `op-title${isRunning ? RUNNING_TITLE_CLASS : ''}`, title: toolName, children: toolName }), summary ? _jsx("span", { className: "jini-op-meta jini-op-target", title: summary, children: summary }) : null] }));
147
148
  }
148
149
  /**
149
150
  * A card for one `page.*`/`daemon.db.*`/`chat.*`/… call — the canonical event
@@ -158,22 +159,27 @@ function DelegatedToolCard({ name, input, result, runStreaming, runSucceeded })
158
159
  const wrapper = (input ?? {});
159
160
  const toolId = isDelegatedWrapperToolName({ name: name }) ? (wrapper.toolId ?? name) : name;
160
161
  const args = isDelegatedWrapperToolName({ name: name }) ? wrapper.input : input;
161
- return (_jsx(ExpandableCard, { className: "op-jini-tool", call: { input: args ?? {}, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsx(ToolRowHead, { name: toolId, input: args, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), after: _jsx(FileErrorDetail, { result: result }), children: _jsx(ToolCallDetail, { input: args ?? {}, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded, children: _jsx(ToolResultMedia, { result: result }) }) }));
162
+ return (_jsx(ExpandableCard, { className: "jini-op-jini-tool", call: { input: args ?? {}, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsx(ToolRowHead, { name: toolId, input: args, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), after: _jsx(FileErrorDetail, { result: result }), children: _jsx(ToolCallDetail, { input: args ?? {}, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded, children: _jsx(ToolResultMedia, { result: result }) }) }));
162
163
  }
163
- function SearchToolsCard({ input, result, runStreaming, runSucceeded }) {
164
- const t = useT();
164
+ /** The row every simple family card shares: status badge, a title (shimmering while the call runs when `shimmer`), optional meta, then the full call detail. */
165
+ function FamilyCard({ call, className, title, meta, shimmer = false, after, detailInput, children }) {
166
+ const isRunning = shimmer && call.runStreaming && !call.result;
167
+ return (_jsxs(ExpandableCard, { className: className, call: call, after: after, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: call.result, runStreaming: call.runStreaming, runSucceeded: call.runSucceeded }), _jsx("span", { className: `op-title${isRunning ? RUNNING_TITLE_CLASS : ''}`, children: title }), meta] }), children: [children, _jsx(ToolCallDetail, { input: detailInput ?? call.input, result: call.result, runStreaming: call.runStreaming, runSucceeded: call.runSucceeded })] }));
168
+ }
169
+ function SearchToolsCard({ input, result, runStreaming, runSucceeded, useTHook = useT }) {
170
+ const t = useTHook();
165
171
  const obj = (input ?? {});
166
- const isRunning = runStreaming && !result;
167
- return (_jsx(ExpandableCard, { className: "op-jini-tool", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: `op-title${isRunning ? RUNNING_TITLE_CLASS : ''}`, children: t('Search tools') }), obj.query ? _jsx("span", { className: "op-meta", children: obj.query }) : null] }), after: _jsx(FileErrorDetail, { result: result }), children: _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }) }));
172
+ const call = { input, result, runStreaming, runSucceeded };
173
+ return _jsx(FamilyCard, { call: call, className: "jini-op-jini-tool", shimmer: true, title: t('Search tools'), meta: obj.query ? _jsx("span", { className: "jini-op-meta", children: obj.query }) : null, after: _jsx(FileErrorDetail, { result: result }) });
168
174
  }
169
- function DescribeToolCard({ input, result, runStreaming, runSucceeded }) {
170
- const t = useT();
175
+ function DescribeToolCard({ input, result, runStreaming, runSucceeded, useTHook = useT }) {
176
+ const t = useTHook();
171
177
  const obj = (input ?? {});
172
- const isRunning = runStreaming && !result;
173
- return (_jsx(ExpandableCard, { className: "op-jini-tool", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: `op-title${isRunning ? RUNNING_TITLE_CLASS : ''}`, children: t('Describe tool') }), obj.id ? _jsx("span", { className: "op-meta", children: obj.id }) : null] }), after: _jsx(FileErrorDetail, { result: result }), children: _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }) }));
178
+ const call = { input, result, runStreaming, runSucceeded };
179
+ return _jsx(FamilyCard, { call: call, className: "jini-op-jini-tool", shimmer: true, title: t('Describe tool'), meta: obj.id ? _jsx("span", { className: "jini-op-meta", children: obj.id }) : null, after: _jsx(FileErrorDetail, { result: result }) });
174
180
  }
175
- function OpenInTabButton({ filePath, ctx }) {
176
- const t = useT();
181
+ function OpenInTabButton({ filePath, ctx, useTHook = useT }) {
182
+ const t = useTHook();
177
183
  if (!ctx.onRequestOpenFile)
178
184
  return null;
179
185
  if (!filePath || filePath === '(unnamed)')
@@ -186,68 +192,72 @@ function OpenInTabButton({ filePath, ctx }) {
186
192
  if (ctx.projectFileNames && !ctx.projectFileNames.has(baseName))
187
193
  return null;
188
194
  const open = ctx.onRequestOpenFile;
189
- return (_jsx("button", { type: "button", className: "op-open", onClick: () => open(baseName), title: t('Open {name} in a tab', { name: baseName }), children: t('Open') }));
195
+ return (_jsx("button", { type: "button", className: "jini-op-open", onClick: () => open(baseName), title: t('Open {name} in a tab', { name: baseName }), children: t('Open') }));
190
196
  }
191
- function FileWriteCard({ input, result, runStreaming, runSucceeded, ctx }) {
192
- const t = useT();
197
+ function FileWriteCard({ input, result, runStreaming, runSucceeded, ctx, useTHook = useT }) {
198
+ const t = useTHook();
193
199
  const obj = (input ?? {});
194
200
  const file = obj.file_path ?? obj.filePath ?? obj.path ?? '(unnamed)';
195
201
  // See OpenInTabButton's baseName comment: `.split('/').pop()` is never undefined.
196
202
  const baseName = file.split('/').pop();
197
203
  const lines = typeof obj.content === 'string' ? obj.content.split('\n').length : null;
198
- const isRunning = runStreaming && !result;
199
- return (_jsxs(ExpandableCard, { className: "op-file", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: `op-title${isRunning ? RUNNING_TITLE_CLASS : ''}`, children: t('Write') }), _jsxs("span", { className: "op-meta", children: [baseName, lines !== null ? ` · ${t('{n} lines', { n: lines })}` : ''] })] }), after: _jsx(FileErrorDetail, { result: result }), children: [_jsxs("div", { className: "op-card-detail op-card-file-detail", children: [_jsx("code", { className: "op-path", children: file }), _jsx(OpenInTabButton, { filePath: file, ctx: ctx })] }), _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded })] }));
204
+ const call = { input, result, runStreaming, runSucceeded };
205
+ return (_jsx(FamilyCard, { call: call, className: "jini-op-file", shimmer: true, title: t('Write'), meta: _jsxs("span", { className: "jini-op-meta", children: [baseName, lines !== null ? ` · ${t('{n} lines', { n: lines })}` : ''] }), after: _jsx(FileErrorDetail, { result: result }), children: _jsxs("div", { className: "jini-op-card-detail jini-op-card-file-detail", children: [_jsx("code", { className: "jini-op-path", children: file }), _jsx(OpenInTabButton, { filePath: file, ctx: ctx })] }) }));
200
206
  }
201
- function FileEditCard({ input, result, runStreaming, runSucceeded, ctx }) {
202
- const t = useT();
207
+ function FileEditCard({ input, result, runStreaming, runSucceeded, ctx, useTHook = useT }) {
208
+ const t = useTHook();
203
209
  const obj = (input ?? {});
204
210
  const file = obj.file_path ?? obj.filePath ?? obj.path ?? '(unnamed)';
205
211
  // See OpenInTabButton's baseName comment: `.split('/').pop()` is never undefined.
206
212
  const baseName = file.split('/').pop();
207
213
  const editCount = Array.isArray(obj.edits) ? obj.edits.length : 1;
208
- const isRunning = runStreaming && !result;
209
- return (_jsxs(ExpandableCard, { className: "op-file", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: `op-title${isRunning ? RUNNING_TITLE_CLASS : ''}`, children: t('Edit') }), _jsxs("span", { className: "op-meta", children: [baseName, " \u00B7 ", editCount, " ", editCount === 1 ? t('change') : t('changes')] })] }), after: _jsx(FileErrorDetail, { result: result }), children: [_jsxs("div", { className: "op-card-detail op-card-file-detail", children: [_jsx("code", { className: "op-path", children: file }), _jsx(OpenInTabButton, { filePath: file, ctx: ctx })] }), _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded })] }));
214
+ const call = { input, result, runStreaming, runSucceeded };
215
+ return (_jsx(FamilyCard, { call: call, className: "jini-op-file", shimmer: true, title: t('Edit'), meta: _jsxs("span", { className: "jini-op-meta", children: [baseName, " \u00B7 ", editCount, " ", editCount === 1 ? t('change') : t('changes')] }), after: _jsx(FileErrorDetail, { result: result }), children: _jsxs("div", { className: "jini-op-card-detail jini-op-card-file-detail", children: [_jsx("code", { className: "jini-op-path", children: file }), _jsx(OpenInTabButton, { filePath: file, ctx: ctx })] }) }));
210
216
  }
211
- function FileReadCard({ input, result, runStreaming, runSucceeded, ctx }) {
212
- const t = useT();
217
+ function FileReadCard({ input, result, runStreaming, runSucceeded, ctx, useTHook = useT }) {
218
+ const t = useTHook();
213
219
  const obj = (input ?? {});
214
220
  const file = obj.file_path ?? obj.filePath ?? obj.path ?? '(unnamed)';
215
221
  // See OpenInTabButton's baseName comment: `.split('/').pop()` is never undefined.
216
222
  const baseName = targetAtOffset({ target: file.split('/').pop(), offset: obj.offset });
217
- const isRunning = runStreaming && !result;
218
- return (_jsxs(ExpandableCard, { className: "op-file", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: `op-title${isRunning ? RUNNING_TITLE_CLASS : ''}`, children: t('Read') }), _jsx("span", { className: "op-meta", children: baseName })] }), after: _jsx(FileErrorDetail, { result: result }), children: [_jsxs("div", { className: "op-card-detail op-card-file-detail", children: [_jsx("code", { className: "op-path", children: file }), _jsx(OpenInTabButton, { filePath: file, ctx: ctx })] }), _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded })] }));
223
+ const call = { input, result, runStreaming, runSucceeded };
224
+ return (_jsx(FamilyCard, { call: call, className: "jini-op-file", shimmer: true, title: t('Read'), meta: _jsx("span", { className: "jini-op-meta", children: baseName }), after: _jsx(FileErrorDetail, { result: result }), children: _jsxs("div", { className: "jini-op-card-detail jini-op-card-file-detail", children: [_jsx("code", { className: "jini-op-path", children: file }), _jsx(OpenInTabButton, { filePath: file, ctx: ctx })] }) }));
219
225
  }
220
- function BashCard({ input, result, runStreaming, runSucceeded }) {
221
- const t = useT();
226
+ function BashCard({ input, result, runStreaming, runSucceeded, useTHook = useT }) {
227
+ const t = useTHook();
222
228
  const obj = (input ?? {});
223
229
  const command = obj.command ?? '';
224
230
  const desc = obj.description;
225
- const isRunning = runStreaming && !result;
226
- return (_jsx(ExpandableCard, { className: "op-bash", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: `op-title${isRunning ? RUNNING_TITLE_CLASS : ''}`, children: t('Bash') }), desc ? _jsx("span", { className: "op-meta op-desc", children: desc }) : null] }), children: _jsx(ToolCallDetail, { input: command, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }) }));
231
+ const call = { input, result, runStreaming, runSucceeded };
232
+ return _jsx(FamilyCard, { call: call, className: "jini-op-bash", shimmer: true, title: t('Bash'), meta: desc ? _jsx("span", { className: "jini-op-meta jini-op-desc", children: desc }) : null, detailInput: command });
227
233
  }
228
- function GlobCard({ input, result, runStreaming, runSucceeded }) {
229
- const t = useT();
234
+ function GlobCard({ input, result, runStreaming, runSucceeded, useTHook = useT }) {
235
+ const t = useTHook();
230
236
  const obj = (input ?? {});
231
- return (_jsx(ExpandableCard, { className: "op-search", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: "op-title", children: t('Search files') }), _jsxs("span", { className: "op-meta", children: [obj.pattern ?? '*', obj.path ? ` in ${obj.path}` : ''] })] }), children: _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }) }));
237
+ const call = { input, result, runStreaming, runSucceeded };
238
+ return _jsx(FamilyCard, { call: call, className: "jini-op-search", title: t('Search files'), meta: _jsxs("span", { className: "jini-op-meta", children: [obj.pattern ?? '*', obj.path ? ` in ${obj.path}` : ''] }) });
232
239
  }
233
- function GrepCard({ input, result, runStreaming, runSucceeded }) {
234
- const t = useT();
240
+ function GrepCard({ input, result, runStreaming, runSucceeded, useTHook = useT }) {
241
+ const t = useTHook();
235
242
  const obj = (input ?? {});
236
- return (_jsx(ExpandableCard, { className: "op-search", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: "op-title", children: t('Search content') }), _jsxs("span", { className: "op-meta", children: [obj.pattern ?? '', obj.path ? ` in ${obj.path}` : ''] })] }), children: _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }) }));
243
+ const call = { input, result, runStreaming, runSucceeded };
244
+ return _jsx(FamilyCard, { call: call, className: "jini-op-search", title: t('Search content'), meta: _jsxs("span", { className: "jini-op-meta", children: [obj.pattern ?? '', obj.path ? ` in ${obj.path}` : ''] }) });
237
245
  }
238
- function WebFetchCard({ input, result, runStreaming, runSucceeded }) {
239
- const t = useT();
246
+ function WebFetchCard({ input, result, runStreaming, runSucceeded, useTHook = useT }) {
247
+ const t = useTHook();
240
248
  const obj = (input ?? {});
241
- return (_jsx(ExpandableCard, { className: "op-web", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: "op-title", children: t('Fetch') }), _jsx("span", { className: "op-meta", children: obj.url ?? '' })] }), children: _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }) }));
249
+ const call = { input, result, runStreaming, runSucceeded };
250
+ return _jsx(FamilyCard, { call: call, className: "jini-op-web", title: t('Fetch'), meta: _jsx("span", { className: "jini-op-meta", children: obj.url ?? '' }) });
242
251
  }
243
- function WebSearchCard({ input, result, runStreaming, runSucceeded }) {
244
- const t = useT();
252
+ function WebSearchCard({ input, result, runStreaming, runSucceeded, useTHook = useT }) {
253
+ const t = useTHook();
245
254
  const obj = (input ?? {});
246
- return (_jsx(ExpandableCard, { className: "op-web", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsxs(_Fragment, { children: [_jsx(ResultBadge, { result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), _jsx("span", { className: "op-title", children: t('Search') }), _jsx("span", { className: "op-meta", children: obj.query ?? '' })] }), children: _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }) }));
255
+ const call = { input, result, runStreaming, runSucceeded };
256
+ return _jsx(FamilyCard, { call: call, className: "jini-op-web", title: t('Search'), meta: _jsx("span", { className: "jini-op-meta", children: obj.query ?? '' }) });
247
257
  }
248
258
  /** Any tool this package has no family card for — an MCP tool, or a card tool such as `assistant_ask_choice` whose form renders elsewhere in the turn. The row still opens to the full call. */
249
259
  function GenericCard({ name, input, result, runStreaming, runSucceeded }) {
250
- return (_jsx(ExpandableCard, { className: "op-generic", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsx(ToolRowHead, { name: name, input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), after: _jsx(ToolResultMedia, { result: result }), children: _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }) }));
260
+ return (_jsx(ExpandableCard, { className: "jini-op-generic", call: { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }, head: _jsx(ToolRowHead, { name: name, input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }), after: _jsx(ToolResultMedia, { result: result }), children: _jsx(ToolCallDetail, { input: input, result: result, runStreaming: runStreaming, runSucceeded: runSucceeded }) }));
251
261
  }
252
262
  /**
253
263
  * The one row shell every card shares: a real `<button>` head (Enter/Space toggle it) that reports
@@ -261,7 +271,7 @@ function GenericCard({ name, input, result, runStreaming, runSucceeded }) {
261
271
  function ExpandableCard({ className, head, after, call, children }) {
262
272
  const [open, setOpen] = useState(false);
263
273
  const panelId = useId();
264
- return (_jsxs("div", { className: `op-card ${className}`, children: [_jsxs("button", { type: "button", className: "op-card-head", "aria-expanded": open, "aria-controls": panelId, onClick: () => setOpen((o) => !o), children: [head, _jsx("span", { className: "op-expand-chev", "aria-hidden": true, children: _jsx(Icon, { name: open ? 'chevron-down' : 'chevron-right', size: 11 }) })] }), _jsx("div", { id: panelId, className: `accordion-collapsible${open ? ' open' : ''}`, children: open ? _jsx("div", { className: "accordion-collapsible-inner", children: children }) : null }), open ? null : _jsx(CollapsedReaderText, { call: call }), after] }));
274
+ return (_jsxs("div", { className: `op-card ${className}`, children: [_jsxs("button", { type: "button", className: "op-card-head", "aria-expanded": open, "aria-controls": panelId, onClick: () => setOpen((o) => !o), children: [head, _jsx("span", { className: "jini-op-expand-chev", "aria-hidden": true, children: _jsx(Icon, { name: open ? 'chevron-down' : 'chevron-right', size: 11 }) })] }), _jsx("div", { id: panelId, className: `accordion-collapsible${open ? ' open' : ''}`, children: open ? _jsx("div", { className: "jini-accordion-collapsible-inner", children: children }) : null }), open ? null : _jsx(CollapsedReaderText, { call: call }), after] }));
265
275
  }
266
276
  /** The collapsed row's stand-in for its panel — see {@link ExpandableCard} and `describeCollapsedToolCall`. */
267
277
  function CollapsedReaderText({ call }) {
@@ -273,32 +283,32 @@ function CollapsedReaderText({ call }) {
273
283
  const runStreaming = !call.result && call.runStreaming;
274
284
  const runSucceeded = !call.result && call.runSucceeded;
275
285
  const text = useMemo(() => describeCollapsedToolCall({ input, result: resultContent === undefined ? undefined : { content: resultContent, isError: resultIsError } }, { runStreaming, runSucceeded }), [input, resultContent, resultIsError, runStreaming, runSucceeded]);
276
- return _jsx("span", { className: "op-card-reader-text op-sr-prefix", children: text });
286
+ return _jsx("span", { className: "jini-op-card-reader-text jini-op-sr-prefix", children: text });
277
287
  }
278
288
  /** The call's input, its result (or why there is none), and any extra `children` — see `describeToolCallDetail` for the redaction and formatting rules. */
279
- function ToolCallDetail({ input, result, runStreaming, runSucceeded, children }) {
280
- const t = useT();
289
+ function ToolCallDetail({ input, result, runStreaming, runSucceeded, children, useTHook = useT }) {
290
+ const t = useTHook();
281
291
  // Only mounted on expansion: keep the compact preview cheap without losing any of the stored
282
292
  // call when the person opens it. The core formatter still owns formatting and secret redaction.
283
293
  const detail = describeToolCallDetail({ input: input, result: result }, { runStreaming: runStreaming, runSucceeded: runSucceeded, maxChars: Infinity });
284
- return (_jsxs("div", { className: "op-card-detail", children: [detail.inputText !== null ? _jsx("pre", { className: "op-command op-input", children: detail.inputText }) : null, detail.outputText !== null ? _jsx("pre", { className: "op-output", children: detail.outputText }) : null, detail.noteKey !== null ? _jsx("p", { className: "op-detail-note", children: t(detail.noteKey) }) : null, children] }));
294
+ return (_jsxs("div", { className: "jini-op-card-detail", children: [detail.inputText !== null ? _jsx("pre", { className: "jini-op-command jini-op-input", children: detail.inputText }) : null, detail.outputText !== null ? _jsx("pre", { className: "op-output", children: detail.outputText }) : null, detail.noteKey !== null ? _jsx("p", { className: "jini-op-detail-note", children: t(detail.noteKey) }) : null, children] }));
285
295
  }
286
296
  /** A failed result: neutral "Retried" when a later call of the same tool succeeded, else red. */
287
- function ErrorBadge({ result }) {
288
- const t = useT();
297
+ function ErrorBadge({ result, useTHook = useT }) {
298
+ const t = useTHook();
289
299
  if (useContext(RetriedContext))
290
- return (_jsx("span", { className: "op-status op-status-retried", title: t('Retried'), children: _jsx(Icon, { name: "retry", size: 14 }) }));
291
- return (_jsx("span", { className: "op-status op-status-error", title: describeToolCallDetail({ input: null, result }, { maxChars: COLLAPSED_DETAIL_MAX_CHARS }).outputText ?? t('Error'), children: _jsx(Icon, { name: "close", size: 14 }) }));
300
+ return (_jsx("span", { className: "jini-op-status jini-op-status-retried", title: t('Retried'), children: _jsx(Icon, { name: "retry", size: 14 }) }));
301
+ return (_jsx("span", { className: "jini-op-status op-status-error", title: describeToolCallDetail({ input: null, result }, { maxChars: COLLAPSED_DETAIL_MAX_CHARS }).outputText ?? t('Error'), children: _jsx(Icon, { name: "close", size: 14 }) }));
292
302
  }
293
- function ResultBadge({ result, runStreaming, runSucceeded }) {
294
- const t = useT();
303
+ function ResultBadge({ result, runStreaming, runSucceeded, useTHook = useT }) {
304
+ const t = useTHook();
295
305
  if (!result && runStreaming)
296
- return (_jsx("span", { className: "op-status op-status-running", title: t('Running'), children: _jsx(Icon, { name: "spinner", size: 14 }) }));
306
+ return (_jsx("span", { className: "jini-op-status jini-op-status-running", title: t('Running'), children: _jsx(Icon, { name: "spinner", size: 14 }) }));
297
307
  if (!result && !runSucceeded)
298
- return (_jsx("span", { className: "op-status op-status-error", title: t('Error'), children: _jsx(Icon, { name: "close", size: 14 }) }));
308
+ return (_jsx("span", { className: "jini-op-status op-status-error", title: t('Error'), children: _jsx(Icon, { name: "close", size: 14 }) }));
299
309
  if (result?.isError)
300
310
  return _jsx(ErrorBadge, { result: result });
301
- return (_jsx("span", { className: "op-status op-status-ok", title: t('Done'), children: _jsx(Icon, { name: "check", size: 14 }) }));
311
+ return (_jsx("span", { className: "jini-op-status jini-op-status-ok", title: t('Done'), children: _jsx(Icon, { name: "check", size: 14 }) }));
302
312
  }
303
313
  /**
304
314
  * Renders the `image` blocks a tool result's `media` field carries — the one media type this slice
@@ -319,7 +329,7 @@ function ToolResultMedia({ result }) {
319
329
  const images = blocks.filter((block) => block.type === 'image');
320
330
  if (images.length === 0)
321
331
  return null;
322
- return (_jsx("div", { className: "op-media", children: images.map((block, index) => _jsx(ToolResultImageFigure, { block: block }, index)) }));
332
+ return (_jsx("div", { className: "jini-op-media", children: images.map((block, index) => _jsx(ToolResultImageFigure, { block: block }, index)) }));
323
333
  }
324
334
  /**
325
335
  * One tool image: captioned by its `title` (also the alt text) and linked to its `href` in a new
@@ -327,15 +337,15 @@ function ToolResultMedia({ result }) {
327
337
  * safe-target rule as chat links (`Markdown.tsx`); `javascript:`/`data:` stays an unlinked image.
328
338
  */
329
339
  function ToolResultImageFigure({ block }) {
330
- const img = (_jsx("img", { className: "op-media-image", src: `data:${block.mimeType};base64,${block.data}`, alt: block.title ?? '', style: { maxWidth: '100%', height: 'auto', display: 'block' } }));
340
+ const img = (_jsx("img", { className: "jini-op-media-image", src: `data:${block.mimeType};base64,${block.data}`, alt: block.title ?? '', style: { maxWidth: '100%', height: 'auto', display: 'block' } }));
331
341
  const linked = block.href !== undefined && SAFE_LINK_HREF.test(block.href) && !block.href.startsWith('#')
332
- ? _jsx("a", { className: "op-media-link", href: block.href, target: "_blank", rel: "noopener noreferrer", children: img })
342
+ ? _jsx("a", { className: "jini-op-media-link", href: block.href, target: "_blank", rel: "noopener noreferrer", children: img })
333
343
  : img;
334
344
  if (block.title === undefined)
335
345
  return linked;
336
346
  return (
337
347
  // No host stylesheet styles op-media yet; reset the UA figure margin (40px sides) inline, like the img.
338
- _jsxs("figure", { className: "op-media-figure", style: { margin: 0 }, children: [linked, _jsx("figcaption", { className: "op-media-caption", children: block.title })] }));
348
+ _jsxs("figure", { className: "jini-op-media-figure", style: { margin: 0 }, children: [linked, _jsx("figcaption", { className: "jini-op-media-caption", children: block.title })] }));
339
349
  }
340
350
  function FileErrorDetail({ result }) {
341
351
  if (!result?.isError)
@@ -1,5 +1,5 @@
1
1
  /** Read display context from a standalone form; its host may not have emitted a tool call. */
2
- import { type UIResource } from '@jini-ai/ui/mcp-ui';
2
+ import { type UIResource } from '@jini-ai/protocol/mcp-ui';
3
3
  import type { AgentEvent } from '../../core/events.js';
4
4
  import type { AcceptedInputProjectionOptions } from '../../core/accepted-input.js';
5
5
  /** Feed recovered form context into the existing receipt projection, including after history reload.
@@ -1,5 +1,5 @@
1
1
  /** Read display context from a standalone form; its host may not have emitted a tool call. */
2
- import { parseUIResource, readActionPlan } from '@jini-ai/ui/mcp-ui';
2
+ import { parseUIResource, readActionPlan } from '@jini-ai/protocol/mcp-ui';
3
3
  import { useMemo, useRef } from 'react';
4
4
  import { SURFACE_QUESTION_META_KEY } from '../../core/question-answer.js';
5
5
  import { useExtEventGroups } from '../hooks/useExtEventGroups.js';
@@ -19,7 +19,7 @@ export function useSurfaceAnswerContexts({ events }, _options = {}) {
19
19
  const data = group.events[0];
20
20
  let cached = cache.current.get(data);
21
21
  if (cached === undefined || cached.sourceInput !== group.call.input) {
22
- const input = surfaceQuestionInput({ resource: parseUIResource(data), input: group.call.input });
22
+ const input = surfaceQuestionInput({ resource: parseUIResource({ value: data }), input: group.call.input });
23
23
  cached = { sourceInput: group.call.input, context: { input, includeTitle: input !== group.call.input } };
24
24
  cache.current.set(data, cached);
25
25
  }
@@ -51,7 +51,7 @@ function surfaceQuestionContext({ resource }, _options = {}) {
51
51
  /** The title and offered choices an inert parse of the surface document shows. */
52
52
  function markupQuestion({ resource }, _options = {}) {
53
53
  const document = new DOMParser().parseFromString(resource.resource.text, 'text/html');
54
- const title = readActionPlan(resource)?.title ?? document.querySelector('h1')?.textContent?.trim();
54
+ const title = readActionPlan({ resource })?.title ?? document.querySelector('h1')?.textContent?.trim();
55
55
  const labels = new Map([...document.querySelectorAll('label')].map(label => [label.htmlFor, label.textContent?.trim() ?? '']));
56
56
  const options = [...document.querySelectorAll('input[type="radio"], input[type="checkbox"], option')].map(control => ({ value: control.value, label: optionText({ labels, control }) }));
57
57
  return { title, options };
@@ -1,4 +1,4 @@
1
- import type { McpUiToolCallHandler } from '@jini-ai/ui/mcp-ui';
1
+ import type { McpUiToolCallHandler } from '@jini-ai/protocol/mcp-ui';
2
2
  import type { ExtEventCall } from '../ext-event-renderer-registry.js';
3
3
  import type { useT } from '../hooks/context.js';
4
4
  type Translate = ReturnType<typeof useT>;
@@ -1,4 +1,4 @@
1
- import type { CapabilityDef, CapabilityInputSchema, CapabilityRisk } from '@jini-ai/agentic';
1
+ import type { CapabilityDef, CapabilityInputSchema, CapabilityRisk } from '@jini-ai/core/contracts/capabilities';
2
2
  /** @deprecated Use `CapabilityRisk` from `@jini-ai/agentic`. */
3
3
  export type ChatPaneAgentToolRisk = CapabilityRisk;
4
4
  /** @deprecated Use `CapabilityInputSchema` from `@jini-ai/agentic`. */
@@ -0,0 +1,2 @@
1
+ export declare const antigravityBarVendorWords: readonly ["gemini", "google"];
2
+ //# sourceMappingURL=model-options.d.ts.map
@@ -0,0 +1,2 @@
1
+ export const antigravityBarVendorWords = ['gemini', 'google'];
2
+ //# sourceMappingURL=model-options.js.map
@@ -0,0 +1,2 @@
1
+ export declare const claudeBarVendorWords: readonly ["claude", "anthropic"];
2
+ //# sourceMappingURL=model-options.d.ts.map
@@ -0,0 +1,2 @@
1
+ export const claudeBarVendorWords = ['claude', 'anthropic'];
2
+ //# sourceMappingURL=model-options.js.map
@@ -0,0 +1,2 @@
1
+ export declare const codexBarVendorWords: readonly ["gpt", "openai"];
2
+ //# sourceMappingURL=model-options.d.ts.map
@@ -0,0 +1,2 @@
1
+ export const codexBarVendorWords = ['gpt', 'openai'];
2
+ //# sourceMappingURL=model-options.js.map
@@ -1,7 +1,10 @@
1
1
  import type { ChatMessage } from '../../../../core/messages.js';
2
+ import { useT } from '../../../hooks/context.js';
2
3
  /** One per-chat usage strip; removing a name persists its exclusion for future turns. */
3
- export declare function AgentPluginUsage({ conversationId, messages }: {
4
+ export declare function AgentPluginUsage({ conversationId, messages, useTHook }: {
4
5
  conversationId?: string | null;
5
6
  messages: readonly ChatMessage[];
7
+ } & {
8
+ useTHook?: typeof useT;
6
9
  }): import("react").JSX.Element | null;
7
10
  //# sourceMappingURL=AgentPluginUsage.d.ts.map
@@ -26,8 +26,8 @@ function resolveAgentPluginStrip({ messages }, { conversationId }) {
26
26
  return { id, state, plugins };
27
27
  }
28
28
  /** One per-chat usage strip; removing a name persists its exclusion for future turns. */
29
- export function AgentPluginUsage({ conversationId, messages }) {
30
- const t = useT();
29
+ export function AgentPluginUsage({ conversationId, messages, useTHook = useT }) {
30
+ const t = useTHook();
31
31
  const [, setRevision] = useState(0);
32
32
  useEffect(() => {
33
33
  const refresh = () => setRevision(value => value + 1);