@jini-ai/chat 0.3.7 → 0.3.9

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 (266) hide show
  1. package/dist/react/features/chat-pane/agent-tools.d.ts +1 -1
  2. package/dist/react/features/chat-pane/agent-tools.js +3 -3
  3. package/dist/react/features/chat-pane/components/AgentRuntimePicker.js +1 -1
  4. package/dist/react/features/chat-pane/components/ChatPane.d.ts +1 -1
  5. package/dist/react/features/chat-pane/components/ChatPane.js +3 -1
  6. package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.js +15 -1
  7. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.d.ts +4 -2
  8. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js +1 -0
  9. package/dist/react/features/chat-pane/types.d.ts +21 -2
  10. package/dist/react/hooks/composer-draft-cache.d.ts +104 -41
  11. package/dist/react/hooks/composer-draft-cache.js +369 -51
  12. package/dist/react/hooks/useComposer.d.ts +17 -0
  13. package/dist/react/hooks/useComposer.js +93 -12
  14. package/package.json +5 -4
  15. package/dist/core/agentic/chat-capabilities.d.ts.map +0 -1
  16. package/dist/core/agentic/chat-capabilities.js.map +0 -1
  17. package/dist/core/agentic/index.d.ts.map +0 -1
  18. package/dist/core/agentic/index.js.map +0 -1
  19. package/dist/core/events.d.ts.map +0 -1
  20. package/dist/core/events.js.map +0 -1
  21. package/dist/core/index.d.ts.map +0 -1
  22. package/dist/core/index.js.map +0 -1
  23. package/dist/core/messages.d.ts.map +0 -1
  24. package/dist/core/messages.js.map +0 -1
  25. package/dist/core/partial-json.d.ts.map +0 -1
  26. package/dist/core/partial-json.js.map +0 -1
  27. package/dist/core/persistence/index.d.ts.map +0 -1
  28. package/dist/core/persistence/index.js.map +0 -1
  29. package/dist/core/persistence/ports.d.ts.map +0 -1
  30. package/dist/core/persistence/ports.js.map +0 -1
  31. package/dist/core/persistence/title.d.ts.map +0 -1
  32. package/dist/core/persistence/title.js.map +0 -1
  33. package/dist/core/question-form/format.d.ts.map +0 -1
  34. package/dist/core/question-form/format.js.map +0 -1
  35. package/dist/core/question-form/normalize.d.ts.map +0 -1
  36. package/dist/core/question-form/normalize.js.map +0 -1
  37. package/dist/core/question-form/scan.d.ts.map +0 -1
  38. package/dist/core/question-form/scan.js.map +0 -1
  39. package/dist/core/question-form/types.d.ts.map +0 -1
  40. package/dist/core/question-form/types.js.map +0 -1
  41. package/dist/core/question-form.d.ts.map +0 -1
  42. package/dist/core/question-form.js.map +0 -1
  43. package/dist/core/todos.d.ts.map +0 -1
  44. package/dist/core/todos.js.map +0 -1
  45. package/dist/core/tool-events.d.ts.map +0 -1
  46. package/dist/core/tool-events.js.map +0 -1
  47. package/dist/core/tools.d.ts.map +0 -1
  48. package/dist/core/tools.js.map +0 -1
  49. package/dist/core/transcript.d.ts.map +0 -1
  50. package/dist/core/transcript.js.map +0 -1
  51. package/dist/core/transport.d.ts.map +0 -1
  52. package/dist/core/transport.js.map +0 -1
  53. package/dist/core/util/index.d.ts.map +0 -1
  54. package/dist/core/util/index.js.map +0 -1
  55. package/dist/core/util/manifest.d.ts.map +0 -1
  56. package/dist/core/util/manifest.js.map +0 -1
  57. package/dist/core/util/markdown-context.d.ts.map +0 -1
  58. package/dist/core/util/markdown-context.js.map +0 -1
  59. package/dist/core/util/markup-attributes.d.ts.map +0 -1
  60. package/dist/core/util/markup-attributes.js.map +0 -1
  61. package/dist/core/util/parser.d.ts.map +0 -1
  62. package/dist/core/util/parser.js.map +0 -1
  63. package/dist/core/util/pointer.d.ts.map +0 -1
  64. package/dist/core/util/pointer.js.map +0 -1
  65. package/dist/core/util/recover.d.ts.map +0 -1
  66. package/dist/core/util/recover.js.map +0 -1
  67. package/dist/core/util/strip.d.ts.map +0 -1
  68. package/dist/core/util/strip.js.map +0 -1
  69. package/dist/core/util/types.d.ts.map +0 -1
  70. package/dist/core/util/types.js.map +0 -1
  71. package/dist/core/util/validate.d.ts.map +0 -1
  72. package/dist/core/util/validate.js.map +0 -1
  73. package/dist/react/agent-bridge/frontend-session-bridge.d.ts.map +0 -1
  74. package/dist/react/agent-bridge/frontend-session-bridge.js.map +0 -1
  75. package/dist/react/artifact-types.d.ts.map +0 -1
  76. package/dist/react/artifact-types.js.map +0 -1
  77. package/dist/react/chat-pane.d.ts.map +0 -1
  78. package/dist/react/chat-pane.js.map +0 -1
  79. package/dist/react/components/A2uiSurfaceCard.d.ts.map +0 -1
  80. package/dist/react/components/A2uiSurfaceCard.js.map +0 -1
  81. package/dist/react/components/AttachmentPreviewModal.d.ts.map +0 -1
  82. package/dist/react/components/AttachmentPreviewModal.hooks.d.ts.map +0 -1
  83. package/dist/react/components/AttachmentPreviewModal.hooks.js.map +0 -1
  84. package/dist/react/components/AttachmentPreviewModal.js.map +0 -1
  85. package/dist/react/components/AttachmentTray.d.ts.map +0 -1
  86. package/dist/react/components/AttachmentTray.js.map +0 -1
  87. package/dist/react/components/ChatFab.d.ts.map +0 -1
  88. package/dist/react/components/ChatFab.js.map +0 -1
  89. package/dist/react/components/Composer.d.ts.map +0 -1
  90. package/dist/react/components/Composer.js.map +0 -1
  91. package/dist/react/components/ComposerDiscovery.d.ts.map +0 -1
  92. package/dist/react/components/ComposerDiscovery.js.map +0 -1
  93. package/dist/react/components/ConversationList.d.ts.map +0 -1
  94. package/dist/react/components/ConversationList.js.map +0 -1
  95. package/dist/react/components/ExtEventErrorBoundary.d.ts.map +0 -1
  96. package/dist/react/components/ExtEventErrorBoundary.js.map +0 -1
  97. package/dist/react/components/Icon.d.ts.map +0 -1
  98. package/dist/react/components/Icon.js.map +0 -1
  99. package/dist/react/components/JiniChatProvider.d.ts.map +0 -1
  100. package/dist/react/components/JiniChatProvider.js.map +0 -1
  101. package/dist/react/components/Markdown.d.ts.map +0 -1
  102. package/dist/react/components/Markdown.js.map +0 -1
  103. package/dist/react/components/McpUiSurfaceCard.d.ts.map +0 -1
  104. package/dist/react/components/McpUiSurfaceCard.js.map +0 -1
  105. package/dist/react/components/MessageList.d.ts.map +0 -1
  106. package/dist/react/components/MessageList.js.map +0 -1
  107. package/dist/react/components/MessageRow.d.ts.map +0 -1
  108. package/dist/react/components/MessageRow.js.map +0 -1
  109. package/dist/react/components/NextStepActions.d.ts.map +0 -1
  110. package/dist/react/components/NextStepActions.js.map +0 -1
  111. package/dist/react/components/QuestionForm.d.ts.map +0 -1
  112. package/dist/react/components/QuestionForm.js.map +0 -1
  113. package/dist/react/components/QuestionsPanel.d.ts.map +0 -1
  114. package/dist/react/components/QuestionsPanel.js.map +0 -1
  115. package/dist/react/components/TodoCard.d.ts.map +0 -1
  116. package/dist/react/components/TodoCard.js.map +0 -1
  117. package/dist/react/components/ToolCard.d.ts.map +0 -1
  118. package/dist/react/components/ToolCard.js.map +0 -1
  119. package/dist/react/components/composer-discovery.d.ts.map +0 -1
  120. package/dist/react/components/composer-discovery.js.map +0 -1
  121. package/dist/react/ext-event-renderer-registry.d.ts.map +0 -1
  122. package/dist/react/ext-event-renderer-registry.js.map +0 -1
  123. package/dist/react/features/chat-pane/agent-tools.d.ts.map +0 -1
  124. package/dist/react/features/chat-pane/agent-tools.js.map +0 -1
  125. package/dist/react/features/chat-pane/components/AgentRuntimePicker.d.ts.map +0 -1
  126. package/dist/react/features/chat-pane/components/AgentRuntimePicker.js.map +0 -1
  127. package/dist/react/features/chat-pane/components/ChatPane.d.ts.map +0 -1
  128. package/dist/react/features/chat-pane/components/ChatPane.js.map +0 -1
  129. package/dist/react/features/chat-pane/create-daemon-attachment-uploader.d.ts.map +0 -1
  130. package/dist/react/features/chat-pane/create-daemon-attachment-uploader.js.map +0 -1
  131. package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.d.ts.map +0 -1
  132. package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.js.map +0 -1
  133. package/dist/react/features/chat-pane/hooks/useAgentRuntimePicker.hooks.d.ts.map +0 -1
  134. package/dist/react/features/chat-pane/hooks/useAgentRuntimePicker.hooks.js.map +0 -1
  135. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.d.ts.map +0 -1
  136. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js.map +0 -1
  137. package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.d.ts.map +0 -1
  138. package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.js.map +0 -1
  139. package/dist/react/features/chat-pane/hooks/useChatPaneComposerPlaceholder.hooks.d.ts.map +0 -1
  140. package/dist/react/features/chat-pane/hooks/useChatPaneComposerPlaceholder.hooks.js.map +0 -1
  141. package/dist/react/features/chat-pane/hooks/useChatPaneControlsHeight.hooks.d.ts.map +0 -1
  142. package/dist/react/features/chat-pane/hooks/useChatPaneControlsHeight.hooks.js.map +0 -1
  143. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.d.ts.map +0 -1
  144. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.js.map +0 -1
  145. package/dist/react/features/chat-pane/hooks/useChatPaneRuntimeInventory.hooks.d.ts.map +0 -1
  146. package/dist/react/features/chat-pane/hooks/useChatPaneRuntimeInventory.hooks.js.map +0 -1
  147. package/dist/react/features/chat-pane/hooks/useChatPaneWorkingDirectory.hooks.d.ts.map +0 -1
  148. package/dist/react/features/chat-pane/hooks/useChatPaneWorkingDirectory.hooks.js.map +0 -1
  149. package/dist/react/features/chat-pane/index.d.ts.map +0 -1
  150. package/dist/react/features/chat-pane/index.js.map +0 -1
  151. package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.d.ts +0 -12
  152. package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.d.ts.map +0 -1
  153. package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.js +0 -102
  154. package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.js.map +0 -1
  155. package/dist/react/features/chat-pane/react/components/ChatPane.d.ts +0 -10
  156. package/dist/react/features/chat-pane/react/components/ChatPane.d.ts.map +0 -1
  157. package/dist/react/features/chat-pane/react/components/ChatPane.js +0 -137
  158. package/dist/react/features/chat-pane/react/components/ChatPane.js.map +0 -1
  159. package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.d.ts +0 -133
  160. package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.d.ts.map +0 -1
  161. package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.js +0 -258
  162. package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.js.map +0 -1
  163. package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.d.ts +0 -66
  164. package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.d.ts.map +0 -1
  165. package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.js +0 -223
  166. package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.js.map +0 -1
  167. package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.d.ts +0 -38
  168. package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.d.ts.map +0 -1
  169. package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.js +0 -252
  170. package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.js.map +0 -1
  171. package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.d.ts +0 -26
  172. package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.d.ts.map +0 -1
  173. package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.js +0 -60
  174. package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.js.map +0 -1
  175. package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.d.ts +0 -25
  176. package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.d.ts.map +0 -1
  177. package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.js +0 -83
  178. package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.js.map +0 -1
  179. package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.d.ts +0 -38
  180. package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.d.ts.map +0 -1
  181. package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.js +0 -184
  182. package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.js.map +0 -1
  183. package/dist/react/features/chat-pane/react/styles.d.ts +0 -2
  184. package/dist/react/features/chat-pane/react/styles.d.ts.map +0 -1
  185. package/dist/react/features/chat-pane/react/styles.js +0 -863
  186. package/dist/react/features/chat-pane/react/styles.js.map +0 -1
  187. package/dist/react/features/chat-pane/rules.d.ts.map +0 -1
  188. package/dist/react/features/chat-pane/rules.js.map +0 -1
  189. package/dist/react/features/chat-pane/styles.d.ts.map +0 -1
  190. package/dist/react/features/chat-pane/styles.js.map +0 -1
  191. package/dist/react/features/chat-pane/types.d.ts.map +0 -1
  192. package/dist/react/features/chat-pane/types.js.map +0 -1
  193. package/dist/react/features/model-picker/components/CredentialStatusBadge.d.ts.map +0 -1
  194. package/dist/react/features/model-picker/components/CredentialStatusBadge.js.map +0 -1
  195. package/dist/react/features/model-picker/components/ModelPicker.d.ts.map +0 -1
  196. package/dist/react/features/model-picker/components/ModelPicker.js.map +0 -1
  197. package/dist/react/features/model-picker/constants.d.ts.map +0 -1
  198. package/dist/react/features/model-picker/constants.js.map +0 -1
  199. package/dist/react/features/model-picker/dependencies.d.ts.map +0 -1
  200. package/dist/react/features/model-picker/dependencies.js.map +0 -1
  201. package/dist/react/features/model-picker/hooks/useModelPicker.hooks.d.ts.map +0 -1
  202. package/dist/react/features/model-picker/hooks/useModelPicker.hooks.js.map +0 -1
  203. package/dist/react/features/model-picker/index.d.ts.map +0 -1
  204. package/dist/react/features/model-picker/index.js.map +0 -1
  205. package/dist/react/features/model-picker/ports.d.ts.map +0 -1
  206. package/dist/react/features/model-picker/ports.js.map +0 -1
  207. package/dist/react/features/model-picker/react/components/CredentialStatusBadge.d.ts +0 -7
  208. package/dist/react/features/model-picker/react/components/CredentialStatusBadge.d.ts.map +0 -1
  209. package/dist/react/features/model-picker/react/components/CredentialStatusBadge.js +0 -20
  210. package/dist/react/features/model-picker/react/components/CredentialStatusBadge.js.map +0 -1
  211. package/dist/react/features/model-picker/react/components/ModelPicker.d.ts +0 -9
  212. package/dist/react/features/model-picker/react/components/ModelPicker.d.ts.map +0 -1
  213. package/dist/react/features/model-picker/react/components/ModelPicker.js +0 -34
  214. package/dist/react/features/model-picker/react/components/ModelPicker.js.map +0 -1
  215. package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.d.ts +0 -27
  216. package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.d.ts.map +0 -1
  217. package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.js +0 -62
  218. package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.js.map +0 -1
  219. package/dist/react/features/model-picker/rules.d.ts.map +0 -1
  220. package/dist/react/features/model-picker/rules.js.map +0 -1
  221. package/dist/react/features/model-picker/types.d.ts.map +0 -1
  222. package/dist/react/features/model-picker/types.js.map +0 -1
  223. package/dist/react/hooks/attachment-preview-cache.d.ts.map +0 -1
  224. package/dist/react/hooks/attachment-preview-cache.js.map +0 -1
  225. package/dist/react/hooks/composer-draft-cache.d.ts.map +0 -1
  226. package/dist/react/hooks/composer-draft-cache.js.map +0 -1
  227. package/dist/react/hooks/context.d.ts.map +0 -1
  228. package/dist/react/hooks/context.js.map +0 -1
  229. package/dist/react/hooks/testing/fake-transport.d.ts.map +0 -1
  230. package/dist/react/hooks/testing/fake-transport.js.map +0 -1
  231. package/dist/react/hooks/useArtifactStream.d.ts.map +0 -1
  232. package/dist/react/hooks/useArtifactStream.js.map +0 -1
  233. package/dist/react/hooks/useChatFabDrag.d.ts.map +0 -1
  234. package/dist/react/hooks/useChatFabDrag.js.map +0 -1
  235. package/dist/react/hooks/useComposer.d.ts.map +0 -1
  236. package/dist/react/hooks/useComposer.js.map +0 -1
  237. package/dist/react/hooks/useConversation.d.ts.map +0 -1
  238. package/dist/react/hooks/useConversation.js.map +0 -1
  239. package/dist/react/hooks/useCopyToClipboard.d.ts.map +0 -1
  240. package/dist/react/hooks/useCopyToClipboard.js.map +0 -1
  241. package/dist/react/hooks/useExtEventGroups.d.ts.map +0 -1
  242. package/dist/react/hooks/useExtEventGroups.js.map +0 -1
  243. package/dist/react/hooks/useLatestOperation.d.ts.map +0 -1
  244. package/dist/react/hooks/useLatestOperation.js.map +0 -1
  245. package/dist/react/hooks/usePinnedTodos.d.ts.map +0 -1
  246. package/dist/react/hooks/usePinnedTodos.js.map +0 -1
  247. package/dist/react/hooks/useQuestionForms.d.ts.map +0 -1
  248. package/dist/react/hooks/useQuestionForms.js.map +0 -1
  249. package/dist/react/hooks/useRunStream.d.ts.map +0 -1
  250. package/dist/react/hooks/useRunStream.js.map +0 -1
  251. package/dist/react/hooks/useToolTimeline.d.ts.map +0 -1
  252. package/dist/react/hooks/useToolTimeline.js.map +0 -1
  253. package/dist/react/index.d.ts.map +0 -1
  254. package/dist/react/index.js.map +0 -1
  255. package/dist/react/message-blocks.d.ts.map +0 -1
  256. package/dist/react/message-blocks.js.map +0 -1
  257. package/dist/react/poc-mcp-ui-official/PocMcpUiCard.d.ts.map +0 -1
  258. package/dist/react/poc-mcp-ui-official/PocMcpUiCard.js.map +0 -1
  259. package/dist/react/poc-mcp-ui-official/create-poc-resource.d.ts.map +0 -1
  260. package/dist/react/poc-mcp-ui-official/create-poc-resource.js.map +0 -1
  261. package/dist/react/slots.d.ts.map +0 -1
  262. package/dist/react/slots.js.map +0 -1
  263. package/dist/react/tool-renderer-registry.d.ts.map +0 -1
  264. package/dist/react/tool-renderer-registry.js.map +0 -1
  265. package/dist/react/util/defined-props.d.ts.map +0 -1
  266. package/dist/react/util/defined-props.js.map +0 -1
