@grackle-ai/ahp 0.131.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 (153) hide show
  1. package/dist/index.d.ts +23 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +23 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/vendor/ahp/action-origin.generated.d.ts +33 -0
  6. package/dist/vendor/ahp/action-origin.generated.d.ts.map +1 -0
  7. package/dist/vendor/ahp/action-origin.generated.js +71 -0
  8. package/dist/vendor/ahp/action-origin.generated.js.map +1 -0
  9. package/dist/vendor/ahp/actions.d.ts +14 -0
  10. package/dist/vendor/ahp/actions.d.ts.map +1 -0
  11. package/dist/vendor/ahp/actions.js +15 -0
  12. package/dist/vendor/ahp/actions.js.map +1 -0
  13. package/dist/vendor/ahp/channels-changeset/actions.d.ts +87 -0
  14. package/dist/vendor/ahp/channels-changeset/actions.d.ts.map +1 -0
  15. package/dist/vendor/ahp/channels-changeset/actions.js +9 -0
  16. package/dist/vendor/ahp/channels-changeset/actions.js.map +1 -0
  17. package/dist/vendor/ahp/channels-changeset/commands.d.ts +103 -0
  18. package/dist/vendor/ahp/channels-changeset/commands.d.ts.map +1 -0
  19. package/dist/vendor/ahp/channels-changeset/commands.js +22 -0
  20. package/dist/vendor/ahp/channels-changeset/commands.js.map +1 -0
  21. package/dist/vendor/ahp/channels-changeset/reducer.d.ts +18 -0
  22. package/dist/vendor/ahp/channels-changeset/reducer.d.ts.map +1 -0
  23. package/dist/vendor/ahp/channels-changeset/reducer.js +65 -0
  24. package/dist/vendor/ahp/channels-changeset/reducer.js.map +1 -0
  25. package/dist/vendor/ahp/channels-changeset/state.d.ts +155 -0
  26. package/dist/vendor/ahp/channels-changeset/state.d.ts.map +1 -0
  27. package/dist/vendor/ahp/channels-changeset/state.js +39 -0
  28. package/dist/vendor/ahp/channels-changeset/state.js.map +1 -0
  29. package/dist/vendor/ahp/channels-otlp/notifications.d.ts +121 -0
  30. package/dist/vendor/ahp/channels-otlp/notifications.d.ts.map +1 -0
  31. package/dist/vendor/ahp/channels-otlp/notifications.js +11 -0
  32. package/dist/vendor/ahp/channels-otlp/notifications.js.map +1 -0
  33. package/dist/vendor/ahp/channels-otlp/state.d.ts +65 -0
  34. package/dist/vendor/ahp/channels-otlp/state.d.ts.map +1 -0
  35. package/dist/vendor/ahp/channels-otlp/state.js +10 -0
  36. package/dist/vendor/ahp/channels-otlp/state.js.map +1 -0
  37. package/dist/vendor/ahp/channels-root/actions.d.ts +62 -0
  38. package/dist/vendor/ahp/channels-root/actions.d.ts.map +1 -0
  39. package/dist/vendor/ahp/channels-root/actions.js +8 -0
  40. package/dist/vendor/ahp/channels-root/actions.js.map +1 -0
  41. package/dist/vendor/ahp/channels-root/commands.d.ts +172 -0
  42. package/dist/vendor/ahp/channels-root/commands.d.ts.map +1 -0
  43. package/dist/vendor/ahp/channels-root/commands.js +10 -0
  44. package/dist/vendor/ahp/channels-root/commands.js.map +1 -0
  45. package/dist/vendor/ahp/channels-root/notifications.d.ts +136 -0
  46. package/dist/vendor/ahp/channels-root/notifications.d.ts.map +1 -0
  47. package/dist/vendor/ahp/channels-root/notifications.js +9 -0
  48. package/dist/vendor/ahp/channels-root/notifications.js.map +1 -0
  49. package/dist/vendor/ahp/channels-root/reducer.d.ts +12 -0
  50. package/dist/vendor/ahp/channels-root/reducer.d.ts.map +1 -0
  51. package/dist/vendor/ahp/channels-root/reducer.js +36 -0
  52. package/dist/vendor/ahp/channels-root/reducer.js.map +1 -0
  53. package/dist/vendor/ahp/channels-root/state.d.ts +123 -0
  54. package/dist/vendor/ahp/channels-root/state.d.ts.map +1 -0
  55. package/dist/vendor/ahp/channels-root/state.js +19 -0
  56. package/dist/vendor/ahp/channels-root/state.js.map +1 -0
  57. package/dist/vendor/ahp/channels-session/actions.d.ts +736 -0
  58. package/dist/vendor/ahp/channels-session/actions.d.ts.map +1 -0
  59. package/dist/vendor/ahp/channels-session/actions.js +8 -0
  60. package/dist/vendor/ahp/channels-session/actions.js.map +1 -0
  61. package/dist/vendor/ahp/channels-session/commands.d.ts +261 -0
  62. package/dist/vendor/ahp/channels-session/commands.d.ts.map +1 -0
  63. package/dist/vendor/ahp/channels-session/commands.js +23 -0
  64. package/dist/vendor/ahp/channels-session/commands.js.map +1 -0
  65. package/dist/vendor/ahp/channels-session/reducer.d.ts +14 -0
  66. package/dist/vendor/ahp/channels-session/reducer.d.ts.map +1 -0
  67. package/dist/vendor/ahp/channels-session/reducer.js +703 -0
  68. package/dist/vendor/ahp/channels-session/reducer.js.map +1 -0
  69. package/dist/vendor/ahp/channels-session/state.d.ts +1217 -0
  70. package/dist/vendor/ahp/channels-session/state.d.ts.map +1 -0
  71. package/dist/vendor/ahp/channels-session/state.js +229 -0
  72. package/dist/vendor/ahp/channels-session/state.js.map +1 -0
  73. package/dist/vendor/ahp/channels-terminal/actions.d.ts +185 -0
  74. package/dist/vendor/ahp/channels-terminal/actions.d.ts.map +1 -0
  75. package/dist/vendor/ahp/channels-terminal/actions.js +8 -0
  76. package/dist/vendor/ahp/channels-terminal/actions.js.map +1 -0
  77. package/dist/vendor/ahp/channels-terminal/commands.d.ts +50 -0
  78. package/dist/vendor/ahp/channels-terminal/commands.d.ts.map +1 -0
  79. package/dist/vendor/ahp/channels-terminal/commands.js +8 -0
  80. package/dist/vendor/ahp/channels-terminal/commands.js.map +1 -0
  81. package/dist/vendor/ahp/channels-terminal/reducer.d.ts +12 -0
  82. package/dist/vendor/ahp/channels-terminal/reducer.d.ts.map +1 -0
  83. package/dist/vendor/ahp/channels-terminal/reducer.js +80 -0
  84. package/dist/vendor/ahp/channels-terminal/reducer.js.map +1 -0
  85. package/dist/vendor/ahp/channels-terminal/state.d.ts +151 -0
  86. package/dist/vendor/ahp/channels-terminal/state.d.ts.map +1 -0
  87. package/dist/vendor/ahp/channels-terminal/state.js +18 -0
  88. package/dist/vendor/ahp/channels-terminal/state.js.map +1 -0
  89. package/dist/vendor/ahp/commands.d.ts +14 -0
  90. package/dist/vendor/ahp/commands.d.ts.map +1 -0
  91. package/dist/vendor/ahp/commands.js +15 -0
  92. package/dist/vendor/ahp/commands.js.map +1 -0
  93. package/dist/vendor/ahp/common/actions.d.ts +107 -0
  94. package/dist/vendor/ahp/common/actions.d.ts.map +1 -0
  95. package/dist/vendor/ahp/common/actions.js +77 -0
  96. package/dist/vendor/ahp/common/actions.js.map +1 -0
  97. package/dist/vendor/ahp/common/commands.d.ts +594 -0
  98. package/dist/vendor/ahp/common/commands.d.ts.map +1 -0
  99. package/dist/vendor/ahp/common/commands.js +32 -0
  100. package/dist/vendor/ahp/common/commands.js.map +1 -0
  101. package/dist/vendor/ahp/common/errors.d.ts +184 -0
  102. package/dist/vendor/ahp/common/errors.d.ts.map +1 -0
  103. package/dist/vendor/ahp/common/errors.js +82 -0
  104. package/dist/vendor/ahp/common/errors.js.map +1 -0
  105. package/dist/vendor/ahp/common/messages.d.ts +330 -0
  106. package/dist/vendor/ahp/common/messages.d.ts.map +1 -0
  107. package/dist/vendor/ahp/common/messages.js +11 -0
  108. package/dist/vendor/ahp/common/messages.js.map +1 -0
  109. package/dist/vendor/ahp/common/notifications.d.ts +58 -0
  110. package/dist/vendor/ahp/common/notifications.d.ts.map +1 -0
  111. package/dist/vendor/ahp/common/notifications.js +20 -0
  112. package/dist/vendor/ahp/common/notifications.js.map +1 -0
  113. package/dist/vendor/ahp/common/reducer-helpers.d.ts +24 -0
  114. package/dist/vendor/ahp/common/reducer-helpers.d.ts.map +1 -0
  115. package/dist/vendor/ahp/common/reducer-helpers.js +31 -0
  116. package/dist/vendor/ahp/common/reducer-helpers.js.map +1 -0
  117. package/dist/vendor/ahp/common/state.d.ts +286 -0
  118. package/dist/vendor/ahp/common/state.d.ts.map +1 -0
  119. package/dist/vendor/ahp/common/state.js +11 -0
  120. package/dist/vendor/ahp/common/state.js.map +1 -0
  121. package/dist/vendor/ahp/errors.d.ts +8 -0
  122. package/dist/vendor/ahp/errors.d.ts.map +1 -0
  123. package/dist/vendor/ahp/errors.js +9 -0
  124. package/dist/vendor/ahp/errors.js.map +1 -0
  125. package/dist/vendor/ahp/index.d.ts +24 -0
  126. package/dist/vendor/ahp/index.d.ts.map +1 -0
  127. package/dist/vendor/ahp/index.js +21 -0
  128. package/dist/vendor/ahp/index.js.map +1 -0
  129. package/dist/vendor/ahp/messages.d.ts +8 -0
  130. package/dist/vendor/ahp/messages.d.ts.map +1 -0
  131. package/dist/vendor/ahp/messages.js +9 -0
  132. package/dist/vendor/ahp/messages.js.map +1 -0
  133. package/dist/vendor/ahp/notifications.d.ts +11 -0
  134. package/dist/vendor/ahp/notifications.d.ts.map +1 -0
  135. package/dist/vendor/ahp/notifications.js +12 -0
  136. package/dist/vendor/ahp/notifications.js.map +1 -0
  137. package/dist/vendor/ahp/reducers.d.ts +12 -0
  138. package/dist/vendor/ahp/reducers.d.ts.map +1 -0
  139. package/dist/vendor/ahp/reducers.js +13 -0
  140. package/dist/vendor/ahp/reducers.js.map +1 -0
  141. package/dist/vendor/ahp/state.d.ts +15 -0
  142. package/dist/vendor/ahp/state.d.ts.map +1 -0
  143. package/dist/vendor/ahp/state.js +16 -0
  144. package/dist/vendor/ahp/state.js.map +1 -0
  145. package/dist/vendor/ahp/version/message-checks.d.ts +15 -0
  146. package/dist/vendor/ahp/version/message-checks.d.ts.map +1 -0
  147. package/dist/vendor/ahp/version/message-checks.js +16 -0
  148. package/dist/vendor/ahp/version/message-checks.js.map +1 -0
  149. package/dist/vendor/ahp/version/registry.d.ts +56 -0
  150. package/dist/vendor/ahp/version/registry.d.ts.map +1 -0
  151. package/dist/vendor/ahp/version/registry.js +138 -0
  152. package/dist/vendor/ahp/version/registry.js.map +1 -0
  153. package/package.json +47 -0
