@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,34 +1,19 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { AgentPluginUsage } from './AgentPluginUsage.js';
3
- import { SECRET_REDACTED_NOTICE } from '../../../../core/user-text-redaction.js';
4
- import { useEffect, useId, useMemo, useRef } from 'react';
5
- import { WorkingDirPicker, useAgentHandle } from '@jini-ai/ui';
6
- import { Composer } from '../../../components/Composer.js';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ import { useAgentHandle } from '@jini-ai/ui';
7
4
  import { appendComposerDiscovery } from '../../../components/composer-discovery.js';
8
- import { Icon } from '../../../components/Icon.js';
9
- import { MessageList } from '../../../components/MessageList.js';
10
5
  import { useT } from '../../../hooks/context.js';
11
6
  import { definedProps } from '../../../util/defined-props.js';
12
- import { chatPaneSendBlockerNeedsNotice, describeAttachmentError, describeChatPaneSendBlocker, describeTypedAnswerNotice, isChatPaneApiModeConfigured, isChatPaneFileDropEnabled } from '../rules.js';
7
+ import { isChatPaneApiModeConfigured, isChatPaneFileDropEnabled } from '../rules.js';
13
8
  import { useChatPane } from '../hooks/useChatPane.hooks.js';
14
9
  import { useChatPaneAgentControl } from '../hooks/useChatPaneAgentControl.hooks.js';
15
10
  import { useChatPaneComposerPlaceholder } from '../hooks/useChatPaneComposerPlaceholder.hooks.js';
16
- import { useChatPaneControlsHeight } from '../hooks/useChatPaneControlsHeight.hooks.js';
17
- import { useChatPaneNewTabLinks } from '../hooks/useChatPaneNewTabLinks.hooks.js';
18
11
  import { useChatPaneSurface } from '../hooks/useChatPaneSurface.hooks.js';
19
- import { useChatPaneSuggestion } from '../hooks/useChatPaneSuggestion.hooks.js';
20
12
  import { useChatPaneFileDrop, } from '../hooks/useChatPaneFileDrop.hooks.js';
21
13
  import { useChatPaneRuntimeInventory, } from '../hooks/useChatPaneRuntimeInventory.hooks.js';
22
- import { CHAT_PANE_STYLES } from '../styles.js';
23
14
  import { AgentRuntimePicker } from './AgentRuntimePicker.js';
15
+ import { ChatPaneLayout } from './ChatPaneLayout.js';
24
16
  const EMPTY_AGENTS = [];
