@collective-intelligence/ai 0.0.0-stage → 0.8.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 (172) hide show
  1. package/AGENTS.md +52 -0
  2. package/README.md +462 -2
  3. package/dist/api/access-check.d.ts +18 -0
  4. package/dist/api/answer-sources.d.ts +48 -0
  5. package/dist/api/attachments-api.d.ts +187 -0
  6. package/dist/api/catalog-api.d.ts +408 -0
  7. package/dist/api/chat-api.d.ts +2401 -0
  8. package/dist/api/chat-surface-api.d.ts +4186 -0
  9. package/dist/api/compaction.d.ts +52 -0
  10. package/dist/api/conversations.d.ts +107 -0
  11. package/dist/api/errors.d.ts +117 -0
  12. package/dist/api/feedback-api.d.ts +185 -0
  13. package/dist/api/files.d.ts +22 -0
  14. package/dist/api/ids.d.ts +33 -0
  15. package/dist/api/index.d.ts +21 -0
  16. package/dist/api/intents-api.d.ts +65 -0
  17. package/dist/api/place-context.d.ts +34 -0
  18. package/dist/api/projects-api.d.ts +718 -0
  19. package/dist/api/speech-api.d.ts +345 -0
  20. package/dist/api/transcript.d.ts +260 -0
  21. package/dist/api/turns.d.ts +196 -0
  22. package/dist/api.d.ts +21 -0
  23. package/dist/api.js +1 -0
  24. package/dist/domain/access.d.ts +29 -0
  25. package/dist/domain/context-trail.d.ts +65 -0
  26. package/dist/domain/data-parts.d.ts +247 -0
  27. package/dist/domain/errors.d.ts +28 -0
  28. package/dist/domain/index.d.ts +14 -0
  29. package/dist/domain/intents.d.ts +101 -0
  30. package/dist/domain/message.d.ts +173 -0
  31. package/dist/domain/place.d.ts +17 -0
  32. package/dist/domain/runtime-value.d.ts +16 -0
  33. package/dist/domain-50vzrrp9.js +2 -0
  34. package/dist/domain-5fpd4fte.js +1 -0
  35. package/dist/domain-9wzbv87n.js +2 -0
  36. package/dist/domain-g97xs965.js +2 -0
  37. package/dist/domain-hk3yw2m7.js +1 -0
  38. package/dist/domain-qyts6dgz.js +0 -0
  39. package/dist/domain-s07s1ry1.js +2 -0
  40. package/dist/domain.d.ts +14 -0
  41. package/dist/domain.js +1 -0
  42. package/dist/headless/access/access-store.d.ts +28 -0
  43. package/dist/headless/access/visibility.d.ts +24 -0
  44. package/dist/headless/blocked-state.d.ts +21 -0
  45. package/dist/headless/chat-registry.d.ts +63 -0
  46. package/dist/headless/chat-session-provider.d.ts +109 -0
  47. package/dist/headless/chat-surface.d.ts +4210 -0
  48. package/dist/headless/host-ports.d.ts +146 -0
  49. package/dist/headless/index.d.ts +33 -0
  50. package/dist/headless/intents/card-ends.d.ts +22 -0
  51. package/dist/headless/intents/intent-call.d.ts +28 -0
  52. package/dist/headless/intents/intents-provider.d.ts +108 -0
  53. package/dist/headless/intents/page-registry.d.ts +129 -0
  54. package/dist/headless/intents/use-intent-dispatch.d.ts +60 -0
  55. package/dist/headless/intents/use-intents.d.ts +11 -0
  56. package/dist/headless/intents/use-returned-intent-handle.d.ts +11 -0
  57. package/dist/headless/launch/chat-launch.d.ts +42 -0
  58. package/dist/headless/launch/launch-target.d.ts +25 -0
  59. package/dist/headless/launch/submit.d.ts +29 -0
  60. package/dist/headless/run-state.d.ts +16 -0
  61. package/dist/headless/sent-files.d.ts +20 -0
  62. package/dist/headless/server-started-turn-follow.proof.d.ts +26 -0
  63. package/dist/headless/session-machine.d.ts +745 -0
  64. package/dist/headless/trail/buffer.d.ts +48 -0
  65. package/dist/headless/trail/json-ld.d.ts +10 -0
  66. package/dist/headless/trail/switches.d.ts +10 -0
  67. package/dist/headless/trail/trail-provider.d.ts +53 -0
  68. package/dist/headless/transcript-messages.d.ts +26 -0
  69. package/dist/headless.d.ts +33 -0
  70. package/dist/headless.js +2 -0
  71. package/dist/transport/chat-client.d.ts +25 -0
  72. package/dist/transport/chat-transport.d.ts +57 -0
  73. package/dist/transport/index.d.ts +6 -0
  74. package/dist/transport/simulated-chat-transport.d.ts +39 -0
  75. package/dist/transport.d.ts +6 -0
  76. package/dist/transport.js +1 -0
  77. package/dist/views/assistant-sidebar/assistant-sidebar.d.ts +15 -0
  78. package/dist/views/assistant-sidebar/layout.d.ts +47 -0
  79. package/dist/views/assistant-sidebar/toggle.d.ts +14 -0
  80. package/dist/views/assistant-sidebar/use-shortcut.d.ts +11 -0
  81. package/dist/views/blocked/chat-blocked-state.d.ts +15 -0
  82. package/dist/views/chat-operations.d.ts +46 -0
  83. package/dist/views/chat-root.d.ts +14 -0
  84. package/dist/views/chat.d.ts +51 -0
  85. package/dist/views/composer/capability-picker.d.ts +77 -0
  86. package/dist/views/composer/capability-pickers.d.ts +24 -0
  87. package/dist/views/composer/chat-composer.d.ts +15 -0
  88. package/dist/views/composer/composer-picks.d.ts +31 -0
  89. package/dist/views/composer/composer-trail.d.ts +21 -0
  90. package/dist/views/composer/draft-attachments.d.ts +36 -0
  91. package/dist/views/composer/queued-messages.d.ts +9 -0
  92. package/dist/views/composer/send-menu.d.ts +11 -0
  93. package/dist/views/composer/slash-suggestions.d.ts +37 -0
  94. package/dist/views/composer/trail-chips.d.ts +15 -0
  95. package/dist/views/composer/voice-input/microphone.d.ts +14 -0
  96. package/dist/views/composer/voice-input/remote-transcription.d.ts +12 -0
  97. package/dist/views/composer/voice-input/use-voice-input.d.ts +30 -0
  98. package/dist/views/composer/voice-input/voice-input.d.ts +15 -0
  99. package/dist/views/dock/chat-dock.d.ts +57 -0
  100. package/dist/views/dock/dock-session.d.ts +22 -0
  101. package/dist/views/header/chat-header.d.ts +10 -0
  102. package/dist/views/header/compaction-controls.d.ts +17 -0
  103. package/dist/views/header/memory-switch.d.ts +16 -0
  104. package/dist/views/index.d.ts +58 -0
  105. package/dist/views/intents/form-fields.d.ts +38 -0
  106. package/dist/views/intents/intent-card.d.ts +61 -0
  107. package/dist/views/intents/intent-form.d.ts +23 -0
  108. package/dist/views/intents/intent-notices.d.ts +39 -0
  109. package/dist/views/intents/intent-trigger.d.ts +46 -0
  110. package/dist/views/intents/labels.d.ts +23 -0
  111. package/dist/views/labels/en.d.ts +3 -0
  112. package/dist/views/labels/index.d.ts +13 -0
  113. package/dist/views/labels/it.d.ts +3 -0
  114. package/dist/views/labels/types.d.ts +7 -0
  115. package/dist/views/launch/chat-launch-button.d.ts +21 -0
  116. package/dist/views/parts/answer-feedback.d.ts +26 -0
  117. package/dist/views/parts/evidence-part.d.ts +8 -0
  118. package/dist/views/parts/file-part.d.ts +8 -0
  119. package/dist/views/parts/image-generation-part.d.ts +9 -0
  120. package/dist/views/parts/image-generation.d.ts +84 -0
  121. package/dist/views/parts/intent-card-part.d.ts +8 -0
  122. package/dist/views/parts/memory-evidence-part.d.ts +7 -0
  123. package/dist/views/parts/message-parts.d.ts +21 -0
  124. package/dist/views/parts/question-part.d.ts +8 -0
  125. package/dist/views/parts/read-aloud.d.ts +23 -0
  126. package/dist/views/parts/reasoning-part.d.ts +8 -0
  127. package/dist/views/parts/steering-message-part.d.ts +7 -0
  128. package/dist/views/parts/text-part.d.ts +4 -0
  129. package/dist/views/parts/tool-part.d.ts +11 -0
  130. package/dist/views/parts/types.d.ts +103 -0
  131. package/dist/views/parts/use-read-aloud.d.ts +13 -0
  132. package/dist/views/run-trace/message-run.d.ts +17 -0
  133. package/dist/views/run-trace/run-stream.d.ts +128 -0
  134. package/dist/views/run-trace/run-trace-parts.d.ts +26 -0
  135. package/dist/views/run-trace/run-trace.d.ts +31 -0
  136. package/dist/views/sidebar/conversation-dialogs.d.ts +38 -0
  137. package/dist/views/sidebar/conversation-row.d.ts +23 -0
  138. package/dist/views/sidebar/conversation-sidebar.d.ts +10 -0
  139. package/dist/views/sidebar/date-groups.d.ts +12 -0
  140. package/dist/views/sidebar/history-filter.d.ts +57 -0
  141. package/dist/views/sidebar/projects/project-dialogs.d.ts +40 -0
  142. package/dist/views/sidebar/projects/project-files.d.ts +16 -0
  143. package/dist/views/sidebar/projects/project-groups.d.ts +19 -0
  144. package/dist/views/sidebar/projects/project-view.d.ts +21 -0
  145. package/dist/views/sidebar/projects/projects-section.d.ts +21 -0
  146. package/dist/views/sidebar/projects/use-chat-projects.d.ts +32 -0
  147. package/dist/views/slots.d.ts +148 -0
  148. package/dist/views/transcript/chat-transcript.d.ts +13 -0
  149. package/dist/views/transcript/sent-trail.d.ts +13 -0
  150. package/dist/views/transcript/use-image-reload.d.ts +16 -0
  151. package/dist/views.d.ts +58 -0
  152. package/dist/views.js +3 -0
  153. package/docs/guide/ai/index.md +377 -0
  154. package/docs/guide/ai/studio.md +245 -0
  155. package/docs/guide/data/connectors.md +267 -0
  156. package/docs/guide/data/datasets.md +145 -0
  157. package/docs/guide/data/documents.md +235 -0
  158. package/docs/guide/data/index.md +62 -0
  159. package/docs/guide/data/knowledge.md +214 -0
  160. package/docs/guide/develop/extensions.md +299 -0
  161. package/docs/guide/develop/external-apps.md +279 -0
  162. package/docs/guide/develop/infrastructure.md +135 -0
  163. package/docs/guide/develop/sdks.md +233 -0
  164. package/docs/guide/index.md +83 -0
  165. package/docs/guide/platform/access.md +311 -0
  166. package/docs/guide/platform/architecture.md +166 -0
  167. package/docs/guide/platform/built-ins.md +225 -0
  168. package/docs/guide/platform/entrypoints.md +318 -0
  169. package/docs/guide/scenarios/index.md +130 -0
  170. package/docs/guide/template/index.md +295 -0
  171. package/docs/guide/template/state-machines.md +294 -0
  172. package/package.json +123 -4
