@opencode-ai/schema 0.0.0-next-14659
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 +175 -0
- package/dist/agent.js +43 -0
- package/dist/catalog.d.ts +89 -0
- package/dist/catalog.js +4 -0
- package/dist/command.d.ts +44 -0
- package/dist/command.js +12 -0
- package/dist/connection.d.ts +28 -0
- package/dist/connection.js +15 -0
- package/dist/credential.d.ts +36 -0
- package/dist/credential.js +23 -0
- package/dist/durable-event-manifest.d.ts +10626 -0
- package/dist/durable-event-manifest.js +12 -0
- package/dist/event-manifest.d.ts +15309 -0
- package/dist/event-manifest.js +43 -0
- package/dist/event.d.ts +82 -0
- package/dist/event.js +73 -0
- package/dist/file-diff.d.ts +11 -0
- package/dist/file-diff.js +10 -0
- package/dist/filesystem-watcher.d.ts +102 -0
- package/dist/filesystem-watcher.js +11 -0
- package/dist/filesystem.d.ts +134 -0
- package/dist/filesystem.js +32 -0
- package/dist/ide-event.d.ts +96 -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 +29 -0
- package/dist/index.js +29 -0
- package/dist/installation-event.d.ts +189 -0
- package/dist/installation-event.js +16 -0
- package/dist/integration-id.d.ts +5 -0
- package/dist/integration-id.js +3 -0
- package/dist/integration.d.ts +572 -0
- package/dist/integration.js +93 -0
- package/dist/legacy-event.d.ts +1 -0
- package/dist/legacy-event.js +1 -0
- package/dist/llm.d.ts +28 -0
- package/dist/llm.js +19 -0
- package/dist/location.d.ts +36 -0
- package/dist/location.js +21 -0
- package/dist/lsp-event.d.ts +87 -0
- package/dist/lsp-event.js +4 -0
- package/dist/mcp-event.d.ts +286 -0
- package/dist/mcp-event.js +25 -0
- package/dist/mcp.d.ts +39 -0
- package/dist/mcp.js +38 -0
- package/dist/model.d.ts +205 -0
- package/dist/model.js +86 -0
- package/dist/models-dev.d.ts +89 -0
- package/dist/models-dev.js +7 -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 +346 -0
- package/dist/permission.js +45 -0
- package/dist/plugin.d.ts +105 -0
- package/dist/plugin.js +12 -0
- package/dist/project-copy.d.ts +29 -0
- package/dist/project-copy.js +21 -0
- package/dist/project-directories.d.ts +105 -0
- package/dist/project-directories.js +8 -0
- package/dist/project-id.d.ts +5 -0
- package/dist/project-id.js +3 -0
- package/dist/project.d.ts +278 -0
- package/dist/project.js +44 -0
- package/dist/prompt-input.d.ts +106 -0
- package/dist/prompt-input.js +19 -0
- package/dist/prompt.d.ts +177 -0
- package/dist/prompt.js +43 -0
- package/dist/provider.d.ts +111 -0
- package/dist/provider.js +53 -0
- package/dist/pty-ticket.d.ts +8 -0
- package/dist/pty-ticket.js +7 -0
- package/dist/pty.d.ts +542 -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 +516 -0
- package/dist/question.js +64 -0
- package/dist/reference.d.ts +140 -0
- package/dist/reference.js +31 -0
- package/dist/revert.d.ts +34 -0
- package/dist/revert.js +19 -0
- package/dist/schema.d.ts +10 -0
- package/dist/schema.js +14 -0
- package/dist/server-event.d.ts +172 -0
- package/dist/server-event.js +5 -0
- package/dist/session-compaction-event.d.ts +107 -0
- package/dist/session-compaction-event.js +10 -0
- package/dist/session-delivery.d.ts +4 -0
- package/dist/session-delivery.js +3 -0
- package/dist/session-event.d.ts +14225 -0
- package/dist/session-event.js +421 -0
- package/dist/session-id.d.ts +6 -0
- package/dist/session-id.js +10 -0
- package/dist/session-input.d.ts +145 -0
- package/dist/session-input.js +18 -0
- package/dist/session-message.d.ts +1318 -0
- package/dist/session-message.js +171 -0
- package/dist/session-status-event.d.ts +339 -0
- package/dist/session-status-event.js +43 -0
- package/dist/session-todo.d.ts +137 -0
- package/dist/session-todo.js +21 -0
- package/dist/session-v1.d.ts +1 -0
- package/dist/session-v1.js +1 -0
- package/dist/session.d.ts +140 -0
- package/dist/session.js +43 -0
- package/dist/shell.d.ts +441 -0
- package/dist/shell.js +58 -0
- package/dist/skill.d.ts +146 -0
- package/dist/skill.js +45 -0
- package/dist/tui-event.d.ts +387 -0
- package/dist/tui-event.js +53 -0
- package/dist/v1/legacy-event.d.ts +128 -0
- package/dist/v1/legacy-event.js +15 -0
- package/dist/v1/permission.d.ts +356 -0
- package/dist/v1/permission.js +41 -0
- package/dist/v1/question.d.ts +504 -0
- package/dist/v1/question.js +57 -0
- package/dist/v1/session.d.ts +7775 -0
- package/dist/v1/session.js +535 -0
- package/dist/vcs-event.d.ts +96 -0
- package/dist/vcs-event.js +11 -0
- package/dist/workspace-event.d.ts +307 -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 +193 -0
- package/dist/worktree-event.js +18 -0
- package/package.json +41 -0
|
@@ -0,0 +1,421 @@
|
|
|
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 { ProviderMetadata, ToolContent } from "./llm.js";
|
|
6
|
+
import { Delivery } from "./session-delivery.js";
|
|
7
|
+
import { Model } from "./model.js";
|
|
8
|
+
import { DateTimeUtcFromMillis, NonNegativeInt, RelativePath } from "./schema.js";
|
|
9
|
+
import { FileAttachment, Prompt } 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 "./revert.js";
|
|
14
|
+
export { FileAttachment };
|
|
15
|
+
export const Source = Schema.Struct({
|
|
16
|
+
start: NonNegativeInt,
|
|
17
|
+
end: NonNegativeInt,
|
|
18
|
+
text: Schema.String,
|
|
19
|
+
}).annotate({
|
|
20
|
+
identifier: "session.next.event.source",
|
|
21
|
+
});
|
|
22
|
+
const Base = {
|
|
23
|
+
timestamp: DateTimeUtcFromMillis,
|
|
24
|
+
sessionID: SessionID,
|
|
25
|
+
};
|
|
26
|
+
const PromptFields = {
|
|
27
|
+
...Base,
|
|
28
|
+
messageID: SessionMessage.ID,
|
|
29
|
+
prompt: Prompt,
|
|
30
|
+
delivery: Delivery,
|
|
31
|
+
};
|
|
32
|
+
const options = {
|
|
33
|
+
durable: {
|
|
34
|
+
aggregate: "sessionID",
|
|
35
|
+
version: 1,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
const stepSettlementOptions = {
|
|
39
|
+
durable: {
|
|
40
|
+
aggregate: "sessionID",
|
|
41
|
+
version: 2,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export const UnknownError = SessionMessage.UnknownError;
|
|
45
|
+
export const AgentSwitched = Event.define({
|
|
46
|
+
type: "session.next.agent.switched",
|
|
47
|
+
...options,
|
|
48
|
+
schema: {
|
|
49
|
+
...Base,
|
|
50
|
+
messageID: SessionMessage.ID,
|
|
51
|
+
agent: Schema.String,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
export const ModelSwitched = Event.define({
|
|
55
|
+
type: "session.next.model.switched",
|
|
56
|
+
...options,
|
|
57
|
+
schema: {
|
|
58
|
+
...Base,
|
|
59
|
+
messageID: SessionMessage.ID,
|
|
60
|
+
model: Model.Ref,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
export const Moved = Event.define({
|
|
64
|
+
type: "session.next.moved",
|
|
65
|
+
...options,
|
|
66
|
+
schema: {
|
|
67
|
+
...Base,
|
|
68
|
+
location: Location.Ref,
|
|
69
|
+
subdirectory: RelativePath.pipe(optional),
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
export const Renamed = Event.define({
|
|
73
|
+
type: "session.next.renamed",
|
|
74
|
+
...options,
|
|
75
|
+
schema: {
|
|
76
|
+
...Base,
|
|
77
|
+
title: Schema.String,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
export const Forked = Event.define({
|
|
81
|
+
type: "session.next.forked",
|
|
82
|
+
...options,
|
|
83
|
+
schema: {
|
|
84
|
+
...Base,
|
|
85
|
+
parentID: SessionID,
|
|
86
|
+
messageID: SessionMessage.ID.pipe(optional),
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
export const Prompted = Event.define({
|
|
90
|
+
type: "session.next.prompted",
|
|
91
|
+
...options,
|
|
92
|
+
schema: PromptFields,
|
|
93
|
+
});
|
|
94
|
+
export const PromptAdmitted = Event.define({
|
|
95
|
+
type: "session.next.prompt.admitted",
|
|
96
|
+
...options,
|
|
97
|
+
schema: PromptFields,
|
|
98
|
+
});
|
|
99
|
+
export const ContextUpdated = Event.define({
|
|
100
|
+
type: "session.next.context.updated",
|
|
101
|
+
...options,
|
|
102
|
+
schema: {
|
|
103
|
+
...Base,
|
|
104
|
+
messageID: SessionMessage.ID,
|
|
105
|
+
text: Schema.String,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
export const Synthetic = Event.define({
|
|
109
|
+
type: "session.next.synthetic",
|
|
110
|
+
...options,
|
|
111
|
+
schema: {
|
|
112
|
+
...Base,
|
|
113
|
+
messageID: SessionMessage.ID,
|
|
114
|
+
text: Schema.String,
|
|
115
|
+
description: Schema.String.pipe(optional),
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
export var Skill;
|
|
119
|
+
(function (Skill) {
|
|
120
|
+
Skill.Activated = Event.define({
|
|
121
|
+
type: "session.next.skill.activated",
|
|
122
|
+
...options,
|
|
123
|
+
schema: {
|
|
124
|
+
...Base,
|
|
125
|
+
messageID: SessionMessage.ID,
|
|
126
|
+
name: Schema.String,
|
|
127
|
+
text: Schema.String,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
})(Skill || (Skill = {}));
|
|
131
|
+
export var Shell;
|
|
132
|
+
(function (Shell) {
|
|
133
|
+
Shell.Started = Event.define({
|
|
134
|
+
type: "session.next.shell.started",
|
|
135
|
+
...options,
|
|
136
|
+
schema: {
|
|
137
|
+
...Base,
|
|
138
|
+
messageID: SessionMessage.ID,
|
|
139
|
+
callID: Schema.String,
|
|
140
|
+
command: Schema.String,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
Shell.Ended = Event.define({
|
|
144
|
+
type: "session.next.shell.ended",
|
|
145
|
+
...options,
|
|
146
|
+
schema: {
|
|
147
|
+
...Base,
|
|
148
|
+
callID: Schema.String,
|
|
149
|
+
output: Schema.String,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
})(Shell || (Shell = {}));
|
|
153
|
+
export var Step;
|
|
154
|
+
(function (Step) {
|
|
155
|
+
Step.Started = Event.define({
|
|
156
|
+
type: "session.next.step.started",
|
|
157
|
+
...options,
|
|
158
|
+
schema: {
|
|
159
|
+
...Base,
|
|
160
|
+
assistantMessageID: SessionMessage.ID,
|
|
161
|
+
agent: Schema.String,
|
|
162
|
+
model: Model.Ref,
|
|
163
|
+
snapshot: Schema.String.pipe(optional),
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
Step.Ended = Event.define({
|
|
167
|
+
type: "session.next.step.ended",
|
|
168
|
+
...stepSettlementOptions,
|
|
169
|
+
schema: {
|
|
170
|
+
...Base,
|
|
171
|
+
assistantMessageID: SessionMessage.ID,
|
|
172
|
+
finish: Schema.String,
|
|
173
|
+
cost: Schema.Finite,
|
|
174
|
+
tokens: Schema.Struct({
|
|
175
|
+
input: Schema.Finite,
|
|
176
|
+
output: Schema.Finite,
|
|
177
|
+
reasoning: Schema.Finite,
|
|
178
|
+
cache: Schema.Struct({
|
|
179
|
+
read: Schema.Finite,
|
|
180
|
+
write: Schema.Finite,
|
|
181
|
+
}),
|
|
182
|
+
}),
|
|
183
|
+
snapshot: Schema.String.pipe(optional),
|
|
184
|
+
files: Schema.Array(RelativePath).pipe(optional),
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
Step.Failed = Event.define({
|
|
188
|
+
type: "session.next.step.failed",
|
|
189
|
+
...stepSettlementOptions,
|
|
190
|
+
schema: {
|
|
191
|
+
...Base,
|
|
192
|
+
assistantMessageID: SessionMessage.ID,
|
|
193
|
+
error: UnknownError,
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
})(Step || (Step = {}));
|
|
197
|
+
export var Text;
|
|
198
|
+
(function (Text) {
|
|
199
|
+
Text.Started = Event.define({
|
|
200
|
+
type: "session.next.text.started",
|
|
201
|
+
...options,
|
|
202
|
+
schema: {
|
|
203
|
+
...Base,
|
|
204
|
+
assistantMessageID: SessionMessage.ID,
|
|
205
|
+
textID: Schema.String,
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
// Stream fragments are live-only; Text.Ended is the replayable full-value boundary.
|
|
209
|
+
Text.Delta = Event.define({
|
|
210
|
+
type: "session.next.text.delta",
|
|
211
|
+
schema: {
|
|
212
|
+
...Base,
|
|
213
|
+
assistantMessageID: SessionMessage.ID,
|
|
214
|
+
textID: Schema.String,
|
|
215
|
+
delta: Schema.String,
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
Text.Ended = Event.define({
|
|
219
|
+
type: "session.next.text.ended",
|
|
220
|
+
...options,
|
|
221
|
+
schema: {
|
|
222
|
+
...Base,
|
|
223
|
+
assistantMessageID: SessionMessage.ID,
|
|
224
|
+
textID: Schema.String,
|
|
225
|
+
text: Schema.String,
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
})(Text || (Text = {}));
|
|
229
|
+
export var Reasoning;
|
|
230
|
+
(function (Reasoning) {
|
|
231
|
+
Reasoning.Started = Event.define({
|
|
232
|
+
type: "session.next.reasoning.started",
|
|
233
|
+
...options,
|
|
234
|
+
schema: {
|
|
235
|
+
...Base,
|
|
236
|
+
assistantMessageID: SessionMessage.ID,
|
|
237
|
+
reasoningID: Schema.String,
|
|
238
|
+
providerMetadata: ProviderMetadata.pipe(optional),
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
// Stream fragments are live-only; Reasoning.Ended is the replayable full-value boundary.
|
|
242
|
+
Reasoning.Delta = Event.define({
|
|
243
|
+
type: "session.next.reasoning.delta",
|
|
244
|
+
schema: {
|
|
245
|
+
...Base,
|
|
246
|
+
assistantMessageID: SessionMessage.ID,
|
|
247
|
+
reasoningID: Schema.String,
|
|
248
|
+
delta: Schema.String,
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
Reasoning.Ended = Event.define({
|
|
252
|
+
type: "session.next.reasoning.ended",
|
|
253
|
+
...options,
|
|
254
|
+
schema: {
|
|
255
|
+
...Base,
|
|
256
|
+
assistantMessageID: SessionMessage.ID,
|
|
257
|
+
reasoningID: Schema.String,
|
|
258
|
+
text: Schema.String,
|
|
259
|
+
providerMetadata: ProviderMetadata.pipe(optional),
|
|
260
|
+
},
|
|
261
|
+
});
|
|
262
|
+
})(Reasoning || (Reasoning = {}));
|
|
263
|
+
export var Tool;
|
|
264
|
+
(function (Tool) {
|
|
265
|
+
const ToolBase = {
|
|
266
|
+
...Base,
|
|
267
|
+
assistantMessageID: SessionMessage.ID,
|
|
268
|
+
callID: Schema.String,
|
|
269
|
+
};
|
|
270
|
+
let Input;
|
|
271
|
+
(function (Input) {
|
|
272
|
+
Input.Started = Event.define({
|
|
273
|
+
type: "session.next.tool.input.started",
|
|
274
|
+
...options,
|
|
275
|
+
schema: {
|
|
276
|
+
...ToolBase,
|
|
277
|
+
name: Schema.String,
|
|
278
|
+
},
|
|
279
|
+
});
|
|
280
|
+
// Stream fragments are live-only; Input.Ended is the replayable raw-input boundary.
|
|
281
|
+
Input.Delta = Event.define({
|
|
282
|
+
type: "session.next.tool.input.delta",
|
|
283
|
+
schema: {
|
|
284
|
+
...ToolBase,
|
|
285
|
+
delta: Schema.String,
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
Input.Ended = Event.define({
|
|
289
|
+
type: "session.next.tool.input.ended",
|
|
290
|
+
...options,
|
|
291
|
+
schema: {
|
|
292
|
+
...ToolBase,
|
|
293
|
+
text: Schema.String,
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
})(Input = Tool.Input || (Tool.Input = {}));
|
|
297
|
+
Tool.Called = Event.define({
|
|
298
|
+
type: "session.next.tool.called",
|
|
299
|
+
...options,
|
|
300
|
+
schema: {
|
|
301
|
+
...ToolBase,
|
|
302
|
+
tool: Schema.String,
|
|
303
|
+
input: Schema.Record(Schema.String, Schema.Unknown),
|
|
304
|
+
provider: Schema.Struct({
|
|
305
|
+
executed: Schema.Boolean,
|
|
306
|
+
metadata: ProviderMetadata.pipe(optional),
|
|
307
|
+
}),
|
|
308
|
+
},
|
|
309
|
+
});
|
|
310
|
+
/**
|
|
311
|
+
* Replayable bounded running-tool state. Tools should checkpoint semantic
|
|
312
|
+
* transitions or at a bounded cadence, not persist every stdout/stderr chunk.
|
|
313
|
+
*/
|
|
314
|
+
Tool.Progress = Event.define({
|
|
315
|
+
type: "session.next.tool.progress",
|
|
316
|
+
...options,
|
|
317
|
+
schema: {
|
|
318
|
+
...ToolBase,
|
|
319
|
+
structured: Schema.Record(Schema.String, Schema.Unknown),
|
|
320
|
+
content: Schema.Array(ToolContent),
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
Tool.Success = Event.define({
|
|
324
|
+
type: "session.next.tool.success",
|
|
325
|
+
...options,
|
|
326
|
+
schema: {
|
|
327
|
+
...ToolBase,
|
|
328
|
+
structured: Schema.Record(Schema.String, Schema.Unknown),
|
|
329
|
+
content: Schema.Array(ToolContent),
|
|
330
|
+
outputPaths: Schema.Array(Schema.String).pipe(optional),
|
|
331
|
+
result: Schema.Unknown.pipe(optional),
|
|
332
|
+
provider: Schema.Struct({
|
|
333
|
+
executed: Schema.Boolean,
|
|
334
|
+
metadata: ProviderMetadata.pipe(optional),
|
|
335
|
+
}),
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
Tool.Failed = Event.define({
|
|
339
|
+
type: "session.next.tool.failed",
|
|
340
|
+
...options,
|
|
341
|
+
schema: {
|
|
342
|
+
...ToolBase,
|
|
343
|
+
error: UnknownError,
|
|
344
|
+
result: Schema.Unknown.pipe(optional),
|
|
345
|
+
provider: Schema.Struct({
|
|
346
|
+
executed: Schema.Boolean,
|
|
347
|
+
metadata: ProviderMetadata.pipe(optional),
|
|
348
|
+
}),
|
|
349
|
+
},
|
|
350
|
+
});
|
|
351
|
+
})(Tool || (Tool = {}));
|
|
352
|
+
export const RetryError = Schema.Struct({
|
|
353
|
+
message: Schema.String,
|
|
354
|
+
statusCode: Schema.Finite.pipe(optional),
|
|
355
|
+
isRetryable: Schema.Boolean,
|
|
356
|
+
responseHeaders: Schema.Record(Schema.String, Schema.String).pipe(optional),
|
|
357
|
+
responseBody: Schema.String.pipe(optional),
|
|
358
|
+
metadata: Schema.Record(Schema.String, Schema.String).pipe(optional),
|
|
359
|
+
}).annotate({
|
|
360
|
+
identifier: "session.next.retry_error",
|
|
361
|
+
});
|
|
362
|
+
export const Retried = Event.define({
|
|
363
|
+
type: "session.next.retried",
|
|
364
|
+
...options,
|
|
365
|
+
schema: {
|
|
366
|
+
...Base,
|
|
367
|
+
attempt: Schema.Finite,
|
|
368
|
+
error: RetryError,
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
export var Compaction;
|
|
372
|
+
(function (Compaction) {
|
|
373
|
+
Compaction.Started = Event.define({
|
|
374
|
+
type: "session.next.compaction.started",
|
|
375
|
+
...options,
|
|
376
|
+
schema: {
|
|
377
|
+
...Base,
|
|
378
|
+
messageID: SessionMessage.ID,
|
|
379
|
+
reason: Schema.Union([Schema.Literal("auto"), Schema.Literal("manual")]),
|
|
380
|
+
},
|
|
381
|
+
});
|
|
382
|
+
Compaction.Delta = Event.define({
|
|
383
|
+
type: "session.next.compaction.delta",
|
|
384
|
+
schema: {
|
|
385
|
+
...Base,
|
|
386
|
+
messageID: SessionMessage.ID,
|
|
387
|
+
text: Schema.String,
|
|
388
|
+
},
|
|
389
|
+
});
|
|
390
|
+
Compaction.Ended = Event.define({
|
|
391
|
+
type: "session.next.compaction.ended",
|
|
392
|
+
...options,
|
|
393
|
+
schema: {
|
|
394
|
+
...Base,
|
|
395
|
+
messageID: SessionMessage.ID,
|
|
396
|
+
reason: Compaction.Started.data.fields.reason,
|
|
397
|
+
text: Schema.String,
|
|
398
|
+
recent: Schema.String,
|
|
399
|
+
},
|
|
400
|
+
});
|
|
401
|
+
})(Compaction || (Compaction = {}));
|
|
402
|
+
export var RevertEvent;
|
|
403
|
+
(function (RevertEvent) {
|
|
404
|
+
RevertEvent.Staged = Event.define({
|
|
405
|
+
type: "session.next.revert.staged",
|
|
406
|
+
...options,
|
|
407
|
+
schema: { ...Base, revert: Revert.State },
|
|
408
|
+
});
|
|
409
|
+
RevertEvent.Cleared = Event.define({ type: "session.next.revert.cleared", ...options, schema: Base });
|
|
410
|
+
RevertEvent.Committed = Event.define({
|
|
411
|
+
type: "session.next.revert.committed",
|
|
412
|
+
...options,
|
|
413
|
+
schema: { ...Base, messageID: SessionMessage.ID },
|
|
414
|
+
});
|
|
415
|
+
})(RevertEvent || (RevertEvent = {}));
|
|
416
|
+
export const DurableDefinitions = Event.inventory(AgentSwitched, ModelSwitched, Moved, Renamed, Forked, Prompted, PromptAdmitted, ContextUpdated, Synthetic, Skill.Activated, Shell.Started, Shell.Ended, Step.Started, Step.Ended, Step.Failed, Text.Started, Text.Ended, Tool.Input.Started, Tool.Input.Ended, Tool.Called, Tool.Progress, Tool.Success, Tool.Failed, Reasoning.Started, Reasoning.Ended, Retried, Compaction.Started, Compaction.Ended, RevertEvent.Staged, RevertEvent.Cleared, RevertEvent.Committed);
|
|
417
|
+
export const Definitions = Event.inventory(AgentSwitched, ModelSwitched, Moved, Renamed, Forked, Prompted, PromptAdmitted, ContextUpdated, 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, Retried, Compaction.Started, Compaction.Delta, Compaction.Ended, RevertEvent.Staged, RevertEvent.Cleared, RevertEvent.Committed);
|
|
418
|
+
export const Durable = Schema.Union(DurableDefinitions, { mode: "oneOf" })
|
|
419
|
+
.pipe(Schema.toTaggedUnion("type"))
|
|
420
|
+
.annotate({ identifier: "SessionDurableEvent" });
|
|
421
|
+
export const All = Schema.Union(Definitions, { mode: "oneOf" }).pipe(Schema.toTaggedUnion("type"));
|
|
@@ -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
|
+
}));
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export * as SessionInput from "./session-input.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { Prompt } from "./prompt.js";
|
|
4
|
+
import { SessionDelivery } from "./session-delivery.js";
|
|
5
|
+
export declare const Delivery: Schema.Literals<readonly ["steer", "queue"]>;
|
|
6
|
+
export type Delivery = SessionDelivery.Delivery;
|
|
7
|
+
export interface Admitted extends Schema.Schema.Type<typeof Admitted> {
|
|
8
|
+
}
|
|
9
|
+
export declare const Admitted: Schema.Struct<{
|
|
10
|
+
readonly admittedSeq: Schema.Int;
|
|
11
|
+
readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
|
|
12
|
+
create: () => string & import("effect/Brand").Brand<"Session.Message.ID">;
|
|
13
|
+
};
|
|
14
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
15
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
16
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
17
|
+
};
|
|
18
|
+
readonly prompt: Schema.Struct<{
|
|
19
|
+
readonly text: Schema.String;
|
|
20
|
+
readonly files: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
21
|
+
readonly uri: Schema.String;
|
|
22
|
+
readonly mime: Schema.String;
|
|
23
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
24
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
25
|
+
readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
26
|
+
readonly start: Schema.Finite;
|
|
27
|
+
readonly end: Schema.Finite;
|
|
28
|
+
readonly text: Schema.String;
|
|
29
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
30
|
+
readonly start: Schema.Finite;
|
|
31
|
+
readonly end: Schema.Finite;
|
|
32
|
+
readonly text: Schema.String;
|
|
33
|
+
}>>, never, never>;
|
|
34
|
+
}> & {
|
|
35
|
+
create: (input: import("./prompt.js").FileAttachment) => {
|
|
36
|
+
readonly uri: string;
|
|
37
|
+
readonly mime: string;
|
|
38
|
+
readonly name?: string | undefined;
|
|
39
|
+
readonly description?: string | undefined;
|
|
40
|
+
readonly source?: {
|
|
41
|
+
readonly start: number;
|
|
42
|
+
readonly end: number;
|
|
43
|
+
readonly text: string;
|
|
44
|
+
} | undefined;
|
|
45
|
+
};
|
|
46
|
+
}>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
47
|
+
readonly uri: Schema.String;
|
|
48
|
+
readonly mime: Schema.String;
|
|
49
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
50
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
51
|
+
readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
52
|
+
readonly start: Schema.Finite;
|
|
53
|
+
readonly end: Schema.Finite;
|
|
54
|
+
readonly text: Schema.String;
|
|
55
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
56
|
+
readonly start: Schema.Finite;
|
|
57
|
+
readonly end: Schema.Finite;
|
|
58
|
+
readonly text: Schema.String;
|
|
59
|
+
}>>, never, never>;
|
|
60
|
+
}> & {
|
|
61
|
+
create: (input: import("./prompt.js").FileAttachment) => {
|
|
62
|
+
readonly uri: string;
|
|
63
|
+
readonly mime: string;
|
|
64
|
+
readonly name?: string | undefined;
|
|
65
|
+
readonly description?: string | undefined;
|
|
66
|
+
readonly source?: {
|
|
67
|
+
readonly start: number;
|
|
68
|
+
readonly end: number;
|
|
69
|
+
readonly text: string;
|
|
70
|
+
} | undefined;
|
|
71
|
+
};
|
|
72
|
+
}>>, never, never>;
|
|
73
|
+
readonly agents: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
74
|
+
readonly name: Schema.String;
|
|
75
|
+
readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
76
|
+
readonly start: Schema.Finite;
|
|
77
|
+
readonly end: Schema.Finite;
|
|
78
|
+
readonly text: Schema.String;
|
|
79
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
80
|
+
readonly start: Schema.Finite;
|
|
81
|
+
readonly end: Schema.Finite;
|
|
82
|
+
readonly text: Schema.String;
|
|
83
|
+
}>>, never, never>;
|
|
84
|
+
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
85
|
+
readonly name: Schema.String;
|
|
86
|
+
readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
87
|
+
readonly start: Schema.Finite;
|
|
88
|
+
readonly end: Schema.Finite;
|
|
89
|
+
readonly text: Schema.String;
|
|
90
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
91
|
+
readonly start: Schema.Finite;
|
|
92
|
+
readonly end: Schema.Finite;
|
|
93
|
+
readonly text: Schema.String;
|
|
94
|
+
}>>, never, never>;
|
|
95
|
+
}>>>, never, never>;
|
|
96
|
+
}> & {
|
|
97
|
+
equivalence: import("effect/Equivalence").Equivalence<{
|
|
98
|
+
readonly text: string;
|
|
99
|
+
readonly files?: readonly {
|
|
100
|
+
readonly uri: string;
|
|
101
|
+
readonly mime: string;
|
|
102
|
+
readonly name?: string | undefined;
|
|
103
|
+
readonly description?: string | undefined;
|
|
104
|
+
readonly source?: {
|
|
105
|
+
readonly start: number;
|
|
106
|
+
readonly end: number;
|
|
107
|
+
readonly text: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
}[] | undefined;
|
|
110
|
+
readonly agents?: readonly {
|
|
111
|
+
readonly name: string;
|
|
112
|
+
readonly source?: {
|
|
113
|
+
readonly start: number;
|
|
114
|
+
readonly end: number;
|
|
115
|
+
readonly text: string;
|
|
116
|
+
} | undefined;
|
|
117
|
+
}[] | undefined;
|
|
118
|
+
}>;
|
|
119
|
+
fromUserMessage: (input: Pick<Prompt, "text" | "files" | "agents">) => {
|
|
120
|
+
readonly text: string;
|
|
121
|
+
readonly files?: readonly {
|
|
122
|
+
readonly uri: string;
|
|
123
|
+
readonly mime: string;
|
|
124
|
+
readonly name?: string | undefined;
|
|
125
|
+
readonly description?: string | undefined;
|
|
126
|
+
readonly source?: {
|
|
127
|
+
readonly start: number;
|
|
128
|
+
readonly end: number;
|
|
129
|
+
readonly text: string;
|
|
130
|
+
} | undefined;
|
|
131
|
+
}[] | undefined;
|
|
132
|
+
readonly agents?: readonly {
|
|
133
|
+
readonly name: string;
|
|
134
|
+
readonly source?: {
|
|
135
|
+
readonly start: number;
|
|
136
|
+
readonly end: number;
|
|
137
|
+
readonly text: string;
|
|
138
|
+
} | undefined;
|
|
139
|
+
}[] | undefined;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
readonly delivery: Schema.Literals<readonly ["steer", "queue"]>;
|
|
143
|
+
readonly timeCreated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
144
|
+
readonly promotedSeq: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
145
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * as SessionInput from "./session-input.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { optional } from "./schema.js";
|
|
4
|
+
import { Prompt } from "./prompt.js";
|
|
5
|
+
import { DateTimeUtcFromMillis, NonNegativeInt } from "./schema.js";
|
|
6
|
+
import { SessionDelivery } from "./session-delivery.js";
|
|
7
|
+
import { SessionID } from "./session-id.js";
|
|
8
|
+
import { SessionMessage } from "./session-message.js";
|
|
9
|
+
export const Delivery = SessionDelivery.Delivery;
|
|
10
|
+
export const Admitted = Schema.Struct({
|
|
11
|
+
admittedSeq: NonNegativeInt,
|
|
12
|
+
id: SessionMessage.ID,
|
|
13
|
+
sessionID: SessionID,
|
|
14
|
+
prompt: Prompt,
|
|
15
|
+
delivery: Delivery,
|
|
16
|
+
timeCreated: DateTimeUtcFromMillis,
|
|
17
|
+
promotedSeq: NonNegativeInt.pipe(optional),
|
|
18
|
+
}).annotate({ identifier: "SessionInput.Admitted" });
|