25
- function defaultHeader(title, onReset, t) {
26
- return (_jsxs("div", { className: "jini-chat-pane__header", children: [_jsxs("div", { className: "jini-chat-pane__heading", children: [_jsx("span", { className: "jini-chat-pane__eyebrow", children: t('Workspace chat') }), _jsx("h1", { className: "jini-chat-pane__title", children: title ?? t('Chat') })] }), _jsx("button", { type: "button", className: "jini-chat-pane__new-thread", onClick: onReset, children: t('New thread') })] }));
27
- }
28
- function chatPaneClassName(variant, className) {
29
- const suffix = className ? ' ' + className : '';
30
- return `jini-chat-pane jini-chat-pane--${variant}${suffix}`;
31
- }
32
17
  function resolveRuntimeAccessView(runtimeAccess, injectedAgents, scanningAgents, daemonOnline, onRescanAgents, inventory) {
33
18
  if (runtimeAccess === undefined) {
34
19
  return { agents: injectedAgents, scanningAgents, connectingAgents: false, daemonOnline, rescanAgents: onRescanAgents };
@@ -41,202 +26,6 @@ function resolveRuntimeAccessView(runtimeAccess, injectedAgents, scanningAgents,
41
26
  rescanAgents: () => void inventory.rescanAgents(),
42
27
  };
43
28
  }
44
- function ChatPaneSuggestionsRow({ suggestions, onSelect, t }) {
45
- if (suggestions.length === 0)
46
- return null;
47
- return (_jsx("div", { className: "jini-chat-pane__suggestions", "aria-label": t('Example prompts'), children: suggestions.map((suggestion) => (_jsx("button", { type: "button", className: "jini-chat-pane__suggestion", onClick: () => onSelect(suggestion), children: suggestion }, suggestion))) }));
48
- }
49
- /**
50
- * The `unavailable` banner's copy and, where reachable, its actual fix — distinguishing three
51
- * CLI-less states so a pointer at BYOK is never shown as an option that would not actually help:
52
- *
53
- * - `executionMode === 'local'` with BYOK available: switching mode is a real fix. When the host
54
- * wired `onExecutionModeChange` (the same callback the runtime picker's own mode buttons already
55
- * call — see `AgentRuntimePicker.tsx`), this renders as a button that performs the switch
56
- * directly rather than prose telling the operator to go hunting for the control themselves. A
57
- * host that reports `apiModeAvailable` without wiring the callback still gets an honest, if
58
- * inert, pointer as plain copy.
59
- * - `executionMode === 'local'` with BYOK NOT available: switching would not help — offering it
60
- * anyway would be a lie — so this falls back to the original, unconditional message.
61
- * - `executionMode === 'api'` already: the operator is already on the one path that could work,
62
- * so a "switch to BYOK" pointer would be nonsensical here; whatever is still missing (e.g. no
63
- * model chosen) is `RuntimeByokDetails`' own job to explain inside the runtime picker, not this
64
- * banner's.
65
- */
66
- function ChatPaneNoUsableCliMessage({ executionMode, apiModeAvailable, onExecutionModeChange, t, }) {
67
- const byokIsARealFix = executionMode === 'local' && apiModeAvailable;
68
- if (!byokIsARealFix) {
69
- return _jsx("div", { className: "jini-chat-pane__error", role: "alert", children: t('No usable CLI is selected.') });
70
- }
71
- if (!onExecutionModeChange) {
72
- return (_jsx("div", { className: "jini-chat-pane__error", role: "alert", children: t('No usable CLI is selected — switch to BYOK to use your own API key.') }));
73
- }
74
- return (_jsxs("div", { className: "jini-chat-pane__error", role: "alert", children: [t('No usable CLI is selected.'), ' ', _jsx("button", { type: "button", className: "jini-chat-pane__error-action", onClick: () => onExecutionModeChange('api'), children: t('Switch to BYOK') })] }));
75
- }
76
- /**
77
- * `unavailable` alone conflates "inventory still loading" with "inventory loaded, nothing
78
- * usable" — both present as `selectedAgent === undefined`. `scanningAgents` is the signal
79
- * that tells them apart, mirroring the `workingDirectoryPending`/`workingDirectoryInvalid`
80
- * pair below: a pending detection is a `status`, only a *finished* detection that found
81
- * nothing is an `alert`. `connectingAgents` is a third state: the inventory could not be
82
- * read at all (the host is unreachable, typically a daemon restart) and a retry is
83
- * pending — a plain status too, never "No usable CLI", which only a SUCCESSFUL answer can
84
- * establish.
85
- */
86
- function ChatPaneAvailabilityStatus({ unavailable, scanningAgents, connectingAgents, executionMode, apiModeAvailable, onExecutionModeChange, t, }) {
87
- if (!unavailable)
88
- return null;
89
- if (connectingAgents) {
90
- return (_jsx("div", { className: "jini-chat-pane__status", role: "status", children: t('Connecting to the assistant…') }));
91
- }
92
- if (scanningAgents) {
93
- return (_jsx("div", { className: "jini-chat-pane__status", role: "status", children: t('Loading available CLIs') }));
94
- }
95
- return (_jsx(ChatPaneNoUsableCliMessage, { executionMode: executionMode, apiModeAvailable: apiModeAvailable, onExecutionModeChange: onExecutionModeChange, t: t }));
96
- }
97
- function ChatPaneWorkingDirectoryStatus({ workingDirectoryPending, workingDirectoryInvalid, t, }) {
98
- if (workingDirectoryPending) {
99
- return (_jsx("div", { className: "jini-chat-pane__status", role: "status", children: t('Checking working directory…') }));
100
- }
101
- if (!workingDirectoryInvalid)
102
- return null;
103
- return (_jsx("div", { className: "jini-chat-pane__error", role: "alert", children: t('Working directory is unavailable.') }));
104
- }
105
- /**
106
- * The typed-answer delivery notice. Only `'failed'` ever reaches it: `useChatPane` queues a
107
- * `'not-pending'` refusal as one ordinary message itself (`answerWaitingQuestion`), without a notice.
108
- *
109
- * MOVE (from the retired "Send as a new message" button this notice once rendered for
110
- * `'not-pending'`): the held answer's only way into a new run besides clearing the draft — an
111
- * explicit choice, so a closed question never turns an answer into a paid run on a second Enter.
112
- * The hook's automatic one-time fallback now owns that guarantee, which left the button unreachable.
113
- */
114
- function ChatPaneTypedAnswerNotice({ typedAnswerNotice, t, }) {
115
- if (!typedAnswerNotice)
116
- return null;
117
- return (_jsx("div", { className: "jini-chat-pane__error", role: "alert", children: t(describeTypedAnswerNotice({ notice: typedAnswerNotice })) }));
118
- }
119
- /** A failed upload, in plain words, with redacted details a person can copy into a report. */
120
- function ChatPaneAttachmentError({ error, t }) {
121
- const { summary, details } = describeAttachmentError({ error });
122
- return (_jsxs("div", { className: "jini-chat-pane__error", role: "alert", children: [_jsx("div", { children: t(summary) }), details ? _jsxs("div", { className: "jini-chat-pane__error-details", children: [t('Details:'), " ", details] }) : null] }));
123
- }
124
- /** A send the server never accepted. Its text went back into the composer if that was still empty;
125
- * Retry sends it again either way (see `useChatPane`'s `retrySend`). */
126
- function ChatPaneSendError({ sendError, onRetry, t }) {
127
- if (!sendError)
128
- return null;
129
- return (_jsxs("div", { className: "jini-chat-pane__error", role: "alert", children: [t('Not sent:'), " ", sendError.message, ' ', _jsx("button", { type: "button", className: "jini-chat-pane__error-action", onClick: onRetry, children: t('Retry') })] }));
130
- }
131
- /** The pane's stack of mutually-independent error/status banners — each condition is its own
132
- * source of truth, so they are rendered as siblings rather than folded into one derived state. */
133
- function ChatPaneStatusMessages({ sendError, onRetrySend, attachmentError, dropReadError, workingDirectoryError, workingDirectoryPending, workingDirectoryInvalid, runtimeInventoryError, typedAnswerNotice, ...availability }) {
134
- const { t } = availability;
135
- return (_jsxs(_Fragment, { children: [_jsx(ChatPaneAvailabilityStatus, { ...availability }), _jsx(ChatPaneSendError, { sendError: sendError, onRetry: onRetrySend, t: t }), attachmentError ? _jsx(ChatPaneAttachmentError, { error: attachmentError, t: t }) : null, dropReadError ? (_jsx("div", { className: "jini-chat-pane__error", role: "alert", children: dropReadError })) : null, workingDirectoryError ? (_jsx("div", { className: "jini-chat-pane__error", role: "alert", children: workingDirectoryError.message })) : null, _jsx(ChatPaneWorkingDirectoryStatus, { workingDirectoryPending: workingDirectoryPending, workingDirectoryInvalid: workingDirectoryInvalid, t: t }), runtimeInventoryError && !availability.connectingAgents ? (_jsx("div", { className: "jini-chat-pane__error", role: "alert", children: runtimeInventoryError.message })) : null, _jsx(ChatPaneTypedAnswerNotice, { typedAnswerNotice: typedAnswerNotice, t: t })] }));
136
- }
137
- function ChatPaneWorkingDirectoryBlock({ workingDirectoryAccess, workingDirectoryControlPlacement, pane, t, }) {
138
- if (workingDirectoryAccess && workingDirectoryControlPlacement === 'below') {
139
- return (_jsx("div", { className: "jini-chat-pane__workdir", children: _jsx(WorkingDirPicker, { workingDir: pane.workingDirectory, recentDirs: [...pane.recentDirectories], onPickDirectory: () => void pane.pickWorkingDirectory(), onSelectRecent: (directory) => void pane.selectRecentDirectory(directory), placement: "up", onClear: pane.clearWorkingDirectory, invalid: pane.workingDirectoryInvalid, onOpen: () => void pane.openWorkingDirectoryPicker(), labels: { trigger: t('Select working directory') } }) }));
140
- }
141
- // Three cases render nothing here, for different reasons:
142
- // - No native `workingDirectoryAccess`: the static text line this replaced is gone entirely —
143
- // see `ChatPaneComposerArea` below, which threads `pane.workingDirectory` and
144
- // `pane.selectRecentDirectory` into `Composer`'s own folder-icon (popover) trigger instead.
145
- // - `workingDirectoryAccess` present but `workingDirectoryControlPlacement === 'composer'`: the
146
- // host asked for the control next to "+" instead — `resolveComposerWorkingDirectory` wires
147
- // `Composer`'s trigger straight to `pane.pickWorkingDirectory` in that case, so rendering this
148
- // block too would put up a second, competing control below the composer.
149
- // - `workingDirectoryControlPlacement === 'none'`: the host asked for no working-directory
150
- // control anywhere — `resolveComposerWorkingDirectory` supplies neither composer handler in
151
- // this case either, so `Composer`'s own folder-icon gate (`onChangeWorkingDirectory ||
152
- // onPickWorkingDirectory`) renders nothing too. Nothing here has a trigger to defer to.
153
- // In every case but `'none'`, the trigger this defers to already covers both "nothing set yet"
154
- // and "a value is set", so this block has nothing left to render.
155
- return null;
156
- }
157
- /** `uploadAttachments === undefined` gates BOTH of these — a temporarily-disabled composer still
158
- * consumes a file drop so the browser cannot navigate away to the local file (see
159
- * `useChatPaneFileDrop`'s module doc), so the drop handlers stay attached even when the picker
160
- * itself is hidden. Shared here so `ChatPaneComposerArea` pays for the branch once, at module
161
- * scope, instead of per call site. */
162
- function resolveDropTargetProps(uploadAttachments, fileDrop) {
163
- return uploadAttachments === undefined ? {} : fileDrop.targetProps;
164
- }
165
- function resolveComposerAttachmentPicker(uploadAttachments, pane, attachmentAccept) {
166
- if (uploadAttachments === undefined)
167
- return {};
168
- return {
169
- attachmentPicker: definedProps({ source: {
170
- onFiles: pane.addAttachments,
171
- uploading: pane.isUploadingAttachments,
172
- accept: attachmentAccept,
173
- } }),
174
- };
175
- }
176
- /**
177
- * Resolves which of `Composer`'s two mutually-exclusive working-directory props (if either) this
178
- * render should supply, mirroring `ChatPaneWorkingDirectoryBlock`'s own four-way branch above so
179
- * the two never disagree about which control owns the composer's folder-icon slot:
180
- *
181
- * - `workingDirectoryControlPlacement === 'none'`: neither prop, regardless of whether
182
- * `workingDirectoryAccess` is present — the host asked for no working-directory control
183
- * anywhere, so `Composer`'s own gate (`onChangeWorkingDirectory || onPickWorkingDirectory`)
184
- * renders nothing. Checked first because it overrides both cases below.
185
- * - No `workingDirectoryAccess`: the composer's lightweight text-input popover, via
186
- * `onChangeWorkingDirectory`. `pane.selectRecentDirectory` is reused as the plain setter here
187
- * rather than inventing one — `useChatPaneWorkingDirectory`'s own doc confirms it already writes
188
- * the value directly (no native validation) whenever `access` is absent, which is exactly this
189
- * case.
190
- * - `workingDirectoryAccess` present and `workingDirectoryControlPlacement === 'composer'`: the
191
- * SAME folder-icon trigger, but wired to `onPickWorkingDirectory` instead — clicking it invokes
192
- * the native OS dialog (`pane.pickWorkingDirectory`) directly, with no popover in between.
193
- * - `workingDirectoryAccess` present and placement is (default) `'below'`: neither prop — the
194
- * composer renders no folder icon at all, and `ChatPaneWorkingDirectoryBlock` renders the richer
195
- * `WorkingDirPicker` below instead, unchanged from every host's prior behavior.
196
- */
197
- function resolveComposerWorkingDirectory(workingDirectoryAccess, workingDirectoryControlPlacement, pane) {
198
- if (workingDirectoryControlPlacement === 'none') {
199
- return {};
200
- }
201
- if (!workingDirectoryAccess) {
202
- return {
203
- workingDirectory: pane.workingDirectory,
204
- onChangeWorkingDirectory: (directory) => void pane.selectRecentDirectory(directory),
205
- };
206
- }
207
- if (workingDirectoryControlPlacement === 'composer') {
208
- return {
209
- workingDirectory: pane.workingDirectory,
210
- onPickWorkingDirectory: () => void pane.pickWorkingDirectory(),
211
- };
212
- }
213
- return {};
214
- }
215
- /** The drop target, composer, and working-directory block — everything below the status banners
216
- * that reads/writes the live pane. Cancelling an in-flight run is not a separate control here: it
217
- * lives in the composer's own trailing button, which swaps from send to stop while streaming (see
218
- * `Composer`'s `running`/`onCancel` props) — the same control an operator's attention is already
219
- * on, rather than a second affordance elsewhere in the pane they'd have to go find.
220
- *
221
- * The pending-turn strip previously lived here (a banner bolted above the composer). It now
222
- * renders inside `<MessageList>` itself, as the newest transcript entry — see that component's
223
- * `pendingPrompts` prop and this component's own call site below. */
224
- function ChatPaneComposerArea({ agentHandle, fileDrop, uploadAttachments, pane, disabled, unavailable, placeholder, slots, attachmentAccept, workingDirectoryAccess, workingDirectoryControlPlacement, t, }) {
225
- const sendDisabledReasonId = useId();
226
- const sendDisabledReason = pane.sendBlocker && pane.sendBlocker !== 'streaming'
227
- ? t(describeChatPaneSendBlocker(pane.sendBlocker))
228
- : undefined;
229
- // MOVE: the reason used to sit in the composer's footer row beside the folder and model buttons.
230
- // It is now a notice above the composer, with the other pane notices; Send's tooltip keeps it.
231
- // While the pane is unavailable its own banner (loading, no usable CLI) already says it.
232
- const showsNotice = sendDisabledReason !== undefined && !unavailable && chatPaneSendBlockerNeedsNotice({ blocker: pane.sendBlocker });
233
- return (_jsxs("div", { className: `jini-chat-pane__drop-target${fileDrop.draggingFiles ? ' is-dragging-files' : ''}`, "data-testid": "chat-pane-file-drop-target", "data-dragging-files": fileDrop.draggingFiles ? 'true' : 'false', ...resolveDropTargetProps(uploadAttachments, fileDrop), children: [fileDrop.draggingFiles ? (_jsx("span", { className: "jini-chat-pane__drop-announcement", role: "status", children: t('Drop files to attach') })) : null, showsNotice ? (_jsxs("div", { id: sendDisabledReasonId, className: "jini-chat-pane__status jini-chat-pane__blocker", role: "status", children: [pane.sendBlocker === 'uploads-pending' ? _jsx(Icon, { name: "spinner", size: 13 }) : null, _jsx("span", { children: sendDisabledReason })] })) : null, _jsx(Composer, { agentHandle: agentHandle, composer: pane.composer, onSend: () => void pane.send(),
234
- // Streaming no longer locks the textarea: `pane.send()` queues a turn typed during a run
235
- // rather than refusing it, so the operator can keep writing while the agent thinks.
236
- disabled: disabled || unavailable,
237
- // The one blocker `send()` handles itself. Every other refusal still greys out the button.
238
- sendDisabled: !pane.canSend && pane.sendBlocker !== 'streaming', ...definedProps({ source: { sendDisabledReason, sendDisabledReasonId: showsNotice ? sendDisabledReasonId : undefined } }), running: pane.conversation.isStreaming, onCancel: pane.conversation.cancel, ...definedProps({ source: { placeholder } }), slots: slots, ...resolveComposerAttachmentPicker(uploadAttachments, pane, attachmentAccept), ...resolveComposerWorkingDirectory(workingDirectoryAccess, workingDirectoryControlPlacement, pane) }), _jsx(ChatPaneWorkingDirectoryBlock, { workingDirectoryAccess: workingDirectoryAccess, workingDirectoryControlPlacement: workingDirectoryControlPlacement, pane: pane, t: t })] }));
239
- }
240
29
  const EMPTY_SUGGESTIONS = [];
241
30
  const CHAT_PANE_DEFAULTS = {
242
31
  agents: EMPTY_AGENTS,
@@ -270,7 +59,7 @@ function resolveAgentControlOptions(agentControl) {
270
59
  webmcp: agentControl?.webmcp,
271
60
  } });
