@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
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunk-processor.mjs","names":[],"sources":["../../src/processor/outbox.ts","../../src/util/error-cause.ts","../../src/processor/prompt.ts","../../src/processor/thread.ts","../../src/processor/processor.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Atom from 'effect/reactivity/Atom';\nimport type * as AtomRegistry from 'effect/reactivity/AtomRegistry';\n\nimport { Obj } from '@dxos/echo';\nimport { BaseError } from '@dxos/errors';\nimport { log } from '@dxos/log';\nimport { type ContentBlock } from '@dxos/types';\n\n/** How far this client got with a prompt; what the agent did with it is read from the feed. */\nexport type OutboxState = 'sending' | 'submitted' | 'failed';\n\n/**\n * A prompt the reader sent from this chat, held from the moment of submit — before anything is\n * persisted — so the thread can show it at once. The thread reconciles it against the feed's queue\n * entry and the turn the agent runs from it (see `projectThread`).\n */\nexport type OutboxEntry = {\n /** The identity of the prompt's thread row for its whole life, so the row never remounts. */\n readonly id: string;\n readonly created: string;\n /** The prompt's content exactly as it is submitted, so the persisted copy renders the same. */\n readonly blocks: readonly ContentBlock.Any[];\n /** Feed messages that existed at submit: an identical earlier prompt is never this one's echo. */\n readonly known: ReadonlySet<string>;\n readonly state: OutboxState;\n readonly error?: Error;\n};\n\n/** Hands one prompt to the agent: resolves once the agent holds it, rejects if it never will. */\nexport type OutboxDispatch<T> = (payload: T) => Promise<void>;\n\n/** A dispatch stopped before the prompt reached the agent, by the reader: the prompt is dropped, not failed. */\nexport class PromptCancelledError extends BaseError.extend(\n 'PromptCancelledError',\n 'Prompt cancelled before it was sent.',\n) {}\n\n/**\n * The prompts this client has sent, in submit order.\n *\n * Dispatches run one at a time, each waiting only until the previous prompt is in the agent's hands\n * (not for its turn): two submits racing to the agent would otherwise reach its queue in whichever\n * order their round trips landed. A failure does not hold up the prompts behind it.\n */\nexport class Outbox<T> {\n // Kept alive: the outbox is the only record of a prompt still being dispatched, and an atom nothing\n // subscribes to is reset by the registry — between two submits with the thread unmounted, say.\n readonly entries = Atom.make<readonly OutboxEntry[]>([]).pipe(Atom.keepAlive);\n\n readonly #payloads = new Map<string, T>();\n #tail: Promise<void> = Promise.resolve();\n\n constructor(\n private readonly _registry: AtomRegistry.AtomRegistry,\n private readonly _dispatch: OutboxDispatch<T>,\n ) {}\n\n /** Settles once every dispatch scheduled so far has settled. */\n get idle(): Promise<void> {\n return this.#tail;\n }\n\n get(id: string): OutboxEntry | undefined {\n return this._registry.get(this.entries).find((entry) => entry.id === id);\n }\n\n /** Appends the prompt synchronously, then dispatches it behind any already sending. */\n add(payload: T, { blocks, known }: Pick<OutboxEntry, 'blocks' | 'known'>): OutboxEntry {\n const entry: OutboxEntry = {\n id: Obj.ID.random(),\n created: new Date().toISOString(),\n blocks,\n known,\n state: 'sending',\n };\n this.#payloads.set(entry.id, payload);\n this._registry.update(this.entries, (entries) => [...entries, entry]);\n this.#schedule(entry.id);\n return entry;\n }\n\n remove(id: string): void {\n this.#payloads.delete(id);\n this._registry.update(this.entries, (entries) => entries.filter((entry) => entry.id !== id));\n }\n\n #schedule(id: string): void {\n this.#tail = this.#tail.then(() => this.#send(id));\n }\n\n async #send(id: string): Promise<void> {\n const payload = this.#payloads.get(id);\n if (payload === undefined || this.get(id)?.state !== 'sending') {\n return;\n }\n\n try {\n await this._dispatch(payload);\n this.#patch(id, { state: 'submitted' });\n } catch (err) {\n if (err instanceof PromptCancelledError) {\n this.remove(id);\n return;\n }\n\n log.warn('prompt was not sent', { error: err });\n this.#patch(id, { state: 'failed', error: err instanceof Error ? err : new Error(String(err)) });\n }\n }\n\n #patch(id: string, patch: Pick<OutboxEntry, 'state' | 'error'>): void {\n this._registry.update(this.entries, (entries) =>\n entries.map((entry) => (entry.id === id ? { ...entry, ...patch } : entry)),\n );\n }\n}\n","//\n// Copyright 2026 DXOS.org\n//\n\n/** Walk an error's `cause` chain and return the first value matching `predicate`. */\nexport const findInCause = <T>(error: unknown, predicate: (value: unknown) => value is T): T | undefined => {\n let current: unknown = error;\n // Guard against self-referential / cyclic `cause` chains so traversal always terminates.\n const visited = new Set<unknown>();\n while (current) {\n if (visited.has(current)) {\n break;\n }\n visited.add(current);\n if (predicate(current)) {\n return current;\n }\n current = current instanceof Error ? current.cause : undefined;\n }\n return undefined;\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport { ContentBlock } from '@dxos/types';\nimport { trim } from '@dxos/util';\n\n/** Ephemeral, per-request context captured at submit time (not part of the durable chat state). */\nexport type ProcessorRequestContext = {\n selection?: {\n /** Anchor strings (`\"${from}:${to}\"` cursor pairs) the text was resolved from; enables future in-place actions. */\n anchors: string[];\n text: string;\n };\n};\n\n/**\n * Prompt content for a request: the bare message, or — when the request carries selection context —\n * a synthetic block (system-generated user-turn content, hidden from the summary view) ahead of it.\n * A synthetic request is itself system-generated (a completed inline flow reporting itself), so it\n * becomes one synthetic block rather than words the reader appears to have typed.\n */\nexport const createPromptContent = (request: {\n message: string;\n disposition?: ContentBlock.Text['disposition'];\n context?: ProcessorRequestContext;\n}): string | ContentBlock.Any[] => {\n if (request.disposition === 'synthetic') {\n return [ContentBlock.Text.make({ text: request.message, disposition: 'synthetic' })];\n }\n\n const selection = request.context?.selection;\n if (!selection?.text.length) {\n return request.message;\n }\n\n return [\n ContentBlock.Text.make({\n disposition: 'synthetic',\n text: trim`\n The user's current selection in the document they are viewing:\n <selection>\n ${selection.text}\n </selection>\n `,\n }),\n ContentBlock.Text.make({ text: request.message }),\n ];\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Array from 'effect/Array';\nimport * as Order from 'effect/Order';\n\nimport { type Alarm, isConsumed, isInFlight, isQueued } from '@dxos/assistant';\nimport { Annotation, Feed, Obj } from '@dxos/echo';\nimport { DeliveryAnnotation, type DeliveryStatus } from '@dxos/react-ui-assistant/types';\nimport { type ContentBlock, Message } from '@dxos/types';\n\nimport { type OutboxEntry } from './outbox.ts';\n\n/**\n * Append order for {@link Feed.history}, which walks lineage positionally rather than by time.\n *\n * Position is authoritative but server-assigned: locally-written blocks — and every block until a\n * position authority acknowledges them — report `+Infinity`, and a query returns an unordered set, so\n * position alone leaves them in arbitrary order. `created` breaks those ties: sound locally, where one\n * conversation's messages come off one clock, and consulted only when position cannot decide.\n */\nexport const byAppendOrder: Order.Order<Message.Message> = (a, b) => {\n const positionA = Feed.getPosition(a);\n const positionB = Feed.getPosition(b);\n if (positionA !== positionB) {\n return positionA < positionB ? -1 : 1;\n }\n return a.created < b.created ? -1 : a.created > b.created ? 1 : 0;\n};\n\n/** What the thread knows about a row standing for a prompt on its way to the agent. */\nexport type DeliveryRow = {\n status: DeliveryStatus;\n /** The client's outbox entry, for a prompt sent from this chat. */\n outboxId?: string;\n /** The agent's queue entry in the feed, once it has landed. */\n entryId?: string;\n /** The user message of the turn the agent ran from it, once that has landed. */\n turnId?: string;\n};\n\nexport type ThreadProjection = {\n /**\n * The rows to render, in order: the turns, then the prompts the agent has not taken up yet.\n * A prompt is ONE row from submit to its turn — keyed by its outbox id, or its queue entry's id\n * after a reload — so it never shows twice and never remounts as the copies of it land.\n */\n messages: Message.Message[];\n /** Delivery state of the rows standing for prompts, by row id. */\n delivery: ReadonlyMap<string, DeliveryRow>;\n /** Prompts still waiting for the agent (sent or delivered, not yet read). */\n queued: number;\n /** How many rows at the end of {@link messages} are prompts not yet in the history. */\n tail: number;\n};\n\n/** A chat with nothing in it yet. */\nexport const EMPTY_THREAD: ThreadProjection = { messages: [], delivery: new Map(), queued: 0, tail: 0 };\n\n/**\n * The turns a thread should render: those reachable from the feed's head, so a rewind's abandoned turns\n * disappear from the view exactly as they disappear from the model's history — followed by the prompts\n * still on their way to the agent, each with its delivery status.\n *\n * A pending `rewindFrom` truncates the view to what precedes it — the rewound-to prompt and everything\n * after it, since the point of rewinding to a prompt is to re-ask it. The pointer is cleared by the next\n * append (which turns the fork into lineage), so a rewind that is never followed through stays visible\n * as a truncated thread with the prompt restored in the composer.\n *\n * A prompt sent from this chat ({@link OutboxEntry}) is reconciled against the feed in three steps:\n * the client holds it (`sent`), the agent's queue entry lands (`delivered`), and the agent takes it\n * up, marking the entry in flight and appending the turn's own user message (`read`). Each copy is\n * matched to the earliest unclaimed feed message carrying the prompt's blocks that did not exist at\n * submit, so identical prompts pair up in order.\n */\nexport const projectThread = ({\n feedMessages,\n pendingMessages = [],\n rewindFrom,\n outbox = [],\n}: {\n feedMessages: readonly Message.Message[];\n /** Messages produced by the current turn that are not in the feed yet. */\n pendingMessages?: readonly Message.Message[];\n /** Earliest message a pending rewind discards. */\n rewindFrom?: string;\n /** Prompts sent from this chat, in submit order. */\n outbox?: readonly OutboxEntry[];\n}): ThreadProjection => {\n const all = Array.dedupeWith([...feedMessages, ...pendingMessages], ({ id: a }, { id: b }) => a === b);\n // A turn's messages that the feed has not caught up with yet continue from the thread's head, so\n // they follow the lineage rather than join it: with no parent of their own, lineage would chain them\n // to whatever sorts before them, which after a rewind is the abandoned reply.\n const feedIds = new Set(feedMessages.map((message) => message.id));\n const unrecorded = Array.sort(\n Array.dedupeWith(\n pendingMessages.filter((message) => !feedIds.has(message.id) && !isQueued(message)),\n ({ id: a }, { id: b }) => a === b,\n ),\n byAppendOrder,\n );\n // A queue entry is not a turn: the turn the agent runs from one appends its own user message, so an\n // entry never joins the history. Until the agent takes it up, it is a row after the history instead.\n const sorted = Array.sort(\n feedMessages.filter((message) => !isQueued(message)),\n byAppendOrder,\n );\n const entries = Array.sort(\n all.filter((message) => isQueued(message)),\n byAppendOrder,\n );\n\n const history = projectHistory(sorted, unrecorded, rewindFrom);\n // The turn's own user message may still be only in the streaming turn, ahead of the feed.\n const turnCandidates = [...sorted, ...unrecorded];\n const claimed = new Set<string>();\n const claim = (candidates: readonly Message.Message[], entry: OutboxEntry): Message.Message | undefined => {\n const match = candidates.find(\n (message) => !claimed.has(message.id) && !entry.known.has(message.id) && carries(message, entry.blocks),\n );\n if (match) {\n claimed.add(match.id);\n }\n return match;\n };\n\n const delivery = new Map<string, DeliveryRow>();\n // Turns that are this chat's own prompts, swapped for the prompt's row so the row keeps its identity.\n const turns = new Map<string, Message.Message>();\n const tail: Message.Message[] = [];\n const sent: Message.Message[] = [];\n for (const entry of outbox) {\n const queueEntry = claim(entries, entry);\n const turn = claim(turnCandidates, entry);\n const status: DeliveryStatus =\n turn || (queueEntry && (isInFlight(queueEntry) || isConsumed(queueEntry)))\n ? 'read'\n : queueEntry\n ? 'delivered'\n : entry.state === 'failed'\n ? 'failed'\n : 'sent';\n\n const row = deliveryRow(entry.id, turn ?? queueEntry ?? entry, entry.created, status);\n delivery.set(entry.id, { status, outboxId: entry.id, entryId: queueEntry?.id, turnId: turn?.id });\n if (turn) {\n turns.set(turn.id, row);\n } else {\n // Read but with no turn yet: the turn's message replicates separately and can trail the mark.\n sent.push(row);\n }\n }\n\n // Waiting entries this chat did not send (another device, or a reload) — they predate the outbox.\n for (const entry of entries) {\n if (!claimed.has(entry.id) && !isConsumed(entry) && !isInFlight(entry)) {\n tail.push(deliveryRow(entry.id, entry, entry.created, 'delivered'));\n delivery.set(entry.id, { status: 'delivered', entryId: entry.id });\n }\n }\n tail.push(...sent);\n\n const messages = [...history.map((message) => turns.get(message.id) ?? message), ...tail];\n const queued = tail.filter((row) => {\n const status = delivery.get(row.id)?.status;\n return status === 'sent' || status === 'delivered';\n }).length;\n\n return { messages, delivery, queued, tail: tail.length };\n};\n\nconst projectHistory = (\n sorted: readonly Message.Message[],\n unrecorded: readonly Message.Message[],\n rewindFrom: string | undefined,\n): Message.Message[] => {\n if (rewindFrom !== undefined) {\n const index = sorted.findIndex((message) => message.id === rewindFrom);\n if (index === 0) {\n // Rewound to the first turn: nothing precedes it.\n return collapseToolRuns(unrecorded);\n }\n // Once a recorded message continues from the rewind head the fork is lineage, whether or not the\n // pointer has been cleared yet.\n if (index > 0 && !sorted.slice(index + 1).some((message) => Feed.getParent(message) === sorted[index - 1].id)) {\n return collapseToolRuns([...Feed.history(sorted, { head: sorted[index - 1].id }).items, ...unrecorded]);\n }\n // Not present — a stale pointer (e.g. the message never replicated) — or already continued; fall\n // through to the feed's own lineage rather than blanking the thread.\n }\n\n return collapseToolRuns([...Feed.history(sorted).items, ...unrecorded]);\n};\n\n/**\n * Whether a feed message is a copy of the prompt `blocks`: the queue entry carries them as they are,\n * and the turn's user message carries them after whatever the agent prepends (object versions).\n */\nconst carries = (message: Message.Message, blocks: readonly ContentBlock.Any[]): boolean => {\n if (message.sender.role !== 'user') {\n return false;\n }\n\n const texts = message.blocks.flatMap((block) => (block._tag === 'text' ? [textKey(block)] : []));\n const wanted = blocks.flatMap((block) => (block._tag === 'text' ? [textKey(block)] : []));\n return wanted.length > 0 && wanted.every((key, index) => texts[texts.length - wanted.length + index] === key);\n};\n\nconst textKey = (block: ContentBlock.Text): string => `${block.disposition ?? ''}:${block.text}`;\n\n/** The row last built for a source, reused while its status holds so an unchanged row is not re-rendered. */\nconst deliveryRows = new WeakMap<object, { id: string; status: DeliveryStatus; row: Message.Message }>();\n\n/**\n * The row a prompt renders as: its content from the latest copy of it, under the row's own id, marked\n * with its delivery status for the renderer's ticks.\n */\nconst deliveryRow = (\n id: string,\n source: Pick<Message.Message, 'blocks'>,\n created: string,\n status: DeliveryStatus,\n): Message.Message => {\n const cached = deliveryRows.get(source);\n if (cached && cached.id === id && cached.status === status) {\n return cached.row;\n }\n\n const row = Message.make({ id, created, sender: { role: 'user' }, blocks: [...source.blocks] });\n Obj.update(row, (row) => Annotation.set(row, DeliveryAnnotation, status));\n deliveryRows.set(source, { id, status, row });\n return row;\n};\n\n/**\n * Alarms that have woken the agent since the last prompt the user typed: the count the runtime caps at\n * `Alarm.MAX_SELF_WAKES`, read from the feed so the status can show it.\n */\nexport const projectSelfWakes = ({\n feedAlarms,\n messages,\n}: {\n feedAlarms: readonly Alarm.Alarm[];\n messages: readonly Message.Message[];\n}): number => {\n const lastPrompt = messages.findLast(\n (message) =>\n message.sender.role === 'user' &&\n message.blocks.some((block) => block._tag === 'text' && block.disposition !== 'synthetic'),\n );\n const since = lastPrompt?.created ?? '';\n return feedAlarms.filter((alarm) => isConsumed(alarm) && alarm.created >= since).length;\n};\n\n/**\n * The alarms still waiting to fire, earliest first: those the agent has not consumed and (for a\n * cancelled one) not removed from the feed.\n */\nexport const projectAlarms = ({ feedAlarms }: { feedAlarms: readonly Alarm.Alarm[] }): Alarm.Alarm[] =>\n Array.sort(\n feedAlarms.filter((alarm) => !isConsumed(alarm)),\n Order.mapInput(Order.Number, (alarm: Alarm.Alarm) => alarm.wakeAt),\n );\n\n/**\n * Blocks that are the machinery of a turn rather than anything the reader wrote or read.\n *\n * `reasoning` and `status` are machinery too: the model explains itself and narrates what it is\n * about to do between calls, so a run of calls is interleaved with both and treating either as prose\n * would split every run into one panel per call. A tool result recovered across a reload arrives as\n * a synthetic text block rather than a tool result (its call id can no longer be answered), which is\n * machinery on the same grounds.\n */\nconst TOOL_BLOCKS = new Set(['toolCall', 'toolResult', 'stats', 'reasoning', 'status']);\n\nconst isMachinery = (block: Message.Message['blocks'][number]): boolean =>\n TOOL_BLOCKS.has(block._tag) ||\n (block._tag === 'text' && (block as { disposition?: string }).disposition === 'synthetic');\n\nconst isToolOnly = (message: Message.Message): boolean =>\n message.blocks.length > 0 && message.blocks.every(isMachinery);\n\n/** A folded run and the messages it was folded from, keyed by the run's first message. */\nconst foldedRuns = new WeakMap<Message.Message, { run: readonly Message.Message[]; folded: Message.Message }>();\n\n/**\n * The run folded into one message, reusing the previous fold while the run holds the same messages:\n * the thread re-projects on every streamed block, and a fresh object per pass made every tool panel\n * in the thread look changed, re-rendering all of them for each block of the current turn.\n */\nconst foldRun = (run: readonly Message.Message[]): Message.Message => {\n const [first] = run;\n const cached = foldedRuns.get(first);\n if (cached && cached.run.length === run.length && cached.run.every((message, index) => message === run[index])) {\n return cached.folded;\n }\n\n const folded = { ...first, blocks: run.flatMap((entry) => entry.blocks) } as Message.Message;\n foldedRuns.set(first, { run, folded });\n return folded;\n};\n\n/**\n * Folds each run of tool-only messages into one, so a multi-step turn renders as a single panel.\n *\n * The runtime delivers one block per message, so without this a turn is one row per call and the\n * panel's summary cannot count the run it belongs to. The run's first message supplies the identity,\n * keeping the row stable as the run grows and leaving `data-object-id` pointing at a real object.\n */\nexport const collapseToolRuns = (messages: readonly Message.Message[]): Message.Message[] => {\n const collapsed: Message.Message[] = [];\n // The messages each entry was folded from, so a later result can join the fold that holds its call.\n const sources: (readonly Message.Message[])[] = [];\n for (let index = 0; index < messages.length; index++) {\n const message = messages[index];\n if (!isToolOnly(message)) {\n collapsed.push(message);\n sources.push([message]);\n continue;\n }\n\n let end = index;\n while (end + 1 < messages.length && isToolOnly(messages[end + 1])) {\n end++;\n }\n const run = messages.slice(index, end + 1);\n index = end;\n\n // A result held apart from its call by the request card that asked about it joins the call's panel; on its\n // own it renders as an empty row.\n const results = run.flatMap((entry) => entry.blocks);\n const callIds = new Set(results.map((block) => (block._tag === 'toolResult' ? block.toolCallId : undefined)));\n const caller = results.every((block) => block._tag === 'toolResult')\n ? collapsed.findLastIndex((earlier) =>\n earlier.blocks.some((block) => block._tag === 'toolCall' && callIds.has(block.toolCallId)),\n )\n : -1;\n if (caller >= 0) {\n sources[caller] = [...sources[caller], ...run];\n collapsed[caller] = foldRun(sources[caller]);\n } else {\n collapsed.push(run.length === 1 ? message : foldRun(run));\n sources.push(run);\n }\n }\n\n return collapsed;\n};\n\n/**\n * What a rewind to `messageId` implies: the messages to discard from, and the prompt text to restore so\n * the user can edit and resend it.\n *\n * Returns `undefined` when the message is absent, so a stale click is a no-op rather than a truncation.\n */\nexport const resolveRewind = (\n messages: readonly Message.Message[],\n messageId: string,\n): { rewindFrom: string; text: string } | undefined => {\n const message = messages.find((candidate) => candidate.id === messageId);\n if (!message) {\n return undefined;\n }\n return { rewindFrom: messageId, text: Message.extractText(message) };\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport * as AiError from 'effect/ai/AiError';\nimport * as Cause from 'effect/Cause';\nimport * as Effect from 'effect/Effect';\nimport * as Exit from 'effect/Exit';\nimport * as Fiber from 'effect/Fiber';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\nimport * as Atom from 'effect/reactivity/Atom';\nimport * as AtomRegistry from 'effect/reactivity/AtomRegistry';\nimport * as Stream from 'effect/Stream';\n\nimport { AiModelNotAvailableError, type AiService, Model, type OpaqueToolkit } from '@dxos/ai';\nimport * as Capabilities from '@dxos/app-framework/Capabilities';\nimport {\n AiContext,\n AiSession,\n Harness,\n ToolExecutionServices,\n createSystemPrompt,\n formatSystemPrompt,\n} from '@dxos/assistant';\nimport type * as Chat from '@dxos/assistant/Chat';\nimport * as AgentService from '@dxos/compute/AgentService';\nimport type * as Credential from '@dxos/compute/Credential';\nimport type * as Instructions from '@dxos/compute/Instructions';\nimport * as Operation from '@dxos/compute/Operation';\nimport type * as ServiceResolver from '@dxos/compute/ServiceResolver';\nimport * as Trace from '@dxos/compute/Trace';\nimport { Database, Feed, Filter, Obj, Query, Ref, type Registry } from '@dxos/echo';\nimport { UsageQuotaExceededError } from '@dxos/edge-client';\nimport * as EffectEx from '@dxos/effect/EffectEx';\nimport { DXN } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { ContentBlock, Message } from '@dxos/types';\nimport { markWork } from '@dxos/util';\n\nimport { AssistantOperation } from '#types';\n\nimport { findInCause } from '../util/error-cause.ts';\nimport { Outbox, type OutboxEntry, PromptCancelledError } from './outbox.ts';\nimport { providerForModel } from './presets.ts';\nimport { type ProcessorRequestContext, createPromptContent } from './prompt.ts';\nimport { EMPTY_THREAD, type ThreadProjection, projectThread } from './thread.ts';\n\n/**\n * Space-scoped services materialised by the layer passed into\n * {@link AiChatProcessor}. Mirrors the tag list that\n * {@link useChatProcessor} passes to {@link ServiceResolver.provide}.\n */\nexport type SpaceServices =\n | Database.Service\n | Credential.CredentialsService\n | AiService.AiService\n | AgentService.AgentService\n | Registry.Service\n | OpaqueToolkit.OpaqueToolkitProvider;\n\nexport type AiChatProcessorOptions = {\n /**\n * The model the chat's picker shows selected. The agent process reads the model off the chat, so\n * this is stamped onto a chat that has not selected one before its first request — otherwise the\n * picker and the process would disagree about what the conversation runs on.\n */\n model?: DXN.DXN;\n // The provider is a global setting rather than the chat's, carried so the agent process resolves\n // the (provider, id) pair — the catalog's shared model ids are ambiguous without it.\n provider?: DXN.DXN;\n modelRegistry?: Model.Registry;\n registry?: Registry.Registry;\n observableRegistry?: AtomRegistry.AtomRegistry;\n /**\n * For tracing.\n */\n chat?: Ref.Ref<Chat.Chat>;\n system?: string;\n /** Who this processor's prompts come from, when the chat is one of several people's with one agent. */\n sender?: AgentService.PromptSender;\n};\n\nconst defaultOptions: Partial<AiChatProcessorOptions> = {\n model: Model.DEFAULT_EDGE,\n};\n\nexport type ProcessorRequestOptions = {};\n\nexport type ProcessorRequest = {\n message: string;\n /** `synthetic` marks system-generated turn content (e.g. a completed inline flow reporting itself). */\n disposition?: ContentBlock.Text['disposition'];\n /** Ephemeral context (e.g. companion-document selection) captured at submit time. */\n context?: ProcessorRequestContext;\n options?: ProcessorRequestOptions;\n};\n\nexport type ProcessorSendOptions = {\n /**\n * Runs before the prompt is dispatched — after it is already showing — and a rejection fails the\n * prompt. Lets a transient chat persist and flush its conversation feed so the agent can resolve it.\n */\n prepare?: () => Promise<void> | void;\n};\n\n/** Settles the dispatch of one prompt: resolved once the agent holds it, rejected if it never will. */\nexport type PromptSubmission = { resolve: () => void; reject: (error: unknown) => void };\n\ntype OutboxPayload = { request: ProcessorRequest; prepare?: () => Promise<void> | void };\n\n/** User-facing message shown when an AI request is rejected for exceeding the account usage quota (HTTP 429). */\nconst QUOTA_EXCEEDED_MESSAGE = 'You have reached your AI usage limit for this period.';\n\n/** An actionable next-step a chat error surfaces in its toast; the label key is resolved by the chat UI. */\nexport type ChatErrorAction = { readonly labelKey: string };\n\n/**\n * Display error for an over-quota (HTTP 429) rejection. Declares an {@link action} so the chat toast can\n * offer a usage-dashboard link declaratively — the UI renders whatever action an error declares rather\n * than branching on the error type.\n */\nexport class AiUsageQuotaError extends Error {\n readonly action: ChatErrorAction = { labelKey: 'view-usage.label' };\n}\n\n/**\n * Matches an over-quota rejection (EDGE responds 429) in error text. The typed\n * {@link UsageQuotaExceededError} is wrapped deep in the cause chain and does not survive the\n * agent-process boundary — the failure is rendered to a string via `Cause.pretty`, which drops\n * nested causes — so detection also relies on the HTTP 429 that `@effect/ai`'s\n * {@link AiError.HttpResponseError} embeds in its message (e.g. \"... (429 POST ...\").\n */\nconst QUOTA_PATTERN = /\\b429\\b|rate.?limit|too many requests|usage quota|quota exceeded/i;\n\n/** Whether an error denotes an over-quota (HTTP 429) rejection, detected by typed status or message text. */\nconst isQuotaError = (err: unknown): boolean => {\n if (AiError.isAiError(err)) {\n // v4 classifies the failure semantically on `reason` rather than by status; these are the two\n // shapes a 429 arrives as.\n if (err.reason._tag === 'RateLimitError' || err.reason._tag === 'QuotaExhaustedError') {\n return true;\n }\n return QUOTA_PATTERN.test(describeAiError(err));\n }\n return typeof err === 'string' && QUOTA_PATTERN.test(err);\n};\n\n/** `description` is declared on only some reason variants; the wrapper's `message` is the fallback. */\nconst describeAiError = (err: AiError.AiError): string =>\n ('description' in err.reason ? err.reason.description : undefined) ?? err.message;\n\n/**\n * Matches an {@link AiModelNotAvailableError} in error text. Like the quota case, the typed error\n * does not always survive the agent-process boundary — the failure is rendered with `Cause.pretty`,\n * which drops nested causes — so detection also reads the message it stringifies to.\n */\nconst MODEL_UNAVAILABLE_PATTERN = /AI Model not available:\\s*(\\S+?):?(?=\\s|$)/i;\n\n/** The displayable text of a failure, which reaches the chat either typed or already stringified. */\nconst errorText = (err: unknown): string => (typeof err === 'string' ? err : err instanceof Error ? err.message : '');\n\n/** The model of a model-unavailable rejection, by typed context or message text. */\nconst unavailableModel = (err: unknown): string | undefined => {\n const typed = findInCause(err, AiModelNotAvailableError.is);\n if (typed) {\n return String(typed.context.model);\n }\n return errorText(err).match(MODEL_UNAVAILABLE_PATTERN)?.[1];\n};\n\n/**\n * Maps a failure from the agent fiber to an error suitable for display.\n * An over-quota (HTTP 429) rejection is surfaced as an actionable usage-limit message; the typed\n * {@link UsageQuotaExceededError} only survives on the direct path, so {@link isQuotaError} also\n * recognizes the stringified 429 the chat receives across the agent-process boundary.\n * A model the configured provider does not serve names that model, since the fix is to pick another\n * one in settings.\n * Other {@link AiError}s originate from the AI service and are actionable by the user\n * (e.g., \"model 'x' not found\", \"Connection refused\"), so their detail is propagated.\n * Any other failure is treated as an internal/unexpected error and reported generically\n * to avoid leaking implementation detail.\n */\nexport const parseError = (err: unknown): Error => {\n const quotaError = findInCause(err, UsageQuotaExceededError.is);\n if (quotaError || isQuotaError(err)) {\n return new AiUsageQuotaError(quotaError?.message?.trim() || QUOTA_EXCEEDED_MESSAGE, { cause: err });\n }\n\n const model = unavailableModel(err);\n if (model) {\n return new Error(`The model is not available: ${model}`, { cause: err });\n }\n\n let message: string | undefined;\n if (AiError.isAiError(err)) {\n message = describeAiError(err).trim();\n } else if (typeof err === 'string') {\n // TODO(burdon): This is brittle.\n // UnknownError: ChatCompletionsClient.streamText: model 'gemma3:27b' not found\n const [, model] = err.match(/model\\s+'([^']+)'\\s+not\\s+found/i) || [];\n if (model) {\n message = `The model is not available: ${model}`;\n }\n }\n\n if (!message) {\n message = 'An unexpected error occurred.';\n }\n\n return new Error(message, { cause: err });\n};\n\n/**\n * Handles interactions with the AI service.\n * Uses AgentService to spawn a process-backed agent and subscribes to ephemeral trace events for streaming.\n */\nexport class AiChatProcessor {\n readonly #registry: AtomRegistry.AtomRegistry;\n\n /** Pending messages (finalized, non-streaming). */\n readonly #pending = Atom.make<Message.Message[]>([]);\n\n /** Currently streaming messages (from ephemeral trace events). */\n readonly #streaming = Atom.make<Message.Message[]>([]);\n\n /** Set of message IDs that have been finalized (non-pending delivered via ephemeral). */\n readonly #finalizedIds = new Set<string>();\n\n /** Currently active request fiber. */\n #requestFiber: Fiber.Fiber<void, unknown> | undefined;\n\n /** Fiber following a turn this processor did not issue ({@link adopt}). */\n #observeFiber: Fiber.Fiber<void, unknown> | undefined;\n\n /** Last request (for retries). */\n #lastRequest: ProcessorRequest | undefined;\n\n /** Streaming state. */\n public readonly streaming = Atom.make<boolean>((get) => get(this.#streaming).length > 0);\n\n /** Active state. */\n public readonly active = Atom.make(false);\n\n /** Array of Messages (incl. the current message being streamed). */\n public readonly messages = Atom.make<Message.Message[]>((get) => [...get(this.#pending), ...get(this.#streaming)]);\n\n /** Last error. */\n public readonly error = Atom.make<Option.Option<Error>>(Option.none());\n\n readonly #outbox: Outbox<OutboxPayload>;\n\n /** Prompts sent from this chat, from submit onwards, in submit order (see {@link send}). */\n public readonly outbox: Atom.Atom<readonly OutboxEntry[]>;\n\n /** The feed's messages, live: what the outbox and the streamed turn are reconciled against. */\n readonly #feedMessages: Atom.Atom<readonly Message.Message[]>;\n\n /**\n * What the chat renders: the feed's turns, the turn streaming now, and the prompts on their way to\n * the agent, reconciled into one list (see `projectThread`). The UI reads this and nothing else.\n */\n public readonly thread: Atom.Atom<ThreadProjection>;\n\n /**\n * MCP server connection errors observed during the most recent request.\n * Misconfigured/unreachable servers are dropped from the toolkit so the chat\n * keeps working; the entries here let the UI display which servers failed.\n */\n public readonly mcpErrors = Atom.make<readonly Trace.PayloadType<typeof Trace.McpServerError>[]>([]);\n\n /**\n * Stage the in-flight request has reached, or `undefined` when there is nothing to report.\n *\n * Tracks the whole turn rather than only the wait before the first token: an agentic turn streams\n * a little, then calls tools for a long time, so a line cleared at the first block reads as a\n * request that has finished. Cleared when the turn settles or is cancelled.\n */\n public readonly activity = Atom.make<Trace.PayloadType<typeof Trace.RequestPhase> | undefined>(undefined);\n\n constructor(\n private readonly _conversation: AiSession.Session,\n private readonly _runtime: Capabilities.ProcessManagerRuntime,\n private readonly _feed: Feed.Feed,\n /**\n * Pre-built layer that materialises {@link SpaceServices}. Built via\n * {@link ServiceResolver.provide} with the {@link ServiceResolver} already\n * supplied (hence `RIn = never`); the {@link ServiceNotAvailableError}\n * error channel surfaces when a tag is not available for the space.\n * Provided to every effect run by the processor so the underlying\n * {@link ProcessManagerRuntime} has access to space-affinity services.\n */\n private readonly _spaceLayer: Layer.Layer<SpaceServices, ServiceResolver.ServiceNotAvailableError, never>,\n private readonly _options: AiChatProcessorOptions = defaultOptions,\n ) {\n this.#registry = this._options.observableRegistry ?? AtomRegistry.make();\n this.#outbox = new Outbox(this.#registry, (payload) => this.#dispatch(payload));\n this.outbox = this.#outbox.entries;\n // Held for the processor's life: a query's atom is memoized per result, so the query must be too.\n const db = Obj.getDatabase(this._feed);\n this.#feedMessages = db\n ? db.query(Query.select(Filter.type(Message.Message)).from(this._feed)).atom\n : Atom.make<readonly Message.Message[]>([]);\n this.thread = Atom.make((get) =>\n projectThread({\n feedMessages: get(this.#feedMessages),\n pendingMessages: get(this.messages),\n rewindFrom: get(Obj.atom(this._feed)).rewindFrom,\n outbox: get(this.outbox),\n }),\n );\n if (this._options.model && !this._options.system) {\n const capabilities = this._options.modelRegistry?.getCapabilities(this._options.model) ?? {};\n this._options.system = createSystemPrompt(capabilities);\n }\n }\n\n get context(): AiContext.Binder {\n return this._conversation.context;\n }\n\n get conversation() {\n return this._conversation;\n }\n\n get registry() {\n return this._options.registry;\n }\n\n get system(): string {\n return this._options.system ?? '';\n }\n\n async getTools(): Promise<Record<string, any>> {\n return this._runtime.runPromise(\n Effect.provide(this._conversation.getTools(), ToolExecutionServices).pipe(Effect.provide(this._spaceLayer)),\n );\n }\n\n async getSystemPrompt(): Promise<string> {\n return this._runtime.runPromise(\n Effect.gen({ self: this }, function* () {\n const skills = this.context.getSkills();\n const objects = this.context.getObjects();\n const instructions = yield* this.#getInstructions();\n // Tier A only: system-prompt formatting runs operations that read the conversation context;\n // the live-host Tier B control surface is not reachable from this fiber.\n const runtime = yield* Effect.context<Database.Service>();\n return yield* formatSystemPrompt({ system: this._options.system, skills, objects, instructions }).pipe(\n Effect.provideService(\n Harness.HarnessService,\n Harness.fromBinder({ feed: this._feed, runtime, binder: this.context }),\n ),\n );\n }).pipe(Effect.provide(this._spaceLayer), Effect.orDie),\n );\n }\n\n /**\n * Resolves the chat's steering instructions, if any — the local `AiSession` used for system-prompt\n * formatting is feed-centric, so the ref is resolved here and handed down.\n */\n #getInstructions(): Effect.Effect<Instructions.Instructions[], never, Database.Service> {\n return Effect.gen({ self: this }, function* () {\n const instructionsRef = this._options.chat?.target?.instructions;\n if (!instructionsRef) {\n return [];\n }\n\n const instructions = yield* Database.load(instructionsRef).pipe(Effect.orElseSucceed(() => undefined));\n return instructions ? [instructions] : [];\n });\n }\n\n /**\n * Sends a prompt the reader typed: it joins {@link outbox} at once — the thread shows it in the\n * same frame, before anything is persisted — and is then dispatched in submit order, as a request\n * when the agent is idle and queued behind the running turn otherwise.\n *\n * Returns the outbox id, which is the prompt's thread row for its whole life.\n */\n send(request: ProcessorRequest, { prepare }: ProcessorSendOptions = {}): string {\n const content = createPromptContent(request);\n const blocks = typeof content === 'string' ? [ContentBlock.Text.make({ text: content })] : content;\n // What the feed holds now cannot be this prompt's echo, however alike it reads.\n const known = new Set(this.#registry.get(this.#feedMessages).map(({ id }) => id));\n return this.#outbox.add({ request, prepare }, { blocks, known }).id;\n }\n\n /** Forgets a prompt this client sent; withdrawing one the agent's queue holds is the feed's business. */\n removePrompt(id: string): void {\n this.#outbox.remove(id);\n }\n\n /**\n * Hands one outbox prompt to the agent, settling once it is submitted rather than when its turn\n * ends, so the next prompt can follow it into the queue while this one runs.\n */\n async #dispatch({ request, prepare }: OutboxPayload): Promise<void> {\n await prepare?.();\n // Read at dispatch, not at submit: the previous prompt's request is what makes the agent active.\n if (this.#registry.get(this.active)) {\n try {\n await this.#enqueue(request);\n } catch (err) {\n this.#registry.set(this.error, Option.some(parseError(err)));\n throw err;\n }\n return;\n }\n\n await new Promise<void>((resolve, reject) => {\n void this.request(request, { resolve, reject });\n });\n }\n\n /**\n * Initiates a new request via AgentService.\n *\n * `submission` settles once the prompt is submitted (or cannot be), which is long before the turn\n * this resolves after.\n */\n async request(requestProp: ProcessorRequest, submission?: PromptSubmission): Promise<void> {\n if (this.#requestFiber) {\n await this.cancel();\n }\n\n try {\n this.#lastRequest = requestProp;\n this.#registry.set(this.error, Option.none());\n this.#registry.set(this.mcpErrors, []);\n // Set locally: spawning or attaching the agent process happens before it can emit anything, and\n // that resolve is itself part of the wait the reader is watching.\n this.#registry.set(this.activity, { phase: 'starting' });\n this.#registry.set(this.active, true);\n\n const effect = Effect.gen({ self: this }, function* () {\n // NOTE: Gets or creates a session for the feed.\n log.info('init agent session', {\n feed: Obj.getURI(this._feed),\n model: this._options.model,\n provider: this._options.provider,\n });\n const session = yield* this.#getSession();\n markWork('chat.session-ready');\n yield* this.#forkEphemeralCollector(session);\n\n log('chat processor submitting prompt', { length: requestProp.message.length });\n yield* session.submitPrompt(createPromptContent(requestProp), { sender: this._options.sender });\n markWork('chat.prompt-submitted');\n submission?.resolve();\n log('chat processor submitPrompt returned, waiting for agent', {});\n\n // On the first message (no name yet), schedule rename immediately so it\n // runs concurrently with the AI response rather than waiting for completion. A synthetic\n // turn is system-generated, so it would name the chat after a report nobody wrote.\n if (!this._options.chat?.target?.name && requestProp.disposition !== 'synthetic') {\n yield* this.#updateChatName(requestProp.message);\n }\n\n yield* session.waitForCompletion();\n log.info('session complete');\n\n this.#flushStreaming();\n });\n\n this.#requestFiber = this._runtime.runFork(effect.pipe(Effect.provide(this._spaceLayer)));\n\n // Inspect the fiber's exit so the underlying failure (e.g. \"model 'x' not found\") is\n // preserved as a clean Error rather than an opaque FiberFailure.\n const exit = await this._runtime.runPromise(Fiber.await(this.#requestFiber));\n if (Exit.isFailure(exit)) {\n if (Cause.hasInterruptsOnly(exit.cause)) {\n // A no-op once submitted: only a prompt stopped on its way to the agent is dropped.\n submission?.reject(new PromptCancelledError());\n this.#discardStreaming();\n return;\n }\n\n throw EffectEx.causeToError(exit.cause);\n }\n\n this.#registry.set(this.error, Option.none());\n this.#lastRequest = undefined;\n this.#requestFiber = undefined;\n } catch (err) {\n // `EffectEx.causeToError` above unwraps the fiber failure into the underlying error (e.g. an AiError\n // carrying \"model 'x' not found\"); `parseError` decides what to surface to the user.\n log.error('request failed', { error: err });\n // A no-op once submitted: a turn that fails after its prompt reached the agent did deliver it.\n submission?.reject(err);\n this.#registry.set(this.error, Option.some(parseError(err)));\n } finally {\n log.info('setting active to false');\n this.#registry.set(this.active, false);\n this.#registry.set(this.activity, undefined);\n this.#requestFiber = undefined;\n }\n }\n\n /**\n * Queues a prompt behind the turn already running, instead of starting one.\n *\n * The agent's input queue is feed state, so submitting is durable and ordered: the running turn is\n * left alone and the process takes this prompt up when it settles. {@link request} cannot serve\n * this case — it cancels the in-flight turn to start its own — and the running request's\n * `waitForCompletion` already covers the queued turn, since the agent does not report completion\n * while its queue is non-empty.\n */\n async enqueue(requestProp: ProcessorRequest): Promise<void> {\n try {\n await this.#enqueue(requestProp);\n } catch (err) {\n log.error('enqueue failed', { error: err });\n this.#registry.set(this.error, Option.some(parseError(err)));\n }\n }\n\n async #enqueue(requestProp: ProcessorRequest): Promise<void> {\n await this._runtime.runPromise(\n Effect.gen({ self: this }, function* () {\n const session = yield* this.#getSession();\n yield* session.submitPrompt(createPromptContent(requestProp), { sender: this._options.sender });\n markWork('chat.prompt-submitted');\n }).pipe(Effect.provide(this._spaceLayer)),\n );\n }\n\n /**\n * Mirrors turns this processor did not initiate into its own state: active/streaming state is\n * per-processor ({@link useChatProcessor} builds one per mount) while the agent process outlives\n * the mount, so a chat remounted mid-turn would otherwise render as idle.\n *\n * Returns a disposer that stops observing.\n */\n adopt(): () => void {\n let disposed = false;\n let unsubscribe: (() => void) | undefined;\n void this._runtime\n .runPromise(this.#getSession().pipe(Effect.provide(this._spaceLayer)))\n .then((session) => {\n if (disposed) {\n return;\n }\n\n unsubscribe = this.#registry.subscribe(\n session.running,\n (running) => {\n if (running) {\n void this.#observe(session);\n }\n },\n // The turn is normally already in flight when a remounted chat gets here.\n { immediate: true },\n );\n })\n .catch((err) => log.warn('failed to attach to agent session', { error: err }));\n\n return () => {\n disposed = true;\n unsubscribe?.();\n // The collector and its stream subscription outlive the unmount otherwise — one per remount,\n // all feeding atoms nothing reads any more.\n const fiber = this.#observeFiber;\n if (fiber) {\n this.#observeFiber = undefined;\n void this._runtime.runPromise(Fiber.interrupt(fiber));\n }\n };\n }\n\n /**\n * Follows a turn started elsewhere to completion, surfacing its streamed blocks here.\n * A turn this processor issued is owned by {@link request}, which reports its own errors.\n */\n async #observe(session: AgentService.Session): Promise<void> {\n if (this.#requestFiber || this.#observeFiber || this.#registry.get(this.active)) {\n return;\n }\n\n log.info('observing agent turn', { feed: Obj.getURI(this._feed) });\n try {\n this.#registry.set(this.active, true);\n const effect = Effect.gen({ self: this }, function* () {\n yield* this.#forkEphemeralCollector(session);\n yield* session.waitForCompletion();\n this.#flushStreaming();\n });\n\n // Tracked apart from `#requestFiber` so `cancel` keeps meaning \"stop the request this chat\n // issued\", and so the disposer interrupts only the observer.\n this.#observeFiber = this._runtime.runFork(effect.pipe(Effect.provide(this._spaceLayer)));\n const exit = await this._runtime.runPromise(Fiber.await(this.#observeFiber));\n if (Exit.isFailure(exit) && !Cause.hasInterruptsOnly(exit.cause)) {\n throw EffectEx.causeToError(exit.cause);\n }\n } catch (err) {\n // Reported but not surfaced as this chat's error: the mount that issued the turn owns that.\n log.warn('failed to observe agent turn', { error: err });\n } finally {\n this.#registry.set(this.active, false);\n this.#registry.set(this.activity, undefined);\n this.#observeFiber = undefined;\n }\n }\n\n /**\n * Resolves the agent session for this chat, reusing the process a previous mount left running and\n * spawning one only when there is none.\n */\n #getSession(): Effect.Effect<AgentService.Session, never, AgentService.AgentService | Database.Service> {\n return Effect.gen({ self: this }, function* () {\n const chat = this._options.chat?.target;\n if (!chat) {\n // The agent process is bound to a chat; a processor constructed without one has no\n // conversation to run.\n return yield* Effect.die(new Error('Chat processor requires a chat.'));\n }\n const selected = this._options.model;\n if (!chat.session?.model && selected) {\n Obj.update(chat, (chat) => {\n chat.session = { ...chat.session, model: selected };\n });\n }\n // The model is the chat's, so the provider has to be the one that serves THAT model: the\n // configured provider can have moved on since the chat made its selection.\n const model = chat.session?.model ?? selected;\n return yield* AgentService.getSession(chat, {\n provider: model ? providerForModel(model, this._options.provider) : this._options.provider,\n location: chat.remote ? 'edge' : 'local',\n });\n });\n }\n\n /**\n * Forks the collector for the session's ephemeral trace events (streaming blocks and MCP\n * failures) as a child of the calling fiber.\n */\n #forkEphemeralCollector(session: AgentService.Session): Effect.Effect<void> {\n return session.subscribeEphemeral().pipe(\n Stream.runForEach((message) =>\n Effect.sync(() => {\n for (const event of message.events) {\n if (Trace.isOfType(Trace.PartialBlock, event)) {\n this.#handleEphemeralMessage(event.data);\n } else if (Trace.isOfType(Trace.RequestPhase, event)) {\n this.#registry.set(this.activity, event.data);\n } else if (Trace.isOfType(Trace.McpServerError, event)) {\n this.#handleMcpError(event.data);\n }\n }\n }),\n ),\n Effect.forkChild,\n Effect.asVoid,\n );\n }\n\n /**\n * Cancels the current request.\n */\n async cancel(): Promise<void> {\n await EffectEx.runAndForwardErrors(\n Effect.gen({ self: this }, function* () {\n log.info('cancelling request', { fiber: this.#requestFiber });\n if (this.#requestFiber) {\n yield* Fiber.interrupt(this.#requestFiber);\n }\n // Same options as `request`: looked up bare, a differing model/provider/instructions reads as\n // a reconfiguration, which tears down the running process and spawns a replacement purely to\n // terminate it again.\n const session = yield* this.#getSession();\n yield* session.terminate();\n }).pipe(Effect.provide(this._spaceLayer)),\n );\n\n this.#requestFiber = undefined;\n this.#discardStreaming();\n this.#registry.set(this.active, false);\n }\n\n /**\n * Retry last failed request.\n */\n async retry(): Promise<void> {\n if (this.#lastRequest) {\n return this.request(this.#lastRequest);\n }\n }\n\n /**\n * Clears the recorded MCP server errors (e.g. after the user dismisses the warning banner).\n */\n dismissMcpErrors(): void {\n this.#registry.set(this.mcpErrors, []);\n }\n\n /**\n * Update the current chat's name.\n */\n async updateName(chat: Chat.Chat): Promise<void> {\n const spaceId = Obj.getDatabase(chat)?.spaceId;\n if (!spaceId) {\n return;\n }\n EffectEx.unwrapExit(\n await this._runtime.runPromiseExit(\n Operation.invoke(AssistantOperation.UpdateChatName, { chat }, { spaceId }).pipe(\n Effect.provide(this._spaceLayer),\n ),\n ),\n );\n }\n\n /**\n * Handles an ephemeral message from the agent process.\n * Both pending and completed blocks arrive here. Completed blocks are deduped\n * against messages already written to the feed queue to handle the race between\n * ephemeral delivery and feed replication.\n */\n #handleEphemeralMessage(event: Trace.PayloadType<typeof Trace.PartialBlock>) {\n // Content arriving is what \"generating\" means, and deriving it here keeps it out of the agent's\n // streaming pipeline, where the extra yield a trace write costs is observable to the turn's\n // tools. A tool call the agent reports supersedes it for as long as the tool runs.\n this.#registry.set(this.activity, { phase: 'generating' });\n\n const isPending = event.block.pending;\n const message = Obj.make(Message.Message, {\n id: event.messageId,\n created: new Date().toISOString(),\n sender: { role: event.role },\n blocks: [event.block],\n });\n\n if (isPending) {\n if (this.#finalizedIds.has(event.messageId)) {\n return;\n }\n this.#registry.update(this.#streaming, (streaming) => {\n const idx = streaming.findIndex((existing) => existing.id === event.messageId);\n if (idx >= 0) {\n const updated = [...streaming];\n updated[idx] = message;\n return updated;\n }\n return [...streaming, message];\n });\n } else {\n this.#finalizedIds.add(event.messageId);\n this.#registry.update(this.#streaming, (streaming) => streaming.filter((existing) => existing.id !== message.id));\n this.#registry.update(this.#pending, (pending) => {\n if (pending.some((existing) => existing.id === message.id)) {\n return pending;\n }\n return [...pending, message];\n });\n }\n }\n\n /**\n * Records a per-server MCP failure, deduped by url+protocol so repeat misconfigurations\n * across turns do not spam the UI.\n */\n #handleMcpError(event: Trace.PayloadType<typeof Trace.McpServerError>) {\n log.warn('MCP server error', event);\n this.#registry.update(this.mcpErrors, (errors) => {\n if (errors.some((existing) => existing.url === event.url && existing.protocol === event.protocol)) {\n return errors;\n }\n return [...errors, event];\n });\n }\n\n /**\n * Drop in-flight streaming messages (cancel/interrupt — partial blocks are discarded).\n */\n #discardStreaming() {\n this.#registry.set(this.#streaming, []);\n this.#registry.set(this.activity, undefined);\n this.#finalizedIds.clear();\n }\n\n /**\n * Move remaining streaming messages to pending (called when agent completes).\n */\n #flushStreaming() {\n this.#registry.set(this.activity, undefined);\n const remaining = this.#registry.get(this.#streaming);\n if (remaining.length > 0) {\n this.#registry.update(this.#pending, (pending) => [...pending, ...remaining]);\n this.#registry.set(this.#streaming, []);\n }\n this.#finalizedIds.clear();\n }\n\n /**\n * Schedule a chat name update as a detached (fire-and-forget) operation.\n * Called automatically on the first message; can also be invoked manually via the toolbar.\n */\n #updateChatName(prompt?: string): Effect.Effect<void, never, Operation.Service> {\n const chat = this._options.chat?.target;\n if (!chat) {\n return Effect.void;\n }\n\n const spaceId = Obj.getDatabase(chat)?.spaceId;\n if (!spaceId) {\n return Effect.void;\n }\n\n log.info('scheduling chat name update');\n return Operation.schedule(AssistantOperation.UpdateChatName, { chat, prompt }, { spaceId });\n }\n}\n\nexport type AiChatProcessorState = Pick<\n AiChatProcessor,\n 'streaming' | 'active' | 'thread' | 'error' | 'mcpErrors' | 'activity'\n>;\n\nconst idleProcessorState: AiChatProcessorState = {\n streaming: Atom.make(false),\n active: Atom.make(false),\n thread: Atom.make<ThreadProjection>(EMPTY_THREAD),\n error: Atom.make<Option.Option<Error>>(Option.none()),\n mcpErrors: Atom.make<readonly Trace.PayloadType<typeof Trace.McpServerError>[]>([]),\n activity: Atom.make<Trace.PayloadType<typeof Trace.RequestPhase> | undefined>(undefined),\n};\n\nexport const getProcessorState = (processor: AiChatProcessor | undefined): AiChatProcessorState =>\n processor ?? idleProcessorState;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAa,uBAAb,cAA0C,UAAU,OAClD,wBACA,sCACF,CAAC,CAAC,CAAC;;;;;;;;AASH,IAAa,SAAb,MAAuB;CASF;CACA;CAPnB,UAAmB,KAAK,KAA6B,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS;CAE5E,4BAAqB,IAAI,IAAe;CACxC,QAAuB,QAAQ,QAAQ;CAEvC,YACE,WACA,WACA;EAFiB,KAAA,YAAA;EACA,KAAA,YAAA;CAChB;;CAGH,IAAI,OAAsB;EACxB,OAAO,KAAK;CACd;CAEA,IAAI,IAAqC;EACvC,OAAO,KAAK,UAAU,IAAI,KAAK,OAAO,CAAC,CAAC,MAAM,UAAU,MAAM,OAAO,EAAE;CACzE;;CAGA,IAAI,SAAY,EAAE,QAAQ,SAA6D;EACrF,MAAM,QAAqB;GACzB,IAAI,IAAI,GAAG,OAAO;GAClB,0BAAS,IAAI,KAAK,EAAA,CAAE,YAAY;GAChC;GACA;GACA,OAAO;EACT;EACA,KAAK,UAAU,IAAI,MAAM,IAAI,OAAO;EACpC,KAAK,UAAU,OAAO,KAAK,UAAU,YAAY,CAAC,GAAG,SAAS,KAAK,CAAC;EACpE,KAAK,UAAU,MAAM,EAAE;EACvB,OAAO;CACT;CAEA,OAAO,IAAkB;EACvB,KAAK,UAAU,OAAO,EAAE;EACxB,KAAK,UAAU,OAAO,KAAK,UAAU,YAAY,QAAQ,QAAQ,UAAU,MAA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"index.d.ts","sourceRoot":"","sources":["../../../../src/processor/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../../../src/processor/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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"outbox.test.d.ts","sourceRoot":"","sources":["../../../../src/processor/outbox.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../../src/processor/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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"presets.test.d.ts","sourceRoot":"","sources":["../../../../src/processor/presets.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../../../src/processor/processor.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,MAA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,CAAC,CA4EzF;IAED;;;;;;;;OAQG;IACG,OAAO,CAAC,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAO1D;IAYD;;;;;;OAMG;IACH,KAAK,IAAI,MAAM,IAAI,CAkClB;IAyFD;;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;CAqGF;AAED,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,eAAe,EACf,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,CACvE,CAAC;AAWF,eAAO,MAAM,iBAAiB,cAAe,eAAe,GAAG,SAAS,KAAG,oBAC1C,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=processor.node.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processor.node.test.d.ts","sourceRoot":"","sources":["../../../../src/processor/processor.node.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../src/processor/prompt.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,mGAAmG;AACnG,MAAM,MAAM,uBAAuB,GAAG;IACpC,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,uBAAuB,CAAC;CACnC,KAAG,MAAM,GAAG,YAAY,CAAC,GAAG,EAsB5B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.test.d.ts","sourceRoot":"","sources":["../../../../src/processor/prompt.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"streaming.node.test.d.ts","sourceRoot":"","sources":["../../../../src/processor/streaming.node.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../../../src/processor/thread.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,KAAK,KAAK,EAAoC,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAOtD,CAAC;AAEF,uFAAuF;AACvF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,cAAc,CAAC;IACvB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5B,kEAAkE;IAClE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3C,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,YAAY,EAAE,gBAA4E,CAAC;AAExG;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,2DAKvB;IACD,YAAY,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,CAAC;IACzC,0EAA0E;IAC1E,eAAe,CAAC,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7C,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,MAAM,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CACjC,KAAG,gBAiFH,CAAC;AAiEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,8BAG1B;IACD,UAAU,EAAE,SAAS,KAAK,CAAC,KAAK,EAAE,CAAC;IACnC,QAAQ,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE,CAAC;CACtC,KAAG,MAQH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,mBAAoB;IAAE,UAAU,EAAE,SAAS,KAAK,CAAC,KAAK,EAAE,CAAA;CAAE,KAAG,KAAK,CAAC,KAAK,EAI/F,CAAC;AAwCJ;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,aAAc,SAAS,OAAO,CAAC,OAAO,EAAE,KAAG,OAAO,CAAC,OAAO,EAsCtF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,aACd,SAAS,OAAO,CAAC,OAAO,EAAE,aACzB,MAAM,KAChB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAMzC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"thread.test.d.ts","sourceRoot":"","sources":["../../../../src/processor/thread.test.ts"],"names":[],"mappings":""}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes