swarm-mail 0.1.0 → 0.1.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/README.md +28 -0
- package/dist/adapter.d.ts +36 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16710 -0
- package/{src/pglite.ts → dist/pglite.d.ts} +7 -93
- package/dist/pglite.d.ts.map +1 -0
- package/dist/streams/agent-mail.d.ts +139 -0
- package/dist/streams/agent-mail.d.ts.map +1 -0
- package/dist/streams/debug.d.ts +173 -0
- package/dist/streams/debug.d.ts.map +1 -0
- package/dist/streams/effect/ask.d.ts +124 -0
- package/dist/streams/effect/ask.d.ts.map +1 -0
- package/dist/streams/effect/cursor.d.ts +87 -0
- package/dist/streams/effect/cursor.d.ts.map +1 -0
- package/dist/streams/effect/deferred.d.ts +108 -0
- package/dist/streams/effect/deferred.d.ts.map +1 -0
- package/{src/streams/effect/index.ts → dist/streams/effect/index.d.ts} +1 -0
- package/dist/streams/effect/index.d.ts.map +1 -0
- package/{src/streams/effect/layers.ts → dist/streams/effect/layers.d.ts} +8 -33
- package/dist/streams/effect/layers.d.ts.map +1 -0
- package/dist/streams/effect/lock.d.ts +137 -0
- package/dist/streams/effect/lock.d.ts.map +1 -0
- package/dist/streams/effect/mailbox.d.ts +98 -0
- package/dist/streams/effect/mailbox.d.ts.map +1 -0
- package/dist/streams/events.d.ts +487 -0
- package/dist/streams/events.d.ts.map +1 -0
- package/dist/streams/index.d.ts +106 -0
- package/dist/streams/index.d.ts.map +1 -0
- package/dist/streams/migrations.d.ts +102 -0
- package/dist/streams/migrations.d.ts.map +1 -0
- package/dist/streams/projections.d.ts +173 -0
- package/dist/streams/projections.d.ts.map +1 -0
- package/dist/streams/store.d.ts +171 -0
- package/dist/streams/store.d.ts.map +1 -0
- package/dist/streams/swarm-mail.d.ts +153 -0
- package/dist/streams/swarm-mail.d.ts.map +1 -0
- package/dist/types/adapter.d.ts +267 -0
- package/dist/types/adapter.d.ts.map +1 -0
- package/dist/types/database.d.ts +117 -0
- package/dist/types/database.d.ts.map +1 -0
- package/{src/types/index.ts → dist/types/index.d.ts} +2 -15
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +21 -5
- package/src/adapter.ts +0 -306
- package/src/index.ts +0 -57
- package/src/streams/agent-mail.test.ts +0 -777
- package/src/streams/agent-mail.ts +0 -535
- package/src/streams/debug.test.ts +0 -500
- package/src/streams/debug.ts +0 -727
- package/src/streams/effect/ask.integration.test.ts +0 -314
- package/src/streams/effect/ask.ts +0 -202
- package/src/streams/effect/cursor.integration.test.ts +0 -418
- package/src/streams/effect/cursor.ts +0 -288
- package/src/streams/effect/deferred.test.ts +0 -357
- package/src/streams/effect/deferred.ts +0 -445
- package/src/streams/effect/lock.test.ts +0 -385
- package/src/streams/effect/lock.ts +0 -399
- package/src/streams/effect/mailbox.test.ts +0 -260
- package/src/streams/effect/mailbox.ts +0 -318
- package/src/streams/events.test.ts +0 -924
- package/src/streams/events.ts +0 -329
- package/src/streams/index.test.ts +0 -229
- package/src/streams/index.ts +0 -578
- package/src/streams/migrations.test.ts +0 -359
- package/src/streams/migrations.ts +0 -362
- package/src/streams/projections.test.ts +0 -611
- package/src/streams/projections.ts +0 -564
- package/src/streams/store.integration.test.ts +0 -658
- package/src/streams/store.ts +0 -1129
- package/src/streams/swarm-mail.ts +0 -552
- package/src/types/adapter.ts +0 -392
- package/src/types/database.ts +0 -127
- package/tsconfig.json +0 -22
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Types for Swarm Mail Event Sourcing
|
|
3
|
+
*
|
|
4
|
+
* All agent coordination operations are represented as immutable events.
|
|
5
|
+
* Current state is computed by replaying events (projections).
|
|
6
|
+
*
|
|
7
|
+
* Event sourcing benefits:
|
|
8
|
+
* - Full audit trail for debugging
|
|
9
|
+
* - Replay from any point
|
|
10
|
+
* - Events ARE the training data for learning
|
|
11
|
+
* - No lost messages - append-only, durable
|
|
12
|
+
*/
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
/**
|
|
15
|
+
* Base fields present on all events
|
|
16
|
+
*/
|
|
17
|
+
export declare const BaseEventSchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
type: z.ZodString;
|
|
20
|
+
project_key: z.ZodString;
|
|
21
|
+
timestamp: z.ZodNumber;
|
|
22
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const AgentRegisteredEventSchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
project_key: z.ZodString;
|
|
27
|
+
timestamp: z.ZodNumber;
|
|
28
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
type: z.ZodLiteral<"agent_registered">;
|
|
30
|
+
agent_name: z.ZodString;
|
|
31
|
+
program: z.ZodDefault<z.ZodString>;
|
|
32
|
+
model: z.ZodDefault<z.ZodString>;
|
|
33
|
+
task_description: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export declare const AgentActiveEventSchema: z.ZodObject<{
|
|
36
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
project_key: z.ZodString;
|
|
38
|
+
timestamp: z.ZodNumber;
|
|
39
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
type: z.ZodLiteral<"agent_active">;
|
|
41
|
+
agent_name: z.ZodString;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export declare const MessageSentEventSchema: z.ZodObject<{
|
|
44
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
project_key: z.ZodString;
|
|
46
|
+
timestamp: z.ZodNumber;
|
|
47
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
type: z.ZodLiteral<"message_sent">;
|
|
49
|
+
message_id: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
from_agent: z.ZodString;
|
|
51
|
+
to_agents: z.ZodArray<z.ZodString>;
|
|
52
|
+
subject: z.ZodString;
|
|
53
|
+
body: z.ZodString;
|
|
54
|
+
thread_id: z.ZodOptional<z.ZodString>;
|
|
55
|
+
importance: z.ZodDefault<z.ZodEnum<{
|
|
56
|
+
low: "low";
|
|
57
|
+
normal: "normal";
|
|
58
|
+
high: "high";
|
|
59
|
+
urgent: "urgent";
|
|
60
|
+
}>>;
|
|
61
|
+
ack_required: z.ZodDefault<z.ZodBoolean>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export declare const MessageReadEventSchema: z.ZodObject<{
|
|
64
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
project_key: z.ZodString;
|
|
66
|
+
timestamp: z.ZodNumber;
|
|
67
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
type: z.ZodLiteral<"message_read">;
|
|
69
|
+
message_id: z.ZodNumber;
|
|
70
|
+
agent_name: z.ZodString;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export declare const MessageAckedEventSchema: z.ZodObject<{
|
|
73
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
project_key: z.ZodString;
|
|
75
|
+
timestamp: z.ZodNumber;
|
|
76
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
type: z.ZodLiteral<"message_acked">;
|
|
78
|
+
message_id: z.ZodNumber;
|
|
79
|
+
agent_name: z.ZodString;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export declare const FileReservedEventSchema: z.ZodObject<{
|
|
82
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
project_key: z.ZodString;
|
|
84
|
+
timestamp: z.ZodNumber;
|
|
85
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
type: z.ZodLiteral<"file_reserved">;
|
|
87
|
+
reservation_id: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
agent_name: z.ZodString;
|
|
89
|
+
paths: z.ZodArray<z.ZodString>;
|
|
90
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
91
|
+
exclusive: z.ZodDefault<z.ZodBoolean>;
|
|
92
|
+
ttl_seconds: z.ZodDefault<z.ZodNumber>;
|
|
93
|
+
expires_at: z.ZodNumber;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
export declare const FileReleasedEventSchema: z.ZodObject<{
|
|
96
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
project_key: z.ZodString;
|
|
98
|
+
timestamp: z.ZodNumber;
|
|
99
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
type: z.ZodLiteral<"file_released">;
|
|
101
|
+
agent_name: z.ZodString;
|
|
102
|
+
paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
+
reservation_ids: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
export declare const TaskStartedEventSchema: z.ZodObject<{
|
|
106
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
project_key: z.ZodString;
|
|
108
|
+
timestamp: z.ZodNumber;
|
|
109
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
type: z.ZodLiteral<"task_started">;
|
|
111
|
+
agent_name: z.ZodString;
|
|
112
|
+
bead_id: z.ZodString;
|
|
113
|
+
epic_id: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
export declare const TaskProgressEventSchema: z.ZodObject<{
|
|
116
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
project_key: z.ZodString;
|
|
118
|
+
timestamp: z.ZodNumber;
|
|
119
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
type: z.ZodLiteral<"task_progress">;
|
|
121
|
+
agent_name: z.ZodString;
|
|
122
|
+
bead_id: z.ZodString;
|
|
123
|
+
progress_percent: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
message: z.ZodOptional<z.ZodString>;
|
|
125
|
+
files_touched: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export declare const TaskCompletedEventSchema: z.ZodObject<{
|
|
128
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
project_key: z.ZodString;
|
|
130
|
+
timestamp: z.ZodNumber;
|
|
131
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
type: z.ZodLiteral<"task_completed">;
|
|
133
|
+
agent_name: z.ZodString;
|
|
134
|
+
bead_id: z.ZodString;
|
|
135
|
+
summary: z.ZodString;
|
|
136
|
+
files_touched: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
137
|
+
success: z.ZodDefault<z.ZodBoolean>;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
export declare const TaskBlockedEventSchema: z.ZodObject<{
|
|
140
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
project_key: z.ZodString;
|
|
142
|
+
timestamp: z.ZodNumber;
|
|
143
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
type: z.ZodLiteral<"task_blocked">;
|
|
145
|
+
agent_name: z.ZodString;
|
|
146
|
+
bead_id: z.ZodString;
|
|
147
|
+
reason: z.ZodString;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
export declare const DecompositionGeneratedEventSchema: z.ZodObject<{
|
|
150
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
project_key: z.ZodString;
|
|
152
|
+
timestamp: z.ZodNumber;
|
|
153
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
154
|
+
type: z.ZodLiteral<"decomposition_generated">;
|
|
155
|
+
epic_id: z.ZodString;
|
|
156
|
+
task: z.ZodString;
|
|
157
|
+
context: z.ZodOptional<z.ZodString>;
|
|
158
|
+
strategy: z.ZodEnum<{
|
|
159
|
+
"file-based": "file-based";
|
|
160
|
+
"feature-based": "feature-based";
|
|
161
|
+
"risk-based": "risk-based";
|
|
162
|
+
}>;
|
|
163
|
+
epic_title: z.ZodString;
|
|
164
|
+
subtasks: z.ZodArray<z.ZodObject<{
|
|
165
|
+
title: z.ZodString;
|
|
166
|
+
files: z.ZodArray<z.ZodString>;
|
|
167
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
168
|
+
}, z.core.$strip>>;
|
|
169
|
+
recovery_context: z.ZodOptional<z.ZodObject<{
|
|
170
|
+
shared_context: z.ZodOptional<z.ZodString>;
|
|
171
|
+
skills_to_load: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
172
|
+
coordinator_notes: z.ZodOptional<z.ZodString>;
|
|
173
|
+
}, z.core.$strip>>;
|
|
174
|
+
}, z.core.$strip>;
|
|
175
|
+
export declare const SubtaskOutcomeEventSchema: z.ZodObject<{
|
|
176
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
177
|
+
project_key: z.ZodString;
|
|
178
|
+
timestamp: z.ZodNumber;
|
|
179
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
180
|
+
type: z.ZodLiteral<"subtask_outcome">;
|
|
181
|
+
epic_id: z.ZodString;
|
|
182
|
+
bead_id: z.ZodString;
|
|
183
|
+
planned_files: z.ZodArray<z.ZodString>;
|
|
184
|
+
actual_files: z.ZodArray<z.ZodString>;
|
|
185
|
+
duration_ms: z.ZodNumber;
|
|
186
|
+
error_count: z.ZodDefault<z.ZodNumber>;
|
|
187
|
+
retry_count: z.ZodDefault<z.ZodNumber>;
|
|
188
|
+
success: z.ZodBoolean;
|
|
189
|
+
}, z.core.$strip>;
|
|
190
|
+
export declare const HumanFeedbackEventSchema: z.ZodObject<{
|
|
191
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
project_key: z.ZodString;
|
|
193
|
+
timestamp: z.ZodNumber;
|
|
194
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
195
|
+
type: z.ZodLiteral<"human_feedback">;
|
|
196
|
+
epic_id: z.ZodString;
|
|
197
|
+
accepted: z.ZodBoolean;
|
|
198
|
+
modified: z.ZodDefault<z.ZodBoolean>;
|
|
199
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
export declare const SwarmCheckpointedEventSchema: z.ZodObject<{
|
|
202
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
project_key: z.ZodString;
|
|
204
|
+
timestamp: z.ZodNumber;
|
|
205
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
type: z.ZodLiteral<"swarm_checkpointed">;
|
|
207
|
+
epic_id: z.ZodString;
|
|
208
|
+
bead_id: z.ZodString;
|
|
209
|
+
strategy: z.ZodEnum<{
|
|
210
|
+
"file-based": "file-based";
|
|
211
|
+
"feature-based": "feature-based";
|
|
212
|
+
"risk-based": "risk-based";
|
|
213
|
+
}>;
|
|
214
|
+
files: z.ZodArray<z.ZodString>;
|
|
215
|
+
dependencies: z.ZodArray<z.ZodString>;
|
|
216
|
+
directives: z.ZodObject<{
|
|
217
|
+
shared_context: z.ZodOptional<z.ZodString>;
|
|
218
|
+
skills_to_load: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
219
|
+
coordinator_notes: z.ZodOptional<z.ZodString>;
|
|
220
|
+
}, z.core.$strip>;
|
|
221
|
+
recovery: z.ZodObject<{
|
|
222
|
+
last_checkpoint: z.ZodNumber;
|
|
223
|
+
files_modified: z.ZodArray<z.ZodString>;
|
|
224
|
+
progress_percent: z.ZodNumber;
|
|
225
|
+
last_message: z.ZodOptional<z.ZodString>;
|
|
226
|
+
error_context: z.ZodOptional<z.ZodString>;
|
|
227
|
+
}, z.core.$strip>;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
export declare const SwarmRecoveredEventSchema: z.ZodObject<{
|
|
230
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
project_key: z.ZodString;
|
|
232
|
+
timestamp: z.ZodNumber;
|
|
233
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
234
|
+
type: z.ZodLiteral<"swarm_recovered">;
|
|
235
|
+
epic_id: z.ZodString;
|
|
236
|
+
bead_id: z.ZodString;
|
|
237
|
+
recovered_from_checkpoint: z.ZodNumber;
|
|
238
|
+
}, z.core.$strip>;
|
|
239
|
+
export declare const AgentEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
240
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
project_key: z.ZodString;
|
|
242
|
+
timestamp: z.ZodNumber;
|
|
243
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
244
|
+
type: z.ZodLiteral<"agent_registered">;
|
|
245
|
+
agent_name: z.ZodString;
|
|
246
|
+
program: z.ZodDefault<z.ZodString>;
|
|
247
|
+
model: z.ZodDefault<z.ZodString>;
|
|
248
|
+
task_description: z.ZodOptional<z.ZodString>;
|
|
249
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
250
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
251
|
+
project_key: z.ZodString;
|
|
252
|
+
timestamp: z.ZodNumber;
|
|
253
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
254
|
+
type: z.ZodLiteral<"agent_active">;
|
|
255
|
+
agent_name: z.ZodString;
|
|
256
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
257
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
258
|
+
project_key: z.ZodString;
|
|
259
|
+
timestamp: z.ZodNumber;
|
|
260
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
261
|
+
type: z.ZodLiteral<"message_sent">;
|
|
262
|
+
message_id: z.ZodOptional<z.ZodNumber>;
|
|
263
|
+
from_agent: z.ZodString;
|
|
264
|
+
to_agents: z.ZodArray<z.ZodString>;
|
|
265
|
+
subject: z.ZodString;
|
|
266
|
+
body: z.ZodString;
|
|
267
|
+
thread_id: z.ZodOptional<z.ZodString>;
|
|
268
|
+
importance: z.ZodDefault<z.ZodEnum<{
|
|
269
|
+
low: "low";
|
|
270
|
+
normal: "normal";
|
|
271
|
+
high: "high";
|
|
272
|
+
urgent: "urgent";
|
|
273
|
+
}>>;
|
|
274
|
+
ack_required: z.ZodDefault<z.ZodBoolean>;
|
|
275
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
276
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
277
|
+
project_key: z.ZodString;
|
|
278
|
+
timestamp: z.ZodNumber;
|
|
279
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
280
|
+
type: z.ZodLiteral<"message_read">;
|
|
281
|
+
message_id: z.ZodNumber;
|
|
282
|
+
agent_name: z.ZodString;
|
|
283
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
284
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
285
|
+
project_key: z.ZodString;
|
|
286
|
+
timestamp: z.ZodNumber;
|
|
287
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
288
|
+
type: z.ZodLiteral<"message_acked">;
|
|
289
|
+
message_id: z.ZodNumber;
|
|
290
|
+
agent_name: z.ZodString;
|
|
291
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
292
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
293
|
+
project_key: z.ZodString;
|
|
294
|
+
timestamp: z.ZodNumber;
|
|
295
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
296
|
+
type: z.ZodLiteral<"file_reserved">;
|
|
297
|
+
reservation_id: z.ZodOptional<z.ZodNumber>;
|
|
298
|
+
agent_name: z.ZodString;
|
|
299
|
+
paths: z.ZodArray<z.ZodString>;
|
|
300
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
301
|
+
exclusive: z.ZodDefault<z.ZodBoolean>;
|
|
302
|
+
ttl_seconds: z.ZodDefault<z.ZodNumber>;
|
|
303
|
+
expires_at: z.ZodNumber;
|
|
304
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
305
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
306
|
+
project_key: z.ZodString;
|
|
307
|
+
timestamp: z.ZodNumber;
|
|
308
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
309
|
+
type: z.ZodLiteral<"file_released">;
|
|
310
|
+
agent_name: z.ZodString;
|
|
311
|
+
paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
312
|
+
reservation_ids: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
313
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
314
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
315
|
+
project_key: z.ZodString;
|
|
316
|
+
timestamp: z.ZodNumber;
|
|
317
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
318
|
+
type: z.ZodLiteral<"task_started">;
|
|
319
|
+
agent_name: z.ZodString;
|
|
320
|
+
bead_id: z.ZodString;
|
|
321
|
+
epic_id: z.ZodOptional<z.ZodString>;
|
|
322
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
323
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
324
|
+
project_key: z.ZodString;
|
|
325
|
+
timestamp: z.ZodNumber;
|
|
326
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
327
|
+
type: z.ZodLiteral<"task_progress">;
|
|
328
|
+
agent_name: z.ZodString;
|
|
329
|
+
bead_id: z.ZodString;
|
|
330
|
+
progress_percent: z.ZodOptional<z.ZodNumber>;
|
|
331
|
+
message: z.ZodOptional<z.ZodString>;
|
|
332
|
+
files_touched: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
333
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
334
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
335
|
+
project_key: z.ZodString;
|
|
336
|
+
timestamp: z.ZodNumber;
|
|
337
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
338
|
+
type: z.ZodLiteral<"task_completed">;
|
|
339
|
+
agent_name: z.ZodString;
|
|
340
|
+
bead_id: z.ZodString;
|
|
341
|
+
summary: z.ZodString;
|
|
342
|
+
files_touched: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
343
|
+
success: z.ZodDefault<z.ZodBoolean>;
|
|
344
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
345
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
346
|
+
project_key: z.ZodString;
|
|
347
|
+
timestamp: z.ZodNumber;
|
|
348
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
349
|
+
type: z.ZodLiteral<"task_blocked">;
|
|
350
|
+
agent_name: z.ZodString;
|
|
351
|
+
bead_id: z.ZodString;
|
|
352
|
+
reason: z.ZodString;
|
|
353
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
354
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
355
|
+
project_key: z.ZodString;
|
|
356
|
+
timestamp: z.ZodNumber;
|
|
357
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
358
|
+
type: z.ZodLiteral<"decomposition_generated">;
|
|
359
|
+
epic_id: z.ZodString;
|
|
360
|
+
task: z.ZodString;
|
|
361
|
+
context: z.ZodOptional<z.ZodString>;
|
|
362
|
+
strategy: z.ZodEnum<{
|
|
363
|
+
"file-based": "file-based";
|
|
364
|
+
"feature-based": "feature-based";
|
|
365
|
+
"risk-based": "risk-based";
|
|
366
|
+
}>;
|
|
367
|
+
epic_title: z.ZodString;
|
|
368
|
+
subtasks: z.ZodArray<z.ZodObject<{
|
|
369
|
+
title: z.ZodString;
|
|
370
|
+
files: z.ZodArray<z.ZodString>;
|
|
371
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
372
|
+
}, z.core.$strip>>;
|
|
373
|
+
recovery_context: z.ZodOptional<z.ZodObject<{
|
|
374
|
+
shared_context: z.ZodOptional<z.ZodString>;
|
|
375
|
+
skills_to_load: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
376
|
+
coordinator_notes: z.ZodOptional<z.ZodString>;
|
|
377
|
+
}, z.core.$strip>>;
|
|
378
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
379
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
380
|
+
project_key: z.ZodString;
|
|
381
|
+
timestamp: z.ZodNumber;
|
|
382
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
383
|
+
type: z.ZodLiteral<"subtask_outcome">;
|
|
384
|
+
epic_id: z.ZodString;
|
|
385
|
+
bead_id: z.ZodString;
|
|
386
|
+
planned_files: z.ZodArray<z.ZodString>;
|
|
387
|
+
actual_files: z.ZodArray<z.ZodString>;
|
|
388
|
+
duration_ms: z.ZodNumber;
|
|
389
|
+
error_count: z.ZodDefault<z.ZodNumber>;
|
|
390
|
+
retry_count: z.ZodDefault<z.ZodNumber>;
|
|
391
|
+
success: z.ZodBoolean;
|
|
392
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
393
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
394
|
+
project_key: z.ZodString;
|
|
395
|
+
timestamp: z.ZodNumber;
|
|
396
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
397
|
+
type: z.ZodLiteral<"human_feedback">;
|
|
398
|
+
epic_id: z.ZodString;
|
|
399
|
+
accepted: z.ZodBoolean;
|
|
400
|
+
modified: z.ZodDefault<z.ZodBoolean>;
|
|
401
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
402
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
403
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
404
|
+
project_key: z.ZodString;
|
|
405
|
+
timestamp: z.ZodNumber;
|
|
406
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
407
|
+
type: z.ZodLiteral<"swarm_checkpointed">;
|
|
408
|
+
epic_id: z.ZodString;
|
|
409
|
+
bead_id: z.ZodString;
|
|
410
|
+
strategy: z.ZodEnum<{
|
|
411
|
+
"file-based": "file-based";
|
|
412
|
+
"feature-based": "feature-based";
|
|
413
|
+
"risk-based": "risk-based";
|
|
414
|
+
}>;
|
|
415
|
+
files: z.ZodArray<z.ZodString>;
|
|
416
|
+
dependencies: z.ZodArray<z.ZodString>;
|
|
417
|
+
directives: z.ZodObject<{
|
|
418
|
+
shared_context: z.ZodOptional<z.ZodString>;
|
|
419
|
+
skills_to_load: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
420
|
+
coordinator_notes: z.ZodOptional<z.ZodString>;
|
|
421
|
+
}, z.core.$strip>;
|
|
422
|
+
recovery: z.ZodObject<{
|
|
423
|
+
last_checkpoint: z.ZodNumber;
|
|
424
|
+
files_modified: z.ZodArray<z.ZodString>;
|
|
425
|
+
progress_percent: z.ZodNumber;
|
|
426
|
+
last_message: z.ZodOptional<z.ZodString>;
|
|
427
|
+
error_context: z.ZodOptional<z.ZodString>;
|
|
428
|
+
}, z.core.$strip>;
|
|
429
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
430
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
431
|
+
project_key: z.ZodString;
|
|
432
|
+
timestamp: z.ZodNumber;
|
|
433
|
+
sequence: z.ZodOptional<z.ZodNumber>;
|
|
434
|
+
type: z.ZodLiteral<"swarm_recovered">;
|
|
435
|
+
epic_id: z.ZodString;
|
|
436
|
+
bead_id: z.ZodString;
|
|
437
|
+
recovered_from_checkpoint: z.ZodNumber;
|
|
438
|
+
}, z.core.$strip>], "type">;
|
|
439
|
+
export type AgentEvent = z.infer<typeof AgentEventSchema>;
|
|
440
|
+
export type AgentRegisteredEvent = z.infer<typeof AgentRegisteredEventSchema>;
|
|
441
|
+
export type AgentActiveEvent = z.infer<typeof AgentActiveEventSchema>;
|
|
442
|
+
export type MessageSentEvent = z.infer<typeof MessageSentEventSchema>;
|
|
443
|
+
export type MessageReadEvent = z.infer<typeof MessageReadEventSchema>;
|
|
444
|
+
export type MessageAckedEvent = z.infer<typeof MessageAckedEventSchema>;
|
|
445
|
+
export type FileReservedEvent = z.infer<typeof FileReservedEventSchema>;
|
|
446
|
+
export type FileReleasedEvent = z.infer<typeof FileReleasedEventSchema>;
|
|
447
|
+
export type TaskStartedEvent = z.infer<typeof TaskStartedEventSchema>;
|
|
448
|
+
export type TaskProgressEvent = z.infer<typeof TaskProgressEventSchema>;
|
|
449
|
+
export type TaskCompletedEvent = z.infer<typeof TaskCompletedEventSchema>;
|
|
450
|
+
export type TaskBlockedEvent = z.infer<typeof TaskBlockedEventSchema>;
|
|
451
|
+
export type DecompositionGeneratedEvent = z.infer<typeof DecompositionGeneratedEventSchema>;
|
|
452
|
+
export type SubtaskOutcomeEvent = z.infer<typeof SubtaskOutcomeEventSchema>;
|
|
453
|
+
export type HumanFeedbackEvent = z.infer<typeof HumanFeedbackEventSchema>;
|
|
454
|
+
export type SwarmCheckpointedEvent = z.infer<typeof SwarmCheckpointedEventSchema>;
|
|
455
|
+
export type SwarmRecoveredEvent = z.infer<typeof SwarmRecoveredEventSchema>;
|
|
456
|
+
/**
|
|
457
|
+
* Shared session state for Agent Mail and Swarm Mail
|
|
458
|
+
*
|
|
459
|
+
* Common fields for tracking agent coordination session across both
|
|
460
|
+
* the MCP-based implementation (agent-mail) and the embedded event-sourced
|
|
461
|
+
* implementation (swarm-mail).
|
|
462
|
+
*/
|
|
463
|
+
export interface MailSessionState {
|
|
464
|
+
/** Project key (usually absolute path) */
|
|
465
|
+
projectKey: string;
|
|
466
|
+
/** Agent name for this session */
|
|
467
|
+
agentName: string;
|
|
468
|
+
/** Active reservation IDs */
|
|
469
|
+
reservations: number[];
|
|
470
|
+
/** Session start timestamp (ISO-8601) */
|
|
471
|
+
startedAt: string;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Create an event with timestamp and validate
|
|
475
|
+
*/
|
|
476
|
+
export declare function createEvent<T extends AgentEvent["type"]>(type: T, data: Omit<Extract<AgentEvent, {
|
|
477
|
+
type: T;
|
|
478
|
+
}>, "type" | "timestamp" | "id" | "sequence">): Extract<AgentEvent, {
|
|
479
|
+
type: T;
|
|
480
|
+
}>;
|
|
481
|
+
/**
|
|
482
|
+
* Type guard for specific event types
|
|
483
|
+
*/
|
|
484
|
+
export declare function isEventType<T extends AgentEvent["type"]>(event: AgentEvent, type: T): event is Extract<AgentEvent, {
|
|
485
|
+
type: T;
|
|
486
|
+
}>;
|
|
487
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/streams/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;iBAW1B,CAAC;AAMH,eAAO,MAAM,0BAA0B;;;;;;;;;;iBAMrC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;iBAGjC,CAAC;AAMH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;iBAWjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;iBAIjC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;iBAIlC,CAAC;AAMH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;iBAYlC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;iBAOlC,CAAC;AAMH,eAAO,MAAM,sBAAsB;;;;;;;;;iBAKjC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;iBAOlC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;iBAOnC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;iBAKjC,CAAC;AAMH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;iBAqB5C,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;iBAUpC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAMnC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tD,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,CAAC,GACN,KAAK,IAAI,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAE3C"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SwarmMail Event Store - PGLite-based event sourcing
|
|
3
|
+
*
|
|
4
|
+
* ## Thread Safety
|
|
5
|
+
*
|
|
6
|
+
* PGLite runs in-process as a single-threaded SQLite-compatible database.
|
|
7
|
+
* While Node.js is single-threaded, async operations can interleave.
|
|
8
|
+
*
|
|
9
|
+
* **Concurrency Model:**
|
|
10
|
+
* - Single PGLite instance per project (singleton pattern via LRU cache)
|
|
11
|
+
* - Transactions provide isolation for multi-statement operations
|
|
12
|
+
* - appendEvents uses BEGIN/COMMIT for atomic event batches
|
|
13
|
+
* - Concurrent reads are safe (no locks needed)
|
|
14
|
+
* - Concurrent writes are serialized by PGLite internally
|
|
15
|
+
*
|
|
16
|
+
* **Race Condition Mitigations:**
|
|
17
|
+
* - File reservations use INSERT with conflict detection
|
|
18
|
+
* - Sequence numbers are auto-incremented by database
|
|
19
|
+
* - Materialized views updated within same transaction as events
|
|
20
|
+
* - Pending instance promises prevent duplicate initialization
|
|
21
|
+
*
|
|
22
|
+
* **Known Limitations:**
|
|
23
|
+
* - No distributed locking (single-process only)
|
|
24
|
+
* - Large transactions may block other operations
|
|
25
|
+
* - No connection pooling (embedded database)
|
|
26
|
+
*
|
|
27
|
+
* ## Database Setup
|
|
28
|
+
*
|
|
29
|
+
* Embedded PostgreSQL database for event sourcing.
|
|
30
|
+
* No external server required - runs in-process.
|
|
31
|
+
*
|
|
32
|
+
* Database location: .opencode/streams.db (project-local)
|
|
33
|
+
* or ~/.opencode/streams.db (global fallback)
|
|
34
|
+
*/
|
|
35
|
+
import { PGlite } from "@electric-sql/pglite";
|
|
36
|
+
/**
|
|
37
|
+
* Wrap a promise with a timeout
|
|
38
|
+
*
|
|
39
|
+
* @param promise - The promise to wrap
|
|
40
|
+
* @param ms - Timeout in milliseconds
|
|
41
|
+
* @param operation - Operation name for error message
|
|
42
|
+
* @returns The result of the promise
|
|
43
|
+
* @throws Error if timeout is reached
|
|
44
|
+
*/
|
|
45
|
+
export declare function withTimeout<T>(promise: Promise<T>, ms: number, operation: string): Promise<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Execute a database operation with timing instrumentation.
|
|
48
|
+
* Logs a warning if the operation exceeds SLOW_QUERY_THRESHOLD_MS.
|
|
49
|
+
*
|
|
50
|
+
* @param operation - Name of the operation for logging
|
|
51
|
+
* @param fn - Async function to execute
|
|
52
|
+
* @returns Result of the function
|
|
53
|
+
*/
|
|
54
|
+
export declare function withTiming<T>(operation: string, fn: () => Promise<T>): Promise<T>;
|
|
55
|
+
/**
|
|
56
|
+
* Get the database path for a project
|
|
57
|
+
*
|
|
58
|
+
* Prefers project-local .opencode/streams.db
|
|
59
|
+
* Falls back to global ~/.opencode/streams.db
|
|
60
|
+
*/
|
|
61
|
+
export declare function getDatabasePath(projectPath?: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Get or create a PGLite instance for the given path
|
|
64
|
+
*
|
|
65
|
+
* If initialization fails, falls back to in-memory database and marks instance as degraded.
|
|
66
|
+
*
|
|
67
|
+
* Uses Promise-based caching to prevent race conditions when multiple concurrent
|
|
68
|
+
* calls occur before the first one completes.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getDatabase(projectPath?: string): Promise<PGlite>;
|
|
71
|
+
/**
|
|
72
|
+
* Close a database instance
|
|
73
|
+
*/
|
|
74
|
+
export declare function closeDatabase(projectPath?: string): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Close all database instances
|
|
77
|
+
*/
|
|
78
|
+
export declare function closeAllDatabases(): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Reset database for testing - clears all data but keeps schema
|
|
81
|
+
*/
|
|
82
|
+
export declare function resetDatabase(projectPath?: string): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Check if the database is healthy
|
|
85
|
+
*
|
|
86
|
+
* Returns false if database is in degraded mode (using in-memory fallback)
|
|
87
|
+
*/
|
|
88
|
+
export declare function isDatabaseHealthy(projectPath?: string): Promise<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* Get database statistics
|
|
91
|
+
*/
|
|
92
|
+
export declare function getDatabaseStats(projectPath?: string): Promise<{
|
|
93
|
+
events: number;
|
|
94
|
+
agents: number;
|
|
95
|
+
messages: number;
|
|
96
|
+
reservations: number;
|
|
97
|
+
}>;
|
|
98
|
+
export { PGlite };
|
|
99
|
+
export * from "./agent-mail";
|
|
100
|
+
export * from "./debug";
|
|
101
|
+
export * from "./events";
|
|
102
|
+
export * from "./migrations";
|
|
103
|
+
export * from "./projections";
|
|
104
|
+
export * from "./store";
|
|
105
|
+
export * from "./swarm-mail";
|
|
106
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/streams/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAW9C;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,CAAC,CAAC,CAQZ;AASD;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAYZ;AAwBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAkB5D;AA2DD;;;;;;;GAOG;AACH,w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