@zyro-sec/schema 1.0.2 → 1.0.3
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.
- package/AGENTS.md +95 -95
- package/package.json +1 -1
- package/script/build.ts +9 -9
- package/script/config-schema.ts +86 -86
- package/script/config-v1.json +1311 -1311
- package/script/pack.ts +5 -5
- package/src/agent.ts +68 -68
- package/src/artifact.ts +81 -81
- package/src/automation.ts +224 -224
- package/src/blob-store.ts +25 -25
- package/src/command.ts +18 -18
- package/src/config/agent.ts +26 -26
- package/src/config/command.ts +14 -14
- package/src/config/compaction.ts +27 -27
- package/src/config/experimental.ts +72 -72
- package/src/config/flag.ts +39 -39
- package/src/config/formatter.ts +13 -13
- package/src/config/lsp.ts +19 -19
- package/src/config/mcp.ts +22 -22
- package/src/config/media.ts +15 -15
- package/src/config/model.ts +37 -37
- package/src/config/plugin.ts +14 -14
- package/src/config/policy.ts +57 -57
- package/src/config/provider.ts +122 -122
- package/src/config/reference.ts +23 -23
- package/src/config/shell.ts +10 -10
- package/src/config/tool-output.ts +9 -9
- package/src/config/warming.ts +21 -21
- package/src/config/watcher.ts +8 -8
- package/src/config/websearch.ts +17 -17
- package/src/config/worktree.ts +10 -10
- package/src/config.ts +149 -149
- package/src/connection.ts +38 -38
- package/src/credential-legacy.ts +29 -29
- package/src/credential.ts +78 -78
- package/src/durable-event-manifest.ts +7 -7
- package/src/event-log.ts +21 -21
- package/src/event-manifest.ts +108 -108
- package/src/event.ts +205 -205
- package/src/file-diff.ts +25 -25
- package/src/filesystem-v1.ts +1 -1
- package/src/filesystem.ts +48 -48
- package/src/form.ts +177 -177
- package/src/generate.ts +292 -292
- package/src/goal.ts +46 -46
- package/src/identifier.ts +32 -32
- package/src/index.ts +51 -51
- package/src/installation-event.ts +20 -20
- package/src/instruction-entry.ts +40 -40
- package/src/instruction.ts +25 -25
- package/src/integration-id.ts +13 -13
- package/src/integration.ts +129 -129
- package/src/job.ts +79 -79
- package/src/legacy-event.ts +1 -1
- package/src/llm.ts +6 -6
- package/src/location-event.ts +8 -8
- package/src/location.ts +36 -36
- package/src/lsp-event.ts +7 -7
- package/src/mcp-event.ts +63 -63
- package/src/mcp.ts +171 -171
- package/src/model-compatibility.ts +55 -55
- package/src/model.ts +176 -176
- package/src/models-dev.ts +9 -9
- package/src/money.ts +18 -18
- package/src/permission-saved.ts +25 -25
- package/src/permission-v1.ts +1 -1
- package/src/permission.ts +67 -67
- package/src/persistent-pty.ts +73 -73
- package/src/plugin.ts +62 -62
- package/src/project-id.ts +9 -9
- package/src/project.ts +62 -62
- package/src/prompt-input.ts +33 -33
- package/src/prompt.ts +117 -117
- package/src/provider.ts +136 -136
- package/src/pty-ticket.ts +10 -10
- package/src/pty.ts +61 -61
- package/src/push.ts +86 -86
- package/src/question.ts +22 -22
- package/src/reference.ts +40 -40
- package/src/rpc.ts +167 -167
- package/src/schema.ts +41 -41
- package/src/server-event.ts +8 -8
- package/src/session-error.ts +14 -14
- package/src/session-event.ts +739 -739
- package/src/session-fork.ts +10 -10
- package/src/session-id.ts +12 -12
- package/src/session-inbox.ts +102 -102
- package/src/session-legacy.ts +117 -117
- package/src/session-message.ts +352 -352
- package/src/session-metadata.ts +11 -11
- package/src/session-revert.ts +86 -86
- package/src/session-stats.ts +68 -68
- package/src/session-status-event.ts +53 -53
- package/src/session-transfer.ts +11 -11
- package/src/session-v1.ts +1 -1
- package/src/session.ts +147 -147
- package/src/shell.ts +90 -90
- package/src/skill.ts +68 -68
- package/src/snapshot.ts +6 -6
- package/src/token-usage.ts +18 -18
- package/src/tool.ts +143 -143
- package/src/tui-event.ts +59 -59
- package/src/usage-limits.ts +76 -76
- package/src/v1/filesystem.ts +11 -11
- package/src/v1/legacy-event.ts +18 -18
- package/src/v1/permission.ts +66 -66
- package/src/v1/session.ts +667 -667
- package/src/vcs-event.ts +14 -14
- package/src/vcs.ts +41 -41
- package/src/websearch.ts +44 -44
- package/src/workspace-event.ts +32 -32
- package/src/workspace-id.ts +19 -19
- package/src/workspace.ts +20 -20
- package/src/worktree-event.ts +22 -22
- package/src/worktree.ts +109 -109
- package/tsconfig.build.json +11 -11
- package/tsconfig.json +14 -14
- package/test/agent.test.ts +0 -10
- package/test/automation.test.ts +0 -48
- package/test/compatibility.test.ts +0 -10
- package/test/config.test.ts +0 -194
- package/test/contract-hygiene.test.ts +0 -352
- package/test/credential-legacy.test.ts +0 -55
- package/test/event-manifest.test.ts +0 -228
- package/test/event.test.ts +0 -52
- package/test/legacy-event.test.ts +0 -46
- package/test/mcp.test.ts +0 -37
- package/test/model.test.ts +0 -104
- package/test/session-cursor.test.ts +0 -16
- package/test/session-error.test.ts +0 -51
- package/test/session-legacy.test.ts +0 -178
- package/test/session-terminal.test.ts +0 -50
- package/test/token-usage.test.ts +0 -18
- package/test/v1-isolation.test.ts +0 -26
- package/test/vcs.test.ts +0 -23
- package/test/worktree.test.ts +0 -45
package/src/session-event.ts
CHANGED
|
@@ -1,739 +1,739 @@
|
|
|
1
|
-
export * as SessionEvent from "./session-event.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { optional } from "./schema.js"
|
|
5
|
-
import { Event } from "./event.js"
|
|
6
|
-
import { FinishReason } from "./llm.js"
|
|
7
|
-
import { Content } from "./tool.js"
|
|
8
|
-
import { Model } from "./model.js"
|
|
9
|
-
import { NonNegativeInt, PositiveInt, RelativePath } from "./schema.js"
|
|
10
|
-
import { SessionID } from "./session-id.js"
|
|
11
|
-
import { SessionMetadata } from "./session-metadata.js"
|
|
12
|
-
import { Location } from "./location.js"
|
|
13
|
-
import { SessionMessage } from "./session-message.js"
|
|
14
|
-
import { Revert } from "./session-revert.js"
|
|
15
|
-
import { Shell as ShellSchema } from "./shell.js"
|
|
16
|
-
import { SessionError } from "./session-error.js"
|
|
17
|
-
import { Instruction } from "./instruction.js"
|
|
18
|
-
import { InstructionEntry } from "./instruction-entry.js"
|
|
19
|
-
import { Agent } from "./agent.js"
|
|
20
|
-
import { Skill as SkillSchema } from "./skill.js"
|
|
21
|
-
import { Money } from "./money.js"
|
|
22
|
-
import { Snapshot } from "./snapshot.js"
|
|
23
|
-
import { TokenUsage } from "./token-usage.js"
|
|
24
|
-
import { SessionInbox } from "./session-inbox.js"
|
|
25
|
-
import { Project } from "./project.js"
|
|
26
|
-
import { SessionFork } from "./session-fork.js"
|
|
27
|
-
import { Permission } from "./permission.js"
|
|
28
|
-
|
|
29
|
-
const Base = {
|
|
30
|
-
sessionID: SessionID,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const options = {
|
|
34
|
-
durable: {
|
|
35
|
-
aggregate: "sessionID",
|
|
36
|
-
version: 1,
|
|
37
|
-
},
|
|
38
|
-
} as const
|
|
39
|
-
export const Created = Event.durable({
|
|
40
|
-
type: "session.created",
|
|
41
|
-
...options,
|
|
42
|
-
schema: {
|
|
43
|
-
...Base,
|
|
44
|
-
projectID: Project.ID,
|
|
45
|
-
location: Location.Ref,
|
|
46
|
-
subpath: RelativePath.pipe(optional),
|
|
47
|
-
parentID: SessionID.pipe(optional),
|
|
48
|
-
slug: Schema.String,
|
|
49
|
-
title: Schema.String.pipe(optional),
|
|
50
|
-
agent: Agent.ID.pipe(optional),
|
|
51
|
-
model: Model.Ref.pipe(optional),
|
|
52
|
-
/** Host-supplied annotations resolved at creation, including any inherited from a parent. */
|
|
53
|
-
metadata: SessionMetadata.pipe(optional),
|
|
54
|
-
permissions: Permission.Ruleset.pipe(optional),
|
|
55
|
-
version: Schema.String,
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
export type Created = typeof Created.Type
|
|
59
|
-
|
|
60
|
-
export const AgentSelected = Event.durable({
|
|
61
|
-
type: "session.agent.selected",
|
|
62
|
-
...options,
|
|
63
|
-
schema: {
|
|
64
|
-
...Base,
|
|
65
|
-
agent: Agent.ID,
|
|
66
|
-
previous: Agent.ID.pipe(optional),
|
|
67
|
-
},
|
|
68
|
-
})
|
|
69
|
-
export type AgentSelected = typeof AgentSelected.Type
|
|
70
|
-
|
|
71
|
-
export const ModelSelected = Event.durable({
|
|
72
|
-
type: "session.model.selected",
|
|
73
|
-
...options,
|
|
74
|
-
schema: {
|
|
75
|
-
...Base,
|
|
76
|
-
model: Model.Ref,
|
|
77
|
-
previous: Model.Ref.pipe(optional),
|
|
78
|
-
},
|
|
79
|
-
})
|
|
80
|
-
export type ModelSelected = typeof ModelSelected.Type
|
|
81
|
-
|
|
82
|
-
export const Moved = Event.durable({
|
|
83
|
-
type: "session.moved",
|
|
84
|
-
...options,
|
|
85
|
-
schema: {
|
|
86
|
-
...Base,
|
|
87
|
-
...SessionInbox.MovePayload.fields,
|
|
88
|
-
},
|
|
89
|
-
})
|
|
90
|
-
export type Moved = typeof Moved.Type
|
|
91
|
-
|
|
92
|
-
export const Renamed = Event.durable({
|
|
93
|
-
type: "session.renamed",
|
|
94
|
-
...options,
|
|
95
|
-
schema: {
|
|
96
|
-
...Base,
|
|
97
|
-
title: Schema.String,
|
|
98
|
-
},
|
|
99
|
-
})
|
|
100
|
-
export type Renamed = typeof Renamed.Type
|
|
101
|
-
|
|
102
|
-
export const MetadataUpdated = Event.durable({
|
|
103
|
-
type: "session.metadata.updated",
|
|
104
|
-
...options,
|
|
105
|
-
schema: {
|
|
106
|
-
...Base,
|
|
107
|
-
metadata: SessionMetadata,
|
|
108
|
-
},
|
|
109
|
-
})
|
|
110
|
-
export type MetadataUpdated = typeof MetadataUpdated.Type
|
|
111
|
-
|
|
112
|
-
export const Permissions = Event.durable({
|
|
113
|
-
type: "session.permissions",
|
|
114
|
-
...options,
|
|
115
|
-
schema: {
|
|
116
|
-
...Base,
|
|
117
|
-
permissions: Permission.Ruleset,
|
|
118
|
-
},
|
|
119
|
-
})
|
|
120
|
-
export type Permissions = typeof Permissions.Type
|
|
121
|
-
|
|
122
|
-
export const Viewed = Event.durable({
|
|
123
|
-
type: "session.viewed",
|
|
124
|
-
...options,
|
|
125
|
-
schema: {
|
|
126
|
-
...Base,
|
|
127
|
-
/** Epoch-millisecond idle watermark the viewer observed; projection never marks a newer idle transition viewed. */
|
|
128
|
-
idle: Schema.Finite,
|
|
129
|
-
},
|
|
130
|
-
})
|
|
131
|
-
export type Viewed = typeof Viewed.Type
|
|
132
|
-
|
|
133
|
-
export const Archived = Event.durable({
|
|
134
|
-
type: "session.archived",
|
|
135
|
-
...options,
|
|
136
|
-
schema: Base,
|
|
137
|
-
})
|
|
138
|
-
export type Archived = typeof Archived.Type
|
|
139
|
-
|
|
140
|
-
export const Unarchived = Event.durable({
|
|
141
|
-
type: "session.unarchived",
|
|
142
|
-
...options,
|
|
143
|
-
schema: Base,
|
|
144
|
-
})
|
|
145
|
-
export type Unarchived = typeof Unarchived.Type
|
|
146
|
-
|
|
147
|
-
// Replay-only: older releases allowed replacing completed assistant content.
|
|
148
|
-
export const MessageContentUpdated = Event.durable({
|
|
149
|
-
type: "session.message.content.updated",
|
|
150
|
-
...options,
|
|
151
|
-
schema: {
|
|
152
|
-
...Base,
|
|
153
|
-
messageID: SessionMessage.ID,
|
|
154
|
-
// Public events are framed directly, so timestamps must already be encoded.
|
|
155
|
-
content: Schema.Array(SessionMessage.AssistantContentEncoded),
|
|
156
|
-
},
|
|
157
|
-
})
|
|
158
|
-
export type MessageContentUpdated = typeof MessageContentUpdated.Type
|
|
159
|
-
|
|
160
|
-
export const UsageRecorded = Event.durable({
|
|
161
|
-
type: "session.usage.recorded",
|
|
162
|
-
...options,
|
|
163
|
-
schema: {
|
|
164
|
-
...Base,
|
|
165
|
-
source: Schema.Literals(["title", "compaction", "generate"]),
|
|
166
|
-
cost: Money.USD,
|
|
167
|
-
tokens: TokenUsage.Info,
|
|
168
|
-
},
|
|
169
|
-
})
|
|
170
|
-
export type UsageRecorded = typeof UsageRecorded.Type
|
|
171
|
-
|
|
172
|
-
export const UsageUpdated = Event.ephemeral({
|
|
173
|
-
type: "session.usage.updated",
|
|
174
|
-
schema: {
|
|
175
|
-
...Base,
|
|
176
|
-
cost: Money.USD,
|
|
177
|
-
tokens: TokenUsage.Info,
|
|
178
|
-
},
|
|
179
|
-
})
|
|
180
|
-
export type UsageUpdated = typeof UsageUpdated.Type
|
|
181
|
-
|
|
182
|
-
export const Deleted = Event.durable({
|
|
183
|
-
type: "session.deleted",
|
|
184
|
-
durable: {
|
|
185
|
-
aggregate: "sessionID",
|
|
186
|
-
version: 2,
|
|
187
|
-
},
|
|
188
|
-
schema: Base,
|
|
189
|
-
})
|
|
190
|
-
export type Deleted = typeof Deleted.Type
|
|
191
|
-
|
|
192
|
-
export const Forked = Event.durable({
|
|
193
|
-
type: "session.forked",
|
|
194
|
-
durable: {
|
|
195
|
-
aggregate: "sessionID",
|
|
196
|
-
version: 2,
|
|
197
|
-
},
|
|
198
|
-
schema: {
|
|
199
|
-
...Base,
|
|
200
|
-
parentID: SessionID,
|
|
201
|
-
boundary: SessionFork.Boundary,
|
|
202
|
-
instructions: Instruction.Values.pipe(optional),
|
|
203
|
-
instructionEntries: InstructionEntry.Snapshot.pipe(optional),
|
|
204
|
-
},
|
|
205
|
-
})
|
|
206
|
-
export type Forked = typeof Forked.Type
|
|
207
|
-
|
|
208
|
-
const InboxRef = {
|
|
209
|
-
...Base,
|
|
210
|
-
inboxID: SessionMessage.ID,
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export const InboxDelivered = Event.durable({
|
|
214
|
-
type: "session.inbox.delivered",
|
|
215
|
-
...options,
|
|
216
|
-
schema: InboxRef,
|
|
217
|
-
})
|
|
218
|
-
export type InboxDelivered = typeof InboxDelivered.Type
|
|
219
|
-
|
|
220
|
-
export const InboxEnqueued = Event.durable({
|
|
221
|
-
type: "session.inbox.enqueued",
|
|
222
|
-
...options,
|
|
223
|
-
schema: {
|
|
224
|
-
...InboxRef,
|
|
225
|
-
item: SessionInbox.Item,
|
|
226
|
-
},
|
|
227
|
-
})
|
|
228
|
-
export type InboxEnqueued = typeof InboxEnqueued.Type
|
|
229
|
-
|
|
230
|
-
export const InboxCancelled = Event.durable({
|
|
231
|
-
type: "session.inbox.cancelled",
|
|
232
|
-
...options,
|
|
233
|
-
schema: InboxRef,
|
|
234
|
-
})
|
|
235
|
-
export type InboxCancelled = typeof InboxCancelled.Type
|
|
236
|
-
|
|
237
|
-
export const InboxDeliveryChanged = Event.durable({
|
|
238
|
-
type: "session.inbox.delivery.changed",
|
|
239
|
-
...options,
|
|
240
|
-
schema: { ...InboxRef, delivery: SessionInbox.Delivery },
|
|
241
|
-
})
|
|
242
|
-
export type InboxDeliveryChanged = typeof InboxDeliveryChanged.Type
|
|
243
|
-
|
|
244
|
-
export namespace Execution {
|
|
245
|
-
export const Started = Event.durable({ type: "session.execution.started", ...options, schema: Base })
|
|
246
|
-
export type Started = typeof Started.Type
|
|
247
|
-
|
|
248
|
-
export const Succeeded = Event.durable({ type: "session.execution.succeeded", ...options, schema: Base })
|
|
249
|
-
export type Succeeded = typeof Succeeded.Type
|
|
250
|
-
|
|
251
|
-
export const Failed = Event.durable({
|
|
252
|
-
type: "session.execution.failed",
|
|
253
|
-
...options,
|
|
254
|
-
schema: { ...Base, error: SessionError.Error },
|
|
255
|
-
})
|
|
256
|
-
export type Failed = typeof Failed.Type
|
|
257
|
-
|
|
258
|
-
export const Interrupted = Event.durable({
|
|
259
|
-
type: "session.execution.interrupted",
|
|
260
|
-
...options,
|
|
261
|
-
schema: { ...Base, reason: Schema.Literals(["user", "shutdown", "superseded", "inactivity"]) },
|
|
262
|
-
})
|
|
263
|
-
export type Interrupted = typeof Interrupted.Type
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export const InstructionsUpdated = Event.durable({
|
|
267
|
-
type: "session.instructions.updated",
|
|
268
|
-
durable: {
|
|
269
|
-
aggregate: "sessionID",
|
|
270
|
-
version: 2,
|
|
271
|
-
},
|
|
272
|
-
schema: {
|
|
273
|
-
...Base,
|
|
274
|
-
delta: Instruction.Delta,
|
|
275
|
-
/**
|
|
276
|
-
* The rendered chronological update shown to the model, frozen at emit time.
|
|
277
|
-
* Absent for the initial baseline observation and for deltas that render empty.
|
|
278
|
-
*/
|
|
279
|
-
text: Schema.String.pipe(optional),
|
|
280
|
-
},
|
|
281
|
-
})
|
|
282
|
-
export type InstructionsUpdated = typeof InstructionsUpdated.Type
|
|
283
|
-
|
|
284
|
-
export const Synthetic = Event.durable({
|
|
285
|
-
type: "session.synthetic",
|
|
286
|
-
...options,
|
|
287
|
-
schema: {
|
|
288
|
-
...Base,
|
|
289
|
-
text: Schema.String,
|
|
290
|
-
description: Schema.String.pipe(optional),
|
|
291
|
-
metadata: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
|
|
292
|
-
},
|
|
293
|
-
})
|
|
294
|
-
export type Synthetic = typeof Synthetic.Type
|
|
295
|
-
|
|
296
|
-
export namespace Skill {
|
|
297
|
-
export const Activated = Event.durable({
|
|
298
|
-
type: "session.skill.activated",
|
|
299
|
-
...options,
|
|
300
|
-
schema: {
|
|
301
|
-
...Base,
|
|
302
|
-
id: SkillSchema.ID,
|
|
303
|
-
name: SkillSchema.Name,
|
|
304
|
-
text: Schema.String,
|
|
305
|
-
},
|
|
306
|
-
})
|
|
307
|
-
export type Activated = typeof Activated.Type
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export namespace Shell {
|
|
311
|
-
export const Started = Event.durable({
|
|
312
|
-
type: "session.shell.started",
|
|
313
|
-
...options,
|
|
314
|
-
schema: {
|
|
315
|
-
...Base,
|
|
316
|
-
shell: ShellSchema.Info,
|
|
317
|
-
},
|
|
318
|
-
})
|
|
319
|
-
export type Started = typeof Started.Type
|
|
320
|
-
|
|
321
|
-
export const Ended = Event.durable({
|
|
322
|
-
type: "session.shell.ended",
|
|
323
|
-
...options,
|
|
324
|
-
schema: {
|
|
325
|
-
...Base,
|
|
326
|
-
shell: ShellSchema.Info,
|
|
327
|
-
output: ShellSchema.Output,
|
|
328
|
-
},
|
|
329
|
-
})
|
|
330
|
-
export type Ended = typeof Ended.Type
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
export namespace Step {
|
|
334
|
-
export const Started = Event.durable({
|
|
335
|
-
type: "session.step.started",
|
|
336
|
-
...options,
|
|
337
|
-
schema: {
|
|
338
|
-
...Base,
|
|
339
|
-
assistantMessageID: SessionMessage.ID,
|
|
340
|
-
agent: Agent.ID,
|
|
341
|
-
model: Model.Ref,
|
|
342
|
-
snapshot: Snapshot.ID.pipe(optional),
|
|
343
|
-
/** Request dispatch time, before waiting for provider output. */
|
|
344
|
-
started: NonNegativeInt,
|
|
345
|
-
},
|
|
346
|
-
})
|
|
347
|
-
export type Started = typeof Started.Type
|
|
348
|
-
|
|
349
|
-
/** Records when the provider streamed the first output token, before the rest of the response. */
|
|
350
|
-
export const FirstToken = Event.durable({
|
|
351
|
-
type: "session.step.first-token",
|
|
352
|
-
...options,
|
|
353
|
-
schema: {
|
|
354
|
-
...Base,
|
|
355
|
-
assistantMessageID: SessionMessage.ID,
|
|
356
|
-
},
|
|
357
|
-
})
|
|
358
|
-
export type FirstToken = typeof FirstToken.Type
|
|
359
|
-
|
|
360
|
-
/** Records the provider response-body boundary independently of tool settlement. */
|
|
361
|
-
export const Streamed = Event.durable({
|
|
362
|
-
type: "session.step.streamed",
|
|
363
|
-
...options,
|
|
364
|
-
schema: {
|
|
365
|
-
...Base,
|
|
366
|
-
assistantMessageID: SessionMessage.ID,
|
|
367
|
-
},
|
|
368
|
-
})
|
|
369
|
-
export type Streamed = typeof Streamed.Type
|
|
370
|
-
|
|
371
|
-
export const Ended = Event.durable({
|
|
372
|
-
type: "session.step.ended",
|
|
373
|
-
...options,
|
|
374
|
-
schema: {
|
|
375
|
-
...Base,
|
|
376
|
-
assistantMessageID: SessionMessage.ID,
|
|
377
|
-
finish: FinishReason,
|
|
378
|
-
rawFinish: Schema.String.pipe(optional),
|
|
379
|
-
native: SessionMessage.Native.pipe(optional),
|
|
380
|
-
cost: Money.USD,
|
|
381
|
-
tokens: TokenUsage.Info,
|
|
382
|
-
snapshot: Snapshot.ID.pipe(optional),
|
|
383
|
-
files: Schema.Array(RelativePath).pipe(optional),
|
|
384
|
-
},
|
|
385
|
-
})
|
|
386
|
-
export type Ended = typeof Ended.Type
|
|
387
|
-
|
|
388
|
-
export const Failed = Event.durable({
|
|
389
|
-
type: "session.step.failed",
|
|
390
|
-
...options,
|
|
391
|
-
schema: {
|
|
392
|
-
...Base,
|
|
393
|
-
assistantMessageID: SessionMessage.ID,
|
|
394
|
-
error: SessionError.Error,
|
|
395
|
-
finish: Schema.Literals(["content-filter"]).pipe(optional),
|
|
396
|
-
rawFinish: Schema.String.pipe(optional),
|
|
397
|
-
native: SessionMessage.Native.pipe(optional),
|
|
398
|
-
cost: Money.USD.pipe(optional),
|
|
399
|
-
tokens: TokenUsage.Info.pipe(optional),
|
|
400
|
-
snapshot: Snapshot.ID.pipe(optional),
|
|
401
|
-
files: Schema.Array(RelativePath).pipe(optional),
|
|
402
|
-
},
|
|
403
|
-
})
|
|
404
|
-
export type Failed = typeof Failed.Type
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
export namespace Text {
|
|
408
|
-
export const Started = Event.durable({
|
|
409
|
-
type: "session.text.started",
|
|
410
|
-
...options,
|
|
411
|
-
schema: {
|
|
412
|
-
...Base,
|
|
413
|
-
assistantMessageID: SessionMessage.ID,
|
|
414
|
-
ordinal: NonNegativeInt,
|
|
415
|
-
},
|
|
416
|
-
})
|
|
417
|
-
export type Started = typeof Started.Type
|
|
418
|
-
|
|
419
|
-
// Stream fragments are live-only; Text.Ended is the replayable full-value boundary.
|
|
420
|
-
export const Delta = Event.ephemeral({
|
|
421
|
-
type: "session.text.delta",
|
|
422
|
-
schema: {
|
|
423
|
-
...Base,
|
|
424
|
-
assistantMessageID: SessionMessage.ID,
|
|
425
|
-
ordinal: NonNegativeInt,
|
|
426
|
-
delta: Schema.String,
|
|
427
|
-
},
|
|
428
|
-
})
|
|
429
|
-
export type Delta = typeof Delta.Type
|
|
430
|
-
|
|
431
|
-
export const Ended = Event.durable({
|
|
432
|
-
type: "session.text.ended",
|
|
433
|
-
...options,
|
|
434
|
-
schema: {
|
|
435
|
-
...Base,
|
|
436
|
-
assistantMessageID: SessionMessage.ID,
|
|
437
|
-
ordinal: NonNegativeInt,
|
|
438
|
-
text: Schema.String,
|
|
439
|
-
native: SessionMessage.Native.pipe(optional),
|
|
440
|
-
},
|
|
441
|
-
})
|
|
442
|
-
export type Ended = typeof Ended.Type
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
export namespace Reasoning {
|
|
446
|
-
export const Started = Event.durable({
|
|
447
|
-
type: "session.reasoning.started",
|
|
448
|
-
...options,
|
|
449
|
-
schema: {
|
|
450
|
-
...Base,
|
|
451
|
-
assistantMessageID: SessionMessage.ID,
|
|
452
|
-
ordinal: NonNegativeInt,
|
|
453
|
-
native: SessionMessage.Native.pipe(optional),
|
|
454
|
-
},
|
|
455
|
-
})
|
|
456
|
-
export type Started = typeof Started.Type
|
|
457
|
-
|
|
458
|
-
// Stream fragments are live-only; Reasoning.Ended is the replayable full-value boundary.
|
|
459
|
-
export const Delta = Event.ephemeral({
|
|
460
|
-
type: "session.reasoning.delta",
|
|
461
|
-
schema: {
|
|
462
|
-
...Base,
|
|
463
|
-
assistantMessageID: SessionMessage.ID,
|
|
464
|
-
ordinal: NonNegativeInt,
|
|
465
|
-
delta: Schema.String,
|
|
466
|
-
},
|
|
467
|
-
})
|
|
468
|
-
export type Delta = typeof Delta.Type
|
|
469
|
-
|
|
470
|
-
export const Ended = Event.durable({
|
|
471
|
-
type: "session.reasoning.ended",
|
|
472
|
-
...options,
|
|
473
|
-
schema: {
|
|
474
|
-
...Base,
|
|
475
|
-
assistantMessageID: SessionMessage.ID,
|
|
476
|
-
ordinal: NonNegativeInt,
|
|
477
|
-
text: Schema.String,
|
|
478
|
-
native: SessionMessage.Native.pipe(optional),
|
|
479
|
-
},
|
|
480
|
-
})
|
|
481
|
-
export type Ended = typeof Ended.Type
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
export namespace Tool {
|
|
485
|
-
const ToolBase = {
|
|
486
|
-
...Base,
|
|
487
|
-
assistantMessageID: SessionMessage.ID,
|
|
488
|
-
id: Schema.String,
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
export namespace Input {
|
|
492
|
-
export const Started = Event.durable({
|
|
493
|
-
type: "session.tool.input.started",
|
|
494
|
-
...options,
|
|
495
|
-
schema: {
|
|
496
|
-
...ToolBase,
|
|
497
|
-
name: Schema.String,
|
|
498
|
-
},
|
|
499
|
-
})
|
|
500
|
-
export type Started = typeof Started.Type
|
|
501
|
-
|
|
502
|
-
// Stream fragments are live-only; Input.Ended is the replayable raw-input boundary.
|
|
503
|
-
export const Delta = Event.ephemeral({
|
|
504
|
-
type: "session.tool.input.delta",
|
|
505
|
-
schema: {
|
|
506
|
-
...ToolBase,
|
|
507
|
-
delta: Schema.String,
|
|
508
|
-
},
|
|
509
|
-
})
|
|
510
|
-
export type Delta = typeof Delta.Type
|
|
511
|
-
|
|
512
|
-
export const Ended = Event.durable({
|
|
513
|
-
type: "session.tool.input.ended",
|
|
514
|
-
...options,
|
|
515
|
-
schema: {
|
|
516
|
-
...ToolBase,
|
|
517
|
-
text: Schema.String,
|
|
518
|
-
},
|
|
519
|
-
})
|
|
520
|
-
export type Ended = typeof Ended.Type
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
export const Called = Event.durable({
|
|
524
|
-
type: "session.tool.called",
|
|
525
|
-
...options,
|
|
526
|
-
schema: {
|
|
527
|
-
...ToolBase,
|
|
528
|
-
input: Schema.Record(Schema.String, Schema.Unknown),
|
|
529
|
-
executed: Schema.Boolean,
|
|
530
|
-
native: SessionMessage.Native.pipe(optional),
|
|
531
|
-
},
|
|
532
|
-
})
|
|
533
|
-
export type Called = typeof Called.Type
|
|
534
|
-
|
|
535
|
-
/** Live replacement metadata for a running tool. */
|
|
536
|
-
export const Progress = Event.ephemeral({
|
|
537
|
-
type: "session.tool.progress",
|
|
538
|
-
schema: {
|
|
539
|
-
...ToolBase,
|
|
540
|
-
metadata: Schema.Record(Schema.String, Schema.Json),
|
|
541
|
-
},
|
|
542
|
-
})
|
|
543
|
-
export type Progress = typeof Progress.Type
|
|
544
|
-
|
|
545
|
-
/** Canonical terminal success: one non-empty model representation plus optional UI metadata. */
|
|
546
|
-
export const Success = Event.durable({
|
|
547
|
-
type: "session.tool.success",
|
|
548
|
-
durable: {
|
|
549
|
-
aggregate: "sessionID",
|
|
550
|
-
version: 2,
|
|
551
|
-
},
|
|
552
|
-
schema: {
|
|
553
|
-
...ToolBase,
|
|
554
|
-
content: Schema.NonEmptyArray(Content),
|
|
555
|
-
metadata: Schema.Record(Schema.String, Schema.Json).pipe(optional),
|
|
556
|
-
executed: Schema.Boolean,
|
|
557
|
-
native: SessionMessage.Native.pipe(optional),
|
|
558
|
-
},
|
|
559
|
-
})
|
|
560
|
-
export type Success = typeof Success.Type
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Canonical terminal failure: one error plus the final bounded snapshot of
|
|
564
|
-
* partial progress. The event is self-contained; projection never reaches
|
|
565
|
-
* into ephemeral progress history.
|
|
566
|
-
*/
|
|
567
|
-
export const Failed = Event.durable({
|
|
568
|
-
type: "session.tool.failed",
|
|
569
|
-
durable: {
|
|
570
|
-
aggregate: "sessionID",
|
|
571
|
-
version: 2,
|
|
572
|
-
},
|
|
573
|
-
schema: {
|
|
574
|
-
...ToolBase,
|
|
575
|
-
error: SessionError.Error,
|
|
576
|
-
content: Schema.NonEmptyArray(Content).pipe(optional),
|
|
577
|
-
metadata: Schema.Record(Schema.String, Schema.Json).pipe(optional),
|
|
578
|
-
executed: Schema.Boolean,
|
|
579
|
-
native: SessionMessage.Native.pipe(optional),
|
|
580
|
-
},
|
|
581
|
-
})
|
|
582
|
-
export type Failed = typeof Failed.Type
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
export const RetryScheduled = Event.durable({
|
|
586
|
-
type: "session.retry.scheduled",
|
|
587
|
-
...options,
|
|
588
|
-
schema: {
|
|
589
|
-
...Base,
|
|
590
|
-
assistantMessageID: SessionMessage.ID,
|
|
591
|
-
attempt: PositiveInt,
|
|
592
|
-
at: NonNegativeInt,
|
|
593
|
-
error: SessionError.Error,
|
|
594
|
-
},
|
|
595
|
-
})
|
|
596
|
-
export type RetryScheduled = typeof RetryScheduled.Type
|
|
597
|
-
|
|
598
|
-
export namespace Compaction {
|
|
599
|
-
export const Started = Event.durable({
|
|
600
|
-
type: "session.compaction.started",
|
|
601
|
-
...options,
|
|
602
|
-
schema: {
|
|
603
|
-
...Base,
|
|
604
|
-
reason: Schema.Literals(["auto", "manual"]),
|
|
605
|
-
inputID: SessionMessage.ID.pipe(optional),
|
|
606
|
-
},
|
|
607
|
-
})
|
|
608
|
-
export type Started = typeof Started.Type
|
|
609
|
-
|
|
610
|
-
export const Delta = Event.ephemeral({
|
|
611
|
-
type: "session.compaction.delta",
|
|
612
|
-
schema: {
|
|
613
|
-
...Base,
|
|
614
|
-
text: Schema.String,
|
|
615
|
-
},
|
|
616
|
-
})
|
|
617
|
-
export type Delta = typeof Delta.Type
|
|
618
|
-
|
|
619
|
-
export const Ended = Event.durable({
|
|
620
|
-
type: "session.compaction.ended",
|
|
621
|
-
...options,
|
|
622
|
-
schema: {
|
|
623
|
-
...Base,
|
|
624
|
-
reason: Started.data.fields.reason,
|
|
625
|
-
model: SessionMessage.CompactionCompleted.fields.model,
|
|
626
|
-
native: SessionMessage.CompactionCompleted.fields.native,
|
|
627
|
-
text: Schema.String,
|
|
628
|
-
// Repeats the internal `session.usage.recorded` figures: that event never reaches clients, and it
|
|
629
|
-
// stays the accounting source for session totals and stats.
|
|
630
|
-
cost: SessionMessage.CompactionCompleted.fields.cost,
|
|
631
|
-
tokens: SessionMessage.CompactionCompleted.fields.tokens,
|
|
632
|
-
},
|
|
633
|
-
})
|
|
634
|
-
export type Ended = typeof Ended.Type
|
|
635
|
-
|
|
636
|
-
export const Failed = Event.durable({
|
|
637
|
-
type: "session.compaction.failed",
|
|
638
|
-
...options,
|
|
639
|
-
schema: {
|
|
640
|
-
...Base,
|
|
641
|
-
reason: Started.data.fields.reason,
|
|
642
|
-
error: SessionError.Error,
|
|
643
|
-
inputID: SessionMessage.ID.pipe(optional),
|
|
644
|
-
cost: SessionMessage.CompactionFailed.fields.cost,
|
|
645
|
-
tokens: SessionMessage.CompactionFailed.fields.tokens,
|
|
646
|
-
},
|
|
647
|
-
})
|
|
648
|
-
export type Failed = typeof Failed.Type
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
export namespace RevertEvent {
|
|
652
|
-
export const Staged = Event.durable({
|
|
653
|
-
type: "session.revert.staged",
|
|
654
|
-
...options,
|
|
655
|
-
schema: { ...Base, revert: Revert },
|
|
656
|
-
})
|
|
657
|
-
export const Cleared = Event.durable({ type: "session.revert.cleared", ...options, schema: Base })
|
|
658
|
-
export const Committed = Event.durable({
|
|
659
|
-
type: "session.revert.committed",
|
|
660
|
-
...options,
|
|
661
|
-
schema: { ...Base, to: SessionMessage.ID },
|
|
662
|
-
})
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
export const Definitions = Event.inventory(
|
|
666
|
-
Created,
|
|
667
|
-
AgentSelected,
|
|
668
|
-
ModelSelected,
|
|
669
|
-
Moved,
|
|
670
|
-
Renamed,
|
|
671
|
-
MetadataUpdated,
|
|
672
|
-
Permissions,
|
|
673
|
-
Viewed,
|
|
674
|
-
Archived,
|
|
675
|
-
Unarchived,
|
|
676
|
-
UsageUpdated,
|
|
677
|
-
Deleted,
|
|
678
|
-
Forked,
|
|
679
|
-
InboxDelivered,
|
|
680
|
-
InboxEnqueued,
|
|
681
|
-
InboxCancelled,
|
|
682
|
-
InboxDeliveryChanged,
|
|
683
|
-
Execution.Started,
|
|
684
|
-
Execution.Succeeded,
|
|
685
|
-
Execution.Failed,
|
|
686
|
-
Execution.Interrupted,
|
|
687
|
-
InstructionsUpdated,
|
|
688
|
-
Synthetic,
|
|
689
|
-
Skill.Activated,
|
|
690
|
-
Shell.Started,
|
|
691
|
-
Shell.Ended,
|
|
692
|
-
Step.Started,
|
|
693
|
-
Step.FirstToken,
|
|
694
|
-
Step.Streamed,
|
|
695
|
-
Step.Ended,
|
|
696
|
-
Step.Failed,
|
|
697
|
-
Text.Started,
|
|
698
|
-
Text.Delta,
|
|
699
|
-
Text.Ended,
|
|
700
|
-
Reasoning.Started,
|
|
701
|
-
Reasoning.Delta,
|
|
702
|
-
Reasoning.Ended,
|
|
703
|
-
Tool.Input.Started,
|
|
704
|
-
Tool.Input.Delta,
|
|
705
|
-
Tool.Input.Ended,
|
|
706
|
-
Tool.Called,
|
|
707
|
-
Tool.Progress,
|
|
708
|
-
Tool.Success,
|
|
709
|
-
Tool.Failed,
|
|
710
|
-
RetryScheduled,
|
|
711
|
-
Compaction.Started,
|
|
712
|
-
Compaction.Delta,
|
|
713
|
-
Compaction.Ended,
|
|
714
|
-
Compaction.Failed,
|
|
715
|
-
RevertEvent.Staged,
|
|
716
|
-
RevertEvent.Cleared,
|
|
717
|
-
RevertEvent.Committed,
|
|
718
|
-
)
|
|
719
|
-
|
|
720
|
-
// Internal and replay-only events are excluded from the public manifest.
|
|
721
|
-
export const DurableDefinitions = Event.inventory(
|
|
722
|
-
...Definitions.filter((definition) => definition.durability === "durable"),
|
|
723
|
-
UsageRecorded,
|
|
724
|
-
MessageContentUpdated,
|
|
725
|
-
)
|
|
726
|
-
export const EphemeralDefinitions = Event.inventory(
|
|
727
|
-
...Definitions.filter((definition) => definition.durability === "ephemeral"),
|
|
728
|
-
)
|
|
729
|
-
|
|
730
|
-
export const Durable = Schema.Union(DurableDefinitions, { mode: "oneOf" })
|
|
731
|
-
.annotate({ identifier: "Session.Event.Durable" })
|
|
732
|
-
.pipe(Schema.toTaggedUnion("type"))
|
|
733
|
-
export type DurableEvent = typeof Durable.Type
|
|
734
|
-
|
|
735
|
-
export const All = Schema.Union([Durable, ...EphemeralDefinitions], { mode: "oneOf" }).pipe(
|
|
736
|
-
Schema.toTaggedUnion("type"),
|
|
737
|
-
)
|
|
738
|
-
export type Event = typeof All.Type
|
|
739
|
-
export type Type = Event["type"]
|
|
1
|
+
export * as SessionEvent from "./session-event.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { optional } from "./schema.js"
|
|
5
|
+
import { Event } from "./event.js"
|
|
6
|
+
import { FinishReason } from "./llm.js"
|
|
7
|
+
import { Content } from "./tool.js"
|
|
8
|
+
import { Model } from "./model.js"
|
|
9
|
+
import { NonNegativeInt, PositiveInt, RelativePath } from "./schema.js"
|
|
10
|
+
import { SessionID } from "./session-id.js"
|
|
11
|
+
import { SessionMetadata } from "./session-metadata.js"
|
|
12
|
+
import { Location } from "./location.js"
|
|
13
|
+
import { SessionMessage } from "./session-message.js"
|
|
14
|
+
import { Revert } from "./session-revert.js"
|
|
15
|
+
import { Shell as ShellSchema } from "./shell.js"
|
|
16
|
+
import { SessionError } from "./session-error.js"
|
|
17
|
+
import { Instruction } from "./instruction.js"
|
|
18
|
+
import { InstructionEntry } from "./instruction-entry.js"
|
|
19
|
+
import { Agent } from "./agent.js"
|
|
20
|
+
import { Skill as SkillSchema } from "./skill.js"
|
|
21
|
+
import { Money } from "./money.js"
|
|
22
|
+
import { Snapshot } from "./snapshot.js"
|
|
23
|
+
import { TokenUsage } from "./token-usage.js"
|
|
24
|
+
import { SessionInbox } from "./session-inbox.js"
|
|
25
|
+
import { Project } from "./project.js"
|
|
26
|
+
import { SessionFork } from "./session-fork.js"
|
|
27
|
+
import { Permission } from "./permission.js"
|
|
28
|
+
|
|
29
|
+
const Base = {
|
|
30
|
+
sessionID: SessionID,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const options = {
|
|
34
|
+
durable: {
|
|
35
|
+
aggregate: "sessionID",
|
|
36
|
+
version: 1,
|
|
37
|
+
},
|
|
38
|
+
} as const
|
|
39
|
+
export const Created = Event.durable({
|
|
40
|
+
type: "session.created",
|
|
41
|
+
...options,
|
|
42
|
+
schema: {
|
|
43
|
+
...Base,
|
|
44
|
+
projectID: Project.ID,
|
|
45
|
+
location: Location.Ref,
|
|
46
|
+
subpath: RelativePath.pipe(optional),
|
|
47
|
+
parentID: SessionID.pipe(optional),
|
|
48
|
+
slug: Schema.String,
|
|
49
|
+
title: Schema.String.pipe(optional),
|
|
50
|
+
agent: Agent.ID.pipe(optional),
|
|
51
|
+
model: Model.Ref.pipe(optional),
|
|
52
|
+
/** Host-supplied annotations resolved at creation, including any inherited from a parent. */
|
|
53
|
+
metadata: SessionMetadata.pipe(optional),
|
|
54
|
+
permissions: Permission.Ruleset.pipe(optional),
|
|
55
|
+
version: Schema.String,
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
export type Created = typeof Created.Type
|
|
59
|
+
|
|
60
|
+
export const AgentSelected = Event.durable({
|
|
61
|
+
type: "session.agent.selected",
|
|
62
|
+
...options,
|
|
63
|
+
schema: {
|
|
64
|
+
...Base,
|
|
65
|
+
agent: Agent.ID,
|
|
66
|
+
previous: Agent.ID.pipe(optional),
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
export type AgentSelected = typeof AgentSelected.Type
|
|
70
|
+
|
|
71
|
+
export const ModelSelected = Event.durable({
|
|
72
|
+
type: "session.model.selected",
|
|
73
|
+
...options,
|
|
74
|
+
schema: {
|
|
75
|
+
...Base,
|
|
76
|
+
model: Model.Ref,
|
|
77
|
+
previous: Model.Ref.pipe(optional),
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
export type ModelSelected = typeof ModelSelected.Type
|
|
81
|
+
|
|
82
|
+
export const Moved = Event.durable({
|
|
83
|
+
type: "session.moved",
|
|
84
|
+
...options,
|
|
85
|
+
schema: {
|
|
86
|
+
...Base,
|
|
87
|
+
...SessionInbox.MovePayload.fields,
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
export type Moved = typeof Moved.Type
|
|
91
|
+
|
|
92
|
+
export const Renamed = Event.durable({
|
|
93
|
+
type: "session.renamed",
|
|
94
|
+
...options,
|
|
95
|
+
schema: {
|
|
96
|
+
...Base,
|
|
97
|
+
title: Schema.String,
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
export type Renamed = typeof Renamed.Type
|
|
101
|
+
|
|
102
|
+
export const MetadataUpdated = Event.durable({
|
|
103
|
+
type: "session.metadata.updated",
|
|
104
|
+
...options,
|
|
105
|
+
schema: {
|
|
106
|
+
...Base,
|
|
107
|
+
metadata: SessionMetadata,
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
export type MetadataUpdated = typeof MetadataUpdated.Type
|
|
111
|
+
|
|
112
|
+
export const Permissions = Event.durable({
|
|
113
|
+
type: "session.permissions",
|
|
114
|
+
...options,
|
|
115
|
+
schema: {
|
|
116
|
+
...Base,
|
|
117
|
+
permissions: Permission.Ruleset,
|
|
118
|
+
},
|
|
119
|
+
})
|
|
120
|
+
export type Permissions = typeof Permissions.Type
|
|
121
|
+
|
|
122
|
+
export const Viewed = Event.durable({
|
|
123
|
+
type: "session.viewed",
|
|
124
|
+
...options,
|
|
125
|
+
schema: {
|
|
126
|
+
...Base,
|
|
127
|
+
/** Epoch-millisecond idle watermark the viewer observed; projection never marks a newer idle transition viewed. */
|
|
128
|
+
idle: Schema.Finite,
|
|
129
|
+
},
|
|
130
|
+
})
|
|
131
|
+
export type Viewed = typeof Viewed.Type
|
|
132
|
+
|
|
133
|
+
export const Archived = Event.durable({
|
|
134
|
+
type: "session.archived",
|
|
135
|
+
...options,
|
|
136
|
+
schema: Base,
|
|
137
|
+
})
|
|
138
|
+
export type Archived = typeof Archived.Type
|
|
139
|
+
|
|
140
|
+
export const Unarchived = Event.durable({
|
|
141
|
+
type: "session.unarchived",
|
|
142
|
+
...options,
|
|
143
|
+
schema: Base,
|
|
144
|
+
})
|
|
145
|
+
export type Unarchived = typeof Unarchived.Type
|
|
146
|
+
|
|
147
|
+
// Replay-only: older releases allowed replacing completed assistant content.
|
|
148
|
+
export const MessageContentUpdated = Event.durable({
|
|
149
|
+
type: "session.message.content.updated",
|
|
150
|
+
...options,
|
|
151
|
+
schema: {
|
|
152
|
+
...Base,
|
|
153
|
+
messageID: SessionMessage.ID,
|
|
154
|
+
// Public events are framed directly, so timestamps must already be encoded.
|
|
155
|
+
content: Schema.Array(SessionMessage.AssistantContentEncoded),
|
|
156
|
+
},
|
|
157
|
+
})
|
|
158
|
+
export type MessageContentUpdated = typeof MessageContentUpdated.Type
|
|
159
|
+
|
|
160
|
+
export const UsageRecorded = Event.durable({
|
|
161
|
+
type: "session.usage.recorded",
|
|
162
|
+
...options,
|
|
163
|
+
schema: {
|
|
164
|
+
...Base,
|
|
165
|
+
source: Schema.Literals(["title", "compaction", "generate"]),
|
|
166
|
+
cost: Money.USD,
|
|
167
|
+
tokens: TokenUsage.Info,
|
|
168
|
+
},
|
|
169
|
+
})
|
|
170
|
+
export type UsageRecorded = typeof UsageRecorded.Type
|
|
171
|
+
|
|
172
|
+
export const UsageUpdated = Event.ephemeral({
|
|
173
|
+
type: "session.usage.updated",
|
|
174
|
+
schema: {
|
|
175
|
+
...Base,
|
|
176
|
+
cost: Money.USD,
|
|
177
|
+
tokens: TokenUsage.Info,
|
|
178
|
+
},
|
|
179
|
+
})
|
|
180
|
+
export type UsageUpdated = typeof UsageUpdated.Type
|
|
181
|
+
|
|
182
|
+
export const Deleted = Event.durable({
|
|
183
|
+
type: "session.deleted",
|
|
184
|
+
durable: {
|
|
185
|
+
aggregate: "sessionID",
|
|
186
|
+
version: 2,
|
|
187
|
+
},
|
|
188
|
+
schema: Base,
|
|
189
|
+
})
|
|
190
|
+
export type Deleted = typeof Deleted.Type
|
|
191
|
+
|
|
192
|
+
export const Forked = Event.durable({
|
|
193
|
+
type: "session.forked",
|
|
194
|
+
durable: {
|
|
195
|
+
aggregate: "sessionID",
|
|
196
|
+
version: 2,
|
|
197
|
+
},
|
|
198
|
+
schema: {
|
|
199
|
+
...Base,
|
|
200
|
+
parentID: SessionID,
|
|
201
|
+
boundary: SessionFork.Boundary,
|
|
202
|
+
instructions: Instruction.Values.pipe(optional),
|
|
203
|
+
instructionEntries: InstructionEntry.Snapshot.pipe(optional),
|
|
204
|
+
},
|
|
205
|
+
})
|
|
206
|
+
export type Forked = typeof Forked.Type
|
|
207
|
+
|
|
208
|
+
const InboxRef = {
|
|
209
|
+
...Base,
|
|
210
|
+
inboxID: SessionMessage.ID,
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export const InboxDelivered = Event.durable({
|
|
214
|
+
type: "session.inbox.delivered",
|
|
215
|
+
...options,
|
|
216
|
+
schema: InboxRef,
|
|
217
|
+
})
|
|
218
|
+
export type InboxDelivered = typeof InboxDelivered.Type
|
|
219
|
+
|
|
220
|
+
export const InboxEnqueued = Event.durable({
|
|
221
|
+
type: "session.inbox.enqueued",
|
|
222
|
+
...options,
|
|
223
|
+
schema: {
|
|
224
|
+
...InboxRef,
|
|
225
|
+
item: SessionInbox.Item,
|
|
226
|
+
},
|
|
227
|
+
})
|
|
228
|
+
export type InboxEnqueued = typeof InboxEnqueued.Type
|
|
229
|
+
|
|
230
|
+
export const InboxCancelled = Event.durable({
|
|
231
|
+
type: "session.inbox.cancelled",
|
|
232
|
+
...options,
|
|
233
|
+
schema: InboxRef,
|
|
234
|
+
})
|
|
235
|
+
export type InboxCancelled = typeof InboxCancelled.Type
|
|
236
|
+
|
|
237
|
+
export const InboxDeliveryChanged = Event.durable({
|
|
238
|
+
type: "session.inbox.delivery.changed",
|
|
239
|
+
...options,
|
|
240
|
+
schema: { ...InboxRef, delivery: SessionInbox.Delivery },
|
|
241
|
+
})
|
|
242
|
+
export type InboxDeliveryChanged = typeof InboxDeliveryChanged.Type
|
|
243
|
+
|
|
244
|
+
export namespace Execution {
|
|
245
|
+
export const Started = Event.durable({ type: "session.execution.started", ...options, schema: Base })
|
|
246
|
+
export type Started = typeof Started.Type
|
|
247
|
+
|
|
248
|
+
export const Succeeded = Event.durable({ type: "session.execution.succeeded", ...options, schema: Base })
|
|
249
|
+
export type Succeeded = typeof Succeeded.Type
|
|
250
|
+
|
|
251
|
+
export const Failed = Event.durable({
|
|
252
|
+
type: "session.execution.failed",
|
|
253
|
+
...options,
|
|
254
|
+
schema: { ...Base, error: SessionError.Error },
|
|
255
|
+
})
|
|
256
|
+
export type Failed = typeof Failed.Type
|
|
257
|
+
|
|
258
|
+
export const Interrupted = Event.durable({
|
|
259
|
+
type: "session.execution.interrupted",
|
|
260
|
+
...options,
|
|
261
|
+
schema: { ...Base, reason: Schema.Literals(["user", "shutdown", "superseded", "inactivity"]) },
|
|
262
|
+
})
|
|
263
|
+
export type Interrupted = typeof Interrupted.Type
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export const InstructionsUpdated = Event.durable({
|
|
267
|
+
type: "session.instructions.updated",
|
|
268
|
+
durable: {
|
|
269
|
+
aggregate: "sessionID",
|
|
270
|
+
version: 2,
|
|
271
|
+
},
|
|
272
|
+
schema: {
|
|
273
|
+
...Base,
|
|
274
|
+
delta: Instruction.Delta,
|
|
275
|
+
/**
|
|
276
|
+
* The rendered chronological update shown to the model, frozen at emit time.
|
|
277
|
+
* Absent for the initial baseline observation and for deltas that render empty.
|
|
278
|
+
*/
|
|
279
|
+
text: Schema.String.pipe(optional),
|
|
280
|
+
},
|
|
281
|
+
})
|
|
282
|
+
export type InstructionsUpdated = typeof InstructionsUpdated.Type
|
|
283
|
+
|
|
284
|
+
export const Synthetic = Event.durable({
|
|
285
|
+
type: "session.synthetic",
|
|
286
|
+
...options,
|
|
287
|
+
schema: {
|
|
288
|
+
...Base,
|
|
289
|
+
text: Schema.String,
|
|
290
|
+
description: Schema.String.pipe(optional),
|
|
291
|
+
metadata: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
|
|
292
|
+
},
|
|
293
|
+
})
|
|
294
|
+
export type Synthetic = typeof Synthetic.Type
|
|
295
|
+
|
|
296
|
+
export namespace Skill {
|
|
297
|
+
export const Activated = Event.durable({
|
|
298
|
+
type: "session.skill.activated",
|
|
299
|
+
...options,
|
|
300
|
+
schema: {
|
|
301
|
+
...Base,
|
|
302
|
+
id: SkillSchema.ID,
|
|
303
|
+
name: SkillSchema.Name,
|
|
304
|
+
text: Schema.String,
|
|
305
|
+
},
|
|
306
|
+
})
|
|
307
|
+
export type Activated = typeof Activated.Type
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export namespace Shell {
|
|
311
|
+
export const Started = Event.durable({
|
|
312
|
+
type: "session.shell.started",
|
|
313
|
+
...options,
|
|
314
|
+
schema: {
|
|
315
|
+
...Base,
|
|
316
|
+
shell: ShellSchema.Info,
|
|
317
|
+
},
|
|
318
|
+
})
|
|
319
|
+
export type Started = typeof Started.Type
|
|
320
|
+
|
|
321
|
+
export const Ended = Event.durable({
|
|
322
|
+
type: "session.shell.ended",
|
|
323
|
+
...options,
|
|
324
|
+
schema: {
|
|
325
|
+
...Base,
|
|
326
|
+
shell: ShellSchema.Info,
|
|
327
|
+
output: ShellSchema.Output,
|
|
328
|
+
},
|
|
329
|
+
})
|
|
330
|
+
export type Ended = typeof Ended.Type
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export namespace Step {
|
|
334
|
+
export const Started = Event.durable({
|
|
335
|
+
type: "session.step.started",
|
|
336
|
+
...options,
|
|
337
|
+
schema: {
|
|
338
|
+
...Base,
|
|
339
|
+
assistantMessageID: SessionMessage.ID,
|
|
340
|
+
agent: Agent.ID,
|
|
341
|
+
model: Model.Ref,
|
|
342
|
+
snapshot: Snapshot.ID.pipe(optional),
|
|
343
|
+
/** Request dispatch time, before waiting for provider output. */
|
|
344
|
+
started: NonNegativeInt,
|
|
345
|
+
},
|
|
346
|
+
})
|
|
347
|
+
export type Started = typeof Started.Type
|
|
348
|
+
|
|
349
|
+
/** Records when the provider streamed the first output token, before the rest of the response. */
|
|
350
|
+
export const FirstToken = Event.durable({
|
|
351
|
+
type: "session.step.first-token",
|
|
352
|
+
...options,
|
|
353
|
+
schema: {
|
|
354
|
+
...Base,
|
|
355
|
+
assistantMessageID: SessionMessage.ID,
|
|
356
|
+
},
|
|
357
|
+
})
|
|
358
|
+
export type FirstToken = typeof FirstToken.Type
|
|
359
|
+
|
|
360
|
+
/** Records the provider response-body boundary independently of tool settlement. */
|
|
361
|
+
export const Streamed = Event.durable({
|
|
362
|
+
type: "session.step.streamed",
|
|
363
|
+
...options,
|
|
364
|
+
schema: {
|
|
365
|
+
...Base,
|
|
366
|
+
assistantMessageID: SessionMessage.ID,
|
|
367
|
+
},
|
|
368
|
+
})
|
|
369
|
+
export type Streamed = typeof Streamed.Type
|
|
370
|
+
|
|
371
|
+
export const Ended = Event.durable({
|
|
372
|
+
type: "session.step.ended",
|
|
373
|
+
...options,
|
|
374
|
+
schema: {
|
|
375
|
+
...Base,
|
|
376
|
+
assistantMessageID: SessionMessage.ID,
|
|
377
|
+
finish: FinishReason,
|
|
378
|
+
rawFinish: Schema.String.pipe(optional),
|
|
379
|
+
native: SessionMessage.Native.pipe(optional),
|
|
380
|
+
cost: Money.USD,
|
|
381
|
+
tokens: TokenUsage.Info,
|
|
382
|
+
snapshot: Snapshot.ID.pipe(optional),
|
|
383
|
+
files: Schema.Array(RelativePath).pipe(optional),
|
|
384
|
+
},
|
|
385
|
+
})
|
|
386
|
+
export type Ended = typeof Ended.Type
|
|
387
|
+
|
|
388
|
+
export const Failed = Event.durable({
|
|
389
|
+
type: "session.step.failed",
|
|
390
|
+
...options,
|
|
391
|
+
schema: {
|
|
392
|
+
...Base,
|
|
393
|
+
assistantMessageID: SessionMessage.ID,
|
|
394
|
+
error: SessionError.Error,
|
|
395
|
+
finish: Schema.Literals(["content-filter"]).pipe(optional),
|
|
396
|
+
rawFinish: Schema.String.pipe(optional),
|
|
397
|
+
native: SessionMessage.Native.pipe(optional),
|
|
398
|
+
cost: Money.USD.pipe(optional),
|
|
399
|
+
tokens: TokenUsage.Info.pipe(optional),
|
|
400
|
+
snapshot: Snapshot.ID.pipe(optional),
|
|
401
|
+
files: Schema.Array(RelativePath).pipe(optional),
|
|
402
|
+
},
|
|
403
|
+
})
|
|
404
|
+
export type Failed = typeof Failed.Type
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export namespace Text {
|
|
408
|
+
export const Started = Event.durable({
|
|
409
|
+
type: "session.text.started",
|
|
410
|
+
...options,
|
|
411
|
+
schema: {
|
|
412
|
+
...Base,
|
|
413
|
+
assistantMessageID: SessionMessage.ID,
|
|
414
|
+
ordinal: NonNegativeInt,
|
|
415
|
+
},
|
|
416
|
+
})
|
|
417
|
+
export type Started = typeof Started.Type
|
|
418
|
+
|
|
419
|
+
// Stream fragments are live-only; Text.Ended is the replayable full-value boundary.
|
|
420
|
+
export const Delta = Event.ephemeral({
|
|
421
|
+
type: "session.text.delta",
|
|
422
|
+
schema: {
|
|
423
|
+
...Base,
|
|
424
|
+
assistantMessageID: SessionMessage.ID,
|
|
425
|
+
ordinal: NonNegativeInt,
|
|
426
|
+
delta: Schema.String,
|
|
427
|
+
},
|
|
428
|
+
})
|
|
429
|
+
export type Delta = typeof Delta.Type
|
|
430
|
+
|
|
431
|
+
export const Ended = Event.durable({
|
|
432
|
+
type: "session.text.ended",
|
|
433
|
+
...options,
|
|
434
|
+
schema: {
|
|
435
|
+
...Base,
|
|
436
|
+
assistantMessageID: SessionMessage.ID,
|
|
437
|
+
ordinal: NonNegativeInt,
|
|
438
|
+
text: Schema.String,
|
|
439
|
+
native: SessionMessage.Native.pipe(optional),
|
|
440
|
+
},
|
|
441
|
+
})
|
|
442
|
+
export type Ended = typeof Ended.Type
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
export namespace Reasoning {
|
|
446
|
+
export const Started = Event.durable({
|
|
447
|
+
type: "session.reasoning.started",
|
|
448
|
+
...options,
|
|
449
|
+
schema: {
|
|
450
|
+
...Base,
|
|
451
|
+
assistantMessageID: SessionMessage.ID,
|
|
452
|
+
ordinal: NonNegativeInt,
|
|
453
|
+
native: SessionMessage.Native.pipe(optional),
|
|
454
|
+
},
|
|
455
|
+
})
|
|
456
|
+
export type Started = typeof Started.Type
|
|
457
|
+
|
|
458
|
+
// Stream fragments are live-only; Reasoning.Ended is the replayable full-value boundary.
|
|
459
|
+
export const Delta = Event.ephemeral({
|
|
460
|
+
type: "session.reasoning.delta",
|
|
461
|
+
schema: {
|
|
462
|
+
...Base,
|
|
463
|
+
assistantMessageID: SessionMessage.ID,
|
|
464
|
+
ordinal: NonNegativeInt,
|
|
465
|
+
delta: Schema.String,
|
|
466
|
+
},
|
|
467
|
+
})
|
|
468
|
+
export type Delta = typeof Delta.Type
|
|
469
|
+
|
|
470
|
+
export const Ended = Event.durable({
|
|
471
|
+
type: "session.reasoning.ended",
|
|
472
|
+
...options,
|
|
473
|
+
schema: {
|
|
474
|
+
...Base,
|
|
475
|
+
assistantMessageID: SessionMessage.ID,
|
|
476
|
+
ordinal: NonNegativeInt,
|
|
477
|
+
text: Schema.String,
|
|
478
|
+
native: SessionMessage.Native.pipe(optional),
|
|
479
|
+
},
|
|
480
|
+
})
|
|
481
|
+
export type Ended = typeof Ended.Type
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export namespace Tool {
|
|
485
|
+
const ToolBase = {
|
|
486
|
+
...Base,
|
|
487
|
+
assistantMessageID: SessionMessage.ID,
|
|
488
|
+
id: Schema.String,
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export namespace Input {
|
|
492
|
+
export const Started = Event.durable({
|
|
493
|
+
type: "session.tool.input.started",
|
|
494
|
+
...options,
|
|
495
|
+
schema: {
|
|
496
|
+
...ToolBase,
|
|
497
|
+
name: Schema.String,
|
|
498
|
+
},
|
|
499
|
+
})
|
|
500
|
+
export type Started = typeof Started.Type
|
|
501
|
+
|
|
502
|
+
// Stream fragments are live-only; Input.Ended is the replayable raw-input boundary.
|
|
503
|
+
export const Delta = Event.ephemeral({
|
|
504
|
+
type: "session.tool.input.delta",
|
|
505
|
+
schema: {
|
|
506
|
+
...ToolBase,
|
|
507
|
+
delta: Schema.String,
|
|
508
|
+
},
|
|
509
|
+
})
|
|
510
|
+
export type Delta = typeof Delta.Type
|
|
511
|
+
|
|
512
|
+
export const Ended = Event.durable({
|
|
513
|
+
type: "session.tool.input.ended",
|
|
514
|
+
...options,
|
|
515
|
+
schema: {
|
|
516
|
+
...ToolBase,
|
|
517
|
+
text: Schema.String,
|
|
518
|
+
},
|
|
519
|
+
})
|
|
520
|
+
export type Ended = typeof Ended.Type
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export const Called = Event.durable({
|
|
524
|
+
type: "session.tool.called",
|
|
525
|
+
...options,
|
|
526
|
+
schema: {
|
|
527
|
+
...ToolBase,
|
|
528
|
+
input: Schema.Record(Schema.String, Schema.Unknown),
|
|
529
|
+
executed: Schema.Boolean,
|
|
530
|
+
native: SessionMessage.Native.pipe(optional),
|
|
531
|
+
},
|
|
532
|
+
})
|
|
533
|
+
export type Called = typeof Called.Type
|
|
534
|
+
|
|
535
|
+
/** Live replacement metadata for a running tool. */
|
|
536
|
+
export const Progress = Event.ephemeral({
|
|
537
|
+
type: "session.tool.progress",
|
|
538
|
+
schema: {
|
|
539
|
+
...ToolBase,
|
|
540
|
+
metadata: Schema.Record(Schema.String, Schema.Json),
|
|
541
|
+
},
|
|
542
|
+
})
|
|
543
|
+
export type Progress = typeof Progress.Type
|
|
544
|
+
|
|
545
|
+
/** Canonical terminal success: one non-empty model representation plus optional UI metadata. */
|
|
546
|
+
export const Success = Event.durable({
|
|
547
|
+
type: "session.tool.success",
|
|
548
|
+
durable: {
|
|
549
|
+
aggregate: "sessionID",
|
|
550
|
+
version: 2,
|
|
551
|
+
},
|
|
552
|
+
schema: {
|
|
553
|
+
...ToolBase,
|
|
554
|
+
content: Schema.NonEmptyArray(Content),
|
|
555
|
+
metadata: Schema.Record(Schema.String, Schema.Json).pipe(optional),
|
|
556
|
+
executed: Schema.Boolean,
|
|
557
|
+
native: SessionMessage.Native.pipe(optional),
|
|
558
|
+
},
|
|
559
|
+
})
|
|
560
|
+
export type Success = typeof Success.Type
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Canonical terminal failure: one error plus the final bounded snapshot of
|
|
564
|
+
* partial progress. The event is self-contained; projection never reaches
|
|
565
|
+
* into ephemeral progress history.
|
|
566
|
+
*/
|
|
567
|
+
export const Failed = Event.durable({
|
|
568
|
+
type: "session.tool.failed",
|
|
569
|
+
durable: {
|
|
570
|
+
aggregate: "sessionID",
|
|
571
|
+
version: 2,
|
|
572
|
+
},
|
|
573
|
+
schema: {
|
|
574
|
+
...ToolBase,
|
|
575
|
+
error: SessionError.Error,
|
|
576
|
+
content: Schema.NonEmptyArray(Content).pipe(optional),
|
|
577
|
+
metadata: Schema.Record(Schema.String, Schema.Json).pipe(optional),
|
|
578
|
+
executed: Schema.Boolean,
|
|
579
|
+
native: SessionMessage.Native.pipe(optional),
|
|
580
|
+
},
|
|
581
|
+
})
|
|
582
|
+
export type Failed = typeof Failed.Type
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export const RetryScheduled = Event.durable({
|
|
586
|
+
type: "session.retry.scheduled",
|
|
587
|
+
...options,
|
|
588
|
+
schema: {
|
|
589
|
+
...Base,
|
|
590
|
+
assistantMessageID: SessionMessage.ID,
|
|
591
|
+
attempt: PositiveInt,
|
|
592
|
+
at: NonNegativeInt,
|
|
593
|
+
error: SessionError.Error,
|
|
594
|
+
},
|
|
595
|
+
})
|
|
596
|
+
export type RetryScheduled = typeof RetryScheduled.Type
|
|
597
|
+
|
|
598
|
+
export namespace Compaction {
|
|
599
|
+
export const Started = Event.durable({
|
|
600
|
+
type: "session.compaction.started",
|
|
601
|
+
...options,
|
|
602
|
+
schema: {
|
|
603
|
+
...Base,
|
|
604
|
+
reason: Schema.Literals(["auto", "manual"]),
|
|
605
|
+
inputID: SessionMessage.ID.pipe(optional),
|
|
606
|
+
},
|
|
607
|
+
})
|
|
608
|
+
export type Started = typeof Started.Type
|
|
609
|
+
|
|
610
|
+
export const Delta = Event.ephemeral({
|
|
611
|
+
type: "session.compaction.delta",
|
|
612
|
+
schema: {
|
|
613
|
+
...Base,
|
|
614
|
+
text: Schema.String,
|
|
615
|
+
},
|
|
616
|
+
})
|
|
617
|
+
export type Delta = typeof Delta.Type
|
|
618
|
+
|
|
619
|
+
export const Ended = Event.durable({
|
|
620
|
+
type: "session.compaction.ended",
|
|
621
|
+
...options,
|
|
622
|
+
schema: {
|
|
623
|
+
...Base,
|
|
624
|
+
reason: Started.data.fields.reason,
|
|
625
|
+
model: SessionMessage.CompactionCompleted.fields.model,
|
|
626
|
+
native: SessionMessage.CompactionCompleted.fields.native,
|
|
627
|
+
text: Schema.String,
|
|
628
|
+
// Repeats the internal `session.usage.recorded` figures: that event never reaches clients, and it
|
|
629
|
+
// stays the accounting source for session totals and stats.
|
|
630
|
+
cost: SessionMessage.CompactionCompleted.fields.cost,
|
|
631
|
+
tokens: SessionMessage.CompactionCompleted.fields.tokens,
|
|
632
|
+
},
|
|
633
|
+
})
|
|
634
|
+
export type Ended = typeof Ended.Type
|
|
635
|
+
|
|
636
|
+
export const Failed = Event.durable({
|
|
637
|
+
type: "session.compaction.failed",
|
|
638
|
+
...options,
|
|
639
|
+
schema: {
|
|
640
|
+
...Base,
|
|
641
|
+
reason: Started.data.fields.reason,
|
|
642
|
+
error: SessionError.Error,
|
|
643
|
+
inputID: SessionMessage.ID.pipe(optional),
|
|
644
|
+
cost: SessionMessage.CompactionFailed.fields.cost,
|
|
645
|
+
tokens: SessionMessage.CompactionFailed.fields.tokens,
|
|
646
|
+
},
|
|
647
|
+
})
|
|
648
|
+
export type Failed = typeof Failed.Type
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
export namespace RevertEvent {
|
|
652
|
+
export const Staged = Event.durable({
|
|
653
|
+
type: "session.revert.staged",
|
|
654
|
+
...options,
|
|
655
|
+
schema: { ...Base, revert: Revert },
|
|
656
|
+
})
|
|
657
|
+
export const Cleared = Event.durable({ type: "session.revert.cleared", ...options, schema: Base })
|
|
658
|
+
export const Committed = Event.durable({
|
|
659
|
+
type: "session.revert.committed",
|
|
660
|
+
...options,
|
|
661
|
+
schema: { ...Base, to: SessionMessage.ID },
|
|
662
|
+
})
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
export const Definitions = Event.inventory(
|
|
666
|
+
Created,
|
|
667
|
+
AgentSelected,
|
|
668
|
+
ModelSelected,
|
|
669
|
+
Moved,
|
|
670
|
+
Renamed,
|
|
671
|
+
MetadataUpdated,
|
|
672
|
+
Permissions,
|
|
673
|
+
Viewed,
|
|
674
|
+
Archived,
|
|
675
|
+
Unarchived,
|
|
676
|
+
UsageUpdated,
|
|
677
|
+
Deleted,
|
|
678
|
+
Forked,
|
|
679
|
+
InboxDelivered,
|
|
680
|
+
InboxEnqueued,
|
|
681
|
+
InboxCancelled,
|
|
682
|
+
InboxDeliveryChanged,
|
|
683
|
+
Execution.Started,
|
|
684
|
+
Execution.Succeeded,
|
|
685
|
+
Execution.Failed,
|
|
686
|
+
Execution.Interrupted,
|
|
687
|
+
InstructionsUpdated,
|
|
688
|
+
Synthetic,
|
|
689
|
+
Skill.Activated,
|
|
690
|
+
Shell.Started,
|
|
691
|
+
Shell.Ended,
|
|
692
|
+
Step.Started,
|
|
693
|
+
Step.FirstToken,
|
|
694
|
+
Step.Streamed,
|
|
695
|
+
Step.Ended,
|
|
696
|
+
Step.Failed,
|
|
697
|
+
Text.Started,
|
|
698
|
+
Text.Delta,
|
|
699
|
+
Text.Ended,
|
|
700
|
+
Reasoning.Started,
|
|
701
|
+
Reasoning.Delta,
|
|
702
|
+
Reasoning.Ended,
|
|
703
|
+
Tool.Input.Started,
|
|
704
|
+
Tool.Input.Delta,
|
|
705
|
+
Tool.Input.Ended,
|
|
706
|
+
Tool.Called,
|
|
707
|
+
Tool.Progress,
|
|
708
|
+
Tool.Success,
|
|
709
|
+
Tool.Failed,
|
|
710
|
+
RetryScheduled,
|
|
711
|
+
Compaction.Started,
|
|
712
|
+
Compaction.Delta,
|
|
713
|
+
Compaction.Ended,
|
|
714
|
+
Compaction.Failed,
|
|
715
|
+
RevertEvent.Staged,
|
|
716
|
+
RevertEvent.Cleared,
|
|
717
|
+
RevertEvent.Committed,
|
|
718
|
+
)
|
|
719
|
+
|
|
720
|
+
// Internal and replay-only events are excluded from the public manifest.
|
|
721
|
+
export const DurableDefinitions = Event.inventory(
|
|
722
|
+
...Definitions.filter((definition) => definition.durability === "durable"),
|
|
723
|
+
UsageRecorded,
|
|
724
|
+
MessageContentUpdated,
|
|
725
|
+
)
|
|
726
|
+
export const EphemeralDefinitions = Event.inventory(
|
|
727
|
+
...Definitions.filter((definition) => definition.durability === "ephemeral"),
|
|
728
|
+
)
|
|
729
|
+
|
|
730
|
+
export const Durable = Schema.Union(DurableDefinitions, { mode: "oneOf" })
|
|
731
|
+
.annotate({ identifier: "Session.Event.Durable" })
|
|
732
|
+
.pipe(Schema.toTaggedUnion("type"))
|
|
733
|
+
export type DurableEvent = typeof Durable.Type
|
|
734
|
+
|
|
735
|
+
export const All = Schema.Union([Durable, ...EphemeralDefinitions], { mode: "oneOf" }).pipe(
|
|
736
|
+
Schema.toTaggedUnion("type"),
|
|
737
|
+
)
|
|
738
|
+
export type Event = typeof All.Type
|
|
739
|
+
export type Type = Event["type"]
|