sidekick-shared 0.22.0 → 0.23.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/README.md +51 -43
- package/dist/accountRegistry.d.ts +2 -0
- package/dist/accountStatus.d.ts +1 -0
- package/dist/accountStatus.js +6 -0
- package/dist/accounts.js +2 -0
- package/dist/aggregation/EventAggregator.d.ts +32 -1
- package/dist/aggregation/EventAggregator.js +238 -25
- package/dist/aggregation/snapshot.js +1 -1
- package/dist/aggregation/types.d.ts +23 -1
- package/dist/analytics/codeImpact.d.ts +20 -0
- package/dist/analytics/codeImpact.js +21 -0
- package/dist/analytics/compactionLedger.d.ts +11 -0
- package/dist/analytics/compactionLedger.js +31 -0
- package/dist/analytics/qualityScore.d.ts +26 -0
- package/dist/analytics/qualityScore.js +115 -0
- package/dist/codexProfiles.js +2 -0
- package/dist/context/composer.d.ts +3 -2
- package/dist/context/composer.js +5 -5
- package/dist/doctor.d.ts +55 -0
- package/dist/doctor.js +244 -0
- package/dist/errorHistory.d.ts +32 -0
- package/dist/errorHistory.js +94 -0
- package/dist/extractors/errorTaxonomy.d.ts +6 -0
- package/dist/extractors/errorTaxonomy.js +47 -0
- package/dist/extractors/toolCall.d.ts +9 -0
- package/dist/extractors/toolCall.js +79 -0
- package/dist/handoffUrl.d.ts +7 -0
- package/dist/handoffUrl.js +26 -0
- package/dist/index.d.ts +32 -9
- package/dist/index.js +62 -24
- package/dist/parsers/codexParser.js +13 -0
- package/dist/parsers/openCodeParser.js +13 -0
- package/dist/parsers/planExtractor.js +17 -6
- package/dist/paths.d.ts +10 -0
- package/dist/paths.js +18 -5
- package/dist/projectMigration.d.ts +23 -0
- package/dist/projectMigration.js +95 -0
- package/dist/providers/codexDatabase.d.ts +1 -11
- package/dist/providers/openCodeDatabase.d.ts +1 -31
- package/dist/providers/openCodeDatabase.js +9 -8
- package/dist/providers/types.d.ts +1 -0
- package/dist/readers/decisions.d.ts +2 -1
- package/dist/readers/decisions.js +2 -4
- package/dist/readers/handoff.d.ts +2 -1
- package/dist/readers/handoff.js +13 -8
- package/dist/readers/helpers.d.ts +3 -0
- package/dist/readers/helpers.js +12 -0
- package/dist/readers/notes.d.ts +2 -1
- package/dist/readers/notes.js +2 -4
- package/dist/readers/plans.js +1 -1
- package/dist/readers/tasks.d.ts +2 -1
- package/dist/readers/tasks.js +2 -4
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +10 -1
- package/dist/schemas/observedSessionV1.d.ts +499 -0
- package/dist/schemas/observedSessionV1.js +69 -0
- package/dist/schemas/sessionEvent.d.ts +13 -0
- package/dist/schemas/sessionEvent.js +19 -0
- package/dist/search/sessionSearch.d.ts +2 -2
- package/dist/search/sessionSearch.js +2 -3
- package/dist/sessionMonitor.d.ts +29 -0
- package/dist/sessionMonitor.js +71 -0
- package/dist/statusline/BurnRateCalculator.d.ts +14 -0
- package/dist/statusline/BurnRateCalculator.js +45 -0
- package/dist/statusline/formatter.d.ts +16 -0
- package/dist/statusline/formatter.js +77 -0
- package/dist/statusline/index.d.ts +7 -0
- package/dist/statusline/index.js +13 -0
- package/dist/types/codex.d.ts +2 -0
- package/dist/types/historicalData.d.ts +35 -1
- package/dist/types/historicalData.js +6 -2
- package/dist/types/observedSessionV1.d.ts +70 -0
- package/dist/types/observedSessionV1.js +185 -0
- package/dist/types/opencode.d.ts +1 -0
- package/dist/types/sessionEvent.d.ts +18 -1
- package/dist/watchers/eventBridge.js +1 -0
- package/dist/watchers/types.d.ts +5 -0
- package/dist/writers/atomic.d.ts +4 -0
- package/dist/writers/atomic.js +113 -0
- package/dist/writers/decisions.d.ts +12 -0
- package/dist/writers/decisions.js +88 -0
- package/dist/writers/notes.d.ts +8 -0
- package/dist/writers/notes.js +82 -0
- package/dist/writers/tasks.d.ts +6 -0
- package/dist/writers/tasks.js +100 -0
- package/package.json +5 -1
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const observationProvenanceV1Schema: z.ZodEnum<{
|
|
3
|
+
reported: "reported";
|
|
4
|
+
estimated: "estimated";
|
|
5
|
+
inferred: "inferred";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const sessionEvidenceRefV1Schema: z.ZodObject<{
|
|
8
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
9
|
+
provider: z.ZodEnum<{
|
|
10
|
+
"claude-code": "claude-code";
|
|
11
|
+
codex: "codex";
|
|
12
|
+
opencode: "opencode";
|
|
13
|
+
}>;
|
|
14
|
+
sessionId: z.ZodString;
|
|
15
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
16
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
18
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const observedValueV1Schema: <T extends z.ZodType>(value: T) => z.ZodObject<{
|
|
21
|
+
value: T;
|
|
22
|
+
provenance: z.ZodEnum<{
|
|
23
|
+
reported: "reported";
|
|
24
|
+
estimated: "estimated";
|
|
25
|
+
inferred: "inferred";
|
|
26
|
+
}>;
|
|
27
|
+
confidence: z.ZodNumber;
|
|
28
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
29
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
30
|
+
provider: z.ZodEnum<{
|
|
31
|
+
"claude-code": "claude-code";
|
|
32
|
+
codex: "codex";
|
|
33
|
+
opencode: "opencode";
|
|
34
|
+
}>;
|
|
35
|
+
sessionId: z.ZodString;
|
|
36
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
37
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
39
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export declare const pendingUserRequestV1Schema: z.ZodObject<{
|
|
43
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
provider: z.ZodEnum<{
|
|
46
|
+
"claude-code": "claude-code";
|
|
47
|
+
codex: "codex";
|
|
48
|
+
opencode: "opencode";
|
|
49
|
+
}>;
|
|
50
|
+
sessionId: z.ZodString;
|
|
51
|
+
kind: z.ZodObject<{
|
|
52
|
+
value: z.ZodEnum<{
|
|
53
|
+
question: "question";
|
|
54
|
+
prompt_response: "prompt_response";
|
|
55
|
+
tool_approval: "tool_approval";
|
|
56
|
+
}>;
|
|
57
|
+
provenance: z.ZodEnum<{
|
|
58
|
+
reported: "reported";
|
|
59
|
+
estimated: "estimated";
|
|
60
|
+
inferred: "inferred";
|
|
61
|
+
}>;
|
|
62
|
+
confidence: z.ZodNumber;
|
|
63
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
64
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
65
|
+
provider: z.ZodEnum<{
|
|
66
|
+
"claude-code": "claude-code";
|
|
67
|
+
codex: "codex";
|
|
68
|
+
opencode: "opencode";
|
|
69
|
+
}>;
|
|
70
|
+
sessionId: z.ZodString;
|
|
71
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
72
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
74
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
requestedAt: z.ZodObject<{
|
|
78
|
+
value: z.ZodString;
|
|
79
|
+
provenance: z.ZodEnum<{
|
|
80
|
+
reported: "reported";
|
|
81
|
+
estimated: "estimated";
|
|
82
|
+
inferred: "inferred";
|
|
83
|
+
}>;
|
|
84
|
+
confidence: z.ZodNumber;
|
|
85
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
86
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
87
|
+
provider: z.ZodEnum<{
|
|
88
|
+
"claude-code": "claude-code";
|
|
89
|
+
codex: "codex";
|
|
90
|
+
opencode: "opencode";
|
|
91
|
+
}>;
|
|
92
|
+
sessionId: z.ZodString;
|
|
93
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
94
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
96
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.core.$strip>>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
prompt: z.ZodObject<{
|
|
100
|
+
value: z.ZodNullable<z.ZodString>;
|
|
101
|
+
provenance: z.ZodEnum<{
|
|
102
|
+
reported: "reported";
|
|
103
|
+
estimated: "estimated";
|
|
104
|
+
inferred: "inferred";
|
|
105
|
+
}>;
|
|
106
|
+
confidence: z.ZodNumber;
|
|
107
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
108
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
109
|
+
provider: z.ZodEnum<{
|
|
110
|
+
"claude-code": "claude-code";
|
|
111
|
+
codex: "codex";
|
|
112
|
+
opencode: "opencode";
|
|
113
|
+
}>;
|
|
114
|
+
sessionId: z.ZodString;
|
|
115
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
116
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
118
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
export declare const observedAgentSessionV1Schema: z.ZodObject<{
|
|
123
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
124
|
+
identity: z.ZodObject<{
|
|
125
|
+
provider: z.ZodEnum<{
|
|
126
|
+
"claude-code": "claude-code";
|
|
127
|
+
codex: "codex";
|
|
128
|
+
opencode: "opencode";
|
|
129
|
+
}>;
|
|
130
|
+
sessionId: z.ZodString;
|
|
131
|
+
sourcePath: z.ZodString;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
cwd: z.ZodObject<{
|
|
134
|
+
value: z.ZodString;
|
|
135
|
+
provenance: z.ZodEnum<{
|
|
136
|
+
reported: "reported";
|
|
137
|
+
estimated: "estimated";
|
|
138
|
+
inferred: "inferred";
|
|
139
|
+
}>;
|
|
140
|
+
confidence: z.ZodNumber;
|
|
141
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
142
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
143
|
+
provider: z.ZodEnum<{
|
|
144
|
+
"claude-code": "claude-code";
|
|
145
|
+
codex: "codex";
|
|
146
|
+
opencode: "opencode";
|
|
147
|
+
}>;
|
|
148
|
+
sessionId: z.ZodString;
|
|
149
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
150
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
152
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, z.core.$strip>>;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
model: z.ZodObject<{
|
|
156
|
+
value: z.ZodNullable<z.ZodString>;
|
|
157
|
+
provenance: z.ZodEnum<{
|
|
158
|
+
reported: "reported";
|
|
159
|
+
estimated: "estimated";
|
|
160
|
+
inferred: "inferred";
|
|
161
|
+
}>;
|
|
162
|
+
confidence: z.ZodNumber;
|
|
163
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
164
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
165
|
+
provider: z.ZodEnum<{
|
|
166
|
+
"claude-code": "claude-code";
|
|
167
|
+
codex: "codex";
|
|
168
|
+
opencode: "opencode";
|
|
169
|
+
}>;
|
|
170
|
+
sessionId: z.ZodString;
|
|
171
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
172
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
173
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
174
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
175
|
+
}, z.core.$strip>>;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
|
+
activity: z.ZodObject<{
|
|
178
|
+
value: z.ZodEnum<{
|
|
179
|
+
unknown: "unknown";
|
|
180
|
+
active: "active";
|
|
181
|
+
idle: "idle";
|
|
182
|
+
ended: "ended";
|
|
183
|
+
}>;
|
|
184
|
+
provenance: z.ZodEnum<{
|
|
185
|
+
reported: "reported";
|
|
186
|
+
estimated: "estimated";
|
|
187
|
+
inferred: "inferred";
|
|
188
|
+
}>;
|
|
189
|
+
confidence: z.ZodNumber;
|
|
190
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
191
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
192
|
+
provider: z.ZodEnum<{
|
|
193
|
+
"claude-code": "claude-code";
|
|
194
|
+
codex: "codex";
|
|
195
|
+
opencode: "opencode";
|
|
196
|
+
}>;
|
|
197
|
+
sessionId: z.ZodString;
|
|
198
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
199
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
200
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
201
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
202
|
+
}, z.core.$strip>>;
|
|
203
|
+
}, z.core.$strip>;
|
|
204
|
+
usage: z.ZodObject<{
|
|
205
|
+
inputTokens: z.ZodObject<{
|
|
206
|
+
value: z.ZodNumber;
|
|
207
|
+
provenance: z.ZodEnum<{
|
|
208
|
+
reported: "reported";
|
|
209
|
+
estimated: "estimated";
|
|
210
|
+
inferred: "inferred";
|
|
211
|
+
}>;
|
|
212
|
+
confidence: z.ZodNumber;
|
|
213
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
214
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
215
|
+
provider: z.ZodEnum<{
|
|
216
|
+
"claude-code": "claude-code";
|
|
217
|
+
codex: "codex";
|
|
218
|
+
opencode: "opencode";
|
|
219
|
+
}>;
|
|
220
|
+
sessionId: z.ZodString;
|
|
221
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
222
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
224
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
225
|
+
}, z.core.$strip>>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
outputTokens: z.ZodObject<{
|
|
228
|
+
value: z.ZodNumber;
|
|
229
|
+
provenance: z.ZodEnum<{
|
|
230
|
+
reported: "reported";
|
|
231
|
+
estimated: "estimated";
|
|
232
|
+
inferred: "inferred";
|
|
233
|
+
}>;
|
|
234
|
+
confidence: z.ZodNumber;
|
|
235
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
236
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
237
|
+
provider: z.ZodEnum<{
|
|
238
|
+
"claude-code": "claude-code";
|
|
239
|
+
codex: "codex";
|
|
240
|
+
opencode: "opencode";
|
|
241
|
+
}>;
|
|
242
|
+
sessionId: z.ZodString;
|
|
243
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
244
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
245
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
246
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
247
|
+
}, z.core.$strip>>;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
cacheReadTokens: z.ZodObject<{
|
|
250
|
+
value: z.ZodNumber;
|
|
251
|
+
provenance: z.ZodEnum<{
|
|
252
|
+
reported: "reported";
|
|
253
|
+
estimated: "estimated";
|
|
254
|
+
inferred: "inferred";
|
|
255
|
+
}>;
|
|
256
|
+
confidence: z.ZodNumber;
|
|
257
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
258
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
259
|
+
provider: z.ZodEnum<{
|
|
260
|
+
"claude-code": "claude-code";
|
|
261
|
+
codex: "codex";
|
|
262
|
+
opencode: "opencode";
|
|
263
|
+
}>;
|
|
264
|
+
sessionId: z.ZodString;
|
|
265
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
266
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
267
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
268
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
269
|
+
}, z.core.$strip>>;
|
|
270
|
+
}, z.core.$strip>;
|
|
271
|
+
cacheWriteTokens: z.ZodObject<{
|
|
272
|
+
value: z.ZodNumber;
|
|
273
|
+
provenance: z.ZodEnum<{
|
|
274
|
+
reported: "reported";
|
|
275
|
+
estimated: "estimated";
|
|
276
|
+
inferred: "inferred";
|
|
277
|
+
}>;
|
|
278
|
+
confidence: z.ZodNumber;
|
|
279
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
280
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
281
|
+
provider: z.ZodEnum<{
|
|
282
|
+
"claude-code": "claude-code";
|
|
283
|
+
codex: "codex";
|
|
284
|
+
opencode: "opencode";
|
|
285
|
+
}>;
|
|
286
|
+
sessionId: z.ZodString;
|
|
287
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
288
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
289
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
290
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
291
|
+
}, z.core.$strip>>;
|
|
292
|
+
}, z.core.$strip>;
|
|
293
|
+
costUsd: z.ZodObject<{
|
|
294
|
+
value: z.ZodNumber;
|
|
295
|
+
provenance: z.ZodEnum<{
|
|
296
|
+
reported: "reported";
|
|
297
|
+
estimated: "estimated";
|
|
298
|
+
inferred: "inferred";
|
|
299
|
+
}>;
|
|
300
|
+
confidence: z.ZodNumber;
|
|
301
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
302
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
303
|
+
provider: z.ZodEnum<{
|
|
304
|
+
"claude-code": "claude-code";
|
|
305
|
+
codex: "codex";
|
|
306
|
+
opencode: "opencode";
|
|
307
|
+
}>;
|
|
308
|
+
sessionId: z.ZodString;
|
|
309
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
310
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
311
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
312
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
313
|
+
}, z.core.$strip>>;
|
|
314
|
+
}, z.core.$strip>;
|
|
315
|
+
}, z.core.$strip>;
|
|
316
|
+
pendingUserRequest: z.ZodNullable<z.ZodObject<{
|
|
317
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
318
|
+
id: z.ZodString;
|
|
319
|
+
provider: z.ZodEnum<{
|
|
320
|
+
"claude-code": "claude-code";
|
|
321
|
+
codex: "codex";
|
|
322
|
+
opencode: "opencode";
|
|
323
|
+
}>;
|
|
324
|
+
sessionId: z.ZodString;
|
|
325
|
+
kind: z.ZodObject<{
|
|
326
|
+
value: z.ZodEnum<{
|
|
327
|
+
question: "question";
|
|
328
|
+
prompt_response: "prompt_response";
|
|
329
|
+
tool_approval: "tool_approval";
|
|
330
|
+
}>;
|
|
331
|
+
provenance: z.ZodEnum<{
|
|
332
|
+
reported: "reported";
|
|
333
|
+
estimated: "estimated";
|
|
334
|
+
inferred: "inferred";
|
|
335
|
+
}>;
|
|
336
|
+
confidence: z.ZodNumber;
|
|
337
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
338
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
339
|
+
provider: z.ZodEnum<{
|
|
340
|
+
"claude-code": "claude-code";
|
|
341
|
+
codex: "codex";
|
|
342
|
+
opencode: "opencode";
|
|
343
|
+
}>;
|
|
344
|
+
sessionId: z.ZodString;
|
|
345
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
346
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
347
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
348
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
349
|
+
}, z.core.$strip>>;
|
|
350
|
+
}, z.core.$strip>;
|
|
351
|
+
requestedAt: z.ZodObject<{
|
|
352
|
+
value: z.ZodString;
|
|
353
|
+
provenance: z.ZodEnum<{
|
|
354
|
+
reported: "reported";
|
|
355
|
+
estimated: "estimated";
|
|
356
|
+
inferred: "inferred";
|
|
357
|
+
}>;
|
|
358
|
+
confidence: z.ZodNumber;
|
|
359
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
360
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
361
|
+
provider: z.ZodEnum<{
|
|
362
|
+
"claude-code": "claude-code";
|
|
363
|
+
codex: "codex";
|
|
364
|
+
opencode: "opencode";
|
|
365
|
+
}>;
|
|
366
|
+
sessionId: z.ZodString;
|
|
367
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
368
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
369
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
370
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
371
|
+
}, z.core.$strip>>;
|
|
372
|
+
}, z.core.$strip>;
|
|
373
|
+
prompt: z.ZodObject<{
|
|
374
|
+
value: z.ZodNullable<z.ZodString>;
|
|
375
|
+
provenance: z.ZodEnum<{
|
|
376
|
+
reported: "reported";
|
|
377
|
+
estimated: "estimated";
|
|
378
|
+
inferred: "inferred";
|
|
379
|
+
}>;
|
|
380
|
+
confidence: z.ZodNumber;
|
|
381
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
382
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
383
|
+
provider: z.ZodEnum<{
|
|
384
|
+
"claude-code": "claude-code";
|
|
385
|
+
codex: "codex";
|
|
386
|
+
opencode: "opencode";
|
|
387
|
+
}>;
|
|
388
|
+
sessionId: z.ZodString;
|
|
389
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
390
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
391
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
392
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
393
|
+
}, z.core.$strip>>;
|
|
394
|
+
}, z.core.$strip>;
|
|
395
|
+
}, z.core.$strip>>;
|
|
396
|
+
observedAt: z.ZodString;
|
|
397
|
+
}, z.core.$strip>;
|
|
398
|
+
export declare const providerCapabilitiesV1Schema: z.ZodObject<{
|
|
399
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
400
|
+
provider: z.ZodEnum<{
|
|
401
|
+
"claude-code": "claude-code";
|
|
402
|
+
codex: "codex";
|
|
403
|
+
opencode: "opencode";
|
|
404
|
+
}>;
|
|
405
|
+
resume: z.ZodObject<{
|
|
406
|
+
value: z.ZodBoolean;
|
|
407
|
+
provenance: z.ZodEnum<{
|
|
408
|
+
reported: "reported";
|
|
409
|
+
estimated: "estimated";
|
|
410
|
+
inferred: "inferred";
|
|
411
|
+
}>;
|
|
412
|
+
confidence: z.ZodNumber;
|
|
413
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
414
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
415
|
+
provider: z.ZodEnum<{
|
|
416
|
+
"claude-code": "claude-code";
|
|
417
|
+
codex: "codex";
|
|
418
|
+
opencode: "opencode";
|
|
419
|
+
}>;
|
|
420
|
+
sessionId: z.ZodString;
|
|
421
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
422
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
423
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
424
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
425
|
+
}, z.core.$strip>>;
|
|
426
|
+
}, z.core.$strip>;
|
|
427
|
+
forkLineage: z.ZodObject<{
|
|
428
|
+
value: z.ZodBoolean;
|
|
429
|
+
provenance: z.ZodEnum<{
|
|
430
|
+
reported: "reported";
|
|
431
|
+
estimated: "estimated";
|
|
432
|
+
inferred: "inferred";
|
|
433
|
+
}>;
|
|
434
|
+
confidence: z.ZodNumber;
|
|
435
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
436
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
437
|
+
provider: z.ZodEnum<{
|
|
438
|
+
"claude-code": "claude-code";
|
|
439
|
+
codex: "codex";
|
|
440
|
+
opencode: "opencode";
|
|
441
|
+
}>;
|
|
442
|
+
sessionId: z.ZodString;
|
|
443
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
444
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
445
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
446
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
447
|
+
}, z.core.$strip>>;
|
|
448
|
+
}, z.core.$strip>;
|
|
449
|
+
quotaSource: z.ZodObject<{
|
|
450
|
+
value: z.ZodEnum<{
|
|
451
|
+
none: "none";
|
|
452
|
+
api: "api";
|
|
453
|
+
session: "session";
|
|
454
|
+
mixed: "mixed";
|
|
455
|
+
}>;
|
|
456
|
+
provenance: z.ZodEnum<{
|
|
457
|
+
reported: "reported";
|
|
458
|
+
estimated: "estimated";
|
|
459
|
+
inferred: "inferred";
|
|
460
|
+
}>;
|
|
461
|
+
confidence: z.ZodNumber;
|
|
462
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
463
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
464
|
+
provider: z.ZodEnum<{
|
|
465
|
+
"claude-code": "claude-code";
|
|
466
|
+
codex: "codex";
|
|
467
|
+
opencode: "opencode";
|
|
468
|
+
}>;
|
|
469
|
+
sessionId: z.ZodString;
|
|
470
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
471
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
472
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
473
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
474
|
+
}, z.core.$strip>>;
|
|
475
|
+
}, z.core.$strip>;
|
|
476
|
+
assetExtraction: z.ZodObject<{
|
|
477
|
+
value: z.ZodBoolean;
|
|
478
|
+
provenance: z.ZodEnum<{
|
|
479
|
+
reported: "reported";
|
|
480
|
+
estimated: "estimated";
|
|
481
|
+
inferred: "inferred";
|
|
482
|
+
}>;
|
|
483
|
+
confidence: z.ZodNumber;
|
|
484
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
485
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
486
|
+
provider: z.ZodEnum<{
|
|
487
|
+
"claude-code": "claude-code";
|
|
488
|
+
codex: "codex";
|
|
489
|
+
opencode: "opencode";
|
|
490
|
+
}>;
|
|
491
|
+
sessionId: z.ZodString;
|
|
492
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
493
|
+
eventIndex: z.ZodOptional<z.ZodNumber>;
|
|
494
|
+
eventId: z.ZodOptional<z.ZodString>;
|
|
495
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
496
|
+
}, z.core.$strip>>;
|
|
497
|
+
}, z.core.$strip>;
|
|
498
|
+
}, z.core.$strip>;
|
|
499
|
+
export declare const providerSessionAdapterV1Schema: z.ZodCustom<import("../types/observedSessionV1").ProviderSessionAdapterV1, import("../types/observedSessionV1").ProviderSessionAdapterV1>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.providerSessionAdapterV1Schema = exports.providerCapabilitiesV1Schema = exports.observedAgentSessionV1Schema = exports.pendingUserRequestV1Schema = exports.observedValueV1Schema = exports.sessionEvidenceRefV1Schema = exports.observationProvenanceV1Schema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.observationProvenanceV1Schema = zod_1.z.enum(['reported', 'estimated', 'inferred']);
|
|
6
|
+
exports.sessionEvidenceRefV1Schema = zod_1.z.object({
|
|
7
|
+
schemaVersion: zod_1.z.literal(1),
|
|
8
|
+
provider: zod_1.z.enum(['claude-code', 'opencode', 'codex']),
|
|
9
|
+
sessionId: zod_1.z.string().min(1),
|
|
10
|
+
sourcePath: zod_1.z.string().optional(),
|
|
11
|
+
eventIndex: zod_1.z.number().int().nonnegative().optional(),
|
|
12
|
+
eventId: zod_1.z.string().optional(),
|
|
13
|
+
timestamp: zod_1.z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
const observedValueV1Schema = (value) => zod_1.z.object({
|
|
16
|
+
value,
|
|
17
|
+
provenance: exports.observationProvenanceV1Schema,
|
|
18
|
+
confidence: zod_1.z.number().min(0).max(1),
|
|
19
|
+
evidence: zod_1.z.array(exports.sessionEvidenceRefV1Schema),
|
|
20
|
+
});
|
|
21
|
+
exports.observedValueV1Schema = observedValueV1Schema;
|
|
22
|
+
exports.pendingUserRequestV1Schema = zod_1.z.object({
|
|
23
|
+
schemaVersion: zod_1.z.literal(1),
|
|
24
|
+
id: zod_1.z.string().min(1),
|
|
25
|
+
provider: zod_1.z.enum(['claude-code', 'opencode', 'codex']),
|
|
26
|
+
sessionId: zod_1.z.string().min(1),
|
|
27
|
+
kind: (0, exports.observedValueV1Schema)(zod_1.z.enum(['prompt_response', 'tool_approval', 'question'])),
|
|
28
|
+
requestedAt: (0, exports.observedValueV1Schema)(zod_1.z.string()),
|
|
29
|
+
prompt: (0, exports.observedValueV1Schema)(zod_1.z.string().nullable()),
|
|
30
|
+
});
|
|
31
|
+
exports.observedAgentSessionV1Schema = zod_1.z.object({
|
|
32
|
+
schemaVersion: zod_1.z.literal(1),
|
|
33
|
+
identity: zod_1.z.object({
|
|
34
|
+
provider: zod_1.z.enum(['claude-code', 'opencode', 'codex']),
|
|
35
|
+
sessionId: zod_1.z.string().min(1),
|
|
36
|
+
sourcePath: zod_1.z.string(),
|
|
37
|
+
}),
|
|
38
|
+
cwd: (0, exports.observedValueV1Schema)(zod_1.z.string()),
|
|
39
|
+
model: (0, exports.observedValueV1Schema)(zod_1.z.string().nullable()),
|
|
40
|
+
activity: (0, exports.observedValueV1Schema)(zod_1.z.enum(['active', 'idle', 'ended', 'unknown'])),
|
|
41
|
+
usage: zod_1.z.object({
|
|
42
|
+
inputTokens: (0, exports.observedValueV1Schema)(zod_1.z.number().nonnegative()),
|
|
43
|
+
outputTokens: (0, exports.observedValueV1Schema)(zod_1.z.number().nonnegative()),
|
|
44
|
+
cacheReadTokens: (0, exports.observedValueV1Schema)(zod_1.z.number().nonnegative()),
|
|
45
|
+
cacheWriteTokens: (0, exports.observedValueV1Schema)(zod_1.z.number().nonnegative()),
|
|
46
|
+
costUsd: (0, exports.observedValueV1Schema)(zod_1.z.number().nonnegative()),
|
|
47
|
+
}),
|
|
48
|
+
pendingUserRequest: exports.pendingUserRequestV1Schema.nullable(),
|
|
49
|
+
observedAt: zod_1.z.string(),
|
|
50
|
+
});
|
|
51
|
+
exports.providerCapabilitiesV1Schema = zod_1.z.object({
|
|
52
|
+
schemaVersion: zod_1.z.literal(1),
|
|
53
|
+
provider: zod_1.z.enum(['claude-code', 'opencode', 'codex']),
|
|
54
|
+
resume: (0, exports.observedValueV1Schema)(zod_1.z.boolean()),
|
|
55
|
+
forkLineage: (0, exports.observedValueV1Schema)(zod_1.z.boolean()),
|
|
56
|
+
quotaSource: (0, exports.observedValueV1Schema)(zod_1.z.enum(['api', 'session', 'mixed', 'none'])),
|
|
57
|
+
assetExtraction: (0, exports.observedValueV1Schema)(zod_1.z.boolean()),
|
|
58
|
+
});
|
|
59
|
+
exports.providerSessionAdapterV1Schema = zod_1.z.custom((value) => {
|
|
60
|
+
if (!value || typeof value !== 'object')
|
|
61
|
+
return false;
|
|
62
|
+
const adapter = value;
|
|
63
|
+
return (adapter.schemaVersion === 1 &&
|
|
64
|
+
typeof adapter.discover === 'function' &&
|
|
65
|
+
typeof adapter.read === 'function' &&
|
|
66
|
+
typeof adapter.watch === 'function' &&
|
|
67
|
+
typeof adapter.dispose === 'function' &&
|
|
68
|
+
exports.providerCapabilitiesV1Schema.safeParse(adapter.capabilities).success);
|
|
69
|
+
}, { message: 'Invalid ProviderSessionAdapterV1 contract' });
|
|
@@ -81,6 +81,19 @@ export declare const sessionEventSchema: z.ZodObject<{
|
|
|
81
81
|
resetsAt: z.ZodNumber;
|
|
82
82
|
}, z.core.$strip>>;
|
|
83
83
|
}, z.core.$strip>>;
|
|
84
|
+
compaction: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
tokensBefore: z.ZodNumber;
|
|
86
|
+
tokensAfter: z.ZodNumber;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
providerMetadata: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
retryAttempts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
90
|
+
finishReasons: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
91
|
+
providerError: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
type: z.ZodOptional<z.ZodString>;
|
|
93
|
+
message: z.ZodOptional<z.ZodString>;
|
|
94
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
95
|
+
}, z.core.$strip>>;
|
|
96
|
+
}, z.core.$strip>>;
|
|
84
97
|
tool: z.ZodOptional<z.ZodObject<{
|
|
85
98
|
name: z.ZodString;
|
|
86
99
|
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
@@ -61,6 +61,25 @@ exports.sessionEventSchema = zod_1.z.object({
|
|
|
61
61
|
.optional(),
|
|
62
62
|
})
|
|
63
63
|
.optional(),
|
|
64
|
+
compaction: zod_1.z
|
|
65
|
+
.object({
|
|
66
|
+
tokensBefore: zod_1.z.number().nonnegative(),
|
|
67
|
+
tokensAfter: zod_1.z.number().nonnegative(),
|
|
68
|
+
})
|
|
69
|
+
.optional(),
|
|
70
|
+
providerMetadata: zod_1.z
|
|
71
|
+
.object({
|
|
72
|
+
retryAttempts: zod_1.z.array(zod_1.z.number()).optional(),
|
|
73
|
+
finishReasons: zod_1.z.array(zod_1.z.string()).optional(),
|
|
74
|
+
providerError: zod_1.z
|
|
75
|
+
.object({
|
|
76
|
+
type: zod_1.z.string().optional(),
|
|
77
|
+
message: zod_1.z.string().optional(),
|
|
78
|
+
code: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
|
|
79
|
+
})
|
|
80
|
+
.optional(),
|
|
81
|
+
})
|
|
82
|
+
.optional(),
|
|
64
83
|
tool: zod_1.z
|
|
65
84
|
.object({
|
|
66
85
|
name: zod_1.z.string(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Provider-aware cross-session search.
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { SessionProviderBase, ProviderId } from '../providers/types';
|
|
5
5
|
export interface SearchResult {
|
|
6
6
|
providerId: ProviderId;
|
|
7
7
|
projectPath: string;
|
|
@@ -10,7 +10,7 @@ export interface SearchResult {
|
|
|
10
10
|
eventType: string;
|
|
11
11
|
timestamp: string;
|
|
12
12
|
}
|
|
13
|
-
export declare function searchSessions(provider:
|
|
13
|
+
export declare function searchSessions(provider: SessionProviderBase, query: string, opts?: {
|
|
14
14
|
projectSlug?: string;
|
|
15
15
|
maxResults?: number;
|
|
16
16
|
}): Promise<SearchResult[]>;
|
|
@@ -70,9 +70,8 @@ async function searchSessions(provider, query, opts) {
|
|
|
70
70
|
}
|
|
71
71
|
// If no files found from dir scan, try findAllSessions with the folder name
|
|
72
72
|
if (sessionFiles.length === 0) {
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
sessionFiles = provider.findSessionFiles(folder.name);
|
|
73
|
+
// Let canonical directory discovery handle synthetic DB-backed paths.
|
|
74
|
+
sessionFiles = provider.findSessionsInDirectory(folder.dir);
|
|
76
75
|
}
|
|
77
76
|
for (const sessionPath of sessionFiles) {
|
|
78
77
|
if (results.length >= maxResults)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AggregatedMetrics, EventAggregatorOptions } from './aggregation/types';
|
|
2
|
+
import type { SessionProviderBase } from './providers/types';
|
|
3
|
+
import type { SessionEvent } from './types/sessionEvent';
|
|
4
|
+
export interface SessionMonitorOptions extends EventAggregatorOptions {
|
|
5
|
+
replayOnAttach?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* UI-independent session monitor for library consumers. It owns one provider
|
|
9
|
+
* reader and the canonical aggregator; hosts decide how often to call `poll()`.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SessionMonitor {
|
|
12
|
+
private readonly provider;
|
|
13
|
+
private readonly aggregator;
|
|
14
|
+
private reader;
|
|
15
|
+
private sessionPath;
|
|
16
|
+
private readonly listeners;
|
|
17
|
+
private readonly replayOnAttach;
|
|
18
|
+
constructor(provider: SessionProviderBase, options?: SessionMonitorOptions);
|
|
19
|
+
attach(sessionPath: string, replay?: boolean): AggregatedMetrics;
|
|
20
|
+
attachLatest(workspacePath: string, replay?: boolean): AggregatedMetrics | null;
|
|
21
|
+
poll(): SessionEvent[];
|
|
22
|
+
process(event: SessionEvent): void;
|
|
23
|
+
onEvent(listener: (event: SessionEvent) => void): () => void;
|
|
24
|
+
getMetrics(): AggregatedMetrics;
|
|
25
|
+
getSessionPath(): string | null;
|
|
26
|
+
reset(): void;
|
|
27
|
+
dispose(): void;
|
|
28
|
+
private consume;
|
|
29
|
+
}
|