@jini-ai/chat 0.7.2 → 0.7.3-next.1

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 (205) hide show
  1. package/CHANGELOG.md +2 -12
  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.d.ts +0 -4
  90. package/dist/react/components/MessageList.hooks.js +6 -18
  91. package/dist/react/components/MessageList.js +17 -20
  92. package/dist/react/components/MessageList.rules.d.ts +0 -5
  93. package/dist/react/components/MessageList.rules.js +0 -4
  94. package/dist/react/components/MessageRow.d.ts +46 -2
  95. package/dist/react/components/MessageRow.hooks.d.ts +60 -0
  96. package/dist/react/components/MessageRow.hooks.js +94 -0
  97. package/dist/react/components/MessageRow.js +53 -113
  98. package/dist/react/components/MidRunUserMessage.d.ts +6 -1
  99. package/dist/react/components/MidRunUserMessage.js +5 -5
  100. package/dist/react/components/NextStepActions.d.ts +3 -1
  101. package/dist/react/components/NextStepActions.js +3 -3
  102. package/dist/react/components/QuestionForm.answers.hooks.d.ts +26 -0
  103. package/dist/react/components/QuestionForm.answers.hooks.js +89 -0
  104. package/dist/react/components/QuestionForm.d.ts +6 -0
  105. package/dist/react/components/QuestionForm.js +23 -261
  106. package/dist/react/components/QuestionForm.values.d.ts +22 -0
  107. package/dist/react/components/QuestionForm.values.js +58 -0
  108. package/dist/react/components/QuestionFormField.d.ts +17 -0
  109. package/dist/react/components/QuestionFormField.js +114 -0
  110. package/dist/react/components/QuestionsPanel.d.ts +3 -1
  111. package/dist/react/components/QuestionsPanel.js +7 -3
  112. package/dist/react/components/SentAttachment.d.ts +11 -2
  113. package/dist/react/components/SentAttachment.hooks.d.ts +1 -1
  114. package/dist/react/components/SentAttachment.hooks.js +6 -5
  115. package/dist/react/components/SentAttachment.js +5 -3
  116. package/dist/react/components/TodoCard.d.ts +3 -1
  117. package/dist/react/components/TodoCard.js +9 -4
  118. package/dist/react/components/ToolCallGroup.d.ts +11 -1
  119. package/dist/react/components/ToolCallGroup.js +10 -4
  120. package/dist/react/components/ToolCard.d.ts +6 -1
  121. package/dist/react/components/ToolCard.js +79 -69
  122. package/dist/react/components/mcp-ui-question-input.d.ts +1 -1
  123. package/dist/react/components/mcp-ui-question-input.js +3 -3
  124. package/dist/react/components/mcp-ui-surface-state.d.ts +1 -1
  125. package/dist/react/features/chat-pane/agent-tools.d.ts +1 -1
  126. package/dist/react/features/chat-pane/antigravity/model-options.d.ts +2 -0
  127. package/dist/react/features/chat-pane/antigravity/model-options.js +2 -0
  128. package/dist/react/features/chat-pane/claude/model-options.d.ts +2 -0
  129. package/dist/react/features/chat-pane/claude/model-options.js +2 -0
  130. package/dist/react/features/chat-pane/codex/model-options.d.ts +2 -0
  131. package/dist/react/features/chat-pane/codex/model-options.js +2 -0
  132. package/dist/react/features/chat-pane/components/AgentPluginUsage.d.ts +4 -1
  133. package/dist/react/features/chat-pane/components/AgentPluginUsage.js +2 -2
  134. package/dist/react/features/chat-pane/components/AgentRuntimePicker.d.ts +10 -6
  135. package/dist/react/features/chat-pane/components/AgentRuntimePicker.js +18 -132
  136. package/dist/react/features/chat-pane/components/ChatPane.d.ts +24 -2
  137. package/dist/react/features/chat-pane/components/ChatPane.js +45 -297
  138. package/dist/react/features/chat-pane/components/ChatPaneComposerArea.d.ts +33 -0
  139. package/dist/react/features/chat-pane/components/ChatPaneComposerArea.js +119 -0
  140. package/dist/react/features/chat-pane/components/ChatPaneLayout.d.ts +42 -0
  141. package/dist/react/features/chat-pane/components/ChatPaneLayout.js +54 -0
  142. package/dist/react/features/chat-pane/components/ChatPaneStatus.d.ts +27 -0
  143. package/dist/react/features/chat-pane/components/ChatPaneStatus.js +91 -0
  144. package/dist/react/features/chat-pane/components/RuntimeDropUp.d.ts +6 -1
  145. package/dist/react/features/chat-pane/components/RuntimeDropUp.js +20 -19
  146. package/dist/react/features/chat-pane/components/RuntimePickerSections.d.ts +62 -0
  147. package/dist/react/features/chat-pane/components/RuntimePickerSections.js +122 -0
  148. package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.d.ts +1 -1
  149. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.d.ts +5 -3
  150. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js +78 -26
  151. package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.js +6 -6
  152. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.d.ts +5 -1
  153. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.js +7 -7
  154. package/dist/react/features/chat-pane/hooks/useRuntimeDropUp.hooks.d.ts +7 -0
  155. package/dist/react/features/chat-pane/hooks/useRuntimeDropUp.hooks.js +5 -0
  156. package/dist/react/features/chat-pane/model-options.js +7 -4
  157. package/dist/react/features/chat-pane/styles.d.ts +1 -1
  158. package/dist/react/features/chat-pane/styles.js +25 -41
  159. package/dist/react/features/chat-pane/types.d.ts +29 -1
  160. package/dist/react/hooks/assistant-chats-contracts.d.ts +1 -1
  161. package/dist/react/hooks/attachment-preview-cache.d.ts +1 -1
  162. package/dist/react/hooks/attachment-preview-cache.js +1 -1
  163. package/dist/react/hooks/fab-position.js +16 -18
  164. package/dist/react/hooks/useConversation.d.ts +6 -1
  165. package/dist/react/hooks/useConversation.js +11 -10
  166. package/dist/react/hooks/useRunStream.d.ts +3 -0
  167. package/dist/react/hooks/useRunStream.js +12 -12
  168. package/dist/react/hooks/useSurfaceRecovery.d.ts +1 -1
  169. package/dist/react/hooks/useSurfaceRecovery.js +2 -2
  170. package/dist/react/index.d.ts +6 -3
  171. package/dist/react/index.js +5 -3
  172. package/dist/react/styles/chat-settings.css +9 -9
  173. package/dist/react/surfaces.d.ts +91 -0
  174. package/dist/react/surfaces.js +28 -0
  175. package/dist/server/durable-runs/recover.d.ts +4 -3
  176. package/dist/server/durable-runs/recover.js +4 -3
  177. package/dist/store/legacy/sqlite/conversations.d.ts +1 -2
  178. package/dist/store/legacy/sqlite/conversations.js +1 -1
  179. package/dist/store/legacy/sqlite/messages.d.ts +2 -3
  180. package/dist/store/legacy/sqlite/messages.js +6 -6
  181. package/dist/store/pglite/index.d.ts +7 -7
  182. package/dist/store/pglite/index.js +1 -1
  183. package/dist/store/ports.d.ts +5 -2
  184. package/dist/store/postgres/index.d.ts +7 -7
  185. package/dist/store/postgres/index.js +1 -1
  186. package/dist/store/runtime/chat-expiry-sweep.js +2 -4
  187. package/dist/store/runtime/chat-history-store.js +2 -3
  188. package/dist/store/runtime/durable-run-store.js +16 -2
  189. package/dist/store/runtime/history-tools.js +33 -11
  190. package/dist/store/runtime/kernel.d.ts +3 -2
  191. package/dist/store/runtime/run-ledger.js +2 -2
  192. package/dist/store/sql/boundary.d.ts +5 -5
  193. package/dist/store/sql/maintenance.d.ts +3 -2
  194. package/dist/store/sql/store.d.ts +16 -8
  195. package/dist/store/sql/store.js +31 -14
  196. package/dist/store/sqlite/index.d.ts +11 -12
  197. package/dist/store/sqlite/index.js +5 -5
  198. package/dist/store/sqlite/schema.d.ts +1 -1
  199. package/package.json +46 -24
  200. package/dist/core/ag-ui/entry.d.ts +0 -84
  201. package/dist/core/ag-ui/entry.js +0 -225
  202. package/dist/core/browser/page-actions.d.ts +0 -121
  203. package/dist/core/browser/page-actions.js +0 -113
  204. package/dist/embed-widget/browser/page-actions.d.ts +0 -2
  205. package/dist/embed-widget/browser/page-actions.js +0 -3
