@amends-dev/harness-opencode 0.0.0-stage → 0.2.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 (95) hide show
  1. package/LICENSE +21 -0
  2. package/Opencode2Agent.d.ts +105 -0
  3. package/Opencode2Agent.d.ts.map +1 -0
  4. package/Opencode2Agent.js +72 -0
  5. package/Opencode2Agent.js.map +1 -0
  6. package/OpencodeAgent.d.ts +110 -0
  7. package/OpencodeAgent.d.ts.map +1 -0
  8. package/OpencodeAgent.js +83 -0
  9. package/OpencodeAgent.js.map +1 -0
  10. package/README.md +223 -2
  11. package/index.d.ts +18 -0
  12. package/index.d.ts.map +1 -0
  13. package/index.js +19 -0
  14. package/index.js.map +1 -0
  15. package/internal/agent.d.ts +29 -0
  16. package/internal/agent.d.ts.map +1 -0
  17. package/internal/agent.js +34 -0
  18. package/internal/agent.js.map +1 -0
  19. package/internal/bridge/bunBridge.d.ts +33 -0
  20. package/internal/bridge/bunBridge.d.ts.map +1 -0
  21. package/internal/bridge/bunBridge.js +62 -0
  22. package/internal/bridge/bunBridge.js.map +1 -0
  23. package/internal/bridge/driver.d.ts +81 -0
  24. package/internal/bridge/driver.d.ts.map +1 -0
  25. package/internal/bridge/driver.js +82 -0
  26. package/internal/bridge/driver.js.map +1 -0
  27. package/internal/bridge/hostTools.d.ts +28 -0
  28. package/internal/bridge/hostTools.d.ts.map +1 -0
  29. package/internal/bridge/hostTools.js +41 -0
  30. package/internal/bridge/hostTools.js.map +1 -0
  31. package/internal/bridge/server.d.ts +64 -0
  32. package/internal/bridge/server.d.ts.map +1 -0
  33. package/internal/bridge/server.js +129 -0
  34. package/internal/bridge/server.js.map +1 -0
  35. package/internal/bridge/steps.d.ts +29 -0
  36. package/internal/bridge/steps.d.ts.map +1 -0
  37. package/internal/bridge/steps.js +42 -0
  38. package/internal/bridge/steps.js.map +1 -0
  39. package/internal/bridge/v1/api.d.ts +181 -0
  40. package/internal/bridge/v1/api.d.ts.map +1 -0
  41. package/internal/bridge/v1/api.js +83 -0
  42. package/internal/bridge/v1/api.js.map +1 -0
  43. package/internal/bridge/v1/event.d.ts +597 -0
  44. package/internal/bridge/v1/event.d.ts.map +1 -0
  45. package/internal/bridge/v1/event.js +186 -0
  46. package/internal/bridge/v1/event.js.map +1 -0
  47. package/internal/bridge/v1/main.d.ts +6 -0
  48. package/internal/bridge/v1/main.d.ts.map +1 -0
  49. package/internal/bridge/v1/main.js +8 -0
  50. package/internal/bridge/v1/main.js.map +1 -0
  51. package/internal/bridge/v1/prompt.d.ts +18 -0
  52. package/internal/bridge/v1/prompt.d.ts.map +1 -0
  53. package/internal/bridge/v1/prompt.js +92 -0
  54. package/internal/bridge/v1/prompt.js.map +1 -0
  55. package/internal/bridge/v1/session.d.ts +28 -0
  56. package/internal/bridge/v1/session.d.ts.map +1 -0
  57. package/internal/bridge/v1/session.js +188 -0
  58. package/internal/bridge/v1/session.js.map +1 -0
  59. package/internal/bridge/v1/turn.d.ts +82 -0
  60. package/internal/bridge/v1/turn.d.ts.map +1 -0
  61. package/internal/bridge/v1/turn.js +335 -0
  62. package/internal/bridge/v1/turn.js.map +1 -0
  63. package/internal/bridge/v2/api.d.ts +86 -0
  64. package/internal/bridge/v2/api.d.ts.map +1 -0
  65. package/internal/bridge/v2/api.js +105 -0
  66. package/internal/bridge/v2/api.js.map +1 -0
  67. package/internal/bridge/v2/event.d.ts +539 -0
  68. package/internal/bridge/v2/event.d.ts.map +1 -0
  69. package/internal/bridge/v2/event.js +164 -0
  70. package/internal/bridge/v2/event.js.map +1 -0
  71. package/internal/bridge/v2/main.d.ts +6 -0
  72. package/internal/bridge/v2/main.d.ts.map +1 -0
  73. package/internal/bridge/v2/main.js +8 -0
  74. package/internal/bridge/v2/main.js.map +1 -0
  75. package/internal/bridge/v2/prompt.d.ts +109 -0
  76. package/internal/bridge/v2/prompt.d.ts.map +1 -0
  77. package/internal/bridge/v2/prompt.js +209 -0
  78. package/internal/bridge/v2/prompt.js.map +1 -0
  79. package/internal/bridge/v2/session.d.ts +21 -0
  80. package/internal/bridge/v2/session.d.ts.map +1 -0
  81. package/internal/bridge/v2/session.js +198 -0
  82. package/internal/bridge/v2/session.js.map +1 -0
  83. package/internal/bridge/v2/turn.d.ts +62 -0
  84. package/internal/bridge/v2/turn.d.ts.map +1 -0
  85. package/internal/bridge/v2/turn.js +277 -0
  86. package/internal/bridge/v2/turn.js.map +1 -0
  87. package/internal/models.d.ts +47 -0
  88. package/internal/models.d.ts.map +1 -0
  89. package/internal/models.js +170 -0
  90. package/internal/models.js.map +1 -0
  91. package/internal/template.d.ts +46 -0
  92. package/internal/template.d.ts.map +1 -0
  93. package/internal/template.js +267 -0
  94. package/internal/template.js.map +1 -0
  95. package/package.json +39 -4
