@dxos/plugin-assistant 0.13.0 → 0.14.0

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 (234) hide show
  1. package/PLUGIN.mdl +25 -0
  2. package/dist/lib/AssistantCapabilities.mjs +8 -1
  3. package/dist/lib/AssistantCapabilities.mjs.map +1 -1
  4. package/dist/lib/Settings.mjs +4 -0
  5. package/dist/lib/Settings.mjs.map +1 -1
  6. package/dist/lib/TurnReviewSkill.mjs +55 -0
  7. package/dist/lib/TurnReviewSkill.mjs.map +1 -0
  8. package/dist/lib/chunk-AgentArticle.mjs +1 -1
  9. package/dist/lib/chunk-AssistantSettings.mjs +1 -1
  10. package/dist/lib/chunk-AssistantSettings.mjs.map +1 -1
  11. package/dist/lib/chunk-Chat.mjs +322 -174
  12. package/dist/lib/chunk-Chat.mjs.map +1 -1
  13. package/dist/lib/chunk-ChatArticle.mjs +14 -7
  14. package/dist/lib/chunk-ChatArticle.mjs.map +1 -1
  15. package/dist/lib/chunk-ChatDialog.mjs +5 -4
  16. package/dist/lib/chunk-ChatDialog.mjs.map +1 -1
  17. package/dist/lib/chunk-IntegrationPrompt.mjs +1 -1
  18. package/dist/lib/chunk-PLUGIN.mjs +1 -1
  19. package/dist/lib/chunk-PluginUrlPrompt.mjs +1 -1
  20. package/dist/lib/chunk-QuestionSurface.mjs +1 -1
  21. package/dist/lib/chunk-SpaceHomePrompt.mjs +116 -60
  22. package/dist/lib/chunk-SpaceHomePrompt.mjs.map +1 -1
  23. package/dist/lib/chunk-TriggerStatus.mjs +1 -1
  24. package/dist/lib/chunk-agent-service.mjs +3 -1
  25. package/dist/lib/chunk-agent-service.mjs.map +1 -1
  26. package/dist/lib/chunk-analyze-turn.mjs +220 -0
  27. package/dist/lib/chunk-analyze-turn.mjs.map +1 -0
  28. package/dist/lib/{chunk-processor.mjs → chunk-chat-model.mjs} +95 -43
  29. package/dist/lib/chunk-chat-model.mjs.map +1 -0
  30. package/dist/lib/chunk-context.mjs.map +1 -1
  31. package/dist/lib/chunk-create-chat.mjs +5 -19
  32. package/dist/lib/chunk-create-chat.mjs.map +1 -1
  33. package/dist/lib/chunk-create-object.mjs +1 -1
  34. package/dist/lib/chunk-default-skills.mjs +28 -0
  35. package/dist/lib/chunk-default-skills.mjs.map +1 -0
  36. package/dist/lib/chunk-generate-home-suggestions.mjs +8 -6
  37. package/dist/lib/chunk-generate-home-suggestions.mjs.map +1 -1
  38. package/dist/lib/chunk-presets.mjs +1 -1
  39. package/dist/lib/chunk-presets.mjs.map +1 -1
  40. package/dist/lib/chunk-question-resumer.mjs +1 -1
  41. package/dist/lib/chunk-react-surface.mjs +1 -1
  42. package/dist/lib/chunk-run-prompt-in-chat.mjs +2 -1
  43. package/dist/lib/chunk-run-prompt-in-chat.mjs.map +1 -1
  44. package/dist/lib/chunk-run-prompt-in-new-chat.mjs +1 -1
  45. package/dist/lib/chunk-schema-defs.mjs +2 -2
  46. package/dist/lib/chunk-skill-definition.mjs +3 -2
  47. package/dist/lib/chunk-skill-definition.mjs.map +1 -1
  48. package/dist/lib/components.mjs +13 -13
  49. package/dist/lib/components.mjs.map +1 -1
  50. package/dist/lib/hooks.mjs +40 -31
  51. package/dist/lib/hooks.mjs.map +1 -1
  52. package/dist/lib/operations.mjs +3 -1
  53. package/dist/lib/operations.mjs.map +1 -1
  54. package/dist/lib/skills.mjs +2 -1
  55. package/dist/lib/translations.mjs +4 -2
  56. package/dist/lib/translations.mjs.map +1 -1
  57. package/dist/types/src/Chat.d.ts +1 -1
  58. package/dist/types/src/capabilities/agent-service.d.ts.map +1 -1
  59. package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -1
  60. package/dist/types/src/{processor/processor.d.ts → chat-model/chat-model.d.ts} +24 -22
  61. package/dist/types/src/chat-model/chat-model.d.ts.map +1 -0
  62. package/dist/types/src/chat-model/chat-model.edge.test.d.ts +2 -0
  63. package/dist/types/src/chat-model/chat-model.edge.test.d.ts.map +1 -0
  64. package/dist/types/src/chat-model/chat-model.node.test.d.ts +2 -0
  65. package/dist/types/src/chat-model/chat-model.node.test.d.ts.map +1 -0
  66. package/dist/types/src/chat-model/chat-model.scripted.node.test.d.ts +2 -0
  67. package/dist/types/src/chat-model/chat-model.scripted.node.test.d.ts.map +1 -0
  68. package/dist/types/src/{processor → chat-model}/index.d.ts +1 -1
  69. package/dist/types/src/chat-model/index.d.ts.map +1 -0
  70. package/dist/types/src/chat-model/outbox.d.ts.map +1 -0
  71. package/dist/types/src/chat-model/outbox.test.d.ts.map +1 -0
  72. package/dist/types/src/chat-model/presets.d.ts.map +1 -0
  73. package/dist/types/src/chat-model/presets.test.d.ts.map +1 -0
  74. package/dist/types/src/{processor → chat-model}/prompt.d.ts +2 -2
  75. package/dist/types/src/chat-model/prompt.d.ts.map +1 -0
  76. package/dist/types/src/chat-model/prompt.test.d.ts.map +1 -0
  77. package/dist/types/src/chat-model/streaming.node.test.d.ts.map +1 -0
  78. package/dist/types/src/chat-model/testing/chat-model-recorder.d.ts +58 -0
  79. package/dist/types/src/chat-model/testing/chat-model-recorder.d.ts.map +1 -0
  80. package/dist/types/src/chat-model/testing/harness.d.ts +22 -0
  81. package/dist/types/src/chat-model/testing/harness.d.ts.map +1 -0
  82. package/dist/types/src/chat-model/thread.d.ts.map +1 -0
  83. package/dist/types/src/chat-model/thread.test.d.ts.map +1 -0
  84. package/dist/types/src/components/Chat/Chat.d.ts +6 -6
  85. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  86. package/dist/types/src/components/Chat/context.d.ts +5 -3
  87. package/dist/types/src/components/Chat/context.d.ts.map +1 -1
  88. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +1 -1
  89. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  90. package/dist/types/src/components/ChatPrompt/ChatMcpErrors.d.ts +3 -3
  91. package/dist/types/src/components/ChatPrompt/ChatMcpErrors.d.ts.map +1 -1
  92. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +3 -1
  93. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
  94. package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +4 -3
  95. package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -1
  96. package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts +15 -5
  97. package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts.map +1 -1
  98. package/dist/types/src/components/ChatPrompt/ChatPrompt.stories.d.ts +1 -1
  99. package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts +1 -1
  100. package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts.map +1 -1
  101. package/dist/types/src/components/ConnectorAuthMenu/ConnectorAuthMenu.stories.d.ts +9 -0
  102. package/dist/types/src/components/ConnectorAuthMenu/ConnectorAuthMenu.stories.d.ts.map +1 -1
  103. package/dist/types/src/components/Toolbox/Toolbox.d.ts +3 -3
  104. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  105. package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts.map +1 -1
  106. package/dist/types/src/containers/ChatArticle/ChatArticle.stories.d.ts +1 -1
  107. package/dist/types/src/containers/SpaceHomePrompt/SpaceHomePrompt.d.ts.map +1 -1
  108. package/dist/types/src/hooks/index.d.ts +2 -2
  109. package/dist/types/src/hooks/index.d.ts.map +1 -1
  110. package/dist/types/src/hooks/{useChatProcessor.d.ts → useChatModel.d.ts} +6 -6
  111. package/dist/types/src/hooks/useChatModel.d.ts.map +1 -0
  112. package/dist/types/src/hooks/useDebug.d.ts +3 -3
  113. package/dist/types/src/hooks/useDebug.d.ts.map +1 -1
  114. package/dist/types/src/hooks/useHomeSuggestions.d.ts +3 -3
  115. package/dist/types/src/hooks/useHomeSuggestions.d.ts.map +1 -1
  116. package/dist/types/src/hooks/usePresets.d.ts +1 -1
  117. package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
  118. package/dist/types/src/hooks/useSelectionContext.d.ts +3 -3
  119. package/dist/types/src/hooks/useSelectionContext.d.ts.map +1 -1
  120. package/dist/types/src/operations/analyze-turn.d.ts +5 -0
  121. package/dist/types/src/operations/analyze-turn.d.ts.map +1 -0
  122. package/dist/types/src/operations/analyze-turn.test.d.ts +2 -0
  123. package/dist/types/src/operations/analyze-turn.test.d.ts.map +1 -0
  124. package/dist/types/src/operations/create-chat.d.ts.map +1 -1
  125. package/dist/types/src/operations/generate-home-suggestions.d.ts.map +1 -1
  126. package/dist/types/src/operations/index.d.ts.map +1 -1
  127. package/dist/types/src/operations/run-prompt-in-chat.d.ts.map +1 -1
  128. package/dist/types/src/review/turn-review.d.ts +58 -0
  129. package/dist/types/src/review/turn-review.d.ts.map +1 -0
  130. package/dist/types/src/review/turn-review.test.d.ts +2 -0
  131. package/dist/types/src/review/turn-review.test.d.ts.map +1 -0
  132. package/dist/types/src/skills/index.d.ts +1 -0
  133. package/dist/types/src/skills/index.d.ts.map +1 -1
  134. package/dist/types/src/skills/turn-review/TurnReviewSkill.d.ts +21 -0
  135. package/dist/types/src/skills/turn-review/TurnReviewSkill.d.ts.map +1 -0
  136. package/dist/types/src/skills/turn-review/index.d.ts +2 -0
  137. package/dist/types/src/skills/turn-review/index.d.ts.map +1 -0
  138. package/dist/types/src/translations.d.ts.map +1 -1
  139. package/dist/types/src/types/Assistant.d.ts +1 -0
  140. package/dist/types/src/types/Assistant.d.ts.map +1 -1
  141. package/dist/types/src/types/AssistantCapabilities.d.ts +7 -1
  142. package/dist/types/src/types/AssistantCapabilities.d.ts.map +1 -1
  143. package/dist/types/src/types/Settings.d.ts +1 -0
  144. package/dist/types/src/types/Settings.d.ts.map +1 -1
  145. package/dist/types/src/util/agent-options.d.ts +27 -0
  146. package/dist/types/src/util/agent-options.d.ts.map +1 -0
  147. package/dist/types/src/util/agent-options.test.d.ts +2 -0
  148. package/dist/types/src/util/agent-options.test.d.ts.map +1 -0
  149. package/dist/types/src/util/default-skills.d.ts +10 -0
  150. package/dist/types/src/util/default-skills.d.ts.map +1 -0
  151. package/dist/types/tsconfig.tsbuildinfo +1 -1
  152. package/package.json +89 -80
  153. package/src/capabilities/agent-service.ts +2 -1
  154. package/src/capabilities/skill-definition.ts +2 -1
  155. package/src/chat-model/chat-model.edge.test.ts +301 -0
  156. package/src/{processor/processor.node.test.ts → chat-model/chat-model.node.test.ts} +19 -9
  157. package/src/chat-model/chat-model.scripted.node.test.ts +441 -0
  158. package/src/{processor/processor.ts → chat-model/chat-model.ts} +140 -45
  159. package/src/{processor → chat-model}/index.ts +1 -1
  160. package/src/{processor → chat-model}/prompt.ts +2 -2
  161. package/src/{processor → chat-model}/streaming.node.test.ts +108 -116
  162. package/src/chat-model/testing/chat-model-recorder.ts +249 -0
  163. package/src/chat-model/testing/harness.ts +81 -0
  164. package/src/{processor → chat-model}/thread.test.ts +1 -1
  165. package/src/components/Chat/Chat.tsx +44 -38
  166. package/src/components/Chat/Error.stories.tsx +1 -1
  167. package/src/components/Chat/context.ts +5 -3
  168. package/src/components/ChatPrompt/ChatActions.tsx +1 -1
  169. package/src/components/ChatPrompt/ChatMcpErrors.tsx +6 -6
  170. package/src/components/ChatPrompt/ChatOptions.stories.tsx +37 -3
  171. package/src/components/ChatPrompt/ChatOptions.tsx +118 -10
  172. package/src/components/ChatPrompt/ChatPrompt.stories.tsx +10 -10
  173. package/src/components/ChatPrompt/ChatPrompt.tsx +44 -27
  174. package/src/components/ChatPrompt/ChatStatus.tsx +8 -7
  175. package/src/components/Toolbox/Toolbox.tsx +12 -13
  176. package/src/containers/AssistantSettings/AssistantSettings.tsx +1 -1
  177. package/src/containers/ChatArticle/ChatArticle.stories.tsx +1 -1
  178. package/src/containers/ChatArticle/ChatArticle.tsx +16 -6
  179. package/src/containers/ChatDialog/ChatDialog.tsx +4 -4
  180. package/src/containers/SpaceHomePrompt/SpaceHomePrompt.tsx +110 -57
  181. package/src/hooks/index.ts +2 -2
  182. package/src/hooks/{useChatProcessor.ts → useChatModel.ts} +16 -14
  183. package/src/hooks/useDebug.ts +8 -8
  184. package/src/hooks/useHomeSuggestions.ts +14 -9
  185. package/src/hooks/usePresets.ts +2 -2
  186. package/src/hooks/useProcessEphemeralStatus.ts +1 -1
  187. package/src/hooks/useSelectionContext.ts +3 -5
  188. package/src/operations/analyze-turn.test.ts +194 -0
  189. package/src/operations/analyze-turn.ts +96 -0
  190. package/src/operations/create-chat.ts +4 -36
  191. package/src/operations/generate-home-suggestions.test.ts +1 -2
  192. package/src/operations/generate-home-suggestions.ts +17 -9
  193. package/src/operations/index.ts +2 -0
  194. package/src/operations/run-prompt-in-chat.ts +3 -2
  195. package/src/review/turn-review.test.ts +92 -0
  196. package/src/review/turn-review.ts +213 -0
  197. package/src/skills/index.ts +1 -0
  198. package/src/skills/turn-review/TurnReviewSkill.ts +46 -0
  199. package/src/skills/turn-review/index.ts +5 -0
  200. package/src/translations.ts +2 -0
  201. package/src/types/AssistantCapabilities.ts +8 -1
  202. package/src/types/Settings.ts +7 -0
  203. package/src/util/agent-options.test.ts +54 -0
  204. package/src/util/agent-options.ts +60 -0
  205. package/src/util/default-skills.ts +35 -0
  206. package/dist/lib/chunk-processor.mjs.map +0 -1
  207. package/dist/types/src/hooks/useChatProcessor.d.ts.map +0 -1
  208. package/dist/types/src/processor/index.d.ts.map +0 -1
  209. package/dist/types/src/processor/outbox.d.ts.map +0 -1
  210. package/dist/types/src/processor/outbox.test.d.ts.map +0 -1
  211. package/dist/types/src/processor/presets.d.ts.map +0 -1
  212. package/dist/types/src/processor/presets.test.d.ts.map +0 -1
  213. package/dist/types/src/processor/processor.d.ts.map +0 -1
  214. package/dist/types/src/processor/processor.node.test.d.ts +0 -2
  215. package/dist/types/src/processor/processor.node.test.d.ts.map +0 -1
  216. package/dist/types/src/processor/prompt.d.ts.map +0 -1
  217. package/dist/types/src/processor/prompt.test.d.ts.map +0 -1
  218. package/dist/types/src/processor/streaming.node.test.d.ts.map +0 -1
  219. package/dist/types/src/processor/thread.d.ts.map +0 -1
  220. package/dist/types/src/processor/thread.test.d.ts.map +0 -1
  221. /package/dist/types/src/{processor → chat-model}/outbox.d.ts +0 -0
  222. /package/dist/types/src/{processor → chat-model}/outbox.test.d.ts +0 -0
  223. /package/dist/types/src/{processor → chat-model}/presets.d.ts +0 -0
  224. /package/dist/types/src/{processor → chat-model}/presets.test.d.ts +0 -0
  225. /package/dist/types/src/{processor → chat-model}/prompt.test.d.ts +0 -0
  226. /package/dist/types/src/{processor → chat-model}/streaming.node.test.d.ts +0 -0
  227. /package/dist/types/src/{processor → chat-model}/thread.d.ts +0 -0
  228. /package/dist/types/src/{processor → chat-model}/thread.test.d.ts +0 -0
  229. /package/src/{processor → chat-model}/outbox.test.ts +0 -0
  230. /package/src/{processor → chat-model}/outbox.ts +0 -0
  231. /package/src/{processor → chat-model}/presets.test.ts +0 -0
  232. /package/src/{processor → chat-model}/presets.ts +0 -0
  233. /package/src/{processor → chat-model}/prompt.test.ts +0 -0
  234. /package/src/{processor → chat-model}/thread.ts +0 -0