@@ -1,252 +0,0 @@
1
- import { useEffect, useRef } from 'react';
2
- import { CHAT_PANE_AGENT_TOOLS } from '../../agent-tools.js';
3
- import { definedProps } from '../../../../util/defined-props.js';
4
- function getModelContext() {
5
- const doc = globalThis.document;
6
- if (isModelContext(doc?.modelContext))
7
- return doc.modelContext;
8
- const nav = globalThis.navigator;
9
- if (isModelContext(nav?.modelContext))
10
- return nav.modelContext;
11
- return undefined;
12
- }
13
- function isModelContext(value) {
14
- return typeof value === 'object' && value !== null && typeof value.registerTool === 'function';
15
- }
16
- function requireStringField(input, key) {
17
- const value = input[key];
18
- if (typeof value !== 'string' || value.length === 0)
19
- throw new Error(`"${key}" is required`);
20
- return value;
21
- }
22
- function optionalStringField(input, key) {
23
- const value = input[key];
24
- return typeof value === 'string' && value.length > 0 ? value : undefined;
25
- }
26
- /** Gate for capabilities whose manifest entry sets `requiresConfirmation`. */
27
- function requireConfirmation(input, what) {
28
- if (input['confirm'] !== true) {
29
- throw new Error(`"confirm" must be true — ${what} is destructive and needs explicit acknowledgement`);
30
- }
31
- }
32
- function errorMessage(error) {
33
- return error instanceof Error ? error.message : String(error);
34
- }
35
- /** Content read off the page/transcript is untrusted input to whatever model reads it back. */
36
- const MAX_RETURNED_CONTENT = 2000;
37
- function summarizeContent(content) {
38
- return {
39
- content: content.slice(0, MAX_RETURNED_CONTENT),
40
- truncated: content.length > MAX_RETURNED_CONTENT,
41
- originalLength: content.length,
42
- };
43
- }
44
- /**
45
- * Routes through the pane's own guarded send (`rules.ts`'s blocker set + staged attachments +
46
- * composer reset + batch rotation + activity notification) rather than calling
47
- * `conversation.sendMessage` directly, so an agent-driven send cannot bypass what the composer
48
- * enforces. Throws a describable refusal when blocked.
49
- *
50
- * It also does not go the other obvious route — `composer.setDraft(prompt)` followed by `send()`.
51
- * `setDraft` is a React state update and is therefore asynchronous, so the `send()` immediately
52
- * after it would race the re-render and read a stale draft. Passing the prompt straight to
53
- * `sendPrompt` is what makes the agent-driven path deterministic.
54
- */
55
- async function sendMessageAction(pane, input) {
56
- await pane.sendPrompt(requireStringField(input, 'prompt'));
57
- return { sent: true };
58
- }
59
- async function setDraftAction(pane, input) {
60
- pane.composer.setDraft(requireStringField(input, 'text'));
61
- return { ok: true };
62
- }
63
- /**
64
- * Only a runtime this machine actually offers.
65
- *
66
- * `setSelection` normalizes an unknown or unavailable agent to the first available one — correct
67
- * for the picker, which must not break when a runtime disappears mid-session. For a caller that is
68
- * told `{ok:true}`, that same behavior is a lie with a safety edge: asking for a constrained
69
- * runtime and silently getting a more capable one is how a prompt intended for a sandboxed agent
70
- * reaches a full coding agent instead. So this refuses by name rather than substituting.
71
- */
72
- async function selectAgentAction(pane, input) {
73
- const agentId = requireStringField(input, 'agentId');
74
- const agent = pane.agents.find((candidate) => candidate.id === agentId);
75
- if (agent === undefined) {
76
- const known = pane.agents.map((candidate) => candidate.id).join(', ');
77
- throw new Error(`unknown agent "${agentId}" — this pane offers: ${known || 'none'}`);
78
- }
79
- if (agent.available === false) {
80
- throw new Error(`agent "${agentId}" is not available on this machine`
81
- + `${agent.diagnostic === undefined ? '' : ` (${agent.diagnostic})`}`);
82
- }
83
- const model = optionalStringField(input, 'model');
84
- const reasoning = optionalStringField(input, 'reasoning');
85
- pane.setSelection(definedProps({ agentId, model, reasoning }));
86
- return { ok: true };
87
- }
88
- async function cancelRunAction(pane) {
89
- pane.conversation.cancel();
90
- return { ok: true };
91
- }
92
- async function resetConversationAction(pane, input) {
93
- requireConfirmation(input, 'resetting the conversation');
94
- pane.reset();
95
- return { ok: true };
96
- }
97
- /**
98
- * Only a directory the user already approved through the host's native picker. Passing a
99
- * model-supplied path straight to `selectRecentDirectory` would let the caller choose its own
100
- * project root, which is the desktop host's human-approval model (`reference-desktop`'s
101
- * `approvedDirectories`) inverted.
102
- */
103
- async function setWorkingDirectoryAction(pane, input) {
104
- const path = requireStringField(input, 'path');
105
- if (!pane.recentDirectories.includes(path)) {
106
- throw new Error('path must be one of the already-approved recentDirectories from chat.get_state; '
107
- + 'a new directory can only be approved by the user through the host picker');
108
- }
109
- await pane.selectRecentDirectory(path);
110
- return { ok: true };
111
- }
112
- async function getStateAction(pane) {
113
- const lastMessage = pane.conversation.messages.at(-1);
114
- const lastMessageSummary = lastMessage === undefined
115
- ? undefined
116
- : { role: lastMessage.role, ...summarizeContent(lastMessage.content) };
117
- return {
118
- activity: pane.activity,
119
- selection: pane.selection,
120
- workingDirectory: pane.workingDirectory,
121
- recentDirectories: pane.recentDirectories,
122
- canSend: pane.canSend,
123
- sendBlocker: pane.sendBlocker,
124
- messageCount: pane.conversation.messages.length,
125
- ...definedProps({ lastMessage: lastMessageSummary }),
126
- /**
127
- * Conversation content is user- and agent-authored text, not instructions from the
128
- * host. A caller reading it back must treat it as data.
129
- */
130
- untrustedFields: ['lastMessage.content'],
131
- };
132
- }
133
- const CHAT_PANE_ACTION_HANDLERS = {
134
- 'chat.send_message': sendMessageAction,
135
- 'chat.set_draft': setDraftAction,
136
- 'chat.select_agent': selectAgentAction,
137
- 'chat.cancel_run': cancelRunAction,
138
- 'chat.reset_conversation': resetConversationAction,
139
- 'chat.set_working_directory': setWorkingDirectoryAction,
140
- 'chat.get_state': getStateAction,
141
- };
142
- /** Module-scope so the dispatch itself (one `if`, no branch-per-capability) never pays the
143
- * per-nested-closure cognitive tax that a `switch` written inline in the effect would; each
144
- * capability's own logic — and its own explanatory comment — lives in its own top-level
145
- * function above instead. */
146
- async function runChatPaneAction(pane, id, input) {
147
- const handler = CHAT_PANE_ACTION_HANDLERS[id];
148
- if (!handler)
149
- throw new Error(`unknown chat capability: ${id}`);
150
- return handler(pane, input);
151
- }
152
- /**
153
- * Answers one daemon-relayed action on the bridge that delivered it, never on whatever bridge is
154
- * current: the `invocationId` belongs to that channel, so answering elsewhere would be answering a
155
- * question nobody asked.
156
- *
157
- * Delivery is reported separately from execution: a rejection inside `respondSuccess` is a failure
158
- * to ANSWER, not a failed action, and must not be re-reported as one. Every delivery attempt is
159
- * itself guarded so a dead channel cannot surface as an unhandled rejection with the daemon-side
160
- * invocation left hanging.
161
- */
162
- async function deliverBridgeAction(pane, bridge, action) {
163
- let output;
164
- try {
165
- output = await runChatPaneAction(pane, action.capabilityId, action.input);
166
- }
167
- catch (error) {
168
- await bridge.respondError(action.invocationId, errorMessage(error)).catch(() => undefined);
169
- return;
170
- }
171
- try {
172
- await bridge.respondSuccess(action.invocationId, output);
173
- }
174
- catch (deliveryError) {
175
- await bridge
176
- .respondError(action.invocationId, `action succeeded but the result could not be delivered: ${errorMessage(deliveryError)}`)
177
- .catch(() => undefined);
178
- }
179
- }
180
- /**
181
- * Wires the chat pane's own actions (send/draft/selection/cancel/reset/working-directory/state) up
182
- * to the outside-caller surfaces the pane supports: a daemon-relayed action channel when
183
- * `bridgeAccess` is supplied, so an HTTP- or MCP-driven caller can reach this SAME live pane
184
- * instance, and — only when the host sets `webmcp` — in-page WebMCP tool registration
185
- * (`document.modelContext.registerTool`, feature-detected). Both dispatch through one identical
186
- * action map (`runChatPaneAction`, module scope above), so the two callers can never diverge in
187
- * *behavior*.
188
- *
189
- * They do differ in *authorization*, and that difference is the reason WebMCP is off by default.
190
- * The relayed channel arrives having already passed `ToolExecutor`; a WebMCP call has no run and
191
- * no principal, so it cannot. See {@link UseChatPaneAgentControlOptions.webmcp}.
192
- */
193
- export function useChatPaneAgentControl(pane, options = {}) {
194
- const enabled = options.enabled ?? false;
195
- const paneRef = useRef(pane);
196
- paneRef.current = pane;
197
- const bridgeAccessRef = useRef(options.bridgeAccess);
198
- bridgeAccessRef.current = options.bridgeAccess;
199
- // Presence, not identity: hosts write `agentControl={{...}}` inline in JSX (as every other prop
200
- // here is written), so depending on the object itself would tear down and re-register all tools
201
- // on every render, dropping in-flight actions. See the effect's closing comment for the tradeoff.
202
- const hasBridgeAccess = options.bridgeAccess !== undefined;
203
- useEffect(() => {
204
- if (!enabled)
205
- return;
206
- const cleanups = [];
207
- // Not registered unless the host opted in: see `webmcp`'s own doc for why this path cannot be
208
- // gated and therefore must not be on by default.
209
- const modelContext = options.webmcp === true ? getModelContext() : undefined;
210
- if (modelContext) {
211
- const controller = new AbortController();
212
- for (const tool of CHAT_PANE_AGENT_TOOLS) {
213
- // `registerTool` is async per the draft IDL, and a polyfill may return undefined instead.
214
- // Normalize both, then swallow: registration is best-effort, and a rejected one must not
215
- // surface as an unhandled rejection from a React effect.
216
- const registered = modelContext.registerTool({
217
- name: tool.id,
218
- description: tool.description,
219
- inputSchema: tool.inputSchema,
220
- execute: (args) => runChatPaneAction(paneRef.current, tool.id, args ?? {}),
221
- }, { signal: controller.signal });
222
- void Promise.resolve(registered).catch(() => undefined);
223
- }
224
- cleanups.push(() => {
225
- controller.abort();
226
- if (modelContext.unregisterTool) {
227
- for (const tool of CHAT_PANE_AGENT_TOOLS)
228
- modelContext.unregisterTool(tool.id);
229
- }
230
- });
231
- }
232
- const subscribedBridge = bridgeAccessRef.current;
233
- if (subscribedBridge) {
234
- const unsubscribe = subscribedBridge.subscribe((action) => {
235
- void deliverBridgeAction(paneRef.current, subscribedBridge, action);
236
- });
237
- cleanups.push(unsubscribe);
238
- }
239
- return () => {
240
- for (const cleanup of cleanups)
241
- cleanup();
242
- };
243
- // Deps are enablement + bridge PRESENCE, never the bridge object: hosts pass `agentControl`
244
- // inline, so an identity dep would re-register every tool on every render (see
245
- // `hasBridgeAccess`). Pane, run context, and bridge are all read through refs at call time.
246
- // Tradeoff: swapping to a genuinely different bridge instance while enabled does not
247
- // re-subscribe — responses still route to the current bridge via the ref, but the old
248
- // subscription stays live. A host needing a true swap should toggle `enabled` or remount.
249
- // eslint-disable-next-line react-hooks/exhaustive-deps
250
- }, [enabled, hasBridgeAccess]);
251
- }
252
- //# sourceMappingURL=useChatPaneAgentControl.hooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useChatPaneAgentControl.hooks.js","sourceRoot":"","sources":["../../../../../../src/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAA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,CAAC,CAAC;YAC1D,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE;gBACjB,UAAU,CAAC,KAAK,EAAE,CAAC;gBACnB,IAAI,YAAY,CAAC,cAAc,EAAE,CAAC;oBAChC,KAAK,MAAM,IAAI,IAAI,qBAAqB;wBAAE,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACjF,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,gBAAgB,GAAG,eAAe,CAAC,OAAO,CAAC;QACjD,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,WAAW,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE;gBACxD,KAAK,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;YACtE,CAAC,CAAC,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7B,CAAC;QAED,OAAO,GAAG,EAAE;YACV,KAAK,MAAM,OAAO,IAAI,QAAQ;gBAAE,OAAO,EAAE,CAAC;QAC5C,CAAC,CAAC;QACF,4FAA4F;QAC5F,+EAA+E;QAC/E,4FAA4F;QAC5F,qFAAqF;QACrF,sFAAsF;QACtF,0FAA0F;QAC1F,uDAAuD;IACzD,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;AACjC,CAAC"}
@@ -1,26 +0,0 @@
1
- import { type DragEventHandler } from 'react';
2
- export interface UseChatPaneFileDropOptions {
3
- enabled: boolean;
4
- onFiles: (files: File[]) => void | Promise<void>;
5
- }
6
- export interface ChatPaneFileDropTargetProps {
7
- onDragEnter: DragEventHandler<HTMLDivElement>;
8
- onDragOver: DragEventHandler<HTMLDivElement>;
9
- onDragLeave: DragEventHandler<HTMLDivElement>;
10
- onDrop: DragEventHandler<HTMLDivElement>;
11
- }
12
- export interface UseChatPaneFileDropResult {
13
- draggingFiles: boolean;
14
- dropReadError: string | null;
15
- targetProps: ChatPaneFileDropTargetProps;
16
- }
17
- /**
18
- * Adapts the shared nesting-safe file drop target to the chat composer.
19
- * Non-file drags are ignored, while temporarily disabled composers still
20
- * consume a file drop so the browser cannot navigate away to the local file.
21
- *
22
- * @complexity Time: O(n) for the dropped file list; space: O(n).
23
- * @overallScore 100/100
24
- */
25
- export declare function useChatPaneFileDrop({ enabled, onFiles, }: UseChatPaneFileDropOptions): UseChatPaneFileDropResult;
26
- //# sourceMappingURL=useChatPaneFileDrop.hooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useChatPaneFileDrop.hooks.d.ts","sourceRoot":"","sources":["../../../../../../src/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,OAAO,CAAC;AAGf,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC9C,UAAU,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC7C,WAAW,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC9C,MAAM,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,2BAA2B,CAAC;CAC1C;AAQD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,GACR,EAAE,0BAA0B,GAAG,yBAAyB,CA4CxD"}
@@ -1,60 +0,0 @@
1
- import { useCallback, } from 'react';
2
- import { useFileDropTarget } from '@jini-ai/ui';
3
- function carriesFiles(event) {
4
- return Array.from(event.dataTransfer.types ?? []).includes('Files')
5
- || Array.from(event.dataTransfer.items ?? []).some((item) => item.kind === 'file')
6
- || (event.type === 'drop' && event.dataTransfer.files.length > 0);
7
- }
8
- /**
9
- * Adapts the shared nesting-safe file drop target to the chat composer.
10
- * Non-file drags are ignored, while temporarily disabled composers still
11
- * consume a file drop so the browser cannot navigate away to the local file.
12
- *
13
- * @complexity Time: O(n) for the dropped file list; space: O(n).
14
- * @overallScore 100/100
15
- */
16
- export function useChatPaneFileDrop({ enabled, onFiles, }) {
17
- const dropTarget = useFileDropTarget((files) => {
18
- void onFiles(files);
19
- });
20
- const onDragEnter = useCallback((event) => {
21
- if (!enabled || !carriesFiles(event))
22
- return;
23
- dropTarget.onDragEnter(event);
24
- }, [dropTarget.onDragEnter, enabled]);
25
- const onDragOver = useCallback((event) => {
26
- if (!carriesFiles(event))
27
- return;
28
- event.preventDefault();
29
- if (!enabled) {
30
- event.dataTransfer.dropEffect = 'none';
31
- return;
32
- }
33
- dropTarget.onDragOver(event);
34
- }, [dropTarget.onDragOver, enabled]);
35
- const onDragLeave = useCallback((event) => {
36
- if (!enabled || !carriesFiles(event))
37
- return;
38
- dropTarget.onDragLeave(event);
39
- }, [dropTarget.onDragLeave, enabled]);
40
- const onDrop = useCallback((event) => {
41
- if (!carriesFiles(event))
42
- return;
43
- if (!enabled) {
44
- event.preventDefault();
45
- return;
46
- }
47
- dropTarget.onDrop(event);
48
- }, [dropTarget.onDrop, enabled]);
49
- return {
50
- draggingFiles: enabled && dropTarget.draggingFiles,
51
- dropReadError: dropTarget.dropReadError,
52
- targetProps: {
53
- onDragEnter,
54
- onDragOver,
55
- onDragLeave,
56
- onDrop,
57
- },
58
- };
59
- }
60
- //# sourceMappingURL=useChatPaneFileDrop.hooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useChatPaneFileDrop.hooks.js","sourceRoot":"","sources":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AAI,CAAC,OAAO,EAAE,CAAC;YACb,KAAK,CAAC,YAAY,CAAC,UAAU,GAAG,MAAM,CAAC;YACvC,OAAO;QACT,CAAC;QACD,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IAErC,MAAM,WAAW,GAAG,WAAW,CAAmC,CAAC,KAAK,EAAE,EAAE;QAC1E,IAAI,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;YAAE,OAAO;QAC7C,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAEtC,MAAM,MAAM,GAAG,WAAW,CAAmC,CAAC,KAAK,EAAE,EAAE;QACrE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;YAAE,OAAO;QACjC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QACD,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEjC,OAAO;QACL,aAAa,EAAE,OAAO,IAAI,UAAU,CAAC,aAAa;QAClD,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,WAAW,EAAE;YACX,WAAW;YACX,UAAU;YACV,WAAW;YACX,MAAM;SACP;KACF,CAAC;AACJ,CAAC"}
@@ -1,25 +0,0 @@
1
- import type { ChatPaneAgent, ChatPaneRuntimeAccess } from '../../types.js';
2
- export interface UseChatPaneRuntimeInventoryOptions {
3
- access?: ChatPaneRuntimeAccess;
4
- initialAgents?: readonly ChatPaneAgent[];
5
- pollIntervalMs?: number;
6
- }
7
- export interface UseChatPaneRuntimeInventoryResult {
8
- agents: readonly ChatPaneAgent[];
9
- scanningAgents: boolean;
10
- daemonOnline: boolean;
11
- runtimeInventoryError: Error | null;
12
- rescanAgents: () => Promise<void>;
13
- }
14
- /**
15
- * Owns agent inventory, explicit rescans, and daemon-health polling while the
16
- * host supplies only the environment-specific I/O effects.
17
- *
18
- * Inventory and health are tracked as two independent operations: a slow `listAgents` must not
19
- * suppress a health tick that resolved after it, and vice versa.
20
- *
21
- * @complexity Time: O(n) per inventory response; space: O(n) for the snapshot.
22
- * @overallScore 100/100
23
- */
24
- export declare function useChatPaneRuntimeInventory({ access, initialAgents, pollIntervalMs, }: UseChatPaneRuntimeInventoryOptions): UseChatPaneRuntimeInventoryResult;
25
- //# sourceMappingURL=useChatPaneRuntimeInventory.hooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useChatPaneRuntimeInventory.hooks.d.ts","sourceRoot":"","sources":["../../../../../../src/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAI3E,MAAM,WAAW,kCAAkC;IACjD,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,aAAa,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iCAAiC;IAChD,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,qBAAqB,EAAE,KAAK,GAAG,IAAI,CAAC;IACpC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,MAAM,EACN,aAA4B,EAC5B,cAAsB,GACvB,EAAE,kCAAkC,GAAG,iCAAiC,CAsExE"}
@@ -1,83 +0,0 @@
1
- import { useCallback, useEffect, useState } from 'react';
2
- import { useLatestOperation } from '../../../../hooks/useLatestOperation.js';
3
- const EMPTY_AGENTS = [];
4
- /**
5
- * Owns agent inventory, explicit rescans, and daemon-health polling while the
6
- * host supplies only the environment-specific I/O effects.
7
- *
8
- * Inventory and health are tracked as two independent operations: a slow `listAgents` must not
9
- * suppress a health tick that resolved after it, and vice versa.
10
- *
11
- * @complexity Time: O(n) per inventory response; space: O(n) for the snapshot.
12
- * @overallScore 100/100
13
- */
14
- export function useChatPaneRuntimeInventory({ access, initialAgents = EMPTY_AGENTS, pollIntervalMs = 5_000, }) {
15
- const [agents, setAgents] = useState(initialAgents);
16
- const [scanningAgents, setScanningAgents] = useState(false);
17
- const [daemonOnline, setDaemonOnline] = useState(false);
18
- const [runtimeInventoryError, setRuntimeInventoryError] = useState(null);
19
- const inventory = useLatestOperation();
20
- const health = useLatestOperation();
21
- useEffect(() => {
22
- if (access !== undefined)
23
- return;
24
- inventory.supersede();
25
- setAgents(initialAgents);
26
- setScanningAgents(false);
27
- setRuntimeInventoryError(null);
28
- }, [access, initialAgents, inventory]);
29
- const loadAgents = useCallback(async (rescan) => {
30
- if (!access)
31
- return;
32
- setScanningAgents(true);
33
- setRuntimeInventoryError(null);
34
- await inventory.run(async (token) => {
35
- const nextAgents = await (rescan ? access.rescanAgents() : access.listAgents());
36
- token.ensureCurrent();
37
- setAgents([...nextAgents]);
38
- setScanningAgents(false);
39
- }, (error) => {
40
- // A failed rescan keeps the last good inventory on screen; a failed initial load has no
41
- // last-good to keep, so it clears to empty rather than showing agents that may be gone.
42
- if (!rescan)
43
- setAgents([]);
44
- setRuntimeInventoryError(error);
45
- setScanningAgents(false);
46
- });
47
- }, [access, inventory]);
48
- const refreshStatus = useCallback(async () => {
49
- // No `if (!access) return` guard here (unlike `loadAgents`, which is reachable through
50
- // the publicly-exposed `rescanAgents` and so can be invoked with a stale closure by the
51
- // host): `refreshStatus` is never returned from this hook, so its only two call sites
52
- // (the effect below, both the immediate call and the interval tick) are inside the SAME
53
- // closure as the effect's own `if (!access) return` at its top — `access` is guaranteed
54
- // defined by the time either one runs.
55
- const runtimeAccess = access;
56
- await health.run(async (token) => {
57
- const online = await runtimeAccess.daemonOnline();
58
- token.ensureCurrent();
59
- setDaemonOnline(online);
60
- }, () => setDaemonOnline(false));
61
- }, [access, health]);
62
- useEffect(() => {
63
- if (!access)
64
- return;
65
- void loadAgents(false);
66
- void refreshStatus();
67
- const timer = window.setInterval(() => void refreshStatus(), pollIntervalMs);
68
- return () => {
69
- window.clearInterval(timer);
70
- inventory.supersede();
71
- health.supersede();
72
- };
73
- }, [access, health, inventory, loadAgents, pollIntervalMs, refreshStatus]);
74
- const rescanAgents = useCallback(() => loadAgents(true), [loadAgents]);
75
- return {
76
- agents,
77
- scanningAgents,
78
- daemonOnline,
79
- runtimeInventoryError,
80
- rescanAgents,
81
- };
82
- }
83
- //# sourceMappingURL=useChatPaneRuntimeInventory.hooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useChatPaneRuntimeInventory.hooks.js","sourceRoot":"","sources":["../../../../../../src/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAG7E,MAAM,YAAY,GAA6B,EAAE,CAAC;AAgBlD;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CAAC,EAC1C,MAAM,EACN,aAAa,GAAG,YAAY,EAC5B,cAAc,GAAG,KAAK,GACa;IACnC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAA2B,aAAa,CAAC,CAAC;IAC9E,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ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QACL,MAAM;QACN,cAAc;QACd,YAAY;QACZ,qBAAqB;QACrB,YAAY;KACb,CAAC;AACJ,CAAC"}
@@ -1,38 +0,0 @@
1
- import type { ChatPaneWorkingDirectoryAccess } from '../../types.js';
2
- export interface UseChatPaneWorkingDirectoryOptions {
3
- workingDirectory?: string | null;
4
- initialWorkingDirectory?: string | null;
5
- onChangeWorkingDirectory?: (workingDirectory: string | null) => void;
6
- workingDirectoryAccess?: ChatPaneWorkingDirectoryAccess;
7
- }
8
- export interface UseChatPaneWorkingDirectoryResult {
9
- workingDirectory: string | null;
10
- recentDirectories: readonly string[];
11
- workingDirectoryInvalid: boolean;
12
- workingDirectoryPending: boolean;
13
- workingDirectoryError: Error | null;
14
- openWorkingDirectoryPicker: () => Promise<void>;
15
- pickWorkingDirectory: () => Promise<void>;
16
- selectRecentDirectory: (directory: string) => Promise<void>;
17
- clearWorkingDirectory: () => void;
18
- }
19
- /**
20
- * Owns controlled/uncontrolled directory state and orchestrates the native
21
- * filesystem effects used by the packaged working-directory picker.
22
- *
23
- * Every async path runs through one {@link useLatestOperation} instance, so a validation still in
24
- * flight cannot clobber the result of the pick that replaced it, and a resolved promise arriving
25
- * after unmount writes nothing. `token.ensureCurrent()` is that check — it stands where a
26
- * `if (!mounted || stale) return;` guard used to sit after each await.
27
- *
28
- * @param options - Public value, change callback, and optional host I/O access.
29
- * @returns Current picker state plus actions consumed by {@link ChatPane}.
30
- * @throws Never. Native capability failures are exposed as
31
- * `workingDirectoryError` for package-owned validation UI.
32
- *
33
- * @complexity Time: O(r) when refreshing `r` recent paths; O(1) otherwise.
34
- * @complexity Space: O(r) for the package-owned recent-directory snapshot.
35
- * @overallScore 100/100
36
- */
37
- export declare function useChatPaneWorkingDirectory(options: UseChatPaneWorkingDirectoryOptions): UseChatPaneWorkingDirectoryResult;
38
- //# sourceMappingURL=useChatPaneWorkingDirectory.hooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useChatPaneWorkingDirectory.hooks.d.ts","sourceRoot":"","sources":["../../../../../../src/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAErE,MAAM,WAAW,kCAAkC;IACjD,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,wBAAwB,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACrE,sBAAsB,CAAC,EAAE,8BAA8B,CAAC;CACzD;AAED,MAAM,WAAW,iCAAiC;IAChD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,uBAAuB,EAAE,OAAO,CAAC;IACjC,uBAAuB,EAAE,OAAO,CAAC;IACjC,qBAAqB,EAAE,KAAK,GAAG,IAAI,CAAC;IACpC,0BAA0B,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,qBAAqB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,kCAAkC,GAC1C,iCAAiC,CA4KnC"}