@isoplan/protocol 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/facts.d.ts +383 -0
- package/dist/facts.js +129 -0
- package/dist/facts.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +975 -0
- package/dist/messages.js +263 -0
- package/dist/messages.js.map +1 -0
- package/dist/project-id.d.ts +12 -0
- package/dist/project-id.js +37 -0
- package/dist/project-id.js.map +1 -0
- package/package.json +31 -4
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Adam Linscott
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/facts.d.ts
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SourceSchema: z.ZodEnum<{
|
|
3
|
+
"claude-code": "claude-code";
|
|
4
|
+
}>;
|
|
5
|
+
export declare const SessionFactSchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
source: z.ZodEnum<{
|
|
8
|
+
"claude-code": "claude-code";
|
|
9
|
+
}>;
|
|
10
|
+
lead: z.ZodString;
|
|
11
|
+
title: z.ZodNullable<z.ZodString>;
|
|
12
|
+
titleFrom: z.ZodEnum<{
|
|
13
|
+
branch: "branch";
|
|
14
|
+
source: "source";
|
|
15
|
+
}>;
|
|
16
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
17
|
+
checkout: z.ZodOptional<z.ZodString>;
|
|
18
|
+
lastActive: z.ZodISODateTime;
|
|
19
|
+
status: z.ZodEnum<{
|
|
20
|
+
active: "active";
|
|
21
|
+
idle: "idle";
|
|
22
|
+
}>;
|
|
23
|
+
lights: z.ZodEnum<{
|
|
24
|
+
off: "off";
|
|
25
|
+
on: "on";
|
|
26
|
+
}>;
|
|
27
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export declare const AgentFactSchema: z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
source: z.ZodEnum<{
|
|
32
|
+
"claude-code": "claude-code";
|
|
33
|
+
}>;
|
|
34
|
+
session: z.ZodString;
|
|
35
|
+
startedBy: z.ZodNullable<z.ZodString>;
|
|
36
|
+
agentType: z.ZodNullable<z.ZodString>;
|
|
37
|
+
task: z.ZodNullable<z.ZodString>;
|
|
38
|
+
status: z.ZodEnum<{
|
|
39
|
+
done: "done";
|
|
40
|
+
failed: "failed";
|
|
41
|
+
idle: "idle";
|
|
42
|
+
stalled: "stalled";
|
|
43
|
+
stopped: "stopped";
|
|
44
|
+
working: "working";
|
|
45
|
+
}>;
|
|
46
|
+
statusSince: z.ZodISODateTime;
|
|
47
|
+
lastActive: z.ZodISODateTime;
|
|
48
|
+
doing: z.ZodNullable<z.ZodObject<{
|
|
49
|
+
kind: z.ZodEnum<{
|
|
50
|
+
read: "read";
|
|
51
|
+
run: "run";
|
|
52
|
+
search: "search";
|
|
53
|
+
talk: "talk";
|
|
54
|
+
write: "write";
|
|
55
|
+
}>;
|
|
56
|
+
file: z.ZodOptional<z.ZodString>;
|
|
57
|
+
since: z.ZodISODateTime;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
usage: z.ZodNullable<z.ZodObject<{
|
|
60
|
+
input: z.ZodNumber;
|
|
61
|
+
cacheWrite: z.ZodNumber;
|
|
62
|
+
cacheWrite1h: z.ZodNumber;
|
|
63
|
+
cacheRead: z.ZodNumber;
|
|
64
|
+
output: z.ZodNumber;
|
|
65
|
+
model: z.ZodString;
|
|
66
|
+
context: z.ZodNumber;
|
|
67
|
+
over100k: z.ZodObject<{
|
|
68
|
+
input: z.ZodNumber;
|
|
69
|
+
cacheWrite: z.ZodNumber;
|
|
70
|
+
cacheWrite1h: z.ZodNumber;
|
|
71
|
+
cacheRead: z.ZodNumber;
|
|
72
|
+
output: z.ZodNumber;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
at: z.ZodISODateTime;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
checkout: z.ZodOptional<z.ZodString>;
|
|
77
|
+
branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
/** An edit or a read: `file` is relative to the repo root, with forward slashes. */
|
|
81
|
+
export declare const FileFactSchema: z.ZodObject<{
|
|
82
|
+
agent: z.ZodString;
|
|
83
|
+
file: z.ZodString;
|
|
84
|
+
at: z.ZodISODateTime;
|
|
85
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export declare const WaitFactSchema: z.ZodObject<{
|
|
88
|
+
waiter: z.ZodString;
|
|
89
|
+
on: z.ZodString;
|
|
90
|
+
since: z.ZodISODateTime;
|
|
91
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
export declare const ReportFactSchema: z.ZodObject<{
|
|
94
|
+
agent: z.ZodString;
|
|
95
|
+
at: z.ZodISODateTime;
|
|
96
|
+
text: z.ZodString;
|
|
97
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
/**
|
|
100
|
+
* A question an agent asked its owner, open until it is answered, so the floor can show it and the
|
|
101
|
+
* owner can answer it there. One of the named cases of session-derived text leaving a machine: the
|
|
102
|
+
* server keeps it only for the retention period. `id` is the tool call's own id.
|
|
103
|
+
*/
|
|
104
|
+
export declare const QuestionFactSchema: z.ZodObject<{
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
agent: z.ZodString;
|
|
107
|
+
at: z.ZodISODateTime;
|
|
108
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
109
|
+
question: z.ZodString;
|
|
110
|
+
header: z.ZodString;
|
|
111
|
+
options: z.ZodArray<z.ZodObject<{
|
|
112
|
+
label: z.ZodString;
|
|
113
|
+
description: z.ZodString;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
multiSelect: z.ZodBoolean;
|
|
116
|
+
}, z.core.$strip>>;
|
|
117
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
export declare const FactsSchema: z.ZodObject<{
|
|
120
|
+
session: z.ZodObject<{
|
|
121
|
+
id: z.ZodString;
|
|
122
|
+
source: z.ZodEnum<{
|
|
123
|
+
"claude-code": "claude-code";
|
|
124
|
+
}>;
|
|
125
|
+
lead: z.ZodString;
|
|
126
|
+
title: z.ZodNullable<z.ZodString>;
|
|
127
|
+
titleFrom: z.ZodEnum<{
|
|
128
|
+
branch: "branch";
|
|
129
|
+
source: "source";
|
|
130
|
+
}>;
|
|
131
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
132
|
+
checkout: z.ZodOptional<z.ZodString>;
|
|
133
|
+
lastActive: z.ZodISODateTime;
|
|
134
|
+
status: z.ZodEnum<{
|
|
135
|
+
active: "active";
|
|
136
|
+
idle: "idle";
|
|
137
|
+
}>;
|
|
138
|
+
lights: z.ZodEnum<{
|
|
139
|
+
off: "off";
|
|
140
|
+
on: "on";
|
|
141
|
+
}>;
|
|
142
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
agents: z.ZodArray<z.ZodObject<{
|
|
145
|
+
id: z.ZodString;
|
|
146
|
+
source: z.ZodEnum<{
|
|
147
|
+
"claude-code": "claude-code";
|
|
148
|
+
}>;
|
|
149
|
+
session: z.ZodString;
|
|
150
|
+
startedBy: z.ZodNullable<z.ZodString>;
|
|
151
|
+
agentType: z.ZodNullable<z.ZodString>;
|
|
152
|
+
task: z.ZodNullable<z.ZodString>;
|
|
153
|
+
status: z.ZodEnum<{
|
|
154
|
+
done: "done";
|
|
155
|
+
failed: "failed";
|
|
156
|
+
idle: "idle";
|
|
157
|
+
stalled: "stalled";
|
|
158
|
+
stopped: "stopped";
|
|
159
|
+
working: "working";
|
|
160
|
+
}>;
|
|
161
|
+
statusSince: z.ZodISODateTime;
|
|
162
|
+
lastActive: z.ZodISODateTime;
|
|
163
|
+
doing: z.ZodNullable<z.ZodObject<{
|
|
164
|
+
kind: z.ZodEnum<{
|
|
165
|
+
read: "read";
|
|
166
|
+
run: "run";
|
|
167
|
+
search: "search";
|
|
168
|
+
talk: "talk";
|
|
169
|
+
write: "write";
|
|
170
|
+
}>;
|
|
171
|
+
file: z.ZodOptional<z.ZodString>;
|
|
172
|
+
since: z.ZodISODateTime;
|
|
173
|
+
}, z.core.$strip>>;
|
|
174
|
+
usage: z.ZodNullable<z.ZodObject<{
|
|
175
|
+
input: z.ZodNumber;
|
|
176
|
+
cacheWrite: z.ZodNumber;
|
|
177
|
+
cacheWrite1h: z.ZodNumber;
|
|
178
|
+
cacheRead: z.ZodNumber;
|
|
179
|
+
output: z.ZodNumber;
|
|
180
|
+
model: z.ZodString;
|
|
181
|
+
context: z.ZodNumber;
|
|
182
|
+
over100k: z.ZodObject<{
|
|
183
|
+
input: z.ZodNumber;
|
|
184
|
+
cacheWrite: z.ZodNumber;
|
|
185
|
+
cacheWrite1h: z.ZodNumber;
|
|
186
|
+
cacheRead: z.ZodNumber;
|
|
187
|
+
output: z.ZodNumber;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
at: z.ZodISODateTime;
|
|
190
|
+
}, z.core.$strip>>;
|
|
191
|
+
checkout: z.ZodOptional<z.ZodString>;
|
|
192
|
+
branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
193
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
194
|
+
}, z.core.$strip>>;
|
|
195
|
+
edits: z.ZodArray<z.ZodObject<{
|
|
196
|
+
agent: z.ZodString;
|
|
197
|
+
file: z.ZodString;
|
|
198
|
+
at: z.ZodISODateTime;
|
|
199
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
200
|
+
}, z.core.$strip>>;
|
|
201
|
+
reads: z.ZodArray<z.ZodObject<{
|
|
202
|
+
agent: z.ZodString;
|
|
203
|
+
file: z.ZodString;
|
|
204
|
+
at: z.ZodISODateTime;
|
|
205
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
206
|
+
}, z.core.$strip>>;
|
|
207
|
+
waits: z.ZodArray<z.ZodObject<{
|
|
208
|
+
waiter: z.ZodString;
|
|
209
|
+
on: z.ZodString;
|
|
210
|
+
since: z.ZodISODateTime;
|
|
211
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
212
|
+
}, z.core.$strip>>;
|
|
213
|
+
reports: z.ZodArray<z.ZodObject<{
|
|
214
|
+
agent: z.ZodString;
|
|
215
|
+
at: z.ZodISODateTime;
|
|
216
|
+
text: z.ZodString;
|
|
217
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
218
|
+
}, z.core.$strip>>;
|
|
219
|
+
questions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
220
|
+
id: z.ZodString;
|
|
221
|
+
agent: z.ZodString;
|
|
222
|
+
at: z.ZodISODateTime;
|
|
223
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
224
|
+
question: z.ZodString;
|
|
225
|
+
header: z.ZodString;
|
|
226
|
+
options: z.ZodArray<z.ZodObject<{
|
|
227
|
+
label: z.ZodString;
|
|
228
|
+
description: z.ZodString;
|
|
229
|
+
}, z.core.$strip>>;
|
|
230
|
+
multiSelect: z.ZodBoolean;
|
|
231
|
+
}, z.core.$strip>>;
|
|
232
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
233
|
+
}, z.core.$strip>>>;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
/** The records that changed, each replacing the one with the same key. */
|
|
236
|
+
export declare const FactUpsertSchema: z.ZodObject<{
|
|
237
|
+
session: z.ZodOptional<z.ZodObject<{
|
|
238
|
+
id: z.ZodString;
|
|
239
|
+
source: z.ZodEnum<{
|
|
240
|
+
"claude-code": "claude-code";
|
|
241
|
+
}>;
|
|
242
|
+
lead: z.ZodString;
|
|
243
|
+
title: z.ZodNullable<z.ZodString>;
|
|
244
|
+
titleFrom: z.ZodEnum<{
|
|
245
|
+
branch: "branch";
|
|
246
|
+
source: "source";
|
|
247
|
+
}>;
|
|
248
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
249
|
+
checkout: z.ZodOptional<z.ZodString>;
|
|
250
|
+
lastActive: z.ZodISODateTime;
|
|
251
|
+
status: z.ZodEnum<{
|
|
252
|
+
active: "active";
|
|
253
|
+
idle: "idle";
|
|
254
|
+
}>;
|
|
255
|
+
lights: z.ZodEnum<{
|
|
256
|
+
off: "off";
|
|
257
|
+
on: "on";
|
|
258
|
+
}>;
|
|
259
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
260
|
+
}, z.core.$strip>>;
|
|
261
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
262
|
+
id: z.ZodString;
|
|
263
|
+
source: z.ZodEnum<{
|
|
264
|
+
"claude-code": "claude-code";
|
|
265
|
+
}>;
|
|
266
|
+
session: z.ZodString;
|
|
267
|
+
startedBy: z.ZodNullable<z.ZodString>;
|
|
268
|
+
agentType: z.ZodNullable<z.ZodString>;
|
|
269
|
+
task: z.ZodNullable<z.ZodString>;
|
|
270
|
+
status: z.ZodEnum<{
|
|
271
|
+
done: "done";
|
|
272
|
+
failed: "failed";
|
|
273
|
+
idle: "idle";
|
|
274
|
+
stalled: "stalled";
|
|
275
|
+
stopped: "stopped";
|
|
276
|
+
working: "working";
|
|
277
|
+
}>;
|
|
278
|
+
statusSince: z.ZodISODateTime;
|
|
279
|
+
lastActive: z.ZodISODateTime;
|
|
280
|
+
doing: z.ZodNullable<z.ZodObject<{
|
|
281
|
+
kind: z.ZodEnum<{
|
|
282
|
+
read: "read";
|
|
283
|
+
run: "run";
|
|
284
|
+
search: "search";
|
|
285
|
+
talk: "talk";
|
|
286
|
+
write: "write";
|
|
287
|
+
}>;
|
|
288
|
+
file: z.ZodOptional<z.ZodString>;
|
|
289
|
+
since: z.ZodISODateTime;
|
|
290
|
+
}, z.core.$strip>>;
|
|
291
|
+
usage: z.ZodNullable<z.ZodObject<{
|
|
292
|
+
input: z.ZodNumber;
|
|
293
|
+
cacheWrite: z.ZodNumber;
|
|
294
|
+
cacheWrite1h: z.ZodNumber;
|
|
295
|
+
cacheRead: z.ZodNumber;
|
|
296
|
+
output: z.ZodNumber;
|
|
297
|
+
model: z.ZodString;
|
|
298
|
+
context: z.ZodNumber;
|
|
299
|
+
over100k: z.ZodObject<{
|
|
300
|
+
input: z.ZodNumber;
|
|
301
|
+
cacheWrite: z.ZodNumber;
|
|
302
|
+
cacheWrite1h: z.ZodNumber;
|
|
303
|
+
cacheRead: z.ZodNumber;
|
|
304
|
+
output: z.ZodNumber;
|
|
305
|
+
}, z.core.$strip>;
|
|
306
|
+
at: z.ZodISODateTime;
|
|
307
|
+
}, z.core.$strip>>;
|
|
308
|
+
checkout: z.ZodOptional<z.ZodString>;
|
|
309
|
+
branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
310
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
311
|
+
}, z.core.$strip>>>;
|
|
312
|
+
edits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
313
|
+
agent: z.ZodString;
|
|
314
|
+
file: z.ZodString;
|
|
315
|
+
at: z.ZodISODateTime;
|
|
316
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
317
|
+
}, z.core.$strip>>>;
|
|
318
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
319
|
+
agent: z.ZodString;
|
|
320
|
+
file: z.ZodString;
|
|
321
|
+
at: z.ZodISODateTime;
|
|
322
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
323
|
+
}, z.core.$strip>>>;
|
|
324
|
+
waits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
325
|
+
waiter: z.ZodString;
|
|
326
|
+
on: z.ZodString;
|
|
327
|
+
since: z.ZodISODateTime;
|
|
328
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
329
|
+
}, z.core.$strip>>>;
|
|
330
|
+
reports: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
331
|
+
agent: z.ZodString;
|
|
332
|
+
at: z.ZodISODateTime;
|
|
333
|
+
text: z.ZodString;
|
|
334
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
335
|
+
}, z.core.$strip>>>;
|
|
336
|
+
questions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
337
|
+
id: z.ZodString;
|
|
338
|
+
agent: z.ZodString;
|
|
339
|
+
at: z.ZodISODateTime;
|
|
340
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
341
|
+
question: z.ZodString;
|
|
342
|
+
header: z.ZodString;
|
|
343
|
+
options: z.ZodArray<z.ZodObject<{
|
|
344
|
+
label: z.ZodString;
|
|
345
|
+
description: z.ZodString;
|
|
346
|
+
}, z.core.$strip>>;
|
|
347
|
+
multiSelect: z.ZodBoolean;
|
|
348
|
+
}, z.core.$strip>>;
|
|
349
|
+
extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
350
|
+
}, z.core.$strip>>>;
|
|
351
|
+
}, z.core.$strip>;
|
|
352
|
+
/**
|
|
353
|
+
* The keys of records that went away: an agent by its id, an edit or read by agent and file, a
|
|
354
|
+
* wait by waiter and on, a report by its agent, a question by its id. The session itself goes with
|
|
355
|
+
* the connection.
|
|
356
|
+
*/
|
|
357
|
+
export declare const FactRemoveSchema: z.ZodObject<{
|
|
358
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
359
|
+
edits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
360
|
+
agent: z.ZodString;
|
|
361
|
+
file: z.ZodString;
|
|
362
|
+
}, z.core.$strip>>>;
|
|
363
|
+
reads: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
364
|
+
agent: z.ZodString;
|
|
365
|
+
file: z.ZodString;
|
|
366
|
+
}, z.core.$strip>>>;
|
|
367
|
+
waits: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
368
|
+
waiter: z.ZodString;
|
|
369
|
+
on: z.ZodString;
|
|
370
|
+
}, z.core.$strip>>>;
|
|
371
|
+
reports: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
372
|
+
questions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
373
|
+
}, z.core.$strip>;
|
|
374
|
+
export type Source = z.infer<typeof SourceSchema>;
|
|
375
|
+
export type SessionFact = z.infer<typeof SessionFactSchema>;
|
|
376
|
+
export type AgentFact = z.infer<typeof AgentFactSchema>;
|
|
377
|
+
export type FileFact = z.infer<typeof FileFactSchema>;
|
|
378
|
+
export type WaitFact = z.infer<typeof WaitFactSchema>;
|
|
379
|
+
export type ReportFact = z.infer<typeof ReportFactSchema>;
|
|
380
|
+
export type QuestionFact = z.infer<typeof QuestionFactSchema>;
|
|
381
|
+
export type Facts = z.infer<typeof FactsSchema>;
|
|
382
|
+
export type FactUpsert = z.infer<typeof FactUpsertSchema>;
|
|
383
|
+
export type FactRemove = z.infer<typeof FactRemoveSchema>;
|
package/dist/facts.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// One session's facts, as its data layer reports them: v1's office model minus everything derived
|
|
3
|
+
// (rooms, roles, meaning) and minus what the hello already says (the owner, the project).
|
|
4
|
+
/** ISO time, with Z or an offset. */
|
|
5
|
+
const Time = z.iso.datetime({ offset: true });
|
|
6
|
+
/** Tool-specific detail that views never rely on. */
|
|
7
|
+
const Extra = z.record(z.string(), z.unknown()).optional();
|
|
8
|
+
export const SourceSchema = z.enum(["claude-code"]);
|
|
9
|
+
export const SessionFactSchema = z.object({
|
|
10
|
+
id: z.string().min(1),
|
|
11
|
+
source: SourceSchema,
|
|
12
|
+
lead: z.string().min(1),
|
|
13
|
+
title: z.string().nullable(),
|
|
14
|
+
titleFrom: z.enum(["source", "branch"]),
|
|
15
|
+
branch: z.string().nullable(),
|
|
16
|
+
checkout: z.string().optional(),
|
|
17
|
+
lastActive: Time,
|
|
18
|
+
status: z.enum(["active", "idle"]),
|
|
19
|
+
lights: z.enum(["on", "off"]),
|
|
20
|
+
extra: Extra,
|
|
21
|
+
});
|
|
22
|
+
const TokenCount = z.number().int().nonnegative();
|
|
23
|
+
const TokenCounts = z.object({
|
|
24
|
+
input: TokenCount,
|
|
25
|
+
cacheWrite: TokenCount,
|
|
26
|
+
cacheWrite1h: TokenCount,
|
|
27
|
+
cacheRead: TokenCount,
|
|
28
|
+
output: TokenCount,
|
|
29
|
+
});
|
|
30
|
+
export const AgentFactSchema = z.object({
|
|
31
|
+
id: z.string().min(1),
|
|
32
|
+
source: SourceSchema,
|
|
33
|
+
session: z.string().min(1),
|
|
34
|
+
startedBy: z.string().min(1).nullable(),
|
|
35
|
+
agentType: z.string().nullable(),
|
|
36
|
+
task: z.string().nullable(),
|
|
37
|
+
status: z.enum(["working", "idle", "done", "stalled", "stopped", "failed"]),
|
|
38
|
+
statusSince: Time,
|
|
39
|
+
lastActive: Time,
|
|
40
|
+
doing: z
|
|
41
|
+
.object({
|
|
42
|
+
kind: z.enum(["write", "read", "run", "search", "talk"]),
|
|
43
|
+
file: z.string().optional(),
|
|
44
|
+
since: Time,
|
|
45
|
+
})
|
|
46
|
+
.nullable(),
|
|
47
|
+
usage: TokenCounts.extend({
|
|
48
|
+
model: z.string().min(1),
|
|
49
|
+
context: TokenCount,
|
|
50
|
+
over100k: TokenCounts,
|
|
51
|
+
at: Time,
|
|
52
|
+
}).nullable(),
|
|
53
|
+
checkout: z.string().optional(),
|
|
54
|
+
branch: z.string().nullable().optional(),
|
|
55
|
+
extra: Extra,
|
|
56
|
+
});
|
|
57
|
+
/** An edit or a read: `file` is relative to the repo root, with forward slashes. */
|
|
58
|
+
export const FileFactSchema = z.object({
|
|
59
|
+
agent: z.string().min(1),
|
|
60
|
+
file: z.string().min(1),
|
|
61
|
+
at: Time,
|
|
62
|
+
extra: Extra,
|
|
63
|
+
});
|
|
64
|
+
export const WaitFactSchema = z.object({
|
|
65
|
+
waiter: z.string().min(1),
|
|
66
|
+
on: z.string().min(1),
|
|
67
|
+
since: Time,
|
|
68
|
+
extra: Extra,
|
|
69
|
+
});
|
|
70
|
+
export const ReportFactSchema = z.object({
|
|
71
|
+
agent: z.string().min(1),
|
|
72
|
+
at: Time,
|
|
73
|
+
text: z.string(),
|
|
74
|
+
extra: Extra,
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* A question an agent asked its owner, open until it is answered, so the floor can show it and the
|
|
78
|
+
* owner can answer it there. One of the named cases of session-derived text leaving a machine: the
|
|
79
|
+
* server keeps it only for the retention period. `id` is the tool call's own id.
|
|
80
|
+
*/
|
|
81
|
+
export const QuestionFactSchema = z.object({
|
|
82
|
+
id: z.string().min(1),
|
|
83
|
+
agent: z.string().min(1),
|
|
84
|
+
at: Time,
|
|
85
|
+
questions: z
|
|
86
|
+
.array(z.object({
|
|
87
|
+
question: z.string().min(1),
|
|
88
|
+
header: z.string(),
|
|
89
|
+
options: z.array(z.object({ label: z.string().min(1), description: z.string() })),
|
|
90
|
+
multiSelect: z.boolean(),
|
|
91
|
+
}))
|
|
92
|
+
.min(1),
|
|
93
|
+
extra: Extra,
|
|
94
|
+
});
|
|
95
|
+
export const FactsSchema = z.object({
|
|
96
|
+
session: SessionFactSchema,
|
|
97
|
+
agents: z.array(AgentFactSchema),
|
|
98
|
+
edits: z.array(FileFactSchema),
|
|
99
|
+
reads: z.array(FileFactSchema),
|
|
100
|
+
waits: z.array(WaitFactSchema),
|
|
101
|
+
reports: z.array(ReportFactSchema),
|
|
102
|
+
/** Absent from a data layer that doesn't report questions, which is the same as none. */
|
|
103
|
+
questions: z.array(QuestionFactSchema).optional(),
|
|
104
|
+
});
|
|
105
|
+
/** The records that changed, each replacing the one with the same key. */
|
|
106
|
+
export const FactUpsertSchema = z.object({
|
|
107
|
+
session: SessionFactSchema.optional(),
|
|
108
|
+
agents: z.array(AgentFactSchema).optional(),
|
|
109
|
+
edits: z.array(FileFactSchema).optional(),
|
|
110
|
+
reads: z.array(FileFactSchema).optional(),
|
|
111
|
+
waits: z.array(WaitFactSchema).optional(),
|
|
112
|
+
reports: z.array(ReportFactSchema).optional(),
|
|
113
|
+
questions: z.array(QuestionFactSchema).optional(),
|
|
114
|
+
});
|
|
115
|
+
const FileKey = FileFactSchema.pick({ agent: true, file: true });
|
|
116
|
+
/**
|
|
117
|
+
* The keys of records that went away: an agent by its id, an edit or read by agent and file, a
|
|
118
|
+
* wait by waiter and on, a report by its agent, a question by its id. The session itself goes with
|
|
119
|
+
* the connection.
|
|
120
|
+
*/
|
|
121
|
+
export const FactRemoveSchema = z.object({
|
|
122
|
+
agents: z.array(z.string().min(1)).optional(),
|
|
123
|
+
edits: z.array(FileKey).optional(),
|
|
124
|
+
reads: z.array(FileKey).optional(),
|
|
125
|
+
waits: z.array(WaitFactSchema.pick({ waiter: true, on: true })).optional(),
|
|
126
|
+
reports: z.array(z.string().min(1)).optional(),
|
|
127
|
+
questions: z.array(z.string().min(1)).optional(),
|
|
128
|
+
});
|
|
129
|
+
//# sourceMappingURL=facts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facts.js","sourceRoot":"","sources":["../src/facts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,kGAAkG;AAClG,0FAA0F;AAE1F,qCAAqC;AACrC,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAE9C,qDAAqD;AACrD,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO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