@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
@@ -1,132 +1,15 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { modelReasoningOptions } from '@jini-ai/agent-runtime/model-selection';
3
- import { friendlyModelLabel, pickerModelValue, pickerCatalogNote, pickerModelOptions, shortModelLabel } from '../model-options.js';
4
- import { useId } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import {} from 'react';
5
3
  import { createPortal } from 'react-dom';
6
- import { AgentIcon, RemixIcon, SearchableModelSelect, useAgentHandle, useOverlayContainer } from '@jini-ai/ui';
7
- import { agentHandleProps, agentHandleSegment } from '@jini-ai/agentic';
8
- import { InfoTip } from '@jini-ai/ui/admin-widgets';
9
- import { assessNativeToolPolicy } from '@jini-ai/agent-runtime/native-tool-policy';
4
+ import { AgentIcon, RemixIcon, useAgentHandle, useOverlayContainer } from '@jini-ai/ui';
5
+ import { agentHandleProps } from '@jini-ai/core/agent-handles';
6
+ import { NativeToolPolicyWarning, RuntimeModeButtons, RuntimeAgentList, RuntimeBarMenus, RuntimeByokDetails, RuntimeRescanFooter } from './RuntimePickerSections.js';
10
7
  import { useT } from '../../../hooks/context.js';
11
8
  import { definedProps } from '../../../util/defined-props.js';
12
- import { RuntimeDropUp } from './RuntimeDropUp.js';
13
- import { defaultChatPaneSelection, resolveChatPaneSelection } from '../rules.js';
14
9
  import { runtimeOptionLabel, runtimePopoverPosition, useAgentRuntimePicker, } from '../hooks/useAgentRuntimePicker.hooks.js';
15
10
  // Re-exported so this module's public surface is unchanged by the behavior extraction; both are
16
11
  // pure and now live beside the hook that consumes them.
17
12
  export { runtimeOptionLabel, runtimePopoverPosition };