272
61
  }
273
- function useComposerHandlePublisher({ pane }, { composerHandle }) {
62
+ export function useComposerHandlePublisher({ pane }, { composerHandle }) {
274
63
  // Mirrors `Composer.tsx`'s own `draftRef`: `composerHandle.insertText` (below) is called from
275
64
  // OUTSIDE any render, so it cannot close over `pane.composer.draft` directly — that would freeze
276
65
  // it at whatever the draft was on the render that captured it. Reassigned unconditionally every
@@ -295,14 +84,6 @@ function useComposerHandlePublisher({ pane }, { composerHandle }) {
295
84
  // `pane.composer.setDraft` from ever going stale if that reference ever changes.
296
85
  }, [composerHandle, pane.composer]);
297
86
  }
298
- function useChatPaneTranscriptProps({ pane }, { projectFileNames }) {
299
- // `MessageList` is memoized so a composer keystroke does not re-render the transcript; these two
300
- // props would otherwise be fresh objects on every render and defeat it.
301
- const { queuedMessages, cancelQueuedMessage } = pane;
302
- const pendingPrompts = useMemo(() => queuedMessages.map(input => ({ ...input, onCancel: () => cancelQueuedMessage({ id: input.id }) })), [queuedMessages, cancelQueuedMessage]);
303
- const projectFileNameSet = useMemo(() => (projectFileNames === undefined ? undefined : new Set(projectFileNames)), [projectFileNames]);
304
- return { pendingPrompts, projectFileNameSet };
305
- }
306
87
  /** `composerSlots`'s type excludes both `leadingAccessories` and `footerAccessories` (see
307
88
  * `ChatPaneProps.composerSlots`'s doc), so the two explicit keys below are never overwriting a
308
89
  * caller-supplied value — they are the ONLY source for both. */