@@ -183,7 +183,7 @@ async function uploadAttachmentBatch(files, effects) {
183
183
  effects.onError(error instanceof Error ? error : new Error(String(error)));
184
184
  }
185
185
  }
186
- export function useChatPane(options) {
186
+ export function useChatPane(options, { useConversationHook = useConversation } = {}) {
187
187
  const guard = useUserTextGuard(options);
188
188
  const [activeUploadCount, setActiveUploadCount] = useState(0);
189
189
  const [attachmentError, setAttachmentError] = useState(null);
@@ -218,7 +218,8 @@ export function useChatPane(options) {
218
218
  const attachmentBatchIdRef = useRef(initialAttachmentBatchId);
219
219
  const batchConversationIdRef = useRef(options.conversationId);
220
220
  const activeUploadsRef = useRef(new Set());
221
- const [internalSelection, setInternalSelection] = useState(options.initialSelection ?? { agentId: '' });
221
+ // A lazy initializer: the initial selection is read once, like every other `useState` seed here.
222
+ const [internalSelection, setInternalSelection] = useState(() => options.initialSelection ?? { agentId: '' });
222
223
  const workingDirectoryState = useChatPaneWorkingDirectory(definedProps({ source: {
223
224
  workingDirectory: options.workingDirectory,
224
225
  initialWorkingDirectory: options.initialWorkingDirectory,
@@ -235,8 +236,8 @@ export function useChatPane(options) {
235
236
  reasoning: resolvedSelection.reasoning,
236
237
  } }), [resolvedSelection.agentId, resolvedSelection.model, resolvedSelection.reasoning]);
237
238
  const selectedAgent = options.agents.find((agent) => agent.id === selection.agentId);
238
- const conversation = useConversation(definedProps({ source: {
239
- transport: options.transport,
239
+ const conversation = useConversationHook(definedProps({ source: {
240
+ transport: options.transport, report: options.report,
240
241
  redactUserText: options.redactUserText,
241
242
  onSecretRedacted: guard.notifyRedaction,
242
243
  initialMessages: options.initialMessages,
@@ -333,20 +334,15 @@ export function useChatPane(options) {
333
334
  composer.setAgent(validated);
334
335
  options.onSelectionChange?.(validated);
335
336
  }, [composer, options.agents, options.onSelectionChange]);
336
- const sendBlocker = findChatPaneSendBlocker({
337
- ...(selection.model ? { model: selection.model } : {}),
337
+ const sendBlocker = resolvePaneSendBlocker({
338
+ model: selection.model,
338
339
  selectedAgent,
339
340
  isStreaming: conversation.isStreaming,
340
341
  activeUploadCount,
341
342
  workingDirectoryPending: workingDirectoryState.workingDirectoryPending,
342
343
  workingDirectoryInvalid: workingDirectoryState.workingDirectoryInvalid,
343
344
  workingDirectoryError: workingDirectoryState.workingDirectoryError,
344
- // `exactOptionalPropertyTypes` rejects `apiModeConfigured: undefined` outright, so this stays a
345
- // ternary rather than routing through `definedProps` — that helper would also make
346
- // `selectedAgent` optional in its return type (its value type already includes `undefined`),
347
- // which no longer structurally matches `ChatPaneSendability`'s required `selectedAgent` key.
348
- ...(options.apiModeConfigured === undefined ? {} : { apiModeConfigured: options.apiModeConfigured }),
349
- });
345
+ }, { apiModeConfigured: options.apiModeConfigured });
350
346
  const canSend = sendBlocker === null && composer.canSubmit;
351
347
  // Read after `await` in `answerWaitingQuestion`, where the render-time `composer.draft` is stale.
352
348
  const latestComposerRef = useRef(composer);
@@ -515,7 +511,7 @@ export function useChatPane(options) {
515
511
  }, [consumeDeliveredAttachments, restoreQueuedDraft, restoreRefusedDraft]);
516
512
  /** `composerDraft`: the composer text this send already took out of the composer, so the
517
513
  * composer is never cleared again on acceptance and a refusal hands the text back. */
518
- const sendGuardedPrompt = useCallback(async ({ redaction, inputs, attachments = composer.attachments, composerDraft, folders = inputs ? inputs.flatMap(input => input.folders ?? []) : composer.folders ?? [] }, _options = {}) => {
514
+ const sendGuardedPrompt = useCallback(async ({ redaction, inputs, attachments = composer.attachments, composerDraft, folders = turnFolders({ inputs }, { composerFolders: composer.folders }) }, _options = {}) => {
519
515
  const trimmed = redaction.text.trim();
520
516
  assertPromptSendable({ trimmed, sendBlocker });
521
517
  if (startingPromptRef.current)
@@ -529,7 +525,7 @@ export function useChatPane(options) {
529
525
  options.onActivityChange?.('queued');
530
526
  let accepted = false;
531
527
  await conversation.sendMessage(trimmed, definedProps({ source: {
532
- secretRedaction: redaction.secretRedacted ? { secretRedacted: true, count: redaction.count } : undefined,
528
+ secretRedaction: transportSecretRedaction({ redaction }),
533
529
  agentId: selection.agentId,
534
530
  // Empty attachment arrays remain absent at the transport boundary.
535
531
  attachments: attachments.length === 0 ? undefined : attachments,
@@ -581,8 +577,7 @@ export function useChatPane(options) {
581
577
  // MOVE: Every queue path retains per-message receipts; appendQueuedTurn owns their one-turn delivery.
582
578
  // A turn queued against another conversation is not joined — it would never be flushed there anyway.
583
579
  const enqueueTurn = useCallback(({ turn, inputs, attachments = composer.attachments }, _options = {}) => {
584
- const accepted = inputs ?? [{ id: createChatLocalId({}), text: turn.text, attachments, folders: composer.folders ?? [],
585
- ...(turn.secretRedacted ? { secretRedaction: { secretRedacted: true, count: turn.count } } : {}) }];
580
+ const accepted = inputs ?? [newQueuedInput({ turn, attachments, folders: composer.folders ?? [] })];
586
581
  const sameConversation = queuedConversationIdRef.current === options.conversationId;
587
582
  queuedConversationIdRef.current = options.conversationId;
588
583
  for (const controller of activeUploadsRef.current) {
@@ -692,12 +687,12 @@ export function useChatPane(options) {
692
687
  if (waitingForLiveInput({ uploadPending, messages: conversation.messages })) {
693
688
  queuedForLiveDeliveryRef.current = queuedTurn === null || queuedForLiveDeliveryRef.current;
694
689
  }
695
- // MOVE: The existing queue owns its files; a later steer must join it to preserve send order.
696
- // Folder context is attached on ordinary run start; live messages have no such envelope.
697
- const target = uploadPending || composer.folders?.length || queuedInputs.some(input => input.liveMessageId === undefined) ? null : findMidRunTarget({
690
+ const target = steerableMidRunTarget({
691
+ uploadPending,
692
+ composer,
693
+ queuedInputs,
698
694
  deliver: options.deliverMidRunMessage,
699
695
  blocker: sendBlocker,
700
- attachmentCount: composer.attachments.length,
701
696
  messages: conversation.messages,
702
697
  });
703
698
  if (target !== null) {
@@ -733,13 +728,14 @@ export function useChatPane(options) {
733
728
  await sendOrdinaryTurn(prompt);
734
729
  return;
735
730
  }
736
- const typedAnswer = composer.folders?.length ? null : findTypedAnswerTarget({
731
+ const typedAnswer = unansweredTypedAnswerTarget({
732
+ composer,
737
733
  deliver: options.deliverTypedAnswer,
738
734
  blocker: sendBlocker,
739
- attachmentCount: composer.attachments.length,
740
735
  messages: conversation.messages,
736
+ answeredQuestionId: answeredQuestionIdRef.current,
741
737
  });
742
- if (typedAnswer !== null && typedAnswer.questionId !== answeredQuestionIdRef.current) {
738
+ if (typedAnswer !== null) {
743
739
  await answerWaitingQuestion({ ...typedAnswer, text: prompt });
744
740
  return;
745
741
  }
@@ -814,10 +810,13 @@ export function useChatPane(options) {
814
810
  }
815
811
  if (activeUploadCount > 0 || attachmentError !== null)
816
812
  return;
817
- const target = queuedForLiveDeliveryRef.current && !queuedInputs.some(input => input.folders?.length) ? findMidRunTarget({
813
+ const target = queuedMidRunTarget({
814
+ liveDelivery: queuedForLiveDeliveryRef.current,
815
+ queuedInputs,
818
816
  deliver: options.deliverMidRunMessage,
819
- blocker: sendBlocker, attachmentCount: queuedInputs.flatMap(input => input.attachments).length, messages: conversation.messages,
820
- }) : null;
817
+ blocker: sendBlocker,
818
+ messages: conversation.messages,
819
+ });
821
820
  if (target === null && (sendBlocker !== null || awaitingRunReceipts({ inputs: queuedInputs, messages: conversation.messages })))
822
821
  return;
823
822
  queuedForLiveDeliveryRef.current = false;
@@ -886,6 +885,59 @@ export function useChatPane(options) {
886
885
  reset,
887
886
  };
888
887
  }
888
+ /** What blocks Send right now; optional sendability keys stay absent rather than `undefined`. */
889
+ function resolvePaneSendBlocker({ model, ...state }, { apiModeConfigured } = {}) {
890
+ return findChatPaneSendBlocker({
891
+ ...(model ? { model } : {}),
892
+ ...state,
893
+ // `exactOptionalPropertyTypes` rejects `apiModeConfigured: undefined` outright, so this stays a
894
+ // ternary rather than routing through `definedProps` — that helper would also make
895
+ // `selectedAgent` optional in its return type (its value type already includes `undefined`),
896
+ // which no longer structurally matches `ChatPaneSendability`'s required `selectedAgent` key.
897
+ ...(apiModeConfigured === undefined ? {} : { apiModeConfigured }),
898
+ });
899
+ }
900
+ /** Folders a send carries: those of the accepted inputs it delivers, else the composer's own. */
901
+ function turnFolders({ inputs }, { composerFolders } = {}) {
902
+ return inputs ? inputs.flatMap(input => input.folders ?? []) : composerFolders ?? [];
903
+ }
904
+ /** The transport's secret-redaction flag for a send; absent when nothing was redacted. */
905
+ function transportSecretRedaction({ redaction }, _options = {}) {
906
+ return redaction.secretRedacted ? { secretRedacted: true, count: redaction.count } : undefined;
907
+ }
908
+ /** A fresh queued input for one redacted turn; the secret-redaction flag travels with it. */
909
+ function newQueuedInput({ turn, attachments, folders }, _options = {}) {
910
+ return { id: createChatLocalId({}), text: turn.text, attachments, folders,
911
+ ...(turn.secretRedacted ? { secretRedaction: { secretRedacted: true, count: turn.count } } : {}) };
912
+ }
913
+ /** The running run a new turn can steer into, or null when it must go through the queue. */
914
+ function steerableMidRunTarget({ uploadPending, composer, queuedInputs, deliver, blocker, messages }, _options = {}) {
915
+ // MOVE: The existing queue owns its files; a later steer must join it to preserve send order.
916
+ // Folder context is attached on ordinary run start; live messages have no such envelope.
917
+ return uploadPending || composer.folders?.length || queuedInputs.some(input => input.liveMessageId === undefined) ? null : findMidRunTarget({
918
+ deliver,
919
+ blocker,
920
+ attachmentCount: composer.attachments.length,
921
+ messages,
922
+ });
923
+ }
924
+ /** The question this send answers, or null; folder context and an already-answered question send normally. */
925
+ function unansweredTypedAnswerTarget({ composer, deliver, blocker, messages, answeredQuestionId }, _options = {}) {
926
+ const typedAnswer = composer.folders?.length ? null : findTypedAnswerTarget({
927
+ deliver,
928
+ blocker,
929
+ attachmentCount: composer.attachments.length,
930
+ messages,
931
+ });
932
+ return typedAnswer !== null && typedAnswer.questionId !== answeredQuestionId ? typedAnswer : null;
933
+ }
934
+ /** Where a flushed queue can steer: only a live-delivery queue without folder context has a target. */
935
+ function queuedMidRunTarget({ liveDelivery, queuedInputs, deliver, blocker, messages }, _options = {}) {
936
+ return liveDelivery && !queuedInputs.some(input => input.folders?.length) ? findMidRunTarget({
937
+ deliver,
938
+ blocker, attachmentCount: queuedInputs.flatMap(input => input.attachments).length, messages,
939
+ }) : null;
940
+ }
889
941
  function attachQueuedInput({ inputs, inputId, attachment }) {
890
942
  return inputs.map(input => input.id === inputId ? { ...input, attachments: [...input.attachments, attachment] } : input);
891
943
  }
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useRef } from 'react';
2
- import { getAgentModelContext } from '@jini-ai/agentic/dom';
2
+ import { useChatSurfaces } from '../../../surfaces.js';
3
3
  import { CHAT_PANE_AGENT_TOOLS } from '../agent-tools.js';
4
4
  import { definedProps } from '../../../util/defined-props.js';
5
5
  function requireStringField(input, key) {
@@ -180,6 +180,7 @@ async function deliverBridgeAction(pane, bridge, action) {
180
180
  * no principal, so it cannot. See {@link UseChatPaneAgentControlOptions.webmcp}.
181
181
  */
182
182
  export function useChatPaneAgentControl({ pane }, options = {}) {
183
+ const surfaces = useChatSurfaces();
183
184
  const enabled = options.enabled ?? false;
184
185
  const paneRef = useRef(pane);
185
186
  paneRef.current = pane;
@@ -196,7 +197,7 @@ export function useChatPaneAgentControl({ pane }, options = {}) {
196
197
  // Not registered unless the host opted in: see `webmcp`'s own doc for why this path cannot be
197
198
  // gated and therefore must not be on by default.
198
199
  // Feature-detect the draft surface through its shared owner; no `@mcp-b/*` dependency.
199
- const modelContext = options.webmcp === true ? getAgentModelContext({
200
+ const modelContext = options.webmcp === true ? surfaces.page.getModelContext({
200
201
  host: { candidates: () => [
201
202
  globalThis.document?.modelContext,
202
203
  globalThis.navigator?.modelContext,
@@ -236,13 +237,12 @@ export function useChatPaneAgentControl({ pane }, options = {}) {
236
237
  for (const cleanup of cleanups)
237
238
  cleanup();
238
239
  };
239
- // Deps are enablement + bridge PRESENCE, never the bridge object: hosts pass `agentControl`
240
+ // Deps are enablement, WebMCP opt-in, and bridge PRESENCE, never the bridge object: hosts pass `agentControl`
240
241
  // inline, so an identity dep would re-register every tool on every render (see
241
242
  // `hasBridgeAccess`). Pane, run context, and bridge are all read through refs at call time.
242
243
  // Tradeoff: swapping to a genuinely different bridge instance while enabled does not
243
- // re-subscribe — responses still route to the current bridge via the ref, but the old
244
+ // re-subscribe — responses still route to the bridge that delivered each action, and the old
244
245
  // subscription stays live. A host needing a true swap should toggle `enabled` or remount.
245
- // eslint-disable-next-line react-hooks/exhaustive-deps
246
- }, [enabled, hasBridgeAccess]);
246
+ }, [enabled, hasBridgeAccess, options.webmcp, surfaces]);
247
247
  }
248
248
  //# sourceMappingURL=useChatPaneAgentControl.hooks.js.map
@@ -1,5 +1,9 @@
1
+ import { type Logger } from '@jini-ai/core/primitives';
1
2
  import { type DragEventHandler } from 'react';
3
+ import { useFileDropTarget } from '@jini-ai/ui';
2
4
  export interface UseChatPaneFileDropOptions {
5
+ report?: Pick<Logger, 'error'> | undefined;
6
+ useFileDropTargetHook?: typeof useFileDropTarget;
3
7
  enabled: boolean;
4
8
  onFiles: (files: File[]) => void | Promise<void>;
5
9
  }
@@ -22,5 +26,5 @@ export interface UseChatPaneFileDropResult {
22
26
  * @complexity Time: O(n) for the dropped file list; space: O(n).
23
27
  * @overallScore 100/100
24
28
  */
25
- export declare function useChatPaneFileDrop({ enabled, onFiles, }: UseChatPaneFileDropOptions): UseChatPaneFileDropResult;
29
+ export declare function useChatPaneFileDrop({ enabled, onFiles, report, useFileDropTargetHook, }: UseChatPaneFileDropOptions): UseChatPaneFileDropResult;
26
30
  //# sourceMappingURL=useChatPaneFileDrop.hooks.d.ts.map
@@ -1,4 +1,4 @@
1
- import { formatErrorForLog } from '@jini-ai/core';
1
+ import { createConsoleLogger } from '@jini-ai/core/primitives';
2
2
  import { useCallback, } from 'react';
3
3
  import { useFileDropTarget } from '@jini-ai/ui';
4
4
  function carriesFiles(event) {
@@ -7,17 +7,17 @@ function carriesFiles(event) {
7
7
  || (event.type === 'drop' && event.dataTransfer.files.length > 0);
8
8
  }
9
9
  /** Invokes the host's `onFiles` and reports a synchronous throw or async rejection without leaving it unhandled. */
10
- function runOnFilesHostEffect(onFiles, files) {
10
+ function runOnFilesHostEffect({ onFiles, files }, { report: logger = createConsoleLogger({ prefix: '' }) } = {}) {
11
11
  let result;
12
12
  try {
13
13
  result = onFiles(files);
14
14
  }
15
15
  catch (error) {
16
- console.error('[@jini-ai/chat] useChatPaneFileDrop onFiles host effect failed:', formatErrorForLog({ error }));
16
+ logger.error({ message: '[@jini-ai/chat] useChatPaneFileDrop onFiles host effect failed:' }, { error });
17
17
  return;
18
18
  }
19
19
  void Promise.resolve(result).catch((error) => {
20
- console.error('[@jini-ai/chat] useChatPaneFileDrop onFiles host effect failed:', formatErrorForLog({ error }));
20
+ logger.error({ message: '[@jini-ai/chat] useChatPaneFileDrop onFiles host effect failed:' }, { error });
21
21
  });
22
22
  }
23
23
  /**
@@ -28,9 +28,9 @@ function runOnFilesHostEffect(onFiles, files) {
28
28
  * @complexity Time: O(n) for the dropped file list; space: O(n).
29
29
  * @overallScore 100/100
30
30
  */
31
- export function useChatPaneFileDrop({ enabled, onFiles, }) {
32
- const dropTarget = useFileDropTarget((files) => {
33
- runOnFilesHostEffect(onFiles, files);
31
+ export function useChatPaneFileDrop({ enabled, onFiles, report, useFileDropTargetHook = useFileDropTarget, }) {
32
+ const dropTarget = useFileDropTargetHook((files) => {
33
+ runOnFilesHostEffect({ onFiles, files }, { report });
34
34
  });
35
35
  const onDragEnter = useCallback((event) => {
36
36
  if (!enabled || !carriesFiles(event))
@@ -10,6 +10,13 @@
10
10
  * closes the menu and lets focus move on).
11
11
  */
12
12
  import { type CSSProperties, type KeyboardEvent as ReactKeyboardEvent, type RefObject } from 'react';
13
+ /** Only reveal a shortened-value tooltip when the menu is closed. */
14
+ export declare function createRuntimeDropUpTipHandler({ tipVisible, tip }: {
15
+ tipVisible: boolean;
16
+ tip: {
17
+ show: () => void;
18
+ };
19
+ }, _options?: {}): () => void;
13
20
  /**
14
21
  * Viewport-fixed geometry for a drop-up: right-aligned with the trigger, clamped into the
15
22
  * viewport and (when given) into `bounds`, bottom edge just above it, and never taller than the
@@ -12,6 +12,11 @@
12
12
  import { useCallback, useEffect, useId, useRef, useState, } from 'react';
13
13
  import { resolveRovingIndex } from './useAgentRuntimePicker.hooks.js';
14
14
  const MENU_ITEMS = '[role="menuitemradio"]';
15
+ /** Only reveal a shortened-value tooltip when the menu is closed. */
16
+ export function createRuntimeDropUpTipHandler({ tipVisible, tip }, _options = {}) {
17
+ return () => { if (tipVisible)
18
+ tip.show(); };
19
+ }
15
20
  /**
16
21
  * Viewport-fixed geometry for a drop-up: right-aligned with the trigger, clamped into the
17
22
  * viewport and (when given) into `bounds`, bottom edge just above it, and never taller than the
@@ -1,8 +1,11 @@
1
1
  import { concreteModelOptions, modelIdentityKind } from '@jini-ai/agent-runtime/model-selection';
2
+ import { claudeBarVendorWords } from './claude/model-options.js';
3
+ import { codexBarVendorWords } from './codex/model-options.js';
4
+ import { antigravityBarVendorWords } from './antigravity/model-options.js';
2
5
  // Model names and timestamps are metadata; only surrounding picker copy is translated.
3
6
  const passthrough = key => key;
4
7
  export function isConcretePickerModel(id) {
5
- return modelIdentityKind(id) === 'concrete';
8
+ return modelIdentityKind({ id }) === 'concrete';
6
9
  }
7
10
  /** Aliases are selectable only as their evidence-backed concrete ID. Never render a Default row.
8
11
  * Keeps the first position per concrete ID, upgrading raw-ID labels from later human labels.
@@ -46,9 +49,9 @@ export function pickerCatalogNote(agent, t = passthrough) {
46
49
  // The vendor word each CLI's own icon already shows beside the bar label (owner 2026-10-18).
47
50
  // Agents not listed keep every word: a Cursor icon says nothing about whether a model is GPT.
48
51
  const BAR_VENDOR_WORDS = {
49
- claude: ['claude', 'anthropic'],
50
- codex: ['gpt', 'openai'],
51
- antigravity: ['gemini', 'google'],
52
+ claude: claudeBarVendorWords,
53
+ codex: codexBarVendorWords,
54
+ antigravity: antigravityBarVendorWords,
52
55
  };
53
56
  // A bare catalog id ("claude-opus-5-5", "gpt-6-astra[1m]", "anthropic/claude-sonnet-5") rather than a display name.
54
57
  const RAW_MODEL_ID = /^(?:[a-z0-9._-]+\/)*[a-z0-9][a-z0-9._-]*(?:\[[^\]]*\])?$/;