@opencode-ai/schema 0.0.0-dev-17471
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/dist/agent.d.ts +164 -0
- package/dist/agent.js +46 -0
- package/dist/ai.d.ts +4 -0
- package/dist/ai.js +5 -0
- package/dist/catalog.d.ts +69 -0
- package/dist/catalog.js +4 -0
- package/dist/command.d.ts +124 -0
- package/dist/command.js +19 -0
- package/dist/config/agent.d.ts +42 -0
- package/dist/config/agent.js +20 -0
- package/dist/config/command.d.ts +27 -0
- package/dist/config/command.js +12 -0
- package/dist/config/compaction.d.ts +14 -0
- package/dist/config/compaction.js +13 -0
- package/dist/config/experimental.d.ts +17 -0
- package/dist/config/experimental.js +16 -0
- package/dist/config/formatter.d.ts +11 -0
- package/dist/config/formatter.js +11 -0
- package/dist/config/lsp.d.ts +20 -0
- package/dist/config/lsp.js +16 -0
- package/dist/config/mcp.d.ts +18 -0
- package/dist/config/mcp.js +14 -0
- package/dist/config/media.d.ts +15 -0
- package/dist/config/media.js +14 -0
- package/dist/config/model.d.ts +18 -0
- package/dist/config/model.js +28 -0
- package/dist/config/plugin.d.ts +11 -0
- package/dist/config/plugin.js +10 -0
- package/dist/config/policy.d.ts +10 -0
- package/dist/config/policy.js +8 -0
- package/dist/config/provider.d.ts +106 -0
- package/dist/config/provider.js +62 -0
- package/dist/config/reference.d.ts +21 -0
- package/dist/config/reference.js +18 -0
- package/dist/config/tool-output.d.ts +8 -0
- package/dist/config/tool-output.js +8 -0
- package/dist/config/warming.d.ts +10 -0
- package/dist/config/warming.js +16 -0
- package/dist/config/watcher.d.ts +7 -0
- package/dist/config/watcher.js +7 -0
- package/dist/config/websearch.d.ts +9 -0
- package/dist/config/websearch.js +8 -0
- package/dist/config.d.ts +175 -0
- package/dist/config.js +136 -0
- package/dist/connection.d.ts +28 -0
- package/dist/connection.js +15 -0
- package/dist/credential.d.ts +38 -0
- package/dist/credential.js +25 -0
- package/dist/durable-event-manifest.d.ts +3 -0
- package/dist/durable-event-manifest.js +5 -0
- package/dist/event-log.d.ts +14 -0
- package/dist/event-log.js +17 -0
- package/dist/event-manifest.d.ts +11372 -0
- package/dist/event-manifest.js +45 -0
- package/dist/event.d.ts +142 -0
- package/dist/event.js +110 -0
- package/dist/file-diff.d.ts +21 -0
- package/dist/file-diff.js +18 -0
- package/dist/filesystem-v1.d.ts +1 -0
- package/dist/filesystem-v1.js +1 -0
- package/dist/filesystem.d.ts +118 -0
- package/dist/filesystem.js +35 -0
- package/dist/form.d.ts +1259 -0
- package/dist/form.js +120 -0
- package/dist/ide-event.d.ts +76 -0
- package/dist/ide-event.js +10 -0
- package/dist/identifier.d.ts +3 -0
- package/dist/identifier.js +24 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +39 -0
- package/dist/installation-event.d.ts +149 -0
- package/dist/installation-event.js +16 -0
- package/dist/instruction-entry.d.ts +23 -0
- package/dist/instruction-entry.js +22 -0
- package/dist/instruction.d.ts +13 -0
- package/dist/instruction.js +8 -0
- package/dist/integration-id.d.ts +5 -0
- package/dist/integration-id.js +3 -0
- package/dist/integration.d.ts +1675 -0
- package/dist/integration.js +87 -0
- package/dist/legacy-event.d.ts +1 -0
- package/dist/legacy-event.js +1 -0
- package/dist/llm.d.ts +4 -0
- package/dist/llm.js +3 -0
- package/dist/location.d.ts +37 -0
- package/dist/location.js +22 -0
- package/dist/lsp-event.d.ts +67 -0
- package/dist/lsp-event.js +4 -0
- package/dist/mcp-event.d.ts +222 -0
- package/dist/mcp-event.js +24 -0
- package/dist/mcp.d.ts +138 -0
- package/dist/mcp.js +111 -0
- package/dist/model.d.ts +186 -0
- package/dist/model.js +104 -0
- package/dist/models-dev.d.ts +69 -0
- package/dist/models-dev.js +7 -0
- package/dist/money.d.ts +10 -0
- package/dist/money.js +5 -0
- package/dist/permission-saved.d.ts +18 -0
- package/dist/permission-saved.js +12 -0
- package/dist/permission-v1.d.ts +1 -0
- package/dist/permission-v1.js +1 -0
- package/dist/permission.d.ts +306 -0
- package/dist/permission.js +45 -0
- package/dist/plugin.d.ts +150 -0
- package/dist/plugin.js +16 -0
- package/dist/project-id.d.ts +5 -0
- package/dist/project-id.js +3 -0
- package/dist/project.d.ts +241 -0
- package/dist/project.js +37 -0
- package/dist/prompt-input.d.ts +143 -0
- package/dist/prompt-input.js +25 -0
- package/dist/prompt.d.ts +297 -0
- package/dist/prompt.js +61 -0
- package/dist/provider.d.ts +60 -0
- package/dist/provider.js +42 -0
- package/dist/pty-ticket.d.ts +8 -0
- package/dist/pty-ticket.js +7 -0
- package/dist/pty.d.ts +462 -0
- package/dist/pty.js +43 -0
- package/dist/question-v1.d.ts +1 -0
- package/dist/question-v1.js +1 -0
- package/dist/question.d.ts +15 -0
- package/dist/question.js +15 -0
- package/dist/reference.d.ts +120 -0
- package/dist/reference.js +30 -0
- package/dist/schema.d.ts +10 -0
- package/dist/schema.js +14 -0
- package/dist/server-event.d.ts +132 -0
- package/dist/server-event.js +5 -0
- package/dist/session-compaction-event.d.ts +87 -0
- package/dist/session-compaction-event.js +10 -0
- package/dist/session-error.d.ts +9 -0
- package/dist/session-error.js +8 -0
- package/dist/session-event.d.ts +17994 -0
- package/dist/session-event.js +499 -0
- package/dist/session-fork.d.ts +26 -0
- package/dist/session-fork.js +11 -0
- package/dist/session-id.d.ts +6 -0
- package/dist/session-id.js +10 -0
- package/dist/session-inbox.d.ts +748 -0
- package/dist/session-inbox.js +47 -0
- package/dist/session-message.d.ts +1512 -0
- package/dist/session-message.js +209 -0
- package/dist/session-revert.d.ts +480 -0
- package/dist/session-revert.js +63 -0
- package/dist/session-status-event.d.ts +299 -0
- package/dist/session-status-event.js +43 -0
- package/dist/session-transfer.d.ts +744 -0
- package/dist/session-transfer.js +8 -0
- package/dist/session-v1.d.ts +1 -0
- package/dist/session-v1.js +1 -0
- package/dist/session.d.ts +218 -0
- package/dist/session.js +45 -0
- package/dist/shell.d.ts +381 -0
- package/dist/shell.js +58 -0
- package/dist/skill.d.ts +133 -0
- package/dist/skill.js +48 -0
- package/dist/snapshot.d.ts +4 -0
- package/dist/snapshot.js +3 -0
- package/dist/token-usage.d.ts +13 -0
- package/dist/token-usage.js +11 -0
- package/dist/tool.d.ts +74 -0
- package/dist/tool.js +22 -0
- package/dist/tui-event.d.ts +307 -0
- package/dist/tui-event.js +53 -0
- package/dist/v1/filesystem.d.ts +78 -0
- package/dist/v1/filesystem.js +8 -0
- package/dist/v1/legacy-event.d.ts +108 -0
- package/dist/v1/legacy-event.js +15 -0
- package/dist/v1/permission.d.ts +316 -0
- package/dist/v1/permission.js +41 -0
- package/dist/v1/question.d.ts +444 -0
- package/dist/v1/question.js +57 -0
- package/dist/v1/session.d.ts +7657 -0
- package/dist/v1/session.js +535 -0
- package/dist/vcs-event.d.ts +76 -0
- package/dist/vcs-event.js +11 -0
- package/dist/vcs.d.ts +26 -0
- package/dist/vcs.js +17 -0
- package/dist/websearch.d.ts +108 -0
- package/dist/websearch.js +31 -0
- package/dist/workspace-event.d.ts +247 -0
- package/dist/workspace-event.js +25 -0
- package/dist/workspace-id.d.ts +6 -0
- package/dist/workspace-id.js +16 -0
- package/dist/workspace.d.ts +9 -0
- package/dist/workspace.js +5 -0
- package/dist/worktree-event.d.ts +153 -0
- package/dist/worktree-event.js +18 -0
- package/dist/worktree.d.ts +255 -0
- package/dist/worktree.js +61 -0
- package/package.json +42 -0
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
export * as SessionEvent from "./session-event.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { optional } from "./schema.js";
|
|
4
|
+
import { Event } from "./event.js";
|
|
5
|
+
import { FinishReason } from "./llm.js";
|
|
6
|
+
import { Content } from "./tool.js";
|
|
7
|
+
import { Model } from "./model.js";
|
|
8
|
+
import { NonNegativeInt, PositiveInt, RelativePath } from "./schema.js";
|
|
9
|
+
import { FileAttachment } from "./prompt.js";
|
|
10
|
+
import { SessionID } from "./session-id.js";
|
|
11
|
+
import { Location } from "./location.js";
|
|
12
|
+
import { SessionMessage } from "./session-message.js";
|
|
13
|
+
import { Revert } from "./session-revert.js";
|
|
14
|
+
import { Shell as ShellSchema } from "./shell.js";
|
|
15
|
+
import { SessionError } from "./session-error.js";
|
|
16
|
+
import { Instruction } from "./instruction.js";
|
|
17
|
+
import { Agent } from "./agent.js";
|
|
18
|
+
import { Skill as SkillSchema } from "./skill.js";
|
|
19
|
+
import { Money } from "./money.js";
|
|
20
|
+
import { Snapshot } from "./snapshot.js";
|
|
21
|
+
import { TokenUsage } from "./token-usage.js";
|
|
22
|
+
import { SessionInbox } from "./session-inbox.js";
|
|
23
|
+
import { Project } from "./project.js";
|
|
24
|
+
import { SessionFork } from "./session-fork.js";
|
|
25
|
+
export { FileAttachment };
|
|
26
|
+
export const Source = Schema.Struct({
|
|
27
|
+
start: NonNegativeInt,
|
|
28
|
+
end: NonNegativeInt,
|
|
29
|
+
text: Schema.String,
|
|
30
|
+
}).annotate({
|
|
31
|
+
identifier: "Session.Event.Source",
|
|
32
|
+
});
|
|
33
|
+
const Base = {
|
|
34
|
+
sessionID: SessionID,
|
|
35
|
+
};
|
|
36
|
+
const options = {
|
|
37
|
+
durable: {
|
|
38
|
+
aggregate: "sessionID",
|
|
39
|
+
version: 1,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const Created = Event.durable({
|
|
43
|
+
type: "session.created",
|
|
44
|
+
...options,
|
|
45
|
+
schema: {
|
|
46
|
+
...Base,
|
|
47
|
+
projectID: Project.ID,
|
|
48
|
+
location: Location.Ref,
|
|
49
|
+
subpath: RelativePath.pipe(optional),
|
|
50
|
+
parentID: SessionID.pipe(optional),
|
|
51
|
+
slug: Schema.String,
|
|
52
|
+
title: Schema.String.pipe(optional),
|
|
53
|
+
agent: Agent.ID.pipe(optional),
|
|
54
|
+
model: Model.Ref.pipe(optional),
|
|
55
|
+
version: Schema.String,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
export const AgentSelected = Event.durable({
|
|
59
|
+
type: "session.agent.selected",
|
|
60
|
+
...options,
|
|
61
|
+
schema: {
|
|
62
|
+
...Base,
|
|
63
|
+
agent: Agent.ID,
|
|
64
|
+
previous: Agent.ID.pipe(optional),
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
export const ModelSelected = Event.durable({
|
|
68
|
+
type: "session.model.selected",
|
|
69
|
+
...options,
|
|
70
|
+
schema: {
|
|
71
|
+
...Base,
|
|
72
|
+
model: Model.Ref,
|
|
73
|
+
previous: Model.Ref.pipe(optional),
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
export const Moved = Event.durable({
|
|
77
|
+
type: "session.moved",
|
|
78
|
+
...options,
|
|
79
|
+
schema: {
|
|
80
|
+
...Base,
|
|
81
|
+
...SessionInbox.MovePayload.fields,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
export const Renamed = Event.durable({
|
|
85
|
+
type: "session.renamed",
|
|
86
|
+
...options,
|
|
87
|
+
schema: {
|
|
88
|
+
...Base,
|
|
89
|
+
title: Schema.String,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
export const UsageRecorded = Event.durable({
|
|
93
|
+
type: "session.usage.recorded",
|
|
94
|
+
...options,
|
|
95
|
+
schema: {
|
|
96
|
+
...Base,
|
|
97
|
+
source: Schema.Literals(["title", "compaction"]),
|
|
98
|
+
cost: Money.USD,
|
|
99
|
+
tokens: TokenUsage.Info,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
export const UsageUpdated = Event.ephemeral({
|
|
103
|
+
type: "session.usage.updated",
|
|
104
|
+
schema: {
|
|
105
|
+
...Base,
|
|
106
|
+
cost: Money.USD,
|
|
107
|
+
tokens: TokenUsage.Info,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
export const Deleted = Event.durable({
|
|
111
|
+
type: "session.deleted",
|
|
112
|
+
durable: {
|
|
113
|
+
aggregate: "sessionID",
|
|
114
|
+
version: 2,
|
|
115
|
+
},
|
|
116
|
+
schema: Base,
|
|
117
|
+
});
|
|
118
|
+
export const Forked = Event.durable({
|
|
119
|
+
type: "session.forked",
|
|
120
|
+
durable: {
|
|
121
|
+
aggregate: "sessionID",
|
|
122
|
+
version: 2,
|
|
123
|
+
},
|
|
124
|
+
schema: {
|
|
125
|
+
...Base,
|
|
126
|
+
parentID: SessionID,
|
|
127
|
+
boundary: SessionFork.Boundary,
|
|
128
|
+
instructions: Instruction.Values.pipe(optional),
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
const InboxRef = {
|
|
132
|
+
...Base,
|
|
133
|
+
inboxID: SessionMessage.ID,
|
|
134
|
+
};
|
|
135
|
+
export const InboxDelivered = Event.durable({
|
|
136
|
+
type: "session.inbox.delivered",
|
|
137
|
+
...options,
|
|
138
|
+
schema: InboxRef,
|
|
139
|
+
});
|
|
140
|
+
export const InboxEnqueued = Event.durable({
|
|
141
|
+
type: "session.inbox.enqueued",
|
|
142
|
+
...options,
|
|
143
|
+
schema: {
|
|
144
|
+
...InboxRef,
|
|
145
|
+
item: SessionInbox.Item,
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
export const InboxCancelled = Event.durable({
|
|
149
|
+
type: "session.inbox.cancelled",
|
|
150
|
+
...options,
|
|
151
|
+
schema: InboxRef,
|
|
152
|
+
});
|
|
153
|
+
export const InboxDeliveryChanged = Event.durable({
|
|
154
|
+
type: "session.inbox.delivery.changed",
|
|
155
|
+
...options,
|
|
156
|
+
schema: { ...InboxRef, delivery: SessionInbox.Delivery },
|
|
157
|
+
});
|
|
158
|
+
export var Execution;
|
|
159
|
+
(function (Execution) {
|
|
160
|
+
Execution.Started = Event.durable({ type: "session.execution.started", ...options, schema: Base });
|
|
161
|
+
Execution.Succeeded = Event.durable({ type: "session.execution.succeeded", ...options, schema: Base });
|
|
162
|
+
Execution.Failed = Event.durable({
|
|
163
|
+
type: "session.execution.failed",
|
|
164
|
+
...options,
|
|
165
|
+
schema: { ...Base, error: SessionError.Error },
|
|
166
|
+
});
|
|
167
|
+
Execution.Interrupted = Event.durable({
|
|
168
|
+
type: "session.execution.interrupted",
|
|
169
|
+
...options,
|
|
170
|
+
schema: { ...Base, reason: Schema.Literals(["user", "shutdown", "superseded"]) },
|
|
171
|
+
});
|
|
172
|
+
})(Execution || (Execution = {}));
|
|
173
|
+
export const InstructionsUpdated = Event.durable({
|
|
174
|
+
type: "session.instructions.updated",
|
|
175
|
+
durable: {
|
|
176
|
+
aggregate: "sessionID",
|
|
177
|
+
version: 2,
|
|
178
|
+
},
|
|
179
|
+
schema: {
|
|
180
|
+
...Base,
|
|
181
|
+
delta: Instruction.Delta,
|
|
182
|
+
/**
|
|
183
|
+
* The rendered chronological update shown to the model, frozen at emit time.
|
|
184
|
+
* Absent for the initial baseline observation and for deltas that render empty.
|
|
185
|
+
*/
|
|
186
|
+
text: Schema.String.pipe(optional),
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
export const Synthetic = Event.durable({
|
|
190
|
+
type: "session.synthetic",
|
|
191
|
+
...options,
|
|
192
|
+
schema: {
|
|
193
|
+
...Base,
|
|
194
|
+
text: Schema.String,
|
|
195
|
+
description: Schema.String.pipe(optional),
|
|
196
|
+
metadata: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
export var Skill;
|
|
200
|
+
(function (Skill) {
|
|
201
|
+
Skill.Activated = Event.durable({
|
|
202
|
+
type: "session.skill.activated",
|
|
203
|
+
...options,
|
|
204
|
+
schema: {
|
|
205
|
+
...Base,
|
|
206
|
+
id: SkillSchema.ID,
|
|
207
|
+
name: SkillSchema.Name,
|
|
208
|
+
text: Schema.String,
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
})(Skill || (Skill = {}));
|
|
212
|
+
export var Shell;
|
|
213
|
+
(function (Shell) {
|
|
214
|
+
Shell.Started = Event.durable({
|
|
215
|
+
type: "session.shell.started",
|
|
216
|
+
...options,
|
|
217
|
+
schema: {
|
|
218
|
+
...Base,
|
|
219
|
+
shell: ShellSchema.Info,
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
Shell.Ended = Event.durable({
|
|
223
|
+
type: "session.shell.ended",
|
|
224
|
+
...options,
|
|
225
|
+
schema: {
|
|
226
|
+
...Base,
|
|
227
|
+
shell: ShellSchema.Info,
|
|
228
|
+
output: ShellSchema.Output,
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
})(Shell || (Shell = {}));
|
|
232
|
+
export var Step;
|
|
233
|
+
(function (Step) {
|
|
234
|
+
Step.Started = Event.durable({
|
|
235
|
+
type: "session.step.started",
|
|
236
|
+
...options,
|
|
237
|
+
schema: {
|
|
238
|
+
...Base,
|
|
239
|
+
assistantMessageID: SessionMessage.ID,
|
|
240
|
+
agent: Agent.ID,
|
|
241
|
+
model: Model.Ref,
|
|
242
|
+
snapshot: Snapshot.ID.pipe(optional),
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
Step.Ended = Event.durable({
|
|
246
|
+
type: "session.step.ended",
|
|
247
|
+
...options,
|
|
248
|
+
schema: {
|
|
249
|
+
...Base,
|
|
250
|
+
assistantMessageID: SessionMessage.ID,
|
|
251
|
+
finish: FinishReason,
|
|
252
|
+
cost: Money.USD,
|
|
253
|
+
tokens: TokenUsage.Info,
|
|
254
|
+
snapshot: Snapshot.ID.pipe(optional),
|
|
255
|
+
files: Schema.Array(RelativePath).pipe(optional),
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
Step.Failed = Event.durable({
|
|
259
|
+
type: "session.step.failed",
|
|
260
|
+
...options,
|
|
261
|
+
schema: {
|
|
262
|
+
...Base,
|
|
263
|
+
assistantMessageID: SessionMessage.ID,
|
|
264
|
+
error: SessionError.Error,
|
|
265
|
+
cost: Money.USD.pipe(optional),
|
|
266
|
+
tokens: TokenUsage.Info.pipe(optional),
|
|
267
|
+
snapshot: Snapshot.ID.pipe(optional),
|
|
268
|
+
files: Schema.Array(RelativePath).pipe(optional),
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
})(Step || (Step = {}));
|
|
272
|
+
export var Text;
|
|
273
|
+
(function (Text) {
|
|
274
|
+
Text.Started = Event.durable({
|
|
275
|
+
type: "session.text.started",
|
|
276
|
+
...options,
|
|
277
|
+
schema: {
|
|
278
|
+
...Base,
|
|
279
|
+
assistantMessageID: SessionMessage.ID,
|
|
280
|
+
ordinal: NonNegativeInt,
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
// Stream fragments are live-only; Text.Ended is the replayable full-value boundary.
|
|
284
|
+
Text.Delta = Event.ephemeral({
|
|
285
|
+
type: "session.text.delta",
|
|
286
|
+
schema: {
|
|
287
|
+
...Base,
|
|
288
|
+
assistantMessageID: SessionMessage.ID,
|
|
289
|
+
ordinal: NonNegativeInt,
|
|
290
|
+
delta: Schema.String,
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
Text.Ended = Event.durable({
|
|
294
|
+
type: "session.text.ended",
|
|
295
|
+
...options,
|
|
296
|
+
schema: {
|
|
297
|
+
...Base,
|
|
298
|
+
assistantMessageID: SessionMessage.ID,
|
|
299
|
+
ordinal: NonNegativeInt,
|
|
300
|
+
text: Schema.String,
|
|
301
|
+
state: SessionMessage.ProviderState.pipe(optional),
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
})(Text || (Text = {}));
|
|
305
|
+
export var Reasoning;
|
|
306
|
+
(function (Reasoning) {
|
|
307
|
+
Reasoning.Started = Event.durable({
|
|
308
|
+
type: "session.reasoning.started",
|
|
309
|
+
...options,
|
|
310
|
+
schema: {
|
|
311
|
+
...Base,
|
|
312
|
+
assistantMessageID: SessionMessage.ID,
|
|
313
|
+
ordinal: NonNegativeInt,
|
|
314
|
+
state: SessionMessage.ProviderState.pipe(optional),
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
// Stream fragments are live-only; Reasoning.Ended is the replayable full-value boundary.
|
|
318
|
+
Reasoning.Delta = Event.ephemeral({
|
|
319
|
+
type: "session.reasoning.delta",
|
|
320
|
+
schema: {
|
|
321
|
+
...Base,
|
|
322
|
+
assistantMessageID: SessionMessage.ID,
|
|
323
|
+
ordinal: NonNegativeInt,
|
|
324
|
+
delta: Schema.String,
|
|
325
|
+
},
|
|
326
|
+
});
|
|
327
|
+
Reasoning.Ended = Event.durable({
|
|
328
|
+
type: "session.reasoning.ended",
|
|
329
|
+
...options,
|
|
330
|
+
schema: {
|
|
331
|
+
...Base,
|
|
332
|
+
assistantMessageID: SessionMessage.ID,
|
|
333
|
+
ordinal: NonNegativeInt,
|
|
334
|
+
text: Schema.String,
|
|
335
|
+
state: SessionMessage.ProviderState.pipe(optional),
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
})(Reasoning || (Reasoning = {}));
|
|
339
|
+
export var Tool;
|
|
340
|
+
(function (Tool) {
|
|
341
|
+
const ToolBase = {
|
|
342
|
+
...Base,
|
|
343
|
+
assistantMessageID: SessionMessage.ID,
|
|
344
|
+
id: Schema.String,
|
|
345
|
+
};
|
|
346
|
+
let Input;
|
|
347
|
+
(function (Input) {
|
|
348
|
+
Input.Started = Event.durable({
|
|
349
|
+
type: "session.tool.input.started",
|
|
350
|
+
...options,
|
|
351
|
+
schema: {
|
|
352
|
+
...ToolBase,
|
|
353
|
+
name: Schema.String,
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
// Stream fragments are live-only; Input.Ended is the replayable raw-input boundary.
|
|
357
|
+
Input.Delta = Event.ephemeral({
|
|
358
|
+
type: "session.tool.input.delta",
|
|
359
|
+
schema: {
|
|
360
|
+
...ToolBase,
|
|
361
|
+
delta: Schema.String,
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
Input.Ended = Event.durable({
|
|
365
|
+
type: "session.tool.input.ended",
|
|
366
|
+
...options,
|
|
367
|
+
schema: {
|
|
368
|
+
...ToolBase,
|
|
369
|
+
text: Schema.String,
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
})(Input = Tool.Input || (Tool.Input = {}));
|
|
373
|
+
Tool.Called = Event.durable({
|
|
374
|
+
type: "session.tool.called",
|
|
375
|
+
...options,
|
|
376
|
+
schema: {
|
|
377
|
+
...ToolBase,
|
|
378
|
+
input: Schema.Record(Schema.String, Schema.Unknown),
|
|
379
|
+
executed: Schema.Boolean,
|
|
380
|
+
state: SessionMessage.ProviderState.pipe(optional),
|
|
381
|
+
},
|
|
382
|
+
});
|
|
383
|
+
/** Live replacement metadata for a running tool. */
|
|
384
|
+
Tool.Progress = Event.ephemeral({
|
|
385
|
+
type: "session.tool.progress",
|
|
386
|
+
schema: {
|
|
387
|
+
...ToolBase,
|
|
388
|
+
metadata: Schema.Record(Schema.String, Schema.Json),
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
/** Canonical terminal success: one non-empty model representation plus optional UI metadata. */
|
|
392
|
+
Tool.Success = Event.durable({
|
|
393
|
+
type: "session.tool.success",
|
|
394
|
+
durable: {
|
|
395
|
+
aggregate: "sessionID",
|
|
396
|
+
version: 2,
|
|
397
|
+
},
|
|
398
|
+
schema: {
|
|
399
|
+
...ToolBase,
|
|
400
|
+
content: Schema.NonEmptyArray(Content),
|
|
401
|
+
metadata: Schema.Record(Schema.String, Schema.Json).pipe(optional),
|
|
402
|
+
executed: Schema.Boolean,
|
|
403
|
+
resultState: SessionMessage.ProviderState.pipe(optional),
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
/**
|
|
407
|
+
* Canonical terminal failure: one error plus the final bounded snapshot of
|
|
408
|
+
* partial progress. The event is self-contained; projection never reaches
|
|
409
|
+
* into ephemeral progress history.
|
|
410
|
+
*/
|
|
411
|
+
Tool.Failed = Event.durable({
|
|
412
|
+
type: "session.tool.failed",
|
|
413
|
+
durable: {
|
|
414
|
+
aggregate: "sessionID",
|
|
415
|
+
version: 2,
|
|
416
|
+
},
|
|
417
|
+
schema: {
|
|
418
|
+
...ToolBase,
|
|
419
|
+
error: SessionError.Error,
|
|
420
|
+
content: Schema.NonEmptyArray(Content).pipe(optional),
|
|
421
|
+
metadata: Schema.Record(Schema.String, Schema.Json).pipe(optional),
|
|
422
|
+
executed: Schema.Boolean,
|
|
423
|
+
resultState: SessionMessage.ProviderState.pipe(optional),
|
|
424
|
+
},
|
|
425
|
+
});
|
|
426
|
+
})(Tool || (Tool = {}));
|
|
427
|
+
export const RetryScheduled = Event.durable({
|
|
428
|
+
type: "session.retry.scheduled",
|
|
429
|
+
...options,
|
|
430
|
+
schema: {
|
|
431
|
+
...Base,
|
|
432
|
+
assistantMessageID: SessionMessage.ID,
|
|
433
|
+
attempt: PositiveInt,
|
|
434
|
+
at: NonNegativeInt,
|
|
435
|
+
error: SessionError.Error,
|
|
436
|
+
},
|
|
437
|
+
});
|
|
438
|
+
export var Compaction;
|
|
439
|
+
(function (Compaction) {
|
|
440
|
+
Compaction.Started = Event.durable({
|
|
441
|
+
type: "session.compaction.started",
|
|
442
|
+
...options,
|
|
443
|
+
schema: {
|
|
444
|
+
...Base,
|
|
445
|
+
reason: Schema.Literals(["auto", "manual"]),
|
|
446
|
+
recent: Schema.String,
|
|
447
|
+
inputID: SessionMessage.ID.pipe(optional),
|
|
448
|
+
},
|
|
449
|
+
});
|
|
450
|
+
Compaction.Delta = Event.ephemeral({
|
|
451
|
+
type: "session.compaction.delta",
|
|
452
|
+
schema: {
|
|
453
|
+
...Base,
|
|
454
|
+
text: Schema.String,
|
|
455
|
+
},
|
|
456
|
+
});
|
|
457
|
+
Compaction.Ended = Event.durable({
|
|
458
|
+
type: "session.compaction.ended",
|
|
459
|
+
...options,
|
|
460
|
+
schema: {
|
|
461
|
+
...Base,
|
|
462
|
+
reason: Compaction.Started.data.fields.reason,
|
|
463
|
+
text: Schema.String,
|
|
464
|
+
recent: Schema.String,
|
|
465
|
+
},
|
|
466
|
+
});
|
|
467
|
+
Compaction.Failed = Event.durable({
|
|
468
|
+
type: "session.compaction.failed",
|
|
469
|
+
...options,
|
|
470
|
+
schema: {
|
|
471
|
+
...Base,
|
|
472
|
+
reason: Compaction.Started.data.fields.reason,
|
|
473
|
+
error: SessionError.Error,
|
|
474
|
+
inputID: SessionMessage.ID.pipe(optional),
|
|
475
|
+
},
|
|
476
|
+
});
|
|
477
|
+
})(Compaction || (Compaction = {}));
|
|
478
|
+
export var RevertEvent;
|
|
479
|
+
(function (RevertEvent) {
|
|
480
|
+
RevertEvent.Staged = Event.durable({
|
|
481
|
+
type: "session.revert.staged",
|
|
482
|
+
...options,
|
|
483
|
+
schema: { ...Base, revert: Revert },
|
|
484
|
+
});
|
|
485
|
+
RevertEvent.Cleared = Event.durable({ type: "session.revert.cleared", ...options, schema: Base });
|
|
486
|
+
RevertEvent.Committed = Event.durable({
|
|
487
|
+
type: "session.revert.committed",
|
|
488
|
+
...options,
|
|
489
|
+
schema: { ...Base, to: SessionMessage.ID },
|
|
490
|
+
});
|
|
491
|
+
})(RevertEvent || (RevertEvent = {}));
|
|
492
|
+
export const Definitions = Event.inventory(Created, AgentSelected, ModelSelected, Moved, Renamed, UsageUpdated, Deleted, Forked, InboxDelivered, InboxEnqueued, InboxCancelled, InboxDeliveryChanged, Execution.Started, Execution.Succeeded, Execution.Failed, Execution.Interrupted, InstructionsUpdated, Synthetic, Skill.Activated, Shell.Started, Shell.Ended, Step.Started, Step.Ended, Step.Failed, Text.Started, Text.Delta, Text.Ended, Reasoning.Started, Reasoning.Delta, Reasoning.Ended, Tool.Input.Started, Tool.Input.Delta, Tool.Input.Ended, Tool.Called, Tool.Progress, Tool.Success, Tool.Failed, RetryScheduled, Compaction.Started, Compaction.Delta, Compaction.Ended, Compaction.Failed, RevertEvent.Staged, RevertEvent.Cleared, RevertEvent.Committed);
|
|
493
|
+
// UsageRecorded is durable but internal: excluded from Definitions so it never reaches the public manifest.
|
|
494
|
+
export const DurableDefinitions = Event.inventory(...Definitions.filter((definition) => definition.durability === "durable"), UsageRecorded);
|
|
495
|
+
export const EphemeralDefinitions = Event.inventory(...Definitions.filter((definition) => definition.durability === "ephemeral"));
|
|
496
|
+
export const Durable = Schema.Union(DurableDefinitions, { mode: "oneOf" })
|
|
497
|
+
.pipe(Schema.toTaggedUnion("type"))
|
|
498
|
+
.annotate({ identifier: "Session.Event.Durable" });
|
|
499
|
+
export const All = Schema.Union([Durable, ...EphemeralDefinitions], { mode: "oneOf" }).pipe(Schema.toTaggedUnion("type"));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * as SessionFork from "./session-fork.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
export declare const Boundary: Schema.Union<readonly [Schema.Struct<{
|
|
4
|
+
readonly type: Schema.Literal<"before">;
|
|
5
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
6
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
7
|
+
fromEvent: (eventID: import("./event.js").ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
8
|
+
};
|
|
9
|
+
}>, Schema.Struct<{
|
|
10
|
+
readonly type: Schema.Literal<"through">;
|
|
11
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
12
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
13
|
+
fromEvent: (eventID: import("./event.js").ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
14
|
+
};
|
|
15
|
+
}>]>;
|
|
16
|
+
export type Boundary = typeof Boundary.Type;
|
|
17
|
+
export declare const RequestBoundary: Schema.Union<readonly [Schema.Struct<{
|
|
18
|
+
readonly type: Schema.Literal<"before">;
|
|
19
|
+
readonly messageID: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
20
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
21
|
+
fromEvent: (eventID: import("./event.js").ID) => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
22
|
+
};
|
|
23
|
+
}>, Schema.Struct<{
|
|
24
|
+
readonly type: Schema.Literal<"through">;
|
|
25
|
+
}>]>;
|
|
26
|
+
export type RequestBoundary = typeof RequestBoundary.Type;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * as SessionFork from "./session-fork.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { SessionMessage } from "./session-message.js";
|
|
4
|
+
export const Boundary = Schema.Union([
|
|
5
|
+
Schema.Struct({ type: Schema.Literal("before"), messageID: SessionMessage.ID }),
|
|
6
|
+
Schema.Struct({ type: Schema.Literal("through"), messageID: SessionMessage.ID }),
|
|
7
|
+
]).annotate({ identifier: "Session.ForkBoundary" });
|
|
8
|
+
export const RequestBoundary = Schema.Union([
|
|
9
|
+
Schema.Struct({ type: Schema.Literal("before"), messageID: SessionMessage.ID }),
|
|
10
|
+
Schema.Struct({ type: Schema.Literal("through") }),
|
|
11
|
+
]).annotate({ identifier: "Session.ForkRequestBoundary" });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const SessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
3
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
5
|
+
};
|
|
6
|
+
export type SessionID = typeof SessionID.Type;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { descending } from "./identifier.js";
|
|
3
|
+
import { statics } from "./schema.js";
|
|
4
|
+
export const SessionID = Schema.String.check(Schema.isStartsWith("ses")).pipe(Schema.brand("SessionID"), statics((schema) => {
|
|
5
|
+
const create = () => schema.make("ses_" + descending());
|
|
6
|
+
return {
|
|
7
|
+
create,
|
|
8
|
+
descending: (id) => (id === undefined ? create() : schema.make(id)),
|
|
9
|
+
};
|
|
10
|
+
}));
|