@@ -0,0 +1,736 @@
1
+ /**
2
+ * Session Channel Actions — Mutations of an `ahp-session:` channel's state.
3
+ *
4
+ * @module channels-session/actions
5
+ */
6
+ import { ActionType } from '../common/actions.js';
7
+ import type { URI, StringOrMarkdown, ErrorInfo, FileEdit, UsageInfo } from '../common/state.js';
8
+ import type { UserMessage, ResponsePart, ToolCallResult, ToolResultContent, ToolDefinition, SessionActiveClient, SessionCustomization, CustomizationRef, CustomizationAgentRef, SessionInputAnswer, SessionInputRequest, SessionInputResponseKind, ConfirmationOption, CustomizationStatus, AgentSelection } from './state.js';
9
+ import type { ModelSelection } from '../channels-root/state.js';
10
+ import { ToolCallConfirmationReason, ToolCallCancellationReason, PendingMessageKind } from './state.js';
11
+ import type { ChangesetSummary } from '../channels-changeset/state.js';
12
+ /**
13
+ * Base interface for all tool-call-scoped actions, carrying the common turn
14
+ * and tool call identifiers. The owning session URI is identified by the
15
+ * enclosing {@link ActionEnvelope}'s `channel` field.
16
+ *
17
+ * @category Session Actions
18
+ */
19
+ interface ToolCallActionBase {
20
+ /** Turn identifier */
21
+ turnId: string;
22
+ /** Tool call identifier */
23
+ toolCallId: string;
24
+ /**
25
+ * Additional provider-specific metadata for this tool call.
26
+ *
27
+ * Clients MAY look for well-known keys here to provide enhanced UI.
28
+ * For example, a `ptyTerminal` key with `{ input: string; output: string }`
29
+ * indicates the tool operated on a terminal (both `input` and `output` may
30
+ * contain escape sequences).
31
+ */
32
+ _meta?: Record<string, unknown>;
33
+ }
34
+ /**
35
+ * Session backend initialized successfully.
36
+ *
37
+ * @category Session Actions
38
+ * @version 1
39
+ */
40
+ export interface SessionReadyAction {
41
+ type: ActionType.SessionReady;
42
+ }
43
+ /**
44
+ * Session backend failed to initialize.
45
+ *
46
+ * @category Session Actions
47
+ * @version 1
48
+ */
49
+ export interface SessionCreationFailedAction {
50
+ type: ActionType.SessionCreationFailed;
51
+ /** Error details */
52
+ error: ErrorInfo;
53
+ }
54
+ /**
55
+ * User sent a message; server starts agent processing.
56
+ *
57
+ * @category Session Actions
58
+ * @version 1
59
+ * @clientDispatchable
60
+ */
61
+ export interface SessionTurnStartedAction {
62
+ type: ActionType.SessionTurnStarted;
63
+ /** Turn identifier */
64
+ turnId: string;
65
+ /** User's message */
66
+ userMessage: UserMessage;
67
+ /** If this turn was auto-started from a queued message, the ID of that message */
68
+ queuedMessageId?: string;
69
+ }
70
+ /**
71
+ * Streaming text chunk from the assistant, appended to a specific response part.
72
+ *
73
+ * The server MUST first emit a `session/responsePart` to create the target
74
+ * part (markdown or reasoning), then use this action to append text to it.
75
+ *
76
+ * @category Session Actions
77
+ * @version 1
78
+ */
79
+ export interface SessionDeltaAction {
80
+ type: ActionType.SessionDelta;
81
+ /** Turn identifier */
82
+ turnId: string;
83
+ /** Identifier of the response part to append to */
84
+ partId: string;
85
+ /** Text chunk */
86
+ content: string;
87
+ }
88
+ /**
89
+ * Structured content appended to the response.
90
+ *
91
+ * @category Session Actions
92
+ * @version 1
93
+ */
94
+ export interface SessionResponsePartAction {
95
+ type: ActionType.SessionResponsePart;
96
+ /** Turn identifier */
97
+ turnId: string;
98
+ /** Response part (markdown or content ref) */
99
+ part: ResponsePart;
100
+ }
101
+ /**
102
+ * A tool call begins — parameters are streaming from the LM.
103
+ *
104
+ * For client-provided tools, the server sets `toolClientId` to identify the
105
+ * owning client. That client is responsible for executing the tool once it
106
+ * reaches the `running` state and dispatching `session/toolCallComplete`.
107
+ *
108
+ * @category Session Actions
109
+ * @version 1
110
+ */
111
+ export interface SessionToolCallStartAction extends ToolCallActionBase {
112
+ type: ActionType.SessionToolCallStart;
113
+ /** Internal tool name (for debugging/logging) */
114
+ toolName: string;
115
+ /** Human-readable tool name */
116
+ displayName: string;
117
+ /**
118
+ * If this tool is provided by a client, the `clientId` of the owning client.
119
+ * Absent for server-side tools.
120
+ */
121
+ toolClientId?: string;
122
+ }
123
+ /**
124
+ * Streaming partial parameters for a tool call.
125
+ *
126
+ * @category Session Actions
127
+ * @version 1
128
+ */
129
+ export interface SessionToolCallDeltaAction extends ToolCallActionBase {
130
+ type: ActionType.SessionToolCallDelta;
131
+ /** Partial parameter content to append */
132
+ content: string;
133
+ /** Updated progress message */
134
+ invocationMessage?: StringOrMarkdown;
135
+ }
136
+ /**
137
+ * Tool call parameters are complete, or a running tool requires re-confirmation.
138
+ *
139
+ * When dispatched for a `streaming` tool call, transitions to `pending-confirmation`
140
+ * or directly to `running` if `confirmed` is set.
141
+ *
142
+ * When dispatched for a `running` tool call (e.g. mid-execution permission needed),
143
+ * transitions back to `pending-confirmation`. The `invocationMessage` and `_meta`
144
+ * SHOULD be updated to describe the specific confirmation needed. Clients use the
145
+ * standard `session/toolCallConfirmed` flow to approve or deny.
146
+ *
147
+ * For client-provided tools, the server typically sets `confirmed` to
148
+ * `'not-needed'` so the tool transitions directly to `running`, where the
149
+ * owning client can begin execution immediately.
150
+ *
151
+ * @category Session Actions
152
+ * @version 1
153
+ */
154
+ export interface SessionToolCallReadyAction extends ToolCallActionBase {
155
+ type: ActionType.SessionToolCallReady;
156
+ /** Message describing what the tool will do or what confirmation is needed */
157
+ invocationMessage: StringOrMarkdown;
158
+ /** Raw tool input */
159
+ toolInput?: string;
160
+ /** Short title for the confirmation prompt (e.g. `"Run in terminal"`, `"Write file"`) */
161
+ confirmationTitle?: StringOrMarkdown;
162
+ /** File edits that this tool call will perform, for preview before confirmation */
163
+ edits?: {
164
+ items: FileEdit[];
165
+ };
166
+ /** Whether the agent host allows the client to edit the tool's input parameters before confirming */
167
+ editable?: boolean;
168
+ /** If set, the tool was auto-confirmed and transitions directly to `running` */
169
+ confirmed?: ToolCallConfirmationReason;
170
+ /**
171
+ * Options the server offers for this confirmation. When present, the client
172
+ * SHOULD render these instead of a plain approve/deny UI. Each option
173
+ * belongs to a {@link ConfirmationOptionGroup} so the client can still
174
+ * categorise the choices.
175
+ */
176
+ options?: ConfirmationOption[];
177
+ }
178
+ /**
179
+ * Client approves a pending tool call. The tool transitions to `running`.
180
+ *
181
+ * @category Session Actions
182
+ * @version 1
183
+ * @clientDispatchable
184
+ */
185
+ export interface SessionToolCallApprovedAction extends ToolCallActionBase {
186
+ type: ActionType.SessionToolCallConfirmed;
187
+ /** The tool call was approved */
188
+ approved: true;
189
+ /** How the tool was confirmed */
190
+ confirmed: ToolCallConfirmationReason;
191
+ /** Edited tool input parameters, if the client modified them before confirming */
192
+ editedToolInput?: string;
193
+ /** ID of the selected confirmation option, if the server provided options */
194
+ selectedOptionId?: string;
195
+ }
196
+ /**
197
+ * Client denies a pending tool call. The tool transitions to `cancelled`.
198
+ *
199
+ * For client-provided tools, the owning client MUST dispatch this if it does
200
+ * not recognize the tool or cannot execute it.
201
+ *
202
+ * @category Session Actions
203
+ * @version 1
204
+ * @clientDispatchable
205
+ */
206
+ export interface SessionToolCallDeniedAction extends ToolCallActionBase {
207
+ type: ActionType.SessionToolCallConfirmed;
208
+ /** The tool call was denied */
209
+ approved: false;
210
+ /** Why the tool was cancelled */
211
+ reason: ToolCallCancellationReason.Denied | ToolCallCancellationReason.Skipped;
212
+ /** What the user suggested doing instead */
213
+ userSuggestion?: UserMessage;
214
+ /** Optional explanation for the denial */
215
+ reasonMessage?: StringOrMarkdown;
216
+ /** ID of the selected confirmation option, if the server provided options */
217
+ selectedOptionId?: string;
218
+ }
219
+ /**
220
+ * Client confirms or denies a pending tool call.
221
+ *
222
+ * @category Session Actions
223
+ * @version 1
224
+ * @clientDispatchable
225
+ */
226
+ export type SessionToolCallConfirmedAction = SessionToolCallApprovedAction | SessionToolCallDeniedAction;
227
+ /**
228
+ * Tool execution finished. Transitions to `completed` or `pending-result-confirmation`
229
+ * if `requiresResultConfirmation` is `true`.
230
+ *
231
+ * For client-provided tools (where `toolClientId` is set on the tool call state),
232
+ * the owning client dispatches this action with the execution result. The server
233
+ * SHOULD reject this action if the dispatching client does not match `toolClientId`.
234
+ *
235
+ * Servers waiting on a client tool call MAY time out after a reasonable duration
236
+ * if the implementing client disconnects or becomes unresponsive, and dispatch
237
+ * this action with `result.success = false` and an appropriate error.
238
+ *
239
+ * @category Session Actions
240
+ * @version 1
241
+ * @clientDispatchable
242
+ */
243
+ export interface SessionToolCallCompleteAction extends ToolCallActionBase {
244
+ type: ActionType.SessionToolCallComplete;
245
+ /** Execution result */
246
+ result: ToolCallResult;
247
+ /** If true, the result requires client approval before finalizing */
248
+ requiresResultConfirmation?: boolean;
249
+ }
250
+ /**
251
+ * Client approves or denies a tool's result.
252
+ *
253
+ * If `approved` is `false`, the tool transitions to `cancelled` with reason `result-denied`.
254
+ *
255
+ * @category Session Actions
256
+ * @version 1
257
+ * @clientDispatchable
258
+ */
259
+ export interface SessionToolCallResultConfirmedAction extends ToolCallActionBase {
260
+ type: ActionType.SessionToolCallResultConfirmed;
261
+ /** Whether the result was approved */
262
+ approved: boolean;
263
+ }
264
+ /**
265
+ * Partial content produced while a tool is still executing.
266
+ *
267
+ * Replaces the `content` array on the running tool call state. Clients can
268
+ * use this to display live feedback (e.g. a terminal reference) before the
269
+ * tool completes.
270
+ *
271
+ * For client-provided tools (where `toolClientId` is set on the tool call state),
272
+ * the owning client dispatches this action to stream intermediate content while
273
+ * executing. The server SHOULD reject this action if the dispatching client does
274
+ * not match `toolClientId`.
275
+ *
276
+ * @category Session Actions
277
+ * @version 1
278
+ * @clientDispatchable
279
+ */
280
+ export interface SessionToolCallContentChangedAction extends ToolCallActionBase {
281
+ type: ActionType.SessionToolCallContentChanged;
282
+ /** The current partial content for the running tool call */
283
+ content: ToolResultContent[];
284
+ }
285
+ /**
286
+ * Turn finished — the assistant is idle.
287
+ *
288
+ * @category Session Actions
289
+ * @version 1
290
+ */
291
+ export interface SessionTurnCompleteAction {
292
+ type: ActionType.SessionTurnComplete;
293
+ /** Turn identifier */
294
+ turnId: string;
295
+ }
296
+ /**
297
+ * Turn was aborted; server stops processing.
298
+ *
299
+ * @category Session Actions
300
+ * @version 1
301
+ * @clientDispatchable
302
+ */
303
+ export interface SessionTurnCancelledAction {
304
+ type: ActionType.SessionTurnCancelled;
305
+ /** Turn identifier */
306
+ turnId: string;
307
+ }
308
+ /**
309
+ * Error during turn processing.
310
+ *
311
+ * @category Session Actions
312
+ * @version 1
313
+ */
314
+ export interface SessionErrorAction {
315
+ type: ActionType.SessionError;
316
+ /** Turn identifier */
317
+ turnId: string;
318
+ /** Error details */
319
+ error: ErrorInfo;
320
+ }
321
+ /**
322
+ * Session title updated. Fired by the server when the title is auto-generated
323
+ * from conversation, or dispatched by a client to rename a session.
324
+ *
325
+ * @category Session Actions
326
+ * @clientDispatchable
327
+ * @version 1
328
+ */
329
+ export interface SessionTitleChangedAction {
330
+ type: ActionType.SessionTitleChanged;
331
+ /** New title */
332
+ title: string;
333
+ }
334
+ /**
335
+ * Token usage report for a turn.
336
+ *
337
+ * @category Session Actions
338
+ * @version 1
339
+ */
340
+ export interface SessionUsageAction {
341
+ type: ActionType.SessionUsage;
342
+ /** Turn identifier */
343
+ turnId: string;
344
+ /** Token usage data */
345
+ usage: UsageInfo;
346
+ }
347
+ /**
348
+ * Reasoning/thinking text from the model, appended to a specific reasoning response part.
349
+ *
350
+ * The server MUST first emit a `session/responsePart` to create the target
351
+ * reasoning part, then use this action to append text to it.
352
+ *
353
+ * @category Session Actions
354
+ * @version 1
355
+ */
356
+ export interface SessionReasoningAction {
357
+ type: ActionType.SessionReasoning;
358
+ /** Turn identifier */
359
+ turnId: string;
360
+ /** Identifier of the reasoning response part to append to */
361
+ partId: string;
362
+ /** Reasoning text chunk */
363
+ content: string;
364
+ }
365
+ /**
366
+ * Model changed for this session.
367
+ *
368
+ * @category Session Actions
369
+ * @version 1
370
+ * @clientDispatchable
371
+ */
372
+ export interface SessionModelChangedAction {
373
+ type: ActionType.SessionModelChanged;
374
+ /** New model selection */
375
+ model: ModelSelection;
376
+ }
377
+ /**
378
+ * Custom agent selection changed for this session.
379
+ *
380
+ * Omitting `agent` (or setting it to `undefined`) clears the selection and
381
+ * resets the session to no selected custom agent (provider default behavior).
382
+ *
383
+ * When a turn is currently active, the server MUST defer the change until
384
+ * the active turn completes, then apply it for the next turn (same rule as
385
+ * {@link SessionModelChangedAction | `session/modelChanged`}).
386
+ *
387
+ * @category Session Actions
388
+ * @version 1
389
+ * @clientDispatchable
390
+ */
391
+ export interface SessionAgentChangedAction {
392
+ type: ActionType.SessionAgentChanged;
393
+ /**
394
+ * New agent selection, or `undefined` to clear the selection and reset the
395
+ * session to no selected custom agent.
396
+ */
397
+ agent?: AgentSelection;
398
+ }
399
+ /**
400
+ * The read state of the session changed.
401
+ *
402
+ * Dispatched by a client to mark a session as read (e.g. after viewing it)
403
+ * or unread (e.g. after new activity since the client last looked at it).
404
+ *
405
+ * @category Session Actions
406
+ * @version 1
407
+ * @clientDispatchable
408
+ */
409
+ export interface SessionIsReadChangedAction {
410
+ type: ActionType.SessionIsReadChanged;
411
+ /** Whether the session has been read */
412
+ isRead: boolean;
413
+ }
414
+ /**
415
+ * The archived state of the session changed.
416
+ *
417
+ * Dispatched by a client to archive a session (e.g. the task is
418
+ * complete) or to unarchive it.
419
+ *
420
+ * @category Session Actions
421
+ * @version 1
422
+ * @clientDispatchable
423
+ */
424
+ export interface SessionIsArchivedChangedAction {
425
+ type: ActionType.SessionIsArchivedChanged;
426
+ /** Whether the session is archived */
427
+ isArchived: boolean;
428
+ }
429
+ /**
430
+ * The activity description of the session changed.
431
+ *
432
+ * Dispatched by the server to indicate what the session is currently doing
433
+ * (e.g. running a tool, thinking). Clear activity by setting it to `undefined`.
434
+ *
435
+ * @category Session Actions
436
+ * @version 1
437
+ */
438
+ export interface SessionActivityChangedAction {
439
+ type: ActionType.SessionActivityChanged;
440
+ /** Human-readable description of current activity, or `undefined` to clear */
441
+ activity: string | undefined;
442
+ }
443
+ /**
444
+ * The {@link ChangesetSummary | catalogue of changesets} the agent host
445
+ * advertises for this session changed. Replaces
446
+ * `state.summary.changesets` entirely (full-replacement semantics) — set
447
+ * to `undefined` to clear the catalogue.
448
+ *
449
+ * Producers dispatch this whenever entries are added, removed, or have
450
+ * their aggregate counts (`additions` / `deletions` / `files`) refreshed.
451
+ * The fan-out happens through this action so observers see catalogue
452
+ * mutations in the same {@link ChangesetAction | per-changeset} action
453
+ * stream they already follow for file-level updates.
454
+ *
455
+ * @category Session Actions
456
+ * @version 1
457
+ */
458
+ export interface SessionChangesetsChangedAction {
459
+ type: ActionType.SessionChangesetsChanged;
460
+ /** New catalogue, or `undefined` to clear it */
461
+ changesets: ChangesetSummary[] | undefined;
462
+ }
463
+ /**
464
+ * Server tools for this session have changed.
465
+ *
466
+ * Full-replacement semantics: the `tools` array replaces the previous `serverTools` entirely.
467
+ *
468
+ * @category Session Actions
469
+ * @version 1
470
+ */
471
+ export interface SessionServerToolsChangedAction {
472
+ type: ActionType.SessionServerToolsChanged;
473
+ /** Updated server tools list (full replacement) */
474
+ tools: ToolDefinition[];
475
+ }
476
+ /**
477
+ * The active client for this session has changed.
478
+ *
479
+ * A client dispatches this action with its own `SessionActiveClient` to claim
480
+ * the active role, or with `null` to release it. The server SHOULD reject if
481
+ * another client is already active. The server SHOULD automatically dispatch
482
+ * this action with `activeClient: null` when the active client disconnects.
483
+ *
484
+ * @category Session Actions
485
+ * @version 1
486
+ * @clientDispatchable
487
+ */
488
+ export interface SessionActiveClientChangedAction {
489
+ type: ActionType.SessionActiveClientChanged;
490
+ /** The new active client, or `null` to unset */
491
+ activeClient: SessionActiveClient | null;
492
+ }
493
+ /**
494
+ * The active client's tool list has changed.
495
+ *
496
+ * Full-replacement semantics: the `tools` array replaces the active client's
497
+ * previous tools entirely. The server SHOULD reject if the dispatching client
498
+ * is not the current active client.
499
+ *
500
+ * @category Session Actions
501
+ * @version 1
502
+ * @clientDispatchable
503
+ */
504
+ export interface SessionActiveClientToolsChangedAction {
505
+ type: ActionType.SessionActiveClientToolsChanged;
506
+ /** Updated client tools list (full replacement) */
507
+ tools: ToolDefinition[];
508
+ }
509
+ /**
510
+ * The session's customizations have changed.
511
+ *
512
+ * Full-replacement semantics: the `customizations` array replaces the
513
+ * previous `customizations` entirely.
514
+ *
515
+ * @category Session Actions
516
+ * @version 1
517
+ */
518
+ export interface SessionCustomizationsChangedAction {
519
+ type: ActionType.SessionCustomizationsChanged;
520
+ /** Updated customization list (full replacement) */
521
+ customizations: SessionCustomization[];
522
+ }
523
+ /**
524
+ * A client toggled a customization on or off.
525
+ *
526
+ * The server locates the customization by `uri` in the session's
527
+ * customization list and sets its `enabled` flag.
528
+ *
529
+ * @category Session Actions
530
+ * @version 1
531
+ * @clientDispatchable
532
+ */
533
+ export interface SessionCustomizationToggledAction {
534
+ type: ActionType.SessionCustomizationToggled;
535
+ /** The URI of the customization to toggle */
536
+ uri: URI;
537
+ /** Whether to enable or disable the customization */
538
+ enabled: boolean;
539
+ }
540
+ /**
541
+ * Upserts mutable fields on a single customization.
542
+ *
543
+ * Dispatched by the server to update one or more fields on a customization,
544
+ * or to add a new customization to the session, without republishing the
545
+ * entire `customizations` list. The reducer locates the existing entry by
546
+ * `customization.uri`:
547
+ *
548
+ * - If an entry exists, each provided field is assigned; absent (or
549
+ * `undefined`) fields are left unchanged. The stored `customization`
550
+ * ref is replaced with the one in the action.
551
+ * - If no entry exists, a new {@link SessionCustomization} is appended
552
+ * using the provided fields; `enabled` defaults to `false` when absent.
553
+ *
554
+ * @category Session Actions
555
+ * @version 1
556
+ */
557
+ export interface SessionCustomizationUpdatedAction {
558
+ type: ActionType.SessionCustomizationUpdated;
559
+ /** The customization to update or insert (matched by `customization.uri`) */
560
+ customization: CustomizationRef;
561
+ /** New enabled state (defaults to `false` on insert) */
562
+ enabled?: boolean;
563
+ /** New loading status */
564
+ status?: CustomizationStatus;
565
+ /** New human-readable status detail */
566
+ statusMessage?: string;
567
+ /**
568
+ * Custom agents contributed by this customization, as resolved by the
569
+ * agent host. Populated only by the agent host. See
570
+ * {@link SessionCustomization.agents} for absent-vs-empty semantics.
571
+ */
572
+ agents?: CustomizationAgentRef[];
573
+ }
574
+ /**
575
+ * Client changed a mutable config value mid-session.
576
+ *
577
+ * Only properties with `sessionMutable: true` in the config schema may be
578
+ * changed. The server validates and broadcasts the action; the reducer merges
579
+ * the new values into `state.config.values`.
580
+ *
581
+ * @category Session Actions
582
+ * @version 1
583
+ * @clientDispatchable
584
+ */
585
+ export interface SessionConfigChangedAction {
586
+ type: ActionType.SessionConfigChanged;
587
+ /** Updated config values */
588
+ config: Record<string, unknown>;
589
+ /** When `true`, replaces all config values instead of merging */
590
+ replace?: boolean;
591
+ }
592
+ /**
593
+ * The session's `_meta` side-channel changed. Replaces `state._meta`
594
+ * entirely (full-replacement semantics). Producers SHOULD merge any
595
+ * keys they wish to preserve into the new value before dispatching.
596
+ *
597
+ * @category Session Actions
598
+ * @version 1
599
+ */
600
+ export interface SessionMetaChangedAction {
601
+ type: ActionType.SessionMetaChanged;
602
+ /** New `_meta` payload, or `undefined` to clear it */
603
+ _meta: Record<string, unknown> | undefined;
604
+ }
605
+ /**
606
+ * Truncates a session's history. If `turnId` is provided, all turns after that
607
+ * turn are removed and the specified turn is kept. If `turnId` is omitted, all
608
+ * turns are removed.
609
+ *
610
+ * If there is an active turn it is silently dropped and the session status
611
+ * returns to `idle`.
612
+ *
613
+ * Common use-case: truncate old data then dispatch a new
614
+ * `session/turnStarted` with an edited message.
615
+ *
616
+ * @category Session Actions
617
+ * @version 1
618
+ * @clientDispatchable
619
+ */
620
+ export interface SessionTruncatedAction {
621
+ type: ActionType.SessionTruncated;
622
+ /** Keep turns up to and including this turn. Omit to clear all turns. */
623
+ turnId?: string;
624
+ }
625
+ /**
626
+ * A pending message was set (upsert semantics: creates or replaces).
627
+ *
628
+ * For steering messages, this always replaces the single steering message.
629
+ * For queued messages, if a message with the given `id` already exists it is
630
+ * updated in place; otherwise it is appended to the queue. If the session is
631
+ * idle when a queued message is set, the server SHOULD immediately consume it
632
+ * and start a new turn.
633
+ *
634
+ * @category Session Actions
635
+ * @version 1
636
+ * @clientDispatchable
637
+ */
638
+ export interface SessionPendingMessageSetAction {
639
+ type: ActionType.SessionPendingMessageSet;
640
+ /** Whether this is a steering or queued message */
641
+ kind: PendingMessageKind;
642
+ /** Unique identifier for this pending message */
643
+ id: string;
644
+ /** The message content */
645
+ userMessage: UserMessage;
646
+ }
647
+ /**
648
+ * A pending message was removed (steering or queued).
649
+ *
650
+ * Dispatched by clients to cancel a pending message, or by the server when
651
+ * it consumes a message (e.g. starting a turn from a queued message or
652
+ * injecting a steering message into the current turn).
653
+ *
654
+ * @category Session Actions
655
+ * @version 1
656
+ * @clientDispatchable
657
+ */
658
+ export interface SessionPendingMessageRemovedAction {
659
+ type: ActionType.SessionPendingMessageRemoved;
660
+ /** Whether this is a steering or queued message */
661
+ kind: PendingMessageKind;
662
+ /** Identifier of the pending message to remove */
663
+ id: string;
664
+ }
665
+ /**
666
+ * Reorder the queued messages.
667
+ *
668
+ * The `order` array contains the IDs of queued messages in their new
669
+ * desired order. IDs not present in the current queue are ignored.
670
+ * Queued messages whose IDs are absent from `order` are appended at
671
+ * the end in their original relative order (so a client with a stale
672
+ * view of the queue never silently drops messages).
673
+ *
674
+ * @category Session Actions
675
+ * @version 1
676
+ * @clientDispatchable
677
+ */
678
+ export interface SessionQueuedMessagesReorderedAction {
679
+ type: ActionType.SessionQueuedMessagesReordered;
680
+ /** Queued message IDs in the desired order */
681
+ order: string[];
682
+ }
683
+ /**
684
+ * A session requested input from the user.
685
+ *
686
+ * Full-request upsert semantics: the `request` replaces any existing request
687
+ * with the same `id`, or is appended if it is new. Answer drafts are preserved
688
+ * unless `request.answers` is provided.
689
+ *
690
+ * @category Session Actions
691
+ * @version 1
692
+ */
693
+ export interface SessionInputRequestedAction {
694
+ type: ActionType.SessionInputRequested;
695
+ /** Input request to create or replace */
696
+ request: SessionInputRequest;
697
+ }
698
+ /**
699
+ * A client updated, submitted, skipped, or removed a single in-progress answer.
700
+ *
701
+ * Dispatching with `answer: undefined` removes that question's answer draft.
702
+ *
703
+ * @category Session Actions
704
+ * @version 1
705
+ * @clientDispatchable
706
+ */
707
+ export interface SessionInputAnswerChangedAction {
708
+ type: ActionType.SessionInputAnswerChanged;
709
+ /** Input request identifier */
710
+ requestId: string;
711
+ /** Question identifier within the input request */
712
+ questionId: string;
713
+ /** Updated answer, or `undefined` to clear an answer draft */
714
+ answer?: SessionInputAnswer;
715
+ }
716
+ /**
717
+ * A client accepted, declined, or cancelled a session input request.
718
+ *
719
+ * If accepted, the server uses `answers` (when provided) plus the request's
720
+ * synced answer state to resume the blocked operation.
721
+ *
722
+ * @category Session Actions
723
+ * @version 1
724
+ * @clientDispatchable
725
+ */
726
+ export interface SessionInputCompletedAction {
727
+ type: ActionType.SessionInputCompleted;
728
+ /** Input request identifier */
729
+ requestId: string;
730
+ /** Completion outcome */
731
+ response: SessionInputResponseKind;
732
+ /** Optional final answer replacement, keyed by question ID */
733
+ answers?: Record<string, SessionInputAnswer>;
734
+ }
735
+ export {};
736
+ //# sourceMappingURL=actions.d.ts.map