@@ -0,0 +1,597 @@
1
+ /**
2
+ * The events opencode publishes on its event stream in opencode 1's session API: a message of a
3
+ * session being written, each of its parts as it changes, the deltas of a text as it streams, the
4
+ * session's status, and what a tool asks of the session's user. opencode keeps a message's parts
5
+ * as the latest state of each, not as events, and publishes each change to the instance of one
6
+ * directory, live only.
7
+ *
8
+ * The schemas are opencode 1.18's, for the events this adapter reads, with the fields it reads of
9
+ * them; other fields pass. Each step of a turn is an assistant message of its own, complete once
10
+ * its `time.completed` is set. Text and reasoning stream as deltas of a part, whose update then
11
+ * holds it whole; a call of a tool is a part that goes from `pending` to `running`, and then to
12
+ * `completed` or `error`.
13
+ */
14
+ import * as Schema from "effect/Schema";
15
+ /** What opencode reports of a failure: its kind, such as `MessageAbortedError`, and its message. */
16
+ export declare const Failure: Schema.Struct<{
17
+ readonly name: Schema.String;
18
+ readonly data: Schema.optional<Schema.Struct<{
19
+ readonly message: Schema.optional<Schema.String>;
20
+ }>>;
21
+ }>;
22
+ export type Failure = typeof Failure.Type;
23
+ /** A text of the message. Its `text` is whole once `time.end` is set. */
24
+ export declare const TextPart: Schema.Struct<{
25
+ readonly id: Schema.String;
26
+ readonly sessionID: Schema.String;
27
+ readonly messageID: Schema.String;
28
+ readonly type: Schema.tag<"text">;
29
+ readonly text: Schema.String;
30
+ readonly time: Schema.optional<Schema.Struct<{
31
+ readonly start: Schema.optional<Schema.Finite>;
32
+ readonly end: Schema.optional<Schema.Finite>;
33
+ }>>;
34
+ }>;
35
+ /** A reasoning of the message, whole once `time.end` is set. */
36
+ export declare const ReasoningPart: Schema.Struct<{
37
+ readonly id: Schema.String;
38
+ readonly sessionID: Schema.String;
39
+ readonly messageID: Schema.String;
40
+ readonly type: Schema.tag<"reasoning">;
41
+ readonly text: Schema.String;
42
+ readonly time: Schema.optional<Schema.Struct<{
43
+ readonly start: Schema.optional<Schema.Finite>;
44
+ readonly end: Schema.optional<Schema.Finite>;
45
+ }>>;
46
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
47
+ }>;
48
+ export declare const ToolState: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
49
+ readonly status: Schema.tag<"pending">;
50
+ }>, Schema.Struct<{
51
+ readonly status: Schema.tag<"running">;
52
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
53
+ }>, Schema.Struct<{
54
+ readonly status: Schema.tag<"completed">;
55
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
56
+ readonly output: Schema.String;
57
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
58
+ }>, Schema.Struct<{
59
+ readonly status: Schema.tag<"error">;
60
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
61
+ readonly error: Schema.String;
62
+ }>]>;
63
+ export type ToolState = typeof ToolState.Type;
64
+ /** A call of the tool `tool`, in the state `state`. */
65
+ export declare const ToolPart: Schema.Struct<{
66
+ readonly id: Schema.String;
67
+ readonly sessionID: Schema.String;
68
+ readonly messageID: Schema.String;
69
+ readonly type: Schema.tag<"tool">;
70
+ readonly callID: Schema.String;
71
+ readonly tool: Schema.String;
72
+ readonly state: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
73
+ readonly status: Schema.tag<"pending">;
74
+ }>, Schema.Struct<{
75
+ readonly status: Schema.tag<"running">;
76
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
77
+ }>, Schema.Struct<{
78
+ readonly status: Schema.tag<"completed">;
79
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
80
+ readonly output: Schema.String;
81
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
82
+ }>, Schema.Struct<{
83
+ readonly status: Schema.tag<"error">;
84
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
85
+ readonly error: Schema.String;
86
+ }>]>;
87
+ }>;
88
+ export type ToolPart = typeof ToolPart.Type;
89
+ /** A part of a type the adapter does not read, such as a step's start, or a snapshot. */
90
+ export declare const OtherPart: Schema.Struct<{
91
+ readonly id: Schema.String;
92
+ readonly sessionID: Schema.String;
93
+ readonly messageID: Schema.String;
94
+ readonly type: Schema.String;
95
+ }>;
96
+ export declare const Part: Schema.Union<readonly [Schema.Struct<{
97
+ readonly id: Schema.String;
98
+ readonly sessionID: Schema.String;
99
+ readonly messageID: Schema.String;
100
+ readonly type: Schema.tag<"text">;
101
+ readonly text: Schema.String;
102
+ readonly time: Schema.optional<Schema.Struct<{
103
+ readonly start: Schema.optional<Schema.Finite>;
104
+ readonly end: Schema.optional<Schema.Finite>;
105
+ }>>;
106
+ }>, Schema.Struct<{
107
+ readonly id: Schema.String;
108
+ readonly sessionID: Schema.String;
109
+ readonly messageID: Schema.String;
110
+ readonly type: Schema.tag<"reasoning">;
111
+ readonly text: Schema.String;
112
+ readonly time: Schema.optional<Schema.Struct<{
113
+ readonly start: Schema.optional<Schema.Finite>;
114
+ readonly end: Schema.optional<Schema.Finite>;
115
+ }>>;
116
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
117
+ }>, Schema.Struct<{
118
+ readonly id: Schema.String;
119
+ readonly sessionID: Schema.String;
120
+ readonly messageID: Schema.String;
121
+ readonly type: Schema.tag<"tool">;
122
+ readonly callID: Schema.String;
123
+ readonly tool: Schema.String;
124
+ readonly state: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
125
+ readonly status: Schema.tag<"pending">;
126
+ }>, Schema.Struct<{
127
+ readonly status: Schema.tag<"running">;
128
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
129
+ }>, Schema.Struct<{
130
+ readonly status: Schema.tag<"completed">;
131
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
132
+ readonly output: Schema.String;
133
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
134
+ }>, Schema.Struct<{
135
+ readonly status: Schema.tag<"error">;
136
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
137
+ readonly error: Schema.String;
138
+ }>]>;
139
+ }>, Schema.Struct<{
140
+ readonly id: Schema.String;
141
+ readonly sessionID: Schema.String;
142
+ readonly messageID: Schema.String;
143
+ readonly type: Schema.String;
144
+ }>]>;
145
+ export type Part = typeof Part.Type;
146
+ export declare const isTextPart: <I>(input: I) => input is I & {
147
+ readonly id: string;
148
+ readonly sessionID: string;
149
+ readonly messageID: string;
150
+ readonly type: "text";
151
+ readonly text: string;
152
+ readonly time?: {
153
+ readonly start?: number | undefined;
154
+ readonly end?: number | undefined;
155
+ } | undefined;
156
+ };
157
+ export declare const isReasoningPart: <I>(input: I) => input is I & {
158
+ readonly id: string;
159
+ readonly sessionID: string;
160
+ readonly messageID: string;
161
+ readonly type: "reasoning";
162
+ readonly text: string;
163
+ readonly time?: {
164
+ readonly start?: number | undefined;
165
+ readonly end?: number | undefined;
166
+ } | undefined;
167
+ readonly metadata?: {
168
+ readonly [x: string]: unknown;
169
+ } | undefined;
170
+ };
171
+ export declare const isToolPart: <I>(input: I) => input is I & {
172
+ readonly id: string;
173
+ readonly sessionID: string;
174
+ readonly messageID: string;
175
+ readonly type: "tool";
176
+ readonly callID: string;
177
+ readonly tool: string;
178
+ readonly state: {
179
+ readonly status: "pending";
180
+ } | {
181
+ readonly status: "running";
182
+ readonly input: {
183
+ readonly [x: string]: unknown;
184
+ };
185
+ } | {
186
+ readonly status: "completed";
187
+ readonly input: {
188
+ readonly [x: string]: unknown;
189
+ };
190
+ readonly output: string;
191
+ readonly metadata?: {
192
+ readonly [x: string]: unknown;
193
+ } | undefined;
194
+ } | {
195
+ readonly status: "error";
196
+ readonly input: {
197
+ readonly [x: string]: unknown;
198
+ };
199
+ readonly error: string;
200
+ };
201
+ };
202
+ /** A model, as opencode 1 names one in a prompt: its provider, and its id there. */
203
+ export declare const MessageModel: Schema.Struct<{
204
+ readonly providerID: Schema.String;
205
+ readonly modelID: Schema.String;
206
+ }>;
207
+ export interface MessageModel extends Schema.Schema.Type<typeof MessageModel> {
208
+ }
209
+ /**
210
+ * An assistant message: one step of a turn. It is complete once `time.completed` is set, having
211
+ * ended as `finish` says, or failed with `error`. A step that answered in JSON holds the answer as
212
+ * `structured`, and one that summarized the conversation is a `summary`.
213
+ */
214
+ export declare const AssistantMessage: Schema.Struct<{
215
+ readonly id: Schema.String;
216
+ readonly sessionID: Schema.String;
217
+ readonly role: Schema.tag<"assistant">;
218
+ readonly providerID: Schema.String;
219
+ readonly modelID: Schema.String;
220
+ readonly time: Schema.Struct<{
221
+ readonly created: Schema.Finite;
222
+ readonly completed: Schema.optional<Schema.Finite>;
223
+ }>;
224
+ readonly error: Schema.optional<Schema.Struct<{
225
+ readonly name: Schema.String;
226
+ readonly data: Schema.optional<Schema.Struct<{
227
+ readonly message: Schema.optional<Schema.String>;
228
+ }>>;
229
+ }>>;
230
+ readonly summary: Schema.optional<Schema.Boolean>;
231
+ readonly tokens: Schema.optional<Schema.Struct<{
232
+ readonly input: Schema.Int;
233
+ readonly output: Schema.Int;
234
+ readonly reasoning: Schema.Int;
235
+ readonly cache: Schema.Struct<{
236
+ readonly read: Schema.Int;
237
+ readonly write: Schema.Int;
238
+ }>;
239
+ }>>;
240
+ readonly structured: Schema.optional<Schema.Unknown>;
241
+ readonly finish: Schema.optional<Schema.String>;
242
+ }>;
243
+ export type AssistantMessage = typeof AssistantMessage.Type;
244
+ /** A user message: a prompt the session took. */
245
+ export declare const UserMessage: Schema.Struct<{
246
+ readonly id: Schema.String;
247
+ readonly sessionID: Schema.String;
248
+ readonly role: Schema.tag<"user">;
249
+ }>;
250
+ export declare const Message: Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
251
+ readonly id: Schema.String;
252
+ readonly sessionID: Schema.String;
253
+ readonly role: Schema.tag<"assistant">;
254
+ readonly providerID: Schema.String;
255
+ readonly modelID: Schema.String;
256
+ readonly time: Schema.Struct<{
257
+ readonly created: Schema.Finite;
258
+ readonly completed: Schema.optional<Schema.Finite>;
259
+ }>;
260
+ readonly error: Schema.optional<Schema.Struct<{
261
+ readonly name: Schema.String;
262
+ readonly data: Schema.optional<Schema.Struct<{
263
+ readonly message: Schema.optional<Schema.String>;
264
+ }>>;
265
+ }>>;
266
+ readonly summary: Schema.optional<Schema.Boolean>;
267
+ readonly tokens: Schema.optional<Schema.Struct<{
268
+ readonly input: Schema.Int;
269
+ readonly output: Schema.Int;
270
+ readonly reasoning: Schema.Int;
271
+ readonly cache: Schema.Struct<{
272
+ readonly read: Schema.Int;
273
+ readonly write: Schema.Int;
274
+ }>;
275
+ }>>;
276
+ readonly structured: Schema.optional<Schema.Unknown>;
277
+ readonly finish: Schema.optional<Schema.String>;
278
+ }>, Schema.Struct<{
279
+ readonly id: Schema.String;
280
+ readonly sessionID: Schema.String;
281
+ readonly role: Schema.tag<"user">;
282
+ }>]>;
283
+ export type Message = typeof Message.Type;
284
+ /** A message was written, or changed: its latest state. */
285
+ export declare const MessageUpdated: Schema.Struct<{
286
+ readonly type: Schema.tag<"message.updated">;
287
+ readonly properties: Schema.Struct<{
288
+ readonly sessionID: Schema.String;
289
+ readonly info: Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
290
+ readonly id: Schema.String;
291
+ readonly sessionID: Schema.String;
292
+ readonly role: Schema.tag<"assistant">;
293
+ readonly providerID: Schema.String;
294
+ readonly modelID: Schema.String;
295
+ readonly time: Schema.Struct<{
296
+ readonly created: Schema.Finite;
297
+ readonly completed: Schema.optional<Schema.Finite>;
298
+ }>;
299
+ readonly error: Schema.optional<Schema.Struct<{
300
+ readonly name: Schema.String;
301
+ readonly data: Schema.optional<Schema.Struct<{
302
+ readonly message: Schema.optional<Schema.String>;
303
+ }>>;
304
+ }>>;
305
+ readonly summary: Schema.optional<Schema.Boolean>;
306
+ readonly tokens: Schema.optional<Schema.Struct<{
307
+ readonly input: Schema.Int;
308
+ readonly output: Schema.Int;
309
+ readonly reasoning: Schema.Int;
310
+ readonly cache: Schema.Struct<{
311
+ readonly read: Schema.Int;
312
+ readonly write: Schema.Int;
313
+ }>;
314
+ }>>;
315
+ readonly structured: Schema.optional<Schema.Unknown>;
316
+ readonly finish: Schema.optional<Schema.String>;
317
+ }>, Schema.Struct<{
318
+ readonly id: Schema.String;
319
+ readonly sessionID: Schema.String;
320
+ readonly role: Schema.tag<"user">;
321
+ }>]>;
322
+ }>;
323
+ }>;
324
+ /** A part of a message was written, or changed: its latest state. */
325
+ export declare const MessagePartUpdated: Schema.Struct<{
326
+ readonly type: Schema.tag<"message.part.updated">;
327
+ readonly properties: Schema.Struct<{
328
+ readonly sessionID: Schema.String;
329
+ readonly part: Schema.Union<readonly [Schema.Struct<{
330
+ readonly id: Schema.String;
331
+ readonly sessionID: Schema.String;
332
+ readonly messageID: Schema.String;
333
+ readonly type: Schema.tag<"text">;
334
+ readonly text: Schema.String;
335
+ readonly time: Schema.optional<Schema.Struct<{
336
+ readonly start: Schema.optional<Schema.Finite>;
337
+ readonly end: Schema.optional<Schema.Finite>;
338
+ }>>;
339
+ }>, Schema.Struct<{
340
+ readonly id: Schema.String;
341
+ readonly sessionID: Schema.String;
342
+ readonly messageID: Schema.String;
343
+ readonly type: Schema.tag<"reasoning">;
344
+ readonly text: Schema.String;
345
+ readonly time: Schema.optional<Schema.Struct<{
346
+ readonly start: Schema.optional<Schema.Finite>;
347
+ readonly end: Schema.optional<Schema.Finite>;
348
+ }>>;
349
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
350
+ }>, Schema.Struct<{
351
+ readonly id: Schema.String;
352
+ readonly sessionID: Schema.String;
353
+ readonly messageID: Schema.String;
354
+ readonly type: Schema.tag<"tool">;
355
+ readonly callID: Schema.String;
356
+ readonly tool: Schema.String;
357
+ readonly state: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
358
+ readonly status: Schema.tag<"pending">;
359
+ }>, Schema.Struct<{
360
+ readonly status: Schema.tag<"running">;
361
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
362
+ }>, Schema.Struct<{
363
+ readonly status: Schema.tag<"completed">;
364
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
365
+ readonly output: Schema.String;
366
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
367
+ }>, Schema.Struct<{
368
+ readonly status: Schema.tag<"error">;
369
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
370
+ readonly error: Schema.String;
371
+ }>]>;
372
+ }>, Schema.Struct<{
373
+ readonly id: Schema.String;
374
+ readonly sessionID: Schema.String;
375
+ readonly messageID: Schema.String;
376
+ readonly type: Schema.String;
377
+ }>]>;
378
+ }>;
379
+ }>;
380
+ /**
381
+ * The model wrote `delta` more of a part's `field`. opencode names the field `text` for a
382
+ * reasoning's text too.
383
+ */
384
+ export declare const MessagePartDelta: Schema.Struct<{
385
+ readonly type: Schema.tag<"message.part.delta">;
386
+ readonly properties: Schema.Struct<{
387
+ readonly sessionID: Schema.String;
388
+ readonly messageID: Schema.String;
389
+ readonly partID: Schema.String;
390
+ readonly field: Schema.String;
391
+ readonly delta: Schema.String;
392
+ }>;
393
+ }>;
394
+ /**
395
+ * The session is `busy` working on a turn, `idle`, or waiting to `retry` a request its model's
396
+ * provider refused.
397
+ */
398
+ export declare const SessionStatus: Schema.Struct<{
399
+ readonly type: Schema.tag<"session.status">;
400
+ readonly properties: Schema.Struct<{
401
+ readonly sessionID: Schema.String;
402
+ readonly status: Schema.Struct<{
403
+ readonly type: Schema.String;
404
+ }>;
405
+ }>;
406
+ }>;
407
+ /** The session stopped working on its turn, whether the turn ended or failed. */
408
+ export declare const SessionIdle: Schema.Struct<{
409
+ readonly type: Schema.tag<"session.idle">;
410
+ readonly properties: Schema.Struct<{
411
+ readonly sessionID: Schema.String;
412
+ }>;
413
+ }>;
414
+ /** The session's turn failed, as when its model's provider refused it, or it was aborted. */
415
+ export declare const SessionErrored: Schema.Struct<{
416
+ readonly type: Schema.tag<"session.error">;
417
+ readonly properties: Schema.Struct<{
418
+ readonly sessionID: Schema.optional<Schema.String>;
419
+ readonly error: Schema.optional<Schema.Struct<{
420
+ readonly name: Schema.String;
421
+ readonly data: Schema.optional<Schema.Struct<{
422
+ readonly message: Schema.optional<Schema.String>;
423
+ }>>;
424
+ }>>;
425
+ }>;
426
+ }>;
427
+ /**
428
+ * A tool asks the user's permission before it goes on, for the action `permission` on `patterns`,
429
+ * such as a command or a path. `tool` names the call that asks.
430
+ */
431
+ export declare const PermissionAsked: Schema.Struct<{
432
+ readonly type: Schema.tag<"permission.asked">;
433
+ readonly properties: Schema.Struct<{
434
+ readonly id: Schema.String;
435
+ readonly sessionID: Schema.String;
436
+ readonly permission: Schema.String;
437
+ readonly patterns: Schema.$Array<Schema.String>;
438
+ readonly tool: Schema.optional<Schema.Struct<{
439
+ readonly messageID: Schema.String;
440
+ readonly callID: Schema.String;
441
+ }>>;
442
+ }>;
443
+ }>;
444
+ /** The model asks the user questions, with its `question` tool. */
445
+ export declare const QuestionAsked: Schema.Struct<{
446
+ readonly type: Schema.tag<"question.asked">;
447
+ readonly properties: Schema.Struct<{
448
+ readonly id: Schema.String;
449
+ readonly sessionID: Schema.String;
450
+ }>;
451
+ }>;
452
+ export declare const SessionEvent: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
453
+ readonly type: Schema.tag<"message.updated">;
454
+ readonly properties: Schema.Struct<{
455
+ readonly sessionID: Schema.String;
456
+ readonly info: Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
457
+ readonly id: Schema.String;
458
+ readonly sessionID: Schema.String;
459
+ readonly role: Schema.tag<"assistant">;
460
+ readonly providerID: Schema.String;
461
+ readonly modelID: Schema.String;
462
+ readonly time: Schema.Struct<{
463
+ readonly created: Schema.Finite;
464
+ readonly completed: Schema.optional<Schema.Finite>;
465
+ }>;
466
+ readonly error: Schema.optional<Schema.Struct<{
467
+ readonly name: Schema.String;
468
+ readonly data: Schema.optional<Schema.Struct<{
469
+ readonly message: Schema.optional<Schema.String>;
470
+ }>>;
471
+ }>>;
472
+ readonly summary: Schema.optional<Schema.Boolean>;
473
+ readonly tokens: Schema.optional<Schema.Struct<{
474
+ readonly input: Schema.Int;
475
+ readonly output: Schema.Int;
476
+ readonly reasoning: Schema.Int;
477
+ readonly cache: Schema.Struct<{
478
+ readonly read: Schema.Int;
479
+ readonly write: Schema.Int;
480
+ }>;
481
+ }>>;
482
+ readonly structured: Schema.optional<Schema.Unknown>;
483
+ readonly finish: Schema.optional<Schema.String>;
484
+ }>, Schema.Struct<{
485
+ readonly id: Schema.String;
486
+ readonly sessionID: Schema.String;
487
+ readonly role: Schema.tag<"user">;
488
+ }>]>;
489
+ }>;
490
+ }>, Schema.Struct<{
491
+ readonly type: Schema.tag<"message.part.updated">;
492
+ readonly properties: Schema.Struct<{
493
+ readonly sessionID: Schema.String;
494
+ readonly part: Schema.Union<readonly [Schema.Struct<{
495
+ readonly id: Schema.String;
496
+ readonly sessionID: Schema.String;
497
+ readonly messageID: Schema.String;
498
+ readonly type: Schema.tag<"text">;
499
+ readonly text: Schema.String;
500
+ readonly time: Schema.optional<Schema.Struct<{
501
+ readonly start: Schema.optional<Schema.Finite>;
502
+ readonly end: Schema.optional<Schema.Finite>;
503
+ }>>;
504
+ }>, Schema.Struct<{
505
+ readonly id: Schema.String;
506
+ readonly sessionID: Schema.String;
507
+ readonly messageID: Schema.String;
508
+ readonly type: Schema.tag<"reasoning">;
509
+ readonly text: Schema.String;
510
+ readonly time: Schema.optional<Schema.Struct<{
511
+ readonly start: Schema.optional<Schema.Finite>;
512
+ readonly end: Schema.optional<Schema.Finite>;
513
+ }>>;
514
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
515
+ }>, Schema.Struct<{
516
+ readonly id: Schema.String;
517
+ readonly sessionID: Schema.String;
518
+ readonly messageID: Schema.String;
519
+ readonly type: Schema.tag<"tool">;
520
+ readonly callID: Schema.String;
521
+ readonly tool: Schema.String;
522
+ readonly state: Schema.toTaggedUnion<"status", readonly [Schema.Struct<{
523
+ readonly status: Schema.tag<"pending">;
524
+ }>, Schema.Struct<{
525
+ readonly status: Schema.tag<"running">;
526
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
527
+ }>, Schema.Struct<{
528
+ readonly status: Schema.tag<"completed">;
529
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
530
+ readonly output: Schema.String;
531
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
532
+ }>, Schema.Struct<{
533
+ readonly status: Schema.tag<"error">;
534
+ readonly input: Schema.$Record<Schema.String, Schema.Unknown>;
535
+ readonly error: Schema.String;
536
+ }>]>;
537
+ }>, Schema.Struct<{
538
+ readonly id: Schema.String;
539
+ readonly sessionID: Schema.String;
540
+ readonly messageID: Schema.String;
541
+ readonly type: Schema.String;
542
+ }>]>;
543
+ }>;
544
+ }>, Schema.Struct<{
545
+ readonly type: Schema.tag<"message.part.delta">;
546
+ readonly properties: Schema.Struct<{
547
+ readonly sessionID: Schema.String;
548
+ readonly messageID: Schema.String;
549
+ readonly partID: Schema.String;
550
+ readonly field: Schema.String;
551
+ readonly delta: Schema.String;
552
+ }>;
553
+ }>, Schema.Struct<{
554
+ readonly type: Schema.tag<"session.status">;
555
+ readonly properties: Schema.Struct<{
556
+ readonly sessionID: Schema.String;
557
+ readonly status: Schema.Struct<{
558
+ readonly type: Schema.String;
559
+ }>;
560
+ }>;
561
+ }>, Schema.Struct<{
562
+ readonly type: Schema.tag<"session.idle">;
563
+ readonly properties: Schema.Struct<{
564
+ readonly sessionID: Schema.String;
565
+ }>;
566
+ }>, Schema.Struct<{
567
+ readonly type: Schema.tag<"session.error">;
568
+ readonly properties: Schema.Struct<{
569
+ readonly sessionID: Schema.optional<Schema.String>;
570
+ readonly error: Schema.optional<Schema.Struct<{
571
+ readonly name: Schema.String;
572
+ readonly data: Schema.optional<Schema.Struct<{
573
+ readonly message: Schema.optional<Schema.String>;
574
+ }>>;
575
+ }>>;
576
+ }>;
577
+ }>, Schema.Struct<{
578
+ readonly type: Schema.tag<"permission.asked">;
579
+ readonly properties: Schema.Struct<{
580
+ readonly id: Schema.String;
581
+ readonly sessionID: Schema.String;
582
+ readonly permission: Schema.String;
583
+ readonly patterns: Schema.$Array<Schema.String>;
584
+ readonly tool: Schema.optional<Schema.Struct<{
585
+ readonly messageID: Schema.String;
586
+ readonly callID: Schema.String;
587
+ }>>;
588
+ }>;
589
+ }>, Schema.Struct<{
590
+ readonly type: Schema.tag<"question.asked">;
591
+ readonly properties: Schema.Struct<{
592
+ readonly id: Schema.String;
593
+ readonly sessionID: Schema.String;
594
+ }>;
595
+ }>]>;
596
+ export type SessionEvent = typeof SessionEvent.Type;
597
+ //# sourceMappingURL=event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../../src/internal/bridge/v1/event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,oGAAoG;AACpG,eAAO,MAAM,OAAO;;;;;EAGlB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAiBzC,yEAAyE;AACzE,eAAO,MAAM,QAAQ;;;;;;;;;;EAKnB,CAAA;AAEF,gEAAgE;AACh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