@@ -313,51 +94,10 @@ function buildChatPaneSlots({ surfaceSlots, embed, renderRuntimePicker }, { lead
313
94
  footerAccessories: embed ? undefined : renderRuntimePicker(),
314
95
  } });
315
96
  }
316
- function ChatPaneTranscript({ pane, sendingLabel, emptyState, embed, suggestions, onSelectSuggestion, pendingPrompts, projectFileNameSet, toolCallDisplay, showUsageLine, showThinking, t, }) {
317
- if (pane.conversation.messages.length === 0 && emptyState) {
318
- return (_jsxs("div", { className: "jini-message-list jini-message-list--empty", children: [emptyState, embed && _jsx(ChatPaneSuggestionsRow, { suggestions: suggestions, onSelect: onSelectSuggestion, t: t })] }));
319
- }
320
- return (_jsx(MessageList, { messages: pane.conversation.messages, ...definedProps({ source: { sendingLabel } }), isStreaming: pane.conversation.isStreaming, scrollIntent: pane.conversation.scrollIntent, onScrolled: pane.conversation.acknowledgeScroll, pendingPrompts: pendingPrompts, toolCallDisplay: toolCallDisplay, showUsageLine: showUsageLine, showThinking: showThinking, ...(projectFileNameSet === undefined ? {} : { projectFileNames: projectFileNameSet }) }));
321
- }
322
- /** The controls-area suggestions row shows on every workspace surface, and on the embed surface
323
- * only when the empty transcript has no `emptyState` to host it instead. */
324
- function showsControlsSuggestions(embed, messageCount, emptyState) {
325
- return !embed || (messageCount === 0 && !emptyState);
326
- }
327
- /**
328
- * Renders the self-contained chat-pane composition, including runtime and
329
- * working-directory orchestration owned by `@jini-ai/chat-react`.
330
- *
331
- * @complexity Time/space: O(n) in rendered messages, agents, and suggestions.
332
- * @overallScore 100/100
333
- */
334
- export function ChatPane(props) {
335
- const p = applyChatPaneDefaults(props);
336
- const base = useAgentHandle({ agentHandle: p.agentHandle });
337
- const t = useT();
338
- const surface = useChatPaneSurface({
339
- variant: p.variant,
340
- composerSlots: p.composerSlots,
341
- workingDirectoryControlPlacement: p.workingDirectoryControlPlacement,
342
- uploadAttachments: p.uploadAttachments,
343
- });
344
- const composerPlaceholder = useChatPaneComposerPlaceholder({ placeholder: p.placeholder, placeholders: p.placeholders });
345
- const inventory = useChatPaneRuntimeInventory(definedProps({ source: {
346
- access: p.runtimeAccess,
347
- initialAgents: p.agents,
348
- pollIntervalMs: p.runtimeStatusPollMs,
349
- } }));
350
- const runtimeView = resolveRuntimeAccessView(p.runtimeAccess, p.agents, p.scanningAgents, p.daemonOnline, p.onRescanAgents, inventory);
351
- // Computed once and threaded into both `useChatPane` (so `sendBlocker` agrees) and this
352
- // component's own `unavailable` below (so the status banner and composer agree) — see
353
- // `isChatPaneApiModeConfigured` for why API mode alone isn't enough.
354
- const apiModeConfigured = isChatPaneApiModeConfigured({
355
- executionMode: p.executionMode,
356
- apiModeAvailable: p.apiModeAvailable,
357
- byokRuntime: p.byokRuntime,
358
- });
359
- const pane = useChatPane(definedProps({ source: {
97
+ function buildChatPaneArguments({ p, runtimeView, apiModeConfigured }, _optional = {}) {
98
+ return definedProps({ source: {
360
99
  transport: p.transport,
100
+ report: p.report,
361
101
  agents: runtimeView.agents,
362
102
  initialMessages: p.initialMessages,
363
103
  refreshSignal: p.refreshSignal,
@@ -384,39 +124,47 @@ export function ChatPane(props) {
384
124
  apiModeConfigured,
385
125
  deliverTypedAnswer: p.deliverTypedAnswer,
386
126
  deliverMidRunMessage: p.deliverMidRunMessage,
387
- } }));
388
- useComposerHandlePublisher({ pane }, definedProps({ source: { composerHandle: p.composerHandle } }));
127
+ } });
128
+ }
129
+ /** Nothing usable is selected and no configured BYOK turn can stand in (split out of `ChatPane` for its complexity budget). */
130
+ function isChatPaneUnavailable({ selectedAgent, apiModeConfigured }, _optional = {}) {
131
+ return selectedAgent === undefined && !apiModeConfigured;
132
+ }
133
+ /**
134
+ * Renders the self-contained chat-pane composition, including runtime and
135
+ * working-directory orchestration owned by `@jini-ai/chat-react`.
136
+ *
137
+ * @complexity Time/space: O(n) in rendered messages, agents, and suggestions.
138
+ * @overallScore 100/100
139
+ */
140
+ export function ChatPane({ useAgentHandleHook = useAgentHandle, useTHook = useT, useChatPaneSurfaceHook = useChatPaneSurface, useChatPaneComposerPlaceholderHook = useChatPaneComposerPlaceholder, useChatPaneRuntimeInventoryHook = useChatPaneRuntimeInventory, useChatPaneHook = useChatPane, useComposerHandlePublisherHook = useComposerHandlePublisher, useChatPaneAgentControlHook = useChatPaneAgentControl, useChatPaneFileDropHook = useChatPaneFileDrop, useChatPaneControlsHeightHook, useChatPaneSuggestionHook, useChatPaneNewTabLinksHook, useChatPaneTranscriptPropsHook, ...props }) {
141
+ const p = applyChatPaneDefaults(props);
142
+ const base = useAgentHandleHook({ agentHandle: p.agentHandle });
143
+ const t = useTHook();
144
+ const surface = useChatPaneSurfaceHook({ variant: p.variant, composerSlots: p.composerSlots,
145
+ workingDirectoryControlPlacement: p.workingDirectoryControlPlacement, uploadAttachments: p.uploadAttachments });
146
+ const composerPlaceholder = useChatPaneComposerPlaceholderHook({ placeholder: p.placeholder, placeholders: p.placeholders });
147
+ const inventory = useChatPaneRuntimeInventoryHook(definedProps({ source: { access: p.runtimeAccess, initialAgents: p.agents, pollIntervalMs: p.runtimeStatusPollMs } }));
148
+ const runtimeView = resolveRuntimeAccessView(p.runtimeAccess, p.agents, p.scanningAgents, p.daemonOnline, p.onRescanAgents, inventory);
149
+ // Computed once and threaded into both `useChatPane` (so `sendBlocker` agrees) and this
150
+ // component's own `unavailable` below (so the status banner and composer agree) — see
151
+ // `isChatPaneApiModeConfigured` for why API mode alone isn't enough.
152
+ const apiModeConfigured = isChatPaneApiModeConfigured({ executionMode: p.executionMode, apiModeAvailable: p.apiModeAvailable, byokRuntime: p.byokRuntime });
153
+ const pane = useChatPaneHook(buildChatPaneArguments({ p, runtimeView, apiModeConfigured }));
154
+ useComposerHandlePublisherHook({ pane }, definedProps({ source: { composerHandle: p.composerHandle } }));
389
155
  // No `runContext` here on purpose: agent-driven sends go through `pane.sendPrompt`, which builds
390
156
  // the context from the SAME `runContext` already handed to `useChatPane` above. A second copy
391
157
  // would be a second source of truth that could silently drift from the composer's.
392
- useChatPaneAgentControl({ pane: pane }, resolveAgentControlOptions(p.agentControl));
158
+ useChatPaneAgentControlHook({ pane: pane }, resolveAgentControlOptions(p.agentControl));
393
159
  // Selection resolution only returns available agents, so absence normally means nothing usable
394
160
  // is selected — except a configured BYOK turn (`apiModeConfigured`, computed above), which calls
395
161
  // the provider directly over HTTP and never touches the CLI inventory.
396
- const unavailable = pane.selectedAgent === undefined && !apiModeConfigured;
397
- const fileDrop = useChatPaneFileDrop({
398
- enabled: isChatPaneFileDropEnabled({
399
- canUpload: surface.uploadAttachments !== undefined,
400
- disabled: p.disabled,
401
- unavailable,
402
- uploading: pane.isUploadingAttachments,
403
- }),
404
- onFiles: pane.addAttachments,
405
- });
406
- const slots = buildChatPaneSlots({
407
- surfaceSlots: surface.composerSlots,
408
- embed: surface.embed,
409
- renderRuntimePicker: () => (_jsx(AgentRuntimePicker, { agentHandle: base ? `${base}-runtime` : false, agents: runtimeView.agents, value: pane.selection, onChange: pane.setSelection, ...definedProps({ source: { onRescan: runtimeView.rescanAgents } }), scanning: runtimeView.scanningAgents, daemonOnline: runtimeView.daemonOnline, placement: p.runtimePickerPlacement, executionMode: p.executionMode, apiModeAvailable: p.apiModeAvailable, ...definedProps({ source: {
410
- onExecutionModeChange: p.onExecutionModeChange,
411
- byokRuntime: p.byokRuntime,
412
- onByokModelChange: p.onByokModelChange,
413
- nativeToolPolicy: p.nativeToolPolicy,
414
- } }) })),
415
- }, { leadingAccessory: p.leadingAccessory });
416
- const { rootRef, controlsRef } = useChatPaneControlsHeight();
417
- const selectSuggestion = useChatPaneSuggestion({ rootRef, setDraft: pane.composer.setDraft });
418
- const openLinkInNewTab = useChatPaneNewTabLinks();
419
- const { pendingPrompts, projectFileNameSet } = useChatPaneTranscriptProps({ pane }, definedProps({ source: { projectFileNames: p.projectFileNames } }));
420
- return (_jsxs("section", { className: chatPaneClassName(p.variant, p.className), style: p.style, "data-activity": pane.activity, ref: rootRef, onClickCapture: openLinkInNewTab, children: [_jsx("style", { "data-jini-chat-pane-styles": "true", children: CHAT_PANE_STYLES }), p.header ?? defaultHeader(p.title, pane.reset, t), p.agentPluginsMode !== 'off' && _jsx(AgentPluginUsage, { conversationId: pane.conversation.conversationId, messages: pane.conversation.messages }), _jsxs("div", { className: "jini-chat-pane__body", children: [_jsx(ChatPaneTranscript, { pane: pane, sendingLabel: p.sendingLabel, emptyState: p.emptyState, embed: surface.embed, suggestions: p.suggestions, onSelectSuggestion: selectSuggestion, pendingPrompts: pendingPrompts, projectFileNameSet: projectFileNameSet, toolCallDisplay: p.toolCallDisplay, showUsageLine: p.showUsageLine, showThinking: p.showThinking, t: t }), _jsxs("div", { className: "jini-chat-pane__controls", ref: controlsRef, children: [showsControlsSuggestions(surface.embed, pane.conversation.messages.length, p.emptyState) && (_jsx(ChatPaneSuggestionsRow, { suggestions: p.suggestions, onSelect: selectSuggestion, t: t })), pane.secretRedacted ? (_jsxs("div", { className: "jini-chat-pane__status jini-chat-pane__status--dismissible", role: "status", children: [_jsx("span", { children: t(SECRET_REDACTED_NOTICE) }), _jsx("button", { type: "button", className: "jini-chat-pane__error-action", onClick: pane.dismissSecretRedacted, children: t('Dismiss') })] })) : null, _jsx(ChatPaneStatusMessages, { unavailable: unavailable, scanningAgents: runtimeView.scanningAgents, connectingAgents: runtimeView.connectingAgents, executionMode: p.executionMode, apiModeAvailable: p.apiModeAvailable, onExecutionModeChange: p.onExecutionModeChange, sendError: pane.conversation.sendError, onRetrySend: () => void pane.retrySend(), attachmentError: pane.attachmentError, dropReadError: fileDrop.dropReadError, workingDirectoryError: pane.workingDirectoryError, workingDirectoryPending: pane.workingDirectoryPending, workingDirectoryInvalid: pane.workingDirectoryInvalid, runtimeInventoryError: inventory.runtimeInventoryError, typedAnswerNotice: pane.typedAnswerNotice, t: t }), _jsx(ChatPaneComposerArea, { agentHandle: base ? `${base}-composer` : false, fileDrop: fileDrop, uploadAttachments: surface.uploadAttachments, pane: pane, disabled: p.disabled, unavailable: unavailable, placeholder: composerPlaceholder, slots: slots, attachmentAccept: p.attachmentAccept, workingDirectoryAccess: p.workingDirectoryAccess, workingDirectoryControlPlacement: surface.workingDirectoryControlPlacement, t: t })] })] }), p.footer] }));
162
+ const unavailable = isChatPaneUnavailable({ selectedAgent: pane.selectedAgent, apiModeConfigured });
163
+ const fileDrop = useChatPaneFileDropHook({ enabled: isChatPaneFileDropEnabled({ canUpload: surface.uploadAttachments !== undefined,
164
+ disabled: p.disabled, unavailable, uploading: pane.isUploadingAttachments }), onFiles: pane.addAttachments, report: p.report });
165
+ const slots = buildChatPaneSlots({ surfaceSlots: surface.composerSlots, embed: surface.embed, renderRuntimePicker: () => (_jsx(AgentRuntimePicker, { agentHandle: base ? `${base}-runtime` : false, agents: runtimeView.agents, value: pane.selection, onChange: pane.setSelection, ...definedProps({ source: { onRescan: runtimeView.rescanAgents } }), scanning: runtimeView.scanningAgents, daemonOnline: runtimeView.daemonOnline, placement: p.runtimePickerPlacement, executionMode: p.executionMode, apiModeAvailable: p.apiModeAvailable, ...definedProps({ source: {
166
+ onExecutionModeChange: p.onExecutionModeChange, byokRuntime: p.byokRuntime, onByokModelChange: p.onByokModelChange, nativeToolPolicy: p.nativeToolPolicy,
167
+ } }) })) }, { leadingAccessory: p.leadingAccessory });
168
+ return _jsx(ChatPaneLayout, { p: p, pane: pane, surface: surface, runtimeView: runtimeView, base: base, unavailable: unavailable, fileDrop: fileDrop, inventory: inventory, t: t, slots: slots, composerPlaceholder: composerPlaceholder, ...definedProps({ source: { useChatPaneControlsHeightHook, useChatPaneSuggestionHook, useChatPaneNewTabLinksHook, useChatPaneTranscriptPropsHook } }) });
421
169
  }
422
170
  //# sourceMappingURL=ChatPane.js.map
@@ -0,0 +1,33 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { ComposerSlots } from '../../../slots.js';
3
+ import type { ChatPaneProps, ChatPaneWorkingDirectoryAccess } from '../types.js';
4
+ import type { UseChatPaneResult } from '../hooks/useChatPane.hooks.js';
5
+ import type { UseChatPaneFileDropResult } from '../hooks/useChatPaneFileDrop.hooks.js';
6
+ type WorkingDirectoryControlPlacement = 'below' | 'composer' | 'none';
7
+ interface ChatPaneComposerAreaProps {
8
+ report?: ChatPaneProps['report'];
9
+ agentHandle: string | false;
10
+ fileDrop: UseChatPaneFileDropResult;
11
+ uploadAttachments: ChatPaneProps['uploadAttachments'];
12
+ pane: UseChatPaneResult;
13
+ disabled: boolean;
14
+ unavailable: boolean;
15
+ placeholder: string | undefined;
16
+ slots: ComposerSlots;
17
+ attachmentAccept: ChatPaneProps['attachmentAccept'];
18
+ workingDirectoryAccess: ChatPaneWorkingDirectoryAccess | undefined;
19
+ workingDirectoryControlPlacement: WorkingDirectoryControlPlacement;
20
+ t: (key: string) => string;
21
+ }
22
+ /** The drop target, composer, and working-directory block — everything below the status banners
23
+ * that reads/writes the live pane. Cancelling an in-flight run is not a separate control here: it
24
+ * lives in the composer's own trailing button, which swaps from send to stop while streaming (see
25
+ * `Composer`'s `running`/`onCancel` props) — the same control an operator's attention is already
26
+ * on, rather than a second affordance elsewhere in the pane they'd have to go find.
27
+ *
28
+ * The pending-turn strip previously lived here (a banner bolted above the composer). It now
29
+ * renders inside `<MessageList>` itself, as the newest transcript entry — see that component's
30
+ * `pendingPrompts` prop and this component's own call site below. */
31
+ export declare function ChatPaneComposerArea({ agentHandle, fileDrop, uploadAttachments, pane, disabled, unavailable, placeholder, slots, attachmentAccept, workingDirectoryAccess, workingDirectoryControlPlacement, t, report, }: ChatPaneComposerAreaProps): ReactNode;
32
+ export {};
33
+ //# sourceMappingURL=ChatPaneComposerArea.d.ts.map
@@ -0,0 +1,119 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from 'react';
3
+ import { WorkingDirPicker } from '@jini-ai/ui';
4
+ import { Composer } from '../../../components/Composer.js';
5
+ import { Icon } from '../../../components/Icon.js';
6
+ import { definedProps } from '../../../util/defined-props.js';
7
+ import { chatPaneSendBlockerNeedsNotice, describeChatPaneSendBlocker } from '../rules.js';
8
+ function ChatPaneWorkingDirectoryBlock({ workingDirectoryAccess, workingDirectoryControlPlacement, pane, t, }) {
9
+ if (workingDirectoryAccess && workingDirectoryControlPlacement === 'below') {
10
+ return (_jsx("div", { className: "jini-chat-pane__workdir", children: _jsx(WorkingDirPicker, { workingDir: pane.workingDirectory, recentDirs: [...pane.recentDirectories], onPickDirectory: () => void pane.pickWorkingDirectory(), onSelectRecent: (directory) => void pane.selectRecentDirectory(directory), placement: "up", onClear: pane.clearWorkingDirectory, invalid: pane.workingDirectoryInvalid, onOpen: () => void pane.openWorkingDirectoryPicker(), labels: { trigger: t('Select working directory') } }) }));
11
+ }
12
+ // Three cases render nothing here, for different reasons:
13
+ // - No native `workingDirectoryAccess`: the static text line this replaced is gone entirely —
14
+ // see `ChatPaneComposerArea` below, which threads `pane.workingDirectory` and
15
+ // `pane.selectRecentDirectory` into `Composer`'s own folder-icon (popover) trigger instead.
16
+ // - `workingDirectoryAccess` present but `workingDirectoryControlPlacement === 'composer'`: the
17
+ // host asked for the control next to "+" instead — `resolveComposerWorkingDirectory` wires
18
+ // `Composer`'s trigger straight to `pane.pickWorkingDirectory` in that case, so rendering this
19
+ // block too would put up a second, competing control below the composer.
20
+ // - `workingDirectoryControlPlacement === 'none'`: the host asked for no working-directory
21
+ // control anywhere — `resolveComposerWorkingDirectory` supplies neither composer handler in
22
+ // this case either, so `Composer`'s own folder-icon gate (`onChangeWorkingDirectory ||
23
+ // onPickWorkingDirectory`) renders nothing too. Nothing here has a trigger to defer to.
24
+ // In every case but `'none'`, the trigger this defers to already covers both "nothing set yet"
25
+ // and "a value is set", so this block has nothing left to render.
26
+ return null;
27
+ }
28
+ /** `uploadAttachments === undefined` gates BOTH of these — a temporarily-disabled composer still
29
+ * consumes a file drop so the browser cannot navigate away to the local file (see
30
+ * `useChatPaneFileDrop`'s module doc), so the drop handlers stay attached even when the picker
31
+ * itself is hidden. Shared here so `ChatPaneComposerArea` pays for the branch once, at module
32
+ * scope, instead of per call site. */
33
+ function resolveDropTargetProps(uploadAttachments, fileDrop) {
34
+ return uploadAttachments === undefined ? {} : fileDrop.targetProps;
35
+ }
36
+ function resolveComposerAttachmentPicker(uploadAttachments, pane, attachmentAccept) {
37
+ if (uploadAttachments === undefined)
38
+ return {};
39
+ return {
40
+ attachmentPicker: definedProps({ source: {
41
+ onFiles: pane.addAttachments,
42
+ uploading: pane.isUploadingAttachments,
43
+ accept: attachmentAccept,
44
+ } }),
45
+ };
46
+ }
47
+ /**
48
+ * Resolves which of `Composer`'s two mutually-exclusive working-directory props (if either) this
49
+ * render should supply, mirroring `ChatPaneWorkingDirectoryBlock`'s own four-way branch above so
50
+ * the two never disagree about which control owns the composer's folder-icon slot:
51
+ *
52
+ * - `workingDirectoryControlPlacement === 'none'`: neither prop, regardless of whether
53
+ * `workingDirectoryAccess` is present — the host asked for no working-directory control
54
+ * anywhere, so `Composer`'s own gate (`onChangeWorkingDirectory || onPickWorkingDirectory`)
55
+ * renders nothing. Checked first because it overrides both cases below.
56
+ * - No `workingDirectoryAccess`: the composer's lightweight text-input popover, via
57
+ * `onChangeWorkingDirectory`. `pane.selectRecentDirectory` is reused as the plain setter here
58
+ * rather than inventing one — `useChatPaneWorkingDirectory`'s own doc confirms it already writes
59
+ * the value directly (no native validation) whenever `access` is absent, which is exactly this
60
+ * case.
61
+ * - `workingDirectoryAccess` present and `workingDirectoryControlPlacement === 'composer'`: the
62
+ * SAME folder-icon trigger, but wired to `onPickWorkingDirectory` instead — clicking it invokes
63
+ * the native OS dialog (`pane.pickWorkingDirectory`) directly, with no popover in between.
64
+ * - `workingDirectoryAccess` present and placement is (default) `'below'`: neither prop — the
65
+ * composer renders no folder icon at all, and `ChatPaneWorkingDirectoryBlock` renders the richer
66
+ * `WorkingDirPicker` below instead, unchanged from every host's prior behavior.
67
+ */
68
+ function resolveComposerWorkingDirectory(workingDirectoryAccess, workingDirectoryControlPlacement, pane) {
69
+ if (workingDirectoryControlPlacement === 'none') {
70
+ return {};
71
+ }
72
+ if (!workingDirectoryAccess) {
73
+ return {
74
+ workingDirectory: pane.workingDirectory,
75
+ onChangeWorkingDirectory: (directory) => void pane.selectRecentDirectory(directory),
76
+ };
77
+ }
78
+ if (workingDirectoryControlPlacement === 'composer') {
79
+ return {
80
+ workingDirectory: pane.workingDirectory,
81
+ onPickWorkingDirectory: () => void pane.pickWorkingDirectory(),
82
+ };
83
+ }
84
+ return {};
85
+ }
86
+ /** Why Send is blocked (streaming is not a block), and whether that reason also shows as a notice. */
87
+ function resolveSendBlockerNotice({ pane, unavailable, t }, _optional = {}) {
88
+ const sendDisabledReason = pane.sendBlocker && pane.sendBlocker !== 'streaming'
89
+ ? t(describeChatPaneSendBlocker(pane.sendBlocker))
90
+ : undefined;
91
+ // MOVE: the reason used to sit in the composer's footer row beside the folder and model buttons.
92
+ // It is now a notice above the composer, with the other pane notices; Send's tooltip keeps it.
93
+ // While the pane is unavailable its own banner (loading, no usable CLI) already says it.
94
+ const showsNotice = sendDisabledReason !== undefined && !unavailable && chatPaneSendBlockerNeedsNotice({ blocker: pane.sendBlocker });
95
+ return { sendDisabledReason, showsNotice };
96
+ }
97
+ /** The drop target, composer, and working-directory block — everything below the status banners
98
+ * that reads/writes the live pane. Cancelling an in-flight run is not a separate control here: it
99
+ * lives in the composer's own trailing button, which swaps from send to stop while streaming (see
100
+ * `Composer`'s `running`/`onCancel` props) — the same control an operator's attention is already
101
+ * on, rather than a second affordance elsewhere in the pane they'd have to go find.
102
+ *
103
+ * The pending-turn strip previously lived here (a banner bolted above the composer). It now
104
+ * renders inside `<MessageList>` itself, as the newest transcript entry — see that component's
105
+ * `pendingPrompts` prop and this component's own call site below. */
106
+ export function ChatPaneComposerArea({ agentHandle, fileDrop, uploadAttachments, pane, disabled, unavailable, placeholder, slots, attachmentAccept, workingDirectoryAccess, workingDirectoryControlPlacement, t, report, }) {
107
+ const sendDisabledReasonId = useId();
108
+ const { sendDisabledReason, showsNotice } = resolveSendBlockerNotice({ pane, unavailable, t });
109
+ return (_jsxs("div", { className: `jini-chat-pane__drop-target${fileDrop.draggingFiles ? ' is-dragging-files' : ''}`, "data-testid": "chat-pane-file-drop-target", "data-dragging-files": fileDrop.draggingFiles ? 'true' : 'false', ...resolveDropTargetProps(uploadAttachments, fileDrop), children: [fileDrop.draggingFiles ? (_jsx("span", { className: "jini-chat-pane__drop-announcement", role: "status", children: t('Drop files to attach') })) : null, _jsx(ChatPaneComposerBlocker, { pane: pane, t: t, sendDisabledReasonId: sendDisabledReasonId, sendDisabledReason: sendDisabledReason, showsNotice: showsNotice }), _jsx(Composer, { report: report, agentHandle: agentHandle, composer: pane.composer, onSend: () => void pane.send(),
110
+ // Streaming no longer locks the textarea: `pane.send()` queues a turn typed during a run
111
+ // rather than refusing it, so the operator can keep writing while the agent thinks.
112
+ disabled: disabled || unavailable,
113
+ // The one blocker `send()` handles itself. Every other refusal still greys out the button.
114
+ sendDisabled: !pane.canSend && pane.sendBlocker !== 'streaming', ...definedProps({ source: { sendDisabledReason, sendDisabledReasonId: showsNotice ? sendDisabledReasonId : undefined } }), running: pane.conversation.isStreaming, onCancel: pane.conversation.cancel, ...definedProps({ source: { placeholder } }), slots: slots, ...resolveComposerAttachmentPicker(uploadAttachments, pane, attachmentAccept), ...resolveComposerWorkingDirectory(workingDirectoryAccess, workingDirectoryControlPlacement, pane) }), _jsx(ChatPaneWorkingDirectoryBlock, { workingDirectoryAccess: workingDirectoryAccess, workingDirectoryControlPlacement: workingDirectoryControlPlacement, pane: pane, t: t })] }));
115
+ }
116
+ function ChatPaneComposerBlocker({ pane, t, sendDisabledReasonId, sendDisabledReason, showsNotice }) {
117
+ return showsNotice ? (_jsxs("div", { id: sendDisabledReasonId, className: "jini-chat-pane__status jini-chat-pane__blocker", role: "status", children: [pane.sendBlocker === 'uploads-pending' ? _jsx(Icon, { name: "spinner", size: 13 }) : null, _jsx("span", { children: sendDisabledReason })] })) : null;
118
+ }
119
+ //# sourceMappingURL=ChatPaneComposerArea.js.map
@@ -0,0 +1,42 @@
1
+ import type { ComposerSlots } from '../../../slots.js';
2
+ import type { ChatPaneProps } from '../types.js';
3
+ import type { ResolvedChatPaneProps, ChatPaneRuntimeView } from './ChatPane.js';
4
+ import type { UseChatPaneResult } from '../hooks/useChatPane.hooks.js';
5
+ import type { UseChatPaneFileDropResult } from '../hooks/useChatPaneFileDrop.hooks.js';
6
+ import type { UseChatPaneRuntimeInventoryResult } from '../hooks/useChatPaneRuntimeInventory.hooks.js';
7
+ import type { useChatPaneSurface } from '../hooks/useChatPaneSurface.hooks.js';
8
+ interface ChatPaneLayoutProps {
9
+ p: ResolvedChatPaneProps;
10
+ pane: UseChatPaneResult;
11
+ surface: ReturnType<typeof useChatPaneSurface>;
12
+ runtimeView: ChatPaneRuntimeView;
13
+ base: string | undefined;
14
+ unavailable: boolean;
15
+ fileDrop: UseChatPaneFileDropResult;
16
+ inventory: UseChatPaneRuntimeInventoryResult;
17
+ t: (key: string) => string;
18
+ slots: ComposerSlots;
19
+ composerPlaceholder: string | undefined;
20
+ }
21
+ export declare function useChatPaneTranscriptProps({ pane }: {
22
+ pane: UseChatPaneResult;
23
+ }, { projectFileNames }: {
24
+ projectFileNames?: ChatPaneProps['projectFileNames'];
25
+ }): {
26
+ pendingPrompts: {
27
+ onCancel: () => void;
28
+ id: string;
29
+ text: string;
30
+ surfaceUri?: string;
31
+ answerText?: string;
32
+ deliveryState?: "queued" | "consumed";
33
+ folders?: string[];
34
+ attachments?: import("../../../../core/messages.js").ChatAttachment[];
35
+ secretRedaction?: import("../../../index.js").ChatMessage["secretRedaction"];
36
+ aliases?: readonly string[];
37
+ }[];
38
+ projectFileNameSet: Set<string> | undefined;
39
+ };
40
+ export declare function ChatPaneLayout({ p, pane, surface, runtimeView, base, unavailable, fileDrop, inventory, t, slots, composerPlaceholder, useChatPaneControlsHeightHook, useChatPaneSuggestionHook, useChatPaneNewTabLinksHook, useChatPaneTranscriptPropsHook, }: ChatPaneLayoutProps & Pick<ChatPaneProps, 'useChatPaneControlsHeightHook' | 'useChatPaneSuggestionHook' | 'useChatPaneNewTabLinksHook' | 'useChatPaneTranscriptPropsHook'>): import("react").JSX.Element;
41
+ export {};
42
+ //# sourceMappingURL=ChatPaneLayout.d.ts.map