18
- export function runtimeAgentStatus({ agent }) {
19
- if (agent.available === false)
20
- return agent.diagnostic ?? 'Not found on PATH';
21
- if (agent.authStatus === 'missing')
22
- return 'Installed · sign-in required';
23
- return agent.version ?? 'Installed';
24
- }
25
- /**
26
- * An agent's `fullCliAccessNote` as a warning icon whose tip (hover, focus, tap) holds the text.
27
- * It was a paragraph beside the model picker that squeezed the composer row (owner 2026-10-30).
28
- * `descriptionId` lets the agent's own radio in the picker list read the same text.
29
- */
30
- function FullAccessNoteTip({ note, descriptionId, t }) {
31
- return (_jsx("span", { className: "jini-runtime-access-note", children: _jsx(InfoTip, { label: t(note), triggerLabel: t('Full computer access'), descriptionId: descriptionId, placement: "top", icon: _jsx(RemixIcon, { name: "alert-line", size: 16 }) }) }));
32
- }
33
- /** Selection preflight uses the launch assessor; it never substitutes for enforcement. */
34
- function NativeToolPolicyWarning({ agent, policy, isApi }) {
35
- const t = useT();
36
- if (!agent || isApi)
37
- return null;
38
- const warning = policy ? assessNativeToolPolicy({ def: agent, policy }) : null;
39
- return _jsxs(_Fragment, { children: [agent.fullCliAccessNote ? _jsx(FullAccessNoteTip, { note: agent.fullCliAccessNote, t: t }) : null, warning ? _jsx(InfoTip, { label: t(warning), triggerLabel: t('Agent permissions required'), placement: "top", icon: _jsx(RemixIcon, { name: "alert-line", size: 16 }) }) : null] });
40
- }
41
- function RuntimeModeButtons({ base, executionMode, daemonOnline, apiModeAvailable, onExecutionModeChange, t, }) {
42
- const localModeLabel = executionMode === 'local' ? t('active') : '';
43
- return (_jsxs(_Fragment, { children: [_jsxs("button", { type: "button", ...agentHandleProps({}, { base, action: 'mode-local', role: 'button', label: t('Use Local CLI') }), className: `jini-runtime-mode${executionMode === 'local' ? ' is-active' : ''}`, disabled: !daemonOnline && executionMode !== 'local', onClick: () => onExecutionModeChange?.('local'), children: [_jsx(RemixIcon, { name: "terminal-box-line", size: 18 }), _jsx("span", { children: t('Use Local CLI') }), _jsx("span", { className: "jini-runtime-mode__meta", children: !daemonOnline ? t('offline') : localModeLabel }), executionMode === 'local' ? (_jsx(RemixIcon, { name: "check-line", size: 19, className: "jini-runtime-check" })) : null] }), _jsxs("button", { type: "button", ...agentHandleProps({}, { base, action: 'mode-api', role: 'button', label: t('Use API · BYOK') }), className: `jini-runtime-mode${executionMode === 'api' ? ' is-active' : ''}`, disabled: !apiModeAvailable, onClick: () => onExecutionModeChange?.('api'), children: [_jsx(RemixIcon, { name: "link", size: 18 }), _jsx("span", { children: t('Use API · BYOK') }), !apiModeAvailable ? _jsx("span", { className: "jini-runtime-mode__meta", children: t('not configured') }) : null, executionMode === 'api' ? (_jsx(RemixIcon, { name: "check-line", size: 19, className: "jini-runtime-check" })) : null] })] }));
44
- }
45
- function RuntimeAgentList({ base, orderedAgents, value, onChange, agentIconBasePath, t, }) {
46
- const noteIdPrefix = useId();
47
- if (orderedAgents.length === 0) {
48
- return _jsx("div", { className: "jini-runtime-empty", children: t('No available code agents') });
49
- }
50
- return (_jsx(_Fragment, { children: orderedAgents.map((agent) => (_jsx(RuntimeAgentRow, { base: base, agent: agent, active: agent.id === value.agentId, noteId: agent.fullCliAccessNote ? `${noteIdPrefix}-${agent.id}-note` : undefined, onChange: onChange, agentIconBasePath: agentIconBasePath, t: t }, agent.id))) }));
51
- }
52
- function RuntimeAgentRow({ base, agent, active, noteId, onChange, agentIconBasePath, t }) {
53
- const status = runtimeAgentStatus({ agent: agent });
54
- // The note's icon is a control of its own, so it sits beside the radio, never inside it.
55
- return (_jsxs("div", { className: "jini-runtime-agent-row", children: [_jsxs("button", { type: "button", ...agentHandleProps({}, { base, action: `agent-${agentHandleSegment({ value: agent.id })}`, role: 'button', label: agent.name }), role: "radio", "aria-checked": active, className: `jini-runtime-agent${active ? ' is-active' : ''}`, "aria-current": active ? 'true' : undefined, "aria-label": `${agent.name} · ${status}`, ...(noteId ? { 'aria-describedby': noteId } : {}), onClick: () => onChange(defaultChatPaneSelection({ agent: agent })), children: [_jsx(AgentIcon, { id: agent.id, size: 20, className: "jini-runtime-agent-icon", ...definedProps({ source: { basePath: agentIconBasePath } }) }), _jsx("span", { className: "jini-runtime-agent__copy", children: _jsx("strong", { children: agent.name }) }), agent.supportsTools === false ? (_jsx("span", { className: "jini-runtime-agent__badge", title: t("This CLI has no MCP support, so it cannot use this app's tools."), children: t('No tools') })) : null, _jsx("span", { className: "jini-runtime-agent__status", children: active ? t('selected') : status }), active ? (_jsx(RemixIcon, { name: "check-line", size: 19, className: "jini-runtime-check" })) : null] }), agent.fullCliAccessNote ? _jsx(FullAccessNoteTip, { note: agent.fullCliAccessNote, descriptionId: noteId, t: t }) : null] }));
56
- }
57
- /**
58
- * The composer bar's "Model ⌄" and "Effort ⌄" drop-ups for the selected CLI. These replace the
59
- * Model / Reasoning selects that used to sit in the runtime popover under the agent list (owner
60
- * 2026-10-18: pick them from the bar and keep the popover small); they read and write the same
61
- * selection, so nothing else changed. Either one renders nothing when the agent publishes no
62
- * choices for it, rather than an empty menu.
63
- */
64
- function RuntimeBarMenus({ base, selectedAgent, value, onChange, modelLabel, t }) {
65
- if (!selectedAgent)
66
- return null;
67
- // Raw catalog ids (an offline fallback list's rows) read as friendly names in the bar and its list.
68
- const models = pickerModelOptions(selectedAgent).map((row) => ({ ...row, label: friendlyModelLabel({ label: row.label }) }));
69
- const selectedModelId = pickerModelValue(selectedAgent, value.model);
70
- const efforts = modelReasoningOptions({ agent: selectedAgent, model: models.find(option => option.id === selectedModelId) });
71
- const modelName = friendlyModelLabel({ label: modelLabel });
72
- return (_jsxs(_Fragment, { children: [models.length > 0 ? (_jsx(RuntimeDropUp, { agentHandle: base ? `${base}-model` : false, label: t('Model'), valueLabel: modelName,
73
- // The agent icon sits right beside it, so the bar drops the vendor word and caps the rest.
74
- triggerLabel: shortModelLabel({ label: modelLabel, agentId: selectedAgent.id }), value: pickerModelValue(selectedAgent, value.model), options: models, note: pickerCatalogNote(selectedAgent, t), width: 260, onSelect: (model) => onChange(value.reasoning ? resolveChatPaneSelection({
75
- agents: [selectedAgent], requested: { ...value, model },
76
- }) : { agentId: value.agentId, model }) })) : null, efforts.length > 0 ? (_jsx(RuntimeDropUp, { agentHandle: base ? `${base}-reasoning` : false, label: t('Reasoning'),
77
- // An unset reasoning shows the first option, as the old native select did.
78
- valueLabel: efforts.find((option) => option.id === value.reasoning)?.label ?? efforts[0].label, value: value.reasoning ?? '', options: efforts, width: 180, className: "jini-runtime-dropup-trigger--effort", onSelect: (reasoning) => onChange({
79
- agentId: value.agentId,
80
- ...(value.model ? { model: value.model } : {}),
81
- reasoning,
82
- }) })) : null] }));
83
- }
84
- /**
85
- * What the popover shows in place of the CLI inventory while `executionMode` is `'api'`: the model
86
- * the credential will run, and nothing else.
87
- *
88
- * Everything this replaces (the agent radios, the "Default (CLI config)" select, Reasoning, Rescan
89
- * PATH) is a property of a *detected CLI process* and has no effect on an API turn — rendering them
90
- * here was the defect.
91
- *
92
- * ## Why the same `SearchableModelSelect` the settings screen uses
93
- *
94
- * Not a look-alike `<select>`. This is literally the control `ByokProviderForm`'s Model field
95
- * renders, fed the same discovered list and writing back to the same stored config, so the two
96
- * surfaces cannot drift: pick a model here and the settings screen shows it, and vice versa. Its
97
- * search box also matters at this size — a live Gemini key discovers ~40 models, which is past the
98
- * point where a plain dropdown in a 320px popover is usable.
99
- *
100
- * Falls back to plain text when the host supplies no `onByokModelChange` or no model list. That is
101
- * a real state, not a degenerate one: a host without discovery has nothing to offer a picker, and a
102
- * disabled dropdown would read as "editable once something is enabled" when nothing here will
103
- * enable it.
104
- */
105
- function resolveByokModel({ onByokModelChange }, { byokRuntime }) {
106
- const model = byokRuntime?.model?.trim();
107
- const models = byokRuntime?.models ?? [];
108
- const pickModel = onByokModelChange !== undefined && models.length > 0 ? onByokModelChange : undefined;
109
- return { model, models, pickModel };
110
- }
111
- function RuntimeByokDetails({ base, byokRuntime, onByokModelChange, t }) {
112
- const { model, models, pickModel } = resolveByokModel({ onByokModelChange }, { byokRuntime });
113
- return (_jsxs("div", { className: "jini-runtime-models", children: [_jsxs("div", { className: "jini-runtime-select jini-runtime-byok-model", children: [_jsx("span", { children: t('Model') }), pickModel ? (_jsx(SearchableModelSelect, { agentHandle: base ? `${base}-byok-model` : false, models: models, value: model ?? '', onChange: (next) => pickModel(next), ariaLabel: t('Model'), searchPlaceholder: t('Search models'),
114
- // The menu portals to `document.body` at the package default `z-index: 60`, while this
115
- // popover positions itself at 1000 — so without this the model list opens BEHIND the
116
- // popover that owns it. Raised here rather than in the shared stylesheet because 60 is
117
- // right for every other consumer; only this one opens a portalled menu from inside an
118
- // already-elevated surface.
119
- menuClassName: "jini-runtime-model-menu" })) : (_jsx("strong", { children: model || t('No model configured') }))] }), !model && !pickModel ? (_jsx("div", { className: "jini-runtime-empty", children: t('Set a model in the BYOK settings before sending a message.') })) : null] }));
120
- }
121
- function RuntimeRescanFooter({ base, onRescan, scanning, t }) {
122
- if (onRescan) {
123
- return (_jsxs("button", { type: "button", ...agentHandleProps({}, { base, action: 'rescan', role: 'button', label: t('Rescan PATH') }), className: "jini-runtime-rescan", disabled: scanning, onClick: onRescan, children: [_jsx(RemixIcon, { name: "refresh-line", size: 17, ...(scanning ? { className: 'jini-runtime-spinner' } : {}) }), _jsx("span", { children: scanning ? t('Scanning PATH…') : t('Rescan PATH') })] }));
124
- }
125
- if (scanning) {
126
- return _jsx("div", { className: "jini-runtime-empty", children: t('Scanning PATH…') });
127
- }
128
- return null;
129
- }
130
13
  function RuntimeTriggerIcon({ picker, isApi, byokRuntime, agentIconBasePath }) {
131
14
  const basePath = definedProps({ source: { basePath: agentIconBasePath } });
132
15
  if (!isApi) {
@@ -147,13 +30,16 @@ function runtimePortalBinding({ trigger, overlay }) {
147
30
  page: trigger?.closest('[data-agent-page]')?.getAttribute('data-agent-page') ?? undefined,
148
31
  };
149
32
  }
150
- function RuntimePopover({ base, picker, value, onChange, onRescan, scanning, daemonOnline, executionMode, apiModeAvailable, onExecutionModeChange, byokRuntime, onByokModelChange, agentIconBasePath, t, }) {
151
- const overlay = useOverlayContainer({});
152
- const portal = runtimePortalBinding({ trigger: picker.triggerRef.current, overlay });
153
- if (!picker.open || !picker.position || !portal.container)
33
+ function RuntimePopover({ useOverlayContainerHook = useOverlayContainer, ...props }) {
34
+ const overlay = useOverlayContainerHook({});
35
+ const portal = runtimePortalBinding({ trigger: props.picker.triggerRef.current, overlay });
36
+ if (!props.picker.open || !props.picker.position || !portal.container)
154
37
  return null;
38
+ return createPortal(_jsx(RuntimePopoverContent, { ...props, page: portal.page }), portal.container);
39
+ }
40
+ function RuntimePopoverContent({ base, picker, value, onChange, onRescan, scanning, daemonOnline, executionMode, apiModeAvailable, onExecutionModeChange, byokRuntime, onByokModelChange, agentIconBasePath, t, page, }) {
155
41
  const isApi = executionMode === 'api';
156
- return createPortal(_jsxs("div", { ref: picker.popoverRef, className: "jini-runtime-popover", "data-agent-page": portal.page, ...(picker.originTheme ? { 'data-theme': picker.originTheme } : {}), id: picker.dialogId, role: "dialog", "aria-label": t('Choose AI runtime'), "aria-modal": "false", style: picker.position, onKeyDown: picker.handlePopoverKeyDown, children: [_jsxs("div", { className: "jini-runtime-popover__head", children: [_jsx("strong", { children: executionMode === 'local' ? t('Local CLI') : t('API · BYOK') }), _jsx("span", { children: picker.runtimeSummary })] }), _jsx(RuntimeModeButtons, { base: base, executionMode: executionMode, daemonOnline: daemonOnline, apiModeAvailable: apiModeAvailable, onExecutionModeChange: onExecutionModeChange, t: t }), isApi ? (_jsx(RuntimeByokDetails, { base: base, byokRuntime: byokRuntime, onByokModelChange: onByokModelChange, t: t })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "jini-runtime-section-label", children: t('Code agent') }), _jsx("div", { role: "radiogroup", "aria-label": t('Code agent'), children: _jsx(RuntimeAgentList, { base: base, orderedAgents: picker.orderedAgents, value: value, onChange: onChange, ...definedProps({ source: { agentIconBasePath } }), t: t }) }), _jsx(RuntimeRescanFooter, { base: base, onRescan: onRescan, scanning: scanning, t: t })] }))] }), portal.container);
42
+ return (_jsxs("div", { ref: picker.popoverRef, className: "jini-runtime-popover", "data-agent-page": page, ...(picker.originTheme ? { 'data-theme': picker.originTheme } : {}), id: picker.dialogId, role: "dialog", "aria-label": t('Choose AI runtime'), "aria-modal": "false", style: picker.position, onKeyDown: picker.handlePopoverKeyDown, children: [_jsxs("div", { className: "jini-runtime-popover__head", children: [_jsx("strong", { children: executionMode === 'local' ? t('Local CLI') : t('API · BYOK') }), _jsx("span", { children: picker.runtimeSummary })] }), _jsx(RuntimeModeButtons, { base: base, executionMode: executionMode, daemonOnline: daemonOnline, apiModeAvailable: apiModeAvailable, onExecutionModeChange: onExecutionModeChange, t: t }), isApi ? (_jsx(RuntimeByokDetails, { base: base, byokRuntime: byokRuntime, onByokModelChange: onByokModelChange, t: t })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "jini-runtime-section-label", children: t('Code agent') }), _jsx("div", { role: "radiogroup", "aria-label": t('Code agent'), children: _jsx(RuntimeAgentList, { base: base, orderedAgents: picker.orderedAgents, value: value, onChange: onChange, ...definedProps({ source: { agentIconBasePath } }), t: t }) }), _jsx(RuntimeRescanFooter, { base: base, onRescan: onRescan, scanning: scanning, t: t })] }))] }));
157
43
  }
158
44
  /**
159
45
  * Renders the package-owned local/API, agent, model, and reasoning picker.
@@ -161,20 +47,20 @@ function RuntimePopover({ base, picker, value, onChange, onRescan, scanning, dae
161
47
  * @complexity Time: O(n) in the runtime inventory; space: O(n) for ordering.
162
48
  * @overallScore 100/100
163
49
  */
164
- export function AgentRuntimePicker({ agentHandle, agents, nativeToolPolicy, value, onChange, onRescan, scanning = false, daemonOnline = true, placement = 'up', executionMode = 'local', apiModeAvailable = false, onExecutionModeChange, byokRuntime, onByokModelChange,
50
+ export function AgentRuntimePicker({ useAgentHandleHook = useAgentHandle, useAgentRuntimePickerHook = useAgentRuntimePicker, useTHook = useT, useOverlayContainerHook, agentHandle, agents, nativeToolPolicy, value, onChange, onRescan, scanning = false, daemonOnline = true, placement = 'up', executionMode = 'local', apiModeAvailable = false, onExecutionModeChange, byokRuntime, onByokModelChange,
165
51
  // No default here (was '/agent-icons'): omitted means "let AgentIcon fall back to its own
166
52
  // bundled icon set" — see AgentIcon.tsx's BUNDLED_ICON_URLS. A host that still wants to vendor
167
53
  // its own asset directory can pass this explicitly, same as before.
168
54
  agentIconBasePath, }) {
169
- const base = useAgentHandle({ agentHandle });
170
- const t = useT();
171
- const picker = useAgentRuntimePicker({ agents, value, placement, t, executionMode, byokRuntime });
55
+ const base = useAgentHandleHook({ agentHandle });
56
+ const t = useTHook();
57
+ const picker = useAgentRuntimePickerHook({ agents, value, placement, t, executionMode, byokRuntime });
172
58
  // The one branch this component makes. Everything below the mode buttons describes a detected CLI
173
59
  // — the agent radios, its model and reasoning selects, and the PATH rescan — and none of it is
174
60
  // true of, or has any effect on, an API turn. Previously all of it rendered in both modes, so an
175
61
  // operator on BYOK saw a CLI named as "selected" and a model reading "Default (CLI config)"
176
62
  // while their messages went to a provider over an API key.
177
63
  const isApi = executionMode === 'api';
178
- return (_jsxs("div", { className: "jini-runtime-picker", children: [_jsx(RuntimeTrigger, { base: base, picker: picker, isApi: isApi, byokRuntime: byokRuntime, agentIconBasePath: agentIconBasePath, t: t }), isApi ? null : (_jsx(RuntimeBarMenus, { base: base, selectedAgent: picker.selectedAgent, value: value, onChange: onChange, modelLabel: picker.modelLabel, t: t })), _jsx(NativeToolPolicyWarning, { agent: picker.selectedAgent, policy: nativeToolPolicy, isApi: isApi }), _jsx(RuntimePopover, { base: base, picker: picker, value: value, onChange: onChange, onRescan: onRescan, scanning: scanning, daemonOnline: daemonOnline, executionMode: executionMode, apiModeAvailable: apiModeAvailable, onExecutionModeChange: onExecutionModeChange, byokRuntime: byokRuntime, onByokModelChange: onByokModelChange, agentIconBasePath: agentIconBasePath, t: t })] }));
64
+ return (_jsxs("div", { className: "jini-runtime-picker", children: [_jsx(RuntimeTrigger, { base: base, picker: picker, isApi: isApi, byokRuntime: byokRuntime, agentIconBasePath: agentIconBasePath, t: t }), isApi ? null : (_jsx(RuntimeBarMenus, { base: base, selectedAgent: picker.selectedAgent, value: value, onChange: onChange, modelLabel: picker.modelLabel, t: t })), _jsx(NativeToolPolicyWarning, { agent: picker.selectedAgent, policy: nativeToolPolicy, isApi: isApi, t: t }), _jsx(RuntimePopover, { base: base, picker: picker, value: value, onChange: onChange, onRescan: onRescan, scanning: scanning, daemonOnline: daemonOnline, executionMode: executionMode, apiModeAvailable: apiModeAvailable, onExecutionModeChange: onExecutionModeChange, byokRuntime: byokRuntime, onByokModelChange: onByokModelChange, agentIconBasePath: agentIconBasePath, t: t, ...definedProps({ source: { useOverlayContainerHook } }) })] }));
179
65
  }
180
66
  //# sourceMappingURL=AgentRuntimePicker.js.map
@@ -1,4 +1,25 @@
1
- import type { ChatPaneProps } from '../types.js';
1
+ import type { ChatPaneAgent, ChatPaneProps } from '../types.js';
2
+ import { type UseChatPaneResult } from '../hooks/useChatPane.hooks.js';
3
+ /** What the view needs after collapsing the four `runtimeAccess === undefined ? host : inventory`
4
+ * ternaries into a single branch. */
5
+ export interface ChatPaneRuntimeView {
6
+ agents: readonly ChatPaneAgent[];
7
+ scanningAgents: boolean;
8
+ /** No successful inventory answer yet and the last attempt failed — see
9
+ * `UseChatPaneRuntimeInventoryResult.connectingAgents`. Always `false` for injected agents. */
10
+ connectingAgents: boolean;
11
+ daemonOnline: boolean;
12
+ rescanAgents: (() => void) | undefined;
13
+ }
14
+ /** Every prop `ChatPane` defaults, and its default — applied only where the caller left the prop
15
+ * `undefined`, exactly like the destructuring defaults this replaced. */
16
+ type ChatPaneDefaultedProp = 'agents' | 'runtimeStatusPollMs' | 'variant' | 'scanningAgents' | 'daemonOnline' | 'executionMode' | 'apiModeAvailable' | 'suggestions' | 'workingDirectoryControlPlacement' | 'toolCallDisplay' | 'showUsageLine' | 'showThinking' | 'agentPluginsMode' | 'disabled' | 'runtimePickerPlacement';
17
+ export type ResolvedChatPaneProps = ChatPaneProps & Required<Pick<ChatPaneProps, ChatPaneDefaultedProp>>;
18
+ export declare function useComposerHandlePublisher({ pane }: {
19
+ pane: UseChatPaneResult;
20
+ }, { composerHandle }: {
21
+ composerHandle?: ChatPaneProps['composerHandle'];
22
+ }): void;
2
23
  /**
3
24
  * Renders the self-contained chat-pane composition, including runtime and
4
25
  * working-directory orchestration owned by `@jini-ai/chat-react`.
@@ -6,5 +27,6 @@ import type { ChatPaneProps } from '../types.js';
6
27
  * @complexity Time/space: O(n) in rendered messages, agents, and suggestions.
7
28
  * @overallScore 100/100
8
29
  */
9
- export declare function ChatPane(props: ChatPaneProps): import("react").JSX.Element;
30
+ export declare function ChatPane({ useAgentHandleHook, useTHook, useChatPaneSurfaceHook, useChatPaneComposerPlaceholderHook, useChatPaneRuntimeInventoryHook, useChatPaneHook, useComposerHandlePublisherHook, useChatPaneAgentControlHook, useChatPaneFileDropHook, useChatPaneControlsHeightHook, useChatPaneSuggestionHook, useChatPaneNewTabLinksHook, useChatPaneTranscriptPropsHook, ...props }: ChatPaneProps): import("react").JSX.Element;
31
+ export {};
10
32
  //# sourceMappingURL=ChatPane.d.ts.map