@@ -13,15 +13,15 @@ import { Database, Feed, Ref, type Registry } from '@dxos/echo';
13
13
  import { DXN } from '@dxos/keys';
14
14
  import { ContentBlock, Message } from '@dxos/types';
15
15
  import { type OutboxEntry } from './outbox.ts';
16
- import { type ProcessorRequestContext } from './prompt.ts';
16
+ import { type ChatRequestContext } from './prompt.ts';
17
17
  import { type ThreadProjection } from './thread.ts';
18
18
  /**
19
19
  * Space-scoped services materialised by the layer passed into
20
- * {@link AiChatProcessor}. Mirrors the tag list that
21
- * {@link useChatProcessor} passes to {@link ServiceResolver.provide}.
20
+ * {@link ChatModel}. Mirrors the tag list that
21
+ * {@link useChatModel} passes to {@link ServiceResolver.provide}.
22
22
  */
23
23
  export type SpaceServices = Database.Service | Credential.CredentialsService | AiService.AiService | AgentService.AgentService | Registry.Service | OpaqueToolkit.OpaqueToolkitProvider;
24
- export type AiChatProcessorOptions = {
24
+ export type ChatModelOptions = {
25
25
  /**
26
26
  * The model the chat's picker shows selected. The agent process reads the model off the chat, so
27
27
  * this is stamped onto a chat that has not selected one before its first request — otherwise the
@@ -37,19 +37,21 @@ export type AiChatProcessorOptions = {
37
37
  */
38
38
  chat?: Ref.Ref<Chat.Chat>;
39
39
  system?: string;
40
- /** Who this processor's prompts come from, when the chat is one of several people's with one agent. */
40
+ /** Who this chat model's prompts come from, when the chat is one of several people's with one agent. */
41
41
  sender?: AgentService.PromptSender;
42
+ /** Binds {@link TurnReviewSkill} so each turn is reviewed for struggles (opt-in setting). */
43
+ reportStruggles?: boolean;
42
44
  };
43
- export type ProcessorRequestOptions = {};
44
- export type ProcessorRequest = {
45
+ export type ChatRequestOptions = {};
46
+ export type ChatRequest = {
45
47
  message: string;
46
48
  /** `synthetic` marks system-generated turn content (e.g. a completed inline flow reporting itself). */
47
49
  disposition?: ContentBlock.Text['disposition'];
48
50
  /** Ephemeral context (e.g. companion-document selection) captured at submit time. */
49
- context?: ProcessorRequestContext;
50
- options?: ProcessorRequestOptions;
51
+ context?: ChatRequestContext;
52
+ options?: ChatRequestOptions;
51
53
  };
52
- export type ProcessorSendOptions = {
54
+ export type ChatSendOptions = {
53
55
  /**
54
56
  * Runs before the prompt is dispatched — after it is already showing — and a rejection fails the
55
57
  * prompt. Lets a transient chat persist and flush its conversation feed so the agent can resolve it.
@@ -90,7 +92,7 @@ export declare const parseError: (err: unknown) => Error;
90
92
  * Handles interactions with the AI service.
91
93
  * Uses AgentService to spawn a process-backed agent and subscribes to ephemeral trace events for streaming.
92
94
  */
93
- export declare class AiChatProcessor {
95
+ export declare class ChatModel {
94
96
  #private;
95
97
  private readonly _conversation;
96
98
  private readonly _runtime;
@@ -100,7 +102,7 @@ export declare class AiChatProcessor {
100
102
  * {@link ServiceResolver.provide} with the {@link ServiceResolver} already
101
103
  * supplied (hence `RIn = never`); the {@link ServiceNotAvailableError}
102
104
  * error channel surfaces when a tag is not available for the space.
103
- * Provided to every effect run by the processor so the underlying
105
+ * Provided to every effect run by the chat model so the underlying
104
106
  * {@link ProcessManagerRuntime} has access to space-affinity services.
105
107
  */
106
108
  private readonly _spaceLayer;
@@ -158,10 +160,10 @@ export declare class AiChatProcessor {
158
160
  * {@link ServiceResolver.provide} with the {@link ServiceResolver} already
159
161
  * supplied (hence `RIn = never`); the {@link ServiceNotAvailableError}
160
162
  * error channel surfaces when a tag is not available for the space.
161
- * Provided to every effect run by the processor so the underlying
163
+ * Provided to every effect run by the chat model so the underlying
162
164
  * {@link ProcessManagerRuntime} has access to space-affinity services.
163
165
  */
164
- _spaceLayer: Layer.Layer<SpaceServices, ServiceResolver.ServiceNotAvailableError, never>, _options?: AiChatProcessorOptions);
166
+ _spaceLayer: Layer.Layer<SpaceServices, ServiceResolver.ServiceNotAvailableError, never>, _options?: ChatModelOptions);
165
167
  get context(): AiContext.Binder;
166
168
  get conversation(): AiSession.Session;
167
169
  get registry(): Registry.Registry | undefined;
@@ -175,7 +177,7 @@ export declare class AiChatProcessor {
175
177
  *
176
178
  * Returns the outbox id, which is the prompt's thread row for its whole life.
177
179
  */
178
- send(request: ProcessorRequest, { prepare }?: ProcessorSendOptions): string;
180
+ send(request: ChatRequest, { prepare }?: ChatSendOptions): string;
179
181
  /** Forgets a prompt this client sent; withdrawing one the agent's queue holds is the feed's business. */
180
182
  removePrompt(id: string): void;
181
183
  /**
@@ -184,7 +186,7 @@ export declare class AiChatProcessor {
184
186
  * `submission` settles once the prompt is submitted (or cannot be), which is long before the turn
185
187
  * this resolves after.
186
188
  */
187
- request(requestProp: ProcessorRequest, submission?: PromptSubmission): Promise<void>;
189
+ request(requestProp: ChatRequest, submission?: PromptSubmission): Promise<void>;
188
190
  /**
189
191
  * Queues a prompt behind the turn already running, instead of starting one.
190
192
  *
@@ -194,10 +196,10 @@ export declare class AiChatProcessor {
194
196
  * `waitForCompletion` already covers the queued turn, since the agent does not report completion
195
197
  * while its queue is non-empty.
196
198
  */
197
- enqueue(requestProp: ProcessorRequest): Promise<void>;
199
+ enqueue(requestProp: ChatRequest): Promise<void>;
198
200
  /**
199
- * Mirrors turns this processor did not initiate into its own state: active/streaming state is
200
- * per-processor ({@link useChatProcessor} builds one per mount) while the agent process outlives
201
+ * Mirrors turns this chat model did not initiate into its own state: active/streaming state is
202
+ * per-chat model ({@link useChatModel} builds one per mount) while the agent process outlives
201
203
  * the mount, so a chat remounted mid-turn would otherwise render as idle.
202
204
  *
203
205
  * Returns a disposer that stops observing.
@@ -220,6 +222,6 @@ export declare class AiChatProcessor {
220
222
  */
221
223
  updateName(chat: Chat.Chat): Promise<void>;
222
224
  }
223
- export type AiChatProcessorState = Pick<AiChatProcessor, 'streaming' | 'active' | 'thread' | 'error' | 'mcpErrors' | 'activity'>;
224
- export declare const getProcessorState: (processor: AiChatProcessor | undefined) => AiChatProcessorState;
225
- //# sourceMappingURL=processor.d.ts.map
225
+ export type ChatModelState = Pick<ChatModel, 'streaming' | 'active' | 'thread' | 'error' | 'mcpErrors' | 'activity'>;
226
+ export declare const getChatModelState: (chatModel: ChatModel | undefined) => ChatModelState;
227
+ //# sourceMappingURL=chat-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-model.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/chat-model.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAA4B,KAAK,SAAS,EAAE,KAAK,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAC/F,OAAO,KAAK,YAAY,MAAM,kCAAkC,CAAC;AACjE,OAAO,EACL,SAAS,EACT,SAAS,EAKV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,KAAK,UAAU,M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,CAOrD;IAYD;;;;;;OAMG;IACH,KAAK,IAAI,MAAM,IAAI,CAkClB;IA0GD;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAkB5B;IAED;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAI3B;IAED;;OAEG;IACH,gBAAgB,IAAI,IAAI,CAEvB;IAED;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAY/C;CA8IF;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC,CAAC;AAWrH,eAAO,MAAM,iBAAiB,cAAe,SAAS,GAAG,SAAS,KAAG,cAAiD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=chat-model.edge.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-model.edge.test.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/chat-model.edge.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=chat-model.node.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-model.node.test.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/chat-model.node.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=chat-model.scripted.node.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-model.scripted.node.test.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/chat-model.scripted.node.test.ts"],"names":[],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  export * from './outbox.ts';
2
2
  export * from './presets.ts';
3
- export * from './processor.ts';
3
+ export * from './chat-model.ts';
4
4
  export * from './prompt.ts';
5
5
  export * from './thread.ts';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/outbox.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,MAAM,wBAAwB,CAAC;AAC/C,OAAO,KAAK,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,+FAA+F;AAC/F,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE7D;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,+FAA+F;IAC/F,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,CAAC,GAAG,EAAE,CAAC;IAC7C,kGAAkG;IAClG,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACxB,CAAC;AAEF,iGAAiG;AACjG,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9D,gHAAgH;AAChH,qBAAa,oBAAqB,SAAQ,yBAGzC;CAAG;AAEJ;;;;;;GAMG;AACH,qBAAa,MAAM,CAAC,CAAC;;IASjB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAP5B,QAAQ,CAAC,OAAO,gEAA8D;IAK9E,YACmB,SAAS,EAAE,YAAY,CAAC,YAAY,EACpC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,EAC3C;IAEJ,gEAAgE;IAChE,IAAI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAExB;IAED,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEvC;IAED,uFAAuF;IACvF,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,WAAW,CAYrF;IAED,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAGvB;CA+BF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox.test.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/outbox.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/presets.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC;IAClB,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC;IACf,iGAAiG;IACjG,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,kBAAkB,aAAc,GAAG,CAAC,GAAG,KAAG,eAAe,EAOjE,CAAC;AAEN;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,GAAG,CAAC,GAA4B,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,UAAU,YAAa,SAAS,eAAe,EAAE,iBAAiB,MAAM,KAAG,eAAe,GAAG,SAG9F,CAAC;AAEb;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,aACd;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CAAE,YAC9E;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,KACjC,eAAe,GAAG,SAGpB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,UAAW,GAAG,CAAC,GAAG,UAAU,GAAG,CAAC,GAAG,GAAG,SAAS,KAAG,GAAG,CAAC,GAAG,GAAG,SACC,CAAC;AAE3F;;;;GAIG;AACH,eAAO,MAAM,eAAe,aAAc,MAAM,GAAG,SAAS,cAAc,OAAO,KAAG,GAAG,CAAC,GASvF,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,sBAAsB,aAAc,GAAG,CAAC,GAAG,KAAG,MAAM,GAAG,QAAQ,GAAG,UACqB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.test.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/presets.test.ts"],"names":[],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  import { ContentBlock } from '@dxos/types';
2
2
  /** Ephemeral, per-request context captured at submit time (not part of the durable chat state). */
3
- export type ProcessorRequestContext = {
3
+ export type ChatRequestContext = {
4
4
  selection?: {
5
5
  /** Anchor strings (`"${from}:${to}"` cursor pairs) the text was resolved from; enables future in-place actions. */
6
6
  anchors: string[];
@@ -16,6 +16,6 @@ export type ProcessorRequestContext = {
16
16
  export declare const createPromptContent: (request: {
17
17
  message: string;
18
18
  disposition?: ContentBlock.Text['disposition'];
19
- context?: ProcessorRequestContext;
19
+ context?: ChatRequestContext;
20
20
  }) => string | ContentBlock.Any[];
21
21
  //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/prompt.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,mGAAmG;AACnG,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE;QACV,mHAAmH;QACnH,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,YAAa;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B,KAAG,MAAM,GAAG,YAAY,CAAC,GAAG,EAsB5B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.test.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/prompt.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.node.test.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/streaming.node.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,58 @@
1
+ import type * as Atom from 'effect/reactivity/Atom';
2
+ import type * as AtomRegistry from 'effect/reactivity/AtomRegistry';
3
+ import { type ChatModel } from '../chat-model.ts';
4
+ /** The observable outputs of a {@link ChatModel} the UI binds to, plus the agent's own view of its turn. */
5
+ export type ChatModelSignal = 'active' | 'streaming' | 'activity' | 'error' | 'thread' | 'agent';
6
+ /** One change to one signal, as the UI would have seen it. */
7
+ export type ChatModelEvent = {
8
+ /** Milliseconds since the recorder was attached. */
9
+ readonly at: number;
10
+ readonly signal: ChatModelSignal;
11
+ /** Compact rendering of the new value, stable enough to assert on. */
12
+ readonly value: string;
13
+ };
14
+ /** A moment at which the indicators disagreed with the work in flight. */
15
+ export type ChatModelViolation = {
16
+ readonly at: number;
17
+ readonly rule: string;
18
+ readonly state: Readonly<Record<ChatModelSignal, string>>;
19
+ };
20
+ export type ChatModelRecorderOptions = {
21
+ /**
22
+ * The agent session's `running` atom. Recorded as the `agent` signal and checked against `active`:
23
+ * an agent working while the chat reads idle is exactly the missing-indicator failure.
24
+ */
25
+ readonly agentRunning?: Atom.Atom<boolean>;
26
+ /** Clock for {@link ChatModelEvent.at}; injectable so a report can share a time base. */
27
+ readonly now?: () => number;
28
+ };
29
+ /**
30
+ * Records every change to a {@link ChatModel}'s indicator atoms as an ordered event log and checks
31
+ * the indicator invariants after each burst of changes.
32
+ *
33
+ * Invariants are evaluated on a microtask rather than per write: the chat model settles several atoms
34
+ * in one synchronous sequence (e.g. `active` then `activity`), which React renders as one frame, so
35
+ * only a state that survives the burst is one a reader could see.
36
+ */
37
+ export declare class ChatModelRecorder {
38
+ #private;
39
+ readonly events: ChatModelEvent[];
40
+ readonly violations: ChatModelViolation[];
41
+ constructor(registry: AtomRegistry.AtomRegistry, chatModel: ChatModel, options?: ChatModelRecorderOptions);
42
+ /** The latest value of every signal. */
43
+ get state(): Readonly<Record<ChatModelSignal, string>>;
44
+ /** The log as `signal=value` lines, optionally narrowed to some signals. */
45
+ lines(signals?: readonly ChatModelSignal[]): string[];
46
+ /** Distinct consecutive values a signal took, from its first recorded value. */
47
+ values(signal: ChatModelSignal): string[];
48
+ /** When `signal` first took `value` (or first changed, without one), relative to attach. */
49
+ firstAt(signal: ChatModelSignal, value?: string | ((value: string) => boolean)): number | undefined;
50
+ /** Milliseconds since the recorder was attached. */
51
+ elapsed(): number;
52
+ /** Resolves once `predicate` holds for the current state (checked now and after every change). */
53
+ until(predicate: (state: Readonly<Record<ChatModelSignal, string>>) => boolean, timeout?: number): Promise<void>;
54
+ /** Resolves once the chat model has been active and is idle again. */
55
+ untilSettled(timeout?: number): Promise<void>;
56
+ dispose(): void;
57
+ }
58
+ //# sourceMappingURL=chat-model-recorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-model-recorder.d.ts","sourceRoot":"","sources":["../../../../../src/chat-model/testing/chat-model-recorder.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAKpE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,4GAA4G;AAC5G,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjG,8DAA8D;AAC9D,MAAM,MAAM,cAAc,GAAG;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,yFAAyF;IACzF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B,CAAC;AAKF;;;;;;;GAOG;AACH,qBAAa,iBAAiB;;IAC5B,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,CAAM;IACvC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,EAAE,CAAM;IAkB/C,YAAY,QAAQ,EAAE,YAAY,CAAC,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,GAAE,wBAA6B,EAc5G;IAED,wCAAwC;IACxC,IAAI,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAErD;IAED,4EAA4E;IAC5E,KAAK,CAAC,OAAO,CAAC,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,EAAE,CAIpD;IAED,gFAAgF;IAChF,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,EAAE,CAExC;IAED,4FAA4F;IAC5F,OAAO,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAQlG;IAED,oDAAoD;IACpD,OAAO,IAAI,MAAM,CAEhB;IAED,kGAAkG;IAClG,KAAK,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,KAAK,OAAO,EAAE,OAAO,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB/G;IAED,sEAAsE;IACtE,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5C;IAED,OAAO,IAAI,IAAI,CAId;CAiDF"}
@@ -0,0 +1,22 @@
1
+ import * as Effect from 'effect/Effect';
2
+ import * as Layer from 'effect/Layer';
3
+ import type * as Scope from 'effect/Scope';
4
+ import type * as Capabilities from '@dxos/app-framework/Capabilities';
5
+ import { ProcessManager } from '@dxos/compute-runtime';
6
+ import * as AgentService from '@dxos/compute/AgentService';
7
+ import * as Operation from '@dxos/compute/Operation';
8
+ import * as ServiceResolver from '@dxos/compute/ServiceResolver';
9
+ import { type SpaceServices } from '../chat-model.ts';
10
+ type BaseSpaceServices = Exclude<SpaceServices, AgentService.AgentService>;
11
+ /** The chat model's space layer over the ambient services, including the real agent service. */
12
+ export declare const makeSpaceLayer: Effect.Effect<Layer.Layer<SpaceServices>, never, SpaceServices>;
13
+ /** The chat model's space layer with a stub agent service, to script the trace stream directly. */
14
+ export declare const makeStubSpaceLayer: (agentService: AgentService.Service) => Effect.Effect<Layer.Layer<SpaceServices>, never, BaseSpaceServices>;
15
+ /**
16
+ * A sound {@link Capabilities.ProcessManagerRuntime} for tests: a `ManagedRuntime` over the
17
+ * assistant test layer's process services plus a bare `PluginManager` for the capability/plugin
18
+ * tags. Scoped so the runtime is disposed with the test.
19
+ */
20
+ export declare const makeTestRuntime: Effect.Effect<Capabilities.ProcessManagerRuntime, never, ProcessManager.Service | Operation.Service | ServiceResolver.ServiceResolver | Scope.Scope>;
21
+ export {};
22
+ //# sourceMappingURL=harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../../../../src/chat-model/testing/harness.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,KAAK,YAAY,MAAM,kCAAkC,CAAC;AAItE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAE3D,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,eAAe,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,KAAK,iBAAiB,GAAG,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;AAe3E,gGAAgG;AAChG,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC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@@ -0,0 +1 @@
1
+ {"version":3,"file":"thread.test.d.ts","sourceRoot":"","sources":["../../../../src/chat-model/thread.test.ts"],"names":[],"mappings":""}
@@ -4,11 +4,11 @@ import { type ChatView } from '@dxos/react-ui-assistant';
4
4
  import { type ActionToolbarProps } from '@dxos/react-ui-menu';
5
5
  import * as Util from '@dxos/react-ui/Util';
6
6
  import { type ChatSwitcher } from '#hooks';
7
- import { type ProcessorRequestContext } from '../../processor/index.ts';
7
+ import { type ChatRequestContext } from '../../chat-model/index.ts';
8
8
  import { ChatStatus, type ChatPromptProps as NaturalChatPromptProps } from '../ChatPrompt/index.ts';
9
9
  import { type ChatContextValue } from './context.ts';
10
10
  import { type ChatEvent } from './events.ts';
11
- type ChatRootProps = PropsWithChildren<Pick<ChatContextValue, 'chat' | 'processor' | 'debug'> & {
11
+ type ChatRootProps = PropsWithChildren<Pick<ChatContextValue, 'chat' | 'chatModel' | 'debug'> & {
12
12
  /** Fallback database when the chat is transient (not yet persisted). */
13
13
  db?: Database.Database;
14
14
  onEvent?: (event: ChatEvent) => void;
@@ -18,10 +18,10 @@ type ChatRootProps = PropsWithChildren<Pick<ChatContextValue, 'chat' | 'processo
18
18
  */
19
19
  onSubmit?: (text: string) => Promise<void> | void;
20
20
  /** Called at submit time to capture ephemeral request context (e.g. companion selection). */
21
- getContext?: () => ProcessorRequestContext | undefined;
21
+ getContext?: () => ChatRequestContext | undefined;
22
22
  }>;
23
23
  declare const ChatRoot: {
24
- ({ children, chat, processor, db: dbFallback, debug: debugProp, onEvent, onSubmit, getContext, ...props }: ChatRootProps): React.JSX.Element;
24
+ ({ children, chat, chatModel, db: dbFallback, debug: debugProp, onEvent, onSubmit, getContext, ...props }: ChatRootProps): React.JSX.Element;
25
25
  displayName: string;
26
26
  };
27
27
  type ChatToolbarProps = Pick<ActionToolbarProps, 'attendableId' | 'alwaysActive'> & PropsWithChildren<{
@@ -53,7 +53,7 @@ declare const ChatOutline: {
53
53
  ({ classNames }: ChatOutlineProps): React.JSX.Element | null;
54
54
  displayName: string;
55
55
  };
56
- type ChatPromptProps = Omit<NaturalChatPromptProps, 'chat' | 'db' | 'processor' | 'event' | 'tasksVisible'> & {
56
+ type ChatPromptProps = Omit<NaturalChatPromptProps, 'chat' | 'db' | 'chatModel' | 'event' | 'tasksVisible' | 'started'> & {
57
57
  /** Whether the checklist is disclosed on mount. */
58
58
  defaultTasksVisible?: boolean;
59
59
  };
@@ -73,7 +73,7 @@ declare const ChatPrompt: {
73
73
  displayName: string;
74
74
  };
75
75
  /**
76
- * The activity line bound to the chat's processor and the chat's pending alarms: what the agent is
76
+ * The activity line bound to the chat's chat model and the chat's pending alarms: what the agent is
77
77
  * doing, for as long as it is doing anything. The line itself takes resolved values, so it lives
78
78
  * beside the prompt with the rest of the presentational parts and only the binding is here.
79
79
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chat/Chat.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAqD,MAAM,OAAO,CAAC;AAQzG,OAAO,EAAE,KAAK,QAAQ,EAAU,GAAG,EAAS,MAAM,YAAY,CAAC;AAK/D,OAAO,EAGL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAiB,KAAK,kBAAkB,EAAoB,MAAM,qBAAqB,CAAC;AAI/F,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAI5C,OAAO,EAAE,KAAK,YAAY,EAAmC,MAAM,QAAQ,CAAC;AAK5E,OAAO,EAEL,KAAK,uBAAuB,EAK7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIV,KAAK,eAAe,IAAI,sBAAsB,EAC/C,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,KAAK,gBAAgB,EAMtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAQ7C,K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pD,CAAC;AAUF,KAAK,eAAe,GAAG,IAAI,CACzB,sBAAsB,EACtB,MAAM,GAAG,IAAI,GAAG,WAAW,GAAG,OAAO,GAAG,cAAc,GAAG,SAAS,CACnE,GAAG;IACF,mDAAmD;IACnD,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,QAAA,MAAM,UAAU;oDAA2D,eAAe;;CAiDzF,CAAC;AAkLF;;;;GAIG;AACH,QAAA,MAAM,YAAY;qBAAoB,IAAI,CAAC,eAAe;;CAQzD,CAAC;AAQF,eAAO,MAAM,IAAI;IACf,IAAI;IACJ,OAAO;;;IACP,OAAO;;;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;CACR,CAAC;AAEF,YAAY,EACV,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB,GACjB,CAAC"}
@@ -5,7 +5,7 @@ import { type Database } from '@dxos/echo';
5
5
  import { type ChatThreadController } from '@dxos/react-ui-assistant';
6
6
  import { type MessageRange } from '@dxos/react-ui-feed';
7
7
  import { type Message } from '@dxos/types';
8
- import { type AiChatProcessor } from '../../processor/index.ts';
8
+ import { type ChatModel } from '../../chat-model/index.ts';
9
9
  import { type ChatEvent } from './events.ts';
10
10
  /**
11
11
  * Wall-clock timestamps for the most-recent (or in-flight) request, lifted out of
@@ -28,8 +28,10 @@ export type ChatContextValue = {
28
28
  event: Event<ChatEvent>;
29
29
  db?: Database.Database;
30
30
  chat?: Chat.Chat;
31
- /** Undefined while the processor is still opening; the chat renders from the feed meanwhile. */
32
- processor?: AiChatProcessor;
31
+ /** Undefined while the chat model is still opening; the chat renders from the feed meanwhile. */
32
+ chatModel?: ChatModel;
33
+ /** Whether the conversation has begun; a boolean, so it changes once rather than per message. */
34
+ started: boolean;
33
35
  /** How many prompts wait behind the running turn; a count, so it changes per enqueue rather than per block. */
34
36
  queueSize: number;
35
37
  setController: (controller: ChatThreadController | null) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chat/context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACxB,EAAE,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACvB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;IACjB,gGAAgG;IAChG,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,+GAA+G;IAC/G,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI,KAAK,IAAI,CAAC;IACjE,eAAe,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,KAAK,IAAI,CA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yB;;IAAE,oBAAoB,kDAAuD,CAAC;AAErH;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC,CAAC;AAIF,eAAO,MAAO,yBAAyB;;IAAE,oBAAoB,kDAE3D,CAAC"}
@@ -16,7 +16,7 @@ export type ChatActionsProps = Util.ThemedClassName<PropsWithChildren<{
16
16
  customActions?: Atom.Atom<ActionGraphProps>;
17
17
  processing?: boolean;
18
18
  debug?: boolean;
19
- /** Whether the prompt holds text and the processor would accept it; drives the send control's enablement. */
19
+ /** Whether the prompt holds text and the chat model would accept it; drives the send control's enablement. */
20
20
  canSend?: boolean;
21
21
  /** Whether the checklist beside the prompt is shown; the toggle renders only when provided. */
22
22
  tasksVisible?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatActions.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatPrompt/ChatActions.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,IAAI,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,KAAK,gBAAgB,EAAiC,MAAM,qBAAqB,CAAC;AAI3F,OAAO,KAAK,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAKjD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AASnD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,eAAe,CACjD,iBAAiB,CAAC;IAChB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,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AAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACtC,CAAC,CACH,CAAC;AAEF,eAAO,MAAM,WAAW,+HAYrB,gBAAgB,sBA+DlB,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import type * as Util from '@dxos/react-ui/Util';
3
- import { type AiChatProcessor } from '../../processor/index.ts';
3
+ import { type ChatModel } from '../../chat-model/index.ts';
4
4
  export type ChatMcpErrorsProps = Util.ThemedClassName<{
5
- processor: AiChatProcessor;
5
+ chatModel: ChatModel;
6
6
  }>;
7
7
  /**
8
8
  * Inline banner that lists MCP servers that failed to connect during the most recent request.
9
9
  * The chat itself keeps working without these servers — this just lets the user see what was dropped.
10
10
  */
11
- export declare const ChatMcpErrors: ({ classNames, processor }: ChatMcpErrorsProps) => React.JSX.Element | null;
11
+ export declare const ChatMcpErrors: ({ classNames, chatModel }: ChatMcpErrorsProps) => React.JSX.Element | null;
12
12
  //# sourceMappingURL=ChatMcpErrors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMcpErrors.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatPrompt/ChatMcpErrors.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAK3C,OAAO,KAAK,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAIjD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,eAAe,CAAC;IACpD,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,8BAA+B,kBAAkB,6BAuC1E,CAAC"}
1
+ {"version":3,"file":"ChatMcpErrors.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatPrompt/ChatMcpErrors.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAK3C,OAAO,KAAK,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAIjD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,eAAe,CAAC;IACpD,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,8BAA+B,kBAAkB,6BAuC1E,CAAC"}
@@ -8,11 +8,13 @@ export type ChatOptionsProps = AssistantPreset.ChatPresetProps & {
8
8
  chat?: Chat.Chat;
9
9
  context?: AiContext.Binder;
10
10
  registry?: Registry.Registry;
11
+ /** Whether the conversation has begun; its agent is fixed from then on. */
12
+ started?: boolean;
11
13
  };
12
14
  /**
13
15
  * Manages the runtime context for the chat.
14
16
  */
15
- export declare const ChatOptions: ({ db, chat, context, registry, presets, preset, onPresetChange }: ChatOptionsProps) => JSX.Element;
17
+ export declare const ChatOptions: ({ db, chat, context, registry, started, presets, preset, onPresetChange, }: ChatOptionsProps) => JSX.Element;
16
18
  /** @private */
17
19
  export declare const ObjectsPanel: ({ db, context }: Pick<ChatOptionsProps, 'db' | 'context'>) => JSX.Element;
18
20
  //# sourceMappingURL=ChatOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatOptions.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatPrompt/ChatOptions.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,GAAG,EAAkC,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,QAAQ,EAAoB,KAAK,QAAQ,EAAa,MAAM,YAAY,CAAC;AA8BvF,OAAO,EAAoC,eAAe,EAAE,MAAM,QAAQ,CAAC;AAQ3E,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC,eAAe,GAAG;IAC/D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BAAgB,EAAE,IAAI,GAAG,SAAS,CAAC,KAAG,GAAG,CAAC,OA0F5F,CAAC"}
@@ -1,11 +1,10 @@
1
1
  import { type StoryObj } from '@storybook/react-vite';
2
2
  import React from 'react';
3
3
  import { type ChatOptionsProps } from './ChatOptions.tsx';
4
- type StoryArgs = Pick<ChatOptionsProps, 'presets'>;
5
- declare const DefaultStory: ({ presets }: StoryArgs) => React.JSX.Element;
4
+ type StoryArgs = Pick<ChatOptionsProps, 'presets' | 'started'>;
5
+ declare const DefaultStory: ({ presets, started }: StoryArgs) => React.JSX.Element;
6
6
  declare const meta: {
7
7
  title: string;
8
- component: any;
9
8
  render: typeof DefaultStory;
10
9
  decorators: import("@storybook/react").Decorator[];
11
10
  parameters: {
@@ -16,5 +15,7 @@ declare const meta: {
16
15
  export default meta;
17
16
  type Story = StoryObj<typeof meta>;
18
17
  export declare const Default: Story;
18
+ /** A chat that has begun shows its agent but no longer offers the others. */
19
+ export declare const Started: Story;
19
20
  export declare const _ObjectsPanel: Story;
20
21
  //# sourceMappingURL=ChatOptions.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatOptions.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatPrompt/ChatOptions.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAsBxC,OAAO,EAAe,KAAK,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAiBrF,KAAK,SAAS,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAEnD,QAAA,MAAM,YAAY,gBAAiB,SAAS,sBAsB3C,CAAC;AAEF,QAAA,MAAM,IAAI;;eAEkB,GAAG;;;;;;;CA0CM,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAe3B,CAAC"}
1
+ {"version":3,"file":"ChatOptions.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatPrompt/ChatOptions.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAuBxC,OAAO,EAAe,KAAK,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AA8BrF,KAAK,SAAS,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;AAE/D,QAAA,MAAM,YAAY,yBAA0B,SAAS,sBAuBpD,CAAC;AAEF,QAAA,MAAM,IAAI;;;;;;;;CAuD2B,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAe3B,CAAC"}
@@ -1,14 +1,15 @@
1
1
  import type * as Atom from 'effect/reactivity/Atom';
2
2
  import React from 'react';
3
+ import { type AiContext } from '@dxos/assistant';
3
4
  import type * as Chat from '@dxos/assistant/Chat';
4
5
  import { type Event } from '@dxos/async';
5
- import { type Database, Obj } from '@dxos/echo';
6
+ import { type Database, Obj, type Registry } from '@dxos/echo';
6
7
  import { type ChatEditorProps } from '@dxos/react-ui-chat';
7
8
  import type { ActionGraphProps } from '@dxos/react-ui-menu';
8
9
  import type * as Util from '@dxos/react-ui/Util';
9
10
  import { type Merge } from '@dxos/util';
10
11
  import { AssistantPreset } from '#types';
11
- import { type AiChatProcessor } from '../../processor/index.ts';
12
+ import { type ChatModel } from '../../chat-model/index.ts';
12
13
  import { type ChatEvent } from '../Chat/index.ts';
13
14
  /** Prompts that may wait behind a running turn, by default. */
14
15
  export declare const DEFAULT_MAX_QUEUE = 3;
@@ -18,8 +19,15 @@ export type ChatPromptProps = Merge<Util.ThemedClassName<{
18
19
  expandable?: boolean;
19
20
  db?: Database.Database;
20
21
  chat?: Chat.Chat;
21
- /** Undefined while the processor is still opening: the prompt takes text but holds it until then. */
22
- processor?: AiChatProcessor;
22
+ /** Undefined while the chat model is still opening: the prompt takes text but holds it until then. */
23
+ chatModel?: ChatModel;
24
+ /**
25
+ * Bindings for a draft with no chat model, whose caller handles the submit event: backs the context
26
+ * controls and lets the prompt send.
27
+ */
28
+ context?: AiContext.Binder;
29
+ /** Skill registry for the context controls when there is no chat model. */
30
+ registry?: Registry.Registry;
23
31
  event: Event<ChatEvent>;
24
32
  /** Whether the checklist beside the prompt is shown; the toggle renders only when provided. */
25
33
  tasksVisible?: boolean;
@@ -39,10 +47,12 @@ export type ChatPromptProps = Merge<Util.ThemedClassName<{
39
47
  queueSize?: number;
40
48
  /** The most prompts that may wait behind a running turn; past it the prompt takes no more until one is taken up. */
41
49
  maxQueue?: number;
50
+ /** Whether the conversation has begun, which fixes its agent. */
51
+ started?: boolean;
42
52
  /** Object the chat is attached to; its project instructions (if any) supply sentinel-command completion. */
43
53
  companionTo?: Obj.Unknown;
44
54
  }>, AssistantPreset.ChatPresetProps>;
45
- export declare function ChatPrompt({ classNames, outline, db, chat, processor, event, tasksVisible, attendableId, customActions, nodeId, placeholder, autoFocus, queueSize, maxQueue, settings, presets, preset, companionTo, onPresetChange, }: ChatPromptProps): React.JSX.Element;
55
+ export declare function ChatPrompt({ classNames, outline, db, chat, chatModel, context: draftContext, registry: draftRegistry, event, tasksVisible, attendableId, customActions, nodeId, placeholder, autoFocus, queueSize, maxQueue, settings, presets, preset, companionTo, started, onPresetChange, }: ChatPromptProps): React.JSX.Element;
46
56
  export declare namespace ChatPrompt {
47
57
  var displayName: string;
48
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChatPrompt.d.ts","source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CAAC;IACnB,oHAAoH;IACpH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4GAA4G;IAC5G,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CAC3B,CAAC,EACF,eAAe,CAAC,eAAe,CAChC,CAAC;mCAEyB,EACzB,UAAU,EACV,OAAO,EACP,EAAE,EACF,IAAI,EACJ,SAAS,EACT,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,aAAa,EACvB,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,SAAgB,EAChB,SAAa,EACb,QAA4B,EAC5B,QAAe,EACf,OAAO,EACP,MAAM,EACN,WAAW,EACX,OAAO,EACP,cAAc,GACf,EAAE,eAAe"}
@@ -11,7 +11,7 @@ type StoryArgs = {
11
11
  /** Prompts already queued on the feed, as a submit-while-busy leaves them. */
12
12
  queued?: string[];
13
13
  /**
14
- * Holds the processor `active` while leaving `streaming` false — a turn parked in a tool call.
14
+ * Holds the chat model `active` while leaving `streaming` false — a turn parked in a tool call.
15
15
  * This is the state the send/stop control has to get right, and no scripted model can hold it
16
16
  * still long enough to assert against.
17
17
  */
@@ -39,7 +39,7 @@ export type ChatStatusViewProps = ChatStreamStatusProps & {
39
39
  export declare const ChatStatus: ({ classNames, icon }: ChatStreamStatusProps) => React.JSX.Element;
40
40
  /**
41
41
  * The pill itself, given resolved values. Split from {@link ChatStatus} so each slot — elapsed,
42
- * tokens, the next alarm — can be mounted and asserted in a story without a live processor.
42
+ * tokens, the next alarm — can be mounted and asserted in a story without a live chat model.
43
43
  */
44
44
  export declare const ChatStatusView: ({ classNames, icon, requestTiming, lastOutputTokens, sessionTotalTokens, alarm, selfWakes, }: ChatStatusViewProps) => React.JSX.Element | null;
45
45
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ChatStatus.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatPrompt/ChatStatus.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAM5D,OAAO,KAAK,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAIjD,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,oBAAoB,CAAC;AAKlF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,eAAe,CAAC;IACvD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG;IACxD,2EAA2E;IAC3E,aAAa,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzC,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,yGAAyG;IACzG,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,yBAA0B,qBAAqB,sBAqCrE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,iGAQxB,mBAAmB,6BAiErB,CAAC;AAwBF;;;GAGG;AACH,eAAO,MAAM,YAAY,WAAY,MAAM,KAAG,MAC0C,CAAC"}
1
+ {"version":3,"file":"ChatStatus.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatPrompt/ChatStatus.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAO5D,OAAO,KAAK,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAIjD,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,oBAAoB,CAAC;AAKlF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,eAAe,CAAC;IACvD,IAA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