@@ -0,0 +1,745 @@
1
+ import type { FileUIPart } from "ai";
2
+ import type { EventObject } from "xstate";
3
+ import type { AgentId, AttachmentId, Conversation, ConversationSubject, ConversationId, InvocationId, PlaceContext, ProjectId, QueuedMessage, QueuedMessageId, QueueMessageResponse, SendSteeringMessageResponse } from "../api/index.js";
4
+ import type { AiError, CiTurnOptions, CiUIMessage, ContextTrailEntry, Place } from "../domain/index.js";
5
+ import type { CiChatTransport } from "../transport/index.js";
6
+ import type { ChatBlockedState } from "./blocked-state.js";
7
+ import type { ChatRegistry, ChatRegistryEvent } from "./chat-registry.js";
8
+ import type { ChatSessionRuntime, ChatSurfaceOptions } from "./chat-surface.js";
9
+ import type { AiHostPorts, ContextTrailPort } from "./host-ports.js";
10
+ /** A skill or a tool that the user chose for the turns of the open Conversation. */
11
+ export type ChatCapability = Readonly<{
12
+ id: string;
13
+ kind: "skill" | "tool";
14
+ name: string;
15
+ }>;
16
+ /** A message that the user sends, with what they chose for its turn. */
17
+ export type ChatSubmit = Readonly<{
18
+ /** Chat attachments of the open Conversation, uploaded before the send; a message to a running answer takes none. */
19
+ attachmentIds?: readonly AttachmentId[];
20
+ /** The capabilities of this send only, in place of the chosen ones: a Chat Launch of a Skill. */
21
+ capabilities?: readonly Pick<ChatCapability, "id" | "kind">[];
22
+ directTool?: NonNullable<CiTurnOptions["directTool"]>;
23
+ /**
24
+ * Files that upload as chat attachments into the open Conversation, or
25
+ * into the Conversation that the first message of a new chat creates,
26
+ * before the turn starts; a message to a running answer takes none.
27
+ */
28
+ files?: readonly File[];
29
+ /**
30
+ * The Intent of a Chat Launch (AC-036): the turn dispatches it before any
31
+ * model call. It goes only with `launchId`.
32
+ */
33
+ launch?: NonNullable<CiTurnOptions["launch"]>;
34
+ /**
35
+ * The launch id of a Chat Launch: the id of its user message, so the key
36
+ * of its one dispatch. A launch never steers or queues: while an answer
37
+ * runs, the chat refuses it as busy (AC-027), and it leaves the draft as
38
+ * it is.
39
+ */
40
+ launchId?: string;
41
+ selectedReportRunId?: string;
42
+ text: string;
43
+ /**
44
+ * Context Trail entries of a Chat Launch (#632 AC-172): the turn carries
45
+ * them after the trail of the tab, and only while that trail records
46
+ * (#632 AC-228).
47
+ */
48
+ trail?: readonly ContextTrailEntry[];
49
+ }>;
50
+ /** A send after its upload: the chat attachments it names and the file parts its user message shows. */
51
+ type ChatSend = ChatSubmit & Readonly<{
52
+ fileParts?: readonly FileUIPart[];
53
+ }>;
54
+ /** What a new chat starts with: its Agent and its Project. */
55
+ export type NewChat = Readonly<{
56
+ agentId?: AgentId;
57
+ projectId?: ProjectId;
58
+ }>;
59
+ /**
60
+ * The turn that the open chat follows: the turn it knows to run, the next
61
+ * turn that the ending turn named (AC-327) or that a send started while the
62
+ * ending turn still streams (Q261), and whether a chat send joined a running
63
+ * turn (Q260).
64
+ */
65
+ export type TurnFollow = Readonly<{
66
+ invocationId: InvocationId | null;
67
+ joined: boolean;
68
+ next: Readonly<{
69
+ invocationId: InvocationId | null;
70
+ userMessage: CiUIMessage;
71
+ }> | null;
72
+ }>;
73
+ export type ChatSessionInput = Readonly<{
74
+ /** The mount that the typed `ChatSurfaceApi` client calls. */
75
+ api: ChatSurfaceOptions;
76
+ host?: AiHostPorts;
77
+ /** Narrows the History Scope of the Conversation list to these Places. */
78
+ historyScope?: readonly Place[];
79
+ place: Place;
80
+ /**
81
+ * The draft that the session works on: the list holds only its
82
+ * Conversations, and the session opens the latest one when the host
83
+ * stores no open Conversation.
84
+ */
85
+ subject?: ConversationSubject;
86
+ transport: CiChatTransport;
87
+ }>;
88
+ /**
89
+ * The Chat Session (AC-377): the blocked state, the selected Conversation,
90
+ * the place context, the composer draft and what the steer-or-queue policy
91
+ * reads. It never holds a message: the AI SDK chats of `registry` hold them.
92
+ */
93
+ export type ChatSessionContext = Readonly<{
94
+ blocked: ChatBlockedState | null;
95
+ capabilities: readonly ChatCapability[];
96
+ conversationId: ConversationId | null;
97
+ conversations: readonly Conversation[];
98
+ draft: string;
99
+ /** The send or answer of the open chat whose request the network dropped, until the chat knows whether the server took it. */
100
+ dropped: DroppedSend | null;
101
+ /** The last failure that does not block the chat. */
102
+ failure: AiError | null;
103
+ follow: TurnFollow;
104
+ historyScope: readonly Place[] | undefined;
105
+ host: AiHostPorts;
106
+ newChat: NewChat;
107
+ place: Place;
108
+ placeContext: PlaceContext | null;
109
+ /** The Queued Messages as `listQueuedMessages` tells them; the machine keeps no queue of its own (AC-301). */
110
+ queuedMessages: readonly QueuedMessage[];
111
+ registry: ChatRegistry;
112
+ runtime: ChatSessionRuntime;
113
+ /** The text of the send in flight, empty once it has gone: a failed send gives it back to an empty draft. */
114
+ sending: string;
115
+ subject: ConversationSubject | undefined;
116
+ transport: CiChatTransport;
117
+ }>;
118
+ type QueueChange = Readonly<{
119
+ content: string;
120
+ queuedMessageId: QueuedMessageId;
121
+ revision: number;
122
+ type: "UPDATE_QUEUED";
123
+ }> | Readonly<{
124
+ queuedMessageId: QueuedMessageId;
125
+ revision: number;
126
+ type: "REMOVE_QUEUED";
127
+ }>;
128
+ export type ChatSessionEvent = ChatRegistryEvent | QueueChange | Readonly<{
129
+ conversationId: ConversationId;
130
+ type: "chat.resume_empty";
131
+ }> | Readonly<{
132
+ conversationId: ConversationId;
133
+ type: "SELECT_CONVERSATION";
134
+ }> | Readonly<{
135
+ capabilities: readonly ChatCapability[];
136
+ type: "SET_CAPABILITIES";
137
+ }> | Readonly<{
138
+ resume: boolean;
139
+ type: "READ_MESSAGES";
140
+ }> | Readonly<{
141
+ type: "WATCH_WAIT";
142
+ } & ShownWait> | Readonly<{
143
+ text: string;
144
+ type: "DRAFT";
145
+ }> | Readonly<{
146
+ text: string;
147
+ type: "QUEUE";
148
+ }> | Readonly<{
149
+ type: "NEW_CHAT";
150
+ } & NewChat> | Readonly<{
151
+ type: "RELOAD_CONVERSATIONS";
152
+ }> | Readonly<{
153
+ type: "RELOAD_QUEUE";
154
+ }> | Readonly<{
155
+ type: "RETRY";
156
+ }> | Readonly<{
157
+ type: "STOP";
158
+ }> | Readonly<{
159
+ type: "SUBMIT";
160
+ } & ChatSubmit>;
161
+ /**
162
+ * A send or an answer whose request the network dropped (T58-D F1): its
163
+ * failure and the number of user messages that the chat showed. The chat
164
+ * resumes the turn; a read of the Conversation with fewer user messages
165
+ * means that the server never took the send.
166
+ */
167
+ type DroppedSend = Readonly<{
168
+ error: AiError;
169
+ userMessages: number;
170
+ }>;
171
+ /** The turn of the open chat whose answer waits for the user's approval, as the chat shows it. */
172
+ type ShownWait = Readonly<{
173
+ conversationId: ConversationId;
174
+ invocationId: InvocationId;
175
+ }>;
176
+ /**
177
+ * The session machine of one chat (ARC-032): `fromEffect` actors read the
178
+ * place context once and the Conversations and run the steering and queue
179
+ * operations; the states are blocked, ready and switching. The AI SDK chat
180
+ * owns the messages; the machine owns the lifecycle and the steer-or-queue
181
+ * policy (AC-380), and follows the turns of the open chat (FLOW-012,
182
+ * FLOW-013).
183
+ */
184
+ export declare const chatSessionMachine: import("xstate").StateMachine<Readonly<{
185
+ blocked: ChatBlockedState | null;
186
+ capabilities: readonly ChatCapability[];
187
+ conversationId: ConversationId | null;
188
+ conversations: readonly Conversation[];
189
+ draft: string;
190
+ /** The send or answer of the open chat whose request the network dropped, until the chat knows whether the server took it. */
191
+ dropped: DroppedSend | null;
192
+ /** The last failure that does not block the chat. */
193
+ failure: AiError | null;
194
+ follow: TurnFollow;
195
+ historyScope: readonly Place[] | undefined;
196
+ host: AiHostPorts;
197
+ newChat: NewChat;
198
+ place: Place;
199
+ placeContext: PlaceContext | null;
200
+ /** The Queued Messages as `listQueuedMessages` tells them; the machine keeps no queue of its own (AC-301). */
201
+ queuedMessages: readonly QueuedMessage[];
202
+ registry: ChatRegistry;
203
+ runtime: ChatSessionRuntime;
204
+ /** The text of the send in flight, empty once it has gone: a failed send gives it back to an empty draft. */
205
+ sending: string;
206
+ subject: ConversationSubject | undefined;
207
+ transport: CiChatTransport;
208
+ }>, ChatSessionEvent, {
209
+ [x: string]: import("xstate").ActorRefFromLogic<import("xstate").CallbackActorLogic<ChatSessionEvent, Readonly<{
210
+ registry: ChatRegistry;
211
+ transport: CiChatTransport;
212
+ }>, EventObject> | import("xstate").PromiseActorLogic<void, Readonly<{
213
+ runtime: ChatSessionRuntime;
214
+ } & {
215
+ invocationId: InvocationId | null;
216
+ }>> | import("xstate").PromiseActorLogic<void, Readonly<{
217
+ runtime: ChatSessionRuntime;
218
+ } & {
219
+ change: QueueChange | null;
220
+ conversationId: ConversationId | null;
221
+ }>> | import("xstate").PromiseActorLogic<void, Readonly<{
222
+ runtime: ChatSessionRuntime;
223
+ } & {
224
+ conversationId: ConversationId | null;
225
+ invocationId: InvocationId | null;
226
+ }>> | import("xstate").PromiseActorLogic<Readonly<{
227
+ answer: QueueMessageResponse | SendSteeringMessageResponse;
228
+ clientMessageId: string;
229
+ text: string;
230
+ }>, Readonly<{
231
+ runtime: ChatSessionRuntime;
232
+ } & {
233
+ conversationId: ConversationId | null;
234
+ /** A queued Chat Launch keys its Queued Message with its launch id. */
235
+ launchId: string | undefined;
236
+ text: string;
237
+ }>> | import("xstate").PromiseActorLogic<Readonly<{
238
+ answer: QueueMessageResponse | SendSteeringMessageResponse;
239
+ clientMessageId: string;
240
+ text: string;
241
+ }>, Readonly<{
242
+ runtime: ChatSessionRuntime;
243
+ } & {
244
+ conversationId: ConversationId | null;
245
+ invocationId: InvocationId | null;
246
+ text: string;
247
+ }>> | import("xstate").PromiseActorLogic<readonly {
248
+ readonly agentId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/AgentId">) | null;
249
+ readonly createdAt: Date | null;
250
+ readonly id: string & import("effect/Brand").Brand<"@collective-intelligence/ai/ConversationId">;
251
+ readonly lastActivityAt: Date | null;
252
+ readonly lastActivityInvocationId: string | null;
253
+ readonly memoryEnabled: boolean;
254
+ readonly organizationId: string;
255
+ readonly origin: Place;
256
+ readonly projectId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/ProjectId">) | null;
257
+ readonly subject: {
258
+ readonly id: string;
259
+ readonly kind: "entity_schema_draft" | "organization_identity" | "report_draft" | "skill_draft" | "workflow_working_copy";
260
+ } | null;
261
+ readonly title: string;
262
+ readonly updatedAt: Date | null;
263
+ readonly userId: string | null;
264
+ }[], Readonly<{
265
+ runtime: ChatSessionRuntime;
266
+ } & Readonly<{
267
+ historyScope: readonly Place[] | undefined;
268
+ subject: ConversationSubject | undefined;
269
+ }>>> | import("xstate").PromiseActorLogic<readonly {
270
+ readonly content: string;
271
+ readonly createdAt: Date;
272
+ readonly id: string & import("effect/Brand").Brand<"@collective-intelligence/ai/QueuedMessageId">;
273
+ readonly invocationId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/InvocationId">) | null;
274
+ readonly position: number;
275
+ readonly revision: number;
276
+ readonly status: "claimed" | "removed" | "waiting";
277
+ }[], Readonly<{
278
+ runtime: ChatSessionRuntime;
279
+ } & {
280
+ conversationId: ConversationId | null;
281
+ }>> | import("xstate").PromiseActorLogic<{
282
+ conversations: readonly {
283
+ readonly agentId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/AgentId">) | null;
284
+ readonly createdAt: Date | null;
285
+ readonly id: string & import("effect/Brand").Brand<"@collective-intelligence/ai/ConversationId">;
286
+ readonly lastActivityAt: Date | null;
287
+ readonly lastActivityInvocationId: string | null;
288
+ readonly memoryEnabled: boolean;
289
+ readonly organizationId: string;
290
+ readonly origin: Place;
291
+ readonly projectId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/ProjectId">) | null;
292
+ readonly subject: {
293
+ readonly id: string;
294
+ readonly kind: "entity_schema_draft" | "organization_identity" | "report_draft" | "skill_draft" | "workflow_working_copy";
295
+ } | null;
296
+ readonly title: string;
297
+ readonly updatedAt: Date | null;
298
+ readonly userId: string | null;
299
+ }[];
300
+ placeContext: {
301
+ readonly contextTrailEnabled: boolean;
302
+ readonly contextTrailVisible: boolean;
303
+ readonly places: readonly {
304
+ readonly id: string;
305
+ readonly kind: "dashboard" | "external_app" | "studio_app";
306
+ readonly name: string | null;
307
+ }[];
308
+ readonly readAloud: boolean;
309
+ readonly voiceInputMode?: "local" | "remote";
310
+ };
311
+ }, Readonly<{
312
+ runtime: ChatSessionRuntime;
313
+ } & Readonly<{
314
+ historyScope: readonly Place[] | undefined;
315
+ subject: ConversationSubject | undefined;
316
+ }> & Readonly<{
317
+ placeContext: PlaceContext | null;
318
+ trail: ContextTrailPort | undefined;
319
+ }>>> | import("xstate").PromiseActorLogic<{
320
+ messages: CiUIMessage[];
321
+ openTurn: import("./transcript-messages.js").OpenTurn | null;
322
+ resume: boolean;
323
+ }, Readonly<{
324
+ runtime: ChatSessionRuntime;
325
+ } & {
326
+ conversationId: ConversationId | null;
327
+ resume: boolean;
328
+ }>> | import("xstate").PromiseActorLogic<{
329
+ conversation: {
330
+ readonly agentId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/AgentId">) | null;
331
+ readonly createdAt: Date | null;
332
+ readonly id: string & import("effect/Brand").Brand<"@collective-intelligence/ai/ConversationId">;
333
+ readonly lastActivityAt: Date | null;
334
+ readonly lastActivityInvocationId: string | null;
335
+ readonly memoryEnabled: boolean;
336
+ readonly organizationId: string;
337
+ readonly origin: Place;
338
+ readonly projectId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/ProjectId">) | null;
339
+ readonly subject: {
340
+ readonly id: string;
341
+ readonly kind: "entity_schema_draft" | "organization_identity" | "report_draft" | "skill_draft" | "workflow_working_copy";
342
+ } | null;
343
+ readonly title: string;
344
+ readonly updatedAt: Date | null;
345
+ readonly userId: string | null;
346
+ };
347
+ submit: Readonly<{
348
+ /** Chat attachments of the open Conversation, uploaded before the send; a message to a running answer takes none. */
349
+ attachmentIds?: readonly AttachmentId[];
350
+ /** The capabilities of this send only, in place of the chosen ones: a Chat Launch of a Skill. */
351
+ capabilities?: readonly Pick<ChatCapability, "id" | "kind">[];
352
+ directTool?: NonNullable<CiTurnOptions["directTool"]>;
353
+ /**
354
+ * Files that upload as chat attachments into the open Conversation, or
355
+ * into the Conversation that the first message of a new chat creates,
356
+ * before the turn starts; a message to a running answer takes none.
357
+ */
358
+ files?: readonly File[];
359
+ /**
360
+ * The Intent of a Chat Launch (AC-036): the turn dispatches it before any
361
+ * model call. It goes only with `launchId`.
362
+ */
363
+ launch?: NonNullable<CiTurnOptions["launch"]>;
364
+ /**
365
+ * The launch id of a Chat Launch: the id of its user message, so the key
366
+ * of its one dispatch. A launch never steers or queues: while an answer
367
+ * runs, the chat refuses it as busy (AC-027), and it leaves the draft as
368
+ * it is.
369
+ */
370
+ launchId?: string;
371
+ selectedReportRunId?: string;
372
+ text: string;
373
+ /**
374
+ * Context Trail entries of a Chat Launch (#632 AC-172): the turn carries
375
+ * them after the trail of the tab, and only while that trail records
376
+ * (#632 AC-228).
377
+ */
378
+ trail?: readonly ContextTrailEntry[];
379
+ }>;
380
+ uploadFailure: AiError;
381
+ } | {
382
+ conversation: {
383
+ readonly agentId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/AgentId">) | null;
384
+ readonly createdAt: Date | null;
385
+ readonly id: string & import("effect/Brand").Brand<"@collective-intelligence/ai/ConversationId">;
386
+ readonly lastActivityAt: Date | null;
387
+ readonly lastActivityInvocationId: string | null;
388
+ readonly memoryEnabled: boolean;
389
+ readonly organizationId: string;
390
+ readonly origin: Place;
391
+ readonly projectId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/ProjectId">) | null;
392
+ readonly subject: {
393
+ readonly id: string;
394
+ readonly kind: "entity_schema_draft" | "organization_identity" | "report_draft" | "skill_draft" | "workflow_working_copy";
395
+ } | null;
396
+ readonly title: string;
397
+ readonly updatedAt: Date | null;
398
+ readonly userId: string | null;
399
+ };
400
+ submit: ChatSend;
401
+ uploadFailure: null;
402
+ }, Readonly<{
403
+ runtime: ChatSessionRuntime;
404
+ } & {
405
+ newChat: NewChat;
406
+ submit: ChatSubmit;
407
+ }>> | import("xstate").PromiseActorLogic<ChatSend, Readonly<{
408
+ runtime: ChatSessionRuntime;
409
+ } & {
410
+ conversationId: ConversationId | null;
411
+ submit: ChatSubmit;
412
+ }>>> | undefined;
413
+ }, {
414
+ src: "cancelTurn";
415
+ logic: import("xstate").PromiseActorLogic<void, Readonly<{
416
+ runtime: ChatSessionRuntime;
417
+ } & {
418
+ invocationId: InvocationId | null;
419
+ }>>;
420
+ id: string | undefined;
421
+ } | {
422
+ src: "changeQueued";
423
+ logic: import("xstate").PromiseActorLogic<void, Readonly<{
424
+ runtime: ChatSessionRuntime;
425
+ } & {
426
+ change: QueueChange | null;
427
+ conversationId: ConversationId | null;
428
+ }>>;
429
+ id: string | undefined;
430
+ } | {
431
+ src: "chatEvents";
432
+ logic: import("xstate").CallbackActorLogic<ChatSessionEvent, Readonly<{
433
+ registry: ChatRegistry;
434
+ transport: CiChatTransport;
435
+ }>, EventObject>;
436
+ id: string | undefined;
437
+ } | {
438
+ src: "createConversation";
439
+ logic: import("xstate").PromiseActorLogic<{
440
+ conversation: {
441
+ readonly agentId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/AgentId">) | null;
442
+ readonly createdAt: Date | null;
443
+ readonly id: string & import("effect/Brand").Brand<"@collective-intelligence/ai/ConversationId">;
444
+ readonly lastActivityAt: Date | null;
445
+ readonly lastActivityInvocationId: string | null;
446
+ readonly memoryEnabled: boolean;
447
+ readonly organizationId: string;
448
+ readonly origin: Place;
449
+ readonly projectId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/ProjectId">) | null;
450
+ readonly subject: {
451
+ readonly id: string;
452
+ readonly kind: "entity_schema_draft" | "organization_identity" | "report_draft" | "skill_draft" | "workflow_working_copy";
453
+ } | null;
454
+ readonly title: string;
455
+ readonly updatedAt: Date | null;
456
+ readonly userId: string | null;
457
+ };
458
+ submit: Readonly<{
459
+ /** Chat attachments of the open Conversation, uploaded before the send; a message to a running answer takes none. */
460
+ attachmentIds?: readonly AttachmentId[];
461
+ /** The capabilities of this send only, in place of the chosen ones: a Chat Launch of a Skill. */
462
+ capabilities?: readonly Pick<ChatCapability, "id" | "kind">[];
463
+ directTool?: NonNullable<CiTurnOptions["directTool"]>;
464
+ /**
465
+ * Files that upload as chat attachments into the open Conversation, or
466
+ * into the Conversation that the first message of a new chat creates,
467
+ * before the turn starts; a message to a running answer takes none.
468
+ */
469
+ files?: readonly File[];
470
+ /**
471
+ * The Intent of a Chat Launch (AC-036): the turn dispatches it before any
472
+ * model call. It goes only with `launchId`.
473
+ */
474
+ launch?: NonNullable<CiTurnOptions["launch"]>;
475
+ /**
476
+ * The launch id of a Chat Launch: the id of its user message, so the key
477
+ * of its one dispatch. A launch never steers or queues: while an answer
478
+ * runs, the chat refuses it as busy (AC-027), and it leaves the draft as
479
+ * it is.
480
+ */
481
+ launchId?: string;
482
+ selectedReportRunId?: string;
483
+ text: string;
484
+ /**
485
+ * Context Trail entries of a Chat Launch (#632 AC-172): the turn carries
486
+ * them after the trail of the tab, and only while that trail records
487
+ * (#632 AC-228).
488
+ */
489
+ trail?: readonly ContextTrailEntry[];
490
+ }>;
491
+ uploadFailure: AiError;
492
+ } | {
493
+ conversation: {
494
+ readonly agentId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/AgentId">) | null;
495
+ readonly createdAt: Date | null;
496
+ readonly id: string & import("effect/Brand").Brand<"@collective-intelligence/ai/ConversationId">;
497
+ readonly lastActivityAt: Date | null;
498
+ readonly lastActivityInvocationId: string | null;
499
+ readonly memoryEnabled: boolean;
500
+ readonly organizationId: string;
501
+ readonly origin: Place;
502
+ readonly projectId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/ProjectId">) | null;
503
+ readonly subject: {
504
+ readonly id: string;
505
+ readonly kind: "entity_schema_draft" | "organization_identity" | "report_draft" | "skill_draft" | "workflow_working_copy";
506
+ } | null;
507
+ readonly title: string;
508
+ readonly updatedAt: Date | null;
509
+ readonly userId: string | null;
510
+ };
511
+ submit: ChatSend;
512
+ uploadFailure: null;
513
+ }, Readonly<{
514
+ runtime: ChatSessionRuntime;
515
+ } & {
516
+ newChat: NewChat;
517
+ submit: ChatSubmit;
518
+ }>>;
519
+ id: string | undefined;
520
+ } | {
521
+ src: "listConversations";
522
+ logic: import("xstate").PromiseActorLogic<readonly {
523
+ readonly agentId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/AgentId">) | null;
524
+ readonly createdAt: Date | null;
525
+ readonly id: string & import("effect/Brand").Brand<"@collective-intelligence/ai/ConversationId">;
526
+ readonly lastActivityAt: Date | null;
527
+ readonly lastActivityInvocationId: string | null;
528
+ readonly memoryEnabled: boolean;
529
+ readonly organizationId: string;
530
+ readonly origin: Place;
531
+ readonly projectId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/ProjectId">) | null;
532
+ readonly subject: {
533
+ readonly id: string;
534
+ readonly kind: "entity_schema_draft" | "organization_identity" | "report_draft" | "skill_draft" | "workflow_working_copy";
535
+ } | null;
536
+ readonly title: string;
537
+ readonly updatedAt: Date | null;
538
+ readonly userId: string | null;
539
+ }[], Readonly<{
540
+ runtime: ChatSessionRuntime;
541
+ } & Readonly<{
542
+ historyScope: readonly Place[] | undefined;
543
+ subject: ConversationSubject | undefined;
544
+ }>>>;
545
+ id: string | undefined;
546
+ } | {
547
+ src: "listQueued";
548
+ logic: import("xstate").PromiseActorLogic<readonly {
549
+ readonly content: string;
550
+ readonly createdAt: Date;
551
+ readonly id: string & import("effect/Brand").Brand<"@collective-intelligence/ai/QueuedMessageId">;
552
+ readonly invocationId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/InvocationId">) | null;
553
+ readonly position: number;
554
+ readonly revision: number;
555
+ readonly status: "claimed" | "removed" | "waiting";
556
+ }[], Readonly<{
557
+ runtime: ChatSessionRuntime;
558
+ } & {
559
+ conversationId: ConversationId | null;
560
+ }>>;
561
+ id: string | undefined;
562
+ } | {
563
+ src: "loadSession";
564
+ logic: import("xstate").PromiseActorLogic<{
565
+ conversations: readonly {
566
+ readonly agentId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/AgentId">) | null;
567
+ readonly createdAt: Date | null;
568
+ readonly id: string & import("effect/Brand").Brand<"@collective-intelligence/ai/ConversationId">;
569
+ readonly lastActivityAt: Date | null;
570
+ readonly lastActivityInvocationId: string | null;
571
+ readonly memoryEnabled: boolean;
572
+ readonly organizationId: string;
573
+ readonly origin: Place;
574
+ readonly projectId: (string & import("effect/Brand").Brand<"@collective-intelligence/ai/ProjectId">) | null;
575
+ readonly subject: {
576
+ readonly id: string;
577
+ readonly kind: "entity_schema_draft" | "organization_identity" | "report_draft" | "skill_draft" | "workflow_working_copy";
578
+ } | null;
579
+ readonly title: string;
580
+ readonly updatedAt: Date | null;
581
+ readonly userId: string | null;
582
+ }[];
583
+ placeContext: {
584
+ readonly contextTrailEnabled: boolean;
585
+ readonly contextTrailVisible: boolean;
586
+ readonly places: readonly {
587
+ readonly id: string;
588
+ readonly kind: "dashboard" | "external_app" | "studio_app";
589
+ readonly name: string | null;
590
+ }[];
591
+ readonly readAloud: boolean;
592
+ readonly voiceInputMode?: "local" | "remote";
593
+ };
594
+ }, Readonly<{
595
+ runtime: ChatSessionRuntime;
596
+ } & Readonly<{
597
+ historyScope: readonly Place[] | undefined;
598
+ subject: ConversationSubject | undefined;
599
+ }> & Readonly<{
600
+ placeContext: PlaceContext | null;
601
+ trail: ContextTrailPort | undefined;
602
+ }>>>;
603
+ id: string | undefined;
604
+ } | {
605
+ src: "queueMessage";
606
+ logic: import("xstate").PromiseActorLogic<Readonly<{
607
+ answer: QueueMessageResponse | SendSteeringMessageResponse;
608
+ clientMessageId: string;
609
+ text: string;
610
+ }>, Readonly<{
611
+ runtime: ChatSessionRuntime;
612
+ } & {
613
+ conversationId: ConversationId | null;
614
+ /** A queued Chat Launch keys its Queued Message with its launch id. */
615
+ launchId: string | undefined;
616
+ text: string;
617
+ }>>;
618
+ id: string | undefined;
619
+ } | {
620
+ src: "readMessages";
621
+ logic: import("xstate").PromiseActorLogic<{
622
+ messages: CiUIMessage[];
623
+ openTurn: import("./transcript-messages.js").OpenTurn | null;
624
+ resume: boolean;
625
+ }, Readonly<{
626
+ runtime: ChatSessionRuntime;
627
+ } & {
628
+ conversationId: ConversationId | null;
629
+ resume: boolean;
630
+ }>>;
631
+ id: string | undefined;
632
+ } | {
633
+ src: "steer";
634
+ logic: import("xstate").PromiseActorLogic<Readonly<{
635
+ answer: QueueMessageResponse | SendSteeringMessageResponse;
636
+ clientMessageId: string;
637
+ text: string;
638
+ }>, Readonly<{
639
+ runtime: ChatSessionRuntime;
640
+ } & {
641
+ conversationId: ConversationId | null;
642
+ invocationId: InvocationId | null;
643
+ text: string;
644
+ }>>;
645
+ id: string | undefined;
646
+ } | {
647
+ src: "uploadFiles";
648
+ logic: import("xstate").PromiseActorLogic<ChatSend, Readonly<{
649
+ runtime: ChatSessionRuntime;
650
+ } & {
651
+ conversationId: ConversationId | null;
652
+ submit: ChatSubmit;
653
+ }>>;
654
+ id: string | undefined;
655
+ } | {
656
+ src: "watchWait";
657
+ logic: import("xstate").PromiseActorLogic<void, Readonly<{
658
+ runtime: ChatSessionRuntime;
659
+ } & {
660
+ conversationId: ConversationId | null;
661
+ invocationId: InvocationId | null;
662
+ }>>;
663
+ id: string | undefined;
664
+ }, {
665
+ type: "followSent";
666
+ params: Readonly<{
667
+ answer: QueueMessageResponse | SendSteeringMessageResponse;
668
+ clientMessageId: string;
669
+ text: string;
670
+ }>;
671
+ } | {
672
+ type: "takeDraft";
673
+ params: import("xstate").NonReducibleUnknown;
674
+ }, never, never, "blocked" | "starting" | "switching" | {
675
+ ready: {
676
+ composer: "cancelling" | "changingQueue" | "creating" | "idle" | "queueing" | "steering" | "stopping" | "uploading";
677
+ conversations: "idle" | "loading";
678
+ follow: "idle" | "reading";
679
+ queue: "check" | "idle" | "loading";
680
+ wait: "idle" | "watching";
681
+ };
682
+ }, string, Readonly<{
683
+ /** The mount that the typed `ChatSurfaceApi` client calls. */
684
+ api: ChatSurfaceOptions;
685
+ host?: AiHostPorts;
686
+ /** Narrows the History Scope of the Conversation list to these Places. */
687
+ historyScope?: readonly Place[];
688
+ place: Place;
689
+ /**
690
+ * The draft that the session works on: the list holds only its
691
+ * Conversations, and the session opens the latest one when the host
692
+ * stores no open Conversation.
693
+ */
694
+ subject?: ConversationSubject;
695
+ transport: CiChatTransport;
696
+ }>, import("xstate").NonReducibleUnknown, EventObject, import("xstate").MetaObject, {
697
+ id: "chatSession";
698
+ states: {
699
+ readonly blocked: {};
700
+ readonly ready: {
701
+ states: {
702
+ readonly composer: {
703
+ states: {
704
+ readonly cancelling: {};
705
+ readonly changingQueue: {};
706
+ readonly creating: {};
707
+ readonly idle: {};
708
+ readonly queueing: {};
709
+ readonly steering: {};
710
+ readonly stopping: {};
711
+ readonly uploading: {};
712
+ };
713
+ };
714
+ readonly conversations: {
715
+ states: {
716
+ readonly idle: {};
717
+ readonly loading: {};
718
+ };
719
+ };
720
+ readonly follow: {
721
+ states: {
722
+ readonly idle: {};
723
+ readonly reading: {};
724
+ };
725
+ };
726
+ readonly queue: {
727
+ states: {
728
+ readonly check: {};
729
+ readonly idle: {};
730
+ readonly loading: {};
731
+ };
732
+ };
733
+ readonly wait: {
734
+ states: {
735
+ readonly idle: {};
736
+ readonly watching: {};
737
+ };
738
+ };
739
+ };
740
+ };
741
+ readonly starting: {};
742
+ readonly switching: {};
743
+ };
744
+ }, import("xstate").MetaObject>;
745
+ export {};